diff --git a/docs/base.js b/docs/base.js index b1a5c8d..d63e09f 100644 --- a/docs/base.js +++ b/docs/base.js @@ -2027,7 +2027,8 @@ __file_url.hostname)&&new EventSource(__event_source).addEventListener("change", object-fit: cover; } } -`);document.adoptedStyleSheets.push(cssStyleSheet);baseLib();baseStyle("./");baseComponents("./");pageReload("./"); +`);document.adoptedStyleSheets.push(cssStyleSheet);baseLib();baseStyle("./");baseComponents("./");pageReload("./");window.addEventListener( +"load",()=>{document.body.style.visibility="visible"}); /*! Bundled license information: @ungap/create-content/esm/index.js: diff --git a/docs/base.js.map b/docs/base.js.map index 26cfde6..c6214af 100644 --- a/docs/base.js.map +++ b/docs/base.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../node_modules/highlight.js/lib/core.js", "../node_modules/color-name/index.js", "../node_modules/simple-swizzle/node_modules/is-arrayish/index.js", "../node_modules/simple-swizzle/index.js", "../node_modules/color-string/index.js", "../node_modules/color-convert/conversions.js", "../node_modules/color-convert/route.js", "../node_modules/color-convert/index.js", "../node_modules/color/index.js", "../node_modules/highlight.js/es/core.js", "../node_modules/highlight.js/es/languages/javascript.js", "../node_modules/highlight.js/es/languages/typescript.js", "../node_modules/highlight.js/es/languages/xml.js", "../node_modules/highlight.js/es/languages/shell.js", "../node_modules/highlight.js/es/languages/css.js", "../docs-src/_base.lib.ts", "../node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js", "../node_modules/@emotion/cache/node_modules/stylis/src/Enum.js", "../node_modules/@emotion/cache/node_modules/stylis/src/Utility.js", "../node_modules/@emotion/cache/node_modules/stylis/src/Tokenizer.js", "../node_modules/@emotion/cache/node_modules/stylis/src/Parser.js", "../node_modules/@emotion/cache/node_modules/stylis/src/Serializer.js", "../node_modules/@emotion/cache/node_modules/stylis/src/Middleware.js", "../node_modules/@emotion/memoize/dist/emotion-memoize.esm.js", "../node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js", "../node_modules/@emotion/hash/dist/emotion-hash.esm.js", "../node_modules/@emotion/unitless/dist/emotion-unitless.esm.js", "../node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js", "../node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js", "../node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js", "../node_modules/@emotion/css/dist/emotion-css.esm.js", "../node_modules/@nitipit/adapter/src/adapter.ts", "../node_modules/gadjet/src/style/bg-color.ts", "../node_modules/gadjet/src/style/font-fluid.ts", "../node_modules/umap/esm/index.js", "../node_modules/uparser/esm/index.js", "../node_modules/uarray/esm/index.js", "../node_modules/uwire/esm/index.js", "../node_modules/udomdiff/esm/index.js", "../node_modules/uhandlers/esm/index.js", "../node_modules/gadjet/node_modules/uhtml/esm/handlers.js", "../node_modules/@ungap/create-content/esm/index.js", "../node_modules/gadjet/node_modules/uhtml/esm/node.js", "../node_modules/gadjet/node_modules/uhtml/esm/rabbit.js", "../node_modules/gadjet/node_modules/uhtml/esm/index.js", "../node_modules/gadjet/src/ui/checkbox/checkbox.style.ts", "../node_modules/gadjet/src/ui/input/input.style.ts", "../node_modules/gadjet/src/ui/input/input.ts", "../node_modules/gadjet/src/ui/input/input-radio.style.ts", "../node_modules/gadjet/src/ui/tag/tag.style.ts", "../node_modules/gadjet/src/ui/tag/tagx.style.ts", "../node_modules/gadjet/src/ui/menu/menu.style.ts", "../node_modules/gadjet/src/ui/table/table.style.ts", "../docs-src/_ux/designToken.ts", "../src/util.ts", "../node_modules/stylis/src/Enum.js", "../node_modules/stylis/src/Utility.js", "../node_modules/stylis/src/Tokenizer.js", "../node_modules/stylis/src/Parser.js", "../node_modules/stylis/src/Serializer.js", "../src/cssProcessor/stylis.bundle.ts", "../src/adapter.ts", "../docs-src/_base.style.ts", "../node_modules/@devcapsule/deficon/src/deficon.ts", "../docs-src/_ux/style.ts", "../docs-src/_ux/ui/code-block.ts", "../docs-src/_ux/ui/blockquote.ts", "../docs-src/_ux/ui/button.ts", "../docs-src/_base.comp.ts", "../docs-src/_base.esbuild.ts", "../docs-src/styleClass.ts", "../docs-src/base.ts"], - "sourcesContent": ["/* eslint-disable no-multi-assign */\n\nfunction deepFreeze(obj) {\n if (obj instanceof Map) {\n obj.clear =\n obj.delete =\n obj.set =\n function () {\n throw new Error('map is read-only');\n };\n } else if (obj instanceof Set) {\n obj.add =\n obj.clear =\n obj.delete =\n function () {\n throw new Error('set is read-only');\n };\n }\n\n // Freeze self\n Object.freeze(obj);\n\n Object.getOwnPropertyNames(obj).forEach((name) => {\n const prop = obj[name];\n const type = typeof prop;\n\n // Freeze prop if it is an object or function and also not already frozen\n if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {\n deepFreeze(prop);\n }\n });\n\n return obj;\n}\n\n/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */\n/** @typedef {import('highlight.js').CompiledMode} CompiledMode */\n/** @implements CallbackResponse */\n\nclass Response {\n /**\n * @param {CompiledMode} mode\n */\n constructor(mode) {\n // eslint-disable-next-line no-undefined\n if (mode.data === undefined) mode.data = {};\n\n this.data = mode.data;\n this.isMatchIgnored = false;\n }\n\n ignoreMatch() {\n this.isMatchIgnored = true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {string}\n */\nfunction escapeHTML(value) {\n return value\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/**\n * performs a shallow merge of multiple objects into one\n *\n * @template T\n * @param {T} original\n * @param {Record[]} objects\n * @returns {T} a single new object\n */\nfunction inherit$1(original, ...objects) {\n /** @type Record */\n const result = Object.create(null);\n\n for (const key in original) {\n result[key] = original[key];\n }\n objects.forEach(function(obj) {\n for (const key in obj) {\n result[key] = obj[key];\n }\n });\n return /** @type {T} */ (result);\n}\n\n/**\n * @typedef {object} Renderer\n * @property {(text: string) => void} addText\n * @property {(node: Node) => void} openNode\n * @property {(node: Node) => void} closeNode\n * @property {() => string} value\n */\n\n/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */\n/** @typedef {{walk: (r: Renderer) => void}} Tree */\n/** */\n\nconst SPAN_CLOSE = '';\n\n/**\n * Determines if a node needs to be wrapped in \n *\n * @param {Node} node */\nconst emitsWrappingTags = (node) => {\n // rarely we can have a sublanguage where language is undefined\n // TODO: track down why\n return !!node.scope;\n};\n\n/**\n *\n * @param {string} name\n * @param {{prefix:string}} options\n */\nconst scopeToCSSClass = (name, { prefix }) => {\n // sub-language\n if (name.startsWith(\"language:\")) {\n return name.replace(\"language:\", \"language-\");\n }\n // tiered scope: comment.line\n if (name.includes(\".\")) {\n const pieces = name.split(\".\");\n return [\n `${prefix}${pieces.shift()}`,\n ...(pieces.map((x, i) => `${x}${\"_\".repeat(i + 1)}`))\n ].join(\" \");\n }\n // simple scope\n return `${prefix}${name}`;\n};\n\n/** @type {Renderer} */\nclass HTMLRenderer {\n /**\n * Creates a new HTMLRenderer\n *\n * @param {Tree} parseTree - the parse tree (must support `walk` API)\n * @param {{classPrefix: string}} options\n */\n constructor(parseTree, options) {\n this.buffer = \"\";\n this.classPrefix = options.classPrefix;\n parseTree.walk(this);\n }\n\n /**\n * Adds texts to the output stream\n *\n * @param {string} text */\n addText(text) {\n this.buffer += escapeHTML(text);\n }\n\n /**\n * Adds a node open to the output stream (if needed)\n *\n * @param {Node} node */\n openNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n const className = scopeToCSSClass(node.scope,\n { prefix: this.classPrefix });\n this.span(className);\n }\n\n /**\n * Adds a node close to the output stream (if needed)\n *\n * @param {Node} node */\n closeNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n this.buffer += SPAN_CLOSE;\n }\n\n /**\n * returns the accumulated buffer\n */\n value() {\n return this.buffer;\n }\n\n // helpers\n\n /**\n * Builds a span element\n *\n * @param {string} className */\n span(className) {\n this.buffer += ``;\n }\n}\n\n/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */\n/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */\n/** @typedef {import('highlight.js').Emitter} Emitter */\n/** */\n\n/** @returns {DataNode} */\nconst newNode = (opts = {}) => {\n /** @type DataNode */\n const result = { children: [] };\n Object.assign(result, opts);\n return result;\n};\n\nclass TokenTree {\n constructor() {\n /** @type DataNode */\n this.rootNode = newNode();\n this.stack = [this.rootNode];\n }\n\n get top() {\n return this.stack[this.stack.length - 1];\n }\n\n get root() { return this.rootNode; }\n\n /** @param {Node} node */\n add(node) {\n this.top.children.push(node);\n }\n\n /** @param {string} scope */\n openNode(scope) {\n /** @type Node */\n const node = newNode({ scope });\n this.add(node);\n this.stack.push(node);\n }\n\n closeNode() {\n if (this.stack.length > 1) {\n return this.stack.pop();\n }\n // eslint-disable-next-line no-undefined\n return undefined;\n }\n\n closeAllNodes() {\n while (this.closeNode());\n }\n\n toJSON() {\n return JSON.stringify(this.rootNode, null, 4);\n }\n\n /**\n * @typedef { import(\"./html_renderer\").Renderer } Renderer\n * @param {Renderer} builder\n */\n walk(builder) {\n // this does not\n return this.constructor._walk(builder, this.rootNode);\n // this works\n // return TokenTree._walk(builder, this.rootNode);\n }\n\n /**\n * @param {Renderer} builder\n * @param {Node} node\n */\n static _walk(builder, node) {\n if (typeof node === \"string\") {\n builder.addText(node);\n } else if (node.children) {\n builder.openNode(node);\n node.children.forEach((child) => this._walk(builder, child));\n builder.closeNode(node);\n }\n return builder;\n }\n\n /**\n * @param {Node} node\n */\n static _collapse(node) {\n if (typeof node === \"string\") return;\n if (!node.children) return;\n\n if (node.children.every(el => typeof el === \"string\")) {\n // node.text = node.children.join(\"\");\n // delete node.children;\n node.children = [node.children.join(\"\")];\n } else {\n node.children.forEach((child) => {\n TokenTree._collapse(child);\n });\n }\n }\n}\n\n/**\n Currently this is all private API, but this is the minimal API necessary\n that an Emitter must implement to fully support the parser.\n\n Minimal interface:\n\n - addText(text)\n - __addSublanguage(emitter, subLanguageName)\n - startScope(scope)\n - endScope()\n - finalize()\n - toHTML()\n\n*/\n\n/**\n * @implements {Emitter}\n */\nclass TokenTreeEmitter extends TokenTree {\n /**\n * @param {*} options\n */\n constructor(options) {\n super();\n this.options = options;\n }\n\n /**\n * @param {string} text\n */\n addText(text) {\n if (text === \"\") { return; }\n\n this.add(text);\n }\n\n /** @param {string} scope */\n startScope(scope) {\n this.openNode(scope);\n }\n\n endScope() {\n this.closeNode();\n }\n\n /**\n * @param {Emitter & {root: DataNode}} emitter\n * @param {string} name\n */\n __addSublanguage(emitter, name) {\n /** @type DataNode */\n const node = emitter.root;\n if (name) node.scope = `language:${name}`;\n\n this.add(node);\n }\n\n toHTML() {\n const renderer = new HTMLRenderer(this, this.options);\n return renderer.value();\n }\n\n finalize() {\n this.closeAllNodes();\n return true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction anyNumberOfTimes(re) {\n return concat('(?:', re, ')*');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction optional(re) {\n return concat('(?:', re, ')?');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '('\n + (opts.capture ? \"\" : \"?:\")\n + args.map((x) => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\n/**\n * @param {RegExp | string} re\n * @returns {number}\n */\nfunction countMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n}\n\n/**\n * Does lexeme start with a regular expression match at the beginning\n * @param {RegExp} re\n * @param {string} lexeme\n */\nfunction startsWith(re, lexeme) {\n const match = re && re.exec(lexeme);\n return match && match.index === 0;\n}\n\n// BACKREF_RE matches an open parenthesis or backreference. To avoid\n// an incorrect parse, it additionally matches the following:\n// - [...] elements, where the meaning of parentheses and escapes change\n// - other escape sequences, so we do not misparse escape sequences as\n// interesting elements\n// - non-matching or lookahead parentheses, which do not capture. These\n// follow the '(' with a '?'.\nconst BACKREF_RE = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n\n// **INTERNAL** Not intended for outside usage\n// join logically computes regexps.join(separator), but fixes the\n// backreferences so they continue to match.\n// it also places each individual regular expression into it's own\n// match group, keeping track of the sequencing of those match groups\n// is currently an exercise for the caller. :-)\n/**\n * @param {(string | RegExp)[]} regexps\n * @param {{joinWith: string}} opts\n * @returns {string}\n */\nfunction _rewriteBackreferences(regexps, { joinWith }) {\n let numCaptures = 0;\n\n return regexps.map((regex) => {\n numCaptures += 1;\n const offset = numCaptures;\n let re = source(regex);\n let out = '';\n\n while (re.length > 0) {\n const match = BACKREF_RE.exec(re);\n if (!match) {\n out += re;\n break;\n }\n out += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] === '\\\\' && match[1]) {\n // Adjust the backreference.\n out += '\\\\' + String(Number(match[1]) + offset);\n } else {\n out += match[0];\n if (match[0] === '(') {\n numCaptures++;\n }\n }\n }\n return out;\n }).map(re => `(${re})`).join(joinWith);\n}\n\n/** @typedef {import('highlight.js').Mode} Mode */\n/** @typedef {import('highlight.js').ModeCallback} ModeCallback */\n\n// Common regexps\nconst MATCH_NOTHING_RE = /\\b\\B/;\nconst IDENT_RE = '[a-zA-Z]\\\\w*';\nconst UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\nconst NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\nconst C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\nconst BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\nconst RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n/**\n* @param { Partial & {binary?: string | RegExp} } opts\n*/\nconst SHEBANG = (opts = {}) => {\n const beginShebang = /^#![ ]*\\//;\n if (opts.binary) {\n opts.begin = concat(\n beginShebang,\n /.*\\b/,\n opts.binary,\n /\\b.*/);\n }\n return inherit$1({\n scope: 'meta',\n begin: beginShebang,\n end: /$/,\n relevance: 0,\n /** @type {ModeCallback} */\n \"on:begin\": (m, resp) => {\n if (m.index !== 0) resp.ignoreMatch();\n }\n }, opts);\n};\n\n// Common modes\nconst BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n};\nconst APOS_STRING_MODE = {\n scope: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst QUOTE_STRING_MODE = {\n scope: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n};\n/**\n * Creates a comment mode\n *\n * @param {string | RegExp} begin\n * @param {string | RegExp} end\n * @param {Mode | {}} [modeOptions]\n * @returns {Partial}\n */\nconst COMMENT = function(begin, end, modeOptions = {}) {\n const mode = inherit$1(\n {\n scope: 'comment',\n begin,\n end,\n contains: []\n },\n modeOptions\n );\n mode.contains.push({\n scope: 'doctag',\n // hack to avoid the space from being included. the space is necessary to\n // match here to prevent the plain text rule below from gobbling up doctags\n begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',\n end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,\n excludeBegin: true,\n relevance: 0\n });\n const ENGLISH_WORD = either(\n // list of common 1 and 2 letter words in English\n \"I\",\n \"a\",\n \"is\",\n \"so\",\n \"us\",\n \"to\",\n \"at\",\n \"if\",\n \"in\",\n \"it\",\n \"on\",\n // note: this is not an exhaustive list of contractions, just popular ones\n /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, // contractions - can't we'd they're let's, etc\n /[A-Za-z]+[-][a-z]+/, // `no-way`, etc.\n /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences\n );\n // looking like plain text, more likely to be a comment\n mode.contains.push(\n {\n // TODO: how to include \", (, ) without breaking grammars that use these for\n // comment delimiters?\n // begin: /[ ]+([()\"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()\":]?([.][ ]|[ ]|\\))){3}/\n // ---\n\n // this tries to find sequences of 3 english words in a row (without any\n // \"programming\" type syntax) this gives us a strong signal that we've\n // TRULY found a comment - vs perhaps scanning with the wrong language.\n // It's possible to find something that LOOKS like the start of the\n // comment - but then if there is no readable text - good chance it is a\n // false match and not a comment.\n //\n // for a visual example please see:\n // https://github.com/highlightjs/highlight.js/issues/2827\n\n begin: concat(\n /[ ]+/, // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */\n '(',\n ENGLISH_WORD,\n /[.]?[:]?([.][ ]|[ ])/,\n '){3}') // look for 3 words in a row\n }\n );\n return mode;\n};\nconst C_LINE_COMMENT_MODE = COMMENT('//', '$');\nconst C_BLOCK_COMMENT_MODE = COMMENT('/\\\\*', '\\\\*/');\nconst HASH_COMMENT_MODE = COMMENT('#', '$');\nconst NUMBER_MODE = {\n scope: 'number',\n begin: NUMBER_RE,\n relevance: 0\n};\nconst C_NUMBER_MODE = {\n scope: 'number',\n begin: C_NUMBER_RE,\n relevance: 0\n};\nconst BINARY_NUMBER_MODE = {\n scope: 'number',\n begin: BINARY_NUMBER_RE,\n relevance: 0\n};\nconst REGEXP_MODE = {\n scope: \"regexp\",\n begin: /\\/(?=[^/\\n]*\\/)/,\n end: /\\/[gimuy]*/,\n contains: [\n BACKSLASH_ESCAPE,\n {\n begin: /\\[/,\n end: /\\]/,\n relevance: 0,\n contains: [BACKSLASH_ESCAPE]\n }\n ]\n};\nconst TITLE_MODE = {\n scope: 'title',\n begin: IDENT_RE,\n relevance: 0\n};\nconst UNDERSCORE_TITLE_MODE = {\n scope: 'title',\n begin: UNDERSCORE_IDENT_RE,\n relevance: 0\n};\nconst METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + UNDERSCORE_IDENT_RE,\n relevance: 0\n};\n\n/**\n * Adds end same as begin mechanics to a mode\n *\n * Your mode must include at least a single () match group as that first match\n * group is what is used for comparison\n * @param {Partial} mode\n */\nconst END_SAME_AS_BEGIN = function(mode) {\n return Object.assign(mode,\n {\n /** @type {ModeCallback} */\n 'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },\n /** @type {ModeCallback} */\n 'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }\n });\n};\n\nvar MODES = /*#__PURE__*/Object.freeze({\n __proto__: null,\n APOS_STRING_MODE: APOS_STRING_MODE,\n BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,\n BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,\n BINARY_NUMBER_RE: BINARY_NUMBER_RE,\n COMMENT: COMMENT,\n C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,\n C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,\n C_NUMBER_MODE: C_NUMBER_MODE,\n C_NUMBER_RE: C_NUMBER_RE,\n END_SAME_AS_BEGIN: END_SAME_AS_BEGIN,\n HASH_COMMENT_MODE: HASH_COMMENT_MODE,\n IDENT_RE: IDENT_RE,\n MATCH_NOTHING_RE: MATCH_NOTHING_RE,\n METHOD_GUARD: METHOD_GUARD,\n NUMBER_MODE: NUMBER_MODE,\n NUMBER_RE: NUMBER_RE,\n PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,\n QUOTE_STRING_MODE: QUOTE_STRING_MODE,\n REGEXP_MODE: REGEXP_MODE,\n RE_STARTERS_RE: RE_STARTERS_RE,\n SHEBANG: SHEBANG,\n TITLE_MODE: TITLE_MODE,\n UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,\n UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE\n});\n\n/**\n@typedef {import('highlight.js').CallbackResponse} CallbackResponse\n@typedef {import('highlight.js').CompilerExt} CompilerExt\n*/\n\n// Grammar extensions / plugins\n// See: https://github.com/highlightjs/highlight.js/issues/2833\n\n// Grammar extensions allow \"syntactic sugar\" to be added to the grammar modes\n// without requiring any underlying changes to the compiler internals.\n\n// `compileMatch` being the perfect small example of now allowing a grammar\n// author to write `match` when they desire to match a single expression rather\n// than being forced to use `begin`. The extension then just moves `match` into\n// `begin` when it runs. Ie, no features have been added, but we've just made\n// the experience of writing (and reading grammars) a little bit nicer.\n\n// ------\n\n// TODO: We need negative look-behind support to do this properly\n/**\n * Skip a match if it has a preceding dot\n *\n * This is used for `beginKeywords` to prevent matching expressions such as\n * `bob.keyword.do()`. The mode compiler automatically wires this up as a\n * special _internal_ 'on:begin' callback for modes with `beginKeywords`\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\nfunction skipIfHasPrecedingDot(match, response) {\n const before = match.input[match.index - 1];\n if (before === \".\") {\n response.ignoreMatch();\n }\n}\n\n/**\n *\n * @type {CompilerExt}\n */\nfunction scopeClassName(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.className !== undefined) {\n mode.scope = mode.className;\n delete mode.className;\n }\n}\n\n/**\n * `beginKeywords` syntactic sugar\n * @type {CompilerExt}\n */\nfunction beginKeywords(mode, parent) {\n if (!parent) return;\n if (!mode.beginKeywords) return;\n\n // for languages with keywords that include non-word characters checking for\n // a word boundary is not sufficient, so instead we check for a word boundary\n // or whitespace - this does no harm in any case since our keyword engine\n // doesn't allow spaces in keywords anyways and we still check for the boundary\n // first\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\\\.)(?=\\\\b|\\\\s)';\n mode.__beforeBegin = skipIfHasPrecedingDot;\n mode.keywords = mode.keywords || mode.beginKeywords;\n delete mode.beginKeywords;\n\n // prevents double relevance, the keywords themselves provide\n // relevance, the mode doesn't need to double it\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 0;\n}\n\n/**\n * Allow `illegal` to contain an array of illegal values\n * @type {CompilerExt}\n */\nfunction compileIllegal(mode, _parent) {\n if (!Array.isArray(mode.illegal)) return;\n\n mode.illegal = either(...mode.illegal);\n}\n\n/**\n * `match` to match a single expression for readability\n * @type {CompilerExt}\n */\nfunction compileMatch(mode, _parent) {\n if (!mode.match) return;\n if (mode.begin || mode.end) throw new Error(\"begin & end are not supported with match\");\n\n mode.begin = mode.match;\n delete mode.match;\n}\n\n/**\n * provides the default 1 relevance to all modes\n * @type {CompilerExt}\n */\nfunction compileRelevance(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 1;\n}\n\n// allow beforeMatch to act as a \"qualifier\" for the match\n// the full match begin must be [beforeMatch][begin]\nconst beforeMatchExt = (mode, parent) => {\n if (!mode.beforeMatch) return;\n // starts conflicts with endsParent which we need to make sure the child\n // rule is not matched multiple times\n if (mode.starts) throw new Error(\"beforeMatch cannot be used with starts\");\n\n const originalMode = Object.assign({}, mode);\n Object.keys(mode).forEach((key) => { delete mode[key]; });\n\n mode.keywords = originalMode.keywords;\n mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));\n mode.starts = {\n relevance: 0,\n contains: [\n Object.assign(originalMode, { endsParent: true })\n ]\n };\n mode.relevance = 0;\n\n delete originalMode.beforeMatch;\n};\n\n// keywords that should have no default relevance value\nconst COMMON_KEYWORDS = [\n 'of',\n 'and',\n 'for',\n 'in',\n 'not',\n 'or',\n 'if',\n 'then',\n 'parent', // common variable name\n 'list', // common variable name\n 'value' // common variable name\n];\n\nconst DEFAULT_KEYWORD_SCOPE = \"keyword\";\n\n/**\n * Given raw keywords from a language definition, compile them.\n *\n * @param {string | Record | Array} rawKeywords\n * @param {boolean} caseInsensitive\n */\nfunction compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {\n /** @type {import(\"highlight.js/private\").KeywordDict} */\n const compiledKeywords = Object.create(null);\n\n // input can be a string of keywords, an array of keywords, or a object with\n // named keys representing scopeName (which can then point to a string or array)\n if (typeof rawKeywords === 'string') {\n compileList(scopeName, rawKeywords.split(\" \"));\n } else if (Array.isArray(rawKeywords)) {\n compileList(scopeName, rawKeywords);\n } else {\n Object.keys(rawKeywords).forEach(function(scopeName) {\n // collapse all our objects back into the parent object\n Object.assign(\n compiledKeywords,\n compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName)\n );\n });\n }\n return compiledKeywords;\n\n // ---\n\n /**\n * Compiles an individual list of keywords\n *\n * Ex: \"for if when while|5\"\n *\n * @param {string} scopeName\n * @param {Array} keywordList\n */\n function compileList(scopeName, keywordList) {\n if (caseInsensitive) {\n keywordList = keywordList.map(x => x.toLowerCase());\n }\n keywordList.forEach(function(keyword) {\n const pair = keyword.split('|');\n compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];\n });\n }\n}\n\n/**\n * Returns the proper score for a given keyword\n *\n * Also takes into account comment keywords, which will be scored 0 UNLESS\n * another score has been manually assigned.\n * @param {string} keyword\n * @param {string} [providedScore]\n */\nfunction scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore) {\n return Number(providedScore);\n }\n\n return commonKeyword(keyword) ? 0 : 1;\n}\n\n/**\n * Determines if a given keyword is common or not\n *\n * @param {string} keyword */\nfunction commonKeyword(keyword) {\n return COMMON_KEYWORDS.includes(keyword.toLowerCase());\n}\n\n/*\n\nFor the reasoning behind this please see:\nhttps://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419\n\n*/\n\n/**\n * @type {Record}\n */\nconst seenDeprecations = {};\n\n/**\n * @param {string} message\n */\nconst error = (message) => {\n console.error(message);\n};\n\n/**\n * @param {string} message\n * @param {any} args\n */\nconst warn = (message, ...args) => {\n console.log(`WARN: ${message}`, ...args);\n};\n\n/**\n * @param {string} version\n * @param {string} message\n */\nconst deprecated = (version, message) => {\n if (seenDeprecations[`${version}/${message}`]) return;\n\n console.log(`Deprecated as of ${version}. ${message}`);\n seenDeprecations[`${version}/${message}`] = true;\n};\n\n/* eslint-disable no-throw-literal */\n\n/**\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n*/\n\nconst MultiClassError = new Error();\n\n/**\n * Renumbers labeled scope names to account for additional inner match\n * groups that otherwise would break everything.\n *\n * Lets say we 3 match scopes:\n *\n * { 1 => ..., 2 => ..., 3 => ... }\n *\n * So what we need is a clean match like this:\n *\n * (a)(b)(c) => [ \"a\", \"b\", \"c\" ]\n *\n * But this falls apart with inner match groups:\n *\n * (a)(((b)))(c) => [\"a\", \"b\", \"b\", \"b\", \"c\" ]\n *\n * Our scopes are now \"out of alignment\" and we're repeating `b` 3 times.\n * What needs to happen is the numbers are remapped:\n *\n * { 1 => ..., 2 => ..., 5 => ... }\n *\n * We also need to know that the ONLY groups that should be output\n * are 1, 2, and 5. This function handles this behavior.\n *\n * @param {CompiledMode} mode\n * @param {Array} regexes\n * @param {{key: \"beginScope\"|\"endScope\"}} opts\n */\nfunction remapScopeNames(mode, regexes, { key }) {\n let offset = 0;\n const scopeNames = mode[key];\n /** @type Record */\n const emit = {};\n /** @type Record */\n const positions = {};\n\n for (let i = 1; i <= regexes.length; i++) {\n positions[i + offset] = scopeNames[i];\n emit[i + offset] = true;\n offset += countMatchGroups(regexes[i - 1]);\n }\n // we use _emit to keep track of which match groups are \"top-level\" to avoid double\n // output from inside match groups\n mode[key] = positions;\n mode[key]._emit = emit;\n mode[key]._multi = true;\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction beginMultiClass(mode) {\n if (!Array.isArray(mode.begin)) return;\n\n if (mode.skip || mode.excludeBegin || mode.returnBegin) {\n error(\"skip, excludeBegin, returnBegin not compatible with beginScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.beginScope !== \"object\" || mode.beginScope === null) {\n error(\"beginScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.begin, { key: \"beginScope\" });\n mode.begin = _rewriteBackreferences(mode.begin, { joinWith: \"\" });\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction endMultiClass(mode) {\n if (!Array.isArray(mode.end)) return;\n\n if (mode.skip || mode.excludeEnd || mode.returnEnd) {\n error(\"skip, excludeEnd, returnEnd not compatible with endScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.endScope !== \"object\" || mode.endScope === null) {\n error(\"endScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.end, { key: \"endScope\" });\n mode.end = _rewriteBackreferences(mode.end, { joinWith: \"\" });\n}\n\n/**\n * this exists only to allow `scope: {}` to be used beside `match:`\n * Otherwise `beginScope` would necessary and that would look weird\n\n {\n match: [ /def/, /\\w+/ ]\n scope: { 1: \"keyword\" , 2: \"title\" }\n }\n\n * @param {CompiledMode} mode\n */\nfunction scopeSugar(mode) {\n if (mode.scope && typeof mode.scope === \"object\" && mode.scope !== null) {\n mode.beginScope = mode.scope;\n delete mode.scope;\n }\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction MultiClass(mode) {\n scopeSugar(mode);\n\n if (typeof mode.beginScope === \"string\") {\n mode.beginScope = { _wrap: mode.beginScope };\n }\n if (typeof mode.endScope === \"string\") {\n mode.endScope = { _wrap: mode.endScope };\n }\n\n beginMultiClass(mode);\n endMultiClass(mode);\n}\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage\n*/\n\n// compilation\n\n/**\n * Compiles a language definition result\n *\n * Given the raw result of a language definition (Language), compiles this so\n * that it is ready for highlighting code.\n * @param {Language} language\n * @returns {CompiledLanguage}\n */\nfunction compileLanguage(language) {\n /**\n * Builds a regex with the case sensitivity of the current language\n *\n * @param {RegExp | string} value\n * @param {boolean} [global]\n */\n function langRe(value, global) {\n return new RegExp(\n source(value),\n 'm'\n + (language.case_insensitive ? 'i' : '')\n + (language.unicodeRegex ? 'u' : '')\n + (global ? 'g' : '')\n );\n }\n\n /**\n Stores multiple regular expressions and allows you to quickly search for\n them all in a string simultaneously - returning the first match. It does\n this by creating a huge (a|b|c) regex - each individual item wrapped with ()\n and joined by `|` - using match groups to track position. When a match is\n found checking which position in the array has content allows us to figure\n out which of the original regexes / match groups triggered the match.\n\n The match object itself (the result of `Regex.exec`) is returned but also\n enhanced by merging in any meta-data that was registered with the regex.\n This is how we keep track of which mode matched, and what type of rule\n (`illegal`, `begin`, end, etc).\n */\n class MultiRegex {\n constructor() {\n this.matchIndexes = {};\n // @ts-ignore\n this.regexes = [];\n this.matchAt = 1;\n this.position = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n opts.position = this.position++;\n // @ts-ignore\n this.matchIndexes[this.matchAt] = opts;\n this.regexes.push([opts, re]);\n this.matchAt += countMatchGroups(re) + 1;\n }\n\n compile() {\n if (this.regexes.length === 0) {\n // avoids the need to check length every time exec is called\n // @ts-ignore\n this.exec = () => null;\n }\n const terminators = this.regexes.map(el => el[1]);\n this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: '|' }), true);\n this.lastIndex = 0;\n }\n\n /** @param {string} s */\n exec(s) {\n this.matcherRe.lastIndex = this.lastIndex;\n const match = this.matcherRe.exec(s);\n if (!match) { return null; }\n\n // eslint-disable-next-line no-undefined\n const i = match.findIndex((el, i) => i > 0 && el !== undefined);\n // @ts-ignore\n const matchData = this.matchIndexes[i];\n // trim off any earlier non-relevant match groups (ie, the other regex\n // match groups that make up the multi-matcher)\n match.splice(0, i);\n\n return Object.assign(match, matchData);\n }\n }\n\n /*\n Created to solve the key deficiently with MultiRegex - there is no way to\n test for multiple matches at a single location. Why would we need to do\n that? In the future a more dynamic engine will allow certain matches to be\n ignored. An example: if we matched say the 3rd regex in a large group but\n decided to ignore it - we'd need to started testing again at the 4th\n regex... but MultiRegex itself gives us no real way to do that.\n\n So what this class creates MultiRegexs on the fly for whatever search\n position they are needed.\n\n NOTE: These additional MultiRegex objects are created dynamically. For most\n grammars most of the time we will never actually need anything more than the\n first MultiRegex - so this shouldn't have too much overhead.\n\n Say this is our search group, and we match regex3, but wish to ignore it.\n\n regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0\n\n What we need is a new MultiRegex that only includes the remaining\n possibilities:\n\n regex4 | regex5 ' ie, startAt = 3\n\n This class wraps all that complexity up in a simple API... `startAt` decides\n where in the array of expressions to start doing the matching. It\n auto-increments, so if a match is found at position 2, then startAt will be\n set to 3. If the end is reached startAt will return to 0.\n\n MOST of the time the parser will be setting startAt manually to 0.\n */\n class ResumableMultiRegex {\n constructor() {\n // @ts-ignore\n this.rules = [];\n // @ts-ignore\n this.multiRegexes = [];\n this.count = 0;\n\n this.lastIndex = 0;\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n getMatcher(index) {\n if (this.multiRegexes[index]) return this.multiRegexes[index];\n\n const matcher = new MultiRegex();\n this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));\n matcher.compile();\n this.multiRegexes[index] = matcher;\n return matcher;\n }\n\n resumingScanAtSamePosition() {\n return this.regexIndex !== 0;\n }\n\n considerAll() {\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n this.rules.push([re, opts]);\n if (opts.type === \"begin\") this.count++;\n }\n\n /** @param {string} s */\n exec(s) {\n const m = this.getMatcher(this.regexIndex);\n m.lastIndex = this.lastIndex;\n let result = m.exec(s);\n\n // The following is because we have no easy way to say \"resume scanning at the\n // existing position but also skip the current rule ONLY\". What happens is\n // all prior rules are also skipped which can result in matching the wrong\n // thing. Example of matching \"booger\":\n\n // our matcher is [string, \"booger\", number]\n //\n // ....booger....\n\n // if \"booger\" is ignored then we'd really need a regex to scan from the\n // SAME position for only: [string, number] but ignoring \"booger\" (if it\n // was the first match), a simple resume would scan ahead who knows how\n // far looking only for \"number\", ignoring potential string matches (or\n // future \"booger\" matches that might be valid.)\n\n // So what we do: We execute two matchers, one resuming at the same\n // position, but the second full matcher starting at the position after:\n\n // /--- resume first regex match here (for [number])\n // |/---- full match here for [string, \"booger\", number]\n // vv\n // ....booger....\n\n // Which ever results in a match first is then used. So this 3-4 step\n // process essentially allows us to say \"match at this position, excluding\n // a prior rule that was ignored\".\n //\n // 1. Match \"booger\" first, ignore. Also proves that [string] does non match.\n // 2. Resume matching for [number]\n // 3. Match at index + 1 for [string, \"booger\", number]\n // 4. If #2 and #3 result in matches, which came first?\n if (this.resumingScanAtSamePosition()) {\n if (result && result.index === this.lastIndex) ; else { // use the second matcher result\n const m2 = this.getMatcher(0);\n m2.lastIndex = this.lastIndex + 1;\n result = m2.exec(s);\n }\n }\n\n if (result) {\n this.regexIndex += result.position + 1;\n if (this.regexIndex === this.count) {\n // wrap-around to considering all matches again\n this.considerAll();\n }\n }\n\n return result;\n }\n }\n\n /**\n * Given a mode, builds a huge ResumableMultiRegex that can be used to walk\n * the content and find matches.\n *\n * @param {CompiledMode} mode\n * @returns {ResumableMultiRegex}\n */\n function buildModeRegex(mode) {\n const mm = new ResumableMultiRegex();\n\n mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: \"begin\" }));\n\n if (mode.terminatorEnd) {\n mm.addRule(mode.terminatorEnd, { type: \"end\" });\n }\n if (mode.illegal) {\n mm.addRule(mode.illegal, { type: \"illegal\" });\n }\n\n return mm;\n }\n\n /** skip vs abort vs ignore\n *\n * @skip - The mode is still entered and exited normally (and contains rules apply),\n * but all content is held and added to the parent buffer rather than being\n * output when the mode ends. Mostly used with `sublanguage` to build up\n * a single large buffer than can be parsed by sublanguage.\n *\n * - The mode begin ands ends normally.\n * - Content matched is added to the parent mode buffer.\n * - The parser cursor is moved forward normally.\n *\n * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it\n * never matched) but DOES NOT continue to match subsequent `contains`\n * modes. Abort is bad/suboptimal because it can result in modes\n * farther down not getting applied because an earlier rule eats the\n * content but then aborts.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is added to the mode buffer.\n * - The parser cursor is moved forward accordingly.\n *\n * @ignore - Ignores the mode (as if it never matched) and continues to match any\n * subsequent `contains` modes. Ignore isn't technically possible with\n * the current parser implementation.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is ignored.\n * - The parser cursor is not moved forward.\n */\n\n /**\n * Compiles an individual mode\n *\n * This can raise an error if the mode contains certain detectable known logic\n * issues.\n * @param {Mode} mode\n * @param {CompiledMode | null} [parent]\n * @returns {CompiledMode | never}\n */\n function compileMode(mode, parent) {\n const cmode = /** @type CompiledMode */ (mode);\n if (mode.isCompiled) return cmode;\n\n [\n scopeClassName,\n // do this early so compiler extensions generally don't have to worry about\n // the distinction between match/begin\n compileMatch,\n MultiClass,\n beforeMatchExt\n ].forEach(ext => ext(mode, parent));\n\n language.compilerExtensions.forEach(ext => ext(mode, parent));\n\n // __beforeBegin is considered private API, internal use only\n mode.__beforeBegin = null;\n\n [\n beginKeywords,\n // do this later so compiler extensions that come earlier have access to the\n // raw array if they wanted to perhaps manipulate it, etc.\n compileIllegal,\n // default to 1 relevance if not specified\n compileRelevance\n ].forEach(ext => ext(mode, parent));\n\n mode.isCompiled = true;\n\n let keywordPattern = null;\n if (typeof mode.keywords === \"object\" && mode.keywords.$pattern) {\n // we need a copy because keywords might be compiled multiple times\n // so we can't go deleting $pattern from the original on the first\n // pass\n mode.keywords = Object.assign({}, mode.keywords);\n keywordPattern = mode.keywords.$pattern;\n delete mode.keywords.$pattern;\n }\n keywordPattern = keywordPattern || /\\w+/;\n\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n }\n\n cmode.keywordPatternRe = langRe(keywordPattern, true);\n\n if (parent) {\n if (!mode.begin) mode.begin = /\\B|\\b/;\n cmode.beginRe = langRe(cmode.begin);\n if (!mode.end && !mode.endsWithParent) mode.end = /\\B|\\b/;\n if (mode.end) cmode.endRe = langRe(cmode.end);\n cmode.terminatorEnd = source(cmode.end) || '';\n if (mode.endsWithParent && parent.terminatorEnd) {\n cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;\n }\n }\n if (mode.illegal) cmode.illegalRe = langRe(/** @type {RegExp | string} */ (mode.illegal));\n if (!mode.contains) mode.contains = [];\n\n mode.contains = [].concat(...mode.contains.map(function(c) {\n return expandOrCloneMode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });\n\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n\n cmode.matcher = buildModeRegex(cmode);\n return cmode;\n }\n\n if (!language.compilerExtensions) language.compilerExtensions = [];\n\n // self is not valid at the top-level\n if (language.contains && language.contains.includes('self')) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\");\n }\n\n // we need a null object, which inherit will guarantee\n language.classNameAliases = inherit$1(language.classNameAliases || {});\n\n return compileMode(/** @type Mode */ (language));\n}\n\n/**\n * Determines if a mode has a dependency on it's parent or not\n *\n * If a mode does have a parent dependency then often we need to clone it if\n * it's used in multiple places so that each copy points to the correct parent,\n * where-as modes without a parent can often safely be re-used at the bottom of\n * a mode chain.\n *\n * @param {Mode | null} mode\n * @returns {boolean} - is there a dependency on the parent?\n * */\nfunction dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n}\n\n/**\n * Expands a mode or clones it if necessary\n *\n * This is necessary for modes with parental dependenceis (see notes on\n * `dependencyOnParent`) and for nodes that have `variants` - which must then be\n * exploded into their own individual modes at compile time.\n *\n * @param {Mode} mode\n * @returns {Mode | Mode[]}\n * */\nfunction expandOrCloneMode(mode) {\n if (mode.variants && !mode.cachedVariants) {\n mode.cachedVariants = mode.variants.map(function(variant) {\n return inherit$1(mode, { variants: null }, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cachedVariants) {\n return mode.cachedVariants;\n }\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode)) {\n return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });\n }\n\n if (Object.isFrozen(mode)) {\n return inherit$1(mode);\n }\n\n // no special dependency issues, just return ourselves\n return mode;\n}\n\nvar version = \"11.9.0\";\n\nclass HTMLInjectionError extends Error {\n constructor(reason, html) {\n super(reason);\n this.name = \"HTMLInjectionError\";\n this.html = html;\n }\n}\n\n/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').CompiledScope} CompiledScope\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSApi} HLJSApi\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').PluginEvent} PluginEvent\n@typedef {import('highlight.js').HLJSOptions} HLJSOptions\n@typedef {import('highlight.js').LanguageFn} LanguageFn\n@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement\n@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext\n@typedef {import('highlight.js/private').MatchType} MatchType\n@typedef {import('highlight.js/private').KeywordData} KeywordData\n@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch\n@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError\n@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult\n@typedef {import('highlight.js').HighlightOptions} HighlightOptions\n@typedef {import('highlight.js').HighlightResult} HighlightResult\n*/\n\n\nconst escape = escapeHTML;\nconst inherit = inherit$1;\nconst NO_MATCH = Symbol(\"nomatch\");\nconst MAX_KEYWORD_HITS = 7;\n\n/**\n * @param {any} hljs - object that is extended (legacy)\n * @returns {HLJSApi}\n */\nconst HLJS = function(hljs) {\n // Global internal variables used within the highlight.js library.\n /** @type {Record} */\n const languages = Object.create(null);\n /** @type {Record} */\n const aliases = Object.create(null);\n /** @type {HLJSPlugin[]} */\n const plugins = [];\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n let SAFE_MODE = true;\n const LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n /** @type {Language} */\n const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n /** @type HLJSOptions */\n let options = {\n ignoreUnescapedHTML: false,\n throwUnescapedHTML: false,\n noHighlightRe: /^(no-?highlight)$/i,\n languageDetectRe: /\\blang(?:uage)?-([\\w-]+)\\b/i,\n classPrefix: 'hljs-',\n cssSelector: 'pre code',\n languages: null,\n // beta configuration options, subject to change, welcome to discuss\n // https://github.com/highlightjs/highlight.js/issues/1086\n __emitter: TokenTreeEmitter\n };\n\n /* Utility functions */\n\n /**\n * Tests a language name to see if highlighting should be skipped\n * @param {string} languageName\n */\n function shouldNotHighlight(languageName) {\n return options.noHighlightRe.test(languageName);\n }\n\n /**\n * @param {HighlightedHTMLElement} block - the HTML element to determine language for\n */\n function blockLanguage(block) {\n let classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n const match = options.languageDetectRe.exec(classes);\n if (match) {\n const language = getLanguage(match[1]);\n if (!language) {\n warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n\n return classes\n .split(/\\s+/)\n .find((_class) => shouldNotHighlight(_class) || getLanguage(_class));\n }\n\n /**\n * Core highlighting function.\n *\n * OLD API\n * highlight(lang, code, ignoreIllegals, continuation)\n *\n * NEW API\n * highlight(code, {lang, ignoreIllegals})\n *\n * @param {string} codeOrLanguageName - the language to use for highlighting\n * @param {string | HighlightOptions} optionsOrCode - the code to highlight\n * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n *\n * @returns {HighlightResult} Result - an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {string} code - the original raw code\n * @property {CompiledMode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {\n let code = \"\";\n let languageName = \"\";\n if (typeof optionsOrCode === \"object\") {\n code = codeOrLanguageName;\n ignoreIllegals = optionsOrCode.ignoreIllegals;\n languageName = optionsOrCode.language;\n } else {\n // old API\n deprecated(\"10.7.0\", \"highlight(lang, code, ...args) has been deprecated.\");\n deprecated(\"10.7.0\", \"Please use highlight(code, options) instead.\\nhttps://github.com/highlightjs/highlight.js/issues/2277\");\n languageName = codeOrLanguageName;\n code = optionsOrCode;\n }\n\n // https://github.com/highlightjs/highlight.js/issues/3149\n // eslint-disable-next-line no-undefined\n if (ignoreIllegals === undefined) { ignoreIllegals = true; }\n\n /** @type {BeforeHighlightContext} */\n const context = {\n code,\n language: languageName\n };\n // the plugin can change the desired language or the code to be highlighted\n // just be changing the object it was passed\n fire(\"before:highlight\", context);\n\n // a before plugin can usurp the result completely by providing it's own\n // in which case we don't even need to call highlight\n const result = context.result\n ? context.result\n : _highlight(context.language, context.code, ignoreIllegals);\n\n result.code = context.code;\n // the plugin can change anything in result to suite it\n fire(\"after:highlight\", result);\n\n return result;\n }\n\n /**\n * private highlight that's used internally and does not fire callbacks\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} codeToHighlight - the code to highlight\n * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n * @param {CompiledMode?} [continuation] - current continuation mode, if any\n * @returns {HighlightResult} - result of the highlight operation\n */\n function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {\n const keywordHits = Object.create(null);\n\n /**\n * Return keyword data if a match is a keyword\n * @param {CompiledMode} mode - current mode\n * @param {string} matchText - the textual match\n * @returns {KeywordData | false}\n */\n function keywordData(mode, matchText) {\n return mode.keywords[matchText];\n }\n\n function processKeywords() {\n if (!top.keywords) {\n emitter.addText(modeBuffer);\n return;\n }\n\n let lastIndex = 0;\n top.keywordPatternRe.lastIndex = 0;\n let match = top.keywordPatternRe.exec(modeBuffer);\n let buf = \"\";\n\n while (match) {\n buf += modeBuffer.substring(lastIndex, match.index);\n const word = language.case_insensitive ? match[0].toLowerCase() : match[0];\n const data = keywordData(top, word);\n if (data) {\n const [kind, keywordRelevance] = data;\n emitter.addText(buf);\n buf = \"\";\n\n keywordHits[word] = (keywordHits[word] || 0) + 1;\n if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;\n if (kind.startsWith(\"_\")) {\n // _ implied for relevance only, do not highlight\n // by applying a class name\n buf += match[0];\n } else {\n const cssClass = language.classNameAliases[kind] || kind;\n emitKeyword(match[0], cssClass);\n }\n } else {\n buf += match[0];\n }\n lastIndex = top.keywordPatternRe.lastIndex;\n match = top.keywordPatternRe.exec(modeBuffer);\n }\n buf += modeBuffer.substring(lastIndex);\n emitter.addText(buf);\n }\n\n function processSubLanguage() {\n if (modeBuffer === \"\") return;\n /** @type HighlightResult */\n let result = null;\n\n if (typeof top.subLanguage === 'string') {\n if (!languages[top.subLanguage]) {\n emitter.addText(modeBuffer);\n return;\n }\n result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);\n continuations[top.subLanguage] = /** @type {CompiledMode} */ (result._top);\n } else {\n result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);\n }\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n emitter.__addSublanguage(result._emitter, result.language);\n }\n\n function processBuffer() {\n if (top.subLanguage != null) {\n processSubLanguage();\n } else {\n processKeywords();\n }\n modeBuffer = '';\n }\n\n /**\n * @param {string} text\n * @param {string} scope\n */\n function emitKeyword(keyword, scope) {\n if (keyword === \"\") return;\n\n emitter.startScope(scope);\n emitter.addText(keyword);\n emitter.endScope();\n }\n\n /**\n * @param {CompiledScope} scope\n * @param {RegExpMatchArray} match\n */\n function emitMultiClass(scope, match) {\n let i = 1;\n const max = match.length - 1;\n while (i <= max) {\n if (!scope._emit[i]) { i++; continue; }\n const klass = language.classNameAliases[scope[i]] || scope[i];\n const text = match[i];\n if (klass) {\n emitKeyword(text, klass);\n } else {\n modeBuffer = text;\n processKeywords();\n modeBuffer = \"\";\n }\n i++;\n }\n }\n\n /**\n * @param {CompiledMode} mode - new mode to start\n * @param {RegExpMatchArray} match\n */\n function startNewMode(mode, match) {\n if (mode.scope && typeof mode.scope === \"string\") {\n emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);\n }\n if (mode.beginScope) {\n // beginScope just wraps the begin match itself in a scope\n if (mode.beginScope._wrap) {\n emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);\n modeBuffer = \"\";\n } else if (mode.beginScope._multi) {\n // at this point modeBuffer should just be the match\n emitMultiClass(mode.beginScope, match);\n modeBuffer = \"\";\n }\n }\n\n top = Object.create(mode, { parent: { value: top } });\n return top;\n }\n\n /**\n * @param {CompiledMode } mode - the mode to potentially end\n * @param {RegExpMatchArray} match - the latest match\n * @param {string} matchPlusRemainder - match plus remainder of content\n * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode\n */\n function endOfMode(mode, match, matchPlusRemainder) {\n let matched = startsWith(mode.endRe, matchPlusRemainder);\n\n if (matched) {\n if (mode[\"on:end\"]) {\n const resp = new Response(mode);\n mode[\"on:end\"](match, resp);\n if (resp.isMatchIgnored) matched = false;\n }\n\n if (matched) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n }\n // even if on:end fires an `ignore` it's still possible\n // that we might trigger the end node because of a parent mode\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, match, matchPlusRemainder);\n }\n }\n\n /**\n * Handle matching but then ignoring a sequence of text\n *\n * @param {string} lexeme - string containing full match text\n */\n function doIgnore(lexeme) {\n if (top.matcher.regexIndex === 0) {\n // no more regexes to potentially match here, so we move the cursor forward one\n // space\n modeBuffer += lexeme[0];\n return 1;\n } else {\n // no need to move the cursor, we still have additional regexes to try and\n // match at this very spot\n resumeScanAtSamePosition = true;\n return 0;\n }\n }\n\n /**\n * Handle the start of a new potential mode match\n *\n * @param {EnhancedMatch} match - the current match\n * @returns {number} how far to advance the parse cursor\n */\n function doBeginMatch(match) {\n const lexeme = match[0];\n const newMode = match.rule;\n\n const resp = new Response(newMode);\n // first internal before callbacks, then the public ones\n const beforeCallbacks = [newMode.__beforeBegin, newMode[\"on:begin\"]];\n for (const cb of beforeCallbacks) {\n if (!cb) continue;\n cb(match, resp);\n if (resp.isMatchIgnored) return doIgnore(lexeme);\n }\n\n if (newMode.skip) {\n modeBuffer += lexeme;\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme;\n }\n }\n startNewMode(newMode, match);\n return newMode.returnBegin ? 0 : lexeme.length;\n }\n\n /**\n * Handle the potential end of mode\n *\n * @param {RegExpMatchArray} match - the current match\n */\n function doEndMatch(match) {\n const lexeme = match[0];\n const matchPlusRemainder = codeToHighlight.substring(match.index);\n\n const endMode = endOfMode(top, match, matchPlusRemainder);\n if (!endMode) { return NO_MATCH; }\n\n const origin = top;\n if (top.endScope && top.endScope._wrap) {\n processBuffer();\n emitKeyword(lexeme, top.endScope._wrap);\n } else if (top.endScope && top.endScope._multi) {\n processBuffer();\n emitMultiClass(top.endScope, match);\n } else if (origin.skip) {\n modeBuffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n modeBuffer = lexeme;\n }\n }\n do {\n if (top.scope) {\n emitter.closeNode();\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== endMode.parent);\n if (endMode.starts) {\n startNewMode(endMode.starts, match);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n function processContinuations() {\n const list = [];\n for (let current = top; current !== language; current = current.parent) {\n if (current.scope) {\n list.unshift(current.scope);\n }\n }\n list.forEach(item => emitter.openNode(item));\n }\n\n /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */\n let lastMatch = {};\n\n /**\n * Process an individual match\n *\n * @param {string} textBeforeMatch - text preceding the match (since the last match)\n * @param {EnhancedMatch} [match] - the match itself\n */\n function processLexeme(textBeforeMatch, match) {\n const lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type === \"begin\" && match.type === \"end\" && lastMatch.index === match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n modeBuffer += codeToHighlight.slice(match.index, match.index + 1);\n if (!SAFE_MODE) {\n /** @type {AnnotatedError} */\n const err = new Error(`0 width match regex (${languageName})`);\n err.languageName = languageName;\n err.badRule = lastMatch.rule;\n throw err;\n }\n return 1;\n }\n lastMatch = match;\n\n if (match.type === \"begin\") {\n return doBeginMatch(match);\n } else if (match.type === \"illegal\" && !ignoreIllegals) {\n // illegal match, we do not continue processing\n /** @type {AnnotatedError} */\n const err = new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.scope || '') + '\"');\n err.mode = top;\n throw err;\n } else if (match.type === \"end\") {\n const processed = doEndMatch(match);\n if (processed !== NO_MATCH) {\n return processed;\n }\n }\n\n // edge case for when illegal matches $ (end of line) which is technically\n // a 0 width match but not a begin/end match so it's not caught by the\n // first handler (when ignoreIllegals is true)\n if (match.type === \"illegal\" && lexeme === \"\") {\n // advance so we aren't stuck in an infinite loop\n return 1;\n }\n\n // infinite loops are BAD, this is a last ditch catch all. if we have a\n // decent number of iterations yet our index (cursor position in our\n // parsing) still 3x behind our index then something is very wrong\n // so we bail\n if (iterations > 100000 && iterations > match.index * 3) {\n const err = new Error('potential infinite loop, way more iterations than matches');\n throw err;\n }\n\n /*\n Why might be find ourselves here? An potential end match that was\n triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.\n (this could be because a callback requests the match be ignored, etc)\n\n This causes no real harm other than stopping a few times too many.\n */\n\n modeBuffer += lexeme;\n return lexeme.length;\n }\n\n const language = getLanguage(languageName);\n if (!language) {\n error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n\n const md = compileLanguage(language);\n let result = '';\n /** @type {CompiledMode} */\n let top = continuation || md;\n /** @type Record */\n const continuations = {}; // keep continuations for sub-languages\n const emitter = new options.__emitter(options);\n processContinuations();\n let modeBuffer = '';\n let relevance = 0;\n let index = 0;\n let iterations = 0;\n let resumeScanAtSamePosition = false;\n\n try {\n if (!language.__emitTokens) {\n top.matcher.considerAll();\n\n for (;;) {\n iterations++;\n if (resumeScanAtSamePosition) {\n // only regexes not matched previously will now be\n // considered for a potential match\n resumeScanAtSamePosition = false;\n } else {\n top.matcher.considerAll();\n }\n top.matcher.lastIndex = index;\n\n const match = top.matcher.exec(codeToHighlight);\n // console.log(\"match\", match[0], match.rule && match.rule.begin)\n\n if (!match) break;\n\n const beforeMatch = codeToHighlight.substring(index, match.index);\n const processedCount = processLexeme(beforeMatch, match);\n index = match.index + processedCount;\n }\n processLexeme(codeToHighlight.substring(index));\n } else {\n language.__emitTokens(codeToHighlight, emitter);\n }\n\n emitter.finalize();\n result = emitter.toHTML();\n\n return {\n language: languageName,\n value: result,\n relevance,\n illegal: false,\n _emitter: emitter,\n _top: top\n };\n } catch (err) {\n if (err.message && err.message.includes('Illegal')) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: true,\n relevance: 0,\n _illegalBy: {\n message: err.message,\n index,\n context: codeToHighlight.slice(index - 100, index + 100),\n mode: err.mode,\n resultSoFar: result\n },\n _emitter: emitter\n };\n } else if (SAFE_MODE) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: false,\n relevance: 0,\n errorRaised: err,\n _emitter: emitter,\n _top: top\n };\n } else {\n throw err;\n }\n }\n }\n\n /**\n * returns a valid highlight result, without actually doing any actual work,\n * auto highlight starts with this and it's possible for small snippets that\n * auto-detection may not find a better match\n * @param {string} code\n * @returns {HighlightResult}\n */\n function justTextHighlightResult(code) {\n const result = {\n value: escape(code),\n illegal: false,\n relevance: 0,\n _top: PLAINTEXT_LANGUAGE,\n _emitter: new options.__emitter(options)\n };\n result._emitter.addText(code);\n return result;\n }\n\n /**\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - secondBest (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n @param {string} code\n @param {Array} [languageSubset]\n @returns {AutoHighlightResult}\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n const plaintext = justTextHighlightResult(code);\n\n const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name =>\n _highlight(name, code, false)\n );\n results.unshift(plaintext); // plaintext is always an option\n\n const sorted = results.sort((a, b) => {\n // sort base on relevance\n if (a.relevance !== b.relevance) return b.relevance - a.relevance;\n\n // always award the tie to the base language\n // ie if C++ and Arduino are tied, it's more likely to be C++\n if (a.language && b.language) {\n if (getLanguage(a.language).supersetOf === b.language) {\n return 1;\n } else if (getLanguage(b.language).supersetOf === a.language) {\n return -1;\n }\n }\n\n // otherwise say they are equal, which has the effect of sorting on\n // relevance while preserving the original ordering - which is how ties\n // have historically been settled, ie the language that comes first always\n // wins in the case of a tie\n return 0;\n });\n\n const [best, secondBest] = sorted;\n\n /** @type {AutoHighlightResult} */\n const result = best;\n result.secondBest = secondBest;\n\n return result;\n }\n\n /**\n * Builds new class name for block given the language name\n *\n * @param {HTMLElement} element\n * @param {string} [currentLang]\n * @param {string} [resultLang]\n */\n function updateClassName(element, currentLang, resultLang) {\n const language = (currentLang && aliases[currentLang]) || resultLang;\n\n element.classList.add(\"hljs\");\n element.classList.add(`language-${language}`);\n }\n\n /**\n * Applies highlighting to a DOM node containing code.\n *\n * @param {HighlightedHTMLElement} element - the HTML element to highlight\n */\n function highlightElement(element) {\n /** @type HTMLElement */\n let node = null;\n const language = blockLanguage(element);\n\n if (shouldNotHighlight(language)) return;\n\n fire(\"before:highlightElement\",\n { el: element, language });\n\n if (element.dataset.highlighted) {\n console.log(\"Element previously highlighted. To highlight again, first unset `dataset.highlighted`.\", element);\n return;\n }\n\n // we should be all text, no child nodes (unescaped HTML) - this is possibly\n // an HTML injection attack - it's likely too late if this is already in\n // production (the code has likely already done its damage by the time\n // we're seeing it)... but we yell loudly about this so that hopefully it's\n // more likely to be caught in development before making it to production\n if (element.children.length > 0) {\n if (!options.ignoreUnescapedHTML) {\n console.warn(\"One of your code blocks includes unescaped HTML. This is a potentially serious security risk.\");\n console.warn(\"https://github.com/highlightjs/highlight.js/wiki/security\");\n console.warn(\"The element with unescaped HTML:\");\n console.warn(element);\n }\n if (options.throwUnescapedHTML) {\n const err = new HTMLInjectionError(\n \"One of your code blocks includes unescaped HTML.\",\n element.innerHTML\n );\n throw err;\n }\n }\n\n node = element;\n const text = node.textContent;\n const result = language ? highlight(text, { language, ignoreIllegals: true }) : highlightAuto(text);\n\n element.innerHTML = result.value;\n element.dataset.highlighted = \"yes\";\n updateClassName(element, language, result.language);\n element.result = {\n language: result.language,\n // TODO: remove with version 11.0\n re: result.relevance,\n relevance: result.relevance\n };\n if (result.secondBest) {\n element.secondBest = {\n language: result.secondBest.language,\n relevance: result.secondBest.relevance\n };\n }\n\n fire(\"after:highlightElement\", { el: element, result, text });\n }\n\n /**\n * Updates highlight.js global options with the passed options\n *\n * @param {Partial} userOptions\n */\n function configure(userOptions) {\n options = inherit(options, userOptions);\n }\n\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlighting() deprecated. Use highlightAll() now.\");\n };\n\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() deprecated. Use highlightAll() now.\");\n }\n\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n wantsHighlight = true;\n return;\n }\n\n const blocks = document.querySelectorAll(options.cssSelector);\n blocks.forEach(highlightElement);\n }\n\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n if (wantsHighlight) highlightAll();\n }\n\n // make sure we are in the browser environment\n if (typeof window !== 'undefined' && window.addEventListener) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) { throw error$1; } else { error(error$1); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n\n if (lang.aliases) {\n registerAliases(lang.aliases, { languageName });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, { languageName }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = (data) => {\n plugin[\"before:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = (data) => {\n plugin[\"after:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function removePlugin(plugin) {\n const index = plugins.indexOf(plugin);\n if (index !== -1) {\n plugins.splice(index, 1);\n }\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function(plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n * DEPRECATED\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n autoDetection,\n inherit,\n addPlugin,\n removePlugin\n });\n\n hljs.debugMode = function() { SAFE_MODE = false; };\n hljs.safeMode = function() { SAFE_MODE = true; };\n hljs.versionString = version;\n\n hljs.regex = {\n concat: concat,\n lookahead: lookahead,\n either: either,\n optional: optional,\n anyNumberOfTimes: anyNumberOfTimes\n };\n\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreeze(MODES[key]);\n }\n }\n\n // merge all the modes/regexes into our main object\n Object.assign(hljs, MODES);\n\n return hljs;\n};\n\n// Other names for the variable may break build script\nconst highlight = HLJS({});\n\n// returns a new instance of the highlighter to be used for extensions\n// check https://github.com/wooorm/lowlight/issues/47\nhighlight.newInstance = () => HLJS({});\n\nmodule.exports = highlight;\nhighlight.HighlightJS = highlight;\nhighlight.default = highlight;\n", "'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n", "module.exports = function isArrayish(obj) {\n\tif (!obj || typeof obj === 'string') {\n\t\treturn false;\n\t}\n\n\treturn obj instanceof Array || Array.isArray(obj) ||\n\t\t(obj.length >= 0 && (obj.splice instanceof Function ||\n\t\t\t(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));\n};\n", "'use strict';\n\nvar isArrayish = require('is-arrayish');\n\nvar concat = Array.prototype.concat;\nvar slice = Array.prototype.slice;\n\nvar swizzle = module.exports = function swizzle(args) {\n\tvar results = [];\n\n\tfor (var i = 0, len = args.length; i < len; i++) {\n\t\tvar arg = args[i];\n\n\t\tif (isArrayish(arg)) {\n\t\t\t// http://jsperf.com/javascript-array-concat-vs-push/98\n\t\t\tresults = concat.call(results, slice.call(arg));\n\t\t} else {\n\t\t\tresults.push(arg);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nswizzle.wrap = function (fn) {\n\treturn function () {\n\t\treturn fn(swizzle(arguments));\n\t};\n};\n", "/* MIT license */\nvar colorNames = require('color-name');\nvar swizzle = require('simple-swizzle');\nvar hasOwnProperty = Object.hasOwnProperty;\n\nvar reverseNames = Object.create(null);\n\n// create a list of reverse color names\nfor (var name in colorNames) {\n\tif (hasOwnProperty.call(colorNames, name)) {\n\t\treverseNames[colorNames[name]] = name;\n\t}\n}\n\nvar cs = module.exports = {\n\tto: {},\n\tget: {}\n};\n\ncs.get = function (string) {\n\tvar prefix = string.substring(0, 3).toLowerCase();\n\tvar val;\n\tvar model;\n\tswitch (prefix) {\n\t\tcase 'hsl':\n\t\t\tval = cs.get.hsl(string);\n\t\t\tmodel = 'hsl';\n\t\t\tbreak;\n\t\tcase 'hwb':\n\t\t\tval = cs.get.hwb(string);\n\t\t\tmodel = 'hwb';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tval = cs.get.rgb(string);\n\t\t\tmodel = 'rgb';\n\t\t\tbreak;\n\t}\n\n\tif (!val) {\n\t\treturn null;\n\t}\n\n\treturn {model: model, value: val};\n};\n\ncs.get.rgb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar abbr = /^#([a-f0-9]{3,4})$/i;\n\tvar hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;\n\tvar rgba = /^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar per = /^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar keyword = /^(\\w+)$/;\n\n\tvar rgb = [0, 0, 0, 1];\n\tvar match;\n\tvar i;\n\tvar hexAlpha;\n\n\tif (match = string.match(hex)) {\n\t\thexAlpha = match[2];\n\t\tmatch = match[1];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\t// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19\n\t\t\tvar i2 = i * 2;\n\t\t\trgb[i] = parseInt(match.slice(i2, i2 + 2), 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(abbr)) {\n\t\tmatch = match[1];\n\t\thexAlpha = match[3];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i] + match[i], 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(rgba)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i + 1], 0);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(per)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(keyword)) {\n\t\tif (match[1] === 'transparent') {\n\t\t\treturn [0, 0, 0, 0];\n\t\t}\n\n\t\tif (!hasOwnProperty.call(colorNames, match[1])) {\n\t\t\treturn null;\n\t\t}\n\n\t\trgb = colorNames[match[1]];\n\t\trgb[3] = 1;\n\n\t\treturn rgb;\n\t} else {\n\t\treturn null;\n\t}\n\n\tfor (i = 0; i < 3; i++) {\n\t\trgb[i] = clamp(rgb[i], 0, 255);\n\t}\n\trgb[3] = clamp(rgb[3], 0, 1);\n\n\treturn rgb;\n};\n\ncs.get.hsl = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hsl = /^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hsl);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar s = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar l = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\n\t\treturn [h, s, l, a];\n\t}\n\n\treturn null;\n};\n\ncs.get.hwb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hwb = /^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hwb);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar w = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar b = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\t\treturn [h, w, b, a];\n\t}\n\n\treturn null;\n};\n\ncs.to.hex = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn (\n\t\t'#' +\n\t\thexDouble(rgba[0]) +\n\t\thexDouble(rgba[1]) +\n\t\thexDouble(rgba[2]) +\n\t\t(rgba[3] < 1\n\t\t\t? (hexDouble(Math.round(rgba[3] * 255)))\n\t\t\t: '')\n\t);\n};\n\ncs.to.rgb = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'\n\t\t: 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';\n};\n\ncs.to.rgb.percent = function () {\n\tvar rgba = swizzle(arguments);\n\n\tvar r = Math.round(rgba[0] / 255 * 100);\n\tvar g = Math.round(rgba[1] / 255 * 100);\n\tvar b = Math.round(rgba[2] / 255 * 100);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'\n\t\t: 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';\n};\n\ncs.to.hsl = function () {\n\tvar hsla = swizzle(arguments);\n\treturn hsla.length < 4 || hsla[3] === 1\n\t\t? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'\n\t\t: 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';\n};\n\n// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax\n// (hwb have alpha optional & 1 is default value)\ncs.to.hwb = function () {\n\tvar hwba = swizzle(arguments);\n\n\tvar a = '';\n\tif (hwba.length >= 4 && hwba[3] !== 1) {\n\t\ta = ', ' + hwba[3];\n\t}\n\n\treturn 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';\n};\n\ncs.to.keyword = function (rgb) {\n\treturn reverseNames[rgb.slice(0, 3)];\n};\n\n// helpers\nfunction clamp(num, min, max) {\n\treturn Math.min(Math.max(min, num), max);\n}\n\nfunction hexDouble(num) {\n\tvar str = Math.round(num).toString(16).toUpperCase();\n\treturn (str.length < 2) ? '0' + str : str;\n}\n", "/* MIT license */\n/* eslint-disable no-mixed-operators */\nconst cssKeywords = require('color-name');\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n// values that give correct `typeof` results).\n// do not use box values types (i.e. Number(), String(), etc.)\n\nconst reverseKeywords = {};\nfor (const key of Object.keys(cssKeywords)) {\n\treverseKeywords[cssKeywords[key]] = key;\n}\n\nconst convert = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\nmodule.exports = convert;\n\n// Hide .channels and .labels properties\nfor (const model of Object.keys(convert)) {\n\tif (!('channels' in convert[model])) {\n\t\tthrow new Error('missing channels property: ' + model);\n\t}\n\n\tif (!('labels' in convert[model])) {\n\t\tthrow new Error('missing channel labels property: ' + model);\n\t}\n\n\tif (convert[model].labels.length !== convert[model].channels) {\n\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t}\n\n\tconst {channels, labels} = convert[model];\n\tdelete convert[model].channels;\n\tdelete convert[model].labels;\n\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\tObject.defineProperty(convert[model], 'labels', {value: labels});\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst min = Math.min(r, g, b);\n\tconst max = Math.max(r, g, b);\n\tconst delta = max - min;\n\tlet h;\n\tlet s;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst l = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tlet rdif;\n\tlet gdif;\n\tlet bdif;\n\tlet h;\n\tlet s;\n\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst v = Math.max(r, g, b);\n\tconst diff = v - Math.min(r, g, b);\n\tconst diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = 0;\n\t\ts = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tconst r = rgb[0];\n\tconst g = rgb[1];\n\tlet b = rgb[2];\n\tconst h = convert.rgb.hsl(rgb)[0];\n\tconst w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\n\tconst k = Math.min(1 - r, 1 - g, 1 - b);\n\tconst c = (1 - r - k) / (1 - k) || 0;\n\tconst m = (1 - g - k) / (1 - k) || 0;\n\tconst y = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\nfunction comparativeDistance(x, y) {\n\t/*\n\t\tSee https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n\t*/\n\treturn (\n\t\t((x[0] - y[0]) ** 2) +\n\t\t((x[1] - y[1]) ** 2) +\n\t\t((x[2] - y[2]) ** 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tconst reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tlet currentClosestDistance = Infinity;\n\tlet currentClosestKeyword;\n\n\tfor (const keyword of Object.keys(cssKeywords)) {\n\t\tconst value = cssKeywords[keyword];\n\n\t\t// Compute comparative distance\n\t\tconst distance = comparativeDistance(rgb, value);\n\n\t\t// Check if its less, if so set as closest\n\t\tif (distance < currentClosestDistance) {\n\t\t\tcurrentClosestDistance = distance;\n\t\t\tcurrentClosestKeyword = keyword;\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tlet r = rgb[0] / 255;\n\tlet g = rgb[1] / 255;\n\tlet b = rgb[2] / 255;\n\n\t// Assume sRGB\n\tr = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);\n\n\tconst x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tconst y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tconst z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tconst xyz = convert.rgb.xyz(rgb);\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tconst h = hsl[0] / 360;\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\tlet t2;\n\tlet t3;\n\tlet val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tconst t1 = 2 * l - t2;\n\n\tconst rgb = [0, 0, 0];\n\tfor (let i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tconst h = hsl[0];\n\tlet s = hsl[1] / 100;\n\tlet l = hsl[2] / 100;\n\tlet smin = s;\n\tconst lmin = Math.max(l, 0.01);\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tconst v = (l + s) / 2;\n\tconst sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tconst h = hsv[0] / 60;\n\tconst s = hsv[1] / 100;\n\tlet v = hsv[2] / 100;\n\tconst hi = Math.floor(h) % 6;\n\n\tconst f = h - Math.floor(h);\n\tconst p = 255 * v * (1 - s);\n\tconst q = 255 * v * (1 - (s * f));\n\tconst t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tconst h = hsv[0];\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\tconst vmin = Math.max(v, 0.01);\n\tlet sl;\n\tlet l;\n\n\tl = (2 - s) * v;\n\tconst lmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tconst h = hwb[0] / 360;\n\tlet wh = hwb[1] / 100;\n\tlet bl = hwb[2] / 100;\n\tconst ratio = wh + bl;\n\tlet f;\n\n\t// Wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\tconst i = Math.floor(6 * h);\n\tconst v = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tconst n = wh + f * (v - wh); // Linear interpolation\n\n\tlet r;\n\tlet g;\n\tlet b;\n\t/* eslint-disable max-statements-per-line,no-multi-spaces */\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v; g = n; b = wh; break;\n\t\tcase 1: r = n; g = v; b = wh; break;\n\t\tcase 2: r = wh; g = v; b = n; break;\n\t\tcase 3: r = wh; g = n; b = v; break;\n\t\tcase 4: r = n; g = wh; b = v; break;\n\t\tcase 5: r = v; g = wh; b = n; break;\n\t}\n\t/* eslint-enable max-statements-per-line,no-multi-spaces */\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tconst c = cmyk[0] / 100;\n\tconst m = cmyk[1] / 100;\n\tconst y = cmyk[2] / 100;\n\tconst k = cmyk[3] / 100;\n\n\tconst r = 1 - Math.min(1, c * (1 - k) + k);\n\tconst g = 1 - Math.min(1, m * (1 - k) + k);\n\tconst b = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\tlet r;\n\tlet g;\n\tlet b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// Assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet x;\n\tlet y;\n\tlet z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tconst y2 = y ** 3;\n\tconst x2 = x ** 3;\n\tconst z2 = z ** 3;\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet h;\n\n\tconst hr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst c = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tconst l = lch[0];\n\tconst c = lch[1];\n\tconst h = lch[2];\n\n\tconst hr = h / 360 * 2 * Math.PI;\n\tconst a = c * Math.cos(hr);\n\tconst b = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args, saturation = null) {\n\tconst [r, g, b] = args;\n\tlet value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tlet ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// Optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tconst r = args[0];\n\tconst g = args[1];\n\tconst b = args[2];\n\n\t// We use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tconst ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tlet color = args % 10;\n\n\t// Handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tconst mult = (~~(args > 50) + 1) * 0.5;\n\tconst r = ((color & 1) * mult) * 255;\n\tconst g = (((color >> 1) & 1) * mult) * 255;\n\tconst b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// Handle greyscale\n\tif (args >= 232) {\n\t\tconst c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tlet rem;\n\tconst r = Math.floor(args / 36) / 5 * 255;\n\tconst g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tconst b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tconst integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tconst match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tlet colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(char => {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tconst integer = parseInt(colorString, 16);\n\tconst r = (integer >> 16) & 0xFF;\n\tconst g = (integer >> 8) & 0xFF;\n\tconst b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst max = Math.max(Math.max(r, g), b);\n\tconst min = Math.min(Math.min(r, g), b);\n\tconst chroma = (max - min);\n\tlet grayscale;\n\tlet hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\n\tconst c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));\n\n\tlet f = 0;\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\n\tconst c = s * v;\n\tlet f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tconst h = hcg[0] / 360;\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tconst pure = [0, 0, 0];\n\tconst hi = (h % 1) * 6;\n\tconst v = hi % 1;\n\tconst w = 1 - v;\n\tlet mg = 0;\n\n\t/* eslint-disable max-statements-per-line */\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\t/* eslint-enable max-statements-per-line */\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst v = c + g * (1.0 - c);\n\tlet f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst l = g * (1.0 - c) + 0.5 * c;\n\tlet s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\tconst v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tconst w = hwb[1] / 100;\n\tconst b = hwb[2] / 100;\n\tconst v = 1 - b;\n\tconst c = v - w;\n\tlet g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hsv = convert.gray.hsl;\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tconst val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tconst integer = (val << 16) + (val << 8) + val;\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tconst val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n", "const conversions = require('./conversions');\n\n/*\n\tThis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tconst graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tconst models = Object.keys(conversions);\n\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tconst graph = buildGraph();\n\tconst queue = [fromModel]; // Unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length) {\n\t\tconst current = queue.pop();\n\t\tconst adjacents = Object.keys(conversions[current]);\n\n\t\tfor (let len = adjacents.length, i = 0; i < len; i++) {\n\t\t\tconst adjacent = adjacents[i];\n\t\t\tconst node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tconst path = [graph[toModel].parent, toModel];\n\tlet fn = conversions[graph[toModel].parent][toModel];\n\n\tlet cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nmodule.exports = function (fromModel) {\n\tconst graph = deriveBFS(fromModel);\n\tconst conversion = {};\n\n\tconst models = Object.keys(graph);\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tconst toModel = models[i];\n\t\tconst node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// No possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n};\n\n", "const conversions = require('./conversions');\nconst route = require('./route');\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\trouteModels.forEach(toModel => {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nmodule.exports = convert;\n", "const colorString = require('color-string');\nconst convert = require('color-convert');\n\nconst skippedModels = [\n\t// To be honest, I don't really feel like keyword belongs in color convert, but eh.\n\t'keyword',\n\n\t// Gray conflicts with some method names, and has its own method defined.\n\t'gray',\n\n\t// Shouldn't really be in color-convert either...\n\t'hex',\n];\n\nconst hashedModelKeys = {};\nfor (const model of Object.keys(convert)) {\n\thashedModelKeys[[...convert[model].labels].sort().join('')] = model;\n}\n\nconst limiters = {};\n\nfunction Color(object, model) {\n\tif (!(this instanceof Color)) {\n\t\treturn new Color(object, model);\n\t}\n\n\tif (model && model in skippedModels) {\n\t\tmodel = null;\n\t}\n\n\tif (model && !(model in convert)) {\n\t\tthrow new Error('Unknown model: ' + model);\n\t}\n\n\tlet i;\n\tlet channels;\n\n\tif (object == null) { // eslint-disable-line no-eq-null,eqeqeq\n\t\tthis.model = 'rgb';\n\t\tthis.color = [0, 0, 0];\n\t\tthis.valpha = 1;\n\t} else if (object instanceof Color) {\n\t\tthis.model = object.model;\n\t\tthis.color = [...object.color];\n\t\tthis.valpha = object.valpha;\n\t} else if (typeof object === 'string') {\n\t\tconst result = colorString.get(object);\n\t\tif (result === null) {\n\t\t\tthrow new Error('Unable to parse color from string: ' + object);\n\t\t}\n\n\t\tthis.model = result.model;\n\t\tchannels = convert[this.model].channels;\n\t\tthis.color = result.value.slice(0, channels);\n\t\tthis.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;\n\t} else if (object.length > 0) {\n\t\tthis.model = model || 'rgb';\n\t\tchannels = convert[this.model].channels;\n\t\tconst newArray = Array.prototype.slice.call(object, 0, channels);\n\t\tthis.color = zeroArray(newArray, channels);\n\t\tthis.valpha = typeof object[channels] === 'number' ? object[channels] : 1;\n\t} else if (typeof object === 'number') {\n\t\t// This is always RGB - can be converted later on.\n\t\tthis.model = 'rgb';\n\t\tthis.color = [\n\t\t\t(object >> 16) & 0xFF,\n\t\t\t(object >> 8) & 0xFF,\n\t\t\tobject & 0xFF,\n\t\t];\n\t\tthis.valpha = 1;\n\t} else {\n\t\tthis.valpha = 1;\n\n\t\tconst keys = Object.keys(object);\n\t\tif ('alpha' in object) {\n\t\t\tkeys.splice(keys.indexOf('alpha'), 1);\n\t\t\tthis.valpha = typeof object.alpha === 'number' ? object.alpha : 0;\n\t\t}\n\n\t\tconst hashedKeys = keys.sort().join('');\n\t\tif (!(hashedKeys in hashedModelKeys)) {\n\t\t\tthrow new Error('Unable to parse color from object: ' + JSON.stringify(object));\n\t\t}\n\n\t\tthis.model = hashedModelKeys[hashedKeys];\n\n\t\tconst {labels} = convert[this.model];\n\t\tconst color = [];\n\t\tfor (i = 0; i < labels.length; i++) {\n\t\t\tcolor.push(object[labels[i]]);\n\t\t}\n\n\t\tthis.color = zeroArray(color);\n\t}\n\n\t// Perform limitations (clamping, etc.)\n\tif (limiters[this.model]) {\n\t\tchannels = convert[this.model].channels;\n\t\tfor (i = 0; i < channels; i++) {\n\t\t\tconst limit = limiters[this.model][i];\n\t\t\tif (limit) {\n\t\t\t\tthis.color[i] = limit(this.color[i]);\n\t\t\t}\n\t\t}\n\t}\n\n\tthis.valpha = Math.max(0, Math.min(1, this.valpha));\n\n\tif (Object.freeze) {\n\t\tObject.freeze(this);\n\t}\n}\n\nColor.prototype = {\n\ttoString() {\n\t\treturn this.string();\n\t},\n\n\ttoJSON() {\n\t\treturn this[this.model]();\n\t},\n\n\tstring(places) {\n\t\tlet self = this.model in colorString.to ? this : this.rgb();\n\t\tself = self.round(typeof places === 'number' ? places : 1);\n\t\tconst args = self.valpha === 1 ? self.color : [...self.color, this.valpha];\n\t\treturn colorString.to[self.model](args);\n\t},\n\n\tpercentString(places) {\n\t\tconst self = this.rgb().round(typeof places === 'number' ? places : 1);\n\t\tconst args = self.valpha === 1 ? self.color : [...self.color, this.valpha];\n\t\treturn colorString.to.rgb.percent(args);\n\t},\n\n\tarray() {\n\t\treturn this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];\n\t},\n\n\tobject() {\n\t\tconst result = {};\n\t\tconst {channels} = convert[this.model];\n\t\tconst {labels} = convert[this.model];\n\n\t\tfor (let i = 0; i < channels; i++) {\n\t\t\tresult[labels[i]] = this.color[i];\n\t\t}\n\n\t\tif (this.valpha !== 1) {\n\t\t\tresult.alpha = this.valpha;\n\t\t}\n\n\t\treturn result;\n\t},\n\n\tunitArray() {\n\t\tconst rgb = this.rgb().color;\n\t\trgb[0] /= 255;\n\t\trgb[1] /= 255;\n\t\trgb[2] /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.push(this.valpha);\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tunitObject() {\n\t\tconst rgb = this.rgb().object();\n\t\trgb.r /= 255;\n\t\trgb.g /= 255;\n\t\trgb.b /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.alpha = this.valpha;\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tround(places) {\n\t\tplaces = Math.max(places || 0, 0);\n\t\treturn new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);\n\t},\n\n\talpha(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);\n\t\t}\n\n\t\treturn this.valpha;\n\t},\n\n\t// Rgb\n\tred: getset('rgb', 0, maxfn(255)),\n\tgreen: getset('rgb', 1, maxfn(255)),\n\tblue: getset('rgb', 2, maxfn(255)),\n\n\thue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),\n\n\tsaturationl: getset('hsl', 1, maxfn(100)),\n\tlightness: getset('hsl', 2, maxfn(100)),\n\n\tsaturationv: getset('hsv', 1, maxfn(100)),\n\tvalue: getset('hsv', 2, maxfn(100)),\n\n\tchroma: getset('hcg', 1, maxfn(100)),\n\tgray: getset('hcg', 2, maxfn(100)),\n\n\twhite: getset('hwb', 1, maxfn(100)),\n\twblack: getset('hwb', 2, maxfn(100)),\n\n\tcyan: getset('cmyk', 0, maxfn(100)),\n\tmagenta: getset('cmyk', 1, maxfn(100)),\n\tyellow: getset('cmyk', 2, maxfn(100)),\n\tblack: getset('cmyk', 3, maxfn(100)),\n\n\tx: getset('xyz', 0, maxfn(95.047)),\n\ty: getset('xyz', 1, maxfn(100)),\n\tz: getset('xyz', 2, maxfn(108.833)),\n\n\tl: getset('lab', 0, maxfn(100)),\n\ta: getset('lab', 1),\n\tb: getset('lab', 2),\n\n\tkeyword(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\treturn convert[this.model].keyword(this.color);\n\t},\n\n\thex(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\treturn colorString.to.hex(this.rgb().round().color);\n\t},\n\n\thexa(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\tconst rgbArray = this.rgb().round().color;\n\n\t\tlet alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();\n\t\tif (alphaHex.length === 1) {\n\t\t\talphaHex = '0' + alphaHex;\n\t\t}\n\n\t\treturn colorString.to.hex(rgbArray) + alphaHex;\n\t},\n\n\trgbNumber() {\n\t\tconst rgb = this.rgb().color;\n\t\treturn ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);\n\t},\n\n\tluminosity() {\n\t\t// http://www.w3.org/TR/WCAG20/#relativeluminancedef\n\t\tconst rgb = this.rgb().color;\n\n\t\tconst lum = [];\n\t\tfor (const [i, element] of rgb.entries()) {\n\t\t\tconst chan = element / 255;\n\t\t\tlum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;\n\t\t}\n\n\t\treturn 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];\n\t},\n\n\tcontrast(color2) {\n\t\t// http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n\t\tconst lum1 = this.luminosity();\n\t\tconst lum2 = color2.luminosity();\n\n\t\tif (lum1 > lum2) {\n\t\t\treturn (lum1 + 0.05) / (lum2 + 0.05);\n\t\t}\n\n\t\treturn (lum2 + 0.05) / (lum1 + 0.05);\n\t},\n\n\tlevel(color2) {\n\t\t// https://www.w3.org/TR/WCAG/#contrast-enhanced\n\t\tconst contrastRatio = this.contrast(color2);\n\t\tif (contrastRatio >= 7) {\n\t\t\treturn 'AAA';\n\t\t}\n\n\t\treturn (contrastRatio >= 4.5) ? 'AA' : '';\n\t},\n\n\tisDark() {\n\t\t// YIQ equation from http://24ways.org/2010/calculating-color-contrast\n\t\tconst rgb = this.rgb().color;\n\t\tconst yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;\n\t\treturn yiq < 128;\n\t},\n\n\tisLight() {\n\t\treturn !this.isDark();\n\t},\n\n\tnegate() {\n\t\tconst rgb = this.rgb();\n\t\tfor (let i = 0; i < 3; i++) {\n\t\t\trgb.color[i] = 255 - rgb.color[i];\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tlighten(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[2] += hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdarken(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[2] -= hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tsaturate(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[1] += hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdesaturate(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[1] -= hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\twhiten(ratio) {\n\t\tconst hwb = this.hwb();\n\t\thwb.color[1] += hwb.color[1] * ratio;\n\t\treturn hwb;\n\t},\n\n\tblacken(ratio) {\n\t\tconst hwb = this.hwb();\n\t\thwb.color[2] += hwb.color[2] * ratio;\n\t\treturn hwb;\n\t},\n\n\tgrayscale() {\n\t\t// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale\n\t\tconst rgb = this.rgb().color;\n\t\tconst value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;\n\t\treturn Color.rgb(value, value, value);\n\t},\n\n\tfade(ratio) {\n\t\treturn this.alpha(this.valpha - (this.valpha * ratio));\n\t},\n\n\topaquer(ratio) {\n\t\treturn this.alpha(this.valpha + (this.valpha * ratio));\n\t},\n\n\trotate(degrees) {\n\t\tconst hsl = this.hsl();\n\t\tlet hue = hsl.color[0];\n\t\thue = (hue + degrees) % 360;\n\t\thue = hue < 0 ? 360 + hue : hue;\n\t\thsl.color[0] = hue;\n\t\treturn hsl;\n\t},\n\n\tmix(mixinColor, weight) {\n\t\t// Ported from sass implementation in C\n\t\t// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209\n\t\tif (!mixinColor || !mixinColor.rgb) {\n\t\t\tthrow new Error('Argument to \"mix\" was not a Color instance, but rather an instance of ' + typeof mixinColor);\n\t\t}\n\n\t\tconst color1 = mixinColor.rgb();\n\t\tconst color2 = this.rgb();\n\t\tconst p = weight === undefined ? 0.5 : weight;\n\n\t\tconst w = 2 * p - 1;\n\t\tconst a = color1.alpha() - color2.alpha();\n\n\t\tconst w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;\n\t\tconst w2 = 1 - w1;\n\n\t\treturn Color.rgb(\n\t\t\tw1 * color1.red() + w2 * color2.red(),\n\t\t\tw1 * color1.green() + w2 * color2.green(),\n\t\t\tw1 * color1.blue() + w2 * color2.blue(),\n\t\t\tcolor1.alpha() * p + color2.alpha() * (1 - p));\n\t},\n};\n\n// Model conversion methods and static constructors\nfor (const model of Object.keys(convert)) {\n\tif (skippedModels.includes(model)) {\n\t\tcontinue;\n\t}\n\n\tconst {channels} = convert[model];\n\n\t// Conversion methods\n\tColor.prototype[model] = function (...args) {\n\t\tif (this.model === model) {\n\t\t\treturn new Color(this);\n\t\t}\n\n\t\tif (args.length > 0) {\n\t\t\treturn new Color(args, model);\n\t\t}\n\n\t\treturn new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);\n\t};\n\n\t// 'static' construction methods\n\tColor[model] = function (...args) {\n\t\tlet color = args[0];\n\t\tif (typeof color === 'number') {\n\t\t\tcolor = zeroArray(args, channels);\n\t\t}\n\n\t\treturn new Color(color, model);\n\t};\n}\n\nfunction roundTo(number, places) {\n\treturn Number(number.toFixed(places));\n}\n\nfunction roundToPlace(places) {\n\treturn function (number) {\n\t\treturn roundTo(number, places);\n\t};\n}\n\nfunction getset(model, channel, modifier) {\n\tmodel = Array.isArray(model) ? model : [model];\n\n\tfor (const m of model) {\n\t\t(limiters[m] || (limiters[m] = []))[channel] = modifier;\n\t}\n\n\tmodel = model[0];\n\n\treturn function (value) {\n\t\tlet result;\n\n\t\tif (value !== undefined) {\n\t\t\tif (modifier) {\n\t\t\t\tvalue = modifier(value);\n\t\t\t}\n\n\t\t\tresult = this[model]();\n\t\t\tresult.color[channel] = value;\n\t\t\treturn result;\n\t\t}\n\n\t\tresult = this[model]().color[channel];\n\t\tif (modifier) {\n\t\t\tresult = modifier(result);\n\t\t}\n\n\t\treturn result;\n\t};\n}\n\nfunction maxfn(max) {\n\treturn function (v) {\n\t\treturn Math.max(0, Math.min(max, v));\n\t};\n}\n\nfunction assertArray(value) {\n\treturn Array.isArray(value) ? value : [value];\n}\n\nfunction zeroArray(array, length) {\n\tfor (let i = 0; i < length; i++) {\n\t\tif (typeof array[i] !== 'number') {\n\t\t\tarray[i] = 0;\n\t\t}\n\t}\n\n\treturn array;\n}\n\nmodule.exports = Color;\n", "// https://nodejs.org/api/packages.html#packages_writing_dual_packages_while_avoiding_or_minimizing_hazards\nimport HighlightJS from '../lib/core.js';\nexport { HighlightJS };\nexport default HighlightJS;\n", "const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\n \"as\", // for exports\n \"in\",\n \"of\",\n \"if\",\n \"for\",\n \"while\",\n \"finally\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\",\n \"catch\",\n \"instanceof\",\n \"with\",\n \"throw\",\n \"case\",\n \"default\",\n \"try\",\n \"switch\",\n \"continue\",\n \"typeof\",\n \"delete\",\n \"let\",\n \"yield\",\n \"const\",\n \"class\",\n // JS handles these with a special rule\n // \"get\",\n // \"set\",\n \"debugger\",\n \"async\",\n \"await\",\n \"static\",\n \"import\",\n \"from\",\n \"export\",\n \"extends\"\n];\nconst LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\",\n \"NaN\",\n \"Infinity\"\n];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // numbers and dates\n \"Math\",\n \"Date\",\n \"Number\",\n \"BigInt\",\n // text\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Int32Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n // Keyed collections\n \"Set\",\n \"Map\",\n \"WeakSet\",\n \"WeakMap\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"Atomics\",\n \"DataView\",\n \"JSON\",\n // Control abstraction objects\n \"Promise\",\n \"Generator\",\n \"GeneratorFunction\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\",\n // WebAssembly\n \"WebAssembly\"\n];\n\nconst ERROR_TYPES = [\n \"Error\",\n \"EvalError\",\n \"InternalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\"\n];\n\nconst BUILT_IN_GLOBALS = [\n \"setInterval\",\n \"setTimeout\",\n \"clearInterval\",\n \"clearTimeout\",\n\n \"require\",\n \"exports\",\n\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\"\n];\n\nconst BUILT_IN_VARIABLES = [\n \"arguments\",\n \"this\",\n \"super\",\n \"console\",\n \"window\",\n \"document\",\n \"localStorage\",\n \"sessionStorage\",\n \"module\",\n \"global\" // Node.js\n];\n\nconst BUILT_INS = [].concat(\n BUILT_IN_GLOBALS,\n TYPES,\n ERROR_TYPES\n);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \" {\n const tag = \"',\n end: ''\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // ``\n nextChar === \",\"\n ) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, { after: afterMatchIndex })) {\n response.ignoreMatch();\n }\n }\n\n // `` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // (key?: string) => Modify<\n if ((m = afterMatch.match(/^\\s*=/))) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if ((m = afterMatch.match(/^\\s+extends\\s+/))) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n { begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` +\n `[eE][+-]?(${decimalDigits})\\\\b` },\n { begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b` },\n\n // DecimalBigIntegerLiteral\n { begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b` },\n\n // NonDecimalIntegerLiteral\n { begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\" },\n { begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\" },\n { begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\" },\n\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n { begin: \"\\\\b0[0-7]+n?\\\\b\" },\n ],\n relevance: 0\n };\n\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: 'html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: 'css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: 'gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n const JSDOC_COMMENT = hljs.COMMENT(\n /\\/\\*\\*(?!\\/)/,\n '\\\\*/',\n {\n relevance: 0,\n contains: [\n {\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [\n {\n className: 'doctag',\n begin: '@[A-Za-z]+'\n },\n {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n },\n {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }\n ]\n }\n ]\n }\n );\n const COMMENT = {\n className: \"comment\",\n variants: [\n JSDOC_COMMENT,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]\n };\n const SUBST_INTERNALS = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS\n .concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\n \"self\"\n ].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }\n ]);\n const PARAMS = {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1,\n /\\s+/,\n /extends/,\n /\\s+/,\n regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n\n ]\n };\n\n const CLASS_REFERENCE = {\n relevance: 0,\n match:\n regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/,\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES,\n ...ERROR_TYPES\n ]\n }\n };\n\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n\n const FUNCTION_DEFINITION = {\n variants: [\n {\n match: [\n /function/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\s*\\()/\n ]\n },\n // anonymous function\n {\n match: [\n /function/,\n /\\s*(?=\\()/\n ]\n }\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [ PARAMS ],\n illegal: /%/\n };\n\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n\n const FUNCTION_CALL = {\n match: regex.concat(\n /\\b/,\n noneOf([\n ...BUILT_IN_GLOBALS,\n \"super\",\n \"import\"\n ]),\n IDENT_RE$1, regex.lookahead(/\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(\n regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)\n )),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n\n const GETTER_OR_SETTER = {\n match: [\n /get|set/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\()/\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n { // eat to avoid empty params\n begin: /\\(\\)/\n },\n PARAMS\n ]\n };\n\n const FUNC_LEAD_IN_RE = '(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n\n const FUNCTION_VARIABLE = {\n match: [\n /const|var|let/, /\\s+/,\n IDENT_RE$1, /\\s*/,\n /=\\s*/,\n /(async\\s*)?/, // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)\n ],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n PARAMS\n ]\n };\n\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: { PARAMS_CONTAINS, CLASS_REFERENCE },\n illegal: /#(?![$_A-z])/,\n contains: [\n hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }),\n USE_STRICT,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n COMMENT,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n CLASS_REFERENCE,\n {\n className: 'attr',\n begin: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n },\n FUNCTION_VARIABLE,\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [\n COMMENT,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n },\n {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n },\n { // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n },\n {\n match: /\\s+/,\n relevance: 0\n },\n { // JSX\n variants: [\n { begin: FRAGMENT.begin, end: FRAGMENT.end },\n { match: XML_SELF_CLOSING },\n {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }\n ],\n subLanguage: 'xml',\n contains: [\n {\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }\n ]\n }\n ],\n },\n FUNCTION_DEFINITION,\n {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n },\n {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +\n '\\\\(' + // first parens\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)\\\\s*\\\\{', // end parens\n returnBegin:true,\n label: \"func.def\",\n contains: [\n PARAMS,\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: \"title.function\" })\n ]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n },\n PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n },\n {\n match: [ /\\bconstructor(?=\\s*\\()/ ],\n className: { 1: \"title.function\" },\n contains: [ PARAMS ]\n },\n FUNCTION_CALL,\n UPPER_CASE_CONSTANT,\n CLASS_OR_EXTENDS,\n GETTER_OR_SETTER,\n {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }\n ]\n };\n}\n\nexport { javascript as default };\n", "const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\n \"as\", // for exports\n \"in\",\n \"of\",\n \"if\",\n \"for\",\n \"while\",\n \"finally\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\",\n \"catch\",\n \"instanceof\",\n \"with\",\n \"throw\",\n \"case\",\n \"default\",\n \"try\",\n \"switch\",\n \"continue\",\n \"typeof\",\n \"delete\",\n \"let\",\n \"yield\",\n \"const\",\n \"class\",\n // JS handles these with a special rule\n // \"get\",\n // \"set\",\n \"debugger\",\n \"async\",\n \"await\",\n \"static\",\n \"import\",\n \"from\",\n \"export\",\n \"extends\"\n];\nconst LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\",\n \"NaN\",\n \"Infinity\"\n];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // numbers and dates\n \"Math\",\n \"Date\",\n \"Number\",\n \"BigInt\",\n // text\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Int32Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n // Keyed collections\n \"Set\",\n \"Map\",\n \"WeakSet\",\n \"WeakMap\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"Atomics\",\n \"DataView\",\n \"JSON\",\n // Control abstraction objects\n \"Promise\",\n \"Generator\",\n \"GeneratorFunction\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\",\n // WebAssembly\n \"WebAssembly\"\n];\n\nconst ERROR_TYPES = [\n \"Error\",\n \"EvalError\",\n \"InternalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\"\n];\n\nconst BUILT_IN_GLOBALS = [\n \"setInterval\",\n \"setTimeout\",\n \"clearInterval\",\n \"clearTimeout\",\n\n \"require\",\n \"exports\",\n\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\"\n];\n\nconst BUILT_IN_VARIABLES = [\n \"arguments\",\n \"this\",\n \"super\",\n \"console\",\n \"window\",\n \"document\",\n \"localStorage\",\n \"sessionStorage\",\n \"module\",\n \"global\" // Node.js\n];\n\nconst BUILT_INS = [].concat(\n BUILT_IN_GLOBALS,\n TYPES,\n ERROR_TYPES\n);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \" {\n const tag = \"',\n end: ''\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // ``\n nextChar === \",\"\n ) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, { after: afterMatchIndex })) {\n response.ignoreMatch();\n }\n }\n\n // `` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // (key?: string) => Modify<\n if ((m = afterMatch.match(/^\\s*=/))) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if ((m = afterMatch.match(/^\\s+extends\\s+/))) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n { begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` +\n `[eE][+-]?(${decimalDigits})\\\\b` },\n { begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b` },\n\n // DecimalBigIntegerLiteral\n { begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b` },\n\n // NonDecimalIntegerLiteral\n { begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\" },\n { begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\" },\n { begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\" },\n\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n { begin: \"\\\\b0[0-7]+n?\\\\b\" },\n ],\n relevance: 0\n };\n\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: 'html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: 'css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: 'gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n const JSDOC_COMMENT = hljs.COMMENT(\n /\\/\\*\\*(?!\\/)/,\n '\\\\*/',\n {\n relevance: 0,\n contains: [\n {\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [\n {\n className: 'doctag',\n begin: '@[A-Za-z]+'\n },\n {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n },\n {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }\n ]\n }\n ]\n }\n );\n const COMMENT = {\n className: \"comment\",\n variants: [\n JSDOC_COMMENT,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]\n };\n const SUBST_INTERNALS = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS\n .concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\n \"self\"\n ].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }\n ]);\n const PARAMS = {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1,\n /\\s+/,\n /extends/,\n /\\s+/,\n regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n\n ]\n };\n\n const CLASS_REFERENCE = {\n relevance: 0,\n match:\n regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/,\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES,\n ...ERROR_TYPES\n ]\n }\n };\n\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n\n const FUNCTION_DEFINITION = {\n variants: [\n {\n match: [\n /function/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\s*\\()/\n ]\n },\n // anonymous function\n {\n match: [\n /function/,\n /\\s*(?=\\()/\n ]\n }\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [ PARAMS ],\n illegal: /%/\n };\n\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n\n const FUNCTION_CALL = {\n match: regex.concat(\n /\\b/,\n noneOf([\n ...BUILT_IN_GLOBALS,\n \"super\",\n \"import\"\n ]),\n IDENT_RE$1, regex.lookahead(/\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(\n regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)\n )),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n\n const GETTER_OR_SETTER = {\n match: [\n /get|set/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\()/\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n { // eat to avoid empty params\n begin: /\\(\\)/\n },\n PARAMS\n ]\n };\n\n const FUNC_LEAD_IN_RE = '(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n\n const FUNCTION_VARIABLE = {\n match: [\n /const|var|let/, /\\s+/,\n IDENT_RE$1, /\\s*/,\n /=\\s*/,\n /(async\\s*)?/, // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)\n ],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n PARAMS\n ]\n };\n\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: { PARAMS_CONTAINS, CLASS_REFERENCE },\n illegal: /#(?![$_A-z])/,\n contains: [\n hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }),\n USE_STRICT,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n COMMENT,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n CLASS_REFERENCE,\n {\n className: 'attr',\n begin: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n },\n FUNCTION_VARIABLE,\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [\n COMMENT,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n },\n {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n },\n { // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n },\n {\n match: /\\s+/,\n relevance: 0\n },\n { // JSX\n variants: [\n { begin: FRAGMENT.begin, end: FRAGMENT.end },\n { match: XML_SELF_CLOSING },\n {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }\n ],\n subLanguage: 'xml',\n contains: [\n {\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }\n ]\n }\n ],\n },\n FUNCTION_DEFINITION,\n {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n },\n {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +\n '\\\\(' + // first parens\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)\\\\s*\\\\{', // end parens\n returnBegin:true,\n label: \"func.def\",\n contains: [\n PARAMS,\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: \"title.function\" })\n ]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n },\n PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n },\n {\n match: [ /\\bconstructor(?=\\s*\\()/ ],\n className: { 1: \"title.function\" },\n contains: [ PARAMS ]\n },\n FUNCTION_CALL,\n UPPER_CASE_CONSTANT,\n CLASS_OR_EXTENDS,\n GETTER_OR_SETTER,\n {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }\n ]\n };\n}\n\n/*\nLanguage: TypeScript\nAuthor: Panu Horsmalahti \nContributors: Ike Ku \nDescription: TypeScript is a strict superset of JavaScript\nWebsite: https://www.typescriptlang.org\nCategory: common, scripting\n*/\n\n\n/** @type LanguageFn */\nfunction typescript(hljs) {\n const tsLanguage = javascript(hljs);\n\n const IDENT_RE$1 = IDENT_RE;\n const TYPES = [\n \"any\",\n \"void\",\n \"number\",\n \"boolean\",\n \"string\",\n \"object\",\n \"never\",\n \"symbol\",\n \"bigint\",\n \"unknown\"\n ];\n const NAMESPACE = {\n beginKeywords: 'namespace',\n end: /\\{/,\n excludeEnd: true,\n contains: [ tsLanguage.exports.CLASS_REFERENCE ]\n };\n const INTERFACE = {\n beginKeywords: 'interface',\n end: /\\{/,\n excludeEnd: true,\n keywords: {\n keyword: 'interface extends',\n built_in: TYPES\n },\n contains: [ tsLanguage.exports.CLASS_REFERENCE ]\n };\n const USE_STRICT = {\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use strict['\"]/\n };\n const TS_SPECIFIC_KEYWORDS = [\n \"type\",\n \"namespace\",\n \"interface\",\n \"public\",\n \"private\",\n \"protected\",\n \"implements\",\n \"declare\",\n \"abstract\",\n \"readonly\",\n \"enum\",\n \"override\"\n ];\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS),\n literal: LITERALS,\n built_in: BUILT_INS.concat(TYPES),\n \"variable.language\": BUILT_IN_VARIABLES\n };\n const DECORATOR = {\n className: 'meta',\n begin: '@' + IDENT_RE$1,\n };\n\n const swapMode = (mode, label, replacement) => {\n const indx = mode.contains.findIndex(m => m.label === label);\n if (indx === -1) { throw new Error(\"can not find mode to replace\"); }\n\n mode.contains.splice(indx, 1, replacement);\n };\n\n\n // this should update anywhere keywords is used since\n // it will be the same actual JS object\n Object.assign(tsLanguage.keywords, KEYWORDS$1);\n\n tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);\n tsLanguage.contains = tsLanguage.contains.concat([\n DECORATOR,\n NAMESPACE,\n INTERFACE,\n ]);\n\n // TS gets a simpler shebang rule than JS\n swapMode(tsLanguage, \"shebang\", hljs.SHEBANG());\n // JS use strict rule purposely excludes `asm` which makes no sense\n swapMode(tsLanguage, \"use_strict\", USE_STRICT);\n\n const functionDeclaration = tsLanguage.contains.find(m => m.label === \"func.def\");\n functionDeclaration.relevance = 0; // () => {} is more typical in TypeScript\n\n Object.assign(tsLanguage, {\n name: 'TypeScript',\n aliases: [\n 'ts',\n 'tsx',\n 'mts',\n 'cts'\n ]\n });\n\n return tsLanguage;\n}\n\nexport { typescript as default };\n", "/*\nLanguage: HTML, XML\nWebsite: https://www.w3.org/XML/\nCategory: common, web\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction xml(hljs) {\n const regex = hljs.regex;\n // XML names can have the following additional letters: https://www.w3.org/TR/xml/#NT-NameChar\n // OTHER_NAME_CHARS = /[:\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]/;\n // Element names start with NAME_START_CHAR followed by optional other Unicode letters, ASCII digits, hyphens, underscores, and periods\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);;\n // const XML_IDENT_RE = /[A-Z_a-z:\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]+/;\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);\n // however, to cater for performance and more Unicode support rely simply on the Unicode letter class\n const TAG_NAME_RE = regex.concat(/[\\p{L}_]/u, regex.optional(/[\\p{L}0-9_.-]*:/u), /[\\p{L}0-9_.-]*/u);\n const XML_IDENT_RE = /[\\p{L}0-9._:-]+/u;\n const XML_ENTITIES = {\n className: 'symbol',\n begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/\n };\n const XML_META_KEYWORDS = {\n begin: /\\s/,\n contains: [\n {\n className: 'keyword',\n begin: /#?[a-z_][a-z1-9_-]+/,\n illegal: /\\n/\n }\n ]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: /\\(/,\n end: /\\)/\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: 'string' });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: 'string' });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /`]+/ }\n ]\n }\n ]\n }\n ]\n };\n return {\n name: 'HTML, XML',\n aliases: [\n 'html',\n 'xhtml',\n 'rss',\n 'atom',\n 'xjb',\n 'xsd',\n 'xsl',\n 'plist',\n 'wsf',\n 'svg'\n ],\n case_insensitive: true,\n unicodeRegex: true,\n contains: [\n {\n className: 'meta',\n begin: //,\n relevance: 10,\n contains: [\n XML_META_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE,\n XML_META_PAR_KEYWORDS,\n {\n begin: /\\[/,\n end: /\\]/,\n contains: [\n {\n className: 'meta',\n begin: //,\n contains: [\n XML_META_KEYWORDS,\n XML_META_PAR_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE\n ]\n }\n ]\n }\n ]\n },\n hljs.COMMENT(\n //,\n { relevance: 10 }\n ),\n {\n begin: //,\n relevance: 10\n },\n XML_ENTITIES,\n // xml processing instructions\n {\n className: 'meta',\n end: /\\?>/,\n variants: [\n {\n begin: /<\\?xml/,\n relevance: 10,\n contains: [\n QUOTE_META_STRING_MODE\n ]\n },\n {\n begin: /<\\?[a-z][a-z0-9]+/,\n }\n ]\n\n },\n {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n ')/,\n end: />/,\n keywords: { name: 'style' },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/style>/,\n returnEnd: true,\n subLanguage: [\n 'css',\n 'xml'\n ]\n }\n },\n {\n className: 'tag',\n // See the comment in the \n let search = `${prefix}${i}`;\n while (i < length) {\n const node = tw.nextNode();\n // if not all updates are bound but there's nothing else to crawl\n // it means that there is something wrong with the template.\n if (!node)\n throw `bad template: ${text}`;\n // if the current node is a comment, and it contains is\u00B5X\n // it means the update should take care of any content\n if (node.nodeType === 8) {\n // The only comments to be considered are those\n // which content is exactly the same as the searched one.\n if (node.data === search) {\n nodes.push({type: 'node', path: createPath(node)});\n search = `${prefix}${++i}`;\n }\n }\n else {\n // if the node is not a comment, loop through all its attributes\n // named is\u00B5X and relate attribute updates to this node and the\n // attribute name, retrieved through node.getAttribute(\"is\u00B5X\")\n // the is\u00B5X attribute will be removed as irrelevant for the layout\n // let svg = -1;\n while (node.hasAttribute(search)) {\n nodes.push({\n type: 'attr',\n path: createPath(node),\n name: node.getAttribute(search),\n //svg: svg < 0 ? (svg = ('ownerSVGElement' in node ? 1 : 0)) : svg\n });\n node.removeAttribute(search);\n search = `${prefix}${++i}`;\n }\n // if the node was a style, textarea, or others, check its content\n // and if it is then update tex-only this node\n if (\n textOnly.test(node.tagName) &&\n node.textContent.trim() === ``\n ){\n node.textContent = '';\n nodes.push({type: 'text', path: createPath(node)});\n search = `${prefix}${++i}`;\n }\n }\n }\n // once all nodes to update, or their attributes, are known, the content\n // will be cloned in the future to represent the template, and all updates\n // related to such content retrieved right away without needing to re-crawl\n // the exact same template, and its content, more than once.\n return {content, nodes};\n};\n\n// if a template is unknown, perform the previous mapping, otherwise grab\n// its details such as the fragment with all nodes, and updates info.\nconst mapUpdates = (type, template) => {\n const {content, nodes} = (\n cache.get(template) ||\n cache.set(template, mapTemplate(type, template))\n );\n // clone deeply the fragment\n const fragment = document.importNode(content, true);\n // and relate an update handler per each node that needs one\n const updates = nodes.map(handlers, fragment);\n // return the fragment and all updates to use within its nodes\n return {content: fragment, updates};\n};\n\n// as html and svg can be nested calls, but no parent node is known\n// until rendered somewhere, the unroll operation is needed to\n// discover what to do with each interpolation, which will result\n// into an update operation.\nexport const unroll = (info, {type, template, values}) => {\n const {length} = values;\n // interpolations can contain holes and arrays, so these need\n // to be recursively discovered\n unrollValues(info, values, length);\n let {entry} = info;\n // if the cache entry is either null or different from the template\n // and the type this unroll should resolve, create a new entry\n // assigning a new content fragment and the list of updates.\n if (!entry || (entry.template !== template || entry.type !== type))\n info.entry = (entry = createEntry(type, template));\n const {content, updates, wire} = entry;\n // even if the fragment and its nodes is not live yet,\n // it is already possible to update via interpolations values.\n for (let i = 0; i < length; i++)\n updates[i](values[i]);\n // if the entry was new, or representing a different template or type,\n // create a new persistent entity to use during diffing.\n // This is simply a DOM node, when the template has a single container,\n // as in `

`, or a \"wire\" in `

` and similar cases.\n return wire || (entry.wire = persistent(content));\n};\n\n// the stack retains, per each interpolation value, the cache\n// related to each interpolation value, or null, if the render\n// was conditional and the value is not special (Array or Hole)\nconst unrollValues = ({stack}, values, length) => {\n for (let i = 0; i < length; i++) {\n const hole = values[i];\n // each Hole gets unrolled and re-assigned as value\n // so that domdiff will deal with a node/wire, not with a hole\n if (hole instanceof Hole)\n values[i] = unroll(\n stack[i] || (stack[i] = createCache()),\n hole\n );\n // arrays are recursively resolved so that each entry will contain\n // also a DOM node or a wire, hence it can be diffed if/when needed\n else if (isArray(hole))\n unrollValues(\n stack[i] || (stack[i] = createCache()),\n hole,\n hole.length\n );\n // if the value is nothing special, the stack doesn't need to retain data\n // this is useful also to cleanup previously retained data, if the value\n // was a Hole, or an Array, but not anymore, i.e.:\n // const update = content => html`
${content}
`;\n // update(listOfItems); update(null); update(html`hole`)\n else\n stack[i] = null;\n }\n if (length < stack.length)\n stack.splice(length);\n};\n\n/**\n * Holds all details wrappers needed to render the content further on.\n * @constructor\n * @param {string} type The hole type, either `html` or `svg`.\n * @param {string[]} template The template literals used to the define the content.\n * @param {Array} values Zero, one, or more interpolated values to render.\n */\nexport function Hole(type, template, values) {\n this.type = type;\n this.template = template;\n this.values = values;\n};\n", "import umap from 'umap';\nimport {Hole, createCache, unroll} from './rabbit.js';\nimport {foreign} from 'uhandlers';\n\nconst {create, defineProperties} = Object;\n\n// both `html` and `svg` template literal tags are polluted\n// with a `for(ref[, id])` and a `node` tag too\nconst tag = type => {\n // both `html` and `svg` tags have their own cache\n const keyed = umap(new WeakMap);\n // keyed operations always re-use the same cache and unroll\n // the template and its interpolations right away\n const fixed = cache => (template, ...values) => unroll(\n cache,\n {type, template, values}\n );\n return defineProperties(\n // non keyed operations are recognized as instance of Hole\n // during the \"unroll\", recursively resolved and updated\n (template, ...values) => new Hole(type, template, values),\n {\n for: {\n // keyed operations need a reference object, usually the parent node\n // which is showing keyed results, and optionally a unique id per each\n // related node, handy with JSON results and mutable list of objects\n // that usually carry a unique identifier\n value(ref, id) {\n const memo = keyed.get(ref) || keyed.set(ref, create(null));\n return memo[id] || (memo[id] = fixed(createCache()));\n }\n },\n node: {\n // it is possible to create one-off content out of the box via node tag\n // this might return the single created node, or a fragment with all\n // nodes present at the root level and, of course, their child nodes\n value: (template, ...values) => unroll(\n createCache(),\n {type, template, values}\n ).valueOf()\n }\n }\n );\n};\n\n// each rendered node gets its own cache\nconst cache = umap(new WeakMap);\n\n// rendering means understanding what `html` or `svg` tags returned\n// and it relates a specific node to its own unique cache.\n// Each time the content to render changes, the node is cleaned up\n// and the new new content is appended, and if such content is a Hole\n// then it's \"unrolled\" to resolve all its inner nodes.\nconst render = (where, what) => {\n const hole = typeof what === 'function' ? what() : what;\n const info = cache.get(where) || cache.set(where, createCache());\n const wire = hole instanceof Hole ? unroll(info, hole) : hole;\n if (wire !== info.wire) {\n info.wire = wire;\n where.textContent = '';\n // valueOf() simply returns the node itself, but in case it was a \"wire\"\n // it will eventually re-append all nodes to its fragment so that such\n // fragment can be re-appended many times in a meaningful way\n // (wires are basically persistent fragments facades with special behavior)\n where.appendChild(wire.valueOf());\n }\n return where;\n};\n\nconst html = tag('html');\nconst svg = tag('svg');\n\nexport {Hole, render, html, svg, foreign};\n", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nconst Color = require('color');\n\n\nexport interface CheckboxStyleParam {\n bgColor?: string;\n activeColor?: string;\n}\n\nexport class CheckboxStyle extends StyleClass {\n static default: CheckboxStyleParam = {\n bgColor: '#ccc',\n activeColor: 'blue'\n }\n static css(style: CheckboxStyleParam = {}): string {\n style = { ...this.default, ...style };\n let css = `\n position: relative;\n width: 1em;\n height: 1em;\n user-select: none;\n display: inline-block;\n\n /* Hide the browser's default checkbox */\n input {\n opacity: 0;\n cursor: pointer;\n width: 1em;\n height: 1em;\n margin: 0;\n position: absolute;\n top: 1;\n left: 0;\n z-index: 1;\n }\n\n /* Create a custom checkbox */\n span {\n position: absolute;\n top: 0;\n left: 0;\n width: 1em;\n height: 1em;\n box-shadow: 0 1px 1px 0 grey;\n }\n\n /* Create the checkmark/indicator (hidden when not checked) */\n span:after {\n content: \"\";\n position: absolute;\n display: none;\n }\n\n /* Show the checkmark when checked */\n input:checked ~ span:after {\n display: block;\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: CheckboxStyleParam = {}): string {\n let css = `\n ${this._bgColor(style)}\n ${this._activeColor(style)}\n `.trim();\n \n return css;\n }\n\n static _bgColor(style: CheckboxStyleParam = {}): string {\n if (style.bgColor == undefined) { return '' };\n return `\n span {\n background-color: ${style.bgColor};\n }\n `.trim();\n }\n\n static _activeColor(style: CheckboxStyleParam = {}): string {\n if (style.activeColor == undefined) { return '' };\n\n let markColor = 'black';\n if (Color(style.activeColor).isDark()) {\n markColor = 'white';\n }\n\n return `\n /* Style the checkmark/indicator */\n span:after {\n border: solid ${markColor};\n left: 0.25em;\n width: 0.3em;\n height: 0.6em;\n border-width: 0 0.2em 0.2em 0;\n transform: rotate(45deg);\n }\n\n /* When the checkbox is checked, add background color */\n input:checked ~ span {\n background-color: ${style.activeColor};\n }\n\n /* On mouse-over, add background color */\n &:hover input ~ span {\n background-color: ${Color(style.activeColor).lighten(0.2)}\n }\n `.trim();\n }\n}", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\n\n\nexport class InputStyle extends StyleClass {\n static css(style = {}): string {\n return `\n font-size: 1em;\n border: 1px solid grey;\n border-radius: 0.2em;\n padding: 0.4em;\n `.trim()\n }\n}", "import { addStyle, Adapter } from \"@nitipit/adapter/src/adapter\";\nimport { InputStyle } from './input.style';\n\n\nexport class Input extends Adapter {\n static Style = InputStyle;\n}\n\naddStyle`\ninput {\n ${InputStyle.css()}\n}`;", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nvar Color = require('color');\n\nexport interface InputRadioStyleParam {\n color?: string;\n boxShadowColor?: string;\n activeColor?: string;\n}\n\n\nexport class InputRadioStyle extends StyleClass {\n static readonly default: InputRadioStyleParam = {\n color: '#ccc',\n boxShadowColor: '#777',\n activeColor: 'blue'\n }\n\n static css(style: InputRadioStyleParam = {}): string {\n style = {...this.default, ...style};\n let markDotColor = 'black';\n if (Color(style.activeColor).isDark()) {\n markDotColor = 'white';\n }\n\n const css = `\n position: relative;\n display: inline-block;\n font-size: 1em;\n user-select: none;\n width: 1.1em;\n height: 1.1em;\n input {\n position: absolute;\n z-index: 1;\n top: 0;\n left: 0;\n opacity: 0;\n cursor: pointer;\n width: 1.1em;\n height: 1.1em;\n vertical-align: middle;\n }\n\n /* Create a custom radio button */\n span {\n position: absolute;\n top: 0;\n left: 0;\n width: 1.1em;\n height: 1.1em;\n border-radius: 50%;\n }\n\n /* Create the indicator (the dot/circle - hidden when not checked) */\n span:after {\n content: \"\";\n position: absolute;\n display: none;\n }\n\n /* Show the indicator (dot/circle) when checked */\n input:checked ~ span:after {\n display: block;\n }\n\n /* Style the indicator (dot/circle) */\n span:after {\n top: 0.35em;\n left: 0.35em;\n width: 0.4em;\n height: 0.4em;\n border-radius: 50%;\n background-color: ${markDotColor};\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: InputRadioStyleParam = {}): string {\n const css = `\n ${this._color(style)}\n ${this._boxShadowColor(style)}\n ${this._activeColor(style)}\n `.trim();\n\n return css;\n }\n\n static _color(style: InputRadioStyleParam = {}): string {\n if (style.color == undefined) { return '' };\n return `\n span {\n background-color: ${style.color};\n }\n `.trim();\n }\n\n static _boxShadowColor(style: InputRadioStyleParam = {}): string {\n if (style.boxShadowColor == undefined) { return '' };\n return `\n span {\n box-shadow: 0 1px 1px 0 ${style.boxShadowColor};\n }`.trim();\n }\n\n static _activeColor(style: InputRadioStyleParam = {}): string {\n if (style.activeColor == undefined) { return '' };\n return`\n /* On mouse-over, add a background color */\n &:hover input ~ span {\n background-color: ${Color(style.activeColor).lighten(0.2).saturate(0.2)};\n }\n\n /* When the radio button is checked, add background color */\n input:checked ~ span {\n background-color: ${style.activeColor};\n }`.trim();\n }\n}", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nimport { bgColor } from \"../../style\";\nconst Color = require('color');\n\n\nexport class TagStyleParam {\n color?: string;\n borderRadius?: string;\n}\n\nexport class TagStyle extends StyleClass {\n static readonly default: TagStyleParam = {\n color: 'blue',\n borderRadius: '4px'\n }\n\n static css(style: TagStyleParam = {}): string {\n style = {...this.default, ...style};\n\n let css = `\n display: inline-flex;\n align-items: center;\n padding: 0.1em 0.4em;\n font-size: 0.9em;\n line-height: unset;\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: TagStyleParam = {}): string {\n let css = `\n ${this._color(style)}\n ${this._borderRadius(style)}\n `.trim();\n\n return css;\n }\n\n static _color(style: TagStyleParam = {}): string {\n if (style.color == undefined) { return '' };\n return `\n ${bgColor(style.color)}\n box-shadow: 0 0.17em 0 0 ${Color(style.color).darken(0.5)};\n `.trim();\n }\n\n static _borderRadius(style: TagStyleParam = {}): string {\n if (style.borderRadius == undefined) { return '' };\n return `\n border-radius: ${style.borderRadius};\n `.trim();\n }\n}\n\n", "import { TagStyle } from \"./tag.style\";\nimport { bgColorInt } from \"../../style\";\nconst Color = require('color');\n\n\nexport interface TagXStyleParam {\n color?: string;\n borderRadius?: string;\n}\n\nexport class TagXStyle extends TagStyle {\n static default: TagXStyleParam = {\n color: 'blue',\n borderRadius: '4px'\n }\n\n static css(style: TagXStyleParam = {}): string {\n style = { ...this.default, ...style };\n let css = `\n ${super.css(style)}\n padding-right: 0;\n [el=\"remove\"] {\n margin-left: 0.3em;\n padding-left: 0.4em;\n padding-right: 0.5em;\n font-weight: bold;\n border-left: 1px solid;\n cursor: pointer;\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: TagXStyleParam = {}): string {\n let css = `\n ${this._color(style)}\n ${this._borderRadius(style)}\n `.trim();\n return css;\n }\n\n static _color(style: TagXStyleParam = {}): string {\n if (style.color == undefined) { return '' };\n return `\n ${bgColorInt({color: style.color})}\n box-shadow: 0 0.17em 0 0 ${Color(style.color).darken(0.5)};\n `.trim();\n }\n\n static _borderRadius(style: TagXStyleParam = {}): string {\n if (style.borderRadius == undefined) { return '' };\n return super._borderRadius(style);\n }\n}", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nimport { bgColor } from \"../../style\";\nconst Color = require('color');\n\nexport interface MenuStyleParam {\n hoverColor?: string;\n arrowColor?: string;\n}\n\nexport class MenuStyle extends StyleClass {\n static readonly default: MenuStyleParam = {\n hoverColor: 'blue',\n arrowColor: 'blue'\n }\n\n static css(style: MenuStyleParam = {}) {\n style = {...this.default, ...style};\n const css = `\n display: block;\n padding: 0;\n margin: 0;\n border: 1px solid blue;\n border-radius: 0.2em;\n\n .arrow i {\n font-size: 1.2em;\n float: right;\n border-left: 0.25em solid transparent;\n border-right: 0.25em solid transparent;\n will-change: transform;\n transform: rotateZ(90deg);\n transition: transform 0.2s;\n }\n\n ul {\n margin: 0;\n padding-left: 1em;\n transition: height 0.2s;\n will-change: transition;\n }\n\n > ul {\n padding-left: 0;\n }\n\n li {\n list-style: none;\n display: block;\n overflow-y: hidden;\n overflow-x: hidden;\n }\n\n a {\n display: flex;\n align-items: center;\n cursor: pointer;\n padding: 0.5em 1em;\n div.content {\n width: 100%;\n }\n div.arrow {\n min-width: 1em;\n }\n }\n\n a ~ ul {\n height: 0;\n }\n\n a.show {\n .arrow i {\n transform: rotateZ(180deg);\n }\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: MenuStyleParam = {}): string {\n const css = `\n ${this._hoverColor(style)}\n ${this._arrowColor(style)}\n `.trim();\n return css;\n }\n\n static _hoverColor(style: MenuStyleParam = {}): string {\n if (style.hoverColor == undefined) { return '' };\n let arrowColor = 'black';\n if (Color(style.hoverColor).isDark()) {\n arrowColor = 'white';\n }\n return `\n a {\n -webkit-tap-highlight-color: ${Color(style.hoverColor)};\n }\n a:hover {\n ${bgColor(style.hoverColor)};\n .arrow i {\n border-bottom-color: ${arrowColor};\n }\n }\n `.trim();\n }\n static _arrowColor(style: MenuStyleParam = {}): string {\n if (style.arrowColor == undefined) { return '' };\n return `\n .arrow i {\n border-bottom: 0.25em solid ${style.arrowColor};\n }\n `.trim();\n }\n}", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nimport { bgColor } from \"../../style\";\nconst Color = require('color');\n\n\nexport interface TableStyleParam {\n theadBgColor?: string;\n activeColor?: string;\n verticalLine?: boolean;\n horizontalLine?: boolean;\n}\n\n\nexport class TableStyle extends StyleClass {\n static readonly default: TableStyleParam = {\n theadBgColor: '#ccc',\n activeColor: 'blue',\n horizontalLine: true,\n verticalLine: true,\n }\n static css(style: TableStyleParam = {}): string {\n style = {...this.default, ...style};\n const css = `\n display: block;\n overflow: auto;\n border: 1px solid;\n border-collapse: separate;\n border-spacing: 0;\n\n thead {\n font-weight: bold;\n }\n th, td {\n padding: 0.5rem;\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: TableStyleParam = {}): string {\n const css = `\n ${this._theadBgColor(style)}\n ${this._activeColor(style)}\n ${this._horizontalLine(style)}\n ${this._verticalLine(style)}\n `.trim();\n return css;\n }\n\n static _theadBgColor(style: TableStyleParam = {}): string {\n if (style.theadBgColor == undefined) { return '' };\n return `\n thead {\n ${bgColor(style.theadBgColor)}\n }`.trim();\n }\n\n static _activeColor(style: TableStyleParam = {}): string {\n if (style.activeColor == undefined) { return '' };\n return `\n tbody td:hover {\n ${bgColor(style.activeColor)}\n &::selection {\n ${bgColor(Color(style.activeColor).rotate(180))}\n }\n }\n `.trim();\n }\n\n static _horizontalLine(style: TableStyleParam = {}): string {\n if (style.horizontalLine == undefined) { return '' };\n let horizontalLineCSS = null;\n if (style.horizontalLine) {\n horizontalLineCSS = `\n td, th {\n border-bottom: 1px solid;\n }\n thead {\n td, th {\n border-bottom: 3px double;\n }\n }`.trim();\n } else {\n horizontalLineCSS = `\n td, th {\n border-bottom: 0;\n }\n thead {\n td, th {\n border-bottom: 0;\n }\n }`.trim();\n }\n return horizontalLineCSS;\n }\n\n static _verticalLine(style: TableStyleParam = {}): string {\n if (style.verticalLine == undefined) { return };\n let verticalLineCSS = null;\n if (style.verticalLine) {\n verticalLineCSS = `\n td:not(:first-child), th:not(:first-child) {\n border-left: 1px solid;\n }`.trim();\n } else {\n verticalLineCSS = `\n td:not(:first-child), th:not(:first-child) {\n border-left: 0;\n }`.trim();\n }\n return verticalLineCSS;\n }\n}", "const color = {\n blue: \"#3584e4\",\n green: \"#33d17a\",\n yellow: \"#f6d32d\",\n orange: \"#ff7800\",\n red: \"#e01b24\",\n purple: \"#9141ac\",\n violet: \"#9141ac\",\n brown: \"#986a44\",\n light: \"#deddda\",\n dark: \"#3d3846\"\n}\n\nexport { color };", "export function sleepSync(ms: number) {\n const end = new Date().getTime() + ms;\n let time = new Date().getTime();\n while (time < end) {\n time = new Date().getTime();\n }\n return time;\n}\n\nexport function uuid() {\n return sleepSync(1).toString(36);\n}", "export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\n", "/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n\n/**\n * @param {string[]} array\n * @param {RegExp} pattern\n * @return {string[]}\n */\nexport function filter (array, pattern) {\n\treturn array.filter(function (value) { return !match(value, pattern) })\n}\n", "import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {object[]} siblings\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length, siblings) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props)\n}\n\n/**\n * @param {object} root\n */\nexport function lift (root) {\n\twhile (root.root)\n\t\troot = copy(root.root, {children: [root]})\n\n\tappend(root, root.siblings)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n", "import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @param {object[]} siblings\n * @return {object}\n */\nexport function comment (value, root, parent, siblings) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function declaration (value, root, parent, length, siblings) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings)\n}\n", "import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\n\tfor (var i = 0; i < children.length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: if (!strlen(element.value = element.props.join(','))) return ''\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n", "import { compile, serialize, stringify } from 'stylis';\n\nexport function stylis(css: string) {\n return serialize(compile(css), stringify);\n}\n", "import { uuid } from './util.js';\nimport { stylis } from './cssProcessor/stylis.bundle.js';\n\ntype Constructor = new (...args: any[]) => T;\n\nexport function AdapterMixin>(\n Base: TBase\n) {\n return class Adapter extends Base {\n /** CSSStyleSheet() for this component */\n static _cssStyleSheet: CSSStyleSheet;\n\n /** Tag name of this component */\n static _tagName: string | null;\n\n /** Styles which contain only css for this component */\n static _styles: string[] = [];\n\n /** CSS Process middleware, This function will be called\n * before applying CSS to CSSStyleSheet.\n */\n static cssProcess(css: string): string {\n return css;\n }\n\n /**\n * Retreive styles for this component,\n * also prevent inherit values from super class.\n */\n static get styles(): string[] {\n if (this._styles === Object.getPrototypeOf(this).styles) {\n this._styles = [];\n }\n return this._styles;\n }\n\n /** Retreive inherited styles for all super classes. */\n static get allStyles(): string[] {\n let superClass = Object.getPrototypeOf(this);\n const allStyles = [];\n\n while (superClass.styles !== undefined) {\n allStyles.push(...superClass.styles);\n superClass = Object.getPrototypeOf(superClass);\n }\n allStyles.push(...this.styles);\n return allStyles;\n }\n\n /** Set CSS for this component */\n static set css(css: string) {\n this._styles = [css];\n\n if (this.tagName) {\n this.cssStyleSheet.replaceSync(\n this.cssProcess(`${this.tagName} { ${this.allCSS} }`)\n );\n }\n }\n\n /** Get CSS for this component, includes inherited styles */\n static get css(): string {\n return this.styles.join(\"\\n\");\n }\n\n static get allCSS(): string {\n return this.allStyles.join(\"\\n\");\n }\n\n /** Get tagName for this class which will be defined after\n * the class has been registerd with CustomElementsRegistry.\n */\n static get tagName(): string | null {\n if (this._tagName === Object.getPrototypeOf(this).tagName) {\n this._tagName = null;\n }\n return this._tagName;\n }\n\n /** Get CSSStyleSheet() for this component.\n * Create a new one if haven't been created yet.\n */\n static get cssStyleSheet(): CSSStyleSheet {\n const superCSSStyleSheet = Object.getPrototypeOf(this)._cssStyleSheet;\n if (this._cssStyleSheet === superCSSStyleSheet) {\n this._cssStyleSheet = new CSSStyleSheet();\n }\n return this._cssStyleSheet;\n }\n\n /** Add style to this component */\n static addStyle(css: string) {\n this._styles = this._styles.concat(css);\n\n if (this.tagName) {\n const rule = `${this.tagName} { ${css} }`;\n const processedCss = this.cssProcess(rule);\n this.cssStyleSheet.insertRule(\n processedCss,\n this.cssStyleSheet.cssRules.length\n );\n }\n }\n\n /**\n * Define component to element tag and init component style.\n * To extends this function, sub-elements must be defined\n * before call this function as `super.define(tagName);`\n */\n static define(tagName: string): void {\n this._tagName = tagName;\n customElements.define(tagName, this);\n this.initStyle();\n }\n\n /** Init component style */\n static initStyle() {\n this.cssStyleSheet.replaceSync(\n this.cssProcess(`${this.tagName} { ${this.allCSS} }`)\n );\n document.adoptedStyleSheets.push(this.cssStyleSheet);\n }\n /** @deprecated, will be removed */\n static tagStyle(css: string): void {\n console.warn('tagStyle() is deprecated, use addStyle() instead');\n this.addStyle(css);\n }\n\n /** @deprecated, will be removed */\n static classStyle(class_: string, css: string) {\n console.warn('classStyle() is deprecated, use addStyle() instead');\n this.addStyle(`&.${class_} { ${css} }`);\n }\n\n _class!: typeof Adapter; // instance's class for using as shortcut\n\n _cssStyleSheet?: CSSStyleSheet;\n\n // index of this.cssStyleSheet in document.adoptedStyleSheets\n adoptedStyleSheetIndex!: number;\n\n _uuid?: string;\n\n _shadowRoot!: ShadowRoot|null;\n\n /**\n * In constructor, there any some if condition to check\n * if it has been inited or not to prevent recursive call in Mixin\n */\n constructor(...args: any[]) {\n super(...args);\n if (!this._class) { this.initClass() };\n }\n\n /** Dynamically create and return uuid for the element */\n get uuid(): string {\n if (!this._uuid) {\n this._uuid = `${this.tagName}-${uuid()}`;\n }\n return this._uuid;\n }\n\n /**\n * Dynamically create a CSSStyleSheet() and keep track of the adopted\n * stylesheet index for reference.\n */\n get cssStyleSheet() {\n if (this._cssStyleSheet) { return this._cssStyleSheet };\n\n this._cssStyleSheet = new CSSStyleSheet();\n\n /** For normal element, attach this._cssStyleSheet to the document */\n if (!this._shadowRoot) {\n const index = document.adoptedStyleSheets.length;\n this.classList.add(this.uuid);\n document.adoptedStyleSheets[index] = this._cssStyleSheet;\n this.adoptedStyleSheetIndex = index;\n }\n\n return this._cssStyleSheet;\n }\n\n /**\n * Return a selector for the this element as a class chain.\n */\n get objectClassSelector(): string {\n return this.classList.value.replace(/ /g, \".\");\n }\n\n /**\n * Set CSS for this element.\n * It works like `` but with CSS processor.\n */\n set css(css: string) {\n // Init cssStyleSheet if it hasn't been inited yet.\n this.cssStyleSheet;\n\n const processedCss = this._class.cssProcess(\n `${this.tagName}.${this.objectClassSelector} { ${css} }`\n );\n \n this.cssStyleSheet.replaceSync(processedCss);\n }\n\n /** Get CSS for this element */\n get css(): string {\n let css = ``;\n for (const rule of this.cssStyleSheet.cssRules) {\n css += rule.cssText + \"\\n\";\n }\n return css;\n }\n\n initClass() {\n this._class = this.constructor as unknown as typeof Adapter;\n\n /**\n * If class tagName has been defined from somewhere else.\n * Then it shouldn't be initialized again.\n */\n if (this._class.tagName) {\n return;\n }\n this._class._tagName = this.tagName;\n this._class.initStyle();\n }\n\n /** Override super.attachShadow()\n * to add this.cssStyleSheet to shadowRoot\n */\n attachShadow(init: ShadowRootInit): ShadowRoot {\n const shadowRoot = super.attachShadow(init);\n shadowRoot.adoptedStyleSheets = [\n this._class.cssStyleSheet,\n this.cssStyleSheet\n ];\n document.adoptedStyleSheets.splice(this.adoptedStyleSheetIndex, 1);\n this._shadowRoot = shadowRoot;\n return shadowRoot;\n }\n\n /** Add style for this element */\n addStyle(css: string): void {\n // Init cssStyleSheet if it hasn't been inited yet.\n this.cssStyleSheet;\n\n const processedCss = this._class.cssProcess(\n `${this.tagName}.${this.objectClassSelector} { ${css} }`\n );\n\n this.cssStyleSheet.insertRule(\n processedCss,\n this.cssStyleSheet.cssRules.length\n );\n }\n\n /** Remove the element from DOM and remove adoptedStyleSheet */\n delete() {\n if (!this._shadowRoot) {\n document.adoptedStyleSheets.splice(this.adoptedStyleSheetIndex, 1)\n };\n this.remove();\n }\n };\n}\n\nexport class Adapter extends AdapterMixin(HTMLElement) {\n static cssProcess(css: string): string {\n return stylis(css);\n }\n}\n", "import { bgColor, fontFluid } from \"gadjet/src/gadjet\";\nimport { color } from \"./_ux/designToken\";\nimport { stylis } from './adapter';\n\n\nfunction baseStyle(to_base_url: string) {\n const __base_url = new URL(import.meta.url);\n const __fira_sans_url = new URL(`${to_base_url}asset/font/FiraSans-Regular.ttf`, __base_url.href);\n const __fira_code_url = new URL(`${to_base_url}asset/font/FiraCode-Variable.ttf`, __base_url.href);\n\n const style = new CSSStyleSheet();\n document.adoptedStyleSheets.push(style);\n style.replaceSync(stylis(/*css*/`\n @font-face {\n font-family: sans;\n src: url(${__fira_sans_url});\n }\n\n @font-face {\n font-family: monospace;\n src: url(${__fira_code_url});\n }\n\n html {\n line-height: 1.75;\n font-family: sans;\n ${fontFluid({\n fontSizeMin: 16,\n fontSizeMax: 18,\n vwMin: 400,\n vwMax: 1200\n })}\n }\n\n body {\n margin: 0;\n padding: 0;\n padding-bottom: 10rem;\n }\n\n code {\n padding: 0.1rem 0.5rem;\n ${bgColor(color.light)}\n border-radius: 0.25em;\n font-family: monospace;\n font-size: 0.85em;\n }\n\n p, h1, h2, h3, h4, ul, li {\n max-width: 80ch;\n margin: auto;\n }\n\n p ~ ol {\n margin-top: -0.7rem;\n }\n\n p ~ ol ~ p {\n margin-top: -0.7rem;\n }\n\n .width-100 {\n width: 100%;\n }\n\n .text-width {\n width: 100%;\n max-width: 80ch;\n }\n\n .container {\n display: block;\n max-width: 1000px;\n min-width: 300px;\n width: 90%;\n margin: auto;\n\n h1, h2, h3 {\n max-width: 45rem;\n }\n\n & h2 {\n line-height: 2;\n text-align: center;\n margin: auto;\n margin-top: 3rem;\n margin-bottom: 2rem;\n font-size: 1.5rem;\n }\n & h3 {\n text-decoration: underline;\n margin: auto;\n margin-top: 2rem;\n margin-bottom: 1rem;\n font-size: 1.25rem;\n }\n & h4 {\n font-size: 1rem;\n margin-top: 1rem;\n margin-bottom: 0.5rem;\n }\n }\n\n .flex {\n display: flex;\n flex-wrap: wrap;\n }\n `));\n}\n\nexport { baseStyle };", "type Constructor = new (...args: any[]) => T;\n\nclass Icon {\n static url: string;\n\n set name(name: string) {\n this._element.setAttribute('name', name);\n this.render();\n }\n\n get name() {\n return this._element.getAttribute('name');\n }\n\n _element: HTMLElement;\n _class: typeof Icon;\n\n constructor(element: HTMLElement) {\n this._class = this.constructor as typeof Icon;\n this._element = element;\n this.render();\n\n const observer = new MutationObserver((mutationRecords, observer) => {\n this.observerCallback(mutationRecords, observer)\n })\n observer.observe(this._element, {attributes: true});\n }\n\n observerCallback(\n mutationRecords: MutationRecord[],\n observer: MutationObserver) {\n \n for (const mutation of mutationRecords) {\n if (mutation.type === \"attributes\") {\n if (mutation.attributeName === \"name\") {\n this.render();\n }\n }\n }\n }\n\n render() {\n if (!this._class.url) {\n return;\n }\n let svg = document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"svg\");\n let use = document.createElementNS(\n 'http://www.w3.org/2000/svg',\n 'use');\n\n this._element.innerHTML = '';\n svg.style.width = '1em';\n svg.style.height = '1em';\n this._element.appendChild(svg);\n use.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n 'xlink:href',\n `${this._class.url}#${this.name}`);\n svg.appendChild(use);\n }\n}\n\ninterface IconParam {\n url: string;\n deficonField?: any; \n}\n\nfunction DefIconMixin>(\n {url, deficonField='deficon'}: IconParam,\n Base: TBase) {\n\n class _Icon extends Icon {};\n _Icon.url = url;\n\n return class DefIconMixin extends Base {\n [key: string]: any;\n\n constructor(...args: any[]) {\n super(...args);\n this[deficonField] = new _Icon(this);\n };\n }\n}\n\nfunction DefIcon(param: IconParam) {\n return class DefIcon extends DefIconMixin(param, HTMLElement) {};\n}\n\nexport { DefIconMixin, DefIcon };", "import Color from \"color\";\n\nfunction bgColor(color) {\n return /*css*/`\n background-color: ${color};\n color: ${Color(color).isDark() ? 'white' : 'black'};\n `.trim();\n}\n\nfunction lift(level: number, color: string = 'black') {\n return `filter: drop-shadow(0 0 ${level * 2}px ${color});`;\n}\n\nfunction pxToRem(px: any) {\n px = parseFloat(px);\n const rem1 = parseFloat(\n getComputedStyle(document.documentElement).fontSize);\n return `${px / rem1}rem`;\n}\n\nconst aspectRatio = (ratio: string = '1/1'): string => {\n return `\n height: auto;\n aspect-ratio: ${ratio};\n @supports not (aspect-ratio: ${ratio}) {\n &::before {\n float: left;\n padding-top: 100% / ${ratio};\n content: \"\";\n }\n\n &::after {\n display: block;\n content: \"\";\n clear: both;\n }\n }\n `.trim();\n}\n\nexport { bgColor, lift, pxToRem, aspectRatio };", "import { Adapter } from \"../../adapter.js\";\nimport { bgColor } from '../style.js';\nimport { color } from '../designToken'; \n\nclass CodeBlock extends Adapter {\n static css = /*css*/`\n & {\n display: block;\n margin: auto;\n margin-top: 1.5rem;\n max-width: 80ch;\n line-height: 1.5;\n }\n [el=\"bar-top-left\"] {\n display: inline-flex;\n ${bgColor(color.yellow)}\n border-top-left-radius: 0.4em;\n border-top-right-radius: 0.4em;\n line-height: 2;\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n font-size: 0.8rem;\n }\n & pre {\n margin-top: 0;\n font-size: 0.8rem;\n & code {\n all: unset;\n border-bottom-left-radius: 0.4em;\n border-bottom-right-radius: 0.4em;\n border-top-right-radius: 0.4em;\n }\n }\n `;\n};\n\nexport { CodeBlock };", "import { Adapter } from \"../../adapter.js\";\nimport { color } from '../designToken.js';\nimport Color from 'color';\n\nexport class BlockQuote extends Adapter {\n static css = /*css*/`\n & {\n display: flex;\n }\n & blockquote {\n margin: 0;\n padding: 0rem 1rem;\n background-color: ${Color(color.yellow).alpha(0.2)};\n border-left: 0.25em solid ${color.yellow};\n border-bottom-left-radius: 0.5rem;\n }\n `\n}", "import { Adapter } from \"../../adapter.js\";\nimport Color from 'color';\nimport { bgColor, lift } from '../style';\n\nconst buttonStyle = (color) => {\n return /*css*/`\n & {\n display: inline-flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n }\n\n & button {\n display: inline-flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n border: 0;\n border-radius: 0.25rem;\n padding: 0.5rem 0.7rem;\n font-weight: bold;\n line-height: 1;\n cursor: pointer;\n ${lift(0.7, '#555')}\n ${bgColor(color)}\n &:hover {\n background-color: ${Color(color)\n .lighten(0.1)\n .saturate(0.1)};\n ${lift(1.1, '#555')}\n }\n &:active {\n background-color: ${Color(color)\n .darken(0.1)\n .saturate(-0.1)};\n ${lift(0.5, '#555')}\n }\n }\n `\n}\n\nclass Button extends Adapter {\n initialHTML = this.innerHTML;\n\n constructor() {\n super();\n this.render();\n }\n\n render() {\n this.innerHTML = ``;\n }\n};\n\nexport { buttonStyle, Button };", "import { DefIcon } from '@devcapsule/deficon';\nimport { AdapterMixin } from './adapter';\n\nimport { CodeBlock } from './_ux/ui/code-block';\nimport { BlockQuote } from './_ux/ui/blockquote';\nimport { Button, buttonStyle } from './_ux/ui/button';\nimport { color } from './_ux/designToken';\n\nfunction baseComponents(to_base_url: string) {\n const __base_url = new URL(import.meta.url);\n\n const icomoon_url = new URL(\n 'asset/icon/icomoon/symbol-defs.svg', __base_url\n ).toString();\n\n class Icon extends AdapterMixin(DefIcon({url: icomoon_url})) {\n static css = /*css*/`\n & {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n }\n `\n };\n Icon.define('el-icon');\n\n CodeBlock.define('el-code-block');\n Button.define('el-button');\n Button.css = /*css*/`\n & {\n ${buttonStyle(color.blue)}\n }\n button {\n min-height: 2em;\n }\n el-icon {\n margin-top: -0.17rem;\n }\n `;\n BlockQuote.define('el-blockquote');\n};\n\nexport { baseComponents };", "function pageReload(to_base_url: string) {\n const __file_url = new URL(import.meta.url);\n const __event_source = new URL(`${to_base_url}esbuild`, __file_url.href)\n\n if (['0.0.0.0', '127.0.0.1', 'localhost'].includes(__file_url.hostname)) {\n new EventSource(__event_source).addEventListener(\n 'change',\n () => location.reload());\n };\n};\n\nexport { pageReload };", "import { aspectRatio } from './_ux/style';\n\nconst cssStyleSheet = new CSSStyleSheet();\n\ncssStyleSheet.replaceSync(/*css*/`\n.aspect-ratio-21-9 {\n display: flex;\n ${aspectRatio('21/9')}\n img {\n width: 100%;\n object-fit: cover;\n }\n}\n`);\n\ndocument.adoptedStyleSheets.push(cssStyleSheet);\n", "import 'highlight.js/styles/monokai.css';\n\nimport { baseLib } from './_base.lib';\nbaseLib();\n\nimport { baseStyle } from './_base.style';\nbaseStyle('./');\n\nimport { baseComponents } from './_base.comp';\nbaseComponents('./');\n\nimport { pageReload } from './_base.esbuild';\npageReload('./');\n\nimport './styleClass';"], - "mappings": ";;;;;;6BAAA;AAEA,SAAS,WAAW,IAAK,CACvB,OAAI,eAAe,IACjB,IAAI,MACF,IAAI,OACJ,IAAI;AACF,UAAY,CACV,MAAM,IAAI,MAAM,kBAAkB,CACpC,EACK,eAAe,MACxB,IAAI,IACF;AAAI,MACJ,IAAI,OACF,UAAY,CACV,MAAM,IAAI,MAAM,kBAAkB,CACpC,GAIN,OAAO;AAAO,GAAG,EAEjB,OAAO,oBAAoB,GAAG,EAAE,QAAS,MAAS,CAChD,IAAM,KAAO,IAAI,IAAI,EACf,KAAO,OAAO;AAAA,CAGf,OAAS,UAAY,OAAS,aAAe,CAAC,OAAO,SAAS,IAAI,GACrE,WAAW,IAAI,CAEnB,CAAC;AAEM,GACT,CA/BS,gCAqCT,IAAM,SAAN,KAAe,CAvCf,MAuCe;AAAA,MAIb,YAAY,KAAM,CAEZ,KAAK,OAAS,SAAW,KAAK,KAAO,CAAC,GAE1C,KAAK,KAAO,KAAK,KACjB;AAAK,eAAiB,EACxB,CAEA,aAAc,CACZ,KAAK,eAAiB,EACxB,CACF,EAMA,SAAS,WAAW,MAAO;AACzB,OAAO,MACJ,QAAQ,KAAM,OAAO,EACrB,QAAQ,KAAM,MAAM,EACpB,QAAQ,KAAM,MAAM,EACpB;AAAQ,KAAM,QAAQ,EACtB,QAAQ,KAA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,CACf,KACA,KACA,KACA,KACA,MACA;AAAA,IACA,UACA,MACA,MACA,WACA,KACA,SACA,OACA,OACA,QACA;AACA,aACA,OACA,QACA,OACA,UACA,MACA,SACA,WACA;AACA,SACA,MACA,QACA,QACA,QAIA,WACA,QACA,QACA,SACA;AAAA,IACA,OACA,SACA,SACF,EACM,SAAW,CACf,OACA,QACA,OACA,YACA;AACA,UACF,EAGM,MAAQ,CAEZ,SACA,WACA,UACA,SAEA,OACA,OACA;AACA,SAEA,SACA,SAEA,QACA,eACA,eACA,YACA;AAAA,UACA,oBACA,aACA,aACA,cACA;AAAA,IACA,gBACA,iBAEA,MACA,MACA,UACA,UAEA;AAAA,GACA,oBACA,UACA,WACA,OAEA,UACA,YACA;AAAA,aACA,gBAEA,UACA,QAEA,OAEA,aACF,EAEM,YAAc;AAClB,QACA,YACA,gBACA,aACA,iBACA;AACA,YACA,UACF,EAEM,iBAAmB,CACvB,cACA,aACA;AAAA,KACA,eAEA,UACA,UAEA,OACA,WACA,QACA,aACA;AAAA,UACA,YACA,qBACA,YACA,qBACA;AAAA,KACA,UACF,EAEM,mBAAqB,CACzB,YACA,OACA,QACA,UACA;AAAA,GACA,WACA,eACA,iBACA,SACA,QACF,EAEM,UAAY,CAAC,EAAE;AACnB,iBACA,MACA,WACF,EAWA,SAAS,WAAW,KAAM,CACxB,IAAM,MAAQ,KAAK;AAQb,cAAgB,QAACC,OAAO,CAAE,KAAM,IAAM,CAC1C,IAAMC,KAAM,KAAOD,OAAM,CAAC,EAAE,MAAM,CAAC,EAEnC,OADYA;AAAM,MAAM,QAAQC,KAAK,KAAK,IAC3B,EACjB,EAJsB,iBAMhB,WAAa,SACb,SAAW,CACf,MAAO;AAAA,IACP,IAAK,KACP,EAEM,iBAAmB,4BACnB,QAAU,CACd,MAAO;AACP,IAAK,4BAKL,kBAAmB,CAACD,OAAO,WAAa,CACtC,IAAM,gBAAkBA,OAAM,CAAC;AAAE,OAASA,OAAM,MAC1C,SAAWA,OAAM,MA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AAe,2BACjB,EACA,CAIE,MAAO,kBAAoB,KAAK;AAC9B,gEAOF,YAAY,GACZ,MAAO;AAAA,UACP,SAAU,CACR,OACA,KAAK,QAAQ,KAAK,WAAY,CAAE,MAAO,WAAY,UAAW;AAAA,eAAiB,CAAC,CAClF,CACF,EAEA,CACE,MAAO,SACP,UAAW,CACb,EACA,gBAIA,CACE,MAAO,MAAQ;AACf,UAAW,CACb,EACA,CACE,MAAO,CAAE,wBAAyB,EAClC,UAAW,CAAE,EAAG,gBAAiB,EACjC,SAAU;AAAE,MAAO,CACrB,EACA,cACA,oBACA,iBACA,iBACA,CACE,MAAO,QACT,CACF,CACF,CACF;AAplBS,gCCvKT,IAAMC,UAAW,2BACXC,UAAW,CACf,KACA,KACA,KACA,KACA,MACA;AAAA,MACA,UACA,MACA,MACA,WACA,KACA,SACA,OACA,OACA,QACA;AAAA,GACA,aACA,OACA,QACA,OACA,UACA,MACA,SACA,WACA;AAAA,GACA,SACA,MACA,QACA,QACA,QAIA,WACA,QACA,QACA,SACA;AAAA,OACA,OACA,SACA,SACF,EACMC,UAAW,CACf,OACA,QACA,OACA,YACA;AAAA,KACA,UACF,EAGMC,OAAQ,CAEZ,SACA,WACA,UACA,SAEA,OACA,OACA;AAAA,OACA,SAEA,SACA,SAEA,QACA,eACA,eACA;AAAA,IACA,aACA,oBACA,aACA,aACA,cACA;AAAA,WACA,gBACA,iBAEA,MACA,MACA,UACA,UAEA;AAAA,UACA,oBACA,UACA,WACA,OAEA,UACA;AACA,oBACA,gBAEA,UACA,QAEA,OAEA,aACF,EAEMC,aAAc;AAClB,QACA,YACA,gBACA,aACA,iBACA;AACA,YACA,UACF,EAEMC,kBAAmB,CACvB,cACA,aACA;AAAA,MACA,eAEA,UACA,UAEA,OACA,WACA,QACA;AACA,WACA,YACA,qBACA,YACA,qBACA;AAAA,MACA,UACF,EAEMC,oBAAqB,CACzB,YACA,OACA,QACA,UACA;AAAA,KACA,WACA,eACA,iBACA,SACA,QACF,EAEMC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O;AAAA,6BAA+B,EACxC,CAAE,MAAO,8BAA+B,EAIxC,CAAE,MAAO;AAAA,aAAkB,CAC7B,EACA,UAAW,CACb,EAEM,MAAQ,CACZ,UAAW,QACX,MAAO,SACP,IAAK,MACL,SAAU;AACV,SAAU,CAAC,CACb,EACM,cAAgB,CACpB,MAAO,QACP,IAAK,GACL,OAAQ,CACN,IAAK,IACL,UAAW,GACX,SAAU;AACR,KAAK,iBACL,KACF,EACA,YAAa,KACf,CACF,EACM,aAAe,CACnB,MAAO,OACP,IAAK;AACL,OAAQ,CACN,IAAK,IACL,UAAW,GACX,SAAU,CACR,KAAK,iBACL,KACF,EACA,YAAa;AAAA,IACf,CACF,EACM,iBAAmB,CACvB,MAAO,OACP,IAAK,GACL,OAAQ,CACN,IAAK,IACL,UAAW,GACX,SAAU;AACR,KAAK,iBACL,KACF,EACA,YAAa,SACf,CACF,EACM,gBAAkB,CACtB,UAAW;AAAA,QACX,MAAO,IACP,IAAK,IACL,SAAU,CACR,KAAK,iBACL,KACF,CACF,EAwCMK,SAAU,CACd,UAAW;AAAA,SACX,SAAU,CAzCU,KAAK,QACzB,eACA,OACA,CACE,UAAW,EACX,SAAU,CACR,CACE,MAAO;AAAA,gBACP,UAAW,EACX,SAAU,CACR,CACE,UAAW,SACX,MAAO,YACT,EACA,CACE,UAAW;AAAA,MACX,MAAO,MACP,IAAK,MACL,WAAY,GACZ,aAAc,GACd,UAAW,CACb,EACA,CACE,UAAW;AAAA,UACX,MAAO,WAAa,gBACpB,WAAY,GACZ,UAAW,CACb,EAGA,CACE,MAAO;AACP,UAAW,CACb,CACF,CACF,CACF,CACF,CACF,EAKI,KAAK,qBACL,KAAK,mBACP,CACF,EACM,gBAAkB;AACtB,KAAK,iBACL,KAAK,kBACL,cACA,aACA;AACA,gBAEA,CAAE,MAAO,OAAQ,EACjB,MAIF,EACA,MAAM,SAAW,gBACd,OAAO,CAGN,MAAO;AACP,IAAK,KACL,SAAU,WACV,SAAU,CACR,MACF,EAA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K,QAAQ,kBAAmB,CAC5D,MAAO,KACP,IAAK,IACP,CAAC,EACK,sBAAwB;AAAK,QAAQ,KAAK,iBAAkB,CAAE,UAAW,QAAS,CAAC,EACnF,uBAAyB;AAAK,QAAQ,KAAK,kBAAmB,CAAE,UAAW,QAAS,CAAC,EACrF,cAAgB,CACpB,eAAgB;AAChB,QAAS,IACT,UAAW,EACX,SAAU,CACR,CACE,UAAW,OACX,MAAO,aACP,UAAW,CACb;AACA,CACE,MAAO,OACP,UAAW,EACX,SAAU,CACR,CACE,UAAW,SACX,WAAY,GACZ,SAAU;AACR,CACE,MAAO,IACP,IAAK,IACL,SAAU,CAAE,YAAa,CAC3B,EACA,CACE,MAAO,IACP,IAAK,IACL,SAAU,CAAE,YAAa,CAC3B;AACA,CAAE,MAAO,cAAe,CAC1B,CACF,CACF,CACF,CACF,CACF,EACA,MAAO,CACL,KAAM,YACN,QAAS,CACP,OACA,QACA;AAAA,GACA,OACA,MACA,MACA,MACA,QACA,MACA,KACF,EACA,iBAAkB,GAClB,aAAc;AACd,SAAU,CACR,CACE,UAAW,OACX,MAAO,UACP,IAAK,IACL,UAAW,GACX,SAAU,CACR;AACA,uBACA,sBACA,sBACA,CACE,MAAO,KACP,IAAK;AACL,SAAU,CACR,CACE,UAAW,OACX,MAAO,UACP,IAAK,IACL,SAAU,CACR;AACA,sBACA,uBACA,qBACF,CACF,CACF,CACF,CACF,CACF,EACA,KAAK;AACH,OACA,MACA,CAAE,UAAW,EAAG,CAClB,EACA,CACE,MAAO,cACP,IAAK,QACL,UAAW,EACb,EACA;AAEA,CACE,UAAW,OACX,IAAK,MACL,SAAU,CACR,CACE,MAAO,SACP,UAAW,GACX,SAAU,CACR,sBACF,CACF;AACA,CACE,MAAO,mBACT,CACF,CAEF,EACA,CACE,UAAW,MAMX,MAAO,iBACP,IAAK,IACL,SAAU;AAAE,KAAM,OAAQ,EAC1B,SAAU,CAAE,aAAc,EAC1B,OAAQ,CACN,IAAK,YACL,UAAW,GACX,YAAa;AACX,MACA,KACF,CACF,CACF,EACA,CACE,UAAW,MAEX,MAAO,kBACP,IAAK,IACL,SAAU,CAAE,KAAM;AAAA,OAAS,EAC3B,SAAU,CAAE,aAAc,EAC1B,OAAQ,CACN,IAAK,aACL,UAAW,GACX,YAAa;AACX,aACA,aACA,KACF,CACF,CACF,EAEA,CACE,UAAW,MACX,MAAO,SACT,EAEA,CACE,UAAW;AAAA,KACX,MAAO,MAAM,OACX,IACA,MAAM,UAAU,MAAM,OACpB,YAIA,MAAM;AAAO,MAAO,IAAK,IAAI,CAC/B,CAAC,CACH,EACA,IAAK,OACL,SAAU,CACR,CACE,UAAW,OACX,MAAO,YACP,UAAW;AACX,OAAQ,aACV,CACF,CACF,EAEA,CACE,UAAW,MACX,MAAO,MAAM,OACX,MACA,MAAM;AAAU,MAAM,OACpB,YAAa,GACf,CAAC,CACH,EACA,SAAU,CACR,CACE,UAAW,OACX,MAAO,YACP,UAAW,CACb;AACA,CACE,MAAO,IACP,UAAW,EACX,WAAY,EACd,CACF,CACF,CACF,CACF,CACF,CAtOS,kBCCT,SAAS,MAAM,KAAM,CACnB,MAAO,CACL,KAAM,gBACN,QAAS,CACP,UACA;AAAA,EACF,EACA,SAAU,CACR,CACE,UAAW,cAIX,MAAO;AACP,OAAQ,CACN,IAAK,gBACL,YAAa,MACf,CACF,CACF,CACF,CACF,CArBS,sBCTT,IAAM,MAAQ,OAAC,OACN,CACL,UAAW,CACT,MAAO,OACP,MAAO,YACT,EACA,cAAe;AAAK,qBACpB,SAAU,CACR,MAAO,SACP,MAAO,iDACT;AACA,kBAAmB,CACjB,UAAW,WACX,MAAO,cACT,EACA,wBAAyB;AACvB,MAAO,gBACP,MAAO,KACP,IAAK,KACL,QAAS,IACT,SAAU,CACR,KAAK;AACL,KAAK,iBACP,CACF,EACA,gBAAiB,CACf,MAAO,SACP,MAAO,KAAK,UAAY;AAAA;AAAA,gBASxB,UAAW,CACb,EACA,aAAc,CACZ,UAAW,OACX,MAAO,2BACT,CACF;AA1CY,SA6CR,KAAO,CACX,IACA,OACA,UACA,UACA,QACA,QACA,IACA,aACA;AAAA,MACA,SACA,SACA,UACA,OACA,OACA,KACA,MACA,UACA,MACA;AACA,KACA,KACA,KACA,WACA,aACA,SACA,SACA,OACA,KACA,KACA,KACA;AAAA,IACA,KACA,KACA,SACA,SACA,OACA,IACA,SACA,MACA,QACA,MACA,MACA;AAAA,MACA,SACA,KACA,OACA,OACA,OACA,MACA,SACA,KACA,IACA,IACA,QACA;AAAA,IACA,UACA,OACA,SACA,UACA,MACA,QACA,QACA,KACA,WACA;AAAA,MACA,KACA,QACA,OACA,KACA,KACA,MACA,OACF,EAEM,eAAiB,CACrB,YACA;AAAA,aACA,eACA,QACA,cACA,cACA;AAAA,MACA,gBACA,eACA,eACA,gBACA,OACA;AAAA,IACA,QACA,kBACA,aACA,cACA,iBACA;AAAA,YACA,UACA,uBACA,mBACA;AAAA,SACA,+BACA,aACA,OACA,YACA;AACA,QAEA,YACA,YACA,aACA,YACF,EAGM,eAAiB,CACrB;AAAA,IACA,WACA,QACA,UACA,UACA,UACA,UACA,MACA;AACA,OACA,QACA,UACA,QACA,cACA,gBACA,aACA;AAAA,KACA,QACA,gBACA,eACA,MACA,OACA,eACA;AACA,gBACA,WACA,UACA,KACA,OACA,aACA,eACA;AAAA,IACA,OACA,aACA,MACA,YACA,UACA,iBACA;AAAA,IACA,mBACA,cACA,aACA,eACA,WACA;AAAA,WACA,OACA,oBACA,YACA,aACA,WACA;AACA,OACA,QACA,SACA,gBACA,eACA,QACA,UACA,OACF;AAGM,gBAAkB,CACtB,QACA,WACA,SACA,MACA,aACA,eACA;AAAA,YACA,gBACA,SACA,OACA,cACA,YACA;AACA,gBACF,EAEM,WAAa,CACjB,gBACA,cACA,aACA,MACA;AAAA,WACA,kBACA,sBACA,qBACA;AAAA,cACA,4BACA,iBACA;AACA,4BACA,sBACA,aACA;AAAA,OACA,wBACA,kBACA,mBACA;AAAA,OACA,oBACA,sBACA,oBACA;AAAA,OACA,aACA,SACA,eACA,qBACA;AAAA,IACA,yBACA,yBACA,yBACA;AAAA,oBACA,2BACA,2BACA;AAAA,qBACA,qBACA,qBACA,gBACA;AAAA,qBACA,4BACA,6BACA;AAAA,oBACA,sBACA,kBACA,eACA;AAAA,UACA,sBACA,sBACA,qBACA;AAAA,iBACA,qBACA,gBACA,sBACA;AAAA,gBACA,0BACA,0BACA;AAAA,cACA,sBACA,4BACA;AAAA,YACA,4BACA,sBACA;AAAA,IACA,cACA,oBACA,oBACA,oBACA;AAAA,cACA,eACA,qBACA,qBACA;AAAA,YACA,iBACA,eACA,aACA,mBACA;AAAA,qBACA,0BACA,mBACA;AAAA,KACA,eACA,SACA,uBACA,aACA,aACA;AAAA,YACA,eACA,eACA,eACA,cACA,QACA;AAAA,MACA,YACA,YACA,QACA,eACA,cACA;AACA,cACA,oBACA,oBACA,oBACA;AAAA,QACA,eACA,UACA,UACA,UACA,qBACA;AAAA,cACA,gBACA,MACA,YACA,aACA,SACA;AACA,UACA,cACA,SACA,OACA,aACA,iBACA;AACA,YACA,cACA,YACA,QACA,OACA,OACA,eACA;AAAA,SACA,wBACA,eACA,yBACA;AAAA,KACA,mBACA,iBACA,eACA,aACA;AAAA,MACA,eACA,oBACA,0BACA;AAAA,YACA,uBACA,wBACA;AAAA,KACA,cACA,MACA,6BACA,OACA,YACA;AAAA,aACA,iBACA,iBACA,cACA,kBACA;AAAA,mBACA,WACA,WACA,eACA,iBACA;AAAA,SACA,sBACA,wBACA,qBACA;AAAA,kBACA,SACA,UACA,OACA,oBACA;AACA,mBACA,WACA,cACA,YACA,kBACA;AACA,iBACA,aACA,cACA,aACA,mBACA;AAAA,kBACA,kBACA,SACA,eACA,mBACA;AAAA,oBACA,gBACA,gBACA,oBACA;AAAA,cACA,cACA,eACA,aACA,QACA,OACA;AAAA,KACA,mBACA,qBACA,qBACA;AAAA,MACA,qBACA,oBACA,YACA,iBACA;AAAA,SACA,YACA,cACA,gBACA,cACA,YACA;AAAA,SACA,iBACA,aACA,kBACA,YACA;AAAA,MACA,aACA,kBACA,YACA,iBACA,WACA;AAAA,SACA,WACA,YACA,SACA,OACA,SACA,aACA;AAAA,QACA,UACA,QACA,UACA,UACA,gBACA,iBACA;AAAA,eACA,gBACA,WACA,gBACA,aACA;AAAA,IACA,UACA,gBACA,oBACA,sBACA;AAAA,SACA,iBACA,qBACA,uBACA;AAAA,KACA,gBACA,cACA,mBACA,oBACA;AAAA,cACA,QACA,cACA,eACA,cACA;AAAA,MACA,iBACA,WACA,SACA,SACA,OACA,aACA;AAAA,MACA,QACA,UACA,gBACA,sBACA;AAAA,QACA,4BACA,uBACA;AACA,2BACA,6BACA,qBACA;AAAA,mBACA,oBACA,iBACA,uBACA;AAAA,0BACA,6BACA,wBACA;AAAA,uBACA,4BACA;AACA,sBACA,uBACA,qBACA;AAAA,MACA,mBACA,mBACA,kBACA;AACA,kBACA,wBACA,eACA,gBACA;AACA,WACA,MACA,WACA,eACA,aACA,iBACA;AAAA,WACA,uBACA,kBACA,wBACA;AAAA,mBACA,wBACA,gBACA;AACA,yBACA,sBACA,cACA,eACA;AAAA,eACA,gBACA,iBACA,cACA,iBACA;AAAA,yBACA,MACA,YACA,gBACA,mBACA;AAAA,gBACA,aACA,mBACA,sBACA;AAAA,YACA,6BACA,eACA,iBACA;AAAA,MACA,gBACA,iBACA,eACA,cACA;AACA,aACA,eACA,eACA,cACA,SACA,QACA;AAAA,QACA,aACA,eACA,YACA,eACA,SAGF,EAAE,QAAQ;AAUV,SAAS,IAAI,KAAM,CACjB,IAAM,MAAQ,KAAK,MACb,MAAQ,MAAM,IAAI,EAClB,cAAgB,CAAE,MAAO,8BAA+B;AACxD,aAAe,kBACf,eAAiB,oBACjBM,UAAW;AAAA,sBACX,QAAU,CACd,KAAK,iBACL,KAAK,iBACP,EAEA,MAAO;AACL,KAAM,MACN,iBAAkB,GAClB,QAAS,UACT,SAAU,CAAE,iBAAkB;AAAA,KAAU,EACxC,iBAAkB,CAG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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MASjC,WAAW,OAAO,eAAe,CACrC,CAhCS,wCCRT,SAAS,WAAW,YAAqB,CACrC,IAAM,WAAa,IAAI,IAAI,YAAY,GAAG,EACpC,eAAiB,IAAI;AAAI,GAAG,WAAW,UAAW,WAAW,IAAI,EAEnE,CAAC,UAAW,YAAa,WAAW,EAAE;AAAS,WAAW,QAAQ,GAClE,IAAI,YAAY,cAAc,EAAE,iBAC5B;AACA,IAAM,SAAS,OAAO,CAAC,CAEnC,CATS,gCCET,IAAM,cAAgB,IAAI,cAE1B,cAAc,YAAmB;AAAA;AAAA;AAAA,MAG3BC,aAAY,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAMxB,EAED,SAAS,mBAAmB,KAAK,aAAa,ECZ9C,QAAQ,EAGR,UAAU,IAAI,EAGd,eAAe,IAAI,EAGnB,WAAW,IAAI", + "sourcesContent": ["/* eslint-disable no-multi-assign */\n\nfunction deepFreeze(obj) {\n if (obj instanceof Map) {\n obj.clear =\n obj.delete =\n obj.set =\n function () {\n throw new Error('map is read-only');\n };\n } else if (obj instanceof Set) {\n obj.add =\n obj.clear =\n obj.delete =\n function () {\n throw new Error('set is read-only');\n };\n }\n\n // Freeze self\n Object.freeze(obj);\n\n Object.getOwnPropertyNames(obj).forEach((name) => {\n const prop = obj[name];\n const type = typeof prop;\n\n // Freeze prop if it is an object or function and also not already frozen\n if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {\n deepFreeze(prop);\n }\n });\n\n return obj;\n}\n\n/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */\n/** @typedef {import('highlight.js').CompiledMode} CompiledMode */\n/** @implements CallbackResponse */\n\nclass Response {\n /**\n * @param {CompiledMode} mode\n */\n constructor(mode) {\n // eslint-disable-next-line no-undefined\n if (mode.data === undefined) mode.data = {};\n\n this.data = mode.data;\n this.isMatchIgnored = false;\n }\n\n ignoreMatch() {\n this.isMatchIgnored = true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {string}\n */\nfunction escapeHTML(value) {\n return value\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/**\n * performs a shallow merge of multiple objects into one\n *\n * @template T\n * @param {T} original\n * @param {Record[]} objects\n * @returns {T} a single new object\n */\nfunction inherit$1(original, ...objects) {\n /** @type Record */\n const result = Object.create(null);\n\n for (const key in original) {\n result[key] = original[key];\n }\n objects.forEach(function(obj) {\n for (const key in obj) {\n result[key] = obj[key];\n }\n });\n return /** @type {T} */ (result);\n}\n\n/**\n * @typedef {object} Renderer\n * @property {(text: string) => void} addText\n * @property {(node: Node) => void} openNode\n * @property {(node: Node) => void} closeNode\n * @property {() => string} value\n */\n\n/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */\n/** @typedef {{walk: (r: Renderer) => void}} Tree */\n/** */\n\nconst SPAN_CLOSE = '
';\n\n/**\n * Determines if a node needs to be wrapped in \n *\n * @param {Node} node */\nconst emitsWrappingTags = (node) => {\n // rarely we can have a sublanguage where language is undefined\n // TODO: track down why\n return !!node.scope;\n};\n\n/**\n *\n * @param {string} name\n * @param {{prefix:string}} options\n */\nconst scopeToCSSClass = (name, { prefix }) => {\n // sub-language\n if (name.startsWith(\"language:\")) {\n return name.replace(\"language:\", \"language-\");\n }\n // tiered scope: comment.line\n if (name.includes(\".\")) {\n const pieces = name.split(\".\");\n return [\n `${prefix}${pieces.shift()}`,\n ...(pieces.map((x, i) => `${x}${\"_\".repeat(i + 1)}`))\n ].join(\" \");\n }\n // simple scope\n return `${prefix}${name}`;\n};\n\n/** @type {Renderer} */\nclass HTMLRenderer {\n /**\n * Creates a new HTMLRenderer\n *\n * @param {Tree} parseTree - the parse tree (must support `walk` API)\n * @param {{classPrefix: string}} options\n */\n constructor(parseTree, options) {\n this.buffer = \"\";\n this.classPrefix = options.classPrefix;\n parseTree.walk(this);\n }\n\n /**\n * Adds texts to the output stream\n *\n * @param {string} text */\n addText(text) {\n this.buffer += escapeHTML(text);\n }\n\n /**\n * Adds a node open to the output stream (if needed)\n *\n * @param {Node} node */\n openNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n const className = scopeToCSSClass(node.scope,\n { prefix: this.classPrefix });\n this.span(className);\n }\n\n /**\n * Adds a node close to the output stream (if needed)\n *\n * @param {Node} node */\n closeNode(node) {\n if (!emitsWrappingTags(node)) return;\n\n this.buffer += SPAN_CLOSE;\n }\n\n /**\n * returns the accumulated buffer\n */\n value() {\n return this.buffer;\n }\n\n // helpers\n\n /**\n * Builds a span element\n *\n * @param {string} className */\n span(className) {\n this.buffer += ``;\n }\n}\n\n/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */\n/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */\n/** @typedef {import('highlight.js').Emitter} Emitter */\n/** */\n\n/** @returns {DataNode} */\nconst newNode = (opts = {}) => {\n /** @type DataNode */\n const result = { children: [] };\n Object.assign(result, opts);\n return result;\n};\n\nclass TokenTree {\n constructor() {\n /** @type DataNode */\n this.rootNode = newNode();\n this.stack = [this.rootNode];\n }\n\n get top() {\n return this.stack[this.stack.length - 1];\n }\n\n get root() { return this.rootNode; }\n\n /** @param {Node} node */\n add(node) {\n this.top.children.push(node);\n }\n\n /** @param {string} scope */\n openNode(scope) {\n /** @type Node */\n const node = newNode({ scope });\n this.add(node);\n this.stack.push(node);\n }\n\n closeNode() {\n if (this.stack.length > 1) {\n return this.stack.pop();\n }\n // eslint-disable-next-line no-undefined\n return undefined;\n }\n\n closeAllNodes() {\n while (this.closeNode());\n }\n\n toJSON() {\n return JSON.stringify(this.rootNode, null, 4);\n }\n\n /**\n * @typedef { import(\"./html_renderer\").Renderer } Renderer\n * @param {Renderer} builder\n */\n walk(builder) {\n // this does not\n return this.constructor._walk(builder, this.rootNode);\n // this works\n // return TokenTree._walk(builder, this.rootNode);\n }\n\n /**\n * @param {Renderer} builder\n * @param {Node} node\n */\n static _walk(builder, node) {\n if (typeof node === \"string\") {\n builder.addText(node);\n } else if (node.children) {\n builder.openNode(node);\n node.children.forEach((child) => this._walk(builder, child));\n builder.closeNode(node);\n }\n return builder;\n }\n\n /**\n * @param {Node} node\n */\n static _collapse(node) {\n if (typeof node === \"string\") return;\n if (!node.children) return;\n\n if (node.children.every(el => typeof el === \"string\")) {\n // node.text = node.children.join(\"\");\n // delete node.children;\n node.children = [node.children.join(\"\")];\n } else {\n node.children.forEach((child) => {\n TokenTree._collapse(child);\n });\n }\n }\n}\n\n/**\n Currently this is all private API, but this is the minimal API necessary\n that an Emitter must implement to fully support the parser.\n\n Minimal interface:\n\n - addText(text)\n - __addSublanguage(emitter, subLanguageName)\n - startScope(scope)\n - endScope()\n - finalize()\n - toHTML()\n\n*/\n\n/**\n * @implements {Emitter}\n */\nclass TokenTreeEmitter extends TokenTree {\n /**\n * @param {*} options\n */\n constructor(options) {\n super();\n this.options = options;\n }\n\n /**\n * @param {string} text\n */\n addText(text) {\n if (text === \"\") { return; }\n\n this.add(text);\n }\n\n /** @param {string} scope */\n startScope(scope) {\n this.openNode(scope);\n }\n\n endScope() {\n this.closeNode();\n }\n\n /**\n * @param {Emitter & {root: DataNode}} emitter\n * @param {string} name\n */\n __addSublanguage(emitter, name) {\n /** @type DataNode */\n const node = emitter.root;\n if (name) node.scope = `language:${name}`;\n\n this.add(node);\n }\n\n toHTML() {\n const renderer = new HTMLRenderer(this, this.options);\n return renderer.value();\n }\n\n finalize() {\n this.closeAllNodes();\n return true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction anyNumberOfTimes(re) {\n return concat('(?:', re, ')*');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction optional(re) {\n return concat('(?:', re, ')?');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '('\n + (opts.capture ? \"\" : \"?:\")\n + args.map((x) => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\n/**\n * @param {RegExp | string} re\n * @returns {number}\n */\nfunction countMatchGroups(re) {\n return (new RegExp(re.toString() + '|')).exec('').length - 1;\n}\n\n/**\n * Does lexeme start with a regular expression match at the beginning\n * @param {RegExp} re\n * @param {string} lexeme\n */\nfunction startsWith(re, lexeme) {\n const match = re && re.exec(lexeme);\n return match && match.index === 0;\n}\n\n// BACKREF_RE matches an open parenthesis or backreference. To avoid\n// an incorrect parse, it additionally matches the following:\n// - [...] elements, where the meaning of parentheses and escapes change\n// - other escape sequences, so we do not misparse escape sequences as\n// interesting elements\n// - non-matching or lookahead parentheses, which do not capture. These\n// follow the '(' with a '?'.\nconst BACKREF_RE = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n\n// **INTERNAL** Not intended for outside usage\n// join logically computes regexps.join(separator), but fixes the\n// backreferences so they continue to match.\n// it also places each individual regular expression into it's own\n// match group, keeping track of the sequencing of those match groups\n// is currently an exercise for the caller. :-)\n/**\n * @param {(string | RegExp)[]} regexps\n * @param {{joinWith: string}} opts\n * @returns {string}\n */\nfunction _rewriteBackreferences(regexps, { joinWith }) {\n let numCaptures = 0;\n\n return regexps.map((regex) => {\n numCaptures += 1;\n const offset = numCaptures;\n let re = source(regex);\n let out = '';\n\n while (re.length > 0) {\n const match = BACKREF_RE.exec(re);\n if (!match) {\n out += re;\n break;\n }\n out += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] === '\\\\' && match[1]) {\n // Adjust the backreference.\n out += '\\\\' + String(Number(match[1]) + offset);\n } else {\n out += match[0];\n if (match[0] === '(') {\n numCaptures++;\n }\n }\n }\n return out;\n }).map(re => `(${re})`).join(joinWith);\n}\n\n/** @typedef {import('highlight.js').Mode} Mode */\n/** @typedef {import('highlight.js').ModeCallback} ModeCallback */\n\n// Common regexps\nconst MATCH_NOTHING_RE = /\\b\\B/;\nconst IDENT_RE = '[a-zA-Z]\\\\w*';\nconst UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\nconst NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\nconst C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\nconst BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\nconst RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n/**\n* @param { Partial & {binary?: string | RegExp} } opts\n*/\nconst SHEBANG = (opts = {}) => {\n const beginShebang = /^#![ ]*\\//;\n if (opts.binary) {\n opts.begin = concat(\n beginShebang,\n /.*\\b/,\n opts.binary,\n /\\b.*/);\n }\n return inherit$1({\n scope: 'meta',\n begin: beginShebang,\n end: /$/,\n relevance: 0,\n /** @type {ModeCallback} */\n \"on:begin\": (m, resp) => {\n if (m.index !== 0) resp.ignoreMatch();\n }\n }, opts);\n};\n\n// Common modes\nconst BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]', relevance: 0\n};\nconst APOS_STRING_MODE = {\n scope: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst QUOTE_STRING_MODE = {\n scope: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n};\n/**\n * Creates a comment mode\n *\n * @param {string | RegExp} begin\n * @param {string | RegExp} end\n * @param {Mode | {}} [modeOptions]\n * @returns {Partial}\n */\nconst COMMENT = function(begin, end, modeOptions = {}) {\n const mode = inherit$1(\n {\n scope: 'comment',\n begin,\n end,\n contains: []\n },\n modeOptions\n );\n mode.contains.push({\n scope: 'doctag',\n // hack to avoid the space from being included. the space is necessary to\n // match here to prevent the plain text rule below from gobbling up doctags\n begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',\n end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,\n excludeBegin: true,\n relevance: 0\n });\n const ENGLISH_WORD = either(\n // list of common 1 and 2 letter words in English\n \"I\",\n \"a\",\n \"is\",\n \"so\",\n \"us\",\n \"to\",\n \"at\",\n \"if\",\n \"in\",\n \"it\",\n \"on\",\n // note: this is not an exhaustive list of contractions, just popular ones\n /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, // contractions - can't we'd they're let's, etc\n /[A-Za-z]+[-][a-z]+/, // `no-way`, etc.\n /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences\n );\n // looking like plain text, more likely to be a comment\n mode.contains.push(\n {\n // TODO: how to include \", (, ) without breaking grammars that use these for\n // comment delimiters?\n // begin: /[ ]+([()\"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()\":]?([.][ ]|[ ]|\\))){3}/\n // ---\n\n // this tries to find sequences of 3 english words in a row (without any\n // \"programming\" type syntax) this gives us a strong signal that we've\n // TRULY found a comment - vs perhaps scanning with the wrong language.\n // It's possible to find something that LOOKS like the start of the\n // comment - but then if there is no readable text - good chance it is a\n // false match and not a comment.\n //\n // for a visual example please see:\n // https://github.com/highlightjs/highlight.js/issues/2827\n\n begin: concat(\n /[ ]+/, // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */\n '(',\n ENGLISH_WORD,\n /[.]?[:]?([.][ ]|[ ])/,\n '){3}') // look for 3 words in a row\n }\n );\n return mode;\n};\nconst C_LINE_COMMENT_MODE = COMMENT('//', '$');\nconst C_BLOCK_COMMENT_MODE = COMMENT('/\\\\*', '\\\\*/');\nconst HASH_COMMENT_MODE = COMMENT('#', '$');\nconst NUMBER_MODE = {\n scope: 'number',\n begin: NUMBER_RE,\n relevance: 0\n};\nconst C_NUMBER_MODE = {\n scope: 'number',\n begin: C_NUMBER_RE,\n relevance: 0\n};\nconst BINARY_NUMBER_MODE = {\n scope: 'number',\n begin: BINARY_NUMBER_RE,\n relevance: 0\n};\nconst REGEXP_MODE = {\n scope: \"regexp\",\n begin: /\\/(?=[^/\\n]*\\/)/,\n end: /\\/[gimuy]*/,\n contains: [\n BACKSLASH_ESCAPE,\n {\n begin: /\\[/,\n end: /\\]/,\n relevance: 0,\n contains: [BACKSLASH_ESCAPE]\n }\n ]\n};\nconst TITLE_MODE = {\n scope: 'title',\n begin: IDENT_RE,\n relevance: 0\n};\nconst UNDERSCORE_TITLE_MODE = {\n scope: 'title',\n begin: UNDERSCORE_IDENT_RE,\n relevance: 0\n};\nconst METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + UNDERSCORE_IDENT_RE,\n relevance: 0\n};\n\n/**\n * Adds end same as begin mechanics to a mode\n *\n * Your mode must include at least a single () match group as that first match\n * group is what is used for comparison\n * @param {Partial} mode\n */\nconst END_SAME_AS_BEGIN = function(mode) {\n return Object.assign(mode,\n {\n /** @type {ModeCallback} */\n 'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },\n /** @type {ModeCallback} */\n 'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }\n });\n};\n\nvar MODES = /*#__PURE__*/Object.freeze({\n __proto__: null,\n APOS_STRING_MODE: APOS_STRING_MODE,\n BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,\n BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,\n BINARY_NUMBER_RE: BINARY_NUMBER_RE,\n COMMENT: COMMENT,\n C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,\n C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,\n C_NUMBER_MODE: C_NUMBER_MODE,\n C_NUMBER_RE: C_NUMBER_RE,\n END_SAME_AS_BEGIN: END_SAME_AS_BEGIN,\n HASH_COMMENT_MODE: HASH_COMMENT_MODE,\n IDENT_RE: IDENT_RE,\n MATCH_NOTHING_RE: MATCH_NOTHING_RE,\n METHOD_GUARD: METHOD_GUARD,\n NUMBER_MODE: NUMBER_MODE,\n NUMBER_RE: NUMBER_RE,\n PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,\n QUOTE_STRING_MODE: QUOTE_STRING_MODE,\n REGEXP_MODE: REGEXP_MODE,\n RE_STARTERS_RE: RE_STARTERS_RE,\n SHEBANG: SHEBANG,\n TITLE_MODE: TITLE_MODE,\n UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,\n UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE\n});\n\n/**\n@typedef {import('highlight.js').CallbackResponse} CallbackResponse\n@typedef {import('highlight.js').CompilerExt} CompilerExt\n*/\n\n// Grammar extensions / plugins\n// See: https://github.com/highlightjs/highlight.js/issues/2833\n\n// Grammar extensions allow \"syntactic sugar\" to be added to the grammar modes\n// without requiring any underlying changes to the compiler internals.\n\n// `compileMatch` being the perfect small example of now allowing a grammar\n// author to write `match` when they desire to match a single expression rather\n// than being forced to use `begin`. The extension then just moves `match` into\n// `begin` when it runs. Ie, no features have been added, but we've just made\n// the experience of writing (and reading grammars) a little bit nicer.\n\n// ------\n\n// TODO: We need negative look-behind support to do this properly\n/**\n * Skip a match if it has a preceding dot\n *\n * This is used for `beginKeywords` to prevent matching expressions such as\n * `bob.keyword.do()`. The mode compiler automatically wires this up as a\n * special _internal_ 'on:begin' callback for modes with `beginKeywords`\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\nfunction skipIfHasPrecedingDot(match, response) {\n const before = match.input[match.index - 1];\n if (before === \".\") {\n response.ignoreMatch();\n }\n}\n\n/**\n *\n * @type {CompilerExt}\n */\nfunction scopeClassName(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.className !== undefined) {\n mode.scope = mode.className;\n delete mode.className;\n }\n}\n\n/**\n * `beginKeywords` syntactic sugar\n * @type {CompilerExt}\n */\nfunction beginKeywords(mode, parent) {\n if (!parent) return;\n if (!mode.beginKeywords) return;\n\n // for languages with keywords that include non-word characters checking for\n // a word boundary is not sufficient, so instead we check for a word boundary\n // or whitespace - this does no harm in any case since our keyword engine\n // doesn't allow spaces in keywords anyways and we still check for the boundary\n // first\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\\\.)(?=\\\\b|\\\\s)';\n mode.__beforeBegin = skipIfHasPrecedingDot;\n mode.keywords = mode.keywords || mode.beginKeywords;\n delete mode.beginKeywords;\n\n // prevents double relevance, the keywords themselves provide\n // relevance, the mode doesn't need to double it\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 0;\n}\n\n/**\n * Allow `illegal` to contain an array of illegal values\n * @type {CompilerExt}\n */\nfunction compileIllegal(mode, _parent) {\n if (!Array.isArray(mode.illegal)) return;\n\n mode.illegal = either(...mode.illegal);\n}\n\n/**\n * `match` to match a single expression for readability\n * @type {CompilerExt}\n */\nfunction compileMatch(mode, _parent) {\n if (!mode.match) return;\n if (mode.begin || mode.end) throw new Error(\"begin & end are not supported with match\");\n\n mode.begin = mode.match;\n delete mode.match;\n}\n\n/**\n * provides the default 1 relevance to all modes\n * @type {CompilerExt}\n */\nfunction compileRelevance(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 1;\n}\n\n// allow beforeMatch to act as a \"qualifier\" for the match\n// the full match begin must be [beforeMatch][begin]\nconst beforeMatchExt = (mode, parent) => {\n if (!mode.beforeMatch) return;\n // starts conflicts with endsParent which we need to make sure the child\n // rule is not matched multiple times\n if (mode.starts) throw new Error(\"beforeMatch cannot be used with starts\");\n\n const originalMode = Object.assign({}, mode);\n Object.keys(mode).forEach((key) => { delete mode[key]; });\n\n mode.keywords = originalMode.keywords;\n mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));\n mode.starts = {\n relevance: 0,\n contains: [\n Object.assign(originalMode, { endsParent: true })\n ]\n };\n mode.relevance = 0;\n\n delete originalMode.beforeMatch;\n};\n\n// keywords that should have no default relevance value\nconst COMMON_KEYWORDS = [\n 'of',\n 'and',\n 'for',\n 'in',\n 'not',\n 'or',\n 'if',\n 'then',\n 'parent', // common variable name\n 'list', // common variable name\n 'value' // common variable name\n];\n\nconst DEFAULT_KEYWORD_SCOPE = \"keyword\";\n\n/**\n * Given raw keywords from a language definition, compile them.\n *\n * @param {string | Record | Array} rawKeywords\n * @param {boolean} caseInsensitive\n */\nfunction compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {\n /** @type {import(\"highlight.js/private\").KeywordDict} */\n const compiledKeywords = Object.create(null);\n\n // input can be a string of keywords, an array of keywords, or a object with\n // named keys representing scopeName (which can then point to a string or array)\n if (typeof rawKeywords === 'string') {\n compileList(scopeName, rawKeywords.split(\" \"));\n } else if (Array.isArray(rawKeywords)) {\n compileList(scopeName, rawKeywords);\n } else {\n Object.keys(rawKeywords).forEach(function(scopeName) {\n // collapse all our objects back into the parent object\n Object.assign(\n compiledKeywords,\n compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName)\n );\n });\n }\n return compiledKeywords;\n\n // ---\n\n /**\n * Compiles an individual list of keywords\n *\n * Ex: \"for if when while|5\"\n *\n * @param {string} scopeName\n * @param {Array} keywordList\n */\n function compileList(scopeName, keywordList) {\n if (caseInsensitive) {\n keywordList = keywordList.map(x => x.toLowerCase());\n }\n keywordList.forEach(function(keyword) {\n const pair = keyword.split('|');\n compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];\n });\n }\n}\n\n/**\n * Returns the proper score for a given keyword\n *\n * Also takes into account comment keywords, which will be scored 0 UNLESS\n * another score has been manually assigned.\n * @param {string} keyword\n * @param {string} [providedScore]\n */\nfunction scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore) {\n return Number(providedScore);\n }\n\n return commonKeyword(keyword) ? 0 : 1;\n}\n\n/**\n * Determines if a given keyword is common or not\n *\n * @param {string} keyword */\nfunction commonKeyword(keyword) {\n return COMMON_KEYWORDS.includes(keyword.toLowerCase());\n}\n\n/*\n\nFor the reasoning behind this please see:\nhttps://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419\n\n*/\n\n/**\n * @type {Record}\n */\nconst seenDeprecations = {};\n\n/**\n * @param {string} message\n */\nconst error = (message) => {\n console.error(message);\n};\n\n/**\n * @param {string} message\n * @param {any} args\n */\nconst warn = (message, ...args) => {\n console.log(`WARN: ${message}`, ...args);\n};\n\n/**\n * @param {string} version\n * @param {string} message\n */\nconst deprecated = (version, message) => {\n if (seenDeprecations[`${version}/${message}`]) return;\n\n console.log(`Deprecated as of ${version}. ${message}`);\n seenDeprecations[`${version}/${message}`] = true;\n};\n\n/* eslint-disable no-throw-literal */\n\n/**\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n*/\n\nconst MultiClassError = new Error();\n\n/**\n * Renumbers labeled scope names to account for additional inner match\n * groups that otherwise would break everything.\n *\n * Lets say we 3 match scopes:\n *\n * { 1 => ..., 2 => ..., 3 => ... }\n *\n * So what we need is a clean match like this:\n *\n * (a)(b)(c) => [ \"a\", \"b\", \"c\" ]\n *\n * But this falls apart with inner match groups:\n *\n * (a)(((b)))(c) => [\"a\", \"b\", \"b\", \"b\", \"c\" ]\n *\n * Our scopes are now \"out of alignment\" and we're repeating `b` 3 times.\n * What needs to happen is the numbers are remapped:\n *\n * { 1 => ..., 2 => ..., 5 => ... }\n *\n * We also need to know that the ONLY groups that should be output\n * are 1, 2, and 5. This function handles this behavior.\n *\n * @param {CompiledMode} mode\n * @param {Array} regexes\n * @param {{key: \"beginScope\"|\"endScope\"}} opts\n */\nfunction remapScopeNames(mode, regexes, { key }) {\n let offset = 0;\n const scopeNames = mode[key];\n /** @type Record */\n const emit = {};\n /** @type Record */\n const positions = {};\n\n for (let i = 1; i <= regexes.length; i++) {\n positions[i + offset] = scopeNames[i];\n emit[i + offset] = true;\n offset += countMatchGroups(regexes[i - 1]);\n }\n // we use _emit to keep track of which match groups are \"top-level\" to avoid double\n // output from inside match groups\n mode[key] = positions;\n mode[key]._emit = emit;\n mode[key]._multi = true;\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction beginMultiClass(mode) {\n if (!Array.isArray(mode.begin)) return;\n\n if (mode.skip || mode.excludeBegin || mode.returnBegin) {\n error(\"skip, excludeBegin, returnBegin not compatible with beginScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.beginScope !== \"object\" || mode.beginScope === null) {\n error(\"beginScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.begin, { key: \"beginScope\" });\n mode.begin = _rewriteBackreferences(mode.begin, { joinWith: \"\" });\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction endMultiClass(mode) {\n if (!Array.isArray(mode.end)) return;\n\n if (mode.skip || mode.excludeEnd || mode.returnEnd) {\n error(\"skip, excludeEnd, returnEnd not compatible with endScope: {}\");\n throw MultiClassError;\n }\n\n if (typeof mode.endScope !== \"object\" || mode.endScope === null) {\n error(\"endScope must be object\");\n throw MultiClassError;\n }\n\n remapScopeNames(mode, mode.end, { key: \"endScope\" });\n mode.end = _rewriteBackreferences(mode.end, { joinWith: \"\" });\n}\n\n/**\n * this exists only to allow `scope: {}` to be used beside `match:`\n * Otherwise `beginScope` would necessary and that would look weird\n\n {\n match: [ /def/, /\\w+/ ]\n scope: { 1: \"keyword\" , 2: \"title\" }\n }\n\n * @param {CompiledMode} mode\n */\nfunction scopeSugar(mode) {\n if (mode.scope && typeof mode.scope === \"object\" && mode.scope !== null) {\n mode.beginScope = mode.scope;\n delete mode.scope;\n }\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction MultiClass(mode) {\n scopeSugar(mode);\n\n if (typeof mode.beginScope === \"string\") {\n mode.beginScope = { _wrap: mode.beginScope };\n }\n if (typeof mode.endScope === \"string\") {\n mode.endScope = { _wrap: mode.endScope };\n }\n\n beginMultiClass(mode);\n endMultiClass(mode);\n}\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage\n*/\n\n// compilation\n\n/**\n * Compiles a language definition result\n *\n * Given the raw result of a language definition (Language), compiles this so\n * that it is ready for highlighting code.\n * @param {Language} language\n * @returns {CompiledLanguage}\n */\nfunction compileLanguage(language) {\n /**\n * Builds a regex with the case sensitivity of the current language\n *\n * @param {RegExp | string} value\n * @param {boolean} [global]\n */\n function langRe(value, global) {\n return new RegExp(\n source(value),\n 'm'\n + (language.case_insensitive ? 'i' : '')\n + (language.unicodeRegex ? 'u' : '')\n + (global ? 'g' : '')\n );\n }\n\n /**\n Stores multiple regular expressions and allows you to quickly search for\n them all in a string simultaneously - returning the first match. It does\n this by creating a huge (a|b|c) regex - each individual item wrapped with ()\n and joined by `|` - using match groups to track position. When a match is\n found checking which position in the array has content allows us to figure\n out which of the original regexes / match groups triggered the match.\n\n The match object itself (the result of `Regex.exec`) is returned but also\n enhanced by merging in any meta-data that was registered with the regex.\n This is how we keep track of which mode matched, and what type of rule\n (`illegal`, `begin`, end, etc).\n */\n class MultiRegex {\n constructor() {\n this.matchIndexes = {};\n // @ts-ignore\n this.regexes = [];\n this.matchAt = 1;\n this.position = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n opts.position = this.position++;\n // @ts-ignore\n this.matchIndexes[this.matchAt] = opts;\n this.regexes.push([opts, re]);\n this.matchAt += countMatchGroups(re) + 1;\n }\n\n compile() {\n if (this.regexes.length === 0) {\n // avoids the need to check length every time exec is called\n // @ts-ignore\n this.exec = () => null;\n }\n const terminators = this.regexes.map(el => el[1]);\n this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: '|' }), true);\n this.lastIndex = 0;\n }\n\n /** @param {string} s */\n exec(s) {\n this.matcherRe.lastIndex = this.lastIndex;\n const match = this.matcherRe.exec(s);\n if (!match) { return null; }\n\n // eslint-disable-next-line no-undefined\n const i = match.findIndex((el, i) => i > 0 && el !== undefined);\n // @ts-ignore\n const matchData = this.matchIndexes[i];\n // trim off any earlier non-relevant match groups (ie, the other regex\n // match groups that make up the multi-matcher)\n match.splice(0, i);\n\n return Object.assign(match, matchData);\n }\n }\n\n /*\n Created to solve the key deficiently with MultiRegex - there is no way to\n test for multiple matches at a single location. Why would we need to do\n that? In the future a more dynamic engine will allow certain matches to be\n ignored. An example: if we matched say the 3rd regex in a large group but\n decided to ignore it - we'd need to started testing again at the 4th\n regex... but MultiRegex itself gives us no real way to do that.\n\n So what this class creates MultiRegexs on the fly for whatever search\n position they are needed.\n\n NOTE: These additional MultiRegex objects are created dynamically. For most\n grammars most of the time we will never actually need anything more than the\n first MultiRegex - so this shouldn't have too much overhead.\n\n Say this is our search group, and we match regex3, but wish to ignore it.\n\n regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0\n\n What we need is a new MultiRegex that only includes the remaining\n possibilities:\n\n regex4 | regex5 ' ie, startAt = 3\n\n This class wraps all that complexity up in a simple API... `startAt` decides\n where in the array of expressions to start doing the matching. It\n auto-increments, so if a match is found at position 2, then startAt will be\n set to 3. If the end is reached startAt will return to 0.\n\n MOST of the time the parser will be setting startAt manually to 0.\n */\n class ResumableMultiRegex {\n constructor() {\n // @ts-ignore\n this.rules = [];\n // @ts-ignore\n this.multiRegexes = [];\n this.count = 0;\n\n this.lastIndex = 0;\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n getMatcher(index) {\n if (this.multiRegexes[index]) return this.multiRegexes[index];\n\n const matcher = new MultiRegex();\n this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));\n matcher.compile();\n this.multiRegexes[index] = matcher;\n return matcher;\n }\n\n resumingScanAtSamePosition() {\n return this.regexIndex !== 0;\n }\n\n considerAll() {\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n this.rules.push([re, opts]);\n if (opts.type === \"begin\") this.count++;\n }\n\n /** @param {string} s */\n exec(s) {\n const m = this.getMatcher(this.regexIndex);\n m.lastIndex = this.lastIndex;\n let result = m.exec(s);\n\n // The following is because we have no easy way to say \"resume scanning at the\n // existing position but also skip the current rule ONLY\". What happens is\n // all prior rules are also skipped which can result in matching the wrong\n // thing. Example of matching \"booger\":\n\n // our matcher is [string, \"booger\", number]\n //\n // ....booger....\n\n // if \"booger\" is ignored then we'd really need a regex to scan from the\n // SAME position for only: [string, number] but ignoring \"booger\" (if it\n // was the first match), a simple resume would scan ahead who knows how\n // far looking only for \"number\", ignoring potential string matches (or\n // future \"booger\" matches that might be valid.)\n\n // So what we do: We execute two matchers, one resuming at the same\n // position, but the second full matcher starting at the position after:\n\n // /--- resume first regex match here (for [number])\n // |/---- full match here for [string, \"booger\", number]\n // vv\n // ....booger....\n\n // Which ever results in a match first is then used. So this 3-4 step\n // process essentially allows us to say \"match at this position, excluding\n // a prior rule that was ignored\".\n //\n // 1. Match \"booger\" first, ignore. Also proves that [string] does non match.\n // 2. Resume matching for [number]\n // 3. Match at index + 1 for [string, \"booger\", number]\n // 4. If #2 and #3 result in matches, which came first?\n if (this.resumingScanAtSamePosition()) {\n if (result && result.index === this.lastIndex) ; else { // use the second matcher result\n const m2 = this.getMatcher(0);\n m2.lastIndex = this.lastIndex + 1;\n result = m2.exec(s);\n }\n }\n\n if (result) {\n this.regexIndex += result.position + 1;\n if (this.regexIndex === this.count) {\n // wrap-around to considering all matches again\n this.considerAll();\n }\n }\n\n return result;\n }\n }\n\n /**\n * Given a mode, builds a huge ResumableMultiRegex that can be used to walk\n * the content and find matches.\n *\n * @param {CompiledMode} mode\n * @returns {ResumableMultiRegex}\n */\n function buildModeRegex(mode) {\n const mm = new ResumableMultiRegex();\n\n mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: \"begin\" }));\n\n if (mode.terminatorEnd) {\n mm.addRule(mode.terminatorEnd, { type: \"end\" });\n }\n if (mode.illegal) {\n mm.addRule(mode.illegal, { type: \"illegal\" });\n }\n\n return mm;\n }\n\n /** skip vs abort vs ignore\n *\n * @skip - The mode is still entered and exited normally (and contains rules apply),\n * but all content is held and added to the parent buffer rather than being\n * output when the mode ends. Mostly used with `sublanguage` to build up\n * a single large buffer than can be parsed by sublanguage.\n *\n * - The mode begin ands ends normally.\n * - Content matched is added to the parent mode buffer.\n * - The parser cursor is moved forward normally.\n *\n * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it\n * never matched) but DOES NOT continue to match subsequent `contains`\n * modes. Abort is bad/suboptimal because it can result in modes\n * farther down not getting applied because an earlier rule eats the\n * content but then aborts.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is added to the mode buffer.\n * - The parser cursor is moved forward accordingly.\n *\n * @ignore - Ignores the mode (as if it never matched) and continues to match any\n * subsequent `contains` modes. Ignore isn't technically possible with\n * the current parser implementation.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is ignored.\n * - The parser cursor is not moved forward.\n */\n\n /**\n * Compiles an individual mode\n *\n * This can raise an error if the mode contains certain detectable known logic\n * issues.\n * @param {Mode} mode\n * @param {CompiledMode | null} [parent]\n * @returns {CompiledMode | never}\n */\n function compileMode(mode, parent) {\n const cmode = /** @type CompiledMode */ (mode);\n if (mode.isCompiled) return cmode;\n\n [\n scopeClassName,\n // do this early so compiler extensions generally don't have to worry about\n // the distinction between match/begin\n compileMatch,\n MultiClass,\n beforeMatchExt\n ].forEach(ext => ext(mode, parent));\n\n language.compilerExtensions.forEach(ext => ext(mode, parent));\n\n // __beforeBegin is considered private API, internal use only\n mode.__beforeBegin = null;\n\n [\n beginKeywords,\n // do this later so compiler extensions that come earlier have access to the\n // raw array if they wanted to perhaps manipulate it, etc.\n compileIllegal,\n // default to 1 relevance if not specified\n compileRelevance\n ].forEach(ext => ext(mode, parent));\n\n mode.isCompiled = true;\n\n let keywordPattern = null;\n if (typeof mode.keywords === \"object\" && mode.keywords.$pattern) {\n // we need a copy because keywords might be compiled multiple times\n // so we can't go deleting $pattern from the original on the first\n // pass\n mode.keywords = Object.assign({}, mode.keywords);\n keywordPattern = mode.keywords.$pattern;\n delete mode.keywords.$pattern;\n }\n keywordPattern = keywordPattern || /\\w+/;\n\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n }\n\n cmode.keywordPatternRe = langRe(keywordPattern, true);\n\n if (parent) {\n if (!mode.begin) mode.begin = /\\B|\\b/;\n cmode.beginRe = langRe(cmode.begin);\n if (!mode.end && !mode.endsWithParent) mode.end = /\\B|\\b/;\n if (mode.end) cmode.endRe = langRe(cmode.end);\n cmode.terminatorEnd = source(cmode.end) || '';\n if (mode.endsWithParent && parent.terminatorEnd) {\n cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;\n }\n }\n if (mode.illegal) cmode.illegalRe = langRe(/** @type {RegExp | string} */ (mode.illegal));\n if (!mode.contains) mode.contains = [];\n\n mode.contains = [].concat(...mode.contains.map(function(c) {\n return expandOrCloneMode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });\n\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n\n cmode.matcher = buildModeRegex(cmode);\n return cmode;\n }\n\n if (!language.compilerExtensions) language.compilerExtensions = [];\n\n // self is not valid at the top-level\n if (language.contains && language.contains.includes('self')) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\");\n }\n\n // we need a null object, which inherit will guarantee\n language.classNameAliases = inherit$1(language.classNameAliases || {});\n\n return compileMode(/** @type Mode */ (language));\n}\n\n/**\n * Determines if a mode has a dependency on it's parent or not\n *\n * If a mode does have a parent dependency then often we need to clone it if\n * it's used in multiple places so that each copy points to the correct parent,\n * where-as modes without a parent can often safely be re-used at the bottom of\n * a mode chain.\n *\n * @param {Mode | null} mode\n * @returns {boolean} - is there a dependency on the parent?\n * */\nfunction dependencyOnParent(mode) {\n if (!mode) return false;\n\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n}\n\n/**\n * Expands a mode or clones it if necessary\n *\n * This is necessary for modes with parental dependenceis (see notes on\n * `dependencyOnParent`) and for nodes that have `variants` - which must then be\n * exploded into their own individual modes at compile time.\n *\n * @param {Mode} mode\n * @returns {Mode | Mode[]}\n * */\nfunction expandOrCloneMode(mode) {\n if (mode.variants && !mode.cachedVariants) {\n mode.cachedVariants = mode.variants.map(function(variant) {\n return inherit$1(mode, { variants: null }, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cachedVariants) {\n return mode.cachedVariants;\n }\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode)) {\n return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });\n }\n\n if (Object.isFrozen(mode)) {\n return inherit$1(mode);\n }\n\n // no special dependency issues, just return ourselves\n return mode;\n}\n\nvar version = \"11.9.0\";\n\nclass HTMLInjectionError extends Error {\n constructor(reason, html) {\n super(reason);\n this.name = \"HTMLInjectionError\";\n this.html = html;\n }\n}\n\n/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').CompiledScope} CompiledScope\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSApi} HLJSApi\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').PluginEvent} PluginEvent\n@typedef {import('highlight.js').HLJSOptions} HLJSOptions\n@typedef {import('highlight.js').LanguageFn} LanguageFn\n@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement\n@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext\n@typedef {import('highlight.js/private').MatchType} MatchType\n@typedef {import('highlight.js/private').KeywordData} KeywordData\n@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch\n@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError\n@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult\n@typedef {import('highlight.js').HighlightOptions} HighlightOptions\n@typedef {import('highlight.js').HighlightResult} HighlightResult\n*/\n\n\nconst escape = escapeHTML;\nconst inherit = inherit$1;\nconst NO_MATCH = Symbol(\"nomatch\");\nconst MAX_KEYWORD_HITS = 7;\n\n/**\n * @param {any} hljs - object that is extended (legacy)\n * @returns {HLJSApi}\n */\nconst HLJS = function(hljs) {\n // Global internal variables used within the highlight.js library.\n /** @type {Record} */\n const languages = Object.create(null);\n /** @type {Record} */\n const aliases = Object.create(null);\n /** @type {HLJSPlugin[]} */\n const plugins = [];\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n let SAFE_MODE = true;\n const LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n /** @type {Language} */\n const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n /** @type HLJSOptions */\n let options = {\n ignoreUnescapedHTML: false,\n throwUnescapedHTML: false,\n noHighlightRe: /^(no-?highlight)$/i,\n languageDetectRe: /\\blang(?:uage)?-([\\w-]+)\\b/i,\n classPrefix: 'hljs-',\n cssSelector: 'pre code',\n languages: null,\n // beta configuration options, subject to change, welcome to discuss\n // https://github.com/highlightjs/highlight.js/issues/1086\n __emitter: TokenTreeEmitter\n };\n\n /* Utility functions */\n\n /**\n * Tests a language name to see if highlighting should be skipped\n * @param {string} languageName\n */\n function shouldNotHighlight(languageName) {\n return options.noHighlightRe.test(languageName);\n }\n\n /**\n * @param {HighlightedHTMLElement} block - the HTML element to determine language for\n */\n function blockLanguage(block) {\n let classes = block.className + ' ';\n\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n const match = options.languageDetectRe.exec(classes);\n if (match) {\n const language = getLanguage(match[1]);\n if (!language) {\n warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n\n return classes\n .split(/\\s+/)\n .find((_class) => shouldNotHighlight(_class) || getLanguage(_class));\n }\n\n /**\n * Core highlighting function.\n *\n * OLD API\n * highlight(lang, code, ignoreIllegals, continuation)\n *\n * NEW API\n * highlight(code, {lang, ignoreIllegals})\n *\n * @param {string} codeOrLanguageName - the language to use for highlighting\n * @param {string | HighlightOptions} optionsOrCode - the code to highlight\n * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n *\n * @returns {HighlightResult} Result - an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {string} code - the original raw code\n * @property {CompiledMode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {\n let code = \"\";\n let languageName = \"\";\n if (typeof optionsOrCode === \"object\") {\n code = codeOrLanguageName;\n ignoreIllegals = optionsOrCode.ignoreIllegals;\n languageName = optionsOrCode.language;\n } else {\n // old API\n deprecated(\"10.7.0\", \"highlight(lang, code, ...args) has been deprecated.\");\n deprecated(\"10.7.0\", \"Please use highlight(code, options) instead.\\nhttps://github.com/highlightjs/highlight.js/issues/2277\");\n languageName = codeOrLanguageName;\n code = optionsOrCode;\n }\n\n // https://github.com/highlightjs/highlight.js/issues/3149\n // eslint-disable-next-line no-undefined\n if (ignoreIllegals === undefined) { ignoreIllegals = true; }\n\n /** @type {BeforeHighlightContext} */\n const context = {\n code,\n language: languageName\n };\n // the plugin can change the desired language or the code to be highlighted\n // just be changing the object it was passed\n fire(\"before:highlight\", context);\n\n // a before plugin can usurp the result completely by providing it's own\n // in which case we don't even need to call highlight\n const result = context.result\n ? context.result\n : _highlight(context.language, context.code, ignoreIllegals);\n\n result.code = context.code;\n // the plugin can change anything in result to suite it\n fire(\"after:highlight\", result);\n\n return result;\n }\n\n /**\n * private highlight that's used internally and does not fire callbacks\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} codeToHighlight - the code to highlight\n * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n * @param {CompiledMode?} [continuation] - current continuation mode, if any\n * @returns {HighlightResult} - result of the highlight operation\n */\n function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {\n const keywordHits = Object.create(null);\n\n /**\n * Return keyword data if a match is a keyword\n * @param {CompiledMode} mode - current mode\n * @param {string} matchText - the textual match\n * @returns {KeywordData | false}\n */\n function keywordData(mode, matchText) {\n return mode.keywords[matchText];\n }\n\n function processKeywords() {\n if (!top.keywords) {\n emitter.addText(modeBuffer);\n return;\n }\n\n let lastIndex = 0;\n top.keywordPatternRe.lastIndex = 0;\n let match = top.keywordPatternRe.exec(modeBuffer);\n let buf = \"\";\n\n while (match) {\n buf += modeBuffer.substring(lastIndex, match.index);\n const word = language.case_insensitive ? match[0].toLowerCase() : match[0];\n const data = keywordData(top, word);\n if (data) {\n const [kind, keywordRelevance] = data;\n emitter.addText(buf);\n buf = \"\";\n\n keywordHits[word] = (keywordHits[word] || 0) + 1;\n if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;\n if (kind.startsWith(\"_\")) {\n // _ implied for relevance only, do not highlight\n // by applying a class name\n buf += match[0];\n } else {\n const cssClass = language.classNameAliases[kind] || kind;\n emitKeyword(match[0], cssClass);\n }\n } else {\n buf += match[0];\n }\n lastIndex = top.keywordPatternRe.lastIndex;\n match = top.keywordPatternRe.exec(modeBuffer);\n }\n buf += modeBuffer.substring(lastIndex);\n emitter.addText(buf);\n }\n\n function processSubLanguage() {\n if (modeBuffer === \"\") return;\n /** @type HighlightResult */\n let result = null;\n\n if (typeof top.subLanguage === 'string') {\n if (!languages[top.subLanguage]) {\n emitter.addText(modeBuffer);\n return;\n }\n result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);\n continuations[top.subLanguage] = /** @type {CompiledMode} */ (result._top);\n } else {\n result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);\n }\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n emitter.__addSublanguage(result._emitter, result.language);\n }\n\n function processBuffer() {\n if (top.subLanguage != null) {\n processSubLanguage();\n } else {\n processKeywords();\n }\n modeBuffer = '';\n }\n\n /**\n * @param {string} text\n * @param {string} scope\n */\n function emitKeyword(keyword, scope) {\n if (keyword === \"\") return;\n\n emitter.startScope(scope);\n emitter.addText(keyword);\n emitter.endScope();\n }\n\n /**\n * @param {CompiledScope} scope\n * @param {RegExpMatchArray} match\n */\n function emitMultiClass(scope, match) {\n let i = 1;\n const max = match.length - 1;\n while (i <= max) {\n if (!scope._emit[i]) { i++; continue; }\n const klass = language.classNameAliases[scope[i]] || scope[i];\n const text = match[i];\n if (klass) {\n emitKeyword(text, klass);\n } else {\n modeBuffer = text;\n processKeywords();\n modeBuffer = \"\";\n }\n i++;\n }\n }\n\n /**\n * @param {CompiledMode} mode - new mode to start\n * @param {RegExpMatchArray} match\n */\n function startNewMode(mode, match) {\n if (mode.scope && typeof mode.scope === \"string\") {\n emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);\n }\n if (mode.beginScope) {\n // beginScope just wraps the begin match itself in a scope\n if (mode.beginScope._wrap) {\n emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);\n modeBuffer = \"\";\n } else if (mode.beginScope._multi) {\n // at this point modeBuffer should just be the match\n emitMultiClass(mode.beginScope, match);\n modeBuffer = \"\";\n }\n }\n\n top = Object.create(mode, { parent: { value: top } });\n return top;\n }\n\n /**\n * @param {CompiledMode } mode - the mode to potentially end\n * @param {RegExpMatchArray} match - the latest match\n * @param {string} matchPlusRemainder - match plus remainder of content\n * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode\n */\n function endOfMode(mode, match, matchPlusRemainder) {\n let matched = startsWith(mode.endRe, matchPlusRemainder);\n\n if (matched) {\n if (mode[\"on:end\"]) {\n const resp = new Response(mode);\n mode[\"on:end\"](match, resp);\n if (resp.isMatchIgnored) matched = false;\n }\n\n if (matched) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n }\n // even if on:end fires an `ignore` it's still possible\n // that we might trigger the end node because of a parent mode\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, match, matchPlusRemainder);\n }\n }\n\n /**\n * Handle matching but then ignoring a sequence of text\n *\n * @param {string} lexeme - string containing full match text\n */\n function doIgnore(lexeme) {\n if (top.matcher.regexIndex === 0) {\n // no more regexes to potentially match here, so we move the cursor forward one\n // space\n modeBuffer += lexeme[0];\n return 1;\n } else {\n // no need to move the cursor, we still have additional regexes to try and\n // match at this very spot\n resumeScanAtSamePosition = true;\n return 0;\n }\n }\n\n /**\n * Handle the start of a new potential mode match\n *\n * @param {EnhancedMatch} match - the current match\n * @returns {number} how far to advance the parse cursor\n */\n function doBeginMatch(match) {\n const lexeme = match[0];\n const newMode = match.rule;\n\n const resp = new Response(newMode);\n // first internal before callbacks, then the public ones\n const beforeCallbacks = [newMode.__beforeBegin, newMode[\"on:begin\"]];\n for (const cb of beforeCallbacks) {\n if (!cb) continue;\n cb(match, resp);\n if (resp.isMatchIgnored) return doIgnore(lexeme);\n }\n\n if (newMode.skip) {\n modeBuffer += lexeme;\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme;\n }\n }\n startNewMode(newMode, match);\n return newMode.returnBegin ? 0 : lexeme.length;\n }\n\n /**\n * Handle the potential end of mode\n *\n * @param {RegExpMatchArray} match - the current match\n */\n function doEndMatch(match) {\n const lexeme = match[0];\n const matchPlusRemainder = codeToHighlight.substring(match.index);\n\n const endMode = endOfMode(top, match, matchPlusRemainder);\n if (!endMode) { return NO_MATCH; }\n\n const origin = top;\n if (top.endScope && top.endScope._wrap) {\n processBuffer();\n emitKeyword(lexeme, top.endScope._wrap);\n } else if (top.endScope && top.endScope._multi) {\n processBuffer();\n emitMultiClass(top.endScope, match);\n } else if (origin.skip) {\n modeBuffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n modeBuffer = lexeme;\n }\n }\n do {\n if (top.scope) {\n emitter.closeNode();\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== endMode.parent);\n if (endMode.starts) {\n startNewMode(endMode.starts, match);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n\n function processContinuations() {\n const list = [];\n for (let current = top; current !== language; current = current.parent) {\n if (current.scope) {\n list.unshift(current.scope);\n }\n }\n list.forEach(item => emitter.openNode(item));\n }\n\n /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */\n let lastMatch = {};\n\n /**\n * Process an individual match\n *\n * @param {string} textBeforeMatch - text preceding the match (since the last match)\n * @param {EnhancedMatch} [match] - the match itself\n */\n function processLexeme(textBeforeMatch, match) {\n const lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch;\n\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type === \"begin\" && match.type === \"end\" && lastMatch.index === match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n modeBuffer += codeToHighlight.slice(match.index, match.index + 1);\n if (!SAFE_MODE) {\n /** @type {AnnotatedError} */\n const err = new Error(`0 width match regex (${languageName})`);\n err.languageName = languageName;\n err.badRule = lastMatch.rule;\n throw err;\n }\n return 1;\n }\n lastMatch = match;\n\n if (match.type === \"begin\") {\n return doBeginMatch(match);\n } else if (match.type === \"illegal\" && !ignoreIllegals) {\n // illegal match, we do not continue processing\n /** @type {AnnotatedError} */\n const err = new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.scope || '') + '\"');\n err.mode = top;\n throw err;\n } else if (match.type === \"end\") {\n const processed = doEndMatch(match);\n if (processed !== NO_MATCH) {\n return processed;\n }\n }\n\n // edge case for when illegal matches $ (end of line) which is technically\n // a 0 width match but not a begin/end match so it's not caught by the\n // first handler (when ignoreIllegals is true)\n if (match.type === \"illegal\" && lexeme === \"\") {\n // advance so we aren't stuck in an infinite loop\n return 1;\n }\n\n // infinite loops are BAD, this is a last ditch catch all. if we have a\n // decent number of iterations yet our index (cursor position in our\n // parsing) still 3x behind our index then something is very wrong\n // so we bail\n if (iterations > 100000 && iterations > match.index * 3) {\n const err = new Error('potential infinite loop, way more iterations than matches');\n throw err;\n }\n\n /*\n Why might be find ourselves here? An potential end match that was\n triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.\n (this could be because a callback requests the match be ignored, etc)\n\n This causes no real harm other than stopping a few times too many.\n */\n\n modeBuffer += lexeme;\n return lexeme.length;\n }\n\n const language = getLanguage(languageName);\n if (!language) {\n error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n\n const md = compileLanguage(language);\n let result = '';\n /** @type {CompiledMode} */\n let top = continuation || md;\n /** @type Record */\n const continuations = {}; // keep continuations for sub-languages\n const emitter = new options.__emitter(options);\n processContinuations();\n let modeBuffer = '';\n let relevance = 0;\n let index = 0;\n let iterations = 0;\n let resumeScanAtSamePosition = false;\n\n try {\n if (!language.__emitTokens) {\n top.matcher.considerAll();\n\n for (;;) {\n iterations++;\n if (resumeScanAtSamePosition) {\n // only regexes not matched previously will now be\n // considered for a potential match\n resumeScanAtSamePosition = false;\n } else {\n top.matcher.considerAll();\n }\n top.matcher.lastIndex = index;\n\n const match = top.matcher.exec(codeToHighlight);\n // console.log(\"match\", match[0], match.rule && match.rule.begin)\n\n if (!match) break;\n\n const beforeMatch = codeToHighlight.substring(index, match.index);\n const processedCount = processLexeme(beforeMatch, match);\n index = match.index + processedCount;\n }\n processLexeme(codeToHighlight.substring(index));\n } else {\n language.__emitTokens(codeToHighlight, emitter);\n }\n\n emitter.finalize();\n result = emitter.toHTML();\n\n return {\n language: languageName,\n value: result,\n relevance,\n illegal: false,\n _emitter: emitter,\n _top: top\n };\n } catch (err) {\n if (err.message && err.message.includes('Illegal')) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: true,\n relevance: 0,\n _illegalBy: {\n message: err.message,\n index,\n context: codeToHighlight.slice(index - 100, index + 100),\n mode: err.mode,\n resultSoFar: result\n },\n _emitter: emitter\n };\n } else if (SAFE_MODE) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: false,\n relevance: 0,\n errorRaised: err,\n _emitter: emitter,\n _top: top\n };\n } else {\n throw err;\n }\n }\n }\n\n /**\n * returns a valid highlight result, without actually doing any actual work,\n * auto highlight starts with this and it's possible for small snippets that\n * auto-detection may not find a better match\n * @param {string} code\n * @returns {HighlightResult}\n */\n function justTextHighlightResult(code) {\n const result = {\n value: escape(code),\n illegal: false,\n relevance: 0,\n _top: PLAINTEXT_LANGUAGE,\n _emitter: new options.__emitter(options)\n };\n result._emitter.addText(code);\n return result;\n }\n\n /**\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - secondBest (object with the same structure for second-best heuristically\n detected language, may be absent)\n\n @param {string} code\n @param {Array} [languageSubset]\n @returns {AutoHighlightResult}\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n const plaintext = justTextHighlightResult(code);\n\n const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name =>\n _highlight(name, code, false)\n );\n results.unshift(plaintext); // plaintext is always an option\n\n const sorted = results.sort((a, b) => {\n // sort base on relevance\n if (a.relevance !== b.relevance) return b.relevance - a.relevance;\n\n // always award the tie to the base language\n // ie if C++ and Arduino are tied, it's more likely to be C++\n if (a.language && b.language) {\n if (getLanguage(a.language).supersetOf === b.language) {\n return 1;\n } else if (getLanguage(b.language).supersetOf === a.language) {\n return -1;\n }\n }\n\n // otherwise say they are equal, which has the effect of sorting on\n // relevance while preserving the original ordering - which is how ties\n // have historically been settled, ie the language that comes first always\n // wins in the case of a tie\n return 0;\n });\n\n const [best, secondBest] = sorted;\n\n /** @type {AutoHighlightResult} */\n const result = best;\n result.secondBest = secondBest;\n\n return result;\n }\n\n /**\n * Builds new class name for block given the language name\n *\n * @param {HTMLElement} element\n * @param {string} [currentLang]\n * @param {string} [resultLang]\n */\n function updateClassName(element, currentLang, resultLang) {\n const language = (currentLang && aliases[currentLang]) || resultLang;\n\n element.classList.add(\"hljs\");\n element.classList.add(`language-${language}`);\n }\n\n /**\n * Applies highlighting to a DOM node containing code.\n *\n * @param {HighlightedHTMLElement} element - the HTML element to highlight\n */\n function highlightElement(element) {\n /** @type HTMLElement */\n let node = null;\n const language = blockLanguage(element);\n\n if (shouldNotHighlight(language)) return;\n\n fire(\"before:highlightElement\",\n { el: element, language });\n\n if (element.dataset.highlighted) {\n console.log(\"Element previously highlighted. To highlight again, first unset `dataset.highlighted`.\", element);\n return;\n }\n\n // we should be all text, no child nodes (unescaped HTML) - this is possibly\n // an HTML injection attack - it's likely too late if this is already in\n // production (the code has likely already done its damage by the time\n // we're seeing it)... but we yell loudly about this so that hopefully it's\n // more likely to be caught in development before making it to production\n if (element.children.length > 0) {\n if (!options.ignoreUnescapedHTML) {\n console.warn(\"One of your code blocks includes unescaped HTML. This is a potentially serious security risk.\");\n console.warn(\"https://github.com/highlightjs/highlight.js/wiki/security\");\n console.warn(\"The element with unescaped HTML:\");\n console.warn(element);\n }\n if (options.throwUnescapedHTML) {\n const err = new HTMLInjectionError(\n \"One of your code blocks includes unescaped HTML.\",\n element.innerHTML\n );\n throw err;\n }\n }\n\n node = element;\n const text = node.textContent;\n const result = language ? highlight(text, { language, ignoreIllegals: true }) : highlightAuto(text);\n\n element.innerHTML = result.value;\n element.dataset.highlighted = \"yes\";\n updateClassName(element, language, result.language);\n element.result = {\n language: result.language,\n // TODO: remove with version 11.0\n re: result.relevance,\n relevance: result.relevance\n };\n if (result.secondBest) {\n element.secondBest = {\n language: result.secondBest.language,\n relevance: result.secondBest.relevance\n };\n }\n\n fire(\"after:highlightElement\", { el: element, result, text });\n }\n\n /**\n * Updates highlight.js global options with the passed options\n *\n * @param {Partial} userOptions\n */\n function configure(userOptions) {\n options = inherit(options, userOptions);\n }\n\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlighting() deprecated. Use highlightAll() now.\");\n };\n\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() deprecated. Use highlightAll() now.\");\n }\n\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n wantsHighlight = true;\n return;\n }\n\n const blocks = document.querySelectorAll(options.cssSelector);\n blocks.forEach(highlightElement);\n }\n\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n if (wantsHighlight) highlightAll();\n }\n\n // make sure we are in the browser environment\n if (typeof window !== 'undefined' && window.addEventListener) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) { throw error$1; } else { error(error$1); }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n\n if (lang.aliases) {\n registerAliases(lang.aliases, { languageName });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, { languageName }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = (data) => {\n plugin[\"before:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = (data) => {\n plugin[\"after:highlightBlock\"](\n Object.assign({ block: data.el }, data)\n );\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function removePlugin(plugin) {\n const index = plugins.indexOf(plugin);\n if (index !== -1) {\n plugins.splice(index, 1);\n }\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function(plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n * DEPRECATED\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n autoDetection,\n inherit,\n addPlugin,\n removePlugin\n });\n\n hljs.debugMode = function() { SAFE_MODE = false; };\n hljs.safeMode = function() { SAFE_MODE = true; };\n hljs.versionString = version;\n\n hljs.regex = {\n concat: concat,\n lookahead: lookahead,\n either: either,\n optional: optional,\n anyNumberOfTimes: anyNumberOfTimes\n };\n\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreeze(MODES[key]);\n }\n }\n\n // merge all the modes/regexes into our main object\n Object.assign(hljs, MODES);\n\n return hljs;\n};\n\n// Other names for the variable may break build script\nconst highlight = HLJS({});\n\n// returns a new instance of the highlighter to be used for extensions\n// check https://github.com/wooorm/lowlight/issues/47\nhighlight.newInstance = () => HLJS({});\n\nmodule.exports = highlight;\nhighlight.HighlightJS = highlight;\nhighlight.default = highlight;\n", "'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n", "module.exports = function isArrayish(obj) {\n\tif (!obj || typeof obj === 'string') {\n\t\treturn false;\n\t}\n\n\treturn obj instanceof Array || Array.isArray(obj) ||\n\t\t(obj.length >= 0 && (obj.splice instanceof Function ||\n\t\t\t(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));\n};\n", "'use strict';\n\nvar isArrayish = require('is-arrayish');\n\nvar concat = Array.prototype.concat;\nvar slice = Array.prototype.slice;\n\nvar swizzle = module.exports = function swizzle(args) {\n\tvar results = [];\n\n\tfor (var i = 0, len = args.length; i < len; i++) {\n\t\tvar arg = args[i];\n\n\t\tif (isArrayish(arg)) {\n\t\t\t// http://jsperf.com/javascript-array-concat-vs-push/98\n\t\t\tresults = concat.call(results, slice.call(arg));\n\t\t} else {\n\t\t\tresults.push(arg);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nswizzle.wrap = function (fn) {\n\treturn function () {\n\t\treturn fn(swizzle(arguments));\n\t};\n};\n", "/* MIT license */\nvar colorNames = require('color-name');\nvar swizzle = require('simple-swizzle');\nvar hasOwnProperty = Object.hasOwnProperty;\n\nvar reverseNames = Object.create(null);\n\n// create a list of reverse color names\nfor (var name in colorNames) {\n\tif (hasOwnProperty.call(colorNames, name)) {\n\t\treverseNames[colorNames[name]] = name;\n\t}\n}\n\nvar cs = module.exports = {\n\tto: {},\n\tget: {}\n};\n\ncs.get = function (string) {\n\tvar prefix = string.substring(0, 3).toLowerCase();\n\tvar val;\n\tvar model;\n\tswitch (prefix) {\n\t\tcase 'hsl':\n\t\t\tval = cs.get.hsl(string);\n\t\t\tmodel = 'hsl';\n\t\t\tbreak;\n\t\tcase 'hwb':\n\t\t\tval = cs.get.hwb(string);\n\t\t\tmodel = 'hwb';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tval = cs.get.rgb(string);\n\t\t\tmodel = 'rgb';\n\t\t\tbreak;\n\t}\n\n\tif (!val) {\n\t\treturn null;\n\t}\n\n\treturn {model: model, value: val};\n};\n\ncs.get.rgb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar abbr = /^#([a-f0-9]{3,4})$/i;\n\tvar hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;\n\tvar rgba = /^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar per = /^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar keyword = /^(\\w+)$/;\n\n\tvar rgb = [0, 0, 0, 1];\n\tvar match;\n\tvar i;\n\tvar hexAlpha;\n\n\tif (match = string.match(hex)) {\n\t\thexAlpha = match[2];\n\t\tmatch = match[1];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\t// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19\n\t\t\tvar i2 = i * 2;\n\t\t\trgb[i] = parseInt(match.slice(i2, i2 + 2), 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(abbr)) {\n\t\tmatch = match[1];\n\t\thexAlpha = match[3];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i] + match[i], 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(rgba)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i + 1], 0);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(per)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(keyword)) {\n\t\tif (match[1] === 'transparent') {\n\t\t\treturn [0, 0, 0, 0];\n\t\t}\n\n\t\tif (!hasOwnProperty.call(colorNames, match[1])) {\n\t\t\treturn null;\n\t\t}\n\n\t\trgb = colorNames[match[1]];\n\t\trgb[3] = 1;\n\n\t\treturn rgb;\n\t} else {\n\t\treturn null;\n\t}\n\n\tfor (i = 0; i < 3; i++) {\n\t\trgb[i] = clamp(rgb[i], 0, 255);\n\t}\n\trgb[3] = clamp(rgb[3], 0, 1);\n\n\treturn rgb;\n};\n\ncs.get.hsl = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hsl = /^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hsl);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar s = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar l = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\n\t\treturn [h, s, l, a];\n\t}\n\n\treturn null;\n};\n\ncs.get.hwb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hwb = /^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hwb);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar w = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar b = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\t\treturn [h, w, b, a];\n\t}\n\n\treturn null;\n};\n\ncs.to.hex = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn (\n\t\t'#' +\n\t\thexDouble(rgba[0]) +\n\t\thexDouble(rgba[1]) +\n\t\thexDouble(rgba[2]) +\n\t\t(rgba[3] < 1\n\t\t\t? (hexDouble(Math.round(rgba[3] * 255)))\n\t\t\t: '')\n\t);\n};\n\ncs.to.rgb = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'\n\t\t: 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';\n};\n\ncs.to.rgb.percent = function () {\n\tvar rgba = swizzle(arguments);\n\n\tvar r = Math.round(rgba[0] / 255 * 100);\n\tvar g = Math.round(rgba[1] / 255 * 100);\n\tvar b = Math.round(rgba[2] / 255 * 100);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'\n\t\t: 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';\n};\n\ncs.to.hsl = function () {\n\tvar hsla = swizzle(arguments);\n\treturn hsla.length < 4 || hsla[3] === 1\n\t\t? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'\n\t\t: 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';\n};\n\n// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax\n// (hwb have alpha optional & 1 is default value)\ncs.to.hwb = function () {\n\tvar hwba = swizzle(arguments);\n\n\tvar a = '';\n\tif (hwba.length >= 4 && hwba[3] !== 1) {\n\t\ta = ', ' + hwba[3];\n\t}\n\n\treturn 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';\n};\n\ncs.to.keyword = function (rgb) {\n\treturn reverseNames[rgb.slice(0, 3)];\n};\n\n// helpers\nfunction clamp(num, min, max) {\n\treturn Math.min(Math.max(min, num), max);\n}\n\nfunction hexDouble(num) {\n\tvar str = Math.round(num).toString(16).toUpperCase();\n\treturn (str.length < 2) ? '0' + str : str;\n}\n", "/* MIT license */\n/* eslint-disable no-mixed-operators */\nconst cssKeywords = require('color-name');\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n// values that give correct `typeof` results).\n// do not use box values types (i.e. Number(), String(), etc.)\n\nconst reverseKeywords = {};\nfor (const key of Object.keys(cssKeywords)) {\n\treverseKeywords[cssKeywords[key]] = key;\n}\n\nconst convert = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\nmodule.exports = convert;\n\n// Hide .channels and .labels properties\nfor (const model of Object.keys(convert)) {\n\tif (!('channels' in convert[model])) {\n\t\tthrow new Error('missing channels property: ' + model);\n\t}\n\n\tif (!('labels' in convert[model])) {\n\t\tthrow new Error('missing channel labels property: ' + model);\n\t}\n\n\tif (convert[model].labels.length !== convert[model].channels) {\n\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t}\n\n\tconst {channels, labels} = convert[model];\n\tdelete convert[model].channels;\n\tdelete convert[model].labels;\n\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\tObject.defineProperty(convert[model], 'labels', {value: labels});\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst min = Math.min(r, g, b);\n\tconst max = Math.max(r, g, b);\n\tconst delta = max - min;\n\tlet h;\n\tlet s;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst l = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tlet rdif;\n\tlet gdif;\n\tlet bdif;\n\tlet h;\n\tlet s;\n\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst v = Math.max(r, g, b);\n\tconst diff = v - Math.min(r, g, b);\n\tconst diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = 0;\n\t\ts = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tconst r = rgb[0];\n\tconst g = rgb[1];\n\tlet b = rgb[2];\n\tconst h = convert.rgb.hsl(rgb)[0];\n\tconst w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\n\tconst k = Math.min(1 - r, 1 - g, 1 - b);\n\tconst c = (1 - r - k) / (1 - k) || 0;\n\tconst m = (1 - g - k) / (1 - k) || 0;\n\tconst y = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\nfunction comparativeDistance(x, y) {\n\t/*\n\t\tSee https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n\t*/\n\treturn (\n\t\t((x[0] - y[0]) ** 2) +\n\t\t((x[1] - y[1]) ** 2) +\n\t\t((x[2] - y[2]) ** 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tconst reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tlet currentClosestDistance = Infinity;\n\tlet currentClosestKeyword;\n\n\tfor (const keyword of Object.keys(cssKeywords)) {\n\t\tconst value = cssKeywords[keyword];\n\n\t\t// Compute comparative distance\n\t\tconst distance = comparativeDistance(rgb, value);\n\n\t\t// Check if its less, if so set as closest\n\t\tif (distance < currentClosestDistance) {\n\t\t\tcurrentClosestDistance = distance;\n\t\t\tcurrentClosestKeyword = keyword;\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tlet r = rgb[0] / 255;\n\tlet g = rgb[1] / 255;\n\tlet b = rgb[2] / 255;\n\n\t// Assume sRGB\n\tr = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);\n\n\tconst x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tconst y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tconst z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tconst xyz = convert.rgb.xyz(rgb);\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tconst h = hsl[0] / 360;\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\tlet t2;\n\tlet t3;\n\tlet val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tconst t1 = 2 * l - t2;\n\n\tconst rgb = [0, 0, 0];\n\tfor (let i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tconst h = hsl[0];\n\tlet s = hsl[1] / 100;\n\tlet l = hsl[2] / 100;\n\tlet smin = s;\n\tconst lmin = Math.max(l, 0.01);\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tconst v = (l + s) / 2;\n\tconst sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tconst h = hsv[0] / 60;\n\tconst s = hsv[1] / 100;\n\tlet v = hsv[2] / 100;\n\tconst hi = Math.floor(h) % 6;\n\n\tconst f = h - Math.floor(h);\n\tconst p = 255 * v * (1 - s);\n\tconst q = 255 * v * (1 - (s * f));\n\tconst t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tconst h = hsv[0];\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\tconst vmin = Math.max(v, 0.01);\n\tlet sl;\n\tlet l;\n\n\tl = (2 - s) * v;\n\tconst lmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tconst h = hwb[0] / 360;\n\tlet wh = hwb[1] / 100;\n\tlet bl = hwb[2] / 100;\n\tconst ratio = wh + bl;\n\tlet f;\n\n\t// Wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\tconst i = Math.floor(6 * h);\n\tconst v = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tconst n = wh + f * (v - wh); // Linear interpolation\n\n\tlet r;\n\tlet g;\n\tlet b;\n\t/* eslint-disable max-statements-per-line,no-multi-spaces */\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v; g = n; b = wh; break;\n\t\tcase 1: r = n; g = v; b = wh; break;\n\t\tcase 2: r = wh; g = v; b = n; break;\n\t\tcase 3: r = wh; g = n; b = v; break;\n\t\tcase 4: r = n; g = wh; b = v; break;\n\t\tcase 5: r = v; g = wh; b = n; break;\n\t}\n\t/* eslint-enable max-statements-per-line,no-multi-spaces */\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tconst c = cmyk[0] / 100;\n\tconst m = cmyk[1] / 100;\n\tconst y = cmyk[2] / 100;\n\tconst k = cmyk[3] / 100;\n\n\tconst r = 1 - Math.min(1, c * (1 - k) + k);\n\tconst g = 1 - Math.min(1, m * (1 - k) + k);\n\tconst b = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\tlet r;\n\tlet g;\n\tlet b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// Assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet x;\n\tlet y;\n\tlet z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tconst y2 = y ** 3;\n\tconst x2 = x ** 3;\n\tconst z2 = z ** 3;\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet h;\n\n\tconst hr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst c = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tconst l = lch[0];\n\tconst c = lch[1];\n\tconst h = lch[2];\n\n\tconst hr = h / 360 * 2 * Math.PI;\n\tconst a = c * Math.cos(hr);\n\tconst b = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args, saturation = null) {\n\tconst [r, g, b] = args;\n\tlet value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tlet ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// Optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tconst r = args[0];\n\tconst g = args[1];\n\tconst b = args[2];\n\n\t// We use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tconst ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tlet color = args % 10;\n\n\t// Handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tconst mult = (~~(args > 50) + 1) * 0.5;\n\tconst r = ((color & 1) * mult) * 255;\n\tconst g = (((color >> 1) & 1) * mult) * 255;\n\tconst b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// Handle greyscale\n\tif (args >= 232) {\n\t\tconst c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tlet rem;\n\tconst r = Math.floor(args / 36) / 5 * 255;\n\tconst g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tconst b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tconst integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tconst match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tlet colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(char => {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tconst integer = parseInt(colorString, 16);\n\tconst r = (integer >> 16) & 0xFF;\n\tconst g = (integer >> 8) & 0xFF;\n\tconst b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst max = Math.max(Math.max(r, g), b);\n\tconst min = Math.min(Math.min(r, g), b);\n\tconst chroma = (max - min);\n\tlet grayscale;\n\tlet hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\n\tconst c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));\n\n\tlet f = 0;\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\n\tconst c = s * v;\n\tlet f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tconst h = hcg[0] / 360;\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tconst pure = [0, 0, 0];\n\tconst hi = (h % 1) * 6;\n\tconst v = hi % 1;\n\tconst w = 1 - v;\n\tlet mg = 0;\n\n\t/* eslint-disable max-statements-per-line */\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\t/* eslint-enable max-statements-per-line */\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst v = c + g * (1.0 - c);\n\tlet f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst l = g * (1.0 - c) + 0.5 * c;\n\tlet s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\tconst v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tconst w = hwb[1] / 100;\n\tconst b = hwb[2] / 100;\n\tconst v = 1 - b;\n\tconst c = v - w;\n\tlet g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hsv = convert.gray.hsl;\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tconst val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tconst integer = (val << 16) + (val << 8) + val;\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tconst val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n", "const conversions = require('./conversions');\n\n/*\n\tThis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tconst graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tconst models = Object.keys(conversions);\n\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tconst graph = buildGraph();\n\tconst queue = [fromModel]; // Unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length) {\n\t\tconst current = queue.pop();\n\t\tconst adjacents = Object.keys(conversions[current]);\n\n\t\tfor (let len = adjacents.length, i = 0; i < len; i++) {\n\t\t\tconst adjacent = adjacents[i];\n\t\t\tconst node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tconst path = [graph[toModel].parent, toModel];\n\tlet fn = conversions[graph[toModel].parent][toModel];\n\n\tlet cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nmodule.exports = function (fromModel) {\n\tconst graph = deriveBFS(fromModel);\n\tconst conversion = {};\n\n\tconst models = Object.keys(graph);\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tconst toModel = models[i];\n\t\tconst node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// No possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n};\n\n", "const conversions = require('./conversions');\nconst route = require('./route');\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\trouteModels.forEach(toModel => {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nmodule.exports = convert;\n", "const colorString = require('color-string');\nconst convert = require('color-convert');\n\nconst skippedModels = [\n\t// To be honest, I don't really feel like keyword belongs in color convert, but eh.\n\t'keyword',\n\n\t// Gray conflicts with some method names, and has its own method defined.\n\t'gray',\n\n\t// Shouldn't really be in color-convert either...\n\t'hex',\n];\n\nconst hashedModelKeys = {};\nfor (const model of Object.keys(convert)) {\n\thashedModelKeys[[...convert[model].labels].sort().join('')] = model;\n}\n\nconst limiters = {};\n\nfunction Color(object, model) {\n\tif (!(this instanceof Color)) {\n\t\treturn new Color(object, model);\n\t}\n\n\tif (model && model in skippedModels) {\n\t\tmodel = null;\n\t}\n\n\tif (model && !(model in convert)) {\n\t\tthrow new Error('Unknown model: ' + model);\n\t}\n\n\tlet i;\n\tlet channels;\n\n\tif (object == null) { // eslint-disable-line no-eq-null,eqeqeq\n\t\tthis.model = 'rgb';\n\t\tthis.color = [0, 0, 0];\n\t\tthis.valpha = 1;\n\t} else if (object instanceof Color) {\n\t\tthis.model = object.model;\n\t\tthis.color = [...object.color];\n\t\tthis.valpha = object.valpha;\n\t} else if (typeof object === 'string') {\n\t\tconst result = colorString.get(object);\n\t\tif (result === null) {\n\t\t\tthrow new Error('Unable to parse color from string: ' + object);\n\t\t}\n\n\t\tthis.model = result.model;\n\t\tchannels = convert[this.model].channels;\n\t\tthis.color = result.value.slice(0, channels);\n\t\tthis.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;\n\t} else if (object.length > 0) {\n\t\tthis.model = model || 'rgb';\n\t\tchannels = convert[this.model].channels;\n\t\tconst newArray = Array.prototype.slice.call(object, 0, channels);\n\t\tthis.color = zeroArray(newArray, channels);\n\t\tthis.valpha = typeof object[channels] === 'number' ? object[channels] : 1;\n\t} else if (typeof object === 'number') {\n\t\t// This is always RGB - can be converted later on.\n\t\tthis.model = 'rgb';\n\t\tthis.color = [\n\t\t\t(object >> 16) & 0xFF,\n\t\t\t(object >> 8) & 0xFF,\n\t\t\tobject & 0xFF,\n\t\t];\n\t\tthis.valpha = 1;\n\t} else {\n\t\tthis.valpha = 1;\n\n\t\tconst keys = Object.keys(object);\n\t\tif ('alpha' in object) {\n\t\t\tkeys.splice(keys.indexOf('alpha'), 1);\n\t\t\tthis.valpha = typeof object.alpha === 'number' ? object.alpha : 0;\n\t\t}\n\n\t\tconst hashedKeys = keys.sort().join('');\n\t\tif (!(hashedKeys in hashedModelKeys)) {\n\t\t\tthrow new Error('Unable to parse color from object: ' + JSON.stringify(object));\n\t\t}\n\n\t\tthis.model = hashedModelKeys[hashedKeys];\n\n\t\tconst {labels} = convert[this.model];\n\t\tconst color = [];\n\t\tfor (i = 0; i < labels.length; i++) {\n\t\t\tcolor.push(object[labels[i]]);\n\t\t}\n\n\t\tthis.color = zeroArray(color);\n\t}\n\n\t// Perform limitations (clamping, etc.)\n\tif (limiters[this.model]) {\n\t\tchannels = convert[this.model].channels;\n\t\tfor (i = 0; i < channels; i++) {\n\t\t\tconst limit = limiters[this.model][i];\n\t\t\tif (limit) {\n\t\t\t\tthis.color[i] = limit(this.color[i]);\n\t\t\t}\n\t\t}\n\t}\n\n\tthis.valpha = Math.max(0, Math.min(1, this.valpha));\n\n\tif (Object.freeze) {\n\t\tObject.freeze(this);\n\t}\n}\n\nColor.prototype = {\n\ttoString() {\n\t\treturn this.string();\n\t},\n\n\ttoJSON() {\n\t\treturn this[this.model]();\n\t},\n\n\tstring(places) {\n\t\tlet self = this.model in colorString.to ? this : this.rgb();\n\t\tself = self.round(typeof places === 'number' ? places : 1);\n\t\tconst args = self.valpha === 1 ? self.color : [...self.color, this.valpha];\n\t\treturn colorString.to[self.model](args);\n\t},\n\n\tpercentString(places) {\n\t\tconst self = this.rgb().round(typeof places === 'number' ? places : 1);\n\t\tconst args = self.valpha === 1 ? self.color : [...self.color, this.valpha];\n\t\treturn colorString.to.rgb.percent(args);\n\t},\n\n\tarray() {\n\t\treturn this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];\n\t},\n\n\tobject() {\n\t\tconst result = {};\n\t\tconst {channels} = convert[this.model];\n\t\tconst {labels} = convert[this.model];\n\n\t\tfor (let i = 0; i < channels; i++) {\n\t\t\tresult[labels[i]] = this.color[i];\n\t\t}\n\n\t\tif (this.valpha !== 1) {\n\t\t\tresult.alpha = this.valpha;\n\t\t}\n\n\t\treturn result;\n\t},\n\n\tunitArray() {\n\t\tconst rgb = this.rgb().color;\n\t\trgb[0] /= 255;\n\t\trgb[1] /= 255;\n\t\trgb[2] /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.push(this.valpha);\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tunitObject() {\n\t\tconst rgb = this.rgb().object();\n\t\trgb.r /= 255;\n\t\trgb.g /= 255;\n\t\trgb.b /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.alpha = this.valpha;\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tround(places) {\n\t\tplaces = Math.max(places || 0, 0);\n\t\treturn new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);\n\t},\n\n\talpha(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);\n\t\t}\n\n\t\treturn this.valpha;\n\t},\n\n\t// Rgb\n\tred: getset('rgb', 0, maxfn(255)),\n\tgreen: getset('rgb', 1, maxfn(255)),\n\tblue: getset('rgb', 2, maxfn(255)),\n\n\thue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),\n\n\tsaturationl: getset('hsl', 1, maxfn(100)),\n\tlightness: getset('hsl', 2, maxfn(100)),\n\n\tsaturationv: getset('hsv', 1, maxfn(100)),\n\tvalue: getset('hsv', 2, maxfn(100)),\n\n\tchroma: getset('hcg', 1, maxfn(100)),\n\tgray: getset('hcg', 2, maxfn(100)),\n\n\twhite: getset('hwb', 1, maxfn(100)),\n\twblack: getset('hwb', 2, maxfn(100)),\n\n\tcyan: getset('cmyk', 0, maxfn(100)),\n\tmagenta: getset('cmyk', 1, maxfn(100)),\n\tyellow: getset('cmyk', 2, maxfn(100)),\n\tblack: getset('cmyk', 3, maxfn(100)),\n\n\tx: getset('xyz', 0, maxfn(95.047)),\n\ty: getset('xyz', 1, maxfn(100)),\n\tz: getset('xyz', 2, maxfn(108.833)),\n\n\tl: getset('lab', 0, maxfn(100)),\n\ta: getset('lab', 1),\n\tb: getset('lab', 2),\n\n\tkeyword(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\treturn convert[this.model].keyword(this.color);\n\t},\n\n\thex(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\treturn colorString.to.hex(this.rgb().round().color);\n\t},\n\n\thexa(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\tconst rgbArray = this.rgb().round().color;\n\n\t\tlet alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();\n\t\tif (alphaHex.length === 1) {\n\t\t\talphaHex = '0' + alphaHex;\n\t\t}\n\n\t\treturn colorString.to.hex(rgbArray) + alphaHex;\n\t},\n\n\trgbNumber() {\n\t\tconst rgb = this.rgb().color;\n\t\treturn ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);\n\t},\n\n\tluminosity() {\n\t\t// http://www.w3.org/TR/WCAG20/#relativeluminancedef\n\t\tconst rgb = this.rgb().color;\n\n\t\tconst lum = [];\n\t\tfor (const [i, element] of rgb.entries()) {\n\t\t\tconst chan = element / 255;\n\t\t\tlum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;\n\t\t}\n\n\t\treturn 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];\n\t},\n\n\tcontrast(color2) {\n\t\t// http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n\t\tconst lum1 = this.luminosity();\n\t\tconst lum2 = color2.luminosity();\n\n\t\tif (lum1 > lum2) {\n\t\t\treturn (lum1 + 0.05) / (lum2 + 0.05);\n\t\t}\n\n\t\treturn (lum2 + 0.05) / (lum1 + 0.05);\n\t},\n\n\tlevel(color2) {\n\t\t// https://www.w3.org/TR/WCAG/#contrast-enhanced\n\t\tconst contrastRatio = this.contrast(color2);\n\t\tif (contrastRatio >= 7) {\n\t\t\treturn 'AAA';\n\t\t}\n\n\t\treturn (contrastRatio >= 4.5) ? 'AA' : '';\n\t},\n\n\tisDark() {\n\t\t// YIQ equation from http://24ways.org/2010/calculating-color-contrast\n\t\tconst rgb = this.rgb().color;\n\t\tconst yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;\n\t\treturn yiq < 128;\n\t},\n\n\tisLight() {\n\t\treturn !this.isDark();\n\t},\n\n\tnegate() {\n\t\tconst rgb = this.rgb();\n\t\tfor (let i = 0; i < 3; i++) {\n\t\t\trgb.color[i] = 255 - rgb.color[i];\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tlighten(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[2] += hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdarken(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[2] -= hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tsaturate(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[1] += hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdesaturate(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[1] -= hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\twhiten(ratio) {\n\t\tconst hwb = this.hwb();\n\t\thwb.color[1] += hwb.color[1] * ratio;\n\t\treturn hwb;\n\t},\n\n\tblacken(ratio) {\n\t\tconst hwb = this.hwb();\n\t\thwb.color[2] += hwb.color[2] * ratio;\n\t\treturn hwb;\n\t},\n\n\tgrayscale() {\n\t\t// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale\n\t\tconst rgb = this.rgb().color;\n\t\tconst value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;\n\t\treturn Color.rgb(value, value, value);\n\t},\n\n\tfade(ratio) {\n\t\treturn this.alpha(this.valpha - (this.valpha * ratio));\n\t},\n\n\topaquer(ratio) {\n\t\treturn this.alpha(this.valpha + (this.valpha * ratio));\n\t},\n\n\trotate(degrees) {\n\t\tconst hsl = this.hsl();\n\t\tlet hue = hsl.color[0];\n\t\thue = (hue + degrees) % 360;\n\t\thue = hue < 0 ? 360 + hue : hue;\n\t\thsl.color[0] = hue;\n\t\treturn hsl;\n\t},\n\n\tmix(mixinColor, weight) {\n\t\t// Ported from sass implementation in C\n\t\t// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209\n\t\tif (!mixinColor || !mixinColor.rgb) {\n\t\t\tthrow new Error('Argument to \"mix\" was not a Color instance, but rather an instance of ' + typeof mixinColor);\n\t\t}\n\n\t\tconst color1 = mixinColor.rgb();\n\t\tconst color2 = this.rgb();\n\t\tconst p = weight === undefined ? 0.5 : weight;\n\n\t\tconst w = 2 * p - 1;\n\t\tconst a = color1.alpha() - color2.alpha();\n\n\t\tconst w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;\n\t\tconst w2 = 1 - w1;\n\n\t\treturn Color.rgb(\n\t\t\tw1 * color1.red() + w2 * color2.red(),\n\t\t\tw1 * color1.green() + w2 * color2.green(),\n\t\t\tw1 * color1.blue() + w2 * color2.blue(),\n\t\t\tcolor1.alpha() * p + color2.alpha() * (1 - p));\n\t},\n};\n\n// Model conversion methods and static constructors\nfor (const model of Object.keys(convert)) {\n\tif (skippedModels.includes(model)) {\n\t\tcontinue;\n\t}\n\n\tconst {channels} = convert[model];\n\n\t// Conversion methods\n\tColor.prototype[model] = function (...args) {\n\t\tif (this.model === model) {\n\t\t\treturn new Color(this);\n\t\t}\n\n\t\tif (args.length > 0) {\n\t\t\treturn new Color(args, model);\n\t\t}\n\n\t\treturn new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);\n\t};\n\n\t// 'static' construction methods\n\tColor[model] = function (...args) {\n\t\tlet color = args[0];\n\t\tif (typeof color === 'number') {\n\t\t\tcolor = zeroArray(args, channels);\n\t\t}\n\n\t\treturn new Color(color, model);\n\t};\n}\n\nfunction roundTo(number, places) {\n\treturn Number(number.toFixed(places));\n}\n\nfunction roundToPlace(places) {\n\treturn function (number) {\n\t\treturn roundTo(number, places);\n\t};\n}\n\nfunction getset(model, channel, modifier) {\n\tmodel = Array.isArray(model) ? model : [model];\n\n\tfor (const m of model) {\n\t\t(limiters[m] || (limiters[m] = []))[channel] = modifier;\n\t}\n\n\tmodel = model[0];\n\n\treturn function (value) {\n\t\tlet result;\n\n\t\tif (value !== undefined) {\n\t\t\tif (modifier) {\n\t\t\t\tvalue = modifier(value);\n\t\t\t}\n\n\t\t\tresult = this[model]();\n\t\t\tresult.color[channel] = value;\n\t\t\treturn result;\n\t\t}\n\n\t\tresult = this[model]().color[channel];\n\t\tif (modifier) {\n\t\t\tresult = modifier(result);\n\t\t}\n\n\t\treturn result;\n\t};\n}\n\nfunction maxfn(max) {\n\treturn function (v) {\n\t\treturn Math.max(0, Math.min(max, v));\n\t};\n}\n\nfunction assertArray(value) {\n\treturn Array.isArray(value) ? value : [value];\n}\n\nfunction zeroArray(array, length) {\n\tfor (let i = 0; i < length; i++) {\n\t\tif (typeof array[i] !== 'number') {\n\t\t\tarray[i] = 0;\n\t\t}\n\t}\n\n\treturn array;\n}\n\nmodule.exports = Color;\n", "// https://nodejs.org/api/packages.html#packages_writing_dual_packages_while_avoiding_or_minimizing_hazards\nimport HighlightJS from '../lib/core.js';\nexport { HighlightJS };\nexport default HighlightJS;\n", "const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\n \"as\", // for exports\n \"in\",\n \"of\",\n \"if\",\n \"for\",\n \"while\",\n \"finally\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\",\n \"catch\",\n \"instanceof\",\n \"with\",\n \"throw\",\n \"case\",\n \"default\",\n \"try\",\n \"switch\",\n \"continue\",\n \"typeof\",\n \"delete\",\n \"let\",\n \"yield\",\n \"const\",\n \"class\",\n // JS handles these with a special rule\n // \"get\",\n // \"set\",\n \"debugger\",\n \"async\",\n \"await\",\n \"static\",\n \"import\",\n \"from\",\n \"export\",\n \"extends\"\n];\nconst LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\",\n \"NaN\",\n \"Infinity\"\n];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // numbers and dates\n \"Math\",\n \"Date\",\n \"Number\",\n \"BigInt\",\n // text\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Int32Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n // Keyed collections\n \"Set\",\n \"Map\",\n \"WeakSet\",\n \"WeakMap\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"Atomics\",\n \"DataView\",\n \"JSON\",\n // Control abstraction objects\n \"Promise\",\n \"Generator\",\n \"GeneratorFunction\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\",\n // WebAssembly\n \"WebAssembly\"\n];\n\nconst ERROR_TYPES = [\n \"Error\",\n \"EvalError\",\n \"InternalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\"\n];\n\nconst BUILT_IN_GLOBALS = [\n \"setInterval\",\n \"setTimeout\",\n \"clearInterval\",\n \"clearTimeout\",\n\n \"require\",\n \"exports\",\n\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\"\n];\n\nconst BUILT_IN_VARIABLES = [\n \"arguments\",\n \"this\",\n \"super\",\n \"console\",\n \"window\",\n \"document\",\n \"localStorage\",\n \"sessionStorage\",\n \"module\",\n \"global\" // Node.js\n];\n\nconst BUILT_INS = [].concat(\n BUILT_IN_GLOBALS,\n TYPES,\n ERROR_TYPES\n);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \" {\n const tag = \"',\n end: ''\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // ``\n nextChar === \",\"\n ) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, { after: afterMatchIndex })) {\n response.ignoreMatch();\n }\n }\n\n // `` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // (key?: string) => Modify<\n if ((m = afterMatch.match(/^\\s*=/))) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if ((m = afterMatch.match(/^\\s+extends\\s+/))) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n { begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` +\n `[eE][+-]?(${decimalDigits})\\\\b` },\n { begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b` },\n\n // DecimalBigIntegerLiteral\n { begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b` },\n\n // NonDecimalIntegerLiteral\n { begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\" },\n { begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\" },\n { begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\" },\n\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n { begin: \"\\\\b0[0-7]+n?\\\\b\" },\n ],\n relevance: 0\n };\n\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: 'html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: 'css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: 'gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n const JSDOC_COMMENT = hljs.COMMENT(\n /\\/\\*\\*(?!\\/)/,\n '\\\\*/',\n {\n relevance: 0,\n contains: [\n {\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [\n {\n className: 'doctag',\n begin: '@[A-Za-z]+'\n },\n {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n },\n {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }\n ]\n }\n ]\n }\n );\n const COMMENT = {\n className: \"comment\",\n variants: [\n JSDOC_COMMENT,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]\n };\n const SUBST_INTERNALS = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS\n .concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\n \"self\"\n ].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }\n ]);\n const PARAMS = {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1,\n /\\s+/,\n /extends/,\n /\\s+/,\n regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n\n ]\n };\n\n const CLASS_REFERENCE = {\n relevance: 0,\n match:\n regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/,\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES,\n ...ERROR_TYPES\n ]\n }\n };\n\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n\n const FUNCTION_DEFINITION = {\n variants: [\n {\n match: [\n /function/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\s*\\()/\n ]\n },\n // anonymous function\n {\n match: [\n /function/,\n /\\s*(?=\\()/\n ]\n }\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [ PARAMS ],\n illegal: /%/\n };\n\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n\n const FUNCTION_CALL = {\n match: regex.concat(\n /\\b/,\n noneOf([\n ...BUILT_IN_GLOBALS,\n \"super\",\n \"import\"\n ]),\n IDENT_RE$1, regex.lookahead(/\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(\n regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)\n )),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n\n const GETTER_OR_SETTER = {\n match: [\n /get|set/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\()/\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n { // eat to avoid empty params\n begin: /\\(\\)/\n },\n PARAMS\n ]\n };\n\n const FUNC_LEAD_IN_RE = '(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n\n const FUNCTION_VARIABLE = {\n match: [\n /const|var|let/, /\\s+/,\n IDENT_RE$1, /\\s*/,\n /=\\s*/,\n /(async\\s*)?/, // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)\n ],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n PARAMS\n ]\n };\n\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: { PARAMS_CONTAINS, CLASS_REFERENCE },\n illegal: /#(?![$_A-z])/,\n contains: [\n hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }),\n USE_STRICT,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n COMMENT,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n CLASS_REFERENCE,\n {\n className: 'attr',\n begin: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n },\n FUNCTION_VARIABLE,\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [\n COMMENT,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n },\n {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n },\n { // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n },\n {\n match: /\\s+/,\n relevance: 0\n },\n { // JSX\n variants: [\n { begin: FRAGMENT.begin, end: FRAGMENT.end },\n { match: XML_SELF_CLOSING },\n {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }\n ],\n subLanguage: 'xml',\n contains: [\n {\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }\n ]\n }\n ],\n },\n FUNCTION_DEFINITION,\n {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n },\n {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +\n '\\\\(' + // first parens\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)\\\\s*\\\\{', // end parens\n returnBegin:true,\n label: \"func.def\",\n contains: [\n PARAMS,\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: \"title.function\" })\n ]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n },\n PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n },\n {\n match: [ /\\bconstructor(?=\\s*\\()/ ],\n className: { 1: \"title.function\" },\n contains: [ PARAMS ]\n },\n FUNCTION_CALL,\n UPPER_CASE_CONSTANT,\n CLASS_OR_EXTENDS,\n GETTER_OR_SETTER,\n {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }\n ]\n };\n}\n\nexport { javascript as default };\n", "const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\n \"as\", // for exports\n \"in\",\n \"of\",\n \"if\",\n \"for\",\n \"while\",\n \"finally\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\",\n \"catch\",\n \"instanceof\",\n \"with\",\n \"throw\",\n \"case\",\n \"default\",\n \"try\",\n \"switch\",\n \"continue\",\n \"typeof\",\n \"delete\",\n \"let\",\n \"yield\",\n \"const\",\n \"class\",\n // JS handles these with a special rule\n // \"get\",\n // \"set\",\n \"debugger\",\n \"async\",\n \"await\",\n \"static\",\n \"import\",\n \"from\",\n \"export\",\n \"extends\"\n];\nconst LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\",\n \"NaN\",\n \"Infinity\"\n];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // numbers and dates\n \"Math\",\n \"Date\",\n \"Number\",\n \"BigInt\",\n // text\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Float32Array\",\n \"Float64Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Int32Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n // Keyed collections\n \"Set\",\n \"Map\",\n \"WeakSet\",\n \"WeakMap\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"Atomics\",\n \"DataView\",\n \"JSON\",\n // Control abstraction objects\n \"Promise\",\n \"Generator\",\n \"GeneratorFunction\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\",\n // WebAssembly\n \"WebAssembly\"\n];\n\nconst ERROR_TYPES = [\n \"Error\",\n \"EvalError\",\n \"InternalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\"\n];\n\nconst BUILT_IN_GLOBALS = [\n \"setInterval\",\n \"setTimeout\",\n \"clearInterval\",\n \"clearTimeout\",\n\n \"require\",\n \"exports\",\n\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\"\n];\n\nconst BUILT_IN_VARIABLES = [\n \"arguments\",\n \"this\",\n \"super\",\n \"console\",\n \"window\",\n \"document\",\n \"localStorage\",\n \"sessionStorage\",\n \"module\",\n \"global\" // Node.js\n];\n\nconst BUILT_INS = [].concat(\n BUILT_IN_GLOBALS,\n TYPES,\n ERROR_TYPES\n);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \" {\n const tag = \"',\n end: ''\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // ``\n nextChar === \",\"\n ) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, { after: afterMatchIndex })) {\n response.ignoreMatch();\n }\n }\n\n // `` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // (key?: string) => Modify<\n if ((m = afterMatch.match(/^\\s*=/))) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if ((m = afterMatch.match(/^\\s+extends\\s+/))) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n { begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` +\n `[eE][+-]?(${decimalDigits})\\\\b` },\n { begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b` },\n\n // DecimalBigIntegerLiteral\n { begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b` },\n\n // NonDecimalIntegerLiteral\n { begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\" },\n { begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\" },\n { begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\" },\n\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n { begin: \"\\\\b0[0-7]+n?\\\\b\" },\n ],\n relevance: 0\n };\n\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: 'html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: 'css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: 'gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n const JSDOC_COMMENT = hljs.COMMENT(\n /\\/\\*\\*(?!\\/)/,\n '\\\\*/',\n {\n relevance: 0,\n contains: [\n {\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [\n {\n className: 'doctag',\n begin: '@[A-Za-z]+'\n },\n {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n },\n {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }\n ]\n }\n ]\n }\n );\n const COMMENT = {\n className: \"comment\",\n variants: [\n JSDOC_COMMENT,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]\n };\n const SUBST_INTERNALS = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS\n .concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\n \"self\"\n ].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }\n ]);\n const PARAMS = {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1,\n /\\s+/,\n /extends/,\n /\\s+/,\n regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [\n /class/,\n /\\s+/,\n IDENT_RE$1\n ],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n },\n\n ]\n };\n\n const CLASS_REFERENCE = {\n relevance: 0,\n match:\n regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/,\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES,\n ...ERROR_TYPES\n ]\n }\n };\n\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n\n const FUNCTION_DEFINITION = {\n variants: [\n {\n match: [\n /function/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\s*\\()/\n ]\n },\n // anonymous function\n {\n match: [\n /function/,\n /\\s*(?=\\()/\n ]\n }\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [ PARAMS ],\n illegal: /%/\n };\n\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n\n const FUNCTION_CALL = {\n match: regex.concat(\n /\\b/,\n noneOf([\n ...BUILT_IN_GLOBALS,\n \"super\",\n \"import\"\n ]),\n IDENT_RE$1, regex.lookahead(/\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(\n regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)\n )),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n\n const GETTER_OR_SETTER = {\n match: [\n /get|set/,\n /\\s+/,\n IDENT_RE$1,\n /(?=\\()/\n ],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n { // eat to avoid empty params\n begin: /\\(\\)/\n },\n PARAMS\n ]\n };\n\n const FUNC_LEAD_IN_RE = '(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n\n const FUNCTION_VARIABLE = {\n match: [\n /const|var|let/, /\\s+/,\n IDENT_RE$1, /\\s*/,\n /=\\s*/,\n /(async\\s*)?/, // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)\n ],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [\n PARAMS\n ]\n };\n\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: { PARAMS_CONTAINS, CLASS_REFERENCE },\n illegal: /#(?![$_A-z])/,\n contains: [\n hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }),\n USE_STRICT,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n GRAPHQL_TEMPLATE,\n TEMPLATE_STRING,\n COMMENT,\n // Skip numbers when they are part of a variable name\n { match: /\\$\\d+/ },\n NUMBER,\n CLASS_REFERENCE,\n {\n className: 'attr',\n begin: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n },\n FUNCTION_VARIABLE,\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [\n COMMENT,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n },\n {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n },\n { // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n },\n {\n match: /\\s+/,\n relevance: 0\n },\n { // JSX\n variants: [\n { begin: FRAGMENT.begin, end: FRAGMENT.end },\n { match: XML_SELF_CLOSING },\n {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }\n ],\n subLanguage: 'xml',\n contains: [\n {\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }\n ]\n }\n ],\n },\n FUNCTION_DEFINITION,\n {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n },\n {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +\n '\\\\(' + // first parens\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)\\\\s*\\\\{', // end parens\n returnBegin:true,\n label: \"func.def\",\n contains: [\n PARAMS,\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: \"title.function\" })\n ]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n },\n PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n },\n {\n match: [ /\\bconstructor(?=\\s*\\()/ ],\n className: { 1: \"title.function\" },\n contains: [ PARAMS ]\n },\n FUNCTION_CALL,\n UPPER_CASE_CONSTANT,\n CLASS_OR_EXTENDS,\n GETTER_OR_SETTER,\n {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }\n ]\n };\n}\n\n/*\nLanguage: TypeScript\nAuthor: Panu Horsmalahti \nContributors: Ike Ku \nDescription: TypeScript is a strict superset of JavaScript\nWebsite: https://www.typescriptlang.org\nCategory: common, scripting\n*/\n\n\n/** @type LanguageFn */\nfunction typescript(hljs) {\n const tsLanguage = javascript(hljs);\n\n const IDENT_RE$1 = IDENT_RE;\n const TYPES = [\n \"any\",\n \"void\",\n \"number\",\n \"boolean\",\n \"string\",\n \"object\",\n \"never\",\n \"symbol\",\n \"bigint\",\n \"unknown\"\n ];\n const NAMESPACE = {\n beginKeywords: 'namespace',\n end: /\\{/,\n excludeEnd: true,\n contains: [ tsLanguage.exports.CLASS_REFERENCE ]\n };\n const INTERFACE = {\n beginKeywords: 'interface',\n end: /\\{/,\n excludeEnd: true,\n keywords: {\n keyword: 'interface extends',\n built_in: TYPES\n },\n contains: [ tsLanguage.exports.CLASS_REFERENCE ]\n };\n const USE_STRICT = {\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use strict['\"]/\n };\n const TS_SPECIFIC_KEYWORDS = [\n \"type\",\n \"namespace\",\n \"interface\",\n \"public\",\n \"private\",\n \"protected\",\n \"implements\",\n \"declare\",\n \"abstract\",\n \"readonly\",\n \"enum\",\n \"override\"\n ];\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS),\n literal: LITERALS,\n built_in: BUILT_INS.concat(TYPES),\n \"variable.language\": BUILT_IN_VARIABLES\n };\n const DECORATOR = {\n className: 'meta',\n begin: '@' + IDENT_RE$1,\n };\n\n const swapMode = (mode, label, replacement) => {\n const indx = mode.contains.findIndex(m => m.label === label);\n if (indx === -1) { throw new Error(\"can not find mode to replace\"); }\n\n mode.contains.splice(indx, 1, replacement);\n };\n\n\n // this should update anywhere keywords is used since\n // it will be the same actual JS object\n Object.assign(tsLanguage.keywords, KEYWORDS$1);\n\n tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);\n tsLanguage.contains = tsLanguage.contains.concat([\n DECORATOR,\n NAMESPACE,\n INTERFACE,\n ]);\n\n // TS gets a simpler shebang rule than JS\n swapMode(tsLanguage, \"shebang\", hljs.SHEBANG());\n // JS use strict rule purposely excludes `asm` which makes no sense\n swapMode(tsLanguage, \"use_strict\", USE_STRICT);\n\n const functionDeclaration = tsLanguage.contains.find(m => m.label === \"func.def\");\n functionDeclaration.relevance = 0; // () => {} is more typical in TypeScript\n\n Object.assign(tsLanguage, {\n name: 'TypeScript',\n aliases: [\n 'ts',\n 'tsx',\n 'mts',\n 'cts'\n ]\n });\n\n return tsLanguage;\n}\n\nexport { typescript as default };\n", "/*\nLanguage: HTML, XML\nWebsite: https://www.w3.org/XML/\nCategory: common, web\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction xml(hljs) {\n const regex = hljs.regex;\n // XML names can have the following additional letters: https://www.w3.org/TR/xml/#NT-NameChar\n // OTHER_NAME_CHARS = /[:\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]/;\n // Element names start with NAME_START_CHAR followed by optional other Unicode letters, ASCII digits, hyphens, underscores, and periods\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);;\n // const XML_IDENT_RE = /[A-Z_a-z:\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]+/;\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);\n // however, to cater for performance and more Unicode support rely simply on the Unicode letter class\n const TAG_NAME_RE = regex.concat(/[\\p{L}_]/u, regex.optional(/[\\p{L}0-9_.-]*:/u), /[\\p{L}0-9_.-]*/u);\n const XML_IDENT_RE = /[\\p{L}0-9._:-]+/u;\n const XML_ENTITIES = {\n className: 'symbol',\n begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/\n };\n const XML_META_KEYWORDS = {\n begin: /\\s/,\n contains: [\n {\n className: 'keyword',\n begin: /#?[a-z_][a-z1-9_-]+/,\n illegal: /\\n/\n }\n ]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: /\\(/,\n end: /\\)/\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: 'string' });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: 'string' });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /`]+/ }\n ]\n }\n ]\n }\n ]\n };\n return {\n name: 'HTML, XML',\n aliases: [\n 'html',\n 'xhtml',\n 'rss',\n 'atom',\n 'xjb',\n 'xsd',\n 'xsl',\n 'plist',\n 'wsf',\n 'svg'\n ],\n case_insensitive: true,\n unicodeRegex: true,\n contains: [\n {\n className: 'meta',\n begin: //,\n relevance: 10,\n contains: [\n XML_META_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE,\n XML_META_PAR_KEYWORDS,\n {\n begin: /\\[/,\n end: /\\]/,\n contains: [\n {\n className: 'meta',\n begin: //,\n contains: [\n XML_META_KEYWORDS,\n XML_META_PAR_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE\n ]\n }\n ]\n }\n ]\n },\n hljs.COMMENT(\n //,\n { relevance: 10 }\n ),\n {\n begin: //,\n relevance: 10\n },\n XML_ENTITIES,\n // xml processing instructions\n {\n className: 'meta',\n end: /\\?>/,\n variants: [\n {\n begin: /<\\?xml/,\n relevance: 10,\n contains: [\n QUOTE_META_STRING_MODE\n ]\n },\n {\n begin: /<\\?[a-z][a-z0-9]+/,\n }\n ]\n\n },\n {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n ')/,\n end: />/,\n keywords: { name: 'style' },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/style>/,\n returnEnd: true,\n subLanguage: [\n 'css',\n 'xml'\n ]\n }\n },\n {\n className: 'tag',\n // See the comment in the \n let search = `${prefix}${i}`;\n while (i < length) {\n const node = tw.nextNode();\n // if not all updates are bound but there's nothing else to crawl\n // it means that there is something wrong with the template.\n if (!node)\n throw `bad template: ${text}`;\n // if the current node is a comment, and it contains is\u00B5X\n // it means the update should take care of any content\n if (node.nodeType === 8) {\n // The only comments to be considered are those\n // which content is exactly the same as the searched one.\n if (node.data === search) {\n nodes.push({type: 'node', path: createPath(node)});\n search = `${prefix}${++i}`;\n }\n }\n else {\n // if the node is not a comment, loop through all its attributes\n // named is\u00B5X and relate attribute updates to this node and the\n // attribute name, retrieved through node.getAttribute(\"is\u00B5X\")\n // the is\u00B5X attribute will be removed as irrelevant for the layout\n // let svg = -1;\n while (node.hasAttribute(search)) {\n nodes.push({\n type: 'attr',\n path: createPath(node),\n name: node.getAttribute(search),\n //svg: svg < 0 ? (svg = ('ownerSVGElement' in node ? 1 : 0)) : svg\n });\n node.removeAttribute(search);\n search = `${prefix}${++i}`;\n }\n // if the node was a style, textarea, or others, check its content\n // and if it is then update tex-only this node\n if (\n textOnly.test(node.tagName) &&\n node.textContent.trim() === ``\n ){\n node.textContent = '';\n nodes.push({type: 'text', path: createPath(node)});\n search = `${prefix}${++i}`;\n }\n }\n }\n // once all nodes to update, or their attributes, are known, the content\n // will be cloned in the future to represent the template, and all updates\n // related to such content retrieved right away without needing to re-crawl\n // the exact same template, and its content, more than once.\n return {content, nodes};\n};\n\n// if a template is unknown, perform the previous mapping, otherwise grab\n// its details such as the fragment with all nodes, and updates info.\nconst mapUpdates = (type, template) => {\n const {content, nodes} = (\n cache.get(template) ||\n cache.set(template, mapTemplate(type, template))\n );\n // clone deeply the fragment\n const fragment = document.importNode(content, true);\n // and relate an update handler per each node that needs one\n const updates = nodes.map(handlers, fragment);\n // return the fragment and all updates to use within its nodes\n return {content: fragment, updates};\n};\n\n// as html and svg can be nested calls, but no parent node is known\n// until rendered somewhere, the unroll operation is needed to\n// discover what to do with each interpolation, which will result\n// into an update operation.\nexport const unroll = (info, {type, template, values}) => {\n const {length} = values;\n // interpolations can contain holes and arrays, so these need\n // to be recursively discovered\n unrollValues(info, values, length);\n let {entry} = info;\n // if the cache entry is either null or different from the template\n // and the type this unroll should resolve, create a new entry\n // assigning a new content fragment and the list of updates.\n if (!entry || (entry.template !== template || entry.type !== type))\n info.entry = (entry = createEntry(type, template));\n const {content, updates, wire} = entry;\n // even if the fragment and its nodes is not live yet,\n // it is already possible to update via interpolations values.\n for (let i = 0; i < length; i++)\n updates[i](values[i]);\n // if the entry was new, or representing a different template or type,\n // create a new persistent entity to use during diffing.\n // This is simply a DOM node, when the template has a single container,\n // as in `

`, or a \"wire\" in `

` and similar cases.\n return wire || (entry.wire = persistent(content));\n};\n\n// the stack retains, per each interpolation value, the cache\n// related to each interpolation value, or null, if the render\n// was conditional and the value is not special (Array or Hole)\nconst unrollValues = ({stack}, values, length) => {\n for (let i = 0; i < length; i++) {\n const hole = values[i];\n // each Hole gets unrolled and re-assigned as value\n // so that domdiff will deal with a node/wire, not with a hole\n if (hole instanceof Hole)\n values[i] = unroll(\n stack[i] || (stack[i] = createCache()),\n hole\n );\n // arrays are recursively resolved so that each entry will contain\n // also a DOM node or a wire, hence it can be diffed if/when needed\n else if (isArray(hole))\n unrollValues(\n stack[i] || (stack[i] = createCache()),\n hole,\n hole.length\n );\n // if the value is nothing special, the stack doesn't need to retain data\n // this is useful also to cleanup previously retained data, if the value\n // was a Hole, or an Array, but not anymore, i.e.:\n // const update = content => html`
${content}
`;\n // update(listOfItems); update(null); update(html`hole`)\n else\n stack[i] = null;\n }\n if (length < stack.length)\n stack.splice(length);\n};\n\n/**\n * Holds all details wrappers needed to render the content further on.\n * @constructor\n * @param {string} type The hole type, either `html` or `svg`.\n * @param {string[]} template The template literals used to the define the content.\n * @param {Array} values Zero, one, or more interpolated values to render.\n */\nexport function Hole(type, template, values) {\n this.type = type;\n this.template = template;\n this.values = values;\n};\n", "import umap from 'umap';\nimport {Hole, createCache, unroll} from './rabbit.js';\nimport {foreign} from 'uhandlers';\n\nconst {create, defineProperties} = Object;\n\n// both `html` and `svg` template literal tags are polluted\n// with a `for(ref[, id])` and a `node` tag too\nconst tag = type => {\n // both `html` and `svg` tags have their own cache\n const keyed = umap(new WeakMap);\n // keyed operations always re-use the same cache and unroll\n // the template and its interpolations right away\n const fixed = cache => (template, ...values) => unroll(\n cache,\n {type, template, values}\n );\n return defineProperties(\n // non keyed operations are recognized as instance of Hole\n // during the \"unroll\", recursively resolved and updated\n (template, ...values) => new Hole(type, template, values),\n {\n for: {\n // keyed operations need a reference object, usually the parent node\n // which is showing keyed results, and optionally a unique id per each\n // related node, handy with JSON results and mutable list of objects\n // that usually carry a unique identifier\n value(ref, id) {\n const memo = keyed.get(ref) || keyed.set(ref, create(null));\n return memo[id] || (memo[id] = fixed(createCache()));\n }\n },\n node: {\n // it is possible to create one-off content out of the box via node tag\n // this might return the single created node, or a fragment with all\n // nodes present at the root level and, of course, their child nodes\n value: (template, ...values) => unroll(\n createCache(),\n {type, template, values}\n ).valueOf()\n }\n }\n );\n};\n\n// each rendered node gets its own cache\nconst cache = umap(new WeakMap);\n\n// rendering means understanding what `html` or `svg` tags returned\n// and it relates a specific node to its own unique cache.\n// Each time the content to render changes, the node is cleaned up\n// and the new new content is appended, and if such content is a Hole\n// then it's \"unrolled\" to resolve all its inner nodes.\nconst render = (where, what) => {\n const hole = typeof what === 'function' ? what() : what;\n const info = cache.get(where) || cache.set(where, createCache());\n const wire = hole instanceof Hole ? unroll(info, hole) : hole;\n if (wire !== info.wire) {\n info.wire = wire;\n where.textContent = '';\n // valueOf() simply returns the node itself, but in case it was a \"wire\"\n // it will eventually re-append all nodes to its fragment so that such\n // fragment can be re-appended many times in a meaningful way\n // (wires are basically persistent fragments facades with special behavior)\n where.appendChild(wire.valueOf());\n }\n return where;\n};\n\nconst html = tag('html');\nconst svg = tag('svg');\n\nexport {Hole, render, html, svg, foreign};\n", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nconst Color = require('color');\n\n\nexport interface CheckboxStyleParam {\n bgColor?: string;\n activeColor?: string;\n}\n\nexport class CheckboxStyle extends StyleClass {\n static default: CheckboxStyleParam = {\n bgColor: '#ccc',\n activeColor: 'blue'\n }\n static css(style: CheckboxStyleParam = {}): string {\n style = { ...this.default, ...style };\n let css = `\n position: relative;\n width: 1em;\n height: 1em;\n user-select: none;\n display: inline-block;\n\n /* Hide the browser's default checkbox */\n input {\n opacity: 0;\n cursor: pointer;\n width: 1em;\n height: 1em;\n margin: 0;\n position: absolute;\n top: 1;\n left: 0;\n z-index: 1;\n }\n\n /* Create a custom checkbox */\n span {\n position: absolute;\n top: 0;\n left: 0;\n width: 1em;\n height: 1em;\n box-shadow: 0 1px 1px 0 grey;\n }\n\n /* Create the checkmark/indicator (hidden when not checked) */\n span:after {\n content: \"\";\n position: absolute;\n display: none;\n }\n\n /* Show the checkmark when checked */\n input:checked ~ span:after {\n display: block;\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: CheckboxStyleParam = {}): string {\n let css = `\n ${this._bgColor(style)}\n ${this._activeColor(style)}\n `.trim();\n \n return css;\n }\n\n static _bgColor(style: CheckboxStyleParam = {}): string {\n if (style.bgColor == undefined) { return '' };\n return `\n span {\n background-color: ${style.bgColor};\n }\n `.trim();\n }\n\n static _activeColor(style: CheckboxStyleParam = {}): string {\n if (style.activeColor == undefined) { return '' };\n\n let markColor = 'black';\n if (Color(style.activeColor).isDark()) {\n markColor = 'white';\n }\n\n return `\n /* Style the checkmark/indicator */\n span:after {\n border: solid ${markColor};\n left: 0.25em;\n width: 0.3em;\n height: 0.6em;\n border-width: 0 0.2em 0.2em 0;\n transform: rotate(45deg);\n }\n\n /* When the checkbox is checked, add background color */\n input:checked ~ span {\n background-color: ${style.activeColor};\n }\n\n /* On mouse-over, add background color */\n &:hover input ~ span {\n background-color: ${Color(style.activeColor).lighten(0.2)}\n }\n `.trim();\n }\n}", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\n\n\nexport class InputStyle extends StyleClass {\n static css(style = {}): string {\n return `\n font-size: 1em;\n border: 1px solid grey;\n border-radius: 0.2em;\n padding: 0.4em;\n `.trim()\n }\n}", "import { addStyle, Adapter } from \"@nitipit/adapter/src/adapter\";\nimport { InputStyle } from './input.style';\n\n\nexport class Input extends Adapter {\n static Style = InputStyle;\n}\n\naddStyle`\ninput {\n ${InputStyle.css()}\n}`;", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nvar Color = require('color');\n\nexport interface InputRadioStyleParam {\n color?: string;\n boxShadowColor?: string;\n activeColor?: string;\n}\n\n\nexport class InputRadioStyle extends StyleClass {\n static readonly default: InputRadioStyleParam = {\n color: '#ccc',\n boxShadowColor: '#777',\n activeColor: 'blue'\n }\n\n static css(style: InputRadioStyleParam = {}): string {\n style = {...this.default, ...style};\n let markDotColor = 'black';\n if (Color(style.activeColor).isDark()) {\n markDotColor = 'white';\n }\n\n const css = `\n position: relative;\n display: inline-block;\n font-size: 1em;\n user-select: none;\n width: 1.1em;\n height: 1.1em;\n input {\n position: absolute;\n z-index: 1;\n top: 0;\n left: 0;\n opacity: 0;\n cursor: pointer;\n width: 1.1em;\n height: 1.1em;\n vertical-align: middle;\n }\n\n /* Create a custom radio button */\n span {\n position: absolute;\n top: 0;\n left: 0;\n width: 1.1em;\n height: 1.1em;\n border-radius: 50%;\n }\n\n /* Create the indicator (the dot/circle - hidden when not checked) */\n span:after {\n content: \"\";\n position: absolute;\n display: none;\n }\n\n /* Show the indicator (dot/circle) when checked */\n input:checked ~ span:after {\n display: block;\n }\n\n /* Style the indicator (dot/circle) */\n span:after {\n top: 0.35em;\n left: 0.35em;\n width: 0.4em;\n height: 0.4em;\n border-radius: 50%;\n background-color: ${markDotColor};\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: InputRadioStyleParam = {}): string {\n const css = `\n ${this._color(style)}\n ${this._boxShadowColor(style)}\n ${this._activeColor(style)}\n `.trim();\n\n return css;\n }\n\n static _color(style: InputRadioStyleParam = {}): string {\n if (style.color == undefined) { return '' };\n return `\n span {\n background-color: ${style.color};\n }\n `.trim();\n }\n\n static _boxShadowColor(style: InputRadioStyleParam = {}): string {\n if (style.boxShadowColor == undefined) { return '' };\n return `\n span {\n box-shadow: 0 1px 1px 0 ${style.boxShadowColor};\n }`.trim();\n }\n\n static _activeColor(style: InputRadioStyleParam = {}): string {\n if (style.activeColor == undefined) { return '' };\n return`\n /* On mouse-over, add a background color */\n &:hover input ~ span {\n background-color: ${Color(style.activeColor).lighten(0.2).saturate(0.2)};\n }\n\n /* When the radio button is checked, add background color */\n input:checked ~ span {\n background-color: ${style.activeColor};\n }`.trim();\n }\n}", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nimport { bgColor } from \"../../style\";\nconst Color = require('color');\n\n\nexport class TagStyleParam {\n color?: string;\n borderRadius?: string;\n}\n\nexport class TagStyle extends StyleClass {\n static readonly default: TagStyleParam = {\n color: 'blue',\n borderRadius: '4px'\n }\n\n static css(style: TagStyleParam = {}): string {\n style = {...this.default, ...style};\n\n let css = `\n display: inline-flex;\n align-items: center;\n padding: 0.1em 0.4em;\n font-size: 0.9em;\n line-height: unset;\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: TagStyleParam = {}): string {\n let css = `\n ${this._color(style)}\n ${this._borderRadius(style)}\n `.trim();\n\n return css;\n }\n\n static _color(style: TagStyleParam = {}): string {\n if (style.color == undefined) { return '' };\n return `\n ${bgColor(style.color)}\n box-shadow: 0 0.17em 0 0 ${Color(style.color).darken(0.5)};\n `.trim();\n }\n\n static _borderRadius(style: TagStyleParam = {}): string {\n if (style.borderRadius == undefined) { return '' };\n return `\n border-radius: ${style.borderRadius};\n `.trim();\n }\n}\n\n", "import { TagStyle } from \"./tag.style\";\nimport { bgColorInt } from \"../../style\";\nconst Color = require('color');\n\n\nexport interface TagXStyleParam {\n color?: string;\n borderRadius?: string;\n}\n\nexport class TagXStyle extends TagStyle {\n static default: TagXStyleParam = {\n color: 'blue',\n borderRadius: '4px'\n }\n\n static css(style: TagXStyleParam = {}): string {\n style = { ...this.default, ...style };\n let css = `\n ${super.css(style)}\n padding-right: 0;\n [el=\"remove\"] {\n margin-left: 0.3em;\n padding-left: 0.4em;\n padding-right: 0.5em;\n font-weight: bold;\n border-left: 1px solid;\n cursor: pointer;\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: TagXStyleParam = {}): string {\n let css = `\n ${this._color(style)}\n ${this._borderRadius(style)}\n `.trim();\n return css;\n }\n\n static _color(style: TagXStyleParam = {}): string {\n if (style.color == undefined) { return '' };\n return `\n ${bgColorInt({color: style.color})}\n box-shadow: 0 0.17em 0 0 ${Color(style.color).darken(0.5)};\n `.trim();\n }\n\n static _borderRadius(style: TagXStyleParam = {}): string {\n if (style.borderRadius == undefined) { return '' };\n return super._borderRadius(style);\n }\n}", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nimport { bgColor } from \"../../style\";\nconst Color = require('color');\n\nexport interface MenuStyleParam {\n hoverColor?: string;\n arrowColor?: string;\n}\n\nexport class MenuStyle extends StyleClass {\n static readonly default: MenuStyleParam = {\n hoverColor: 'blue',\n arrowColor: 'blue'\n }\n\n static css(style: MenuStyleParam = {}) {\n style = {...this.default, ...style};\n const css = `\n display: block;\n padding: 0;\n margin: 0;\n border: 1px solid blue;\n border-radius: 0.2em;\n\n .arrow i {\n font-size: 1.2em;\n float: right;\n border-left: 0.25em solid transparent;\n border-right: 0.25em solid transparent;\n will-change: transform;\n transform: rotateZ(90deg);\n transition: transform 0.2s;\n }\n\n ul {\n margin: 0;\n padding-left: 1em;\n transition: height 0.2s;\n will-change: transition;\n }\n\n > ul {\n padding-left: 0;\n }\n\n li {\n list-style: none;\n display: block;\n overflow-y: hidden;\n overflow-x: hidden;\n }\n\n a {\n display: flex;\n align-items: center;\n cursor: pointer;\n padding: 0.5em 1em;\n div.content {\n width: 100%;\n }\n div.arrow {\n min-width: 1em;\n }\n }\n\n a ~ ul {\n height: 0;\n }\n\n a.show {\n .arrow i {\n transform: rotateZ(180deg);\n }\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: MenuStyleParam = {}): string {\n const css = `\n ${this._hoverColor(style)}\n ${this._arrowColor(style)}\n `.trim();\n return css;\n }\n\n static _hoverColor(style: MenuStyleParam = {}): string {\n if (style.hoverColor == undefined) { return '' };\n let arrowColor = 'black';\n if (Color(style.hoverColor).isDark()) {\n arrowColor = 'white';\n }\n return `\n a {\n -webkit-tap-highlight-color: ${Color(style.hoverColor)};\n }\n a:hover {\n ${bgColor(style.hoverColor)};\n .arrow i {\n border-bottom-color: ${arrowColor};\n }\n }\n `.trim();\n }\n static _arrowColor(style: MenuStyleParam = {}): string {\n if (style.arrowColor == undefined) { return '' };\n return `\n .arrow i {\n border-bottom: 0.25em solid ${style.arrowColor};\n }\n `.trim();\n }\n}", "import { StyleClass } from \"@nitipit/adapter/src/adapter\";\nimport { bgColor } from \"../../style\";\nconst Color = require('color');\n\n\nexport interface TableStyleParam {\n theadBgColor?: string;\n activeColor?: string;\n verticalLine?: boolean;\n horizontalLine?: boolean;\n}\n\n\nexport class TableStyle extends StyleClass {\n static readonly default: TableStyleParam = {\n theadBgColor: '#ccc',\n activeColor: 'blue',\n horizontalLine: true,\n verticalLine: true,\n }\n static css(style: TableStyleParam = {}): string {\n style = {...this.default, ...style};\n const css = `\n display: block;\n overflow: auto;\n border: 1px solid;\n border-collapse: separate;\n border-spacing: 0;\n\n thead {\n font-weight: bold;\n }\n th, td {\n padding: 0.5rem;\n }\n ${this.style(style)}\n `.trim();\n\n return css;\n }\n\n static style(style: TableStyleParam = {}): string {\n const css = `\n ${this._theadBgColor(style)}\n ${this._activeColor(style)}\n ${this._horizontalLine(style)}\n ${this._verticalLine(style)}\n `.trim();\n return css;\n }\n\n static _theadBgColor(style: TableStyleParam = {}): string {\n if (style.theadBgColor == undefined) { return '' };\n return `\n thead {\n ${bgColor(style.theadBgColor)}\n }`.trim();\n }\n\n static _activeColor(style: TableStyleParam = {}): string {\n if (style.activeColor == undefined) { return '' };\n return `\n tbody td:hover {\n ${bgColor(style.activeColor)}\n &::selection {\n ${bgColor(Color(style.activeColor).rotate(180))}\n }\n }\n `.trim();\n }\n\n static _horizontalLine(style: TableStyleParam = {}): string {\n if (style.horizontalLine == undefined) { return '' };\n let horizontalLineCSS = null;\n if (style.horizontalLine) {\n horizontalLineCSS = `\n td, th {\n border-bottom: 1px solid;\n }\n thead {\n td, th {\n border-bottom: 3px double;\n }\n }`.trim();\n } else {\n horizontalLineCSS = `\n td, th {\n border-bottom: 0;\n }\n thead {\n td, th {\n border-bottom: 0;\n }\n }`.trim();\n }\n return horizontalLineCSS;\n }\n\n static _verticalLine(style: TableStyleParam = {}): string {\n if (style.verticalLine == undefined) { return };\n let verticalLineCSS = null;\n if (style.verticalLine) {\n verticalLineCSS = `\n td:not(:first-child), th:not(:first-child) {\n border-left: 1px solid;\n }`.trim();\n } else {\n verticalLineCSS = `\n td:not(:first-child), th:not(:first-child) {\n border-left: 0;\n }`.trim();\n }\n return verticalLineCSS;\n }\n}", "const color = {\n blue: \"#3584e4\",\n green: \"#33d17a\",\n yellow: \"#f6d32d\",\n orange: \"#ff7800\",\n red: \"#e01b24\",\n purple: \"#9141ac\",\n violet: \"#9141ac\",\n brown: \"#986a44\",\n light: \"#deddda\",\n dark: \"#3d3846\"\n}\n\nexport { color };", "export function sleepSync(ms: number) {\n const end = new Date().getTime() + ms;\n let time = new Date().getTime();\n while (time < end) {\n time = new Date().getTime();\n }\n return time;\n}\n\nexport function uuid() {\n return sleepSync(1).toString(36);\n}", "export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\n", "/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n\n/**\n * @param {string[]} array\n * @param {RegExp} pattern\n * @return {string[]}\n */\nexport function filter (array, pattern) {\n\treturn array.filter(function (value) { return !match(value, pattern) })\n}\n", "import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {object[]} siblings\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length, siblings) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props)\n}\n\n/**\n * @param {object} root\n */\nexport function lift (root) {\n\twhile (root.root)\n\t\troot = copy(root.root, {children: [root]})\n\n\tappend(root, root.siblings)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n", "import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @param {object[]} siblings\n * @return {object}\n */\nexport function comment (value, root, parent, siblings) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function declaration (value, root, parent, length, siblings) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings)\n}\n", "import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\n\tfor (var i = 0; i < children.length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: if (!strlen(element.value = element.props.join(','))) return ''\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n", "import { compile, serialize, stringify } from 'stylis';\n\nexport function stylis(css: string) {\n return serialize(compile(css), stringify);\n}\n", "import { uuid } from './util.js';\nimport { stylis } from './cssProcessor/stylis.bundle.js';\n\ntype Constructor = new (...args: any[]) => T;\n\nexport function AdapterMixin>(\n Base: TBase\n) {\n return class Adapter extends Base {\n /** CSSStyleSheet() for this component */\n static _cssStyleSheet: CSSStyleSheet;\n\n /** Tag name of this component */\n static _tagName: string | null;\n\n /** Styles which contain only css for this component */\n static _styles: string[] = [];\n\n /** CSS Process middleware, This function will be called\n * before applying CSS to CSSStyleSheet.\n */\n static cssProcess(css: string): string {\n return css;\n }\n\n /**\n * Retreive styles for this component,\n * also prevent inherit values from super class.\n */\n static get styles(): string[] {\n if (this._styles === Object.getPrototypeOf(this).styles) {\n this._styles = [];\n }\n return this._styles;\n }\n\n /** Retreive inherited styles for all super classes. */\n static get allStyles(): string[] {\n let superClass = Object.getPrototypeOf(this);\n const allStyles = [];\n\n while (superClass.styles !== undefined) {\n allStyles.push(...superClass.styles);\n superClass = Object.getPrototypeOf(superClass);\n }\n allStyles.push(...this.styles);\n return allStyles;\n }\n\n /** Set CSS for this component */\n static set css(css: string) {\n this._styles = [css];\n\n if (this.tagName) {\n this.cssStyleSheet.replaceSync(\n this.cssProcess(`${this.tagName} { ${this.allCSS} }`)\n );\n }\n }\n\n /** Get CSS for this component, includes inherited styles */\n static get css(): string {\n return this.styles.join(\"\\n\");\n }\n\n static get allCSS(): string {\n return this.allStyles.join(\"\\n\");\n }\n\n /** Get tagName for this class which will be defined after\n * the class has been registerd with CustomElementsRegistry.\n */\n static get tagName(): string | null {\n if (this._tagName === Object.getPrototypeOf(this).tagName) {\n this._tagName = null;\n }\n return this._tagName;\n }\n\n /** Get CSSStyleSheet() for this component.\n * Create a new one if haven't been created yet.\n */\n static get cssStyleSheet(): CSSStyleSheet {\n const superCSSStyleSheet = Object.getPrototypeOf(this)._cssStyleSheet;\n if (this._cssStyleSheet === superCSSStyleSheet) {\n this._cssStyleSheet = new CSSStyleSheet();\n }\n return this._cssStyleSheet;\n }\n\n /** Add style to this component */\n static addStyle(css: string) {\n this._styles = this._styles.concat(css);\n\n if (this.tagName) {\n const rule = `${this.tagName} { ${css} }`;\n const processedCss = this.cssProcess(rule);\n this.cssStyleSheet.insertRule(\n processedCss,\n this.cssStyleSheet.cssRules.length\n );\n }\n }\n\n /**\n * Define component to element tag and init component style.\n * To extends this function, sub-elements must be defined\n * before call this function as `super.define(tagName);`\n */\n static define(tagName: string): void {\n this._tagName = tagName;\n customElements.define(tagName, this);\n this.initStyle();\n }\n\n /** Init component style */\n static initStyle() {\n this.cssStyleSheet.replaceSync(\n this.cssProcess(`${this.tagName} { ${this.allCSS} }`)\n );\n document.adoptedStyleSheets.push(this.cssStyleSheet);\n }\n /** @deprecated, will be removed */\n static tagStyle(css: string): void {\n console.warn('tagStyle() is deprecated, use addStyle() instead');\n this.addStyle(css);\n }\n\n /** @deprecated, will be removed */\n static classStyle(class_: string, css: string) {\n console.warn('classStyle() is deprecated, use addStyle() instead');\n this.addStyle(`&.${class_} { ${css} }`);\n }\n\n _class!: typeof Adapter; // instance's class for using as shortcut\n\n _cssStyleSheet?: CSSStyleSheet;\n\n // index of this.cssStyleSheet in document.adoptedStyleSheets\n adoptedStyleSheetIndex!: number;\n\n _uuid?: string;\n\n _shadowRoot!: ShadowRoot|null;\n\n /**\n * In constructor, there any some if condition to check\n * if it has been inited or not to prevent recursive call in Mixin\n */\n constructor(...args: any[]) {\n super(...args);\n if (!this._class) { this.initClass() };\n }\n\n /** Dynamically create and return uuid for the element */\n get uuid(): string {\n if (!this._uuid) {\n this._uuid = `${this.tagName}-${uuid()}`;\n }\n return this._uuid;\n }\n\n /**\n * Dynamically create a CSSStyleSheet() and keep track of the adopted\n * stylesheet index for reference.\n */\n get cssStyleSheet() {\n if (this._cssStyleSheet) { return this._cssStyleSheet };\n\n this._cssStyleSheet = new CSSStyleSheet();\n\n /** For normal element, attach this._cssStyleSheet to the document */\n if (!this._shadowRoot) {\n const index = document.adoptedStyleSheets.length;\n this.classList.add(this.uuid);\n document.adoptedStyleSheets[index] = this._cssStyleSheet;\n this.adoptedStyleSheetIndex = index;\n }\n\n return this._cssStyleSheet;\n }\n\n /**\n * Return a selector for the this element as a class chain.\n */\n get objectClassSelector(): string {\n return this.classList.value.replace(/ /g, \".\");\n }\n\n /**\n * Set CSS for this element.\n * It works like `` but with CSS processor.\n */\n set css(css: string) {\n // Init cssStyleSheet if it hasn't been inited yet.\n this.cssStyleSheet;\n\n const processedCss = this._class.cssProcess(\n `${this.tagName}.${this.objectClassSelector} { ${css} }`\n );\n \n this.cssStyleSheet.replaceSync(processedCss);\n }\n\n /** Get CSS for this element */\n get css(): string {\n let css = ``;\n for (const rule of this.cssStyleSheet.cssRules) {\n css += rule.cssText + \"\\n\";\n }\n return css;\n }\n\n initClass() {\n this._class = this.constructor as unknown as typeof Adapter;\n\n /**\n * If class tagName has been defined from somewhere else.\n * Then it shouldn't be initialized again.\n */\n if (this._class.tagName) {\n return;\n }\n this._class._tagName = this.tagName;\n this._class.initStyle();\n }\n\n /** Override super.attachShadow()\n * to add this.cssStyleSheet to shadowRoot\n */\n attachShadow(init: ShadowRootInit): ShadowRoot {\n const shadowRoot = super.attachShadow(init);\n shadowRoot.adoptedStyleSheets = [\n this._class.cssStyleSheet,\n this.cssStyleSheet\n ];\n document.adoptedStyleSheets.splice(this.adoptedStyleSheetIndex, 1);\n this._shadowRoot = shadowRoot;\n return shadowRoot;\n }\n\n /** Add style for this element */\n addStyle(css: string): void {\n // Init cssStyleSheet if it hasn't been inited yet.\n this.cssStyleSheet;\n\n const processedCss = this._class.cssProcess(\n `${this.tagName}.${this.objectClassSelector} { ${css} }`\n );\n\n this.cssStyleSheet.insertRule(\n processedCss,\n this.cssStyleSheet.cssRules.length\n );\n }\n\n /** Remove the element from DOM and remove adoptedStyleSheet */\n delete() {\n if (!this._shadowRoot) {\n document.adoptedStyleSheets.splice(this.adoptedStyleSheetIndex, 1)\n };\n this.remove();\n }\n };\n}\n\nexport class Adapter extends AdapterMixin(HTMLElement) {\n static cssProcess(css: string): string {\n return stylis(css);\n }\n}\n", "import { bgColor, fontFluid } from \"gadjet/src/gadjet\";\nimport { color } from \"./_ux/designToken\";\nimport { stylis } from './adapter';\n\n\nfunction baseStyle(to_base_url: string) {\n const __base_url = new URL(import.meta.url);\n const __fira_sans_url = new URL(`${to_base_url}asset/font/FiraSans-Regular.ttf`, __base_url.href);\n const __fira_code_url = new URL(`${to_base_url}asset/font/FiraCode-Variable.ttf`, __base_url.href);\n\n const style = new CSSStyleSheet();\n document.adoptedStyleSheets.push(style);\n style.replaceSync(stylis(/*css*/`\n @font-face {\n font-family: sans;\n src: url(${__fira_sans_url});\n }\n\n @font-face {\n font-family: monospace;\n src: url(${__fira_code_url});\n }\n\n html {\n line-height: 1.75;\n font-family: sans;\n ${fontFluid({\n fontSizeMin: 16,\n fontSizeMax: 18,\n vwMin: 400,\n vwMax: 1200\n })}\n }\n\n body {\n margin: 0;\n padding: 0;\n padding-bottom: 10rem;\n }\n\n code {\n padding: 0.1rem 0.5rem;\n ${bgColor(color.light)}\n border-radius: 0.25em;\n font-family: monospace;\n font-size: 0.85em;\n }\n\n p, h1, h2, h3, h4, ul, li {\n max-width: 80ch;\n margin: auto;\n }\n\n p ~ ol {\n margin-top: -0.7rem;\n }\n\n p ~ ol ~ p {\n margin-top: -0.7rem;\n }\n\n .width-100 {\n width: 100%;\n }\n\n .text-width {\n width: 100%;\n max-width: 80ch;\n }\n\n .container {\n display: block;\n max-width: 1000px;\n min-width: 300px;\n width: 90%;\n margin: auto;\n\n h1, h2, h3 {\n max-width: 45rem;\n }\n\n & h2 {\n line-height: 2;\n text-align: center;\n margin: auto;\n margin-top: 3rem;\n margin-bottom: 2rem;\n font-size: 1.5rem;\n }\n & h3 {\n text-decoration: underline;\n margin: auto;\n margin-top: 2rem;\n margin-bottom: 1rem;\n font-size: 1.25rem;\n }\n & h4 {\n font-size: 1rem;\n margin-top: 1rem;\n margin-bottom: 0.5rem;\n }\n }\n\n .flex {\n display: flex;\n flex-wrap: wrap;\n }\n `));\n}\n\nexport { baseStyle };", "type Constructor = new (...args: any[]) => T;\n\nclass Icon {\n static url: string;\n\n set name(name: string) {\n this._element.setAttribute('name', name);\n this.render();\n }\n\n get name() {\n return this._element.getAttribute('name');\n }\n\n _element: HTMLElement;\n _class: typeof Icon;\n\n constructor(element: HTMLElement) {\n this._class = this.constructor as typeof Icon;\n this._element = element;\n this.render();\n\n const observer = new MutationObserver((mutationRecords, observer) => {\n this.observerCallback(mutationRecords, observer)\n })\n observer.observe(this._element, {attributes: true});\n }\n\n observerCallback(\n mutationRecords: MutationRecord[],\n observer: MutationObserver) {\n \n for (const mutation of mutationRecords) {\n if (mutation.type === \"attributes\") {\n if (mutation.attributeName === \"name\") {\n this.render();\n }\n }\n }\n }\n\n render() {\n if (!this._class.url) {\n return;\n }\n let svg = document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"svg\");\n let use = document.createElementNS(\n 'http://www.w3.org/2000/svg',\n 'use');\n\n this._element.innerHTML = '';\n svg.style.width = '1em';\n svg.style.height = '1em';\n this._element.appendChild(svg);\n use.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n 'xlink:href',\n `${this._class.url}#${this.name}`);\n svg.appendChild(use);\n }\n}\n\ninterface IconParam {\n url: string;\n deficonField?: any; \n}\n\nfunction DefIconMixin>(\n {url, deficonField='deficon'}: IconParam,\n Base: TBase) {\n\n class _Icon extends Icon {};\n _Icon.url = url;\n\n return class DefIconMixin extends Base {\n [key: string]: any;\n\n constructor(...args: any[]) {\n super(...args);\n this[deficonField] = new _Icon(this);\n };\n }\n}\n\nfunction DefIcon(param: IconParam) {\n return class DefIcon extends DefIconMixin(param, HTMLElement) {};\n}\n\nexport { DefIconMixin, DefIcon };", "import Color from \"color\";\n\nfunction bgColor(color) {\n return /*css*/`\n background-color: ${color};\n color: ${Color(color).isDark() ? 'white' : 'black'};\n `.trim();\n}\n\nfunction lift(level: number, color: string = 'black') {\n return `filter: drop-shadow(0 0 ${level * 2}px ${color});`;\n}\n\nfunction pxToRem(px: any) {\n px = parseFloat(px);\n const rem1 = parseFloat(\n getComputedStyle(document.documentElement).fontSize);\n return `${px / rem1}rem`;\n}\n\nconst aspectRatio = (ratio: string = '1/1'): string => {\n return `\n height: auto;\n aspect-ratio: ${ratio};\n @supports not (aspect-ratio: ${ratio}) {\n &::before {\n float: left;\n padding-top: 100% / ${ratio};\n content: \"\";\n }\n\n &::after {\n display: block;\n content: \"\";\n clear: both;\n }\n }\n `.trim();\n}\n\nexport { bgColor, lift, pxToRem, aspectRatio };", "import { Adapter } from \"../../adapter.js\";\nimport { bgColor } from '../style.js';\nimport { color } from '../designToken'; \n\nclass CodeBlock extends Adapter {\n static css = /*css*/`\n & {\n display: block;\n margin: auto;\n margin-top: 1.5rem;\n max-width: 80ch;\n line-height: 1.5;\n }\n [el=\"bar-top-left\"] {\n display: inline-flex;\n ${bgColor(color.yellow)}\n border-top-left-radius: 0.4em;\n border-top-right-radius: 0.4em;\n line-height: 2;\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n font-size: 0.8rem;\n }\n & pre {\n margin-top: 0;\n font-size: 0.8rem;\n & code {\n all: unset;\n border-bottom-left-radius: 0.4em;\n border-bottom-right-radius: 0.4em;\n border-top-right-radius: 0.4em;\n }\n }\n `;\n};\n\nexport { CodeBlock };", "import { Adapter } from \"../../adapter.js\";\nimport { color } from '../designToken.js';\nimport Color from 'color';\n\nexport class BlockQuote extends Adapter {\n static css = /*css*/`\n & {\n display: flex;\n }\n & blockquote {\n margin: 0;\n padding: 0rem 1rem;\n background-color: ${Color(color.yellow).alpha(0.2)};\n border-left: 0.25em solid ${color.yellow};\n border-bottom-left-radius: 0.5rem;\n }\n `\n}", "import { Adapter } from \"../../adapter.js\";\nimport Color from 'color';\nimport { bgColor, lift } from '../style';\n\nconst buttonStyle = (color) => {\n return /*css*/`\n & {\n display: inline-flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n }\n\n & button {\n display: inline-flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n border: 0;\n border-radius: 0.25rem;\n padding: 0.5rem 0.7rem;\n font-weight: bold;\n line-height: 1;\n cursor: pointer;\n ${lift(0.7, '#555')}\n ${bgColor(color)}\n &:hover {\n background-color: ${Color(color)\n .lighten(0.1)\n .saturate(0.1)};\n ${lift(1.1, '#555')}\n }\n &:active {\n background-color: ${Color(color)\n .darken(0.1)\n .saturate(-0.1)};\n ${lift(0.5, '#555')}\n }\n }\n `\n}\n\nclass Button extends Adapter {\n initialHTML = this.innerHTML;\n\n constructor() {\n super();\n this.render();\n }\n\n render() {\n this.innerHTML = ``;\n }\n};\n\nexport { buttonStyle, Button };", "import { DefIcon } from '@devcapsule/deficon';\nimport { AdapterMixin } from './adapter';\n\nimport { CodeBlock } from './_ux/ui/code-block';\nimport { BlockQuote } from './_ux/ui/blockquote';\nimport { Button, buttonStyle } from './_ux/ui/button';\nimport { color } from './_ux/designToken';\n\nfunction baseComponents(to_base_url: string) {\n const __base_url = new URL(import.meta.url);\n\n const icomoon_url = new URL(\n 'asset/icon/icomoon/symbol-defs.svg', __base_url\n ).toString();\n\n class Icon extends AdapterMixin(DefIcon({url: icomoon_url})) {\n static css = /*css*/`\n & {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n }\n `\n };\n Icon.define('el-icon');\n\n CodeBlock.define('el-code-block');\n Button.define('el-button');\n Button.css = /*css*/`\n & {\n ${buttonStyle(color.blue)}\n }\n button {\n min-height: 2em;\n }\n el-icon {\n margin-top: -0.17rem;\n }\n `;\n BlockQuote.define('el-blockquote');\n};\n\nexport { baseComponents };", "function pageReload(to_base_url: string) {\n const __file_url = new URL(import.meta.url);\n const __event_source = new URL(`${to_base_url}esbuild`, __file_url.href)\n\n if (['0.0.0.0', '127.0.0.1', 'localhost'].includes(__file_url.hostname)) {\n new EventSource(__event_source).addEventListener(\n 'change',\n () => location.reload());\n };\n};\n\nexport { pageReload };", "import { aspectRatio } from './_ux/style';\n\nconst cssStyleSheet = new CSSStyleSheet();\n\ncssStyleSheet.replaceSync(/*css*/`\n.aspect-ratio-21-9 {\n display: flex;\n ${aspectRatio('21/9')}\n img {\n width: 100%;\n object-fit: cover;\n }\n}\n`);\n\ndocument.adoptedStyleSheets.push(cssStyleSheet);\n", "import 'highlight.js/styles/monokai.css';\n\nimport { baseLib } from './_base.lib';\nbaseLib();\n\nimport { baseStyle } from './_base.style';\nbaseStyle('./');\n\nimport { baseComponents } from './_base.comp';\nbaseComponents('./');\n\nimport { pageReload } from './_base.esbuild';\npageReload('./');\n\nimport './styleClass';\n\nwindow.addEventListener('load', () => {\n document.body.style.visibility = 'visible';\n});"], + "mappings": ";;;;;;6BAAA;AAEA,SAAS,WAAW,IAAK,CACvB,OAAI,eAAe,IACjB,IAAI,MACF,IAAI,OACJ,IAAI;AACF,UAAY,CACV,MAAM,IAAI,MAAM,kBAAkB,CACpC,EACK,eAAe,MACxB,IAAI,IACF;AAAI,MACJ,IAAI,OACF,UAAY,CACV,MAAM,IAAI,MAAM,kBAA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AAI,MACjB,SAGR,OAAS,KAAK,KAAK,EAAE;AAAE,MAAM,OAAO,EAChC,WACH,OAAS,SAAS,MAAM,GAGlB,OACR,CACD,CA7BS;AAAA,IA+BT,SAAS,MAAM,IAAK,CACnB,OAAO,SAAU,EAAG,CACnB,OAAO,KAAK,IAAI,EAAG,KAAK,IAAI,IAAK,CAAC,CAAC,CACpC,CACD,CAJS;AAAA,eAMT,SAAS,YAAY,MAAO,CAC3B,OAAO,MAAM,QAAQ,KAAK,EAAI,MAAQ,CAAC,KAAK,CAC7C;AAFS,kCAIT,SAAS,UAAU,MAAOC,QAAQ,CACjC,QAAS,EAAI,EAAG;AAAIA,QAAQ,IACvB,OAAO,MAAM,CAAC,GAAM,WACvB,MAAM,CAAC,EAAI,GAIb,OAAO,KACR,CARS;AAAA,aAUT,OAAO,QAAUF,WC9ejB,gBAAwB,0BAExB,IAAO,aAAQ,YAAAG,QCHf,IAAM,SAAW,2BACX,SAAW,CACf,KACA,KACA,KACA,KACA,MACA;AAAA,IACA,UACA,MACA,MACA,WACA,KACA,SACA,OACA,OACA,QACA;AACA,aACA,OACA,QACA,OACA,UACA,MACA,SACA,WACA;AACA,SACA,MACA,QACA,QACA,QAIA,WACA,QACA,QACA,SACA;AAAA,IACA,OACA,SACA,SACF,EACM,SAAW,CACf,OACA,QACA,OACA,YACA;AACA,UACF,EAGM,MAAQ,CAEZ,SACA,WACA,UACA,SAEA,OACA,OACA;AACA,SAEA,SACA,SAEA,QACA,eACA,eACA,YACA;AAAA,UACA,oBACA,aACA,aACA,cACA;AAAA,IACA,gBACA,iBAEA,MACA,MACA,UACA,UAEA;AAAA,GACA,oBACA,UACA,WACA,OAEA,UACA,YACA;AAAA,aACA,gBAEA,UACA,QAEA,OAEA,aACF,EAEM,YAAc;AAClB,QACA,YACA,gBACA,aACA,iBACA;AACA,YACA,UACF,EAEM,iBAAmB,CACvB,cACA,aACA;AAAA,KACA,eAEA,UACA,UAEA,OACA,WACA,QACA,aACA;AAAA,UAC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AAK,SACL,SAAU,CACR,CACE,UAAW;AAAA,IACX,SAAU,CACR,CACE,MAAO,KAAK,oBACZ,UAAW,CACb,EACA,CACE,UAAW,KACX,MAAO;AACP,KAAM,EACR,EACA,CACE,MAAO,KACP,IAAK,KACL,aAAc,GACd,WAAY,GACZ,SAAU;AACV,SAAU,eACZ,CACF,CACF,CACF,CACF,EACA,CACE,MAAO,IACP,UAAW,CACb,EACA,CACE,MAAO,MACP,UAAW,CACb;AACA,CACE,SAAU,CACR,CAAE,MAAO,SAAS,MAAO,IAAK,SAAS,GAAI,EAC3C,CAAE,MAAO,gBAAiB,EAC1B,CACE,MAAO;AAAQ,MAGf,WAAY,QAAQ,kBACpB,IAAK,QAAQ,GACf,CACF,EACA,YAAa,MACb,SAAU;AACR,CACE,MAAO,QAAQ,MACf,IAAK,QAAQ,IACb,KAAM,GACN,SAAU,CAAC,MAAM,CACnB,CACF,CACF,CACF,CACF,EACA;AACA,CAGE,cAAe,2BACjB,EACA,CAIE,MAAO,kBAAoB,KAAK;AAC9B,gEAOF,YAAY,GACZ,MAAO;AAAA,UACP,SAAU,CACR,OACA,KAAK,QAAQ,KAAK,WAAY,CAAE,MAAO,WAAY,UAAW;AAAA,eAAiB,CAAC,CAClF,CACF,EAEA,CACE,MAAO,SACP,UAAW,CACb,EACA,gBAIA,CACE,MAAO,MAAQ;AACf,UAAW,CACb,EACA,CACE,MAAO,CAAE,wBAAyB,EAClC,UAAW,CAAE,EAAG,gBAAiB,EACjC,SAAU;AAAE,MAAO,CACrB,EACA,cACA,oBACA,iBACA,iBACA,CACE,MAAO,QACT,CACF,CACF,CACF;AAplBS,gCCvKT,IAAMC,UAAW,2BACXC,UAAW,CACf,KACA,KACA,KACA,KACA,MACA;AAAA,MACA,UACA,MACA,MACA,WACA,KACA,SACA,OACA,OACA,QACA;AAAA,GACA,aACA,OACA,QACA,OACA,UACA,MACA,SACA,WACA;AAAA,GACA,SACA,MACA,QACA,QACA,QAIA,WACA,QACA,QACA,SACA;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aAAc;AACd,SAAU,CACR,CACE,UAAW,OACX,MAAO,UACP,IAAK,IACL,UAAW,GACX,SAAU,CACR;AACA,uBACA,sBACA,sBACA,CACE,MAAO,KACP,IAAK;AACL,SAAU,CACR,CACE,UAAW,OACX,MAAO,UACP,IAAK,IACL,SAAU,CACR;AACA,sBACA,uBACA,qBACF,CACF,CACF,CACF,CACF,CACF,EACA,KAAK;AACH,OACA,MACA,CAAE,UAAW,EAAG,CAClB,EACA,CACE,MAAO,cACP,IAAK,QACL,UAAW,EACb,EACA;AAEA,CACE,UAAW,OACX,IAAK,MACL,SAAU,CACR,CACE,MAAO,SACP,UAAW,GACX,SAAU,CACR,sBACF,CACF;AACA,CACE,MAAO,mBACT,CACF,CAEF,EACA,CACE,UAAW,MAMX,MAAO,iBACP,IAAK,IACL,SAAU;AAAE,KAAM,OAAQ,EAC1B,SAAU,CAAE,aAAc,EAC1B,OAAQ,CACN,IAAK,YACL,UAAW,GACX,YAAa;AACX,MACA,KACF,CACF,CACF,EACA,CACE,UAAW,MAEX,MAAO,kBACP,IAAK,IACL,SAAU,CAAE,KAAM;AAAA,OAAS,EAC3B,SAAU,CAAE,aAAc,EAC1B,OAAQ,CACN,IAAK,aACL,UAAW,GACX,YAAa;AACX,aACA,aACA,KACF,CACF,CACF,EAEA,CACE,UAAW,MACX,MAAO,SACT,EAEA,CACE,UAAW;AAAA,KACX,MAAO,MAAM,OACX,IACA,MAAM,UAAU,MAAM,OACpB,YAIA,MAAM;AAAO,MAAO,IAAK,IAAI,CAC/B,CAAC,CACH,EACA,IAAK,OACL,SAAU,CACR,CACE,UAAW,OACX,MAAO,YACP,UAAW;AACX,OAAQ,aACV,CACF,CACF,EAEA,CACE,UAAW,MACX,MAAO,MAAM,OACX,MACA,MAAM;AAAU,MAAM,OACpB,YAAa,GACf,CAAC,CACH,EACA,SAAU,CACR,CACE,UAAW,OACX,MAAO,YACP,UAAW,CACb;AACA,CACE,MAAO,IACP,UAAW,EACX,WAAY,EACd,CACF,CACF,CACF,CACF,CACF,CAtOS,kBCCT,SAAS,MAAM,KAAM,CACnB,MAAO,CACL,KAAM,gBACN,QAAS,CACP,UACA;AAAA,EACF,EACA,SAAU,CACR,CACE,UAAW,cAIX,MAAO;AACP,OAAQ,CACN,IAAK,gBACL,YAAa,MACf,CACF,CACF,CACF,CACF,CArBS,sBCTT,IAAM,MAAQ,OAAC,OACN,CACL,UAAW,CACT,MAAO,OACP,MAAO,YACT,EACA,cAAe;AAAK,qBACpB,SAAU,CACR,MAAO,SACP,MAAO,iDACT;AACA,kBAAmB,CACjB,UAAW,WACX,MAAO,cACT,EACA,wBAAyB;AACvB,MAAO,gBACP,MAAO,KACP,IAAK,KACL,QAAS,IACT,SAAU,CACR,KAAK;AACL,KAAK,iBACP,CACF,EACA,gBAAiB,CACf,MAAO,SACP,MAAO,KAAK,UAAY;AAAA;AAAA,gBASxB,UAAW,CACb,EACA,aAAc,CACZ,UAAW,OACX,MAAO,2BACT,CACF;AA1CY,SA6CR,KAAO,CACX,IACA,OACA,UACA,UACA,QACA,QACA,IACA,aACA;AAAA,MACA,SACA,SACA,UACA,OACA,OACA,KACA,MACA,UACA,MACA;AACA,KACA,KACA,KACA,WACA,aACA,SACA,SACA,OACA,KACA,KACA,KACA;AAAA,IACA,KACA,KACA,SACA,SACA,OACA,IACA,SACA,MACA,QACA,MACA,MACA;AAAA,MACA,SACA,KACA,OACA,OACA,OACA,MACA,SACA,KACA,IACA,IACA,QACA;AAAA,IACA,UACA,OACA,SACA,UACA,MACA,QACA,QACA,KACA,WACA;AAAA,MACA,KACA,QACA,OACA,KACA,KACA,MACA,OACF,EAEM,eAAiB,CACrB,YACA;AAAA,aACA,eACA,QACA,cACA,cACA;AAAA,MACA,gBACA,eACA,eACA,gBACA,OACA;AAAA,IACA,QACA,kBACA,aACA,cACA,iBACA;AAAA,YACA,UACA,uBACA,mBACA;AAAA,SACA,+BACA,aACA,OACA,YACA;AACA,QAEA,YACA,YACA,aACA,YACF,EAGM,eAAiB,CACrB;AAAA,IACA,WACA,QACA,UACA,UACA,UACA,UACA,MACA;AACA,OACA,QACA,UACA,QACA,cACA,gBACA,aACA;AAAA,KACA,QACA,gBACA,eACA,MACA,OACA,eACA;AACA,gBACA,WACA,UACA,KACA,OACA,aACA,eACA;AAAA,IACA,OACA,aACA,MACA,YACA,UACA,iBACA;AAAA,IACA,mBACA,cACA,aACA,eACA,WACA;AAAA,WACA,OACA,oBACA,YACA,aACA,WACA;AACA,OACA,QACA,SACA,gBACA,eACA,QACA,UACA,OACF;AAGM,gBAAkB,CACtB,QACA,WACA,SACA,MACA,aACA,eACA;AAAA,YACA,gBACA,SACA,OACA,cACA,YACA;AACA,gBACF,EAEM,WAAa,CACjB,gBACA,cACA,aACA,MACA;AAAA,WACA,kBACA,sBACA,qBACA;AAAA,cACA,4BACA,iBACA;AACA,4BACA,sBACA,aACA;AAAA,OACA,wBACA,kBACA,mBACA;AAAA,OACA,oBACA,sBACA,oBACA;AAAA,OACA,aACA,SACA,eACA,qBACA;AAAA,IACA,yBACA,yBACA,yBACA;AAAA,oBACA,2BACA,2BACA;AAAA,qBACA,qBACA,qBACA,gBACA;AAAA,qBACA,4BACA,6BACA;AAAA,oBACA,sBACA,kBACA,eACA;AAAA,UACA,sBACA,sBACA,qBACA;AAAA,iBACA,qBACA,gBACA,sBACA;AAAA,gBACA,0BACA,0BACA;AAAA,cACA,sBACA,4BACA;AAAA,YACA,4BACA,sBACA;AAAA,IACA,cACA,oBACA,oBACA,oBACA;AAAA,cACA,eACA,qBACA,qBACA;AAAA,YACA,iBACA,eACA,aACA,mBACA;AAAA,qBACA,0BACA,mBACA;AAAA,KACA,eACA,SACA,uBACA,aACA,aACA;AAAA,YACA,eACA,eACA,eACA,cACA,QACA;AAAA,MACA,YACA,YACA,QACA,eACA,cACA;AACA,cACA,oBACA,oBACA,oBACA;AAAA,QACA,eACA,UACA,UACA,UACA,qBACA;AAAA,cACA,gBACA,MACA,YACA,aACA,SACA;AACA,UACA,cACA,SACA,OACA,aACA,iBACA;AACA,YACA,cACA,YACA,QACA,OACA,OACA,eACA;AAAA,SACA,wBACA,eACA,yBACA;AAAA,KACA,mBACA,iBACA,eACA,aACA;AAAA,MACA,eACA,oBACA,0BACA;AAAA,YACA,uBACA,wBACA;AAAA,KACA,cACA,MACA,6BACA,OACA,YACA;AAAA,aACA,iBACA,iBACA,cACA,kBACA;AAAA,mBACA,WACA,WACA,eACA,iBACA;AAAA,SACA,sBACA,wBACA,qBACA;AAAA,kBACA,SACA,UACA,OACA,oBACA;AACA,mBACA,WACA,cACA,YACA,kBACA;AACA,iBACA,aACA,cACA,aACA,mBACA;AAAA,kBACA,kBACA,SACA,eACA,mBACA;AAAA,oBACA,gBACA,gBACA,oBACA;AAAA,cACA,cACA,eACA,aACA,QACA,OACA;AAAA,KACA,mBACA,qBACA,qBACA;AAAA,MACA,qBACA,oBACA,YACA,iBACA;AAAA,SACA,YACA,cACA,gBACA,cACA,YACA;AAAA,SACA,iBACA,aACA,kBACA,YACA;AAAA,MACA,aACA,kBACA,YACA,iBACA,WACA;AAAA,SACA,WACA,YACA,SACA,OACA,SACA,aACA;AAAA,QACA,UACA,QACA,UACA,UACA,gBACA,iBACA;AAAA,eACA,gBACA,WACA,gBACA,aACA;AAAA,IACA,UACA,gBACA,oBACA,sBACA;AAAA,SACA,iBACA,qBACA,uBACA;AAAA,KACA,gBACA,cACA,mBACA,oBACA;AAAA,cACA,QACA,cACA,eACA,cACA;AAAA,MACA,iBACA,WACA,SACA,SACA,OACA,aACA;AAAA,MACA,QACA,UACA,gBACA,sBACA;AAAA,QACA,4BACA,uBACA;AACA,2BACA,6BACA,qBACA;AAAA,mBACA,oBACA,iBACA,uBACA;AAAA,0BACA,6BACA,wBACA;AAAA,uBACA,4BACA;AACA,sBACA,uBACA,qBACA;AAAA,MACA,mBACA,mBACA,kBACA;AACA,kBACA,wBACA,eACA,gBACA;AACA,WACA,MACA,WACA,eACA,aACA,iBACA;AAAA,WACA,uBACA,kBACA,w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a,SACrC,CAAC", "names": ["node", "prefix", "text", "match", "IDENT_RE", "COMMENT", "MODES", "scopeName", "version", "i", "html", "highlight", "data", "result", "event", "slice", "prefix", "match", "diff", "color", "match", "char", "node", "from", "Color", "color", "length", "HighlightJS", "match", "tag", "COMMENT", "IDENT_RE", "KEYWORDS", "LITERALS", "TYPES", "ERROR_TYPES", "BUILT_IN_GLOBALS", "BUILT_IN_VARIABLES", "BUILT_INS", "javascript", "match", "tag", "COMMENT", "IDENT_RE", "tag", "StyleSheet", "isImportRule", "sheet", "length", "length", "length", "character", "characters", "length", "length", "cache", "character", "cache", "node", "length", "stylis", "sheet", "match", "next", "cache", "cache", "css", "keyframes", "injectGlobal", "cx", "classnames", "merge", "getRegisteredStyles", "css", "event", "color", "node", "esm_default", "prefix", "svg", "text", "length", "slice", "node", "length", "slice", "esm_default", "node", "node", "comment", "esm_default", "text", "slice", "node", "document", "create", "html", "append", "length", "svg", "esm_default", "text", "esm_default", "node", "prefix", "cache", "createCache", "text", "esm_default", "length", "cache", "ref", "createCache", "Color", "Color", "Color", "Color", "Color", "Color", "COMMENT", "RULESET", "DECLARATION", "IMPORT", "KEYFRAMES", "LAYER", "abs", "from", "trim", "replace", "indexof", "charat", "substr", "strlen", "sizeof", "append", "line", "column", "length", "position", "character", "characters", "node", "char", "character", "prev", "position", "charat", "characters", "column", "line", "next", "length", "peek", "caret", "slice", "substr", "token", "alloc", "strlen", "dealloc", "delimit", "trim", "delimiter", "whitespace", "character", "peek", "next", "token", "escaping", "next", "character", "slice", "caret", "peek", "delimiter", "position", "commenter", "from", "identifier", "token", "compile", "dealloc", "parse", "alloc", "length", "character", "characters", "next", "charat", "indexof", "replace", "delimit", "whitespace", "escaping", "caret", "peek", "append", "comment", "commenter", "strlen", "declaration", "ruleset", "prev", "from", "identifier", "sizeof", "substr", "abs", "trim", "node", "RULESET", "COMMENT", "char", "DECLARATION", "serialize", "stringify", "LAYER", "IMPORT", "DECLARATION", "COMMENT", "KEYFRAMES", "RULESET", "strlen", "css", "serialize", "compile", "stringify", "css", "Adapter", "observer", "svg", "bgColor", "color", "Color", "lift", "aspectRatio", "Adapter", "bgColor", "import_color", "Adapter", "Color", "import_color", "color", "lift", "bgColor", "Color", "Button", "Adapter", "Button", "aspectRatio"] } diff --git a/docs/guide/base.js b/docs/guide/base.js index 44fa1e9..680990e 100644 --- a/docs/guide/base.js +++ b/docs/guide/base.js @@ -350,10 +350,7 @@ t");function maxfn(max){return function(v){return Math.max(0,Math.min(max,v))}}_ maxfn,"maxfn");function assertArray(value){return Array.isArray(value)?value:[value]} __name(assertArray,"assertArray");function zeroArray(array,length2){for(let i=0;i< length2;i++)typeof array[i]!="number"&&(array[i]=0);return array}__name(zeroArray, -"zeroArray");module.exports=Color4}});function pageReload(to_base_url){let __file_url=new URL(import.meta.url),__event_source=new URL( -`${to_base_url}esbuild`,__file_url.href);["0.0.0.0","127.0.0.1","localhost"].includes( -__file_url.hostname)&&new EventSource(__event_source).addEventListener("change", -()=>location.reload())}__name(pageReload,"pageReload");function sleepSync(ms){let end=new Date().getTime()+ms,time=new Date().getTime(); +"zeroArray");module.exports=Color4}});function sleepSync(ms){let end=new Date().getTime()+ms,time=new Date().getTime(); for(;time= 0 && (obj.splice instanceof Function ||\n\t\t\t(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));\n};\n", "'use strict';\n\nvar isArrayish = require('is-arrayish');\n\nvar concat = Array.prototype.concat;\nvar slice = Array.prototype.slice;\n\nvar swizzle = module.exports = function swizzle(args) {\n\tvar results = [];\n\n\tfor (var i = 0, len = args.length; i < len; i++) {\n\t\tvar arg = args[i];\n\n\t\tif (isArrayish(arg)) {\n\t\t\t// http://jsperf.com/javascript-array-concat-vs-push/98\n\t\t\tresults = concat.call(results, slice.call(arg));\n\t\t} else {\n\t\t\tresults.push(arg);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nswizzle.wrap = function (fn) {\n\treturn function () {\n\t\treturn fn(swizzle(arguments));\n\t};\n};\n", "/* MIT license */\nvar colorNames = require('color-name');\nvar swizzle = require('simple-swizzle');\nvar hasOwnProperty = Object.hasOwnProperty;\n\nvar reverseNames = Object.create(null);\n\n// create a list of reverse color names\nfor (var name in colorNames) {\n\tif (hasOwnProperty.call(colorNames, name)) {\n\t\treverseNames[colorNames[name]] = name;\n\t}\n}\n\nvar cs = module.exports = {\n\tto: {},\n\tget: {}\n};\n\ncs.get = function (string) {\n\tvar prefix = string.substring(0, 3).toLowerCase();\n\tvar val;\n\tvar model;\n\tswitch (prefix) {\n\t\tcase 'hsl':\n\t\t\tval = cs.get.hsl(string);\n\t\t\tmodel = 'hsl';\n\t\t\tbreak;\n\t\tcase 'hwb':\n\t\t\tval = cs.get.hwb(string);\n\t\t\tmodel = 'hwb';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tval = cs.get.rgb(string);\n\t\t\tmodel = 'rgb';\n\t\t\tbreak;\n\t}\n\n\tif (!val) {\n\t\treturn null;\n\t}\n\n\treturn {model: model, value: val};\n};\n\ncs.get.rgb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar abbr = /^#([a-f0-9]{3,4})$/i;\n\tvar hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;\n\tvar rgba = /^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar per = /^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar keyword = /^(\\w+)$/;\n\n\tvar rgb = [0, 0, 0, 1];\n\tvar match;\n\tvar i;\n\tvar hexAlpha;\n\n\tif (match = string.match(hex)) {\n\t\thexAlpha = match[2];\n\t\tmatch = match[1];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\t// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19\n\t\t\tvar i2 = i * 2;\n\t\t\trgb[i] = parseInt(match.slice(i2, i2 + 2), 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(abbr)) {\n\t\tmatch = match[1];\n\t\thexAlpha = match[3];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i] + match[i], 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(rgba)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i + 1], 0);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(per)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(keyword)) {\n\t\tif (match[1] === 'transparent') {\n\t\t\treturn [0, 0, 0, 0];\n\t\t}\n\n\t\tif (!hasOwnProperty.call(colorNames, match[1])) {\n\t\t\treturn null;\n\t\t}\n\n\t\trgb = colorNames[match[1]];\n\t\trgb[3] = 1;\n\n\t\treturn rgb;\n\t} else {\n\t\treturn null;\n\t}\n\n\tfor (i = 0; i < 3; i++) {\n\t\trgb[i] = clamp(rgb[i], 0, 255);\n\t}\n\trgb[3] = clamp(rgb[3], 0, 1);\n\n\treturn rgb;\n};\n\ncs.get.hsl = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hsl = /^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hsl);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar s = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar l = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\n\t\treturn [h, s, l, a];\n\t}\n\n\treturn null;\n};\n\ncs.get.hwb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hwb = /^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hwb);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar w = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar b = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\t\treturn [h, w, b, a];\n\t}\n\n\treturn null;\n};\n\ncs.to.hex = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn (\n\t\t'#' +\n\t\thexDouble(rgba[0]) +\n\t\thexDouble(rgba[1]) +\n\t\thexDouble(rgba[2]) +\n\t\t(rgba[3] < 1\n\t\t\t? (hexDouble(Math.round(rgba[3] * 255)))\n\t\t\t: '')\n\t);\n};\n\ncs.to.rgb = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'\n\t\t: 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';\n};\n\ncs.to.rgb.percent = function () {\n\tvar rgba = swizzle(arguments);\n\n\tvar r = Math.round(rgba[0] / 255 * 100);\n\tvar g = Math.round(rgba[1] / 255 * 100);\n\tvar b = Math.round(rgba[2] / 255 * 100);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'\n\t\t: 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';\n};\n\ncs.to.hsl = function () {\n\tvar hsla = swizzle(arguments);\n\treturn hsla.length < 4 || hsla[3] === 1\n\t\t? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'\n\t\t: 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';\n};\n\n// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax\n// (hwb have alpha optional & 1 is default value)\ncs.to.hwb = function () {\n\tvar hwba = swizzle(arguments);\n\n\tvar a = '';\n\tif (hwba.length >= 4 && hwba[3] !== 1) {\n\t\ta = ', ' + hwba[3];\n\t}\n\n\treturn 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';\n};\n\ncs.to.keyword = function (rgb) {\n\treturn reverseNames[rgb.slice(0, 3)];\n};\n\n// helpers\nfunction clamp(num, min, max) {\n\treturn Math.min(Math.max(min, num), max);\n}\n\nfunction hexDouble(num) {\n\tvar str = Math.round(num).toString(16).toUpperCase();\n\treturn (str.length < 2) ? '0' + str : str;\n}\n", "/* MIT license */\n/* eslint-disable no-mixed-operators */\nconst cssKeywords = require('color-name');\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n// values that give correct `typeof` results).\n// do not use box values types (i.e. Number(), String(), etc.)\n\nconst reverseKeywords = {};\nfor (const key of Object.keys(cssKeywords)) {\n\treverseKeywords[cssKeywords[key]] = key;\n}\n\nconst convert = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\nmodule.exports = convert;\n\n// Hide .channels and .labels properties\nfor (const model of Object.keys(convert)) {\n\tif (!('channels' in convert[model])) {\n\t\tthrow new Error('missing channels property: ' + model);\n\t}\n\n\tif (!('labels' in convert[model])) {\n\t\tthrow new Error('missing channel labels property: ' + model);\n\t}\n\n\tif (convert[model].labels.length !== convert[model].channels) {\n\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t}\n\n\tconst {channels, labels} = convert[model];\n\tdelete convert[model].channels;\n\tdelete convert[model].labels;\n\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\tObject.defineProperty(convert[model], 'labels', {value: labels});\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst min = Math.min(r, g, b);\n\tconst max = Math.max(r, g, b);\n\tconst delta = max - min;\n\tlet h;\n\tlet s;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst l = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tlet rdif;\n\tlet gdif;\n\tlet bdif;\n\tlet h;\n\tlet s;\n\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst v = Math.max(r, g, b);\n\tconst diff = v - Math.min(r, g, b);\n\tconst diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = 0;\n\t\ts = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tconst r = rgb[0];\n\tconst g = rgb[1];\n\tlet b = rgb[2];\n\tconst h = convert.rgb.hsl(rgb)[0];\n\tconst w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\n\tconst k = Math.min(1 - r, 1 - g, 1 - b);\n\tconst c = (1 - r - k) / (1 - k) || 0;\n\tconst m = (1 - g - k) / (1 - k) || 0;\n\tconst y = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\nfunction comparativeDistance(x, y) {\n\t/*\n\t\tSee https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n\t*/\n\treturn (\n\t\t((x[0] - y[0]) ** 2) +\n\t\t((x[1] - y[1]) ** 2) +\n\t\t((x[2] - y[2]) ** 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tconst reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tlet currentClosestDistance = Infinity;\n\tlet currentClosestKeyword;\n\n\tfor (const keyword of Object.keys(cssKeywords)) {\n\t\tconst value = cssKeywords[keyword];\n\n\t\t// Compute comparative distance\n\t\tconst distance = comparativeDistance(rgb, value);\n\n\t\t// Check if its less, if so set as closest\n\t\tif (distance < currentClosestDistance) {\n\t\t\tcurrentClosestDistance = distance;\n\t\t\tcurrentClosestKeyword = keyword;\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tlet r = rgb[0] / 255;\n\tlet g = rgb[1] / 255;\n\tlet b = rgb[2] / 255;\n\n\t// Assume sRGB\n\tr = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);\n\n\tconst x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tconst y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tconst z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tconst xyz = convert.rgb.xyz(rgb);\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tconst h = hsl[0] / 360;\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\tlet t2;\n\tlet t3;\n\tlet val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tconst t1 = 2 * l - t2;\n\n\tconst rgb = [0, 0, 0];\n\tfor (let i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tconst h = hsl[0];\n\tlet s = hsl[1] / 100;\n\tlet l = hsl[2] / 100;\n\tlet smin = s;\n\tconst lmin = Math.max(l, 0.01);\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tconst v = (l + s) / 2;\n\tconst sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tconst h = hsv[0] / 60;\n\tconst s = hsv[1] / 100;\n\tlet v = hsv[2] / 100;\n\tconst hi = Math.floor(h) % 6;\n\n\tconst f = h - Math.floor(h);\n\tconst p = 255 * v * (1 - s);\n\tconst q = 255 * v * (1 - (s * f));\n\tconst t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tconst h = hsv[0];\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\tconst vmin = Math.max(v, 0.01);\n\tlet sl;\n\tlet l;\n\n\tl = (2 - s) * v;\n\tconst lmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tconst h = hwb[0] / 360;\n\tlet wh = hwb[1] / 100;\n\tlet bl = hwb[2] / 100;\n\tconst ratio = wh + bl;\n\tlet f;\n\n\t// Wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\tconst i = Math.floor(6 * h);\n\tconst v = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tconst n = wh + f * (v - wh); // Linear interpolation\n\n\tlet r;\n\tlet g;\n\tlet b;\n\t/* eslint-disable max-statements-per-line,no-multi-spaces */\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v; g = n; b = wh; break;\n\t\tcase 1: r = n; g = v; b = wh; break;\n\t\tcase 2: r = wh; g = v; b = n; break;\n\t\tcase 3: r = wh; g = n; b = v; break;\n\t\tcase 4: r = n; g = wh; b = v; break;\n\t\tcase 5: r = v; g = wh; b = n; break;\n\t}\n\t/* eslint-enable max-statements-per-line,no-multi-spaces */\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tconst c = cmyk[0] / 100;\n\tconst m = cmyk[1] / 100;\n\tconst y = cmyk[2] / 100;\n\tconst k = cmyk[3] / 100;\n\n\tconst r = 1 - Math.min(1, c * (1 - k) + k);\n\tconst g = 1 - Math.min(1, m * (1 - k) + k);\n\tconst b = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\tlet r;\n\tlet g;\n\tlet b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// Assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet x;\n\tlet y;\n\tlet z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tconst y2 = y ** 3;\n\tconst x2 = x ** 3;\n\tconst z2 = z ** 3;\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet h;\n\n\tconst hr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst c = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tconst l = lch[0];\n\tconst c = lch[1];\n\tconst h = lch[2];\n\n\tconst hr = h / 360 * 2 * Math.PI;\n\tconst a = c * Math.cos(hr);\n\tconst b = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args, saturation = null) {\n\tconst [r, g, b] = args;\n\tlet value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tlet ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// Optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tconst r = args[0];\n\tconst g = args[1];\n\tconst b = args[2];\n\n\t// We use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tconst ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tlet color = args % 10;\n\n\t// Handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tconst mult = (~~(args > 50) + 1) * 0.5;\n\tconst r = ((color & 1) * mult) * 255;\n\tconst g = (((color >> 1) & 1) * mult) * 255;\n\tconst b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// Handle greyscale\n\tif (args >= 232) {\n\t\tconst c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tlet rem;\n\tconst r = Math.floor(args / 36) / 5 * 255;\n\tconst g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tconst b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tconst integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tconst match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tlet colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(char => {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tconst integer = parseInt(colorString, 16);\n\tconst r = (integer >> 16) & 0xFF;\n\tconst g = (integer >> 8) & 0xFF;\n\tconst b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst max = Math.max(Math.max(r, g), b);\n\tconst min = Math.min(Math.min(r, g), b);\n\tconst chroma = (max - min);\n\tlet grayscale;\n\tlet hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\n\tconst c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));\n\n\tlet f = 0;\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\n\tconst c = s * v;\n\tlet f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tconst h = hcg[0] / 360;\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tconst pure = [0, 0, 0];\n\tconst hi = (h % 1) * 6;\n\tconst v = hi % 1;\n\tconst w = 1 - v;\n\tlet mg = 0;\n\n\t/* eslint-disable max-statements-per-line */\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\t/* eslint-enable max-statements-per-line */\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst v = c + g * (1.0 - c);\n\tlet f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst l = g * (1.0 - c) + 0.5 * c;\n\tlet s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\tconst v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tconst w = hwb[1] / 100;\n\tconst b = hwb[2] / 100;\n\tconst v = 1 - b;\n\tconst c = v - w;\n\tlet g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hsv = convert.gray.hsl;\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tconst val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tconst integer = (val << 16) + (val << 8) + val;\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tconst val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n", "const conversions = require('./conversions');\n\n/*\n\tThis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tconst graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tconst models = Object.keys(conversions);\n\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tconst graph = buildGraph();\n\tconst queue = [fromModel]; // Unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length) {\n\t\tconst current = queue.pop();\n\t\tconst adjacents = Object.keys(conversions[current]);\n\n\t\tfor (let len = adjacents.length, i = 0; i < len; i++) {\n\t\t\tconst adjacent = adjacents[i];\n\t\t\tconst node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tconst path = [graph[toModel].parent, toModel];\n\tlet fn = conversions[graph[toModel].parent][toModel];\n\n\tlet cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nmodule.exports = function (fromModel) {\n\tconst graph = deriveBFS(fromModel);\n\tconst conversion = {};\n\n\tconst models = Object.keys(graph);\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tconst toModel = models[i];\n\t\tconst node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// No possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n};\n\n", "const conversions = require('./conversions');\nconst route = require('./route');\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\trouteModels.forEach(toModel => {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nmodule.exports = convert;\n", "const colorString = require('color-string');\nconst convert = require('color-convert');\n\nconst skippedModels = [\n\t// To be honest, I don't really feel like keyword belongs in color convert, but eh.\n\t'keyword',\n\n\t// Gray conflicts with some method names, and has its own method defined.\n\t'gray',\n\n\t// Shouldn't really be in color-convert either...\n\t'hex',\n];\n\nconst hashedModelKeys = {};\nfor (const model of Object.keys(convert)) {\n\thashedModelKeys[[...convert[model].labels].sort().join('')] = model;\n}\n\nconst limiters = {};\n\nfunction Color(object, model) {\n\tif (!(this instanceof Color)) {\n\t\treturn new Color(object, model);\n\t}\n\n\tif (model && model in skippedModels) {\n\t\tmodel = null;\n\t}\n\n\tif (model && !(model in convert)) {\n\t\tthrow new Error('Unknown model: ' + model);\n\t}\n\n\tlet i;\n\tlet channels;\n\n\tif (object == null) { // eslint-disable-line no-eq-null,eqeqeq\n\t\tthis.model = 'rgb';\n\t\tthis.color = [0, 0, 0];\n\t\tthis.valpha = 1;\n\t} else if (object instanceof Color) {\n\t\tthis.model = object.model;\n\t\tthis.color = [...object.color];\n\t\tthis.valpha = object.valpha;\n\t} else if (typeof object === 'string') {\n\t\tconst result = colorString.get(object);\n\t\tif (result === null) {\n\t\t\tthrow new Error('Unable to parse color from string: ' + object);\n\t\t}\n\n\t\tthis.model = result.model;\n\t\tchannels = convert[this.model].channels;\n\t\tthis.color = result.value.slice(0, channels);\n\t\tthis.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;\n\t} else if (object.length > 0) {\n\t\tthis.model = model || 'rgb';\n\t\tchannels = convert[this.model].channels;\n\t\tconst newArray = Array.prototype.slice.call(object, 0, channels);\n\t\tthis.color = zeroArray(newArray, channels);\n\t\tthis.valpha = typeof object[channels] === 'number' ? object[channels] : 1;\n\t} else if (typeof object === 'number') {\n\t\t// This is always RGB - can be converted later on.\n\t\tthis.model = 'rgb';\n\t\tthis.color = [\n\t\t\t(object >> 16) & 0xFF,\n\t\t\t(object >> 8) & 0xFF,\n\t\t\tobject & 0xFF,\n\t\t];\n\t\tthis.valpha = 1;\n\t} else {\n\t\tthis.valpha = 1;\n\n\t\tconst keys = Object.keys(object);\n\t\tif ('alpha' in object) {\n\t\t\tkeys.splice(keys.indexOf('alpha'), 1);\n\t\t\tthis.valpha = typeof object.alpha === 'number' ? object.alpha : 0;\n\t\t}\n\n\t\tconst hashedKeys = keys.sort().join('');\n\t\tif (!(hashedKeys in hashedModelKeys)) {\n\t\t\tthrow new Error('Unable to parse color from object: ' + JSON.stringify(object));\n\t\t}\n\n\t\tthis.model = hashedModelKeys[hashedKeys];\n\n\t\tconst {labels} = convert[this.model];\n\t\tconst color = [];\n\t\tfor (i = 0; i < labels.length; i++) {\n\t\t\tcolor.push(object[labels[i]]);\n\t\t}\n\n\t\tthis.color = zeroArray(color);\n\t}\n\n\t// Perform limitations (clamping, etc.)\n\tif (limiters[this.model]) {\n\t\tchannels = convert[this.model].channels;\n\t\tfor (i = 0; i < channels; i++) {\n\t\t\tconst limit = limiters[this.model][i];\n\t\t\tif (limit) {\n\t\t\t\tthis.color[i] = limit(this.color[i]);\n\t\t\t}\n\t\t}\n\t}\n\n\tthis.valpha = Math.max(0, Math.min(1, this.valpha));\n\n\tif (Object.freeze) {\n\t\tObject.freeze(this);\n\t}\n}\n\nColor.prototype = {\n\ttoString() {\n\t\treturn this.string();\n\t},\n\n\ttoJSON() {\n\t\treturn this[this.model]();\n\t},\n\n\tstring(places) {\n\t\tlet self = this.model in colorString.to ? this : this.rgb();\n\t\tself = self.round(typeof places === 'number' ? places : 1);\n\t\tconst args = self.valpha === 1 ? self.color : [...self.color, this.valpha];\n\t\treturn colorString.to[self.model](args);\n\t},\n\n\tpercentString(places) {\n\t\tconst self = this.rgb().round(typeof places === 'number' ? places : 1);\n\t\tconst args = self.valpha === 1 ? self.color : [...self.color, this.valpha];\n\t\treturn colorString.to.rgb.percent(args);\n\t},\n\n\tarray() {\n\t\treturn this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];\n\t},\n\n\tobject() {\n\t\tconst result = {};\n\t\tconst {channels} = convert[this.model];\n\t\tconst {labels} = convert[this.model];\n\n\t\tfor (let i = 0; i < channels; i++) {\n\t\t\tresult[labels[i]] = this.color[i];\n\t\t}\n\n\t\tif (this.valpha !== 1) {\n\t\t\tresult.alpha = this.valpha;\n\t\t}\n\n\t\treturn result;\n\t},\n\n\tunitArray() {\n\t\tconst rgb = this.rgb().color;\n\t\trgb[0] /= 255;\n\t\trgb[1] /= 255;\n\t\trgb[2] /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.push(this.valpha);\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tunitObject() {\n\t\tconst rgb = this.rgb().object();\n\t\trgb.r /= 255;\n\t\trgb.g /= 255;\n\t\trgb.b /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.alpha = this.valpha;\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tround(places) {\n\t\tplaces = Math.max(places || 0, 0);\n\t\treturn new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);\n\t},\n\n\talpha(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);\n\t\t}\n\n\t\treturn this.valpha;\n\t},\n\n\t// Rgb\n\tred: getset('rgb', 0, maxfn(255)),\n\tgreen: getset('rgb', 1, maxfn(255)),\n\tblue: getset('rgb', 2, maxfn(255)),\n\n\thue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),\n\n\tsaturationl: getset('hsl', 1, maxfn(100)),\n\tlightness: getset('hsl', 2, maxfn(100)),\n\n\tsaturationv: getset('hsv', 1, maxfn(100)),\n\tvalue: getset('hsv', 2, maxfn(100)),\n\n\tchroma: getset('hcg', 1, maxfn(100)),\n\tgray: getset('hcg', 2, maxfn(100)),\n\n\twhite: getset('hwb', 1, maxfn(100)),\n\twblack: getset('hwb', 2, maxfn(100)),\n\n\tcyan: getset('cmyk', 0, maxfn(100)),\n\tmagenta: getset('cmyk', 1, maxfn(100)),\n\tyellow: getset('cmyk', 2, maxfn(100)),\n\tblack: getset('cmyk', 3, maxfn(100)),\n\n\tx: getset('xyz', 0, maxfn(95.047)),\n\ty: getset('xyz', 1, maxfn(100)),\n\tz: getset('xyz', 2, maxfn(108.833)),\n\n\tl: getset('lab', 0, maxfn(100)),\n\ta: getset('lab', 1),\n\tb: getset('lab', 2),\n\n\tkeyword(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\treturn convert[this.model].keyword(this.color);\n\t},\n\n\thex(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\treturn colorString.to.hex(this.rgb().round().color);\n\t},\n\n\thexa(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\tconst rgbArray = this.rgb().round().color;\n\n\t\tlet alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();\n\t\tif (alphaHex.length === 1) {\n\t\t\talphaHex = '0' + alphaHex;\n\t\t}\n\n\t\treturn colorString.to.hex(rgbArray) + alphaHex;\n\t},\n\n\trgbNumber() {\n\t\tconst rgb = this.rgb().color;\n\t\treturn ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);\n\t},\n\n\tluminosity() {\n\t\t// http://www.w3.org/TR/WCAG20/#relativeluminancedef\n\t\tconst rgb = this.rgb().color;\n\n\t\tconst lum = [];\n\t\tfor (const [i, element] of rgb.entries()) {\n\t\t\tconst chan = element / 255;\n\t\t\tlum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;\n\t\t}\n\n\t\treturn 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];\n\t},\n\n\tcontrast(color2) {\n\t\t// http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n\t\tconst lum1 = this.luminosity();\n\t\tconst lum2 = color2.luminosity();\n\n\t\tif (lum1 > lum2) {\n\t\t\treturn (lum1 + 0.05) / (lum2 + 0.05);\n\t\t}\n\n\t\treturn (lum2 + 0.05) / (lum1 + 0.05);\n\t},\n\n\tlevel(color2) {\n\t\t// https://www.w3.org/TR/WCAG/#contrast-enhanced\n\t\tconst contrastRatio = this.contrast(color2);\n\t\tif (contrastRatio >= 7) {\n\t\t\treturn 'AAA';\n\t\t}\n\n\t\treturn (contrastRatio >= 4.5) ? 'AA' : '';\n\t},\n\n\tisDark() {\n\t\t// YIQ equation from http://24ways.org/2010/calculating-color-contrast\n\t\tconst rgb = this.rgb().color;\n\t\tconst yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;\n\t\treturn yiq < 128;\n\t},\n\n\tisLight() {\n\t\treturn !this.isDark();\n\t},\n\n\tnegate() {\n\t\tconst rgb = this.rgb();\n\t\tfor (let i = 0; i < 3; i++) {\n\t\t\trgb.color[i] = 255 - rgb.color[i];\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tlighten(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[2] += hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdarken(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[2] -= hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tsaturate(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[1] += hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdesaturate(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[1] -= hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\twhiten(ratio) {\n\t\tconst hwb = this.hwb();\n\t\thwb.color[1] += hwb.color[1] * ratio;\n\t\treturn hwb;\n\t},\n\n\tblacken(ratio) {\n\t\tconst hwb = this.hwb();\n\t\thwb.color[2] += hwb.color[2] * ratio;\n\t\treturn hwb;\n\t},\n\n\tgrayscale() {\n\t\t// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale\n\t\tconst rgb = this.rgb().color;\n\t\tconst value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;\n\t\treturn Color.rgb(value, value, value);\n\t},\n\n\tfade(ratio) {\n\t\treturn this.alpha(this.valpha - (this.valpha * ratio));\n\t},\n\n\topaquer(ratio) {\n\t\treturn this.alpha(this.valpha + (this.valpha * ratio));\n\t},\n\n\trotate(degrees) {\n\t\tconst hsl = this.hsl();\n\t\tlet hue = hsl.color[0];\n\t\thue = (hue + degrees) % 360;\n\t\thue = hue < 0 ? 360 + hue : hue;\n\t\thsl.color[0] = hue;\n\t\treturn hsl;\n\t},\n\n\tmix(mixinColor, weight) {\n\t\t// Ported from sass implementation in C\n\t\t// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209\n\t\tif (!mixinColor || !mixinColor.rgb) {\n\t\t\tthrow new Error('Argument to \"mix\" was not a Color instance, but rather an instance of ' + typeof mixinColor);\n\t\t}\n\n\t\tconst color1 = mixinColor.rgb();\n\t\tconst color2 = this.rgb();\n\t\tconst p = weight === undefined ? 0.5 : weight;\n\n\t\tconst w = 2 * p - 1;\n\t\tconst a = color1.alpha() - color2.alpha();\n\n\t\tconst w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;\n\t\tconst w2 = 1 - w1;\n\n\t\treturn Color.rgb(\n\t\t\tw1 * color1.red() + w2 * color2.red(),\n\t\t\tw1 * color1.green() + w2 * color2.green(),\n\t\t\tw1 * color1.blue() + w2 * color2.blue(),\n\t\t\tcolor1.alpha() * p + color2.alpha() * (1 - p));\n\t},\n};\n\n// Model conversion methods and static constructors\nfor (const model of Object.keys(convert)) {\n\tif (skippedModels.includes(model)) {\n\t\tcontinue;\n\t}\n\n\tconst {channels} = convert[model];\n\n\t// Conversion methods\n\tColor.prototype[model] = function (...args) {\n\t\tif (this.model === model) {\n\t\t\treturn new Color(this);\n\t\t}\n\n\t\tif (args.length > 0) {\n\t\t\treturn new Color(args, model);\n\t\t}\n\n\t\treturn new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);\n\t};\n\n\t// 'static' construction methods\n\tColor[model] = function (...args) {\n\t\tlet color = args[0];\n\t\tif (typeof color === 'number') {\n\t\t\tcolor = zeroArray(args, channels);\n\t\t}\n\n\t\treturn new Color(color, model);\n\t};\n}\n\nfunction roundTo(number, places) {\n\treturn Number(number.toFixed(places));\n}\n\nfunction roundToPlace(places) {\n\treturn function (number) {\n\t\treturn roundTo(number, places);\n\t};\n}\n\nfunction getset(model, channel, modifier) {\n\tmodel = Array.isArray(model) ? model : [model];\n\n\tfor (const m of model) {\n\t\t(limiters[m] || (limiters[m] = []))[channel] = modifier;\n\t}\n\n\tmodel = model[0];\n\n\treturn function (value) {\n\t\tlet result;\n\n\t\tif (value !== undefined) {\n\t\t\tif (modifier) {\n\t\t\t\tvalue = modifier(value);\n\t\t\t}\n\n\t\t\tresult = this[model]();\n\t\t\tresult.color[channel] = value;\n\t\t\treturn result;\n\t\t}\n\n\t\tresult = this[model]().color[channel];\n\t\tif (modifier) {\n\t\t\tresult = modifier(result);\n\t\t}\n\n\t\treturn result;\n\t};\n}\n\nfunction maxfn(max) {\n\treturn function (v) {\n\t\treturn Math.max(0, Math.min(max, v));\n\t};\n}\n\nfunction assertArray(value) {\n\treturn Array.isArray(value) ? value : [value];\n}\n\nfunction zeroArray(array, length) {\n\tfor (let i = 0; i < length; i++) {\n\t\tif (typeof array[i] !== 'number') {\n\t\t\tarray[i] = 0;\n\t\t}\n\t}\n\n\treturn array;\n}\n\nmodule.exports = Color;\n", "function pageReload(to_base_url: string) {\n const __file_url = new URL(import.meta.url);\n const __event_source = new URL(`${to_base_url}esbuild`, __file_url.href)\n\n if (['0.0.0.0', '127.0.0.1', 'localhost'].includes(__file_url.hostname)) {\n new EventSource(__event_source).addEventListener(\n 'change',\n () => location.reload());\n };\n};\n\nexport { pageReload };", "export function sleepSync(ms: number) {\n const end = new Date().getTime() + ms;\n let time = new Date().getTime();\n while (time < end) {\n time = new Date().getTime();\n }\n return time;\n}\n\nexport function uuid() {\n return sleepSync(1).toString(36);\n}", "export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\n", "/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n\n/**\n * @param {string[]} array\n * @param {RegExp} pattern\n * @return {string[]}\n */\nexport function filter (array, pattern) {\n\treturn array.filter(function (value) { return !match(value, pattern) })\n}\n", "import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {object[]} siblings\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length, siblings) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props)\n}\n\n/**\n * @param {object} root\n */\nexport function lift (root) {\n\twhile (root.root)\n\t\troot = copy(root.root, {children: [root]})\n\n\tappend(root, root.siblings)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n", "import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @param {object[]} siblings\n * @return {object}\n */\nexport function comment (value, root, parent, siblings) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function declaration (value, root, parent, length, siblings) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings)\n}\n", "import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\n\tfor (var i = 0; i < children.length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: if (!strlen(element.value = element.props.join(','))) return ''\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n", "import { compile, serialize, stringify } from 'stylis';\n\nexport function stylis(css: string) {\n return serialize(compile(css), stringify);\n}\n", "import { uuid } from './util.js';\nimport { stylis } from './cssProcessor/stylis.bundle.js';\n\ntype Constructor = new (...args: any[]) => T;\n\nexport function AdapterMixin>(\n Base: TBase\n) {\n return class Adapter extends Base {\n /** CSSStyleSheet() for this component */\n static _cssStyleSheet: CSSStyleSheet;\n\n /** Tag name of this component */\n static _tagName: string | null;\n\n /** Styles which contain only css for this component */\n static _styles: string[] = [];\n\n /** CSS Process middleware, This function will be called\n * before applying CSS to CSSStyleSheet.\n */\n static cssProcess(css: string): string {\n return css;\n }\n\n /**\n * Retreive styles for this component,\n * also prevent inherit values from super class.\n */\n static get styles(): string[] {\n if (this._styles === Object.getPrototypeOf(this).styles) {\n this._styles = [];\n }\n return this._styles;\n }\n\n /** Retreive inherited styles for all super classes. */\n static get allStyles(): string[] {\n let superClass = Object.getPrototypeOf(this);\n const allStyles = [];\n\n while (superClass.styles !== undefined) {\n allStyles.push(...superClass.styles);\n superClass = Object.getPrototypeOf(superClass);\n }\n allStyles.push(...this.styles);\n return allStyles;\n }\n\n /** Set CSS for this component */\n static set css(css: string) {\n this._styles = [css];\n\n if (this.tagName) {\n this.cssStyleSheet.replaceSync(\n this.cssProcess(`${this.tagName} { ${this.allCSS} }`)\n );\n }\n }\n\n /** Get CSS for this component, includes inherited styles */\n static get css(): string {\n return this.styles.join(\"\\n\");\n }\n\n static get allCSS(): string {\n return this.allStyles.join(\"\\n\");\n }\n\n /** Get tagName for this class which will be defined after\n * the class has been registerd with CustomElementsRegistry.\n */\n static get tagName(): string | null {\n if (this._tagName === Object.getPrototypeOf(this).tagName) {\n this._tagName = null;\n }\n return this._tagName;\n }\n\n /** Get CSSStyleSheet() for this component.\n * Create a new one if haven't been created yet.\n */\n static get cssStyleSheet(): CSSStyleSheet {\n const superCSSStyleSheet = Object.getPrototypeOf(this)._cssStyleSheet;\n if (this._cssStyleSheet === superCSSStyleSheet) {\n this._cssStyleSheet = new CSSStyleSheet();\n }\n return this._cssStyleSheet;\n }\n\n /** Add style to this component */\n static addStyle(css: string) {\n this._styles = this._styles.concat(css);\n\n if (this.tagName) {\n const rule = `${this.tagName} { ${css} }`;\n const processedCss = this.cssProcess(rule);\n this.cssStyleSheet.insertRule(\n processedCss,\n this.cssStyleSheet.cssRules.length\n );\n }\n }\n\n /**\n * Define component to element tag and init component style.\n * To extends this function, sub-elements must be defined\n * before call this function as `super.define(tagName);`\n */\n static define(tagName: string): void {\n this._tagName = tagName;\n customElements.define(tagName, this);\n this.initStyle();\n }\n\n /** Init component style */\n static initStyle() {\n this.cssStyleSheet.replaceSync(\n this.cssProcess(`${this.tagName} { ${this.allCSS} }`)\n );\n document.adoptedStyleSheets.push(this.cssStyleSheet);\n }\n /** @deprecated, will be removed */\n static tagStyle(css: string): void {\n console.warn('tagStyle() is deprecated, use addStyle() instead');\n this.addStyle(css);\n }\n\n /** @deprecated, will be removed */\n static classStyle(class_: string, css: string) {\n console.warn('classStyle() is deprecated, use addStyle() instead');\n this.addStyle(`&.${class_} { ${css} }`);\n }\n\n _class!: typeof Adapter; // instance's class for using as shortcut\n\n _cssStyleSheet?: CSSStyleSheet;\n\n // index of this.cssStyleSheet in document.adoptedStyleSheets\n adoptedStyleSheetIndex!: number;\n\n _uuid?: string;\n\n _shadowRoot!: ShadowRoot|null;\n\n /**\n * In constructor, there any some if condition to check\n * if it has been inited or not to prevent recursive call in Mixin\n */\n constructor(...args: any[]) {\n super(...args);\n if (!this._class) { this.initClass() };\n }\n\n /** Dynamically create and return uuid for the element */\n get uuid(): string {\n if (!this._uuid) {\n this._uuid = `${this.tagName}-${uuid()}`;\n }\n return this._uuid;\n }\n\n /**\n * Dynamically create a CSSStyleSheet() and keep track of the adopted\n * stylesheet index for reference.\n */\n get cssStyleSheet() {\n if (this._cssStyleSheet) { return this._cssStyleSheet };\n\n this._cssStyleSheet = new CSSStyleSheet();\n\n /** For normal element, attach this._cssStyleSheet to the document */\n if (!this._shadowRoot) {\n const index = document.adoptedStyleSheets.length;\n this.classList.add(this.uuid);\n document.adoptedStyleSheets[index] = this._cssStyleSheet;\n this.adoptedStyleSheetIndex = index;\n }\n\n return this._cssStyleSheet;\n }\n\n /**\n * Return a selector for the this element as a class chain.\n */\n get objectClassSelector(): string {\n return this.classList.value.replace(/ /g, \".\");\n }\n\n /**\n * Set CSS for this element.\n * It works like `` but with CSS processor.\n */\n set css(css: string) {\n // Init cssStyleSheet if it hasn't been inited yet.\n this.cssStyleSheet;\n\n const processedCss = this._class.cssProcess(\n `${this.tagName}.${this.objectClassSelector} { ${css} }`\n );\n \n this.cssStyleSheet.replaceSync(processedCss);\n }\n\n /** Get CSS for this element */\n get css(): string {\n let css = ``;\n for (const rule of this.cssStyleSheet.cssRules) {\n css += rule.cssText + \"\\n\";\n }\n return css;\n }\n\n initClass() {\n this._class = this.constructor as unknown as typeof Adapter;\n\n /**\n * If class tagName has been defined from somewhere else.\n * Then it shouldn't be initialized again.\n */\n if (this._class.tagName) {\n return;\n }\n this._class._tagName = this.tagName;\n this._class.initStyle();\n }\n\n /** Override super.attachShadow()\n * to add this.cssStyleSheet to shadowRoot\n */\n attachShadow(init: ShadowRootInit): ShadowRoot {\n const shadowRoot = super.attachShadow(init);\n shadowRoot.adoptedStyleSheets = [\n this._class.cssStyleSheet,\n this.cssStyleSheet\n ];\n document.adoptedStyleSheets.splice(this.adoptedStyleSheetIndex, 1);\n this._shadowRoot = shadowRoot;\n return shadowRoot;\n }\n\n /** Add style for this element */\n addStyle(css: string): void {\n // Init cssStyleSheet if it hasn't been inited yet.\n this.cssStyleSheet;\n\n const processedCss = this._class.cssProcess(\n `${this.tagName}.${this.objectClassSelector} { ${css} }`\n );\n\n this.cssStyleSheet.insertRule(\n processedCss,\n this.cssStyleSheet.cssRules.length\n );\n }\n\n /** Remove the element from DOM and remove adoptedStyleSheet */\n delete() {\n if (!this._shadowRoot) {\n document.adoptedStyleSheets.splice(this.adoptedStyleSheetIndex, 1)\n };\n this.remove();\n }\n };\n}\n\nexport class Adapter extends AdapterMixin(HTMLElement) {\n static cssProcess(css: string): string {\n return stylis(css);\n }\n}\n", "import Color from \"color\";\n\nfunction bgColor(color) {\n return /*css*/`\n background-color: ${color};\n color: ${Color(color).isDark() ? 'white' : 'black'};\n `.trim();\n}\n\nfunction lift(level: number, color: string = 'black') {\n return `filter: drop-shadow(0 0 ${level * 2}px ${color});`;\n}\n\nfunction pxToRem(px: any) {\n px = parseFloat(px);\n const rem1 = parseFloat(\n getComputedStyle(document.documentElement).fontSize);\n return `${px / rem1}rem`;\n}\n\nconst aspectRatio = (ratio: string = '1/1'): string => {\n return `\n height: auto;\n aspect-ratio: ${ratio};\n @supports not (aspect-ratio: ${ratio}) {\n &::before {\n float: left;\n padding-top: 100% / ${ratio};\n content: \"\";\n }\n\n &::after {\n display: block;\n content: \"\";\n clear: both;\n }\n }\n `.trim();\n}\n\nexport { bgColor, lift, pxToRem, aspectRatio };", "const color = {\n blue: \"#3584e4\",\n green: \"#33d17a\",\n yellow: \"#f6d32d\",\n orange: \"#ff7800\",\n red: \"#e01b24\",\n purple: \"#9141ac\",\n violet: \"#9141ac\",\n brown: \"#986a44\",\n light: \"#deddda\",\n dark: \"#3d3846\"\n}\n\nexport { color };", "import { Adapter } from \"../../adapter.js\";\nimport { bgColor, pxToRem } from '../style';\nimport { color } from '../designToken';\n\n\ninterface MenuStyleParam {\n itemCSS?: string;\n itemHoverCSS?: string;\n}\n\nfunction menuStyle(param: MenuStyleParam = {}) {\n\n return /*css*/`\n div[class] {all: unset};\n\n & {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n width: 100%;\n }\n\n details, details[class] {\n width: 100%;\n overflow: hidden;\n > div.container {\n display: block;\n box-sizing: border-box;\n border-left: 0.2rem groove;\n border-bottom-left-radius: 0.3rem;\n border-top-left-radius: 0.3rem;\n margin-left: 0.6rem;\n transition: height 0.3s ease;\n }\n }\n\n /** Item CSS */\n div.container {\n > div:not(:has(details)),\n > div:has(details) summary {\n display: flex;\n box-sizing: border-box;\n padding-left: 0.5rem;\n line-height: 2.5;\n ${param.itemCSS}\n }\n }\n\n /** Item Hover CSS */\n summary:has(> a), div:has(> a) {\n &:hover {\n ${bgColor(color.light)}\n ${param.itemHoverCSS}\n }\n }\n\n details > summary > .toggle {\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 1.5rem;\n min-width: 3rem;\n cursor: pointer;\n user-select: none;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n transition: transform 0.3s ease;\n transform: rotate(0deg)\n }\n\n details.open > summary > .toggle {\n transition: transform 0.3s ease;\n transform: rotate(90deg);\n }\n\n summary {\n list-style: none;\n display: flex;\n box-sizing: border-box;\n width: 100%;\n padding-left: 0.5rem;\n }\n\n a {\n width: 100%;\n }\n `.trim();\n}\n\nclass Menu extends Adapter {\n static css = menuStyle();\n static style = menuStyle;\n\n constructor() {\n super();\n this.addEventListener('click', (e) => {\n const target = e.target as HTMLElement;\n if (target.tagName.toLowerCase() === 'summary') {\n e.preventDefault();\n return\n };\n if (!target.classList.contains('toggle')) { \n return;\n };\n e.preventDefault();\n let el_details = target.closest(`${this.tagName} summary`) as HTMLDetailsElement;\n\n if (!el_details) {return};\n el_details = el_details.parentElement as HTMLDetailsElement;\n el_details.open ? this.close(el_details) : this.open(el_details);\n });\n }\n\n open(el_details?: HTMLDetailsElement) {\n if (!el_details) {\n el_details = this.querySelector('details') as HTMLDetailsElement;\n };\n el_details.classList.add('open');\n const el_parentContainer :HTMLElement = el_details\n .parentElement!\n .closest(`${this.tagName} div.container`)! as HTMLElement;\n el_parentContainer ? el_parentContainer.style.height = \"auto\" : null;\n\n const el_container: HTMLElement = el_details\n .querySelector('div.container') as HTMLElement;\n\n const height = pxToRem(getComputedStyle(el_container).height);\n\n let parentDetailsElement = el_details\n .parentElement!\n .closest(`${this.tagName} details`) as HTMLDetailsElement;\n while (parentDetailsElement) {\n parentDetailsElement.open ? null : this.open(parentDetailsElement);\n parentDetailsElement = parentDetailsElement\n .parentElement!\n .closest('details') as HTMLDetailsElement;\n }\n\n el_details.open = true;\n el_container.style.height = \"0\";\n setTimeout(() => {\n el_container.style.height = height;\n }, 0);\n return this;\n }\n\n expand(el_details: HTMLDetailsElement) {\n let childDetailsElement = el_details\n .querySelector('details') as HTMLDetailsElement;\n while (childDetailsElement) {\n this.open(childDetailsElement);\n childDetailsElement = childDetailsElement\n .querySelector('details') as HTMLDetailsElement;\n }\n }\n\n close(el_details: HTMLDetailsElement) {\n el_details.classList.remove('open');\n const el_container: HTMLElement = el_details.querySelector('div.container')!;\n el_container.style.height = pxToRem(getComputedStyle(el_container).height);\n setTimeout(() => {\n el_container.style.height = \"0\";\n }, 0);\n setTimeout(() => {\n el_details.open = false;\n el_container.style.height = \"auto\";\n }, 300);\n }\n\n collapse(el_details: HTMLDetailsElement) {\n this.close(el_details);\n let childDetailsElement = el_details\n .querySelector('details') as HTMLDetailsElement;\n while (childDetailsElement) {\n this.close(childDetailsElement);\n childDetailsElement = childDetailsElement\n .querySelector('details') as HTMLDetailsElement;\n }\n }\n}\n\nexport { Menu };", "import { Menu as _Menu } from '../../_ux/ui/menu';\n\n\nclass Menu extends _Menu {\n static css = /*css*/`\n ${_Menu.style()}\n a {\n width: 100%;\n text-decoration: none;\n color: unset;\n }\n summary {\n h2 {\n font-size: 1.25rem;\n line-height: 2;\n margin: 0;\n padding-left: 0.5rem;\n }\n }\n `;\n};\n\nexport { Menu };", "function baseStyle() {\n const cssStyleSheet = new CSSStyleSheet();\n cssStyleSheet.replaceSync(/*css*/`\n body {\n display: flex;\n justify-content: center;\n padding: 0;\n > el-container:first-of-type {\n margin-top: 2rem;\n }\n }\n h1, h2, h3 {\n margin: auto;\n max-width: 80ch;\n }\n h1 {\n text-align: center\n }\n h2{\n margin-top: 2.5rem;\n }\n h3 {\n margin-top: 1.5rem;\n }\n p {\n margin: 1rem auto;\n }\n `);\n document.adoptedStyleSheets.push(cssStyleSheet);\n};\n\nexport { baseStyle };", "import Color from 'color';\n\nimport { aspectRatio, bgColor } from '../../_ux/style';\nimport { buttonStyle } from '../../_ux/ui/button';\nimport { color } from '../../_ux/designToken';\nimport { Sidebar as _Sidebar } from '../../_ux/ui/sidebar';\n\n\nconst sideBarStyle = /*css*/`\n & {\n height: 110dvh;\n ${bgColor(color.dark)}\n }\n\n filter: drop-shadow(2px 2px 4px ${Color(color.dark)\n .alpha(0.8).string()});\n\n &.show {\n filter: drop-shadow(2px 2px 4px ${Color(color.dark)\n .alpha(0.8).string()});\n [el=\"toggle\"] {\n span { transform: rotate(180deg) }\n };\n }\n \n &.hide {\n filter: none;\n [el=\"toggle\"] {\n span { transform: rotate(0deg) }\n };\n }\n\n el-button[el=\"toggle\"] {\n ${buttonStyle('blue')}\n display: flex;\n justify-content: center;\n align-items: stretch;\n position: fixed;\n top: 70dvh;\n right: 0;\n width: 3em;\n transform: translateX(100%);\n opacity: 0.7;\n &:hover { opacity: 1 };\n ${aspectRatio('1')}\n button {\n width: 100%;\n height: 100%;\n border-top-left-radius:0 ;\n border-bottom-left-radius: 0;\n }\n span {\n line-height: 1;\n font-size: 1.5em;\n transition: transform 0.4s ease;\n transform: rotate(0deg);\n }\n }\n`;\n\nclass Sidebar extends _Sidebar {\n static css = /*css*/`\n ${Sidebar.style()}\n ${sideBarStyle}\n `;\n\n constructor() {\n super();\n this.querySelector('[el=\"toggle\"]')?.addEventListener('click', () => { \n this.toggle();\n });\n\n let mql = window.matchMedia('screen and (max-width: 1200px)');\n setTimeout(() => {\n this.onMediaQueryChange(mql);\n }, 0);\n setTimeout(() => {\n mql.addEventListener('change', () => {\n this.onMediaQueryChange(mql);\n });\n }, 750);\n }\n\n onMediaQueryChange(mql: MediaQueryList) {\n mql.matches ? this.hide() : this.show();\n }\n\n show() {\n super.show();\n this.dispatchEvent(new CustomEvent('show'));\n }\n\n hide() {\n super.hide();\n this.dispatchEvent(new CustomEvent('hide'));\n }\n}\n\nexport { Sidebar };", "import { Adapter } from \"../../adapter.js\";\nimport Color from 'color';\nimport { bgColor, lift } from '../style';\n\nconst buttonStyle = (color) => {\n return /*css*/`\n & {\n display: inline-flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n }\n\n & button {\n display: inline-flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n border: 0;\n border-radius: 0.25rem;\n padding: 0.5rem 0.7rem;\n font-weight: bold;\n line-height: 1;\n cursor: pointer;\n ${lift(0.7, '#555')}\n ${bgColor(color)}\n &:hover {\n background-color: ${Color(color)\n .lighten(0.1)\n .saturate(0.1)};\n ${lift(1.1, '#555')}\n }\n &:active {\n background-color: ${Color(color)\n .darken(0.1)\n .saturate(-0.1)};\n ${lift(0.5, '#555')}\n }\n }\n `\n}\n\nclass Button extends Adapter {\n initialHTML = this.innerHTML;\n\n constructor() {\n super();\n this.render();\n }\n\n render() {\n this.innerHTML = ``;\n }\n};\n\nexport { buttonStyle, Button };", "import { Adapter } from \"../../adapter.js\";\n\nconst sidebarStyle = (): string => {\n const style = /*css*/`\n & {\n all: unset;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n align-content: flex-start;\n box-sizing: border-box;\n position: fixed;\n left: 0;\n z-index: 100;\n width: 28ch;\n min-height: 50dvh;\n padding-top: 30dvh;\n padding-bottom: 20dvh;\n background-color: white;\n transition: transform 0.4s ease;\n transform: translateX(0);\n }\n\n &.show {\n transform: translateX(0);\n }\n \n &.hide {\n transform: translateX(-100%);\n }\n\n `.trim();\n return style;\n};\n\nclass Sidebar extends Adapter {\n static css = `${sidebarStyle()}`;\n static style = sidebarStyle;\n\n constructor() {\n super();\n }\n\n show() {\n this.classList.remove('hide');\n this.classList.add('show');\n }\n\n hide() {\n this.classList.remove('show');\n this.classList.add('hide');\n }\n\n toggle() {\n if (this.classList.contains('show')) {\n this.hide();\n } else {\n this.show();\n }\n }\n};\n\nexport { Sidebar };", "import { Adapter } from '../../adapter';\n\n\nclass Container extends Adapter {\n static css = /*css*/`& {\n all: unset;\n display: block;\n box-sizing: border-box;\n margin-bottom: 40dvh;\n max-width: 80ch;\n min-height: 100dvh;\n width: 90%;\n transition: margin-left 0.3s ease-in-out;\n }`;\n\n constructor() {\n super();\n const el_sidebar = document.querySelector('el-sidebar') as HTMLElement;\n setTimeout(() => {\n this.css = this.defaultStyle();\n }, 0);\n el_sidebar.addEventListener('hide', () => {\n this.addStyle(`margin: unset;`);\n });\n el_sidebar.addEventListener('show', () => {\n this.css = this.defaultStyle();\n });\n }\n\n defaultStyle(): string {\n const el_sidebar = document.querySelector('el-sidebar') as HTMLElement;\n return /*css*/`& {\n @media screen and (min-width: 1200px) {\n width: 68%;\n margin-left: calc(${getComputedStyle(el_sidebar).width});\n }\n }`;\n }\n};\n\nexport { Container };", "/** 3rd Party */\nimport { pageReload } from '../_base.esbuild'\nimport { Sidebar as _Sidebar } from '../_ux/ui/sidebar';\nimport { Menu } from './_ui/menu';\nimport { baseStyle as guideBaseStyle } from './_base.style';\n\nimport { Sidebar } from './_ui/sidebar';\nimport { Container } from './_ui/container';\n\n\nguideBaseStyle();\npageReload('../');\n\nMenu.define('el-menu');\n\nSidebar.define('el-sidebar');\nContainer.define('el-container');"], - "mappings": ";;;;;;6BAAA;AAAA,aAEA,OAAO,QAAU,CAChB,UAAa,CAAC,IAAK,IAAK,GAAG,EAC3B,aAAgB,CAAC,IAAK,IAAK,GAAG;AAC9B,KAAQ,CAAC,EAAG,IAAK,GAAG,EACpB,WAAc,CAAC,IAAK,IAAK,GAAG,EAC5B,MAAS,CAAC,IAAK,IAAK,GAAG,EACvB,MAAS,CAAC,IAAK,IAAK,GAAG;AACvB,OAAU,CAAC,IAAK,IAAK,GAAG,EACxB,MAAS,CAAC,EAAG,EAAG,CAAC,EACjB,eAAkB,CAAC,IAAK,IAAK,GAAG,EAChC,KAAQ,CAAC,EAAG,EAAG,GAAG,EAClB,WAAc;AAAC,IAAK,GAAI,GAAG,EAC3B,MAAS,CAAC,IAAK,GAAI,EAAE,EACrB,UAAa,CAAC,IAAK,IAAK,GAAG,EAC3B,UAAa,CAAC,GAAI,IAAK,GAAG,EAC1B,WAAc;AAAC,IAAK,IAAK,CAAC,EAC1B,UAAa,CAAC,IAAK,IAAK,EAAE,EAC1B,MAAS,CAAC,IAAK,IAAK,EAAE,EACtB,eAAkB,CAAC,IAAK,IAAK,GAAG;AAChC,SAAY,CAAC,IAAK,IAAK,GAAG,EAC1B,QAAW,CAAC,IAAK,GAAI,EAAE,EACvB,KAAQ,CAAC,EAAG,IAAK,GAAG,EACpB,SAAY,CAAC,EAAG,EAAG,GAAG,EACtB,SAAY;AAAC,EAAG,IAAK,GAAG,EACxB,cAAiB,CAAC,IAAK,IAAK,EAAE,EAC9B,SAAY,CAAC,IAAK,IAAK,GAAG,EAC1B,UAAa,CA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Ac,IAAI,YAAY;AAAA,KAAM,CAAC,CAC9C,CAEA,MAAO,CACH,MAAM,KAAK,EACX,KAAK,cAAc,IAAI,YAAY,MAAM,CAAC,CAC9C,CACJ,EG7FA,IAAM,UAAN,cAAwB,OAAQ,CAHhC,MAGgC,0BAC5B;AAAO,IAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAWpB,aAAc,CACV,MAAM,EACN,IAAM,WAAa,SAAS,cAAc,YAAY;AACtD,WAAW,IAAM,CACb,KAAK,IAAM,KAAK,aAAa,CACjC,EAAG,CAAC,EACJ,WAAW,iBAAiB;AAAA,IAAQ,IAAM,CACtC,KAAK,SAAS,gBAAgB,CAClC,CAAC,EACD,WAAW,iBAAiB,OAAQ,IAAM;AACtC,KAAK,IAAM,KAAK,aAAa,CACjC,CAAC,CACL,CAEA,cAAuB,CACnB,IAAM,WAAa,SAAS;AAAc,YAAY,EACtD,MAAc;AAAA;AAAA;AAAA,oCAGc,iBAAiB,UAAU,EAAE,KAAK;AAAA;AAAA,UAGlE,CACJ,EC5BA,UAAe,EACf,WAAW,KAAK,EAEhBC,MAAK,OAAO,SAAS,EAErBC,SAAQ,OAAO;AAAA,EAAY,EAC3B,UAAU,OAAO,cAAc", + "sources": ["../../node_modules/color-name/index.js", "../../node_modules/simple-swizzle/node_modules/is-arrayish/index.js", "../../node_modules/simple-swizzle/index.js", "../../node_modules/color-string/index.js", "../../node_modules/color-convert/conversions.js", "../../node_modules/color-convert/route.js", "../../node_modules/color-convert/index.js", "../../node_modules/color/index.js", "../../src/util.ts", "../../node_modules/stylis/src/Enum.js", "../../node_modules/stylis/src/Utility.js", "../../node_modules/stylis/src/Tokenizer.js", "../../node_modules/stylis/src/Parser.js", "../../node_modules/stylis/src/Serializer.js", "../../src/cssProcessor/stylis.bundle.ts", "../../src/adapter.ts", "../../docs-src/_ux/style.ts", "../../docs-src/_ux/designToken.ts", "../../docs-src/_ux/ui/menu.ts", "../../docs-src/guide/_ui/menu.ts", "../../docs-src/guide/_base.style.ts", "../../docs-src/guide/_ui/sidebar.ts", "../../docs-src/_ux/ui/button.ts", "../../docs-src/_ux/ui/sidebar.ts", "../../docs-src/guide/_ui/container.ts", "../../docs-src/guide/base.ts"], + "sourcesContent": ["'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n", "module.exports = function isArrayish(obj) {\n\tif (!obj || typeof obj === 'string') {\n\t\treturn false;\n\t}\n\n\treturn obj instanceof Array || Array.isArray(obj) ||\n\t\t(obj.length >= 0 && (obj.splice instanceof Function ||\n\t\t\t(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));\n};\n", "'use strict';\n\nvar isArrayish = require('is-arrayish');\n\nvar concat = Array.prototype.concat;\nvar slice = Array.prototype.slice;\n\nvar swizzle = module.exports = function swizzle(args) {\n\tvar results = [];\n\n\tfor (var i = 0, len = args.length; i < len; i++) {\n\t\tvar arg = args[i];\n\n\t\tif (isArrayish(arg)) {\n\t\t\t// http://jsperf.com/javascript-array-concat-vs-push/98\n\t\t\tresults = concat.call(results, slice.call(arg));\n\t\t} else {\n\t\t\tresults.push(arg);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nswizzle.wrap = function (fn) {\n\treturn function () {\n\t\treturn fn(swizzle(arguments));\n\t};\n};\n", "/* MIT license */\nvar colorNames = require('color-name');\nvar swizzle = require('simple-swizzle');\nvar hasOwnProperty = Object.hasOwnProperty;\n\nvar reverseNames = Object.create(null);\n\n// create a list of reverse color names\nfor (var name in colorNames) {\n\tif (hasOwnProperty.call(colorNames, name)) {\n\t\treverseNames[colorNames[name]] = name;\n\t}\n}\n\nvar cs = module.exports = {\n\tto: {},\n\tget: {}\n};\n\ncs.get = function (string) {\n\tvar prefix = string.substring(0, 3).toLowerCase();\n\tvar val;\n\tvar model;\n\tswitch (prefix) {\n\t\tcase 'hsl':\n\t\t\tval = cs.get.hsl(string);\n\t\t\tmodel = 'hsl';\n\t\t\tbreak;\n\t\tcase 'hwb':\n\t\t\tval = cs.get.hwb(string);\n\t\t\tmodel = 'hwb';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tval = cs.get.rgb(string);\n\t\t\tmodel = 'rgb';\n\t\t\tbreak;\n\t}\n\n\tif (!val) {\n\t\treturn null;\n\t}\n\n\treturn {model: model, value: val};\n};\n\ncs.get.rgb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar abbr = /^#([a-f0-9]{3,4})$/i;\n\tvar hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;\n\tvar rgba = /^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar per = /^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/;\n\tvar keyword = /^(\\w+)$/;\n\n\tvar rgb = [0, 0, 0, 1];\n\tvar match;\n\tvar i;\n\tvar hexAlpha;\n\n\tif (match = string.match(hex)) {\n\t\thexAlpha = match[2];\n\t\tmatch = match[1];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\t// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19\n\t\t\tvar i2 = i * 2;\n\t\t\trgb[i] = parseInt(match.slice(i2, i2 + 2), 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(abbr)) {\n\t\tmatch = match[1];\n\t\thexAlpha = match[3];\n\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i] + match[i], 16);\n\t\t}\n\n\t\tif (hexAlpha) {\n\t\t\trgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;\n\t\t}\n\t} else if (match = string.match(rgba)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = parseInt(match[i + 1], 0);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(per)) {\n\t\tfor (i = 0; i < 3; i++) {\n\t\t\trgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);\n\t\t}\n\n\t\tif (match[4]) {\n\t\t\tif (match[5]) {\n\t\t\t\trgb[3] = parseFloat(match[4]) * 0.01;\n\t\t\t} else {\n\t\t\t\trgb[3] = parseFloat(match[4]);\n\t\t\t}\n\t\t}\n\t} else if (match = string.match(keyword)) {\n\t\tif (match[1] === 'transparent') {\n\t\t\treturn [0, 0, 0, 0];\n\t\t}\n\n\t\tif (!hasOwnProperty.call(colorNames, match[1])) {\n\t\t\treturn null;\n\t\t}\n\n\t\trgb = colorNames[match[1]];\n\t\trgb[3] = 1;\n\n\t\treturn rgb;\n\t} else {\n\t\treturn null;\n\t}\n\n\tfor (i = 0; i < 3; i++) {\n\t\trgb[i] = clamp(rgb[i], 0, 255);\n\t}\n\trgb[3] = clamp(rgb[3], 0, 1);\n\n\treturn rgb;\n};\n\ncs.get.hsl = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hsl = /^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hsl);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar s = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar l = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\n\t\treturn [h, s, l, a];\n\t}\n\n\treturn null;\n};\n\ncs.get.hwb = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hwb = /^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/;\n\tvar match = string.match(hwb);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = ((parseFloat(match[1]) % 360) + 360) % 360;\n\t\tvar w = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar b = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\t\treturn [h, w, b, a];\n\t}\n\n\treturn null;\n};\n\ncs.to.hex = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn (\n\t\t'#' +\n\t\thexDouble(rgba[0]) +\n\t\thexDouble(rgba[1]) +\n\t\thexDouble(rgba[2]) +\n\t\t(rgba[3] < 1\n\t\t\t? (hexDouble(Math.round(rgba[3] * 255)))\n\t\t\t: '')\n\t);\n};\n\ncs.to.rgb = function () {\n\tvar rgba = swizzle(arguments);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'\n\t\t: 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';\n};\n\ncs.to.rgb.percent = function () {\n\tvar rgba = swizzle(arguments);\n\n\tvar r = Math.round(rgba[0] / 255 * 100);\n\tvar g = Math.round(rgba[1] / 255 * 100);\n\tvar b = Math.round(rgba[2] / 255 * 100);\n\n\treturn rgba.length < 4 || rgba[3] === 1\n\t\t? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'\n\t\t: 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';\n};\n\ncs.to.hsl = function () {\n\tvar hsla = swizzle(arguments);\n\treturn hsla.length < 4 || hsla[3] === 1\n\t\t? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'\n\t\t: 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';\n};\n\n// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax\n// (hwb have alpha optional & 1 is default value)\ncs.to.hwb = function () {\n\tvar hwba = swizzle(arguments);\n\n\tvar a = '';\n\tif (hwba.length >= 4 && hwba[3] !== 1) {\n\t\ta = ', ' + hwba[3];\n\t}\n\n\treturn 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';\n};\n\ncs.to.keyword = function (rgb) {\n\treturn reverseNames[rgb.slice(0, 3)];\n};\n\n// helpers\nfunction clamp(num, min, max) {\n\treturn Math.min(Math.max(min, num), max);\n}\n\nfunction hexDouble(num) {\n\tvar str = Math.round(num).toString(16).toUpperCase();\n\treturn (str.length < 2) ? '0' + str : str;\n}\n", "/* MIT license */\n/* eslint-disable no-mixed-operators */\nconst cssKeywords = require('color-name');\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n// values that give correct `typeof` results).\n// do not use box values types (i.e. Number(), String(), etc.)\n\nconst reverseKeywords = {};\nfor (const key of Object.keys(cssKeywords)) {\n\treverseKeywords[cssKeywords[key]] = key;\n}\n\nconst convert = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\nmodule.exports = convert;\n\n// Hide .channels and .labels properties\nfor (const model of Object.keys(convert)) {\n\tif (!('channels' in convert[model])) {\n\t\tthrow new Error('missing channels property: ' + model);\n\t}\n\n\tif (!('labels' in convert[model])) {\n\t\tthrow new Error('missing channel labels property: ' + model);\n\t}\n\n\tif (convert[model].labels.length !== convert[model].channels) {\n\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t}\n\n\tconst {channels, labels} = convert[model];\n\tdelete convert[model].channels;\n\tdelete convert[model].labels;\n\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\tObject.defineProperty(convert[model], 'labels', {value: labels});\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst min = Math.min(r, g, b);\n\tconst max = Math.max(r, g, b);\n\tconst delta = max - min;\n\tlet h;\n\tlet s;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst l = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tlet rdif;\n\tlet gdif;\n\tlet bdif;\n\tlet h;\n\tlet s;\n\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst v = Math.max(r, g, b);\n\tconst diff = v - Math.min(r, g, b);\n\tconst diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = 0;\n\t\ts = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tconst r = rgb[0];\n\tconst g = rgb[1];\n\tlet b = rgb[2];\n\tconst h = convert.rgb.hsl(rgb)[0];\n\tconst w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\n\tconst k = Math.min(1 - r, 1 - g, 1 - b);\n\tconst c = (1 - r - k) / (1 - k) || 0;\n\tconst m = (1 - g - k) / (1 - k) || 0;\n\tconst y = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\nfunction comparativeDistance(x, y) {\n\t/*\n\t\tSee https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n\t*/\n\treturn (\n\t\t((x[0] - y[0]) ** 2) +\n\t\t((x[1] - y[1]) ** 2) +\n\t\t((x[2] - y[2]) ** 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tconst reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tlet currentClosestDistance = Infinity;\n\tlet currentClosestKeyword;\n\n\tfor (const keyword of Object.keys(cssKeywords)) {\n\t\tconst value = cssKeywords[keyword];\n\n\t\t// Compute comparative distance\n\t\tconst distance = comparativeDistance(rgb, value);\n\n\t\t// Check if its less, if so set as closest\n\t\tif (distance < currentClosestDistance) {\n\t\t\tcurrentClosestDistance = distance;\n\t\t\tcurrentClosestKeyword = keyword;\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tlet r = rgb[0] / 255;\n\tlet g = rgb[1] / 255;\n\tlet b = rgb[2] / 255;\n\n\t// Assume sRGB\n\tr = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);\n\n\tconst x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tconst y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tconst z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tconst xyz = convert.rgb.xyz(rgb);\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tconst h = hsl[0] / 360;\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\tlet t2;\n\tlet t3;\n\tlet val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tconst t1 = 2 * l - t2;\n\n\tconst rgb = [0, 0, 0];\n\tfor (let i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tconst h = hsl[0];\n\tlet s = hsl[1] / 100;\n\tlet l = hsl[2] / 100;\n\tlet smin = s;\n\tconst lmin = Math.max(l, 0.01);\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tconst v = (l + s) / 2;\n\tconst sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tconst h = hsv[0] / 60;\n\tconst s = hsv[1] / 100;\n\tlet v = hsv[2] / 100;\n\tconst hi = Math.floor(h) % 6;\n\n\tconst f = h - Math.floor(h);\n\tconst p = 255 * v * (1 - s);\n\tconst q = 255 * v * (1 - (s * f));\n\tconst t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tconst h = hsv[0];\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\tconst vmin = Math.max(v, 0.01);\n\tlet sl;\n\tlet l;\n\n\tl = (2 - s) * v;\n\tconst lmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tconst h = hwb[0] / 360;\n\tlet wh = hwb[1] / 100;\n\tlet bl = hwb[2] / 100;\n\tconst ratio = wh + bl;\n\tlet f;\n\n\t// Wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\tconst i = Math.floor(6 * h);\n\tconst v = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tconst n = wh + f * (v - wh); // Linear interpolation\n\n\tlet r;\n\tlet g;\n\tlet b;\n\t/* eslint-disable max-statements-per-line,no-multi-spaces */\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v; g = n; b = wh; break;\n\t\tcase 1: r = n; g = v; b = wh; break;\n\t\tcase 2: r = wh; g = v; b = n; break;\n\t\tcase 3: r = wh; g = n; b = v; break;\n\t\tcase 4: r = n; g = wh; b = v; break;\n\t\tcase 5: r = v; g = wh; b = n; break;\n\t}\n\t/* eslint-enable max-statements-per-line,no-multi-spaces */\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tconst c = cmyk[0] / 100;\n\tconst m = cmyk[1] / 100;\n\tconst y = cmyk[2] / 100;\n\tconst k = cmyk[3] / 100;\n\n\tconst r = 1 - Math.min(1, c * (1 - k) + k);\n\tconst g = 1 - Math.min(1, m * (1 - k) + k);\n\tconst b = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\tlet r;\n\tlet g;\n\tlet b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// Assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet x;\n\tlet y;\n\tlet z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tconst y2 = y ** 3;\n\tconst x2 = x ** 3;\n\tconst z2 = z ** 3;\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet h;\n\n\tconst hr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst c = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tconst l = lch[0];\n\tconst c = lch[1];\n\tconst h = lch[2];\n\n\tconst hr = h / 360 * 2 * Math.PI;\n\tconst a = c * Math.cos(hr);\n\tconst b = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args, saturation = null) {\n\tconst [r, g, b] = args;\n\tlet value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tlet ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// Optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tconst r = args[0];\n\tconst g = args[1];\n\tconst b = args[2];\n\n\t// We use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tconst ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tlet color = args % 10;\n\n\t// Handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tconst mult = (~~(args > 50) + 1) * 0.5;\n\tconst r = ((color & 1) * mult) * 255;\n\tconst g = (((color >> 1) & 1) * mult) * 255;\n\tconst b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// Handle greyscale\n\tif (args >= 232) {\n\t\tconst c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tlet rem;\n\tconst r = Math.floor(args / 36) / 5 * 255;\n\tconst g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tconst b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tconst integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tconst match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tlet colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(char => {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tconst integer = parseInt(colorString, 16);\n\tconst r = (integer >> 16) & 0xFF;\n\tconst g = (integer >> 8) & 0xFF;\n\tconst b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst max = Math.max(Math.max(r, g), b);\n\tconst min = Math.min(Math.min(r, g), b);\n\tconst chroma = (max - min);\n\tlet grayscale;\n\tlet hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\n\tconst c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));\n\n\tlet f = 0;\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\n\tconst c = s * v;\n\tlet f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tconst h = hcg[0] / 360;\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tconst pure = [0, 0, 0];\n\tconst hi = (h % 1) * 6;\n\tconst v = hi % 1;\n\tconst w = 1 - v;\n\tlet mg = 0;\n\n\t/* eslint-disable max-statements-per-line */\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\t/* eslint-enable max-statements-per-line */\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst v = c + g * (1.0 - c);\n\tlet f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst l = g * (1.0 - c) + 0.5 * c;\n\tlet s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\tconst v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tconst w = hwb[1] / 100;\n\tconst b = hwb[2] / 100;\n\tconst v = 1 - b;\n\tconst c = v - w;\n\tlet g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hsv = convert.gray.hsl;\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tconst val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tconst integer = (val << 16) + (val << 8) + val;\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tconst val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n", "const conversions = require('./conversions');\n\n/*\n\tThis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tconst graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tconst models = Object.keys(conversions);\n\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tconst graph = buildGraph();\n\tconst queue = [fromModel]; // Unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length) {\n\t\tconst current = queue.pop();\n\t\tconst adjacents = Object.keys(conversions[current]);\n\n\t\tfor (let len = adjacents.length, i = 0; i < len; i++) {\n\t\t\tconst adjacent = adjacents[i];\n\t\t\tconst node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tconst path = [graph[toModel].parent, toModel];\n\tlet fn = conversions[graph[toModel].parent][toModel];\n\n\tlet cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nmodule.exports = function (fromModel) {\n\tconst graph = deriveBFS(fromModel);\n\tconst conversion = {};\n\n\tconst models = Object.keys(graph);\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tconst toModel = models[i];\n\t\tconst node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// No possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n};\n\n", "const conversions = require('./conversions');\nconst route = require('./route');\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\trouteModels.forEach(toModel => {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nmodule.exports = convert;\n", "const colorString = require('color-string');\nconst convert = require('color-convert');\n\nconst skippedModels = [\n\t// To be honest, I don't really feel like keyword belongs in color convert, but eh.\n\t'keyword',\n\n\t// Gray conflicts with some method names, and has its own method defined.\n\t'gray',\n\n\t// Shouldn't really be in color-convert either...\n\t'hex',\n];\n\nconst hashedModelKeys = {};\nfor (const model of Object.keys(convert)) {\n\thashedModelKeys[[...convert[model].labels].sort().join('')] = model;\n}\n\nconst limiters = {};\n\nfunction Color(object, model) {\n\tif (!(this instanceof Color)) {\n\t\treturn new Color(object, model);\n\t}\n\n\tif (model && model in skippedModels) {\n\t\tmodel = null;\n\t}\n\n\tif (model && !(model in convert)) {\n\t\tthrow new Error('Unknown model: ' + model);\n\t}\n\n\tlet i;\n\tlet channels;\n\n\tif (object == null) { // eslint-disable-line no-eq-null,eqeqeq\n\t\tthis.model = 'rgb';\n\t\tthis.color = [0, 0, 0];\n\t\tthis.valpha = 1;\n\t} else if (object instanceof Color) {\n\t\tthis.model = object.model;\n\t\tthis.color = [...object.color];\n\t\tthis.valpha = object.valpha;\n\t} else if (typeof object === 'string') {\n\t\tconst result = colorString.get(object);\n\t\tif (result === null) {\n\t\t\tthrow new Error('Unable to parse color from string: ' + object);\n\t\t}\n\n\t\tthis.model = result.model;\n\t\tchannels = convert[this.model].channels;\n\t\tthis.color = result.value.slice(0, channels);\n\t\tthis.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;\n\t} else if (object.length > 0) {\n\t\tthis.model = model || 'rgb';\n\t\tchannels = convert[this.model].channels;\n\t\tconst newArray = Array.prototype.slice.call(object, 0, channels);\n\t\tthis.color = zeroArray(newArray, channels);\n\t\tthis.valpha = typeof object[channels] === 'number' ? object[channels] : 1;\n\t} else if (typeof object === 'number') {\n\t\t// This is always RGB - can be converted later on.\n\t\tthis.model = 'rgb';\n\t\tthis.color = [\n\t\t\t(object >> 16) & 0xFF,\n\t\t\t(object >> 8) & 0xFF,\n\t\t\tobject & 0xFF,\n\t\t];\n\t\tthis.valpha = 1;\n\t} else {\n\t\tthis.valpha = 1;\n\n\t\tconst keys = Object.keys(object);\n\t\tif ('alpha' in object) {\n\t\t\tkeys.splice(keys.indexOf('alpha'), 1);\n\t\t\tthis.valpha = typeof object.alpha === 'number' ? object.alpha : 0;\n\t\t}\n\n\t\tconst hashedKeys = keys.sort().join('');\n\t\tif (!(hashedKeys in hashedModelKeys)) {\n\t\t\tthrow new Error('Unable to parse color from object: ' + JSON.stringify(object));\n\t\t}\n\n\t\tthis.model = hashedModelKeys[hashedKeys];\n\n\t\tconst {labels} = convert[this.model];\n\t\tconst color = [];\n\t\tfor (i = 0; i < labels.length; i++) {\n\t\t\tcolor.push(object[labels[i]]);\n\t\t}\n\n\t\tthis.color = zeroArray(color);\n\t}\n\n\t// Perform limitations (clamping, etc.)\n\tif (limiters[this.model]) {\n\t\tchannels = convert[this.model].channels;\n\t\tfor (i = 0; i < channels; i++) {\n\t\t\tconst limit = limiters[this.model][i];\n\t\t\tif (limit) {\n\t\t\t\tthis.color[i] = limit(this.color[i]);\n\t\t\t}\n\t\t}\n\t}\n\n\tthis.valpha = Math.max(0, Math.min(1, this.valpha));\n\n\tif (Object.freeze) {\n\t\tObject.freeze(this);\n\t}\n}\n\nColor.prototype = {\n\ttoString() {\n\t\treturn this.string();\n\t},\n\n\ttoJSON() {\n\t\treturn this[this.model]();\n\t},\n\n\tstring(places) {\n\t\tlet self = this.model in colorString.to ? this : this.rgb();\n\t\tself = self.round(typeof places === 'number' ? places : 1);\n\t\tconst args = self.valpha === 1 ? self.color : [...self.color, this.valpha];\n\t\treturn colorString.to[self.model](args);\n\t},\n\n\tpercentString(places) {\n\t\tconst self = this.rgb().round(typeof places === 'number' ? places : 1);\n\t\tconst args = self.valpha === 1 ? self.color : [...self.color, this.valpha];\n\t\treturn colorString.to.rgb.percent(args);\n\t},\n\n\tarray() {\n\t\treturn this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];\n\t},\n\n\tobject() {\n\t\tconst result = {};\n\t\tconst {channels} = convert[this.model];\n\t\tconst {labels} = convert[this.model];\n\n\t\tfor (let i = 0; i < channels; i++) {\n\t\t\tresult[labels[i]] = this.color[i];\n\t\t}\n\n\t\tif (this.valpha !== 1) {\n\t\t\tresult.alpha = this.valpha;\n\t\t}\n\n\t\treturn result;\n\t},\n\n\tunitArray() {\n\t\tconst rgb = this.rgb().color;\n\t\trgb[0] /= 255;\n\t\trgb[1] /= 255;\n\t\trgb[2] /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.push(this.valpha);\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tunitObject() {\n\t\tconst rgb = this.rgb().object();\n\t\trgb.r /= 255;\n\t\trgb.g /= 255;\n\t\trgb.b /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.alpha = this.valpha;\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tround(places) {\n\t\tplaces = Math.max(places || 0, 0);\n\t\treturn new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);\n\t},\n\n\talpha(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);\n\t\t}\n\n\t\treturn this.valpha;\n\t},\n\n\t// Rgb\n\tred: getset('rgb', 0, maxfn(255)),\n\tgreen: getset('rgb', 1, maxfn(255)),\n\tblue: getset('rgb', 2, maxfn(255)),\n\n\thue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),\n\n\tsaturationl: getset('hsl', 1, maxfn(100)),\n\tlightness: getset('hsl', 2, maxfn(100)),\n\n\tsaturationv: getset('hsv', 1, maxfn(100)),\n\tvalue: getset('hsv', 2, maxfn(100)),\n\n\tchroma: getset('hcg', 1, maxfn(100)),\n\tgray: getset('hcg', 2, maxfn(100)),\n\n\twhite: getset('hwb', 1, maxfn(100)),\n\twblack: getset('hwb', 2, maxfn(100)),\n\n\tcyan: getset('cmyk', 0, maxfn(100)),\n\tmagenta: getset('cmyk', 1, maxfn(100)),\n\tyellow: getset('cmyk', 2, maxfn(100)),\n\tblack: getset('cmyk', 3, maxfn(100)),\n\n\tx: getset('xyz', 0, maxfn(95.047)),\n\ty: getset('xyz', 1, maxfn(100)),\n\tz: getset('xyz', 2, maxfn(108.833)),\n\n\tl: getset('lab', 0, maxfn(100)),\n\ta: getset('lab', 1),\n\tb: getset('lab', 2),\n\n\tkeyword(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\treturn convert[this.model].keyword(this.color);\n\t},\n\n\thex(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\treturn colorString.to.hex(this.rgb().round().color);\n\t},\n\n\thexa(value) {\n\t\tif (value !== undefined) {\n\t\t\treturn new Color(value);\n\t\t}\n\n\t\tconst rgbArray = this.rgb().round().color;\n\n\t\tlet alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();\n\t\tif (alphaHex.length === 1) {\n\t\t\talphaHex = '0' + alphaHex;\n\t\t}\n\n\t\treturn colorString.to.hex(rgbArray) + alphaHex;\n\t},\n\n\trgbNumber() {\n\t\tconst rgb = this.rgb().color;\n\t\treturn ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);\n\t},\n\n\tluminosity() {\n\t\t// http://www.w3.org/TR/WCAG20/#relativeluminancedef\n\t\tconst rgb = this.rgb().color;\n\n\t\tconst lum = [];\n\t\tfor (const [i, element] of rgb.entries()) {\n\t\t\tconst chan = element / 255;\n\t\t\tlum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;\n\t\t}\n\n\t\treturn 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];\n\t},\n\n\tcontrast(color2) {\n\t\t// http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n\t\tconst lum1 = this.luminosity();\n\t\tconst lum2 = color2.luminosity();\n\n\t\tif (lum1 > lum2) {\n\t\t\treturn (lum1 + 0.05) / (lum2 + 0.05);\n\t\t}\n\n\t\treturn (lum2 + 0.05) / (lum1 + 0.05);\n\t},\n\n\tlevel(color2) {\n\t\t// https://www.w3.org/TR/WCAG/#contrast-enhanced\n\t\tconst contrastRatio = this.contrast(color2);\n\t\tif (contrastRatio >= 7) {\n\t\t\treturn 'AAA';\n\t\t}\n\n\t\treturn (contrastRatio >= 4.5) ? 'AA' : '';\n\t},\n\n\tisDark() {\n\t\t// YIQ equation from http://24ways.org/2010/calculating-color-contrast\n\t\tconst rgb = this.rgb().color;\n\t\tconst yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;\n\t\treturn yiq < 128;\n\t},\n\n\tisLight() {\n\t\treturn !this.isDark();\n\t},\n\n\tnegate() {\n\t\tconst rgb = this.rgb();\n\t\tfor (let i = 0; i < 3; i++) {\n\t\t\trgb.color[i] = 255 - rgb.color[i];\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tlighten(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[2] += hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdarken(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[2] -= hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tsaturate(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[1] += hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdesaturate(ratio) {\n\t\tconst hsl = this.hsl();\n\t\thsl.color[1] -= hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\twhiten(ratio) {\n\t\tconst hwb = this.hwb();\n\t\thwb.color[1] += hwb.color[1] * ratio;\n\t\treturn hwb;\n\t},\n\n\tblacken(ratio) {\n\t\tconst hwb = this.hwb();\n\t\thwb.color[2] += hwb.color[2] * ratio;\n\t\treturn hwb;\n\t},\n\n\tgrayscale() {\n\t\t// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale\n\t\tconst rgb = this.rgb().color;\n\t\tconst value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;\n\t\treturn Color.rgb(value, value, value);\n\t},\n\n\tfade(ratio) {\n\t\treturn this.alpha(this.valpha - (this.valpha * ratio));\n\t},\n\n\topaquer(ratio) {\n\t\treturn this.alpha(this.valpha + (this.valpha * ratio));\n\t},\n\n\trotate(degrees) {\n\t\tconst hsl = this.hsl();\n\t\tlet hue = hsl.color[0];\n\t\thue = (hue + degrees) % 360;\n\t\thue = hue < 0 ? 360 + hue : hue;\n\t\thsl.color[0] = hue;\n\t\treturn hsl;\n\t},\n\n\tmix(mixinColor, weight) {\n\t\t// Ported from sass implementation in C\n\t\t// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209\n\t\tif (!mixinColor || !mixinColor.rgb) {\n\t\t\tthrow new Error('Argument to \"mix\" was not a Color instance, but rather an instance of ' + typeof mixinColor);\n\t\t}\n\n\t\tconst color1 = mixinColor.rgb();\n\t\tconst color2 = this.rgb();\n\t\tconst p = weight === undefined ? 0.5 : weight;\n\n\t\tconst w = 2 * p - 1;\n\t\tconst a = color1.alpha() - color2.alpha();\n\n\t\tconst w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;\n\t\tconst w2 = 1 - w1;\n\n\t\treturn Color.rgb(\n\t\t\tw1 * color1.red() + w2 * color2.red(),\n\t\t\tw1 * color1.green() + w2 * color2.green(),\n\t\t\tw1 * color1.blue() + w2 * color2.blue(),\n\t\t\tcolor1.alpha() * p + color2.alpha() * (1 - p));\n\t},\n};\n\n// Model conversion methods and static constructors\nfor (const model of Object.keys(convert)) {\n\tif (skippedModels.includes(model)) {\n\t\tcontinue;\n\t}\n\n\tconst {channels} = convert[model];\n\n\t// Conversion methods\n\tColor.prototype[model] = function (...args) {\n\t\tif (this.model === model) {\n\t\t\treturn new Color(this);\n\t\t}\n\n\t\tif (args.length > 0) {\n\t\t\treturn new Color(args, model);\n\t\t}\n\n\t\treturn new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);\n\t};\n\n\t// 'static' construction methods\n\tColor[model] = function (...args) {\n\t\tlet color = args[0];\n\t\tif (typeof color === 'number') {\n\t\t\tcolor = zeroArray(args, channels);\n\t\t}\n\n\t\treturn new Color(color, model);\n\t};\n}\n\nfunction roundTo(number, places) {\n\treturn Number(number.toFixed(places));\n}\n\nfunction roundToPlace(places) {\n\treturn function (number) {\n\t\treturn roundTo(number, places);\n\t};\n}\n\nfunction getset(model, channel, modifier) {\n\tmodel = Array.isArray(model) ? model : [model];\n\n\tfor (const m of model) {\n\t\t(limiters[m] || (limiters[m] = []))[channel] = modifier;\n\t}\n\n\tmodel = model[0];\n\n\treturn function (value) {\n\t\tlet result;\n\n\t\tif (value !== undefined) {\n\t\t\tif (modifier) {\n\t\t\t\tvalue = modifier(value);\n\t\t\t}\n\n\t\t\tresult = this[model]();\n\t\t\tresult.color[channel] = value;\n\t\t\treturn result;\n\t\t}\n\n\t\tresult = this[model]().color[channel];\n\t\tif (modifier) {\n\t\t\tresult = modifier(result);\n\t\t}\n\n\t\treturn result;\n\t};\n}\n\nfunction maxfn(max) {\n\treturn function (v) {\n\t\treturn Math.max(0, Math.min(max, v));\n\t};\n}\n\nfunction assertArray(value) {\n\treturn Array.isArray(value) ? value : [value];\n}\n\nfunction zeroArray(array, length) {\n\tfor (let i = 0; i < length; i++) {\n\t\tif (typeof array[i] !== 'number') {\n\t\t\tarray[i] = 0;\n\t\t}\n\t}\n\n\treturn array;\n}\n\nmodule.exports = Color;\n", "export function sleepSync(ms: number) {\n const end = new Date().getTime() + ms;\n let time = new Date().getTime();\n while (time < end) {\n time = new Date().getTime();\n }\n return time;\n}\n\nexport function uuid() {\n return sleepSync(1).toString(36);\n}", "export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\n", "/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n\n/**\n * @param {string[]} array\n * @param {RegExp} pattern\n * @return {string[]}\n */\nexport function filter (array, pattern) {\n\treturn array.filter(function (value) { return !match(value, pattern) })\n}\n", "import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {object[]} siblings\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length, siblings) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props)\n}\n\n/**\n * @param {object} root\n */\nexport function lift (root) {\n\twhile (root.root)\n\t\troot = copy(root.root, {children: [root]})\n\n\tappend(root, root.siblings)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n", "import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @param {object[]} siblings\n * @return {object}\n */\nexport function comment (value, root, parent, siblings) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function declaration (value, root, parent, length, siblings) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings)\n}\n", "import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\n\tfor (var i = 0; i < children.length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: if (!strlen(element.value = element.props.join(','))) return ''\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n", "import { compile, serialize, stringify } from 'stylis';\n\nexport function stylis(css: string) {\n return serialize(compile(css), stringify);\n}\n", "import { uuid } from './util.js';\nimport { stylis } from './cssProcessor/stylis.bundle.js';\n\ntype Constructor = new (...args: any[]) => T;\n\nexport function AdapterMixin>(\n Base: TBase\n) {\n return class Adapter extends Base {\n /** CSSStyleSheet() for this component */\n static _cssStyleSheet: CSSStyleSheet;\n\n /** Tag name of this component */\n static _tagName: string | null;\n\n /** Styles which contain only css for this component */\n static _styles: string[] = [];\n\n /** CSS Process middleware, This function will be called\n * before applying CSS to CSSStyleSheet.\n */\n static cssProcess(css: string): string {\n return css;\n }\n\n /**\n * Retreive styles for this component,\n * also prevent inherit values from super class.\n */\n static get styles(): string[] {\n if (this._styles === Object.getPrototypeOf(this).styles) {\n this._styles = [];\n }\n return this._styles;\n }\n\n /** Retreive inherited styles for all super classes. */\n static get allStyles(): string[] {\n let superClass = Object.getPrototypeOf(this);\n const allStyles = [];\n\n while (superClass.styles !== undefined) {\n allStyles.push(...superClass.styles);\n superClass = Object.getPrototypeOf(superClass);\n }\n allStyles.push(...this.styles);\n return allStyles;\n }\n\n /** Set CSS for this component */\n static set css(css: string) {\n this._styles = [css];\n\n if (this.tagName) {\n this.cssStyleSheet.replaceSync(\n this.cssProcess(`${this.tagName} { ${this.allCSS} }`)\n );\n }\n }\n\n /** Get CSS for this component, includes inherited styles */\n static get css(): string {\n return this.styles.join(\"\\n\");\n }\n\n static get allCSS(): string {\n return this.allStyles.join(\"\\n\");\n }\n\n /** Get tagName for this class which will be defined after\n * the class has been registerd with CustomElementsRegistry.\n */\n static get tagName(): string | null {\n if (this._tagName === Object.getPrototypeOf(this).tagName) {\n this._tagName = null;\n }\n return this._tagName;\n }\n\n /** Get CSSStyleSheet() for this component.\n * Create a new one if haven't been created yet.\n */\n static get cssStyleSheet(): CSSStyleSheet {\n const superCSSStyleSheet = Object.getPrototypeOf(this)._cssStyleSheet;\n if (this._cssStyleSheet === superCSSStyleSheet) {\n this._cssStyleSheet = new CSSStyleSheet();\n }\n return this._cssStyleSheet;\n }\n\n /** Add style to this component */\n static addStyle(css: string) {\n this._styles = this._styles.concat(css);\n\n if (this.tagName) {\n const rule = `${this.tagName} { ${css} }`;\n const processedCss = this.cssProcess(rule);\n this.cssStyleSheet.insertRule(\n processedCss,\n this.cssStyleSheet.cssRules.length\n );\n }\n }\n\n /**\n * Define component to element tag and init component style.\n * To extends this function, sub-elements must be defined\n * before call this function as `super.define(tagName);`\n */\n static define(tagName: string): void {\n this._tagName = tagName;\n customElements.define(tagName, this);\n this.initStyle();\n }\n\n /** Init component style */\n static initStyle() {\n this.cssStyleSheet.replaceSync(\n this.cssProcess(`${this.tagName} { ${this.allCSS} }`)\n );\n document.adoptedStyleSheets.push(this.cssStyleSheet);\n }\n /** @deprecated, will be removed */\n static tagStyle(css: string): void {\n console.warn('tagStyle() is deprecated, use addStyle() instead');\n this.addStyle(css);\n }\n\n /** @deprecated, will be removed */\n static classStyle(class_: string, css: string) {\n console.warn('classStyle() is deprecated, use addStyle() instead');\n this.addStyle(`&.${class_} { ${css} }`);\n }\n\n _class!: typeof Adapter; // instance's class for using as shortcut\n\n _cssStyleSheet?: CSSStyleSheet;\n\n // index of this.cssStyleSheet in document.adoptedStyleSheets\n adoptedStyleSheetIndex!: number;\n\n _uuid?: string;\n\n _shadowRoot!: ShadowRoot|null;\n\n /**\n * In constructor, there any some if condition to check\n * if it has been inited or not to prevent recursive call in Mixin\n */\n constructor(...args: any[]) {\n super(...args);\n if (!this._class) { this.initClass() };\n }\n\n /** Dynamically create and return uuid for the element */\n get uuid(): string {\n if (!this._uuid) {\n this._uuid = `${this.tagName}-${uuid()}`;\n }\n return this._uuid;\n }\n\n /**\n * Dynamically create a CSSStyleSheet() and keep track of the adopted\n * stylesheet index for reference.\n */\n get cssStyleSheet() {\n if (this._cssStyleSheet) { return this._cssStyleSheet };\n\n this._cssStyleSheet = new CSSStyleSheet();\n\n /** For normal element, attach this._cssStyleSheet to the document */\n if (!this._shadowRoot) {\n const index = document.adoptedStyleSheets.length;\n this.classList.add(this.uuid);\n document.adoptedStyleSheets[index] = this._cssStyleSheet;\n this.adoptedStyleSheetIndex = index;\n }\n\n return this._cssStyleSheet;\n }\n\n /**\n * Return a selector for the this element as a class chain.\n */\n get objectClassSelector(): string {\n return this.classList.value.replace(/ /g, \".\");\n }\n\n /**\n * Set CSS for this element.\n * It works like `` but with CSS processor.\n */\n set css(css: string) {\n // Init cssStyleSheet if it hasn't been inited yet.\n this.cssStyleSheet;\n\n const processedCss = this._class.cssProcess(\n `${this.tagName}.${this.objectClassSelector} { ${css} }`\n );\n \n this.cssStyleSheet.replaceSync(processedCss);\n }\n\n /** Get CSS for this element */\n get css(): string {\n let css = ``;\n for (const rule of this.cssStyleSheet.cssRules) {\n css += rule.cssText + \"\\n\";\n }\n return css;\n }\n\n initClass() {\n this._class = this.constructor as unknown as typeof Adapter;\n\n /**\n * If class tagName has been defined from somewhere else.\n * Then it shouldn't be initialized again.\n */\n if (this._class.tagName) {\n return;\n }\n this._class._tagName = this.tagName;\n this._class.initStyle();\n }\n\n /** Override super.attachShadow()\n * to add this.cssStyleSheet to shadowRoot\n */\n attachShadow(init: ShadowRootInit): ShadowRoot {\n const shadowRoot = super.attachShadow(init);\n shadowRoot.adoptedStyleSheets = [\n this._class.cssStyleSheet,\n this.cssStyleSheet\n ];\n document.adoptedStyleSheets.splice(this.adoptedStyleSheetIndex, 1);\n this._shadowRoot = shadowRoot;\n return shadowRoot;\n }\n\n /** Add style for this element */\n addStyle(css: string): void {\n // Init cssStyleSheet if it hasn't been inited yet.\n this.cssStyleSheet;\n\n const processedCss = this._class.cssProcess(\n `${this.tagName}.${this.objectClassSelector} { ${css} }`\n );\n\n this.cssStyleSheet.insertRule(\n processedCss,\n this.cssStyleSheet.cssRules.length\n );\n }\n\n /** Remove the element from DOM and remove adoptedStyleSheet */\n delete() {\n if (!this._shadowRoot) {\n document.adoptedStyleSheets.splice(this.adoptedStyleSheetIndex, 1)\n };\n this.remove();\n }\n };\n}\n\nexport class Adapter extends AdapterMixin(HTMLElement) {\n static cssProcess(css: string): string {\n return stylis(css);\n }\n}\n", "import Color from \"color\";\n\nfunction bgColor(color) {\n return /*css*/`\n background-color: ${color};\n color: ${Color(color).isDark() ? 'white' : 'black'};\n `.trim();\n}\n\nfunction lift(level: number, color: string = 'black') {\n return `filter: drop-shadow(0 0 ${level * 2}px ${color});`;\n}\n\nfunction pxToRem(px: any) {\n px = parseFloat(px);\n const rem1 = parseFloat(\n getComputedStyle(document.documentElement).fontSize);\n return `${px / rem1}rem`;\n}\n\nconst aspectRatio = (ratio: string = '1/1'): string => {\n return `\n height: auto;\n aspect-ratio: ${ratio};\n @supports not (aspect-ratio: ${ratio}) {\n &::before {\n float: left;\n padding-top: 100% / ${ratio};\n content: \"\";\n }\n\n &::after {\n display: block;\n content: \"\";\n clear: both;\n }\n }\n `.trim();\n}\n\nexport { bgColor, lift, pxToRem, aspectRatio };", "const color = {\n blue: \"#3584e4\",\n green: \"#33d17a\",\n yellow: \"#f6d32d\",\n orange: \"#ff7800\",\n red: \"#e01b24\",\n purple: \"#9141ac\",\n violet: \"#9141ac\",\n brown: \"#986a44\",\n light: \"#deddda\",\n dark: \"#3d3846\"\n}\n\nexport { color };", "import { Adapter } from \"../../adapter.js\";\nimport { bgColor, pxToRem } from '../style';\nimport { color } from '../designToken';\n\n\ninterface MenuStyleParam {\n itemCSS?: string;\n itemHoverCSS?: string;\n}\n\nfunction menuStyle(param: MenuStyleParam = {}) {\n\n return /*css*/`\n div[class] {all: unset};\n\n & {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n width: 100%;\n }\n\n details, details[class] {\n width: 100%;\n overflow: hidden;\n > div.container {\n display: block;\n box-sizing: border-box;\n border-left: 0.2rem groove;\n border-bottom-left-radius: 0.3rem;\n border-top-left-radius: 0.3rem;\n margin-left: 0.6rem;\n transition: height 0.3s ease;\n }\n }\n\n /** Item CSS */\n div.container {\n > div:not(:has(details)),\n > div:has(details) summary {\n display: flex;\n box-sizing: border-box;\n padding-left: 0.5rem;\n line-height: 2.5;\n ${param.itemCSS}\n }\n }\n\n /** Item Hover CSS */\n summary:has(> a), div:has(> a) {\n &:hover {\n ${bgColor(color.light)}\n ${param.itemHoverCSS}\n }\n }\n\n details > summary > .toggle {\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 1.5rem;\n min-width: 3rem;\n cursor: pointer;\n user-select: none;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n transition: transform 0.3s ease;\n transform: rotate(0deg)\n }\n\n details.open > summary > .toggle {\n transition: transform 0.3s ease;\n transform: rotate(90deg);\n }\n\n summary {\n list-style: none;\n display: flex;\n box-sizing: border-box;\n width: 100%;\n padding-left: 0.5rem;\n }\n\n a {\n width: 100%;\n }\n `.trim();\n}\n\nclass Menu extends Adapter {\n static css = menuStyle();\n static style = menuStyle;\n\n constructor() {\n super();\n this.addEventListener('click', (e) => {\n const target = e.target as HTMLElement;\n if (target.tagName.toLowerCase() === 'summary') {\n e.preventDefault();\n return\n };\n if (!target.classList.contains('toggle')) { \n return;\n };\n e.preventDefault();\n let el_details = target.closest(`${this.tagName} summary`) as HTMLDetailsElement;\n\n if (!el_details) {return};\n el_details = el_details.parentElement as HTMLDetailsElement;\n el_details.open ? this.close(el_details) : this.open(el_details);\n });\n }\n\n open(el_details?: HTMLDetailsElement) {\n if (!el_details) {\n el_details = this.querySelector('details') as HTMLDetailsElement;\n };\n el_details.classList.add('open');\n const el_parentContainer :HTMLElement = el_details\n .parentElement!\n .closest(`${this.tagName} div.container`)! as HTMLElement;\n el_parentContainer ? el_parentContainer.style.height = \"auto\" : null;\n\n const el_container: HTMLElement = el_details\n .querySelector('div.container') as HTMLElement;\n\n const height = pxToRem(getComputedStyle(el_container).height);\n\n let parentDetailsElement = el_details\n .parentElement!\n .closest(`${this.tagName} details`) as HTMLDetailsElement;\n while (parentDetailsElement) {\n parentDetailsElement.open ? null : this.open(parentDetailsElement);\n parentDetailsElement = parentDetailsElement\n .parentElement!\n .closest('details') as HTMLDetailsElement;\n }\n\n el_details.open = true;\n el_container.style.height = \"0\";\n setTimeout(() => {\n el_container.style.height = height;\n }, 0);\n return this;\n }\n\n expand(el_details: HTMLDetailsElement) {\n let childDetailsElement = el_details\n .querySelector('details') as HTMLDetailsElement;\n while (childDetailsElement) {\n this.open(childDetailsElement);\n childDetailsElement = childDetailsElement\n .querySelector('details') as HTMLDetailsElement;\n }\n }\n\n close(el_details: HTMLDetailsElement) {\n el_details.classList.remove('open');\n const el_container: HTMLElement = el_details.querySelector('div.container')!;\n el_container.style.height = pxToRem(getComputedStyle(el_container).height);\n setTimeout(() => {\n el_container.style.height = \"0\";\n }, 0);\n setTimeout(() => {\n el_details.open = false;\n el_container.style.height = \"auto\";\n }, 300);\n }\n\n collapse(el_details: HTMLDetailsElement) {\n this.close(el_details);\n let childDetailsElement = el_details\n .querySelector('details') as HTMLDetailsElement;\n while (childDetailsElement) {\n this.close(childDetailsElement);\n childDetailsElement = childDetailsElement\n .querySelector('details') as HTMLDetailsElement;\n }\n }\n}\n\nexport { Menu };", "import { Menu as _Menu } from '../../_ux/ui/menu';\n\n\nclass Menu extends _Menu {\n static css = /*css*/`\n ${_Menu.style()}\n a {\n width: 100%;\n text-decoration: none;\n color: unset;\n }\n summary {\n h2 {\n font-size: 1.25rem;\n line-height: 2;\n margin: 0;\n padding-left: 0.5rem;\n }\n }\n `;\n};\n\nexport { Menu };", "function baseStyle() {\n const cssStyleSheet = new CSSStyleSheet();\n cssStyleSheet.replaceSync(/*css*/`\n body {\n display: flex;\n justify-content: center;\n padding: 0;\n > el-container:first-of-type {\n margin-top: 2rem;\n }\n }\n h1, h2, h3 {\n margin: auto;\n max-width: 80ch;\n }\n h1 {\n text-align: center\n }\n h2{\n margin-top: 2.5rem;\n }\n h3 {\n margin-top: 1.5rem;\n }\n p {\n margin: 1rem auto;\n }\n `);\n document.adoptedStyleSheets.push(cssStyleSheet);\n};\n\nexport { baseStyle };", "import Color from 'color';\n\nimport { aspectRatio, bgColor } from '../../_ux/style';\nimport { buttonStyle } from '../../_ux/ui/button';\nimport { color } from '../../_ux/designToken';\nimport { Sidebar as _Sidebar } from '../../_ux/ui/sidebar';\n\n\nconst sideBarStyle = /*css*/`\n & {\n height: 110dvh;\n ${bgColor(color.dark)}\n }\n\n filter: drop-shadow(2px 2px 4px ${Color(color.dark)\n .alpha(0.8).string()});\n\n &.show {\n filter: drop-shadow(2px 2px 4px ${Color(color.dark)\n .alpha(0.8).string()});\n [el=\"toggle\"] {\n span { transform: rotate(180deg) }\n };\n }\n \n &.hide {\n filter: none;\n [el=\"toggle\"] {\n span { transform: rotate(0deg) }\n };\n }\n\n el-button[el=\"toggle\"] {\n ${buttonStyle('blue')}\n display: flex;\n justify-content: center;\n align-items: stretch;\n position: fixed;\n top: 70dvh;\n right: 0;\n width: 3em;\n transform: translateX(100%);\n opacity: 0.7;\n &:hover { opacity: 1 };\n ${aspectRatio('1')}\n button {\n width: 100%;\n height: 100%;\n border-top-left-radius:0 ;\n border-bottom-left-radius: 0;\n }\n span {\n line-height: 1;\n font-size: 1.5em;\n transition: transform 0.4s ease;\n transform: rotate(0deg);\n }\n }\n`;\n\nclass Sidebar extends _Sidebar {\n static css = /*css*/`\n ${Sidebar.style()}\n ${sideBarStyle}\n `;\n\n constructor() {\n super();\n this.querySelector('[el=\"toggle\"]')?.addEventListener('click', () => { \n this.toggle();\n });\n\n let mql = window.matchMedia('screen and (max-width: 1200px)');\n setTimeout(() => {\n this.onMediaQueryChange(mql);\n }, 0);\n setTimeout(() => {\n mql.addEventListener('change', () => {\n this.onMediaQueryChange(mql);\n });\n }, 750);\n }\n\n onMediaQueryChange(mql: MediaQueryList) {\n mql.matches ? this.hide() : this.show();\n }\n\n show() {\n super.show();\n this.dispatchEvent(new CustomEvent('show'));\n }\n\n hide() {\n super.hide();\n this.dispatchEvent(new CustomEvent('hide'));\n }\n}\n\nexport { Sidebar };", "import { Adapter } from \"../../adapter.js\";\nimport Color from 'color';\nimport { bgColor, lift } from '../style';\n\nconst buttonStyle = (color) => {\n return /*css*/`\n & {\n display: inline-flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n }\n\n & button {\n display: inline-flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n border: 0;\n border-radius: 0.25rem;\n padding: 0.5rem 0.7rem;\n font-weight: bold;\n line-height: 1;\n cursor: pointer;\n ${lift(0.7, '#555')}\n ${bgColor(color)}\n &:hover {\n background-color: ${Color(color)\n .lighten(0.1)\n .saturate(0.1)};\n ${lift(1.1, '#555')}\n }\n &:active {\n background-color: ${Color(color)\n .darken(0.1)\n .saturate(-0.1)};\n ${lift(0.5, '#555')}\n }\n }\n `\n}\n\nclass Button extends Adapter {\n initialHTML = this.innerHTML;\n\n constructor() {\n super();\n this.render();\n }\n\n render() {\n this.innerHTML = ``;\n }\n};\n\nexport { buttonStyle, Button };", "import { Adapter } from \"../../adapter.js\";\n\nconst sidebarStyle = (): string => {\n const style = /*css*/`\n & {\n all: unset;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n align-content: flex-start;\n box-sizing: border-box;\n position: fixed;\n left: 0;\n z-index: 100;\n width: 28ch;\n min-height: 50dvh;\n padding-top: 30dvh;\n padding-bottom: 20dvh;\n background-color: white;\n transition: transform 0.4s ease;\n transform: translateX(0);\n }\n\n &.show {\n transform: translateX(0);\n }\n \n &.hide {\n transform: translateX(-100%);\n }\n\n `.trim();\n return style;\n};\n\nclass Sidebar extends Adapter {\n static css = `${sidebarStyle()}`;\n static style = sidebarStyle;\n\n constructor() {\n super();\n }\n\n show() {\n this.classList.remove('hide');\n this.classList.add('show');\n }\n\n hide() {\n this.classList.remove('show');\n this.classList.add('hide');\n }\n\n toggle() {\n if (this.classList.contains('show')) {\n this.hide();\n } else {\n this.show();\n }\n }\n};\n\nexport { Sidebar };", "import { Adapter } from '../../adapter';\n\n\nclass Container extends Adapter {\n static css = /*css*/`& {\n all: unset;\n display: block;\n box-sizing: border-box;\n margin-bottom: 40dvh;\n max-width: 80ch;\n min-height: 100dvh;\n width: 90%;\n transition: margin-left 0.3s ease-in-out;\n }`;\n\n constructor() {\n super();\n const el_sidebar = document.querySelector('el-sidebar') as HTMLElement;\n setTimeout(() => {\n this.css = this.defaultStyle();\n }, 0);\n el_sidebar.addEventListener('hide', () => {\n this.addStyle(`margin: unset;`);\n });\n el_sidebar.addEventListener('show', () => {\n this.css = this.defaultStyle();\n });\n }\n\n defaultStyle(): string {\n const el_sidebar = document.querySelector('el-sidebar') as HTMLElement;\n return /*css*/`& {\n @media screen and (min-width: 1200px) {\n width: 68%;\n margin-left: calc(${getComputedStyle(el_sidebar).width});\n }\n }`;\n }\n};\n\nexport { Container };", "/** 3rd Party */\nimport { Sidebar as _Sidebar } from '../_ux/ui/sidebar';\nimport { Menu } from './_ui/menu';\nimport { baseStyle as guideBaseStyle } from './_base.style';\n\nimport { Sidebar } from './_ui/sidebar';\nimport { Container } from './_ui/container';\n\nguideBaseStyle();\n\nMenu.define('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AiB,OAAQ,IAAM;AACtC,KAAK,IAAM,KAAK,aAAa,CACjC,CAAC,CACL,CAEA,cAAuB,CACnB,IAAM,WAAa,SAAS;AAAc,YAAY,EACtD,MAAc;AAAA;AAAA;AAAA,oCAGc,iBAAiB,UAAU,EAAE,KAAK;AAAA;AAAA,UAGlE,CACJ,EC9BA,UAAe,EAEfC,MAAK,OAAO,SAAS,EAErBC,SAAQ,OAAO,YAAY,EAC3B,UAAU;AAAO,cAAc", "names": ["slice", "color", "char", "node", "from", "Color", "color", "length", "length", "length", "character", "characters", "color", "Color", "Menu", "import_color", "import_color", "color", "Color", "Color", "Sidebar", "Menu", "Sidebar"] } diff --git a/docs/guide/examples/index.html b/docs/guide/examples/index.html new file mode 100644 index 0000000..bd8c5b7 --- /dev/null +++ b/docs/guide/examples/index.html @@ -0,0 +1,74 @@ + + + + + + + + Adapter : Adaptive Style Web Component Framework + + + + + + + + + + + + + + + + + + + + +
+ +

Intro

+
+
+ +
+ +

Setup

+
+
+
+ + +
+
+
+ +

Usage

+
+
+
+ +

Mixin

+
+
+
+ +

Style Filtering

+
+
+
+ » +
+ + + + + + \ No newline at end of file diff --git a/docs/guide/examples/index.js b/docs/guide/examples/index.js new file mode 100644 index 0000000..f853f19 --- /dev/null +++ b/docs/guide/examples/index.js @@ -0,0 +1,34622 @@ +var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __export=(target,all)=>{for(var name2 in all)__defProp(target,name2,{get:all[name2], +enumerable:!0})};var warn=console.warn.bind(console);console.warn=(...msgs)=>{typeof msgs[0]=="st\ +ring"&&msgs[0].includes("computations created outside")||warn(...msgs)};var sharedConfig={context:void 0,registry:void 0};function setHydrateContext(context){ +sharedConfig.context=context}__name(setHydrateContext,"setHydrateContext");function nextHydrateContext(){ +return{...sharedConfig.context,id:`${sharedConfig.context.id}${sharedConfig.context. +count++}-`,count:0}}__name(nextHydrateContext,"nextHydrateContext");var equalFn=__name( +(a,b)=>a===b,"equalFn"),$PROXY=Symbol("solid-proxy"),$TRACK=Symbol("solid-track"), +$DEVCOMP=Symbol("solid-dev-component"),signalOptions={equals:equalFn},ERROR=null, +runEffects=runQueue,STALE=1,PENDING=2,UNOWNED={owned:null,cleanups:null,context:null, +owner:null};var Owner=null,Transition=null,Scheduler=null,ExternalSourceConfig=null,Listener=null, +Updates=null,Effects=null,ExecCount=0;function createRoot(fn,detachedOwner){let listener=Listener, +owner=Owner,unowned=fn.length===0,current=detachedOwner===void 0?owner:detachedOwner, +root=unowned?UNOWNED:{owned:null,cleanups:null,context:current?current.context:null, +owner:current},updateFn=unowned?fn:()=>fn(()=>untrack(()=>cleanNode(root)));Owner= +root,Listener=null;try{return runUpdates(updateFn,!0)}finally{Listener=listener, +Owner=owner}}__name(createRoot,"createRoot");function createSignal(value,options){ +options=options?Object.assign({},signalOptions,options):signalOptions;let s={value, +observers:null,observerSlots:null,comparator:options.equals||void 0},setter=__name( +value2=>(typeof value2=="function"&&(Transition&&Transition.running&&Transition. +sources.has(s)?value2=value2(s.tValue):value2=value2(s.value)),writeSignal(s,value2)), +"setter");return[readSignal.bind(s),setter]}__name(createSignal,"createSignal"); +function createComputed(fn,value,options){let c3=createComputation(fn,value,!0,STALE); +Scheduler&&Transition&&Transition.running?Updates.push(c3):updateComputation(c3)} +__name(createComputed,"createComputed");function createRenderEffect(fn,value,options){ +let c3=createComputation(fn,value,!1,STALE);Scheduler&&Transition&&Transition.running? +Updates.push(c3):updateComputation(c3)}__name(createRenderEffect,"createRenderEf\ +fect");function createEffect(fn,value,options){runEffects=runUserEffects;let c3=createComputation( +fn,value,!1,STALE),s=SuspenseContext&&useContext(SuspenseContext);s&&(c3.suspense= +s),(!options||!options.render)&&(c3.user=!0),Effects?Effects.push(c3):updateComputation( +c3)}__name(createEffect,"createEffect");function createMemo(fn,value,options){options=options?Object.assign({},signalOptions, +options):signalOptions;let c3=createComputation(fn,value,!0,0);return c3.observers= +null,c3.observerSlots=null,c3.comparator=options.equals||void 0,Scheduler&&Transition&& +Transition.running?(c3.tState=STALE,Updates.push(c3)):updateComputation(c3),readSignal. +bind(c3)}__name(createMemo,"createMemo");function batch(fn){return runUpdates(fn,!1)}__name(batch,"batch");function untrack(fn){ +if(!ExternalSourceConfig&&Listener===null)return fn();let listener=Listener;Listener= +null;try{return ExternalSourceConfig?ExternalSourceConfig.untrack(fn):fn()}finally{ +Listener=listener}}__name(untrack,"untrack");function onCleanup(fn){return Owner===null||(Owner.cleanups===null?Owner.cleanups= +[fn]:Owner.cleanups.push(fn)),fn}__name(onCleanup,"onCleanup");function getListener(){return Listener}__name(getListener,"getListener");function getOwner(){ +return Owner}__name(getOwner,"getOwner");function runWithOwner(o,fn){let prev=Owner, +prevListener=Listener;Owner=o,Listener=null;try{return runUpdates(fn,!0)}catch(err){ +handleError(err)}finally{Owner=prev,Listener=prevListener}}__name(runWithOwner,"\ +runWithOwner");function startTransition(fn){if(Transition&&Transition.running)return fn(),Transition. +done;let l=Listener,o=Owner;return Promise.resolve().then(()=>{Listener=l,Owner= +o;let t;return(Scheduler||SuspenseContext)&&(t=Transition||(Transition={sources:new Set, +effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),t.done|| +(t.done=new Promise(res=>t.resolve=res)),t.running=!0),runUpdates(fn,!1),Listener= +Owner=null,t?t.done:void 0})}__name(startTransition,"startTransition");var[transPending, +setTransPending]=createSignal(!1);function createContext(defaultValue,options){let id=Symbol("context");return{id, +Provider:createProvider(id),defaultValue}}__name(createContext,"createContext"); +function useContext(context){return Owner&&Owner.context&&Owner.context[context. +id]!==void 0?Owner.context[context.id]:context.defaultValue}__name(useContext,"u\ +seContext");function children(fn){let children2=createMemo(fn),memo=createMemo(()=>resolveChildren( +children2()));return memo.toArray=()=>{let c3=memo();return Array.isArray(c3)?c3: +c3!=null?[c3]:[]},memo}__name(children,"children");var SuspenseContext;function readSignal(){let runningTransition=Transition&&Transition.running;if(this. +sources&&(runningTransition?this.tState:this.state))if((runningTransition?this.tState: +this.state)===STALE)updateComputation(this);else{let updates=Updates;Updates=null, +runUpdates(()=>lookUpstream(this),!1),Updates=updates}if(Listener){let sSlot=this. +observers?this.observers.length:0;Listener.sources?(Listener.sources.push(this), +Listener.sourceSlots.push(sSlot)):(Listener.sources=[this],Listener.sourceSlots= +[sSlot]),this.observers?(this.observers.push(Listener),this.observerSlots.push(Listener. +sources.length-1)):(this.observers=[Listener],this.observerSlots=[Listener.sources. +length-1])}return runningTransition&&Transition.sources.has(this)?this.tValue:this. +value}__name(readSignal,"readSignal");function writeSignal(node,value,isComp){let current=Transition&& +Transition.running&&Transition.sources.has(node)?node.tValue:node.value;if(!node. +comparator||!node.comparator(current,value)){if(Transition){let TransitionRunning=Transition. +running;(TransitionRunning||!isComp&&Transition.sources.has(node))&&(Transition. +sources.add(node),node.tValue=value),TransitionRunning||(node.value=value)}else node. +value=value;node.observers&&node.observers.length&&runUpdates(()=>{for(let i2=0;i2< +node.observers.length;i2+=1){let o=node.observers[i2],TransitionRunning=Transition&& +Transition.running;TransitionRunning&&Transition.disposed.has(o)||((TransitionRunning? +!o.tState:!o.state)&&(o.pure?Updates.push(o):Effects.push(o),o.observers&&markDownstream( +o)),TransitionRunning?o.tState=STALE:o.state=STALE)}if(Updates.length>1e6)throw Updates= +[],new Error},!1)}return value}__name(writeSignal,"writeSignal");function updateComputation(node){ +if(!node.fn)return;cleanNode(node);let time=ExecCount;runComputation(node,Transition&& +Transition.running&&Transition.sources.has(node)?node.tValue:node.value,time),Transition&& +!Transition.running&&Transition.sources.has(node)&&queueMicrotask(()=>{runUpdates( +()=>{Transition&&(Transition.running=!0),Listener=Owner=node,runComputation(node, +node.tValue,time),Listener=Owner=null},!1)})}__name(updateComputation,"updateCom\ +putation");function runComputation(node,value,time){let nextValue,owner=Owner,listener=Listener; +Listener=Owner=node;try{nextValue=node.fn(value)}catch(err){return node.pure&&(Transition&& +Transition.running?(node.tState=STALE,node.tOwned&&node.tOwned.forEach(cleanNode), +node.tOwned=void 0):(node.state=STALE,node.owned&&node.owned.forEach(cleanNode), +node.owned=null)),node.updatedAt=time+1,handleError(err)}finally{Listener=listener, +Owner=owner}(!node.updatedAt||node.updatedAt<=time)&&(node.updatedAt!=null&&"obs\ +ervers"in node?writeSignal(node,nextValue,!0):Transition&&Transition.running&&node. +pure?(Transition.sources.add(node),node.tValue=nextValue):node.value=nextValue,node. +updatedAt=time)}__name(runComputation,"runComputation");function createComputation(fn,init,pure,state=STALE,options){ +let c3={fn,state,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null, +value:init,owner:Owner,context:Owner?Owner.context:null,pure};if(Transition&&Transition. +running&&(c3.state=0,c3.tState=state),Owner===null||Owner!==UNOWNED&&(Transition&& +Transition.running&&Owner.pure?Owner.tOwned?Owner.tOwned.push(c3):Owner.tOwned=[ +c3]:Owner.owned?Owner.owned.push(c3):Owner.owned=[c3]),ExternalSourceConfig&&c3. +fn){let[track,trigger]=createSignal(void 0,{equals:!1}),ordinary=ExternalSourceConfig. +factory(c3.fn,trigger);onCleanup(()=>ordinary.dispose());let triggerInTransition=__name( +()=>startTransition(trigger).then(()=>inTransition.dispose()),"triggerInTransiti\ +on"),inTransition=ExternalSourceConfig.factory(c3.fn,triggerInTransition);c3.fn= +x2=>(track(),Transition&&Transition.running?inTransition.track(x2):ordinary.track( +x2))}return c3}__name(createComputation,"createComputation");function runTop(node){ +let runningTransition=Transition&&Transition.running;if((runningTransition?node. +tState:node.state)===0)return;if((runningTransition?node.tState:node.state)===PENDING) +return lookUpstream(node);if(node.suspense&&untrack(node.suspense.inFallback))return node. +suspense.effects.push(node);let ancestors=[node];for(;(node=node.owner)&&(!node. +updatedAt||node.updatedAt=0;i2--){if(node=ancestors[i2],runningTransition){ +let top=node,prev=ancestors[i2+1];for(;(top=top.owner)&&top!==prev;)if(Transition. +disposed.has(top))return}if((runningTransition?node.tState:node.state)===STALE)updateComputation( +node);else if((runningTransition?node.tState:node.state)===PENDING){let updates=Updates; +Updates=null,runUpdates(()=>lookUpstream(node,ancestors[0]),!1),Updates=updates}}} +__name(runTop,"runTop");function runUpdates(fn,init){if(Updates)return fn();let wait=!1; +init||(Updates=[]),Effects?wait=!0:Effects=[],ExecCount++;try{let res=fn();return completeUpdates( +wait),res}catch(err){wait||(Effects=null),Updates=null,handleError(err)}}__name( +runUpdates,"runUpdates");function completeUpdates(wait){if(Updates&&(Scheduler&& +Transition&&Transition.running?scheduleQueue(Updates):runQueue(Updates),Updates= +null),wait)return;let res;if(Transition){if(!Transition.promises.size&&!Transition. +queue.size){let sources=Transition.sources,disposed=Transition.disposed;Effects. +push.apply(Effects,Transition.effects),res=Transition.resolve;for(let e2 of Effects) +"tState"in e2&&(e2.state=e2.tState),delete e2.tState;Transition=null,runUpdates( +()=>{for(let d2 of disposed)cleanNode(d2);for(let v of sources){if(v.value=v.tValue, +v.owned)for(let i2=0,len=v.owned.length;i2runEffects(e),!1),res&&res()}__name(completeUpdates, +"completeUpdates");function runQueue(queue){for(let i2=0;i2{tasks2.delete(item),runUpdates(()=>{Transition. +running=!0,runTop(item)},!1),Transition&&(Transition.running=!1)}))}}__name(scheduleQueue, +"scheduleQueue");function runUserEffects(queue){let i2,userLength=0;for(i2=0;i2< +queue.length;i2++){let e=queue[i2];e.user?queue[userLength++]=e:runTop(e)}if(sharedConfig. +context){if(sharedConfig.count){sharedConfig.effects||(sharedConfig.effects=[]), +sharedConfig.effects.push(...queue.slice(0,userLength));return}else sharedConfig. +effects&&(queue=[...sharedConfig.effects,...queue],userLength+=sharedConfig.effects. +length,delete sharedConfig.effects);setHydrateContext()}for(i2=0;i2=0;i2--) +cleanNode(node.tOwned[i2]);delete node.tOwned}reset(node,!0)}else if(node.owned){ +for(i2=node.owned.length-1;i2>=0;i2--)cleanNode(node.owned[i2]);node.owned=null} +if(node.cleanups){for(i2=node.cleanups.length-1;i2>=0;i2--)node.cleanups[i2]();node. +cleanups=null}Transition&&Transition.running?node.tState=0:node.state=0}__name(cleanNode, +"cleanNode");function reset(node,top){if(top||(node.tState=0,Transition.disposed. +add(node)),node.owned)for(let i2=0;i2res=untrack(()=>(Owner.context={...Owner.context, +[id]:props.value},children(()=>props.children))),void 0),res},"provider")}__name( +createProvider,"createProvider");var FALLBACK=Symbol("fallback");var hydrationEnabled=!1;function createComponent(Comp,props){if(hydrationEnabled&&sharedConfig.context){ +let c3=sharedConfig.context;setHydrateContext(nextHydrateContext());let r3=untrack( +()=>Comp(props||{}));return setHydrateContext(c3),r3}return untrack(()=>Comp(props|| +{}))}__name(createComponent,"createComponent");function trueFn(){return!0}__name( +trueFn,"trueFn");var propTraps={get(_3,property,receiver2){return property===$PROXY? +receiver2:_3.get(property)},has(_3,property){return property===$PROXY?!0:_3.has( +property)},set:trueFn,deleteProperty:trueFn,getOwnPropertyDescriptor(_3,property){ +return{configurable:!0,enumerable:!0,get(){return _3.get(property)},set:trueFn,deleteProperty:trueFn}}, +ownKeys(_3){return _3.keys()}};function resolveSource(s){return(s=typeof s=="fun\ +ction"?s():s)?s:{}}__name(resolveSource,"resolveSource");function resolveSources(){ +for(let i2=0,length=this.length;i2=0;i2--){let v=resolveSource(sources[i2])[property]; +if(v!==void 0)return v}},has(property){for(let i2=sources.length-1;i2>=0;i2--)if(property in +resolveSource(sources[i2]))return!0;return!1},keys(){let keys=[];for(let i2=0;i2< +sources.length;i2++)keys.push(...Object.keys(resolveSource(sources[i2])));return[ +...new Set(keys)]}},propTraps);let target={},sourcesMap={},defined=new Set;for(let i2=sources. +length-1;i2>=0;i2--){let source=sources[i2];if(!source)continue;let sourceKeys=Object. +getOwnPropertyNames(source);for(let i3=0,length=sourceKeys.length;i3desc. +value):target[key2]===void 0&&(target[key2]=desc.value)}}}return target}__name(mergeProps, +"mergeProps");var SuspenseListContext=createContext();var booleans=["allowfullscreen","async","autofocus","autoplay","checked","contro\ +ls","default","disabled","formnovalidate","hidden","indeterminate","inert","isma\ +p","loop","multiple","muted","nomodule","novalidate","open","playsinline","reado\ +nly","required","reversed","seamless","selected"],Properties=new Set(["className", +"value","readOnly","formNoValidate","isMap","noModule","playsInline",...booleans]), +ChildProperties=new Set(["innerHTML","textContent","innerText","children"]),Aliases=Object. +assign(Object.create(null),{className:"class",htmlFor:"for"}),PropAliases=Object. +assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate", +BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{ +$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function getPropAlias(prop,tagName2){ +let a=PropAliases[prop];return typeof a=="object"?a[tagName2]?a.$:void 0:a}__name( +getPropAlias,"getPropAlias");var DelegatedEvents=new Set(["beforeinput","click", +"dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedo\ +wn","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","po\ +interout","pointerover","pointerup","touchend","touchmove","touchstart"]),SVGElements=new Set( +["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion", +"animateTransform","circle","clipPath","color-profile","cursor","defs","desc","e\ +llipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolv\ +eMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feF\ +uncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMerg\ +eNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLigh\ +t","feTile","feTurbulence","filter","font","font-face","font-face-format","font-\ +face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef", +"hkern","image","line","linearGradient","marker","mask","metadata","missing-glyp\ +h","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","\ +stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vke\ +rn"]),SVGNamespace={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/\ +XML/1998/namespace"};function reconcileArrays(parentNode,a,b){let bLength=b.length,aEnd=a.length,bEnd=bLength, +aStart=0,bStart=0,after=a[aEnd-1].nextSibling,map=null;for(;aStartindex-bStart){let node=a[aStart];for(;bStart{disposer=dispose,element2===document?code():insert(element2,code(),element2. +firstChild?null:void 0,init)},options.owner),()=>{disposer(),element2.textContent= +""}}__name(render,"render");function delegateEvents(eventNames,document2=window.document){let e=document2[$$EVENTS]|| +(document2[$$EVENTS]=new Set);for(let i2=0,l=eventNames.length;i2handlerFn.call(node,handler[1],e))}else +node.addEventListener(name2,handler)}__name(addEventListener,"addEventListener"); +function classList(node,value,prev={}){let classKeys=Object.keys(value||{}),prevKeys=Object. +keys(prev),i2,len;for(i2=0,len=prevKeys.length;i2prevProps.children=insertExpression(node,props.children,prevProps. +children)),createRenderEffect(()=>props.ref&&props.ref(node)),createRenderEffect( +()=>assign(node,props,isSVG,!0,prevProps,!0)),prevProps}__name(spread,"spread"); +function dynamicProperty(props,key2){let src=props[key2];return Object.defineProperty( +props,key2,{get(){return src()},enumerable:!0}),props}__name(dynamicProperty,"dy\ +namicProperty");function insert(parent,accessor,marker2,initial){if(marker2!==void 0&&!initial&& +(initial=[]),typeof accessor!="function")return insertExpression(parent,accessor, +initial,marker2);createRenderEffect(current=>insertExpression(parent,accessor(), +current,marker2),initial)}__name(insert,"insert");function assign(node,props,isSVG,skipChildren,prevProps={},skipRef=!1){ +props||(props={});for(let prop in prevProps)if(!(prop in props)){if(prop==="chil\ +dren")continue;prevProps[prop]=assignProp(node,prop,null,prevProps[prop],isSVG,skipRef)} +for(let prop in props){if(prop==="children"){skipChildren||insertExpression(node, +props.children);continue}let value=props[prop];prevProps[prop]=assignProp(node,prop, +value,prevProps[prop],isSVG,skipRef)}}__name(assign,"assign");function toPropertyName(name2){return name2.toLowerCase().replace(/-([a-z])/g,(_3,w2)=>w2. +toUpperCase())}__name(toPropertyName,"toPropertyName");function toggleClassKey(node,key2,value){ +let classNames=key2.trim().split(/\s+/);for(let i2=0,nameLen=classNames.length;i2< +nameLen;i2++)node.classList.toggle(classNames[i2],value)}__name(toggleClassKey,"\ +toggleClassKey");function assignProp(node,prop,value,prev,isSVG,skipRef){let isCE, +isProp,isChildProp,propAlias,forceProp;if(prop==="style")return style(node,value, +prev);if(prop==="classList")return classList(node,value,prev);if(value===prev)return prev; +if(prop==="ref")skipRef||value(node);else if(prop.slice(0,3)==="on:"){let e=prop. +slice(3);prev&&node.removeEventListener(e,prev),value&&node.addEventListener(e,value)}else if(prop. +slice(0,10)==="oncapture:"){let e=prop.slice(10);prev&&node.removeEventListener( +e,prev,!0),value&&node.addEventListener(e,value,!0)}else if(prop.slice(0,2)==="o\ +n"){let name2=prop.slice(2).toLowerCase(),delegate=DelegatedEvents.has(name2);if(!delegate&& +prev){let h=Array.isArray(prev)?prev[0]:prev;node.removeEventListener(name2,h)}(delegate|| +value)&&(addEventListener(node,name2,value,delegate),delegate&&delegateEvents([name2]))}else if(prop. +slice(0,5)==="attr:")setAttribute(node,prop.slice(5),value);else if((forceProp=prop. +slice(0,5)==="prop:")||(isChildProp=ChildProperties.has(prop))||!isSVG&&((propAlias= +getPropAlias(prop,node.tagName))||(isProp=Properties.has(prop)))||(isCE=node.nodeName. +includes("-"))){if(forceProp)prop=prop.slice(5),isProp=!0;else if(sharedConfig.context) +return value;prop==="class"||prop==="className"?className(node,value):isCE&&!isProp&& +!isChildProp?node[toPropertyName(prop)]=value:node[propAlias||prop]=value}else{let ns=isSVG&& +prop.indexOf(":")>-1&&SVGNamespace[prop.split(":")[0]];ns?setAttributeNS(node,ns, +prop,value):setAttribute(node,Aliases[prop]||prop,value)}return value}__name(assignProp, +"assignProp");function eventHandler(e){let key2=`$$${e.type}`,node=e.composedPath&& +e.composedPath()[0]||e.target;for(e.target!==node&&Object.defineProperty(e,"targ\ +et",{configurable:!0,value:node}),Object.defineProperty(e,"currentTarget",{configurable:!0, +get(){return node||document}}),sharedConfig.registry&&!sharedConfig.done&&(sharedConfig. +done=_$HY.done=!0);node;){let handler=node[key2];if(handler&&!node.disabled){let data=node[`${key2}\ +Data`];if(data!==void 0?handler.call(node,data,e):handler.call(node,e),e.cancelBubble) +return}node=node._$host||node.parentNode||node.host}}__name(eventHandler,"eventH\ +andler");function insertExpression(parent,value,current,marker2,unwrapArray){if(sharedConfig. +context){!current&&(current=[...parent.childNodes]);let cleaned=[];for(let i2=0;i2< +current.length;i2++){let node=current[i2];node.nodeType===8&&node.data.slice(0,2)=== +"!$"?node.remove():cleaned.push(node)}current=cleaned}for(;typeof current=="func\ +tion";)current=current();if(value===current)return current;let t=typeof value,multi=marker2!== +void 0;if(parent=multi&¤t[0]&¤t[0].parentNode||parent,t==="string"|| +t==="number"){if(sharedConfig.context)return current;if(t==="number"&&(value=value. +toString()),multi){let node=current[0];node&&node.nodeType===3?node.data=value:node= +document.createTextNode(value),current=cleanChildren(parent,current,marker2,node)}else +current!==""&&typeof current=="string"?current=parent.firstChild.data=value:current= +parent.textContent=value}else if(value==null||t==="boolean"){if(sharedConfig.context) +return current;current=cleanChildren(parent,current,marker2)}else{if(t==="functi\ +on")return createRenderEffect(()=>{let v=value();for(;typeof v=="function";)v=v(); +current=insertExpression(parent,v,current,marker2)}),()=>current;if(Array.isArray( +value)){let array=[],currentArray=current&&Array.isArray(current);if(normalizeIncomingArray( +array,value,current,unwrapArray))return createRenderEffect(()=>current=insertExpression( +parent,array,current,marker2,!0)),()=>current;if(sharedConfig.context){if(!array. +length)return current;if(marker2===void 0)return[...parent.childNodes];let node=array[0], +nodes=[node];for(;(node=node.nextSibling)!==marker2;)nodes.push(node);return current= +nodes}if(array.length===0){if(current=cleanChildren(parent,current,marker2),multi) +return current}else currentArray?current.length===0?appendNodes(parent,array,marker2): +reconcileArrays(parent,current,array):(current&&cleanChildren(parent),appendNodes( +parent,array));current=array}else if(value.nodeType){if(sharedConfig.context&&value. +parentNode)return current=multi?[value]:value;if(Array.isArray(current)){if(multi) +return current=cleanChildren(parent,current,marker2,value);cleanChildren(parent, +current,null,value)}else current==null||current===""||!parent.firstChild?parent. +appendChild(value):parent.replaceChild(value,parent.firstChild);current=value}}return current} +__name(insertExpression,"insertExpression");function normalizeIncomingArray(normalized,array,current,unwrap2){ +let dynamic=!1;for(let i2=0,len=array.length;i2=0;i2--){let el2=current[i2];if(node!==el2){let isParent=el2.parentNode===parent; +!inserted&&!i2?isParent?parent.replaceChild(node,el2):parent.insertBefore(node,marker2): +isParent&&el2.remove()}else inserted=!0}}else parent.insertBefore(node,marker2); +return[node]}__name(cleanChildren,"cleanChildren");var RequestContext=Symbol();var tagRE=/(?:|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,attrRE=/(?:\s(?[^/\s><=]+?)(?=[\s/>]))|(?:(?\S+?)(?:\s*=\s*(?:(['"])(?[\s\S]*?)\3|(?[^\s>]+))))/g, +lookup={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0, +menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};function parseTag(tag){let res={ +type:"tag",name:"",voidElement:!1,attrs:[],children:[]},tagMatch=tag.match(/<\/?([^\s]+?)[/\s>]/); +if(tagMatch&&(res.name=tagMatch[1],(lookup[tagMatch[1].toLowerCase()]||tag.charAt( +tag.length-2)==="/")&&(res.voidElement=!0),res.name.startsWith("!--"))){let endIndex=tag. +indexOf("-->");return{type:"comment",comment:endIndex!==-1?tag.slice(4,endIndex): +""}}let reg=new RegExp(attrRE);for(let match of tag.matchAll(reg))(match[1]||match[2]). +startsWith("use:")?res.attrs.push({type:"directive",name:match[1]||match[2],value:match[4]|| +match[5]||""}):res.attrs.push({type:"attr",name:match[1]||match[2],value:match[4]|| +match[5]||""});return res}__name(parseTag,"parseTag");function pushTextNode(list,html2,start){ +let end=html2.indexOf("<",start),content=html2.slice(start,end===-1?void 0:end); +/^\s*$/.test(content)||list.push({type:"text",content})}__name(pushTextNode,"pus\ +hTextNode");function pushCommentNode(list,tag){let content=tag.replace("","");/^\s*$/.test(content)||list.push({type:"comment",content})}__name( +pushCommentNode,"pushCommentNode");function parse(html2){let result=[],current,level=-1, +arr=[],byTag={};return html2.replace(tagRE,(tag,index)=>{let isOpen=tag.charAt(1)!== +"/",isComment=tag.slice(0,4)===""}}__name( +stringifier,"stringifier");function stringify(doc){return doc.reduce(function(token,rootEl){ +return token+stringifier("",rootEl)},"")}__name(stringify,"stringify");var cache=new Map, +VOID_ELEMENTS=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i, +spaces=" \\f\\n\\r\\t",almostEverything="[^"+spaces+`\\/>"'=]+`,attrName="[ "+spaces+ +"]+(?:use:|"+almostEverything+")",tagName="<([A-Za-z$#]+[A-Za-z0-9:_-]*)\ +((?:",attrPartials=`(?:\\s*=\\s*(?:'[^']*?'|"[^"]*?"|\\([^)]*?\\)|<[^>]*?>|`+almostEverything+ +"))?)",attrSeeker=new RegExp(tagName+attrName+attrPartials+"+)([ "+spaces+"]*/?>\ +)","g"),findAttributes=new RegExp("("+attrName+`\\s*=\\s*)(|['"(]([\\w\\s]*<\ +!--#-->[\\w\\s]*)*['")])`,"gi"),selfClosing=new RegExp(tagName+attrName+attrPartials+ +"*)([ "+spaces+"]*/>)","g"),marker="",reservedNameSpaces=new Set(["class", +"on","oncapture","style","use","prop","attr"]);function attrReplacer($0,$1,$2,$3){ +return"<"+$1+$2.replace(findAttributes,replaceAttributes)+$3}__name(attrReplacer, +"attrReplacer");function replaceAttributes($0,$1,$2){return $1.replace(//g, +"###")+($2[0]==='"'||$2[0]==="'"?$2.replace(//g,"###"):'"###"')}__name(replaceAttributes, +"replaceAttributes");function fullClosing($0,$1,$2){return VOID_ELEMENTS.test($1)? +$0:"<"+$1+$2+">"}__name(fullClosing,"fullClosing");function toPropertyName2(name2){ +return name2.toLowerCase().replace(/-([a-z])/g,(_3,w2)=>w2.toUpperCase())}__name( +toPropertyName2,"toPropertyName");function parseDirective(name2,value,tag,options){ +if(name2==="use:###"&&value==="###"){let count=options.counter++;options.exprs.push( +`typeof exprs[${count}] === "function" ? r.use(exprs[${count}], ${tag}, exprs[${options. +counter++}]) : (()=>{throw new Error("use:### must be a function")})()`)}else throw new Error( +`Not support syntax ${name2} must be use:{function}`)}__name(parseDirective,"par\ +seDirective");function createHTML(r3,{delegateEvents:delegateEvents2=!0,functionBuilder=__name( +(...args)=>new Function(...args),"functionBuilder")}={}){let uuid=1;r3.wrapProps= +props=>{let d2=Object.getOwnPropertyDescriptors(props);for(let k in d2)typeof d2[k]. +value=="function"&&!d2[k].value.length&&r3.dynamicProperty(props,k);return props}; +function createTemplate(statics,opt){let i2=0,markup="";for(;i2";markup=markup+statics[i2],markup=[[selfClosing, +fullClosing],[/<()/g,"<###"],[/\.\.\.()/g,"###"],[attrSeeker,attrReplacer], +[/>\n+\s*/g,">"],[/\n+\s*\s+/g,"> "]].reduce((acc,x2)=>acc. +replace(x2[0],x2[1]),markup);let pars=parse(markup),[html3,code]=parseTemplate(pars, +opt.funcBuilder),templates=[];for(let i3=0;i3-1){let parts=d2. +split(marker).reduce((memo,p2,i4)=>(i4&&memo.push(""),memo.push(p2),memo),[]);nomarkers[i3]. +firstChild.replaceWith(...parts)}}}return templates[0].create=code,cache.set(statics, +templates),templates}__name(createTemplate,"createTemplate");function parseKeyValue(node,tag,name2,value,isSVG,isCE,options){ +let expr=value==="###"?`!doNotWrap ? exprs[${options.counter}]() : exprs[${options. +counter++}]`:value.split("###").map((v,i2)=>i2?` + (typeof exprs[${options.counter}\ +] === "function" ? exprs[${options.counter}]() : exprs[${options.counter++}]) + \ +"${v}"`:`"${v}"`).join(""),parts,namespace;(parts=name2.split(":"))&&parts[1]&&reservedNameSpaces. +has(parts[0])&&(name2=parts[1],namespace=parts[0]);let isChildProp=r3.ChildProperties. +has(name2),isProp=r3.Properties.has(name2);if(name2==="style"){let prev=`_$v${uuid++}`; +options.decl.push(`${prev}={}`),options.exprs.push(`r.style(${tag},${expr},${prev}\ +)`)}else if(name2==="classList"){let prev=`_$v${uuid++}`;options.decl.push(`${prev}\ +={}`),options.exprs.push(`r.classList(${tag},${expr},${prev})`)}else if(namespace!== +"attr"&&(isChildProp||!isSVG&&(r3.getPropAlias(name2,node.name.toUpperCase())||isProp)|| +isCE||namespace==="prop"))isCE&&!isChildProp&&!isProp&&namespace!=="prop"&&(name2= +toPropertyName2(name2)),options.exprs.push(`${tag}.${r3.getPropAlias(name2,node. +name.toUpperCase())||name2} = ${expr}`);else{let ns=isSVG&&name2.indexOf(":")>-1&& +r3.SVGNamespace[name2.split(":")[0]];ns?options.exprs.push(`r.setAttributeNS(${tag}\ +,"${ns}","${name2}",${expr})`):options.exprs.push(`r.setAttribute(${tag},"${r3.Aliases[name2]|| +name2}",${expr})`)}}__name(parseKeyValue,"parseKeyValue");function parseAttribute(node,tag,name2,value,isSVG,isCE,options){ +if(name2.slice(0,2)==="on")if(name2.includes(":")){let capture=name2.startsWith( +"oncapture:");options.exprs.push(`${tag}.addEventListener("${name2.slice(capture? +10:3)}",exprs[${options.counter++}]${capture?",true":""})`)}else{let lc=name2.slice( +2).toLowerCase(),delegate=delegateEvents2&&r3.DelegatedEvents.has(lc);options.exprs. +push(`r.addEventListener(${tag},"${lc}",exprs[${options.counter++}],${delegate})`), +delegate&&options.delegatedEvents.add(lc)}else if(name2==="ref")options.exprs.push( +`exprs[${options.counter++}](${tag})`);else{let childOptions=Object.assign({},options, +{exprs:[]}),count=options.counter;if(parseKeyValue(node,tag,name2,value,isSVG,isCE, +childOptions),options.decl.push(`_fn${count} = (${value==="###"?"doNotWrap":""})\ + => { +${childOptions.exprs.join(`; +`)}; +}`),value==="###")options.exprs.push(`typeof exprs[${count}] === "function" ? r.\ +effect(_fn${count}) : _fn${count}(true)`);else{let check="";for(let i2=count;i2< +childOptions.counter;i2++)i2!==count&&(check+=" || "),check+=`typeof exprs[${i2}\ +] === "function"`;options.exprs.push(check+` ? r.effect(_fn${count}) : _fn${count}\ +()`)}options.counter=childOptions.counter,options.wrap=!1}}__name(parseAttribute, +"parseAttribute");function processChildren(node,options){let childOptions=Object. +assign({},options,{first:!0,multi:!1,parent:options.path});if(node.children.length> +1)for(let i3=0;i31?`r.mergeProps(${result.join(",")})`:result[0]}__name(processComponentProps, +"processComponentProps");function processComponent(node,options){let props=[],keys=Object. +keys(node.attrs),propGroups=[props],componentIdentifier=options.counter++;for(let i2=0;i2< +keys.length;i2++){let{type,name:name2,value}=node.attrs[i2];if(type==="attr")name2=== +"###"?(propGroups.push(`exprs[${options.counter++}]`),propGroups.push(props=[])): +value==="###"?props.push(`${name2}: exprs[${options.counter++}]`):props.push(`${name2}\ +: "${value}"`);else if(type==="directive"){let tag2=`_$el${uuid++}`,topDecl=!options. +decl.length;options.decl.push(topDecl?"":`${tag2} = ${options.path}.${options.first? +"firstChild":"nextSibling"}`),parseDirective(name2,value,tag2,options)}}if(node. +children.length===1&&node.children[0].type==="comment"&&node.children[0].content=== +"#")props.push(`children: () => exprs[${options.counter++}]`);else if(node.children. +length){let children2={type:"fragment",children:node.children},childOptions=Object. +assign({},options,{first:!0,decl:[],exprs:[],parent:!1});parseNode(children2,childOptions), +props.push(`children: () => { ${childOptions.exprs.join(`; +`)}}`),options.templateId=childOptions.templateId,options.counter=childOptions.counter} +let tag;options.multi&&(tag=`_$el${uuid++}`,options.decl.push(`${tag} = ${options. +path}.${options.first?"firstChild":"nextSibling"}`)),options.parent?options.exprs. +push(`r.insert(${options.parent}, r.createComponent(exprs[${componentIdentifier}\ +],${processComponentProps(propGroups)})${tag?`, ${tag}`:""})`):options.exprs.push( +`${options.fragment?"":"return "}r.createComponent(exprs[${componentIdentifier}]\ +,${processComponentProps(propGroups)})`),options.path=tag,options.first=!1}__name( +processComponent,"processComponent");function parseNode(node,options){if(node.type=== +"fragment"){let parts=[];node.children.forEach(child=>{if(child.type==="tag"){if(child. +name==="###"){let childOptions2=Object.assign({},options,{first:!0,fragment:!0,decl:[], +exprs:[]});processComponent(child,childOptions2),parts.push(childOptions2.exprs[0]), +options.counter=childOptions2.counter,options.templateId=childOptions2.templateId; +return}options.templateId++;let id=uuid,childOptions=Object.assign({},options,{first:!0, +decl:[],exprs:[]});options.templateNodes.push([child]),parseNode(child,childOptions), +parts.push(`function() { ${childOptions.decl.join(`, +`)+`; +`+childOptions.exprs.join(`; +`)+`; +return _$el${id}; +`}}()`),options.counter=childOptions.counter,options.templateId=childOptions.templateId}else if(child. +type==="text")parts.push(`"${child.content}"`);else if(child.type==="comment"){if(child. +content==="#")parts.push(`exprs[${options.counter++}]`);else if(child.content)for(let i2=0;i2< +child.content.split("###").length-1;i2++)parts.push(`exprs[${options.counter++}]`)}}), +options.exprs.push(`return [${parts.join(`, +`)}]`)}else if(node.type==="tag"){let tag=`_$el${uuid++}`,topDecl=!options.decl. +length,templateId=options.templateId;options.decl.push(topDecl?"":`${tag} = ${options. +path}.${options.first?"firstChild":"nextSibling"}`);let isSVG=r3.SVGElements.has( +node.name),isCE=node.name.includes("-");if(options.hasCustomElement=isCE,node.attrs. +some(e=>e.name==="###")){let spreadArgs=[],current="",newAttrs=[];for(let i2=0;i2< +node.attrs.length;i2++){let{type,name:name2,value}=node.attrs[i2];if(type==="att\ +r")if(value.includes("###")){let count=options.counter++;current+=`${name2}: ${name2!== +"ref"?`typeof exprs[${count}] === "function" ? exprs[${count}]() : `:""}exprs[${count}\ +],`}else name2==="###"?(current.length&&(spreadArgs.push(`()=>({${current}})`),current= +""),spreadArgs.push(`exprs[${options.counter++}]`)):newAttrs.push(node.attrs[i2]);else +type==="directive"&&parseDirective(name2,value,tag,options)}node.attrs=newAttrs, +current.length&&spreadArgs.push(`()=>({${current}})`),options.exprs.push(`r.spre\ +ad(${tag},${spreadArgs.length===1?`typeof ${spreadArgs[0]} === "function" ? r.me\ +rgeProps(${spreadArgs[0]}) : ${spreadArgs[0]}`:`r.mergeProps(${spreadArgs.join("\ +,")})`},${isSVG},${!!node.children.length})`)}else for(let i2=0;i2 docume\ +nt.importNode(tmpls[${templateId}].content.firstChild, true))`:`const ${tag} = t\ +mpls[${templateId}].content.firstChild.cloneNode(true)`)}else if(node.type==="te\ +xt"){let tag=`_$el${uuid++}`;options.decl.push(`${tag} = ${options.path}.${options. +first?"firstChild":"nextSibling"}`),options.path=tag,options.first=!1}else if(node. +type==="comment"){let tag=`_$el${uuid++}`;options.decl.push(`${tag} = ${options. +path}.${options.first?"firstChild":"nextSibling"}`),node.content==="#"&&(options. +multi?options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}\ +], ${tag})`):options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}\ +])`)),options.path=tag,options.first=!1}}__name(parseNode,"parseNode");function parseTemplate(nodes,funcBuilder){ +let options={path:"",decl:[],exprs:[],delegatedEvents:new Set,counter:0,first:!0, +multi:!1,templateId:0,templateNodes:[]},id=uuid,origNodes=nodes,toplevel;return nodes. +length>1&&(nodes=[{type:"fragment",children:nodes}]),nodes[0].name==="###"?(toplevel= +!0,processComponent(nodes[0],options)):parseNode(nodes[0],options),r3.delegateEvents( +Array.from(options.delegatedEvents)),[[origNodes].concat(options.templateNodes). +map(t=>stringify(t)),funcBuilder("tmpls","exprs","r",options.decl.join(`, +`)+`; +`+options.exprs.join(`; +`)+(toplevel?"":`; +return _$el${id}; +`))]}__name(parseTemplate,"parseTemplate");function html2(statics,...args){let templates=cache. +get(statics)||createTemplate(statics,{funcBuilder:functionBuilder});return templates[0]. +create(templates,args,r3)}return __name(html2,"html"),html2}__name(createHTML,"c\ +reateHTML");var html=createHTML({effect:createRenderEffect,style,insert,untrack, +spread,createComponent,delegateEvents,classList,mergeProps,dynamicProperty,setAttribute, +setAttributeNS,addEventListener,Aliases,getPropAlias,Properties,ChildProperties, +DelegatedEvents,SVGElements,SVGNamespace});function createStoppableEffect(fn){let[running,setRunning]=createSignal(!0);return createEffect( +()=>running()&&fn()),{stop:()=>setRunning(!1),resume:()=>setRunning(!0)}}__name( +createStoppableEffect,"createStoppableEffect");function Effectful(Base){return class extends Base{static{__name(this,"Effectful")}#effects=new Set;createEffect(fn){ +let method=4;method===1&&this.#createEffect1(fn),method===2&&createRoot(()=>this.#createEffect1( +fn)),method===3&&queueMicrotask(()=>this.#createEffect1(fn)),method===4&&this.#createEffect2( +fn)}stopEffects(){let method=2;method===1&&this.#stopEffects1(),method===2&&this.#stopEffects2()}#createEffect1(fn){ +let effect=null;effect=createStoppableEffect(()=>{effect&&this.#effects.add(effect), +createEffect(fn),onCleanup(()=>this.#effects.delete(effect))}),this.#effects.add( +effect)}#stopEffects1(){for(let effect of this.#effects)effect.stop()}#owner=null;#dispose=null;#createEffect2(fn){ +if(!this.#owner)createRoot(dispose=>{this.#owner=getOwner(),this.#dispose=dispose, +this.#createEffect2(fn)});else{let owner=getOwner();for(;owner&&owner!==this.#owner;) +owner=owner?.owner??null;if(owner===this.#owner)return createEffect(fn);runWithOwner( +this.#owner,()=>createEffect(fn))}}#stopEffects2(){this.#dispose?.()}}}__name(Effectful, +"Effectful");var Effects2=class extends Effectful(Object){static{__name(this,"Ef\ +fects")}};var WeakTwoWayMap=class{static{__name(this,"WeakTwoWayMap")}m=new WeakMap;set(a,b){ +this.m.set(a,b),this.m.set(b,a)}get(item){return this.m.get(item)}has(item){return this. +m.has(item)}};function getFunctionBody(fn){let code=fn.toString().split(` +`);return code.shift(),code.pop(),code.join(` +`)}__name(getFunctionBody,"getFunctionBody");var descriptorDefaults={enumerable:!0, +configurable:!0};function setDescriptor(obj,key2,newDescriptor,inherited=!1){let currentDescriptor=inherited? +getInheritedDescriptor(obj,key2):Object.getOwnPropertyDescriptor(obj,key2);newDescriptor= +overrideDescriptor(currentDescriptor,newDescriptor),Object.defineProperty(obj,key2, +newDescriptor)}__name(setDescriptor,"setDescriptor");function setDescriptors(obj,newDescriptors){ +let newDescriptor,currentDescriptor,currentDescriptors=Object.getOwnPropertyDescriptors( +obj);for(let key2 in newDescriptors)newDescriptor=newDescriptors[key2],currentDescriptor= +currentDescriptors[key2],newDescriptors[key2]=overrideDescriptor(currentDescriptor, +newDescriptor);Object.defineProperties(obj,newDescriptors)}__name(setDescriptors, +"setDescriptors");function overrideDescriptor(oldDescriptor,newDescriptor){if(("\ +get"in newDescriptor||"set"in newDescriptor)&&("value"in newDescriptor||"writabl\ +e"in newDescriptor))throw new TypeError("cannot specify both accessors and a val\ +ue or writable attribute");return oldDescriptor&&("get"in newDescriptor||"set"in +newDescriptor?(delete oldDescriptor.value,delete oldDescriptor.writable):("value"in +newDescriptor||"writable"in newDescriptor)&&(delete oldDescriptor.get,delete oldDescriptor. +set)),{...descriptorDefaults,...oldDescriptor,...newDescriptor}}__name(overrideDescriptor, +"overrideDescriptor");function propertyIsAccessor(obj,key2,inherited=!0){let result=!1, +descriptor;return arguments.length===1?descriptor=obj:descriptor=inherited?getInheritedDescriptor( +obj,key2):Object.getOwnPropertyDescriptor(obj,key2),descriptor&&(descriptor.get|| +descriptor.set)&&(result=!0),result}__name(propertyIsAccessor,"propertyIsAccesso\ +r");function getInheritedDescriptor(obj,key2){let currentProto=obj,descriptor;for(;currentProto;){ +if(descriptor=Object.getOwnPropertyDescriptor(currentProto,key2),descriptor)return descriptor. +owner=currentProto,descriptor;currentProto=currentProto.__proto__}}__name(getInheritedDescriptor, +"getInheritedDescriptor");function getInheritedPropertyNames(obj){let currentProto=obj, +keys=[];for(;currentProto;)keys=keys.concat(Object.getOwnPropertyNames(currentProto)), +currentProto=currentProto.__proto__;return keys=Array.from(new Set(keys)),keys}__name( +getInheritedPropertyNames,"getInheritedPropertyNames");function hasPrototype(obj,proto){let currentProto=obj.__proto__;do{if(proto===currentProto) +return!0;currentProto=currentProto.__proto__}while(currentProto);return!1}__name( +hasPrototype,"hasPrototype");function copyDescriptors(source,destination,mod){let props=Object. +getOwnPropertyNames(source),i2=props.length;for(;i2--;){let prop=props[i2],descriptor=Object. +getOwnPropertyDescriptor(source,prop);mod&&mod(descriptor),Object.defineProperty( +destination,prop,descriptor)}}__name(copyDescriptors,"copyDescriptors");function setDefaultPrototypeDescriptors(prototype,{ +defaultClassDescriptor:{writable,enumerable:enumerable2,configurable}}){let descriptors=Object. +getOwnPropertyDescriptors(prototype),descriptor;for(let key2 in descriptors)descriptor= +descriptors[key2],("value"in descriptor||"writable"in descriptor)&&(descriptor.writable= +writable),descriptor.enumerable=enumerable2,descriptor.configurable=configurable; +setDescriptors(prototype,descriptors)}__name(setDefaultPrototypeDescriptors,"set\ +DefaultPrototypeDescriptors");function setDefaultStaticDescriptors(Ctor,{defaultClassDescriptor:{ +writable,enumerable:enumerable2,configurable}},staticBlacklist2){let descriptors=Object. +getOwnPropertyDescriptors(Ctor),descriptor;for(let key2 in descriptors){if(staticBlacklist2&& +staticBlacklist2.includes(key2)){delete descriptors[key2];continue}descriptor=descriptors[key2], +("value"in descriptor||"writable"in descriptor)&&(descriptor.writable=writable), +descriptor.enumerable=enumerable2,descriptor.configurable=configurable}setDescriptors( +Ctor,descriptors)}__name(setDefaultStaticDescriptors,"setDefaultStaticDescriptor\ +s");var staticBlacklist=["subclass","extends",...Object.getOwnPropertyNames(new Function)], +publicProtoToProtectedProto=new WeakMap,publicProtoToPrivateProto=new WeakMap,publicToProtected=new WeakTwoWayMap, +privateInstanceToClassScope=new WeakMap,brandToPublicPrototypes=new WeakMap,brandToProtectedPrototypes=new WeakMap, +brandToPrivatePrototypes=new WeakMap,brandToPublicsPrivates=new WeakMap,defaultOptions={ +mode:"es5",nativeNaming:!1,prototypeWritable:!1,defaultClassDescriptor:{writable:!0, +enumerable:!1,configurable:!0},setClassDescriptors:!0},InvalidSuperAccessError=class extends Error{static{ +__name(this,"InvalidSuperAccessError")}},InvalidAccessError=class extends Error{static{ +__name(this,"InvalidAccessError")}},Class=createClassHelper();function createClassHelper(options){ +options=options?{...defaultOptions,...options}:defaultOptions,options.defaultClassDescriptor= +{...defaultOptions.defaultClassDescriptor,...options.defaultClassDescriptor};let{ +mode,prototypeWritable,setClassDescriptors,nativeNaming}=options;function Class2(...args){ +let usingStaticSubclassMethod=!1;if(typeof this=="function"&&(usingStaticSubclassMethod= +!0),args.length<=3){let name2="",definer=null,classBrand=null;typeof args[0]=="s\ +tring"?name2=args[0]:(typeof args[0]=="function"||typeof args[0]=="object")&&(definer= +args[0],classBrand=args[1]),(typeof args[1]=="function"||typeof args[1]=="object")&& +(definer=args[1],classBrand=args[2]);let Ctor=usingStaticSubclassMethod?createClass. +call(this,name2,definer,classBrand):createClass(name2,definer,classBrand);return Ctor. +extends=function(ParentClass,def,brand){return def=def||definer,brand=brand||classBrand, +createClass.call(ParentClass,name2,def,brand)},Ctor}throw new TypeError("invalid\ + args")}return __name(Class2,"Class"),Class2;function createClass(className2,definer,classBrand){ +"use strict";let ParentClass=this;if(typeof className2!="string")throw new TypeError( +` + You must specify a string for the 'className' argument. + `);let definition=null;if(definer&&typeof definer=="object")definition= +definer;else if(!ParentClass&&(!definer||typeof definer!="function"&&typeof definer!= +"object")){let Ctor;return nativeNaming&&className2?Ctor=new Function(`return fu\ +nction ${className2}() {}`)():(Ctor=(()=>function(){})(),className2&&setDescriptor( +Ctor,"name",{value:className2})),Ctor.prototype={__proto__:Object.prototype,constructor:Ctor}, +setDescriptor(Ctor,"subclass",{value:Class2,writable:!0,enumerable:!1,configurable:!1}), +Ctor}let scopedPublicsToPrivates=classBrand?void 0:new WeakTwoWayMap;classBrand&& +(brandToPublicsPrivates.get(classBrand)||brandToPublicsPrivates.set(classBrand,new WeakTwoWayMap)), +classBrand=classBrand||{brand:"lexical"};let scope={className:className2,get publicToPrivate(){ +return scopedPublicsToPrivates||brandToPublicsPrivates.get(classBrand)},classBrand, +cachedPublicAccesses:new WeakMap,cachedProtectedAccesses:new WeakMap,cachedPrivateAccesses:new WeakMap}, +supers=new WeakMap,Super=superHelper.bind(null,supers,scope),Public=getPublicMembers. +bind(null,scope),Protected=getProtectedMembers.bind(null,scope),Private=getPrivateMembers. +bind(null,scope);if(Public.prototype={},Protected.prototype={},Private.prototype= +{},Public.Public=Public,Public.Protected=Protected,Public.Private=Private,Public. +Super=Super,Protected.Public=Public,Protected.Protected=Protected,Protected.Private= +Private,Protected.Super=Super,definition=definition||definer&&definer(Public,Protected, +Private,Super),definition&&typeof definition!="object"&&typeof definition!="func\ +tion")throw new TypeError(` + The return value of a class definer function, if any, should be + an object, or a class constructor. + `);let customClass=null;typeof definition=="function"&&(customClass= +definition,definition=definition.prototype,ParentClass=customClass.prototype.__proto__. +constructor);let staticMembers;definition&&(staticMembers=definition.static,delete definition. +static,typeof definition.public=="function"&&(definition.public=definition.public( +Protected,Private)),typeof definition.protected=="function"&&(definition.protected= +definition.protected(Public,Private)),typeof definition.private=="function"&&(definition. +private=definition.private(Public,Protected))),ParentClass=ParentClass||Object;let parentPublicPrototype=ParentClass. +prototype,publicPrototype=definition&&definition.public||definition||Object.create( +parentPublicPrototype);publicPrototype.__proto__!==parentPublicPrototype&&(publicPrototype. +__proto__=parentPublicPrototype);let parentProtectedPrototype=getParentProtectedPrototype( +parentPublicPrototype),protectedPrototype=definition&&definition.protected||Object. +create(parentProtectedPrototype);protectedPrototype.__proto__!==parentProtectedPrototype&& +(protectedPrototype.__proto__=parentProtectedPrototype),publicProtoToProtectedProto. +set(publicPrototype,protectedPrototype);let parentPrivatePrototype=getParentPrivatePrototype( +parentPublicPrototype),privatePrototype=definition&&definition.private||Object.create( +parentPrivatePrototype);if(privatePrototype.__proto__!==parentPrivatePrototype&& +(privatePrototype.__proto__=parentPrivatePrototype),publicProtoToPrivateProto.set( +publicPrototype,privatePrototype),brandToPublicPrototypes.get(classBrand)||brandToPublicPrototypes. +set(classBrand,new Set),brandToProtectedPrototypes.get(classBrand)||brandToProtectedPrototypes. +set(classBrand,new Set),brandToPrivatePrototypes.get(classBrand)||brandToPrivatePrototypes. +set(classBrand,new Set),brandToPublicPrototypes.get(classBrand).add(publicPrototype), +brandToProtectedPrototypes.get(classBrand).add(protectedPrototype),brandToPrivatePrototypes. +get(classBrand).add(privatePrototype),scope.publicPrototype=publicPrototype,scope. +privatePrototype=privatePrototype,scope.protectedPrototype=protectedPrototype,scope. +parentPublicPrototype=parentPublicPrototype,scope.parentProtectedPrototype=parentProtectedPrototype, +scope.parentPrivatePrototype=parentPrivatePrototype,copyDescriptors(Public.prototype, +publicPrototype),copyDescriptors(Protected.prototype,protectedPrototype),copyDescriptors( +Private.prototype,privatePrototype),definition&&(delete definition.public,delete definition. +protected,delete definition.private,definition!==publicPrototype&©Descriptors( +definition,publicPrototype)),customClass)return staticMembers&©Descriptors(staticMembers, +customClass),customClass;let userConstructor=publicPrototype.hasOwnProperty("con\ +structor")?publicPrototype.constructor:null,NewClass,newPrototype=null;if(mode=== +"es5")NewClass=(()=>function(){let ret=null,constructor2=null;return userConstructor? +constructor2=userConstructor:constructor2=ParentClass,constructor2!==Object&&(ret= +constructor2.apply(this,arguments)),ret&&(typeof ret=="object"||typeof ret=="fun\ +ction")?ret:this})(),newPrototype=publicPrototype;else throw new TypeError(` + The lowclass "mode" option can only be 'es5' for now. + `);if(className2)if(nativeNaming){let code=getFunctionBody(NewClass), +proto=NewClass.prototype;NewClass=new Function(" userConstructor, ParentClass ", +` + return function ${className2}() { ${code} } + `)(userConstructor,ParentClass),NewClass.prototype=proto}else setDescriptor( +NewClass,"name",{value:className2});return userConstructor&&userConstructor.length&& +setDescriptor(NewClass,"length",{value:userConstructor.length}),NewClass.__proto__= +ParentClass,staticMembers&©Descriptors(staticMembers,NewClass),setDescriptor( +NewClass,"subclass",{value:Class2,writable:!0,enumerable:!1,configurable:!1}),NewClass. +prototype=newPrototype,NewClass.prototype.constructor=NewClass,setClassDescriptors&& +(setDefaultStaticDescriptors(NewClass,options,staticBlacklist),setDescriptor(NewClass, +"prototype",{writable:prototypeWritable}),setDefaultPrototypeDescriptors(NewClass. +prototype,options),setDefaultPrototypeDescriptors(protectedPrototype,options),setDefaultPrototypeDescriptors( +privatePrototype,options)),scope.constructor=NewClass,NewClass}__name(createClass, +"createClass")}__name(createClassHelper,"createClassHelper");function getParentProtectedPrototype(parentPublicPrototype){ +let parentProtectedProto,currentPublicProto=parentPublicPrototype;for(;currentPublicProto&& +!parentProtectedProto;)parentProtectedProto=publicProtoToProtectedProto.get(currentPublicProto), +currentPublicProto=currentPublicProto.__proto__;return parentProtectedProto||{}} +__name(getParentProtectedPrototype,"getParentProtectedPrototype");function getParentPrivatePrototype(parentPublicPrototype){ +let parentPrivateProto,currentPublicProto=parentPublicPrototype;for(;currentPublicProto&& +!parentPrivateProto;)parentPrivateProto=publicProtoToPrivateProto.get(currentPublicProto), +currentPublicProto=currentPublicProto.__proto__;return parentPrivateProto||{}}__name( +getParentPrivatePrototype,"getParentPrivatePrototype");function getPublicMembers(scope,instance3){ +let result=scope.cachedPublicAccesses.get(instance3);return result||(isPrivateInstance( +scope,instance3)?scope.cachedPublicAccesses.set(instance3,result=getSubclassScope( +instance3).publicToPrivate.get(instance3)):isProtectedInstance(scope,instance3)? +scope.cachedPublicAccesses.set(instance3,result=publicToProtected.get(instance3)): +scope.cachedPublicAccesses.set(instance3,result=instance3),result)}__name(getPublicMembers, +"getPublicMembers");function getProtectedMembers(scope,instance3){let result=scope. +cachedProtectedAccesses.get(instance3);if(result)return result;if(isPublicInstance( +scope,instance3))scope.cachedProtectedAccesses.set(instance3,result=publicToProtected. +get(instance3)||createProtectedInstance(instance3));else if(isPrivateInstance(scope, +instance3)){let publicInstance=getSubclassScope(instance3).publicToPrivate.get(instance3); +scope.cachedProtectedAccesses.set(instance3,result=publicToProtected.get(publicInstance)|| +createProtectedInstance(publicInstance))}else isProtectedInstance(scope,instance3)&& +scope.cachedProtectedAccesses.set(instance3,result=instance3);if(!result)throw new InvalidAccessError( +"invalid access of protected member");return result}__name(getProtectedMembers,"\ +getProtectedMembers");function getSubclassScope(privateInstance){return privateInstanceToClassScope. +get(privateInstance)}__name(getSubclassScope,"getSubclassScope");function createProtectedInstance(publicInstance){ +let protectedPrototype=findLeafmostProtectedPrototype(publicInstance),protectedInstance=Object. +create(protectedPrototype);return publicToProtected.set(publicInstance,protectedInstance), +protectedInstance}__name(createProtectedInstance,"createProtectedInstance");function findLeafmostProtectedPrototype(publicInstance){ +let result=null,currentProto=publicInstance.__proto__;for(;currentProto;){if(result= +publicProtoToProtectedProto.get(currentProto),result)return result;currentProto= +currentProto.__proto__}return result}__name(findLeafmostProtectedPrototype,"find\ +LeafmostProtectedPrototype");function getPrivateMembers(scope,instance3){let result=scope. +cachedPrivateAccesses.get(instance3);if(result)return result;if(isPublicInstance( +scope,instance3))scope.cachedPrivateAccesses.set(instance3,result=scope.publicToPrivate. +get(instance3)||createPrivateInstance(scope,instance3));else if(isProtectedInstance( +scope,instance3)){let publicInstance=publicToProtected.get(instance3);scope.cachedPrivateAccesses. +set(instance3,result=scope.publicToPrivate.get(publicInstance)||createPrivateInstance( +scope,publicInstance))}else isPrivateInstance(scope,instance3)&&scope.cachedPrivateAccesses. +set(instance3,result=instance3);if(!result)throw new InvalidAccessError("invalid\ + access of private member");return result}__name(getPrivateMembers,"getPrivateMe\ +mbers");function createPrivateInstance(scope,publicInstance){let privateInstance=Object. +create(scope.privatePrototype);return scope.publicToPrivate.set(publicInstance,privateInstance), +privateInstanceToClassScope.set(privateInstance,scope),privateInstance}__name(createPrivateInstance, +"createPrivateInstance");function isPublicInstance(scope,instance3,brandedCheck=!0){ +if(!brandedCheck)return hasPrototype(instance3,scope.publicPrototype);for(let proto of Array. +from(brandToPublicPrototypes.get(scope.classBrand)))if(hasPrototype(instance3,proto)) +return!0;return!1}__name(isPublicInstance,"isPublicInstance");function isProtectedInstance(scope,instance3,brandedCheck=!0){ +if(!brandedCheck)return hasPrototype(instance3,scope.protectedPrototype);for(let proto of Array. +from(brandToProtectedPrototypes.get(scope.classBrand)))if(hasPrototype(instance3, +proto))return!0;return!1}__name(isProtectedInstance,"isProtectedInstance");function isPrivateInstance(scope,instance3,brandedCheck=!0){ +if(!brandedCheck)return hasPrototype(instance3,scope.privatePrototype);for(let proto of Array. +from(brandToPrivatePrototypes.get(scope.classBrand)))if(hasPrototype(instance3,proto)) +return!0;return!1}__name(isPrivateInstance,"isPrivateInstance");function superHelper(supers,scope,instance3){ +let{parentPublicPrototype,parentProtectedPrototype,parentPrivatePrototype}=scope; +if(isPublicInstance(scope,instance3,!1))return getSuperHelperObject(instance3,parentPublicPrototype, +supers);if(isProtectedInstance(scope,instance3,!1))return getSuperHelperObject(instance3, +parentProtectedPrototype,supers);if(isPrivateInstance(scope,instance3,!1))return getSuperHelperObject( +instance3,parentPrivatePrototype,supers);throw new InvalidSuperAccessError("inva\ +lid super access")}__name(superHelper,"superHelper");function getSuperHelperObject(instance3,parentPrototype,supers){ +let _super=supers.get(instance3);if(!_super){supers.set(instance3,_super=Object. +create(parentPrototype));let keys=getInheritedPropertyNames(parentPrototype),i2=keys. +length;for(;i2--;){let key2=keys[i2];setDescriptor(_super,key2,{get:function(){let value, +descriptor=getInheritedDescriptor(parentPrototype,key2);if(descriptor&&propertyIsAccessor( +descriptor)){let getter=descriptor.get;getter&&(value=getter.call(instance3))}else +value=parentPrototype[key2];return value&&value.call&&typeof value=="function"&& +(value=value.bind(instance3)),value},set:function(value){let descriptor=getInheritedDescriptor( +parentPrototype,key2);if(descriptor&&propertyIsAccessor(descriptor)){let setter=descriptor. +set;setter&&(value=setter.call(instance3,value))}else instance3[key2]=value}},!0)}} +return _super}__name(getSuperHelperObject,"getSuperHelperObject");var ImplementationMethod;(function(ImplementationMethod2){ImplementationMethod2. +PROXIES_ON_INSTANCE_AND_PROTOTYPE="PROXIES_ON_INSTANCE_AND_PROTOTYPE",ImplementationMethod2. +PROXIES_ON_PROTOTYPE="PROXIES_ON_PROTOTYPE",ImplementationMethod2.PROXY_AFTER_INSTANCE_AND_PROTOTYPE= +"PROXY_AFTER_INSTANCE_AND_PROTOTYPE"})(ImplementationMethod||(ImplementationMethod= +{}));function makeMultipleHelper(options){return __name(function(...classes){switch(options&& +options.method||ImplementationMethod.PROXIES_ON_INSTANCE_AND_PROTOTYPE){case ImplementationMethod. +PROXIES_ON_INSTANCE_AND_PROTOTYPE:return withProxiesOnThisAndPrototype(...classes);case ImplementationMethod. +PROXIES_ON_PROTOTYPE:return withProxiesOnPrototype(...classes);case ImplementationMethod. +PROXY_AFTER_INSTANCE_AND_PROTOTYPE:throw new Error(" not implemented yet")}},"mu\ +ltiple")}__name(makeMultipleHelper,"makeMultipleHelper");var multiple=makeMultipleHelper( +{method:ImplementationMethod.PROXIES_ON_INSTANCE_AND_PROTOTYPE});function withProxiesOnThisAndPrototype(...classes){ +if(classes.length===0)return Object;if(classes.length===1)return classes[0];let FirstClass=classes. +shift();class MultiClass extends FirstClass{static{__name(this,"MultiClass")}constructor(...args){ +super(...args);let instances=[],Ctor;for(let i2=0,l=classes.length;i2{let result=__instances__. +get(inst);return result||__instances__.set(inst,result=[]),result},"getInstances"), +getResult={has:!1,value:void 0};function getFromInstance(instance3,key2,result){ +if(result.has=!1,result.value=void 0,Reflect.ownKeys(instance3).includes(key2)){ +result.has=!0,result.value=Reflect.get(instance3,key2);return}let instances=__instances__. +get(instance3);if(instances){for(let instance4 of instances)if(getFromInstance(instance4, +key2,result),result.has)return}}__name(getFromInstance,"getFromInstance");var shouldGetFromPrototype=!1, +topLevelMultiClassPrototype=null;function withProxiesOnPrototype(...classes){if(classes. +length===0)return Object;if(classes.length===1)return classes[0];let FirstClass=classes. +shift();class MultiClass extends FirstClass{static{__name(this,"MultiClass")}constructor(...args){ +super(...args);let instances=getInstances(this);for(let Ctor of classes){let instance3=Reflect. +construct(Ctor,args);instances.push(instance3)}}}let newMultiClassPrototype=new Proxy( +Object.create(FirstClass.prototype),{get(target,key2,self2){if(topLevelMultiClassPrototype|| +(topLevelMultiClassPrototype=target),!shouldGetFromPrototype){if(getFromInstance( +self2,key2,getResult),getResult.has)return topLevelMultiClassPrototype=null,getResult. +value;shouldGetFromPrototype=!0}if(shouldGetFromPrototype){let result;Reflect.has( +target,key2)&&(result=Reflect.get(target,key2,self2));let Class2;for(let i2=0,l=classes. +length;i2 0) argList += ','; + argList += 'args[' + i + ']'; + } + var constructCall = Function('constructor, args', + 'return new constructor( ' + argList + ' );' + ); + var value = constructCall(constructor, args); + + args = Array.prototype.slice.call(args); + args = [null].concat(args); + var value = new constructor.bind.apply(constructor, args); + + `} + + // fix up the prototype so it matches the intended one, not one \ +who's + // prototype is the intended one :P + Object.setPrototypeOf(value, target.prototype); + return value; + `);var instantiator=__name(function(){},"instantiator");return __name( +function(constructor2,args,target){if(arguments.length===3&&typeof target!="func\ +tion")throw new TypeError(target+" is not a constructor");instantiator.prototype= +(target||constructor2).prototype;var instance3=new instantiator,value=constructor2. +apply(instance3,args);return typeof value=="object"&&value?(value.__proto__=(target|| +constructor2).prototype,value):instance3},"construct")}(),SKIP_PROPERTIES=["argu\ +ments","caller","length","name","prototype"];function copyProperties(source,destination){ +if(Object.getOwnPropertyNames&&Object.defineProperty){var properties=Object.getOwnPropertyNames( +source);Object.getOwnPropertySymbols&&(properties=properties.concat(Object.getOwnPropertySymbols( +source)));for(var i2=properties.length-1;i2>=0;i2--)SKIP_PROPERTIES.indexOf(properties[i2])=== +-1&&Object.defineProperty(destination,properties[i2],Object.getOwnPropertyDescriptor( +source,properties[i2]))}else for(var property in source)destination[property]=source[property]} +__name(copyProperties,"copyProperties");function newless(constructor){var name=constructor. +name,usesClassSyntax=constructor.toString().substr(0,5)==="class",requiresNew=usesClassSyntax? +!0:null,newlessConstructor=(()=>function(){if(!requiresNew&&this instanceof newlessConstructor){ +if(requiresNew===!1){let returnValue2=constructor.apply(this,arguments);return typeof returnValue2== +"object"&&returnValue2||this}try{requiresNew=!1;let returnValue2=constructor.apply( +this,arguments);return typeof returnValue2=="object"&&returnValue2||this}catch(error){ +if(error instanceof TypeError&&(/class constructor/i.test(error.message)||/use the 'new' operator/i. +test(error.message)))requiresNew=!0;else throw error instanceof Error&&/Illegal constructor/i. +test(error.message)&&Object.create(constructor.prototype)instanceof Node&&console. +error(`The following error can happen if a Custom Element is called +with 'new' before being defined. The constructor was ${constructor.name}: `,constructor), +error}}var newTarget,hasNewTarget=!1;supportsNewTarget&&(eval("newTarget = new.t\ +arget"),newTarget&&(hasNewTarget=!0)),(!supportsNewTarget||!hasNewTarget)&&(newTarget= +this instanceof newlessConstructor?this.constructor:constructor);let returnValue=construct( +constructor,arguments,newTarget);return this instanceof newlessConstructor&&setPrototype( +this,returnValue),returnValue})();if(name){let code=getFunctionBody(newlessConstructor); +newlessConstructor=Function("constructor, construct, setPrototype, requiresNew, \ +supportsNewTarget",` + var newlessConstructor = function ${name}() { ${code} }; + return newlessConstructor + `)(constructor,construct,setPrototype,requiresNew,supportsNewTarget)}return constructor. +length&&setDescriptor(newlessConstructor,"length",{value:constructor.length}),newlessConstructor. +prototype=Object.create(constructor.prototype),newlessConstructor.prototype.constructor= +newlessConstructor,constructor.prototype.constructor=constructor,newlessConstructor[TRUE_CONSTRUCTOR]= +constructor,copyProperties(constructor,newlessConstructor),setPrototype(newlessConstructor, +constructor),newlessConstructor}__name(newless,"newless");function isSyntaxSupported(example,useStrict=!0){ +try{return!!Function("",(useStrict?"'use strict';":"")+example)}catch{return!1}} +__name(isSyntaxSupported,"isSyntaxSupported");function syncSignals(getterA,setterA,getterB,setterB){let settingB=!1,settingA=!1; +return createComputed(()=>{let _a2=getterA();if(settingA)return settingA=!1;settingB= +!0,setterB(_a2)}),createComputed(()=>{let _b2=getterB();if(settingB)return settingB= +!1;settingA=!0,setterA(_b2)}),[[getterA,setterA],[getterB,setterB]]}__name(syncSignals, +"syncSignals");var signalifiedProps=new WeakMap;function signalify(obj,...props){let _props=props. +length?props:Object.keys(obj).concat(Object.getOwnPropertySymbols(obj));for(let prop of _props) +createSignalAccessor(obj,prop);return obj}__name(signalify,"signalify");var gotCreateSignalAccessor=!1; +function getCreateSignalAccessor(){if(gotCreateSignalAccessor)throw new Error('E\ +xport "createSignalAccessor" is internal to classy-solid only.');return gotCreateSignalAccessor= +!0,createSignalAccessor}__name(getCreateSignalAccessor,"getCreateSignalAccessor"); +var propsSetAtLeastOnce=new WeakMap;function __isPropSetAtLeastOnce(instance3,prop){ +return!!propsSetAtLeastOnce.get(instance3)?.has(prop)}__name(__isPropSetAtLeastOnce, +"__isPropSetAtLeastOnce");function trackPropSetAtLeastOnce(instance3,prop){propsSetAtLeastOnce. +has(instance3)||propsSetAtLeastOnce.set(instance3,new Set),propsSetAtLeastOnce.get( +instance3).add(prop)}__name(trackPropSetAtLeastOnce,"trackPropSetAtLeastOnce");var isSignalGetter=new WeakSet; +function createSignalAccessor(obj,prop,initialVal=untrack(()=>obj[prop]),override=!1){ +if(!override&&signalifiedProps.get(obj)?.has(prop)||obj[$PROXY])return;let descriptor=getInheritedDescriptor( +obj,prop),originalGet,originalSet;if(descriptor){if(originalGet=descriptor.get,originalSet= +descriptor.set,originalGet&&isSignalGetter.has(originalGet))return;if(originalGet|| +originalSet){if(!originalGet||!originalSet){console.warn(`The \`@signal\` decorato\ +r was used on an accessor named "${prop.toString()}" which had a getter or a set\ +ter, but not both. Reactivity on accessors works only when accessors have both g\ +et and set. In this case the decorator does not do anything.`);return}delete descriptor. +get,delete descriptor.set}else{if(initialVal=descriptor.value,!descriptor.writable){ +console.warn(`The \`@signal\` decorator was used on a property named "${prop.toString()}\ +" that is not writable. Reactivity is not enabled for non-writable properties.`); +return}delete descriptor.value,delete descriptor.writable}}let s=createSignal(initialVal, +{equals:!1});descriptor={configurable:!0,enumerable:!0,...descriptor,get:originalGet? +function(){return s[0](),originalGet.call(this)}:function(){return s[0]()},set:originalSet? +function(newValue){originalSet.call(this,newValue),trackPropSetAtLeastOnce(this, +prop),typeof newValue=="function"?s[1](()=>newValue):s[1](newValue)}:function(newValue){ +trackPropSetAtLeastOnce(this,prop),typeof newValue=="function"?s[1](()=>newValue): +s[1](newValue)}},isSignalGetter.add(descriptor.get),Object.defineProperty(obj,prop, +descriptor),signalifiedProps.has(obj)||signalifiedProps.set(obj,new Set),signalifiedProps. +get(obj).add(prop)}__name(createSignalAccessor,"createSignalAccessor");var propsToSignalify=new Map,accessKey=null;function getKey(){if(accessKey)throw new Error( +"Attempted use of classy-solid internals.");return accessKey=Symbol(),accessKey} +__name(getKey,"getKey");function getPropsToSignalify(key2){if(key2!==accessKey)throw new Error( +"Attempted use of classy-solid internals.");return propsToSignalify}__name(getPropsToSignalify, +"getPropsToSignalify");function resetPropsToSignalify(key2){if(key2!==accessKey) +throw new Error("Attempted use of classy-solid internals.");propsToSignalify=new Map} +__name(resetPropsToSignalify,"resetPropsToSignalify");function isMemberDecorator(context){ +return"private"in context}__name(isMemberDecorator,"isMemberDecorator");function signal(_3,context){ +let{kind,name:name2}=context,props=propsToSignalify;if(isMemberDecorator(context)){ +if(context.private)throw new Error("@signal is not supported on private fields y\ +et.");if(context.static)throw new Error("@signal is not supported on static fiel\ +ds yet.")}if(kind==="field")return props.set(name2,{initialValue:void 0}),function(initialValue){ +return props.get(name2).initialValue=initialValue,initialValue};if(kind==="gette\ +r"||kind==="setter")props.set(name2,{initialValue:void 0});else throw new Error( +"The @signal decorator is only for use on fields, getters, and setters. Auto acc\ +essor support is coming next if there is demand for it.");queueReactiveDecoratorChecker( +props)}__name(signal,"signal");var checkerQueued=!1;function queueReactiveDecoratorChecker(props){ +checkerQueued||(checkerQueued=!0,queueMicrotask(()=>{if(checkerQueued=!1,props=== +propsToSignalify)throw new Error(`Stray @signal-decorated properties detected: ${Array. +from(props.keys()).join(", ")}. Did you forget to use the \`@reactive\` decorator \ +on a class that has properties decorated with \`@signal\`?`)}))}__name(queueReactiveDecoratorChecker, +"queueReactiveDecoratorChecker");var accessKey2=getKey(),createSignalAccessor2=getCreateSignalAccessor(),hasOwnProperty=Object. +prototype.hasOwnProperty;function reactive(value,context){if(typeof value!="func\ +tion"||context&&context.kind!=="class")throw new TypeError("The @reactive decora\ +tor is only for use on classes.");let Class2=value,signalProps=getPropsToSignalify( +accessKey2);resetPropsToSignalify(accessKey2);class ReactiveDecorator extends Class2{static{ +__name(this,"ReactiveDecorator")}constructor(...args){let instance3;getListener()? +untrack(()=>instance3=Reflect.construct(Class2,args,new.target)):(super(...args), +instance3=this);for(let[prop,{initialValue}]of signalProps){if(!(hasOwnProperty. +call(instance3,prop)||hasOwnProperty.call(Class2.prototype,prop)))throw new Error( +`Property "${prop.toString()}" not found on instance of class decorated with \`@r\ +eactive\`. Did you forget to use the \`@reactive\` decorator on one of your classes\ + that has a "${prop.toString()}" property decorated with \`@signal\`?`);createSignalAccessor2( +instance3,prop,initialValue,!0)}return instance3}}return ReactiveDecorator}__name( +reactive,"reactive");var ctor,HTMLElement2=globalThis.HTMLElement??class{static{__name(this,"HTMLElem\ +ent")}constructor(){throw new Error("@lume/element needs a DOM to operate with! \ +If this code is running during server-side rendering, it means your app is tryin\ +g to instantiate elements when it shouldn't be, and should be refactored to avoi\ +d doing that when no DOM is present.")}},LumeElement=class _LumeElement extends HTMLElement2{static{ +__name(this,"LumeElement")}static elementName="";static defineElement(name2,registry=customElements){ +if(name2){if(registry.get(name2))return console.warn(`defineElement(): An elemen\ +t class was already defined for tag name ${name2}.`),this;{let Class2=class extends this{static{ +__name(this,"Class")}};return Class2.elementName=name2,registry.define(name2,Class2), +Class2}}else return name2=this.elementName,registry.get(name2)?(console.warn(`de\ +fineElement(): An element class was already defined for tag name ${name2}.`),this): +(registry.define(name2,this),this)}static observedAttributes;___init___=(()=>{this. +__handleInitialPropertyValuesIfAny()})();__handleInitialPropertyValuesIfAny(){let preUpgradeKeys=Object. +keys(this);this._preUpgradeValues=new Map;for(let propName of preUpgradeKeys){let descriptor=Object. +getOwnPropertyDescriptor(this,propName);"value"in descriptor&&(delete this[propName], +this._preUpgradeValues.set(propName,descriptor.value),queueMicrotask(()=>{if(__isPropSetAtLeastOnce( +this,propName))return;propName in this.__proto__&&(this[propName]=descriptor.value)}))}}hasShadow=!0;__root=null;get root(){ +return this.hasShadow?this.__root?this.__root:this.shadowRoot?this.__root=this.shadowRoot: +this.__root=this.attachShadow({mode:"open"}):this}set root(v){if(!this.hasShadow) +throw new Error("Can not set root, element.hasShadow is false.");if(this.__root|| +this.shadowRoot)throw new Error("Element root can only be set once if there is n\ +o ShadowRoot.");this.__root=v}get styleRoot(){return this.root}attachShadow(options){ +return this.__root&&console.warn("Element already has a root defined."),this.__root= +super.attachShadow(options)}connectedCallback(){this.__setStyle();let template=this. +template;template&&(this.__dispose=render(typeof template=="function"?template.bind( +this):()=>template,this.root))}disconnectedCallback(){this.__dispose&&this.__dispose(), +this.__cleanupStyle()}static __styleRootNodeRefCountPerTagName=new WeakMap;__styleRootNode=null;#defaultHostStyle=hostSelector=>`${hostSelector}\ + { + display: block; + }`;__setStyle(){ctor=this.constructor;let staticCSS=typeof ctor.css=="function"? +ctor.css=ctor.css():ctor.css||"",instanceCSS=typeof this.css=="function"?this.css(): +this.css||"";if(this.hasShadow){let hostSelector=":host",staticStyle=document.createElement( +"style");staticStyle.innerHTML=` + ${this.#defaultHostStyle(hostSelector)} + ${staticCSS} + ${instanceCSS} + `,this.styleRoot.appendChild(staticStyle)}else{let rootNode=this.getRootNode(); +this.__styleRootNode=rootNode===document?document.head:rootNode;let refCountPerTagName=_LumeElement. +__styleRootNodeRefCountPerTagName.get(this.__styleRootNode);refCountPerTagName|| +_LumeElement.__styleRootNodeRefCountPerTagName.set(this.__styleRootNode,refCountPerTagName= +{});let refCount2=refCountPerTagName[this.tagName]||0;if(refCountPerTagName[this. +tagName]=refCount2+1,refCount2===0){let hostSelector=this.tagName.toLowerCase(), +staticStyle=document.createElement("style");staticStyle.innerHTML=` + ${this.#defaultHostStyle(hostSelector)} + ${staticCSS&&staticCSS.replaceAll(":host",hostSelector)} + `,staticStyle.id=this.tagName.toLowerCase(),this.__styleRootNode.appendChild( +staticStyle)}if(instanceCSS){let id=this.tagName.toLowerCase()+"-"+this.__id;this. +setAttribute(id,"");let instanceStyle=this.__dynamicStyle=document.createElement( +"style");instanceStyle.id=id,instanceStyle.innerHTML=instanceCSS.replaceAll(":ho\ +st",`[${id}]`);let rootNode2=this.getRootNode();this.__styleRootNode=rootNode2=== +document?document.head:rootNode2,this.__styleRootNode.appendChild(instanceStyle)}}}static __elementId=0;__id=_LumeElement. +__elementId++;__dynamicStyle=null;__cleanupStyle(){do{if(this.hasShadow)break;let refCountPerTagName=_LumeElement. +__styleRootNodeRefCountPerTagName.get(this.__styleRootNode);if(!refCountPerTagName) +break;let refCount2=refCountPerTagName[this.tagName];if(refCount2===void 0)break; +refCountPerTagName[this.tagName]=--refCount2,refCount2===0&&(delete refCountPerTagName[this. +tagName],this.__styleRootNode.querySelector("#"+this.tagName)?.remove())}while(!1); +this.__dynamicStyle&&this.__dynamicStyle.remove()}adoptedCallback(){}};Symbol.metadata??=Symbol.for("Symbol.metadata");function camelCaseToDash(str){return str.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()} +__name(camelCaseToDash,"camelCaseToDash");function defineProp(obj,prop,value){Object.defineProperty(obj,prop,{value,writable:!0, +configurable:!0,enumerable:!0})}__name(defineProp,"defineProp");var __classFinishers=[];function attribute(handlerOrValue,context){if(arguments. +length===2)return handleAttributeDecoration(handlerOrValue,context,void 0);let handler=handlerOrValue; +return(value,context2)=>handleAttributeDecoration(value,context2,handler)}__name( +attribute,"attribute");var noSignal=__name((_value,context)=>{Object.hasOwn(context. +metadata,"noSignal")||(context.metadata.noSignal=new Set),context.metadata.noSignal. +add(context.name)},"noSignal");function handleAttributeDecoration(value,context,attributeHandler={}){ +let{kind,name:name2,private:isPrivate,static:isStatic,metadata}=context,useSignal=!(Object. +hasOwn(metadata,"noSignal")&&metadata.noSignal||void 0)?.has(name2);if(typeof name2== +"symbol")throw new Error("@attribute is not supported on symbol fields yet.");if(isPrivate) +throw new Error("@attribute is not supported on private fields yet.");if(isStatic) +throw new Error("@attribute is not supported on static fields.");if(__classFinishers. +push(Class2=>__setUpAttribute(Class2,name2,attributeHandler)),kind==="field"){let signalInitializer=useSignal? +signal(value,context):v=>v;return function(initialValue){return initialValue=signalInitializer( +initialValue),"default"in attributeHandler||(attributeHandler.default=initialValue), +initialValue}}else if(kind==="getter"||kind==="setter")useSignal&&signal(value,context);else +throw new Error("@attribute is only for use on fields, getters, and setters. Aut\ +o accessor support is coming next if there is demand for it.")}__name(handleAttributeDecoration, +"handleAttributeDecoration");function __setUpAttribute(ctor2,propName,attributeHandler){ +if(!ctor2.observedAttributes||!ctor2.hasOwnProperty("observedAttributes")){let inheritedAttrs=ctor2. +__proto__.observedAttributes;if(inheritedAttrs&&!Array.isArray(inheritedAttrs))throw new TypeError( +"observedAttributes is in the wrong format. Did you forget to decorate your cust\ +om element class with the `@element` decorator?");defineProp(ctor2,"observedAttr\ +ibutes",[...inheritedAttrs||[]])}if(!Array.isArray(ctor2.observedAttributes))throw new TypeError( +"observedAttributes is in the wrong format. Maybe you forgot to decorate your cu\ +stom element class with the `@element` decorator.");let attrName2=camelCaseToDash( +propName);ctor2.observedAttributes.includes(attrName2)||ctor2.observedAttributes. +push(attrName2),mapAttributeToProp(ctor2.prototype,attrName2,propName,attributeHandler)} +__name(__setUpAttribute,"__setUpAttribute");function mapAttributeToProp(prototype,attr,prop,attributeHandler){ +if(!prototype.__hasAttributeChangedCallback){prototype.__hasAttributeChangedCallback= +!0;let originalAttrChanged=prototype.attributeChangedCallback;prototype.attributeChangedCallback= +function(attr2,oldVal,newVal){originalAttrChanged?originalAttrChanged.call(this, +attr2,oldVal,newVal):prototype.__proto__?.attributeChangedCallback?.call(this,attr2, +oldVal,newVal);let prop2=this.__attributesToProps&&this.__attributesToProps[attr2]; +if(prop2){let handler=prop2.attributeHandler;this[prop2.name]=handler?newVal===null? +"default"in handler?handler.default:null:handler.from?handler.from(newVal):newVal: +newVal}}}prototype.hasOwnProperty("__attributesToProps")||Object.defineProperty( +prototype,"__attributesToProps",{value:{__proto__:prototype.__attributesToProps|| +Object.prototype}}),prototype.__attributesToProps[attr]={name:prop,attributeHandler}} +__name(mapAttributeToProp,"mapAttributeToProp");var toString=__name(str=>str,"to\ +String");attribute.string=()=>({from:toString});function stringAttribute(value,context){ +return attribute(attribute.string())(value,context)}__name(stringAttribute,"stri\ +ngAttribute");var toNumber=__name(str=>+str,"toNumber");attribute.number=()=>({from:toNumber}); +function numberAttribute(value,context){return attribute(attribute.number())(value, +context)}__name(numberAttribute,"numberAttribute");var toBoolean=__name(str=>str!== +"false","toBoolean");attribute.boolean=()=>({from:toBoolean});function booleanAttribute(value,context){ +return attribute(attribute.boolean())(value,context)}__name(booleanAttribute,"bo\ +oleanAttribute");function element(tagNameOrClass,autoDefineOrContext){let tagName2="",autoDefine=!!(autoDefineOrContext?? +!0);return typeof tagNameOrClass=="string"?(tagName2=tagNameOrClass,(Class3,context2)=>applyElementDecoration( +Class3,context2,tagName2,autoDefine)):(autoDefine=!1,applyElementDecoration(tagNameOrClass, +autoDefineOrContext,tagName2,autoDefine))}__name(element,"element");function applyElementDecoration(Class2,context,tagName2,autoDefine){ +if(typeof Class2!="function"||context&&context.kind!=="class")throw new Error("@\ +element is only for use on classes.");let{metadata={}}=context??{},noSignal2=Object. +hasOwn(metadata,"noSignal")&&metadata.noSignal||void 0,Ctor=Class2,attrs=Ctor.observedAttributes; +if(Ctor.hasOwnProperty("elementName")?tagName2=Ctor.elementName||tagName2:Ctor.elementName= +tagName2,!Array.isArray(attrs)){if(attrs&&typeof attrs=="object"){Ctor.observedAttributes= +void 0;for(let prop in attrs)__setUpAttribute(Ctor,prop,attrs[prop])}}Ctor=reactive( +Ctor,context);class ElementDecorator extends Ctor{static{__name(this,"ElementDec\ +orator")}constructor(...args){super(...args),untrack(()=>{handlePreUpgradeValues( +this);let propsToSignalify2=[],attrsToProps=ElementDecorator.prototype.__attributesToProps?? +{};for(let propSpec of Object.values(attrsToProps)){let prop=propSpec.name;!noSignal2?. +has(prop)&&propsToSignalify2.push(prop);let handler=propSpec.attributeHandler;handler&& +!("default"in handler)&&(handler.default=this[prop])}propsToSignalify2.length&&signalify( +this,...propsToSignalify2)})}}let classFinishers=[...__classFinishers];__classFinishers. +length=0;function finishClass(){for(let finisher of classFinishers)finisher(ElementDecorator); +tagName2&&autoDefine&&customElements.define(tagName2,ElementDecorator)}return __name( +finishClass,"finishClass"),context?.addInitializer?context.addInitializer(finishClass): +finishClass(),ElementDecorator}__name(applyElementDecoration,"applyElementDecora\ +tion");function handlePreUpgradeValues(self2){if(self2 instanceof LumeElement)for(let[ +key2,value]of self2._preUpgradeValues){if(!(key2 in self2))continue;self2._preUpgradeValues. +delete(key2);let desc=Object.getOwnPropertyDescriptor(self2,key2);desc&&"value"in +desc&&delete self2[key2],self2[key2]=value}}__name(handlePreUpgradeValues,"handl\ +ePreUpgradeValues");var $RAW=Symbol("store-raw"),$NODE=Symbol("store-node"),$HAS=Symbol("store-has"), +$SELF=Symbol("store-self");function isWrappable(obj){let proto;return obj!=null&&typeof obj=="object"&&(obj[$PROXY]|| +!(proto=Object.getPrototypeOf(obj))||proto===Object.prototype||Array.isArray(obj))} +__name(isWrappable,"isWrappable");function unwrap(item,set=new Set){let result,unwrapped, +v,prop;if(result=item!=null&&item[$RAW])return result;if(!isWrappable(item)||set. +has(item))return item;if(Array.isArray(item)){Object.isFrozen(item)?item=item.slice( +0):set.add(item);for(let i2=0,l=item.length;i2value),Array.isArray(state)&&state.length!==len){for(let i2=state.length;i2< +len;i2++)(node=nodes[i2])&&node.$();(node=getNode(nodes,"length",len))&&node.$(state. +length)}(node=nodes[$SELF])&&node.$()}__name(setProperty,"setProperty");function proxyDescriptor(target,property){let desc=Reflect.getOwnPropertyDescriptor( +target,property);return!desc||desc.get||desc.set||!desc.configurable||property=== +$PROXY||property===$NODE||(delete desc.value,delete desc.writable,desc.get=()=>target[$PROXY][property], +desc.set=v=>target[$PROXY][property]=v),desc}__name(proxyDescriptor,"proxyDescri\ +ptor");var proxyTraps={get(target,property,receiver2){if(property===$RAW)return target; +if(property===$PROXY)return receiver2;if(property===$TRACK)return trackSelf(target), +receiver2;let nodes=getNodes(target,$NODE),tracked=nodes[property],value=tracked? +tracked():target[property];if(property===$NODE||property===$HAS||property==="__p\ +roto__")return value;if(!tracked){let desc=Object.getOwnPropertyDescriptor(target, +property),isFunction=typeof value=="function";if(getListener()&&(!isFunction||target. +hasOwnProperty(property))&&!(desc&&desc.get))value=getNode(nodes,property,value)();else if(value!= +null&&isFunction&&value===Array.prototype[property])return(...args)=>batch(()=>Array. +prototype[property].apply(receiver2,args))}return isWrappable(value)?wrap(value): +value},has(target,property){return property===$RAW||property===$PROXY||property=== +$TRACK||property===$NODE||property===$HAS||property==="__proto__"?!0:(getListener()&& +getNode(getNodes(target,$HAS),property)(),property in target)},set(target,property,value){ +return batch(()=>setProperty(target,property,unwrap(value))),!0},deleteProperty(target,property){ +return batch(()=>setProperty(target,property,void 0,!0)),!0},ownKeys,getOwnPropertyDescriptor:proxyDescriptor}; +function wrap(value){let p2=value[$PROXY];if(!p2){Object.defineProperty(value,$PROXY, +{value:p2=new Proxy(value,proxyTraps)});let keys=Object.keys(value),desc=Object. +getOwnPropertyDescriptors(value);for(let i2=0,l=keys.length;i2batch(()=>og.call(p2,v)),"set")})}}}return p2}__name(wrap,"wrap"); +function createMutable(state,options){let unwrappedStore=unwrap(state||{});return wrap( +unwrappedStore)}__name(createMutable,"createMutable");function modifyMutable(state,modifier){ +batch(()=>modifier(unwrap(state)))}__name(modifyMutable,"modifyMutable");var $ROOT=Symbol( +"store-root");function applyState(target,parent,property,merge,key2){let previous=parent[property]; +if(target===previous)return;let isArray=Array.isArray(target);if(property!==$ROOT&& +(!isWrappable(target)||!isWrappable(previous)||isArray&&!Array.isArray(previous)|| +key2&&target[key2]!==previous[key2])){setProperty(parent,property,target);return} +if(isArray){if(target.length&&previous.length&&(!merge||key2&&target[0]&&target[0][key2]!= +null)){let i2,j2,start,end,newEnd,item,newIndicesNext,keyVal;for(start=0,end=Math. +min(previous.length,target.length);start=start&& +newEnd>=start&&(previous[end]===target[newEnd]||key2&&previous[start]&&target[start]&& +previous[end][key2]===target[newEnd][key2]);end--,newEnd--)temp[newEnd]=previous[end]; +if(start>newEnd||start>end){for(j2=start;j2<=newEnd;j2++)setProperty(previous,j2, +target[j2]);for(;j2target.length&&setProperty(previous, +"length",target.length);return}for(newIndicesNext=new Array(newEnd+1),j2=newEnd;j2>= +start;j2--)item=target[j2],keyVal=key2&&item?item[key2]:item,i2=newIndices.get(keyVal), +newIndicesNext[j2]=i2===void 0?-1:i2,newIndices.set(keyVal,j2);for(i2=start;i2<= +end;i2++)item=previous[i2],keyVal=key2&&item?item[key2]:item,j2=newIndices.get(keyVal), +j2!==void 0&&j2!==-1&&(temp[j2]=previous[i2],j2=newIndicesNext[j2],newIndices.set( +keyVal,j2));for(j2=start;j2target.length&&setProperty(previous,"len\ +gth",target.length);return}let targetKeys=Object.keys(target);for(let i2=0,len=targetKeys. +length;i2{if(!isWrappable(state)|| +!isWrappable(v))return v;let res=applyState(v,{[$ROOT]:state},$ROOT,merge,key2); +return res===void 0?state:res}}__name(reconcile,"reconcile");var BehaviorMap=class extends Map{static{__name(this,"BehaviorMap")}#reactivityTriggerObject=createMutable( +{});find(predicate){let result;for(let[name2,behavior2]of this)if(predicate(name2, +behavior2)){result=behavior2;break}return result}get(key2){return this.#reactivityTriggerObject[key2], +super.get(key2)}set(key2,value){return queueMicrotask(()=>{this.#reactivityTriggerObject[key2]= +value}),super.set(key2,value),this}delete(key2){return queueMicrotask(()=>{delete this.#reactivityTriggerObject[key2]}), +super.delete(key2)}clear(){queueMicrotask(()=>{modifyMutable(this.#reactivityTriggerObject, +reconcile({}))}),super.clear()}has(key2){return this.#reactivityTriggerObject[key2], +super.has(key2)}entries(){return this.#reactivityTriggerObject[$TRACK],super.entries()}[Symbol. +iterator](){return this.#reactivityTriggerObject[$TRACK],super[Symbol.iterator]()}forEach(callbackfn,thisArg){ +this.#reactivityTriggerObject[$TRACK],super.forEach(callbackfn,thisArg)}keys(){return this.#reactivityTriggerObject[$TRACK], +super.keys()}get size(){return this.#reactivityTriggerObject[$TRACK],super.size}set size(n){ +super.size=n}};var BehaviorRegistry=class{static{__name(this,"BehaviorRegistry")}#definedBehaviors=new Map;#whenDefinedPromises=new Map;define(name2,Behavior2){ +if(!this.#definedBehaviors.has(name2))this.#definedBehaviors.set(name2,Behavior2), +this.#whenDefinedPromises.has(name2)&&(this.#whenDefinedPromises.get(name2).resolve(), +this.#whenDefinedPromises.delete(name2));else throw new Error(`Behavior ${name2}\ + is already defined.`)}get(name2){return this.#definedBehaviors.get(name2)}has(name2){ +return this.#definedBehaviors.has(name2)}whenDefined(name2){if(this.#whenDefinedPromises. +has(name2))return this.#whenDefinedPromises.get(name2).promise;if(this.has(name2)) +return Promise.resolve();let resolve,promise=new Promise(r3=>resolve=r3);return this.#whenDefinedPromises. +set(name2,{promise,resolve}),promise}},elementBehaviors2;globalThis.window?.document&& +(elementBehaviors2=globalThis.elementBehaviors=new BehaviorRegistry);var forEach=Array.prototype.forEach,CustomAttributeRegistry=class{static{__name( +this,"CustomAttributeRegistry")}ownerDocument;_attrMap=new Map;_elementMap=new WeakMap;_observer=new MutationObserver( +mutations=>{forEach.call(mutations,m=>{m.type==="attributes"?this._getConstructor( +m.attributeName)&&this._handleChange(m.attributeName,m.target,m.oldValue):(forEach. +call(m.removedNodes,this._elementDisconnected),forEach.call(m.addedNodes,this._elementConnected))})});constructor(ownerDocument){ +if(this.ownerDocument=ownerDocument,!ownerDocument)throw new Error("Must be give\ +n a document")}define(attrName2,Class2){this._attrMap.set(attrName2,Class2),this. +_upgradeAttr(attrName2),this._reobserve()}get(element2,attrName2){let map=this._elementMap. +get(element2);if(map)return map.get(attrName2)}_getConstructor(attrName2){return this. +_attrMap.get(attrName2)}_observe(){this._observer.observe(this.ownerDocument,{childList:!0, +subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:Array.from(this._attrMap. +keys())})}_unobserve(){this._observer.disconnect()}_reobserve(){this._unobserve(), +this._observe()}_upgradeAttr(attrName2,node=this.ownerDocument){let matches=node. +querySelectorAll("["+attrName2+"]");forEach.call(matches,element2=>this._handleChange( +attrName2,element2,null))}_elementConnected=element2=>{element2.nodeType===1&&(forEach. +call(element2.attributes,attr=>{this._getConstructor(attr.name)&&this._handleChange( +attr.name,element2,null)}),this._attrMap.forEach((_constructor,attr)=>this._upgradeAttr( +attr,element2)))};_elementDisconnected=element2=>{let map=this._elementMap.get(element2); +map&&(map.forEach(inst=>inst.disconnectedCallback?.(),this),this._elementMap.delete( +element2))};_handleChange(attrName2,el2,oldVal){let map=this._elementMap.get(el2); +map||this._elementMap.set(el2,map=new Map);let inst=map.get(attrName2),newVal=el2. +getAttribute(attrName2);if(!inst){let Constructor3=this._getConstructor(attrName2); +if(inst=new Constructor3,map.set(attrName2,inst),inst.ownerElement=el2,inst.name= +attrName2,newVal==null)throw new Error("Not possible!");inst.value=newVal,inst.connectedCallback?.(); +return}if(newVal==null)inst.disconnectedCallback?.(),map.delete(attrName2);else if(newVal!== +inst.value){if(inst.value=newVal,oldVal==null)throw new Error("Not possible!");inst. +changedCallback?.(oldVal,newVal)}}};if(globalThis.window?.document){let _attachShadow=Element. +prototype.attachShadow;Element.prototype.attachShadow=__name(function(options){let root=_attachShadow. +call(this,options);return root.customAttributes||(root.customAttributes=new CustomAttributeRegistry( +root)),root},"attachShadow")}var customAttributes;globalThis.window?.document&&(customAttributes=globalThis.customAttributes= +new CustomAttributeRegistry(document));function Privates(){let storage=new WeakMap;return obj=>{let privates=storage.get( +obj);return privates||storage.set(obj,privates={}),privates}}__name(Privates,"Pr\ +ivates");var _=Privates(),PromiseCancellation=class extends Error{static{__name(this,"Pro\ +miseCancellation")}},CancelablePromise=class extends Promise{static{__name(this, +"CancelablePromise")}canceled;constructor(executor,options){let rejectOnCancel=options? +options.rejectOnCancel:!1,originalReject;if(executor instanceof Promise){let promise=executor; +super((resolve,reject)=>{originalReject=reject,promise.then(value=>{this.canceled|| +resolve(value)}).catch(error=>{this.canceled||reject(error)})})}else super((resolve,reject)=>{ +originalReject=reject,executor(value=>{this.canceled||resolve(value)},error=>{this. +canceled||reject(error)})});this.canceled=!1,_(this).originalReject=originalReject, +_(this).rejectOnCancel=rejectOnCancel}cancel(){this.canceled=!0,_(this).rejectOnCancel&& +_(this).originalReject(new PromiseCancellation("canceled"))}};var HasAttribute=class{static{__name(this,"HasAttribute")}get behaviors(){return this. +ownerElement.behaviors}observers=new Map;elementDefinedPromises=new Map;isConnected=!1;connectedCallback(){ +this.isConnected=!0,this.changedCallback("",this.value)}disconnectedCallback(){this. +isConnected=!1,this.#skipConnectedCheck=!0,this.changedCallback(this.value,""),this.#skipConnectedCheck= +!1}#skipConnectedCheck=!1;changedCallback(oldVal,newVal){if(!this.#skipConnectedCheck&& +!this.isConnected)return;let currentBehaviors=this.getBehaviorNames(newVal),previousBehaviors=this. +getBehaviorNames(oldVal);if(currentBehaviors.length==0&&previousBehaviors.length== +0)return;let{removed,added}=this.getDiff(previousBehaviors,currentBehaviors);this. +handleDiff(removed,added)}getBehaviorNames(string){return string.trim()==""?[]:string. +split(/\s+/)}getDiff(previousBehaviors,currentBehaviors){let diff={removed:[],added:currentBehaviors}; +for(let i2=0,l=previousBehaviors.length;i2{if(!behavior2.attributeChangedCallback)return; +let lastAttributeValues={},name2="";for(let record of records)if(record.type==="\ +attributes"){if(name2=record.attributeName,lastAttributeValues[name2]===void 0){ +lastAttributeValues[name2]=record.oldValue;continue}behavior2.attributeChangedCallback( +name2,lastAttributeValues[name2],record.oldValue,this.ownerElement),lastAttributeValues[name2]= +record.oldValue}let attr;for(let name3 in lastAttributeValues)attr=el2.attributes. +getNamedItem(name3),behavior2.attributeChangedCallback(name3,lastAttributeValues[name3], +attr===null?null:attr.value,this.ownerElement)});observer.observe(el2,{attributes:!0, +attributeOldValue:!0,attributeFilter:behavior2.constructor.observedAttributes}), +this.observers.set(behavior2,observer)}fireInitialAttributeChangedCallbacks(behavior2,attributes){ +if(behavior2.attributeChangedCallback)for(let name2 of attributes)this.ownerElement. +hasAttribute(name2)&&behavior2.attributeChangedCallback(name2,null,this.ownerElement. +attributes.getNamedItem(name2).value,this.ownerElement)}};if(globalThis.window?. +document){let behaviorMaps=new WeakMap;Object.defineProperty(Element.prototype,"\ +behaviors",{get(){let behaviorMap=null;return behaviorMaps.has(this)?behaviorMap= +behaviorMaps.get(this):behaviorMaps.set(this,behaviorMap=new BehaviorMap),behaviorMap}}); +let _attachShadow=Element.prototype.attachShadow;Element.prototype.attachShadow= +function(options){let root=_attachShadow.call(this,options);return root.customAttributes. +define("has",HasAttribute),root},globalThis.customAttributes.define("has",HasAttribute)}var propsAndCallbacks=new WeakMap;function observe(object,propertyNames,callback,options={}){ +options.async=options.async||!1,options.inherited=options.inherited||!1;for(let propName of propertyNames){ +let propCallbacks=propsAndCallbacks.get(object);!propCallbacks&&propsAndCallbacks. +set(object,propCallbacks=new Map);let callbacks=propCallbacks.get(propName);callbacks|| +(propCallbacks.set(propName,callbacks=[]),defineObservationGetterSetter(object,propName, +options)),callbacks.includes(callback)||callbacks.push(callback)}}__name(observe, +"observe");function unobserve(object,props,callback){let propCallbacks=propsAndCallbacks. +get(object);if(!propCallbacks){console.warn("the object is not observed, no need\ + to unobserve:",object);return}if(typeof props=="function"&&(callback=props,props= +Array.from(propCallbacks.keys())),!callback)throw new TypeError("callback not su\ +pplied");for(let prop of props){let callbacks=propCallbacks.get(prop);callbacks. +includes(callback)&&(callbacks.splice(callbacks.indexOf(callback),1),callbacks.length|| +propCallbacks.delete(prop))}}__name(unobserve,"unobserve");var objectsToObservableProps=new WeakMap; +function defineObservationGetterSetter(object,propName,options){let observableProps, +inherited=options.inherited;if(!inherited){if(observableProps=objectsToObservableProps. +get(object),!observableProps)objectsToObservableProps.set(object,observableProps= +new Set);else if(observableProps.has(propName))return}let descriptor=getInheritedDescriptor( +object,propName)||{value:void 0,writable:!0,configurable:!0,enumerable:!0},owner=options. +inherited&&descriptor.owner||object;if(inherited){if(observableProps=objectsToObservableProps. +get(owner),!observableProps)objectsToObservableProps.set(owner,observableProps=new Set);else if(observableProps. +has(propName))return}let getValue,setValue;if(descriptor.get||descriptor.set){let oldGet=descriptor. +get,oldSet=descriptor.set;getValue=oldGet?()=>oldGet.call(object):void 0,setValue= +oldSet?value=>oldSet.call(object,value):void 0}else{let _value=descriptor.value; +if(!descriptor.writable)throw console.error(`Can not observe readonly property "${String( +propName)}" with descriptor`,descriptor,"of object:",object),new Error(`Can not \ +observe readonly property "${String(propName)}" of object: ${object} (see above)`); +delete descriptor.value,delete descriptor.writable,getValue=__name(()=>_value,"g\ +etValue"),setValue=__name(value=>_value=value,"setValue")}if(!setValue)throw new Error( +"Can not observe read-only property.");if(!getValue)throw new Error("Can not obs\ +erve write-only property.");Object.defineProperty(owner,propName,{...descriptor, +get:getValue,set(value){setValue(value),runCallbacks(object,propName,getValue())}}), +observableProps.add(propName)}__name(defineObservationGetterSetter,"defineObserv\ +ationGetterSetter");function runCallbacks(object,propName,value){let callbacks=propsAndCallbacks. +get(object).get(propName);if(callbacks)for(let callback of callbacks)callback(propName, +value)}__name(runCallbacks,"runCallbacks");var isPropReceiverClass=Symbol();function PropReceiver(Base=Object){var _a2;return class extends Base{static{ +__name(this,"PropReceiver")}static{this[isPropReceiverClass]=!0}constructor(...args){ +super(...args),this._propChangedCallback=this._propChangedCallback.bind(this)}connectedCallback(){ +super.connectedCallback?.(),this.#observeProps()}disconnectedCallback(){super.disconnectedCallback?.(), +this.#unobserveProps()}get observedObject(){throw new TypeError(` + The subclass using PropReceiver must define + 'observedObject' to specify the object from which props + are received. + `)}_propChangedCallback(propName,value){this[propName]=value}#observeProps(){ +let ctor2=this.constructor;ctor2.receivedProperties&&(ctor2.receivedProperties=Array. +from(new Set(ctor2.receivedProperties))),this.__receiveInitialValues(),observe(this. +observedObject,this.__getReceivedProps(),this._propChangedCallback,{})}#unobserveProps(){ +unobserve(this.observedObject,this.__getReceivedProps(),this._propChangedCallback)}static receivedProperties;__getReceivedProps(){ +let props=this.constructor.receivedProperties||[];if(!Array.isArray(props))throw new TypeError( +"Expected static receivedProperties to be an array.");return props}__receiveInitialValues(){ +let observed=this.observedObject;for(let prop of this.__getReceivedProps())if(prop in +observed){let value=observed[prop];this._propChangedCallback(prop,value!==void 0? +value:this[prop])}}}}__name(PropReceiver,"PropReceiver");function checkIsObject(o){ +if(typeof o!="object")throw new Error("cannot use @receiver on class returning a\ + non-object instance");return!0}__name(checkIsObject,"checkIsObject");function receiver(_3,context){ +let{kind,name:name2}=context;if(kind==="field")return function(initialValue){return checkIsObject( +this),trackReceiverProperty(this,name2),initialValue};if(kind==="getter"||kind=== +"setter"||kind==="accessor")context.addInitializer(function(){checkIsObject(this), +trackReceiverProperty(this,name2)});else throw new TypeError("@receiver is for u\ +se only on class fields, getters/setters, and auto accessors. Also make sure you\ +r class extends from PropReceiver.")}__name(receiver,"receiver");function trackReceiverProperty(obj,name2){ +let ctor2=obj.constructor;if(!ctor2[isPropReceiverClass])throw new TypeError("@r\ +eceiver must be used on a property of a class that extends PropReceiver");ctor2. +hasOwnProperty("receivedProperties")||(ctor2.receivedProperties=[...ctor2.receivedProperties|| +[]]),ctor2.receivedProperties.push(name2)}__name(trackReceiverProperty,"trackRec\ +eiverProperty");function behavior(nameOrClass,context){if(typeof nameOrClass=="string"&&context== +null)return(Class2,context2)=>elementBehaviors.define(nameOrClass,element(Class2, +context2));if(context&&context.kind==="class")return element(nameOrClass,context); +throw new TypeError("Invalid decorator usage. Call with a string, or as a plain \ +decorator with, only on a class meant to be used as an element behavior.")}__name( +behavior,"behavior");var Behavior=class extends PropReceiver(){static{__name(this, +"Behavior")}static awaitElementDefined=!0;element;constructor(element2){super(), +this.#checkElementIsLibraryElement(element2),this.element=element2}requiredElementType(){ +return[Element]}get observedObject(){return this.element}#whenDefined=null;#elementDefined=!1;__receiveInitialValues(){ +super.__receiveInitialValues(),this.#fowardPreUpgradeValues()}#preUpgradeValuesHandled=!1;#fowardPreUpgradeValues(){ +if(this.#preUpgradeValuesHandled)return;let el2=this.observedObject;if(isLumeElement( +el2)){this.#preUpgradeValuesHandled=!0;for(let prop of this.__getReceivedProps()){ +let value=el2._preUpgradeValues.get(prop);value!==void 0&&this._propChangedCallback( +prop,value)}}}async#checkElementIsLibraryElement(element2){let classes=this.requiredElementType(); +if(element2.nodeName.includes("-")){if(this.#whenDefined=customElements.whenDefined( +element2.nodeName.toLowerCase()),this.#whenDefined.then(()=>{this.#elementDefined= +classes.some(Class2=>element2 instanceof Class2),this.#fowardPreUpgradeValues()}), +await Promise.race([this.#whenDefined,new Promise(r3=>setTimeout(r3,1e3))]),!this.#elementDefined){ +let errorMessage=` + Either the element you're using the behavior on + (<${element2.tagName.toLowerCase()}>) is not an instance of one + of the allowed classes, or there was a 1-second timeout waiting + for the element to be defined. Please make sure all elements + you intend to use are defined. The allowed classes are: + `;throw queueMicrotask(()=>console.error(errorMessage,classes)),new Error(`${errorMessage}\ + + + ${classes} + `)}}else{let errorMessage=` + The element you're using the mesh behavior on (<${element2.tagName.toLowerCase()}\ +>) + is not an instance of one of the following classes: + `;throw queueMicrotask(()=>console.error(errorMessage,classes)),new Error(`${errorMessage}\ + + + ${classes} + `)}}};function isLumeElement(el2){return"_preUpgradeValues"in el2}__name(isLumeElement, +"isLumeElement");var _lut=["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"];var DEG2RAD=Math.PI/180,RAD2DEG=180/Math.PI;function generateUUID(){let d0=Math. +random()*4294967295|0,d1=Math.random()*4294967295|0,d2=Math.random()*4294967295| +0,d3=Math.random()*4294967295|0;return(_lut[d0&255]+_lut[d0>>8&255]+_lut[d0>>16& +255]+_lut[d0>>24&255]+"-"+_lut[d1&255]+_lut[d1>>8&255]+"-"+_lut[d1>>16&15|64]+_lut[d1>> +24&255]+"-"+_lut[d2&63|128]+_lut[d2>>8&255]+"-"+_lut[d2>>16&255]+_lut[d2>>24&255]+ +_lut[d3&255]+_lut[d3>>8&255]+_lut[d3>>16&255]+_lut[d3>>24&255]).toLowerCase()}__name( +generateUUID,"generateUUID");function clamp(value,min,max2){return Math.max(min, +Math.min(max2,value))}__name(clamp,"clamp");function euclideanModulo(n,m){return(n% +m+m)%m}__name(euclideanModulo,"euclideanModulo");function lerp(x2,y2,t){return(1-t)*x2+t*y2}__name(lerp,"lerp");function isPowerOfTwo(value){return(value&value-1)===0&&value!==0}__name(isPowerOfTwo, +"isPowerOfTwo");function floorPowerOfTwo(value){return Math.pow(2,Math.floor(Math.log(value)/Math. +LN2))}__name(floorPowerOfTwo,"floorPowerOfTwo");function denormalize(value,array){switch(array.constructor){case Float32Array:return value;case Uint32Array: +return value/4294967295;case Uint16Array:return value/65535;case Uint8Array:return value/ +255;case Int32Array:return Math.max(value/2147483647,-1);case Int16Array:return Math. +max(value/32767,-1);case Int8Array:return Math.max(value/127,-1);default:throw new Error( +"Invalid component type.")}}__name(denormalize,"denormalize");function normalize(value,array){ +switch(array.constructor){case Float32Array:return value;case Uint32Array:return Math. +round(value*4294967295);case Uint16Array:return Math.round(value*65535);case Uint8Array: +return Math.round(value*255);case Int32Array:return Math.round(value*2147483647);case Int16Array: +return Math.round(value*32767);case Int8Array:return Math.round(value*127);default: +throw new Error("Invalid component type.")}}__name(normalize,"normalize");var Quaternion=class{static{__name(this,"Quaternion")}constructor(x2=0,y2=0,z2=0,w2=1){ +this.isQuaternion=!0,this._x=x2,this._y=y2,this._z=z2,this._w=w2}static slerpFlat(dst,dstOffset,src0,srcOffset0,src1,srcOffset1,t){ +let x0=src0[srcOffset0+0],y0=src0[srcOffset0+1],z0=src0[srcOffset0+2],w0=src0[srcOffset0+ +3],x1=src1[srcOffset1+0],y1=src1[srcOffset1+1],z1=src1[srcOffset1+2],w1=src1[srcOffset1+ +3];if(t===0){dst[dstOffset+0]=x0,dst[dstOffset+1]=y0,dst[dstOffset+2]=z0,dst[dstOffset+ +3]=w0;return}if(t===1){dst[dstOffset+0]=x1,dst[dstOffset+1]=y1,dst[dstOffset+2]= +z1,dst[dstOffset+3]=w1;return}if(w0!==w1||x0!==x1||y0!==y1||z0!==z1){let s=1-t,cos=x0* +x1+y0*y1+z0*z1+w0*w1,dir=cos>=0?1:-1,sqrSin=1-cos*cos;if(sqrSin>Number.EPSILON){ +let sin=Math.sqrt(sqrSin),len=Math.atan2(sin,cos*dir);s=Math.sin(s*len)/sin,t=Math. +sin(t*len)/sin}let tDir=t*dir;if(x0=x0*s+x1*tDir,y0=y0*s+y1*tDir,z0=z0*s+z1*tDir, +w0=w0*s+w1*tDir,s===1-t){let f=1/Math.sqrt(x0*x0+y0*y0+z0*z0+w0*w0);x0*=f,y0*=f, +z0*=f,w0*=f}}dst[dstOffset]=x0,dst[dstOffset+1]=y0,dst[dstOffset+2]=z0,dst[dstOffset+ +3]=w0}static multiplyQuaternionsFlat(dst,dstOffset,src0,srcOffset0,src1,srcOffset1){ +let x0=src0[srcOffset0],y0=src0[srcOffset0+1],z0=src0[srcOffset0+2],w0=src0[srcOffset0+ +3],x1=src1[srcOffset1],y1=src1[srcOffset1+1],z1=src1[srcOffset1+2],w1=src1[srcOffset1+ +3];return dst[dstOffset]=x0*w1+w0*x1+y0*z1-z0*y1,dst[dstOffset+1]=y0*w1+w0*y1+z0* +x1-x0*z1,dst[dstOffset+2]=z0*w1+w0*z1+x0*y1-y0*x1,dst[dstOffset+3]=w0*w1-x0*x1-y0* +y1-z0*z1,dst}get x(){return this._x}set x(value){this._x=value,this._onChangeCallback()}get y(){ +return this._y}set y(value){this._y=value,this._onChangeCallback()}get z(){return this. +_z}set z(value){this._z=value,this._onChangeCallback()}get w(){return this._w}set w(value){ +this._w=value,this._onChangeCallback()}set(x2,y2,z2,w2){return this._x=x2,this._y= +y2,this._z=z2,this._w=w2,this._onChangeCallback(),this}clone(){return new this.constructor( +this._x,this._y,this._z,this._w)}copy(quaternion){return this._x=quaternion.x,this. +_y=quaternion.y,this._z=quaternion.z,this._w=quaternion.w,this._onChangeCallback(), +this}setFromEuler(euler,update=!0){let x2=euler._x,y2=euler._y,z2=euler._z,order=euler. +_order,cos=Math.cos,sin=Math.sin,c1=cos(x2/2),c22=cos(y2/2),c3=cos(z2/2),s1=sin( +x2/2),s2=sin(y2/2),s3=sin(z2/2);switch(order){case"XYZ":this._x=s1*c22*c3+c1*s2* +s3,this._y=c1*s2*c3-s1*c22*s3,this._z=c1*c22*s3+s1*s2*c3,this._w=c1*c22*c3-s1*s2* +s3;break;case"YXZ":this._x=s1*c22*c3+c1*s2*s3,this._y=c1*s2*c3-s1*c22*s3,this._z= +c1*c22*s3-s1*s2*c3,this._w=c1*c22*c3+s1*s2*s3;break;case"ZXY":this._x=s1*c22*c3- +c1*s2*s3,this._y=c1*s2*c3+s1*c22*s3,this._z=c1*c22*s3+s1*s2*c3,this._w=c1*c22*c3- +s1*s2*s3;break;case"ZYX":this._x=s1*c22*c3-c1*s2*s3,this._y=c1*s2*c3+s1*c22*s3,this. +_z=c1*c22*s3-s1*s2*c3,this._w=c1*c22*c3+s1*s2*s3;break;case"YZX":this._x=s1*c22* +c3+c1*s2*s3,this._y=c1*s2*c3+s1*c22*s3,this._z=c1*c22*s3-s1*s2*c3,this._w=c1*c22* +c3-s1*s2*s3;break;case"XZY":this._x=s1*c22*c3-c1*s2*s3,this._y=c1*s2*c3-s1*c22*s3, +this._z=c1*c22*s3+s1*s2*c3,this._w=c1*c22*c3+s1*s2*s3;break;default:console.warn( +"THREE.Quaternion: .setFromEuler() encountered an unknown order: "+order)}return update=== +!0&&this._onChangeCallback(),this}setFromAxisAngle(axis,angle){let halfAngle=angle/ +2,s=Math.sin(halfAngle);return this._x=axis.x*s,this._y=axis.y*s,this._z=axis.z* +s,this._w=Math.cos(halfAngle),this._onChangeCallback(),this}setFromRotationMatrix(m){ +let te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2], +m32=te[6],m33=te[10],trace=m11+m22+m33;if(trace>0){let s=.5/Math.sqrt(trace+1);this. +_w=.25/s,this._x=(m32-m23)*s,this._y=(m13-m31)*s,this._z=(m21-m12)*s}else if(m11> +m22&&m11>m33){let s=2*Math.sqrt(1+m11-m22-m33);this._w=(m32-m23)/s,this._x=.25*s, +this._y=(m12+m21)/s,this._z=(m13+m31)/s}else if(m22>m33){let s=2*Math.sqrt(1+m22- +m11-m33);this._w=(m13-m31)/s,this._x=(m12+m21)/s,this._y=.25*s,this._z=(m23+m32)/ +s}else{let s=2*Math.sqrt(1+m33-m11-m22);this._w=(m21-m12)/s,this._x=(m13+m31)/s, +this._y=(m23+m32)/s,this._z=.25*s}return this._onChangeCallback(),this}setFromUnitVectors(vFrom,vTo){ +let r3=vFrom.dot(vTo)+1;return r3Math.abs( +vFrom.z)?(this._x=-vFrom.y,this._y=vFrom.x,this._z=0,this._w=r3):(this._x=0,this. +_y=-vFrom.z,this._z=vFrom.y,this._w=r3)):(this._x=vFrom.y*vTo.z-vFrom.z*vTo.y,this. +_y=vFrom.z*vTo.x-vFrom.x*vTo.z,this._z=vFrom.x*vTo.y-vFrom.y*vTo.x,this._w=r3),this. +normalize()}angleTo(q2){return 2*Math.acos(Math.abs(clamp(this.dot(q2),-1,1)))}rotateTowards(q2,step){ +let angle=this.angleTo(q2);if(angle===0)return this;let t=Math.min(1,step/angle); +return this.slerp(q2,t),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(v){return this._x*v._x+this._y*v._y+this._z*v._z+this._w*v._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 l=this.length();return l===0?(this._x=0,this._y=0,this._z=0,this._w=1):(l=1/ +l,this._x=this._x*l,this._y=this._y*l,this._z=this._z*l,this._w=this._w*l),this. +_onChangeCallback(),this}multiply(q2){return this.multiplyQuaternions(this,q2)}premultiply(q2){ +return this.multiplyQuaternions(q2,this)}multiplyQuaternions(a,b){let qax=a._x,qay=a. +_y,qaz=a._z,qaw=a._w,qbx=b._x,qby=b._y,qbz=b._z,qbw=b._w;return this._x=qax*qbw+ +qaw*qbx+qay*qbz-qaz*qby,this._y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz,this._z=qaz*qbw+ +qaw*qbz+qax*qby-qay*qbx,this._w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz,this._onChangeCallback(), +this}slerp(qb,t){if(t===0)return this;if(t===1)return this.copy(qb);let x2=this. +_x,y2=this._y,z2=this._z,w2=this._w,cosHalfTheta=w2*qb._w+x2*qb._x+y2*qb._y+z2*qb. +_z;if(cosHalfTheta<0?(this._w=-qb._w,this._x=-qb._x,this._y=-qb._y,this._z=-qb._z, +cosHalfTheta=-cosHalfTheta):this.copy(qb),cosHalfTheta>=1)return this._w=w2,this. +_x=x2,this._y=y2,this._z=z2,this;let sqrSinHalfTheta=1-cosHalfTheta*cosHalfTheta; +if(sqrSinHalfTheta<=Number.EPSILON){let s=1-t;return this._w=s*w2+t*this._w,this. +_x=s*x2+t*this._x,this._y=s*y2+t*this._y,this._z=s*z2+t*this._z,this.normalize(), +this}let sinHalfTheta=Math.sqrt(sqrSinHalfTheta),halfTheta=Math.atan2(sinHalfTheta, +cosHalfTheta),ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta,ratioB=Math.sin(t*halfTheta)/ +sinHalfTheta;return this._w=w2*ratioA+this._w*ratioB,this._x=x2*ratioA+this._x*ratioB, +this._y=y2*ratioA+this._y*ratioB,this._z=z2*ratioA+this._z*ratioB,this._onChangeCallback(), +this}slerpQuaternions(qa,qb,t){return this.copy(qa).slerp(qb,t)}random(){let u1=Math. +random(),sqrt1u1=Math.sqrt(1-u1),sqrtu1=Math.sqrt(u1),u2=2*Math.PI*Math.random(), +u3=2*Math.PI*Math.random();return this.set(sqrt1u1*Math.cos(u2),sqrtu1*Math.sin( +u3),sqrtu1*Math.cos(u3),sqrt1u1*Math.sin(u2))}equals(quaternion){return quaternion. +_x===this._x&&quaternion._y===this._y&&quaternion._z===this._z&&quaternion._w=== +this._w}fromArray(array,offset=0){return this._x=array[offset],this._y=array[offset+ +1],this._z=array[offset+2],this._w=array[offset+3],this._onChangeCallback(),this}toArray(array=[],offset=0){ +return array[offset]=this._x,array[offset+1]=this._y,array[offset+2]=this._z,array[offset+ +3]=this._w,array}fromBufferAttribute(attribute2,index){return this._x=attribute2. +getX(index),this._y=attribute2.getY(index),this._z=attribute2.getZ(index),this._w= +attribute2.getW(index),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(callback){ +return this._onChangeCallback=callback,this}_onChangeCallback(){}*[Symbol.iterator](){ +yield this._x,yield this._y,yield this._z,yield this._w}};var Vector3=class _Vector3{static{__name(this,"Vector3")}constructor(x2=0,y2=0,z2=0){ +_Vector3.prototype.isVector3=!0,this.x=x2,this.y=y2,this.z=z2}set(x2,y2,z2){return z2=== +void 0&&(z2=this.z),this.x=x2,this.y=y2,this.z=z2,this}setScalar(scalar){return this. +x=scalar,this.y=scalar,this.z=scalar,this}setX(x2){return this.x=x2,this}setY(y2){ +return this.y=y2,this}setZ(z2){return this.z=z2,this}setComponent(index,value){switch(index){case 0: +this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;default:throw new Error( +"index is out of range: "+index)}return this}getComponent(index){switch(index){case 0: +return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error( +"index is out of range: "+index)}}clone(){return new this.constructor(this.x,this. +y,this.z)}copy(v){return this.x=v.x,this.y=v.y,this.z=v.z,this}add(v){return this. +x+=v.x,this.y+=v.y,this.z+=v.z,this}addScalar(s){return this.x+=s,this.y+=s,this. +z+=s,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this}addScaledVector(v,s){ +return this.x+=v.x*s,this.y+=v.y*s,this.z+=v.z*s,this}sub(v){return this.x-=v.x, +this.y-=v.y,this.z-=v.z,this}subScalar(s){return this.x-=s,this.y-=s,this.z-=s,this}subVectors(a,b){ +return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this}multiply(v){return this. +x*=v.x,this.y*=v.y,this.z*=v.z,this}multiplyScalar(scalar){return this.x*=scalar, +this.y*=scalar,this.z*=scalar,this}multiplyVectors(a,b){return this.x=a.x*b.x,this. +y=a.y*b.y,this.z=a.z*b.z,this}applyEuler(euler){return this.applyQuaternion(_quaternion. +setFromEuler(euler))}applyAxisAngle(axis,angle){return this.applyQuaternion(_quaternion. +setFromAxisAngle(axis,angle))}applyMatrix3(m){let x2=this.x,y2=this.y,z2=this.z, +e=m.elements;return this.x=e[0]*x2+e[3]*y2+e[6]*z2,this.y=e[1]*x2+e[4]*y2+e[7]*z2, +this.z=e[2]*x2+e[5]*y2+e[8]*z2,this}applyNormalMatrix(m){return this.applyMatrix3( +m).normalize()}applyMatrix4(m){let x2=this.x,y2=this.y,z2=this.z,e=m.elements,w2=1/ +(e[3]*x2+e[7]*y2+e[11]*z2+e[15]);return this.x=(e[0]*x2+e[4]*y2+e[8]*z2+e[12])*w2, +this.y=(e[1]*x2+e[5]*y2+e[9]*z2+e[13])*w2,this.z=(e[2]*x2+e[6]*y2+e[10]*z2+e[14])* +w2,this}applyQuaternion(q2){let vx=this.x,vy=this.y,vz=this.z,qx=q2.x,qy=q2.y,qz=q2. +z,qw=q2.w,tx=2*(qy*vz-qz*vy),ty=2*(qz*vx-qx*vz),tz=2*(qx*vy-qy*vx);return this.x= +vx+qw*tx+qy*tz-qz*ty,this.y=vy+qw*ty+qz*tx-qx*tz,this.z=vz+qw*tz+qx*ty-qy*tx,this}project(camera){ +return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix)}unproject(camera){ +return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld)}transformDirection(m){ +let x2=this.x,y2=this.y,z2=this.z,e=m.elements;return this.x=e[0]*x2+e[4]*y2+e[8]* +z2,this.y=e[1]*x2+e[5]*y2+e[9]*z2,this.z=e[2]*x2+e[6]*y2+e[10]*z2,this.normalize()}divide(v){ +return this.x/=v.x,this.y/=v.y,this.z/=v.z,this}divideScalar(scalar){return this. +multiplyScalar(1/scalar)}min(v){return this.x=Math.min(this.x,v.x),this.y=Math.min( +this.y,v.y),this.z=Math.min(this.z,v.z),this}max(v){return this.x=Math.max(this. +x,v.x),this.y=Math.max(this.y,v.y),this.z=Math.max(this.z,v.z),this}clamp(min,max2){ +return this.x=Math.max(min.x,Math.min(max2.x,this.x)),this.y=Math.max(min.y,Math. +min(max2.y,this.y)),this.z=Math.max(min.z,Math.min(max2.z,this.z)),this}clampScalar(minVal,maxVal){ +return this.x=Math.max(minVal,Math.min(maxVal,this.x)),this.y=Math.max(minVal,Math. +min(maxVal,this.y)),this.z=Math.max(minVal,Math.min(maxVal,this.z)),this}clampLength(min,max2){ +let length=this.length();return this.divideScalar(length||1).multiplyScalar(Math. +max(min,Math.min(max2,length)))}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(v){ +return this.x*v.x+this.y*v.y+this.z*v.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(length){return this.normalize(). +multiplyScalar(length)}lerp(v,alpha){return this.x+=(v.x-this.x)*alpha,this.y+=(v. +y-this.y)*alpha,this.z+=(v.z-this.z)*alpha,this}lerpVectors(v1,v2,alpha){return this. +x=v1.x+(v2.x-v1.x)*alpha,this.y=v1.y+(v2.y-v1.y)*alpha,this.z=v1.z+(v2.z-v1.z)*alpha, +this}cross(v){return this.crossVectors(this,v)}crossVectors(a,b){let ax=a.x,ay=a. +y,az=a.z,bx=b.x,by=b.y,bz=b.z;return this.x=ay*bz-az*by,this.y=az*bx-ax*bz,this. +z=ax*by-ay*bx,this}projectOnVector(v){let denominator=v.lengthSq();if(denominator=== +0)return this.set(0,0,0);let scalar=v.dot(this)/denominator;return this.copy(v). +multiplyScalar(scalar)}projectOnPlane(planeNormal){return _vector.copy(this).projectOnVector( +planeNormal),this.sub(_vector)}reflect(normal){return this.sub(_vector.copy(normal). +multiplyScalar(2*this.dot(normal)))}angleTo(v){let denominator=Math.sqrt(this.lengthSq()* +v.lengthSq());if(denominator===0)return Math.PI/2;let theta=this.dot(v)/denominator; +return Math.acos(clamp(theta,-1,1))}distanceTo(v){return Math.sqrt(this.distanceToSquared( +v))}distanceToSquared(v){let dx=this.x-v.x,dy=this.y-v.y,dz=this.z-v.z;return dx* +dx+dy*dy+dz*dz}manhattanDistanceTo(v){return Math.abs(this.x-v.x)+Math.abs(this. +y-v.y)+Math.abs(this.z-v.z)}setFromSpherical(s){return this.setFromSphericalCoords( +s.radius,s.phi,s.theta)}setFromSphericalCoords(radius,phi,theta){let sinPhiRadius=Math. +sin(phi)*radius;return this.x=sinPhiRadius*Math.sin(theta),this.y=Math.cos(phi)* +radius,this.z=sinPhiRadius*Math.cos(theta),this}setFromCylindrical(c3){return this. +setFromCylindricalCoords(c3.radius,c3.theta,c3.y)}setFromCylindricalCoords(radius,theta,y2){ +return this.x=radius*Math.sin(theta),this.y=y2,this.z=radius*Math.cos(theta),this}setFromMatrixPosition(m){ +let e=m.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(m){ +let sx=this.setFromMatrixColumn(m,0).length(),sy=this.setFromMatrixColumn(m,1).length(), +sz=this.setFromMatrixColumn(m,2).length();return this.x=sx,this.y=sy,this.z=sz,this}setFromMatrixColumn(m,index){ +return this.fromArray(m.elements,index*4)}setFromMatrix3Column(m,index){return this. +fromArray(m.elements,index*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this. +z=e._z,this}setFromColor(c3){return this.x=c3.r,this.y=c3.g,this.z=c3.b,this}equals(v){ +return v.x===this.x&&v.y===this.y&&v.z===this.z}fromArray(array,offset=0){return this. +x=array[offset],this.y=array[offset+1],this.z=array[offset+2],this}toArray(array=[],offset=0){ +return array[offset]=this.x,array[offset+1]=this.y,array[offset+2]=this.z,array}fromBufferAttribute(attribute2,index){ +return this.x=attribute2.getX(index),this.y=attribute2.getY(index),this.z=attribute2. +getZ(index),this}random(){return this.x=Math.random(),this.y=Math.random(),this. +z=Math.random(),this}randomDirection(){let u2=(Math.random()-.5)*2,t=Math.random()* +Math.PI*2,f=Math.sqrt(1-u2**2);return this.x=f*Math.cos(t),this.y=f*Math.sin(t), +this.z=u2,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},_vector=new Vector3, +_quaternion=new Quaternion;var REVISION="160";var CullFaceNone=0,CullFaceBack=1,CullFaceFront=2;var BasicShadowMap=0,PCFShadowMap=1,PCFSoftShadowMap=2,VSMShadowMap=3,FrontSide=0, +BackSide=1,DoubleSide=2;var NoBlending=0,NormalBlending=1,AdditiveBlending=2,SubtractiveBlending=3,MultiplyBlending=4, +CustomBlending=5,AddEquation=100,SubtractEquation=101,ReverseSubtractEquation=102, +MinEquation=103,MaxEquation=104,ZeroFactor=200,OneFactor=201,SrcColorFactor=202, +OneMinusSrcColorFactor=203,SrcAlphaFactor=204,OneMinusSrcAlphaFactor=205,DstAlphaFactor=206, +OneMinusDstAlphaFactor=207,DstColorFactor=208,OneMinusDstColorFactor=209,SrcAlphaSaturateFactor=210, +ConstantColorFactor=211,OneMinusConstantColorFactor=212,ConstantAlphaFactor=213, +OneMinusConstantAlphaFactor=214,NeverDepth=0,AlwaysDepth=1,LessDepth=2,LessEqualDepth=3, +EqualDepth=4,GreaterEqualDepth=5,GreaterDepth=6,NotEqualDepth=7,MultiplyOperation=0, +MixOperation=1,AddOperation=2,NoToneMapping=0,LinearToneMapping=1,ReinhardToneMapping=2, +CineonToneMapping=3,ACESFilmicToneMapping=4,CustomToneMapping=5,AgXToneMapping=6;var UVMapping=300,CubeReflectionMapping=301,CubeRefractionMapping=302,EquirectangularReflectionMapping=303, +EquirectangularRefractionMapping=304,CubeUVReflectionMapping=306,RepeatWrapping=1e3, +ClampToEdgeWrapping=1001,MirroredRepeatWrapping=1002,NearestFilter=1003,NearestMipmapNearestFilter=1004;var NearestMipmapLinearFilter=1005;var LinearFilter=1006,LinearMipmapNearestFilter=1007;var LinearMipmapLinearFilter=1008;var UnsignedByteType=1009,ByteType=1010,ShortType=1011,UnsignedShortType=1012,IntType=1013, +UnsignedIntType=1014,FloatType=1015,HalfFloatType=1016,UnsignedShort4444Type=1017, +UnsignedShort5551Type=1018,UnsignedInt248Type=1020,AlphaFormat=1021,RGBAFormat=1023, +LuminanceFormat=1024,LuminanceAlphaFormat=1025,DepthFormat=1026,DepthStencilFormat=1027, +RedFormat=1028,RedIntegerFormat=1029,RGFormat=1030,RGIntegerFormat=1031,RGBAIntegerFormat=1033, +RGB_S3TC_DXT1_Format=33776,RGBA_S3TC_DXT1_Format=33777,RGBA_S3TC_DXT3_Format=33778, +RGBA_S3TC_DXT5_Format=33779,RGB_PVRTC_4BPPV1_Format=35840,RGB_PVRTC_2BPPV1_Format=35841, +RGBA_PVRTC_4BPPV1_Format=35842,RGBA_PVRTC_2BPPV1_Format=35843,RGB_ETC1_Format=36196, +RGB_ETC2_Format=37492,RGBA_ETC2_EAC_Format=37496,RGBA_ASTC_4x4_Format=37808,RGBA_ASTC_5x4_Format=37809, +RGBA_ASTC_5x5_Format=37810,RGBA_ASTC_6x5_Format=37811,RGBA_ASTC_6x6_Format=37812, +RGBA_ASTC_8x5_Format=37813,RGBA_ASTC_8x6_Format=37814,RGBA_ASTC_8x8_Format=37815, +RGBA_ASTC_10x5_Format=37816,RGBA_ASTC_10x6_Format=37817,RGBA_ASTC_10x8_Format=37818, +RGBA_ASTC_10x10_Format=37819,RGBA_ASTC_12x10_Format=37820,RGBA_ASTC_12x12_Format=37821, +RGBA_BPTC_Format=36492,RGB_BPTC_SIGNED_Format=36494,RGB_BPTC_UNSIGNED_Format=36495, +RED_RGTC1_Format=36283,SIGNED_RED_RGTC1_Format=36284,RED_GREEN_RGTC2_Format=36285, +SIGNED_RED_GREEN_RGTC2_Format=36286;var LinearEncoding=3e3,sRGBEncoding=3001,BasicDepthPacking=3200,RGBADepthPacking=3201, +TangentSpaceNormalMap=0,ObjectSpaceNormalMap=1,NoColorSpace="",SRGBColorSpace="s\ +rgb",LinearSRGBColorSpace="srgb-linear",DisplayP3ColorSpace="display-p3",LinearDisplayP3ColorSpace="\ +display-p3-linear",LinearTransfer="linear",SRGBTransfer="srgb",Rec709Primaries="\ +rec709",P3Primaries="p3";var KeepStencilOp=7680;var AlwaysStencilFunc=519,NeverCompare=512,LessCompare=513,EqualCompare=514,LessEqualCompare=515, +GreaterCompare=516,NotEqualCompare=517,GreaterEqualCompare=518,AlwaysCompare=519, +StaticDrawUsage=35044,DynamicDrawUsage=35048;var GLSL3="300 es",_SRGBAFormat=1035,WebGLCoordinateSystem=2e3,WebGPUCoordinateSystem=2001;var Matrix4=class _Matrix4{static{__name(this,"Matrix4")}constructor(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){ +_Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], +n11!==void 0&&this.set(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43, +n44)}set(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){let te=this. +elements;return te[0]=n11,te[4]=n12,te[8]=n13,te[12]=n14,te[1]=n21,te[5]=n22,te[9]= +n23,te[13]=n24,te[2]=n31,te[6]=n32,te[10]=n33,te[14]=n34,te[3]=n41,te[7]=n42,te[11]= +n43,te[15]=n44,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 _Matrix4().fromArray(this.elements)}copy(m){let te=this. +elements,me=m.elements;return te[0]=me[0],te[1]=me[1],te[2]=me[2],te[3]=me[3],te[4]= +me[4],te[5]=me[5],te[6]=me[6],te[7]=me[7],te[8]=me[8],te[9]=me[9],te[10]=me[10], +te[11]=me[11],te[12]=me[12],te[13]=me[13],te[14]=me[14],te[15]=me[15],this}copyPosition(m){ +let te=this.elements,me=m.elements;return te[12]=me[12],te[13]=me[13],te[14]=me[14], +this}setFromMatrix3(m){let me=m.elements;return this.set(me[0],me[3],me[6],0,me[1], +me[4],me[7],0,me[2],me[5],me[8],0,0,0,0,1),this}extractBasis(xAxis,yAxis,zAxis){ +return xAxis.setFromMatrixColumn(this,0),yAxis.setFromMatrixColumn(this,1),zAxis. +setFromMatrixColumn(this,2),this}makeBasis(xAxis,yAxis,zAxis){return this.set(xAxis. +x,yAxis.x,zAxis.x,0,xAxis.y,yAxis.y,zAxis.y,0,xAxis.z,yAxis.z,zAxis.z,0,0,0,0,1), +this}extractRotation(m){let te=this.elements,me=m.elements,scaleX=1/_v1.setFromMatrixColumn( +m,0).length(),scaleY=1/_v1.setFromMatrixColumn(m,1).length(),scaleZ=1/_v1.setFromMatrixColumn( +m,2).length();return te[0]=me[0]*scaleX,te[1]=me[1]*scaleX,te[2]=me[2]*scaleX,te[3]= +0,te[4]=me[4]*scaleY,te[5]=me[5]*scaleY,te[6]=me[6]*scaleY,te[7]=0,te[8]=me[8]*scaleZ, +te[9]=me[9]*scaleZ,te[10]=me[10]*scaleZ,te[11]=0,te[12]=0,te[13]=0,te[14]=0,te[15]= +1,this}makeRotationFromEuler(euler){let te=this.elements,x2=euler.x,y2=euler.y,z2=euler. +z,a=Math.cos(x2),b=Math.sin(x2),c3=Math.cos(y2),d2=Math.sin(y2),e=Math.cos(z2),f=Math. +sin(z2);if(euler.order==="XYZ"){let ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c3*e,te[4]= +-c3*f,te[8]=d2,te[1]=af+be*d2,te[5]=ae-bf*d2,te[9]=-b*c3,te[2]=bf-ae*d2,te[6]=be+ +af*d2,te[10]=a*c3}else if(euler.order==="YXZ"){let ce=c3*e,cf=c3*f,de=d2*e,df=d2* +f;te[0]=ce+df*b,te[4]=de*b-cf,te[8]=a*d2,te[1]=a*f,te[5]=a*e,te[9]=-b,te[2]=cf*b- +de,te[6]=df+ce*b,te[10]=a*c3}else if(euler.order==="ZXY"){let ce=c3*e,cf=c3*f,de=d2* +e,df=d2*f;te[0]=ce-df*b,te[4]=-a*f,te[8]=de+cf*b,te[1]=cf+de*b,te[5]=a*e,te[9]=df- +ce*b,te[2]=-a*d2,te[6]=b,te[10]=a*c3}else if(euler.order==="ZYX"){let ae=a*e,af=a* +f,be=b*e,bf=b*f;te[0]=c3*e,te[4]=be*d2-af,te[8]=ae*d2+bf,te[1]=c3*f,te[5]=bf*d2+ +ae,te[9]=af*d2-be,te[2]=-d2,te[6]=b*c3,te[10]=a*c3}else if(euler.order==="YZX"){ +let ac=a*c3,ad=a*d2,bc=b*c3,bd=b*d2;te[0]=c3*e,te[4]=bd-ac*f,te[8]=bc*f+ad,te[1]= +f,te[5]=a*e,te[9]=-b*e,te[2]=-d2*e,te[6]=ad*f+bc,te[10]=ac-bd*f}else if(euler.order=== +"XZY"){let ac=a*c3,ad=a*d2,bc=b*c3,bd=b*d2;te[0]=c3*e,te[4]=-f,te[8]=d2*e,te[1]= +ac*f+bd,te[5]=a*e,te[9]=ad*f-bc,te[2]=bc*f-ad,te[6]=b*e,te[10]=bd*f+ac}return te[3]= +0,te[7]=0,te[11]=0,te[12]=0,te[13]=0,te[14]=0,te[15]=1,this}makeRotationFromQuaternion(q2){ +return this.compose(_zero,q2,_one)}lookAt(eye,target,up){let te=this.elements;return _z. +subVectors(eye,target),_z.lengthSq()===0&&(_z.z=1),_z.normalize(),_x.crossVectors( +up,_z),_x.lengthSq()===0&&(Math.abs(up.z)===1?_z.x+=1e-4:_z.z+=1e-4,_z.normalize(), +_x.crossVectors(up,_z)),_x.normalize(),_y.crossVectors(_z,_x),te[0]=_x.x,te[4]=_y. +x,te[8]=_z.x,te[1]=_x.y,te[5]=_y.y,te[9]=_z.y,te[2]=_x.z,te[6]=_y.z,te[10]=_z.z, +this}multiply(m){return this.multiplyMatrices(this,m)}premultiply(m){return this. +multiplyMatrices(m,this)}multiplyMatrices(a,b){let ae=a.elements,be=b.elements,te=this. +elements,a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12],a21=ae[1],a22=ae[5],a23=ae[9], +a24=ae[13],a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14],a41=ae[3],a42=ae[7],a43=ae[11], +a44=ae[15],b11=be[0],b12=be[4],b13=be[8],b14=be[12],b21=be[1],b22=be[5],b23=be[9], +b24=be[13],b31=be[2],b32=be[6],b33=be[10],b34=be[14],b41=be[3],b42=be[7],b43=be[11], +b44=be[15];return te[0]=a11*b11+a12*b21+a13*b31+a14*b41,te[4]=a11*b12+a12*b22+a13* +b32+a14*b42,te[8]=a11*b13+a12*b23+a13*b33+a14*b43,te[12]=a11*b14+a12*b24+a13*b34+ +a14*b44,te[1]=a21*b11+a22*b21+a23*b31+a24*b41,te[5]=a21*b12+a22*b22+a23*b32+a24* +b42,te[9]=a21*b13+a22*b23+a23*b33+a24*b43,te[13]=a21*b14+a22*b24+a23*b34+a24*b44, +te[2]=a31*b11+a32*b21+a33*b31+a34*b41,te[6]=a31*b12+a32*b22+a33*b32+a34*b42,te[10]= +a31*b13+a32*b23+a33*b33+a34*b43,te[14]=a31*b14+a32*b24+a33*b34+a34*b44,te[3]=a41* +b11+a42*b21+a43*b31+a44*b41,te[7]=a41*b12+a42*b22+a43*b32+a44*b42,te[11]=a41*b13+ +a42*b23+a43*b33+a44*b43,te[15]=a41*b14+a42*b24+a43*b34+a44*b44,this}multiplyScalar(s){ +let te=this.elements;return te[0]*=s,te[4]*=s,te[8]*=s,te[12]*=s,te[1]*=s,te[5]*= +s,te[9]*=s,te[13]*=s,te[2]*=s,te[6]*=s,te[10]*=s,te[14]*=s,te[3]*=s,te[7]*=s,te[11]*= +s,te[15]*=s,this}determinant(){let te=this.elements,n11=te[0],n12=te[4],n13=te[8], +n14=te[12],n21=te[1],n22=te[5],n23=te[9],n24=te[13],n31=te[2],n32=te[6],n33=te[10], +n34=te[14],n41=te[3],n42=te[7],n43=te[11],n44=te[15];return n41*(+n14*n23*n32-n13* +n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34)+n42*(+n11*n23*n34-n11*n24* +n33+n14*n21*n33-n13*n21*n34+n13*n24*n31-n14*n23*n31)+n43*(+n11*n24*n32-n11*n22*n34- +n14*n21*n32+n12*n21*n34+n14*n22*n31-n12*n24*n31)+n44*(-n13*n22*n31-n11*n23*n32+n11* +n22*n33+n13*n21*n32-n12*n21*n33+n12*n23*n31)}transpose(){let te=this.elements,tmp2; +return tmp2=te[1],te[1]=te[4],te[4]=tmp2,tmp2=te[2],te[2]=te[8],te[8]=tmp2,tmp2= +te[6],te[6]=te[9],te[9]=tmp2,tmp2=te[3],te[3]=te[12],te[12]=tmp2,tmp2=te[7],te[7]= +te[13],te[13]=tmp2,tmp2=te[11],te[11]=te[14],te[14]=tmp2,this}setPosition(x2,y2,z2){ +let te=this.elements;return x2.isVector3?(te[12]=x2.x,te[13]=x2.y,te[14]=x2.z):(te[12]= +x2,te[13]=y2,te[14]=z2),this}invert(){let te=this.elements,n11=te[0],n21=te[1],n31=te[2], +n41=te[3],n12=te[4],n22=te[5],n32=te[6],n42=te[7],n13=te[8],n23=te[9],n33=te[10], +n43=te[11],n14=te[12],n24=te[13],n34=te[14],n44=te[15],t11=n23*n34*n42-n24*n33*n42+ +n24*n32*n43-n22*n34*n43-n23*n32*n44+n22*n33*n44,t12=n14*n33*n42-n13*n34*n42-n14* +n32*n43+n12*n34*n43+n13*n32*n44-n12*n33*n44,t13=n13*n24*n42-n14*n23*n42+n14*n22* +n43-n12*n24*n43-n13*n22*n44+n12*n23*n44,t14=n14*n23*n32-n13*n24*n32-n14*n22*n33+ +n12*n24*n33+n13*n22*n34-n12*n23*n34,det=n11*t11+n21*t12+n31*t13+n41*t14;if(det=== +0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let detInv=1/det;return te[0]= +t11*detInv,te[1]=(n24*n33*n41-n23*n34*n41-n24*n31*n43+n21*n34*n43+n23*n31*n44-n21* +n33*n44)*detInv,te[2]=(n22*n34*n41-n24*n32*n41+n24*n31*n42-n21*n34*n42-n22*n31*n44+ +n21*n32*n44)*detInv,te[3]=(n23*n32*n41-n22*n33*n41-n23*n31*n42+n21*n33*n42+n22*n31* +n43-n21*n32*n43)*detInv,te[4]=t12*detInv,te[5]=(n13*n34*n41-n14*n33*n41+n14*n31* +n43-n11*n34*n43-n13*n31*n44+n11*n33*n44)*detInv,te[6]=(n14*n32*n41-n12*n34*n41-n14* +n31*n42+n11*n34*n42+n12*n31*n44-n11*n32*n44)*detInv,te[7]=(n12*n33*n41-n13*n32*n41+ +n13*n31*n42-n11*n33*n42-n12*n31*n43+n11*n32*n43)*detInv,te[8]=t13*detInv,te[9]=(n14* +n23*n41-n13*n24*n41-n14*n21*n43+n11*n24*n43+n13*n21*n44-n11*n23*n44)*detInv,te[10]= +(n12*n24*n41-n14*n22*n41+n14*n21*n42-n11*n24*n42-n12*n21*n44+n11*n22*n44)*detInv, +te[11]=(n13*n22*n41-n12*n23*n41-n13*n21*n42+n11*n23*n42+n12*n21*n43-n11*n22*n43)* +detInv,te[12]=t14*detInv,te[13]=(n13*n24*n31-n14*n23*n31+n14*n21*n33-n11*n24*n33- +n13*n21*n34+n11*n23*n34)*detInv,te[14]=(n14*n22*n31-n12*n24*n31-n14*n21*n32+n11* +n24*n32+n12*n21*n34-n11*n22*n34)*detInv,te[15]=(n12*n23*n31-n13*n22*n31+n13*n21* +n32-n11*n23*n32-n12*n21*n33+n11*n22*n33)*detInv,this}scale(v){let te=this.elements, +x2=v.x,y2=v.y,z2=v.z;return te[0]*=x2,te[4]*=y2,te[8]*=z2,te[1]*=x2,te[5]*=y2,te[9]*= +z2,te[2]*=x2,te[6]*=y2,te[10]*=z2,te[3]*=x2,te[7]*=y2,te[11]*=z2,this}getMaxScaleOnAxis(){ +let te=this.elements,scaleXSq=te[0]*te[0]+te[1]*te[1]+te[2]*te[2],scaleYSq=te[4]* +te[4]+te[5]*te[5]+te[6]*te[6],scaleZSq=te[8]*te[8]+te[9]*te[9]+te[10]*te[10];return Math. +sqrt(Math.max(scaleXSq,scaleYSq,scaleZSq))}makeTranslation(x2,y2,z2){return x2.isVector3? +this.set(1,0,0,x2.x,0,1,0,x2.y,0,0,1,x2.z,0,0,0,1):this.set(1,0,0,x2,0,1,0,y2,0, +0,1,z2,0,0,0,1),this}makeRotationX(theta){let c3=Math.cos(theta),s=Math.sin(theta); +return this.set(1,0,0,0,0,c3,-s,0,0,s,c3,0,0,0,0,1),this}makeRotationY(theta){let c3=Math. +cos(theta),s=Math.sin(theta);return this.set(c3,0,s,0,0,1,0,0,-s,0,c3,0,0,0,0,1), +this}makeRotationZ(theta){let c3=Math.cos(theta),s=Math.sin(theta);return this.set( +c3,-s,0,0,s,c3,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(axis,angle){let c3=Math. +cos(angle),s=Math.sin(angle),t=1-c3,x2=axis.x,y2=axis.y,z2=axis.z,tx=t*x2,ty=t*y2; +return this.set(tx*x2+c3,tx*y2-s*z2,tx*z2+s*y2,0,tx*y2+s*z2,ty*y2+c3,ty*z2-s*x2, +0,tx*z2-s*y2,ty*z2+s*x2,t*z2*z2+c3,0,0,0,0,1),this}makeScale(x2,y2,z2){return this. +set(x2,0,0,0,0,y2,0,0,0,0,z2,0,0,0,0,1),this}makeShear(xy,xz,yx,yz,zx,zy){return this. +set(1,yx,zx,0,xy,1,zy,0,xz,yz,1,0,0,0,0,1),this}compose(position2,quaternion,scale2){ +let te=this.elements,x2=quaternion._x,y2=quaternion._y,z2=quaternion._z,w2=quaternion. +_w,x22=x2+x2,y22=y2+y2,z22=z2+z2,xx=x2*x22,xy=x2*y22,xz=x2*z22,yy=y2*y22,yz=y2*z22, +zz=z2*z22,wx=w2*x22,wy=w2*y22,wz=w2*z22,sx=scale2.x,sy=scale2.y,sz=scale2.z;return te[0]= +(1-(yy+zz))*sx,te[1]=(xy+wz)*sx,te[2]=(xz-wy)*sx,te[3]=0,te[4]=(xy-wz)*sy,te[5]= +(1-(xx+zz))*sy,te[6]=(yz+wx)*sy,te[7]=0,te[8]=(xz+wy)*sz,te[9]=(yz-wx)*sz,te[10]= +(1-(xx+yy))*sz,te[11]=0,te[12]=position2.x,te[13]=position2.y,te[14]=position2.z, +te[15]=1,this}decompose(position2,quaternion,scale2){let te=this.elements,sx=_v1. +set(te[0],te[1],te[2]).length(),sy=_v1.set(te[4],te[5],te[6]).length(),sz=_v1.set( +te[8],te[9],te[10]).length();this.determinant()<0&&(sx=-sx),position2.x=te[12],position2. +y=te[13],position2.z=te[14],_m1.copy(this);let invSX=1/sx,invSY=1/sy,invSZ=1/sz; +return _m1.elements[0]*=invSX,_m1.elements[1]*=invSX,_m1.elements[2]*=invSX,_m1. +elements[4]*=invSY,_m1.elements[5]*=invSY,_m1.elements[6]*=invSY,_m1.elements[8]*= +invSZ,_m1.elements[9]*=invSZ,_m1.elements[10]*=invSZ,quaternion.setFromRotationMatrix( +_m1),scale2.x=sx,scale2.y=sy,scale2.z=sz,this}makePerspective(left,right,top,bottom,near,far,coordinateSystem=WebGLCoordinateSystem){ +let te=this.elements,x2=2*near/(right-left),y2=2*near/(top-bottom),a=(right+left)/ +(right-left),b=(top+bottom)/(top-bottom),c3,d2;if(coordinateSystem===WebGLCoordinateSystem) +c3=-(far+near)/(far-near),d2=-2*far*near/(far-near);else if(coordinateSystem===WebGPUCoordinateSystem) +c3=-far/(far-near),d2=-far*near/(far-near);else throw new Error("THREE.Matrix4.m\ +akePerspective(): Invalid coordinate system: "+coordinateSystem);return te[0]=x2, +te[4]=0,te[8]=a,te[12]=0,te[1]=0,te[5]=y2,te[9]=b,te[13]=0,te[2]=0,te[6]=0,te[10]= +c3,te[14]=d2,te[3]=0,te[7]=0,te[11]=-1,te[15]=0,this}makeOrthographic(left,right,top,bottom,near,far,coordinateSystem=WebGLCoordinateSystem){ +let te=this.elements,w2=1/(right-left),h=1/(top-bottom),p2=1/(far-near),x2=(right+ +left)*w2,y2=(top+bottom)*h,z2,zInv;if(coordinateSystem===WebGLCoordinateSystem)z2= +(far+near)*p2,zInv=-2*p2;else if(coordinateSystem===WebGPUCoordinateSystem)z2=near* +p2,zInv=-1*p2;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid co\ +ordinate system: "+coordinateSystem);return te[0]=2*w2,te[4]=0,te[8]=0,te[12]=-x2, +te[1]=0,te[5]=2*h,te[9]=0,te[13]=-y2,te[2]=0,te[6]=0,te[10]=zInv,te[14]=-z2,te[3]= +0,te[7]=0,te[11]=0,te[15]=1,this}equals(matrix){let te=this.elements,me=matrix.elements; +for(let i2=0;i2<16;i2++)if(te[i2]!==me[i2])return!1;return!0}fromArray(array,offset=0){ +for(let i2=0;i2<16;i2++)this.elements[i2]=array[i2+offset];return this}toArray(array=[],offset=0){ +let te=this.elements;return array[offset]=te[0],array[offset+1]=te[1],array[offset+ +2]=te[2],array[offset+3]=te[3],array[offset+4]=te[4],array[offset+5]=te[5],array[offset+ +6]=te[6],array[offset+7]=te[7],array[offset+8]=te[8],array[offset+9]=te[9],array[offset+ +10]=te[10],array[offset+11]=te[11],array[offset+12]=te[12],array[offset+13]=te[13], +array[offset+14]=te[14],array[offset+15]=te[15],array}},_v1=new Vector3,_m1=new Matrix4, +_zero=new Vector3(0,0,0),_one=new Vector3(1,1,1),_x=new Vector3,_y=new Vector3,_z=new Vector3;var EventDispatcher=class{static{__name(this,"EventDispatcher")}addEventListener(type,listener){ +this._listeners===void 0&&(this._listeners={});let listeners=this._listeners;listeners[type]=== +void 0&&(listeners[type]=[]),listeners[type].indexOf(listener)===-1&&listeners[type]. +push(listener)}hasEventListener(type,listener){if(this._listeners===void 0)return!1; +let listeners=this._listeners;return listeners[type]!==void 0&&listeners[type].indexOf( +listener)!==-1}removeEventListener(type,listener){if(this._listeners===void 0)return; +let listenerArray=this._listeners[type];if(listenerArray!==void 0){let index=listenerArray. +indexOf(listener);index!==-1&&listenerArray.splice(index,1)}}dispatchEvent(event){ +if(this._listeners===void 0)return;let listenerArray=this._listeners[event.type]; +if(listenerArray!==void 0){event.target=this;let array=listenerArray.slice(0);for(let i2=0, +l=array.length;i2>>0}enable(channel){this.mask|=1<1){for(let i2=0;i21){for(let i2=0;i20&&(object.userData=this.userData),object.layers=this.layers.mask,object. +matrix=this.matrix.toArray(),object.up=this.up.toArray(),this.matrixAutoUpdate=== +!1&&(object.matrixAutoUpdate=!1),this.isInstancedMesh&&(object.type="InstancedMe\ +sh",object.count=this.count,object.instanceMatrix=this.instanceMatrix.toJSON(),this. +instanceColor!==null&&(object.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&& +(object.type="BatchedMesh",object.perObjectFrustumCulled=this.perObjectFrustumCulled, +object.sortObjects=this.sortObjects,object.drawRanges=this._drawRanges,object.reservedRanges= +this._reservedRanges,object.visibility=this._visibility,object.active=this._active, +object.bounds=this._bounds.map(bound=>({boxInitialized:bound.boxInitialized,boxMin:bound. +box.min.toArray(),boxMax:bound.box.max.toArray(),sphereInitialized:bound.sphereInitialized, +sphereRadius:bound.sphere.radius,sphereCenter:bound.sphere.center.toArray()})),object. +maxGeometryCount=this._maxGeometryCount,object.maxVertexCount=this._maxVertexCount, +object.maxIndexCount=this._maxIndexCount,object.geometryInitialized=this._geometryInitialized, +object.geometryCount=this._geometryCount,object.matricesTexture=this._matricesTexture. +toJSON(meta),this.boundingSphere!==null&&(object.boundingSphere={center:object.boundingSphere. +center.toArray(),radius:object.boundingSphere.radius}),this.boundingBox!==null&& +(object.boundingBox={min:object.boundingBox.min.toArray(),max:object.boundingBox. +max.toArray()}));function serialize(library,element2){return library[element2.uuid]=== +void 0&&(library[element2.uuid]=element2.toJSON(meta)),element2.uuid}if(__name(serialize, +"serialize"),this.isScene)this.background&&(this.background.isColor?object.background= +this.background.toJSON():this.background.isTexture&&(object.background=this.background. +toJSON(meta).uuid)),this.environment&&this.environment.isTexture&&this.environment. +isRenderTargetTexture!==!0&&(object.environment=this.environment.toJSON(meta).uuid);else if(this. +isMesh||this.isLine||this.isPoints){object.geometry=serialize(meta.geometries,this. +geometry);let parameters=this.geometry.parameters;if(parameters!==void 0&¶meters. +shapes!==void 0){let shapes=parameters.shapes;if(Array.isArray(shapes))for(let i2=0, +l=shapes.length;i2 +0){object.children=[];for(let i2=0;i20){object. +animations=[];for(let i2=0;i20&&(output.geometries= +geometries),materials.length>0&&(output.materials=materials),textures.length>0&& +(output.textures=textures),images.length>0&&(output.images=images),shapes.length> +0&&(output.shapes=shapes),skeletons.length>0&&(output.skeletons=skeletons),animations. +length>0&&(output.animations=animations),nodes.length>0&&(output.nodes=nodes)}return output. +object=object,output;function extractFromCache(cache2){let values=[];for(let key2 in cache2){ +let data=cache2[key2];delete data.metadata,values.push(data)}return values}__name( +extractFromCache,"extractFromCache")}clone(recursive){return new this.constructor(). +copy(this,recursive)}copy(source,recursive=!0){if(this.name=source.name,this.up. +copy(source.up),this.position.copy(source.position),this.rotation.order=source.rotation. +order,this.quaternion.copy(source.quaternion),this.scale.copy(source.scale),this. +matrix.copy(source.matrix),this.matrixWorld.copy(source.matrixWorld),this.matrixAutoUpdate= +source.matrixAutoUpdate,this.matrixWorldAutoUpdate=source.matrixWorldAutoUpdate, +this.matrixWorldNeedsUpdate=source.matrixWorldNeedsUpdate,this.layers.mask=source. +layers.mask,this.visible=source.visible,this.castShadow=source.castShadow,this.receiveShadow= +source.receiveShadow,this.frustumCulled=source.frustumCulled,this.renderOrder=source. +renderOrder,this.animations=source.animations.slice(),this.userData=JSON.parse(JSON. +stringify(source.userData)),recursive===!0)for(let i2=0;i2string.replace( +/[.*+?^${}()|[\]\\]/g,"\\$&"),"escape");var stringArrayRegexCache={};function stringToArray(string,separator=","){separator= +separator||",";let re=stringArrayRegexCache[separator];return re||(re=r`/(?:\s*${escape2( +separator)}\s*)|(?:\s+)/g`,stringArrayRegexCache[separator]=re),string.trim().split( +re)}__name(stringToArray,"stringToArray");var __runInitializers=function(thisArg,initializers,value){for(var useValue=arguments. +length>2,i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},defaultValues={ +x:void 0,y:void 0,z:void 0},XYZValues=(()=>{let _classDecorators=[reactive],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=Object,_instanceExtraInitializers=[], +_set_x_decorators,_set_y_decorators,_set_z_decorators;var XYZValues2=class extends _classSuper{static{ +__name(this,"XYZValues")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_set_x_decorators=[signal],_set_y_decorators=[signal],_set_z_decorators=[signal], +__esDecorate(this,null,_set_x_decorators,{kind:"setter",name:"x",static:!1,private:!1, +access:{has:obj=>"x"in obj,set:(obj,value)=>{obj.x=value}},metadata:_metadata},null, +_instanceExtraInitializers),__esDecorate(this,null,_set_y_decorators,{kind:"sett\ +er",name:"y",static:!1,private:!1,access:{has:obj=>"y"in obj,set:(obj,value)=>{obj. +y=value}},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this, +null,_set_z_decorators,{kind:"setter",name:"z",static:!1,private:!1,access:{has:obj=>"\ +z"in obj,set:(obj,value)=>{obj.z=value}},metadata:_metadata},null,_instanceExtraInitializers), +__esDecorate(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"cl\ +ass",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),XYZValues2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers( +_classThis,_classExtraInitializers)}#x=(__runInitializers(this,_instanceExtraInitializers), +void 0);#y=void 0;#z=void 0;set x(value){typeof value=="string"&&(value=this.deserializeValue( +"x",value)),this.checkValue("x",value)&&(this.#x=value)}get x(){return this.#x}set y(value){ +typeof value=="string"&&(value=this.deserializeValue("y",value)),this.checkValue( +"y",value)&&(this.#y=value)}get y(){return this.#y}set z(value){typeof value=="s\ +tring"&&(value=this.deserializeValue("z",value)),this.checkValue("z",value)&&(this.#z= +value)}get z(){return this.#z}constructor(x2,y2,z2){super(),this.#from(x2,y2,z2)}get#default(){ +return this.default||defaultValues}fromDefault(){return this.from(this.#default), +this}#from(x2,y2,z2){if(x2==null&&y2===void 0&&z2===void 0)this.fromDefault();else if(Array. +isArray(x2))this.fromArray(x2);else if(typeof x2=="object"&&x2!==null){if(x2===this) +return this;this.fromObject(x2)}else typeof x2=="string"&&y2===void 0&&z2===void 0? +this.fromString(x2):this.set(x2,y2,z2);return this}from(x2,y2,z2){return this.#from( +x2,y2,z2)}set(x2,y2,z2){return batch(()=>{this.x=x2,this.y=y2,this.z=z2}),this}fromArray(array){ +return this.set(array[0],array[1],array[2]),this}toArray(){return[this.x,this.y, +this.z]}fromObject(object){return this.set(object.x,object.y,object.z),this}toObject(){ +return{x:this.x,y:this.y,z:this.z}}fromString(string,separator=","){return this. +fromArray(this.#stringToArray(string,separator)),this}toString(separator=""){return separator? +`${this.x}${separator} ${this.y}${separator} ${this.z}`:`${this.x} ${this.y} ${this. +z}`}deserializeValue(_prop,value){return value}#stringToArray(string,separator="\ +,"){let values=stringToArray(string,separator),result=[],length=values.length;return length> +0&&(result[0]=this.deserializeValue("x",values[0])),length>1&&(result[1]=this.deserializeValue( +"y",values[1])),length>2&&(result[2]=this.deserializeValue("z",values[2])),result}checkValue(_prop,_value){ +return!0}asDependency=()=>(this.x,this.y,this.z,this)};return XYZValues2=_classThis})();function enumerable(obj,prop){Object.defineProperty(obj,prop,{...getInheritedDescriptor( +obj,prop),enumerable:!0})}__name(enumerable,"enumerable");enumerable(XYZValues.prototype, +"x");enumerable(XYZValues.prototype,"y");enumerable(XYZValues.prototype,"z");var XYZNumberValues=class extends XYZValues{static{__name(this,"XYZNumberValues")}get default(){ +return{x:0,y:0,z:0}}deserializeValue(_prop,value){return Number(value)}checkValue(prop,value){ +if(!super.checkValue(prop,value)||value===void 0)return!1;if(typeof value!="numb\ +er"||isNaN(value)||!isFinite(value))throw new TypeError(`Expected ${prop} to be \ +a finite number. Received: ${value}`);return!0}};function Eventful(Base=Object){class Eventful2 extends Base{static{__name(this,"\ +Eventful")}[isEventful]=isEventful;on(eventName,callback,context){let eventMap=this.#eventMap; +if(typeof callback!="function")throw new Error("Expected a function in callback \ +argument of Eventful#on.");eventMap||(eventMap=this.#eventMap=new Map);let callbacks=eventMap. +get(eventName);callbacks||eventMap.set(eventName,callbacks=[]),callbacks.push([callback, +context])}off(eventName,callback,context){let eventMap=this.#eventMap;if(!eventMap) +return;let callbacks=eventMap.get(eventName);if(!callbacks)return;let index=callbacks. +findIndex(tuple=>tuple[0]===callback&&tuple[1]===context);index!==-1&&(callbacks. +splice(index,1),callbacks.length===0&&eventMap.delete(eventName),eventMap.size=== +0&&(this.#eventMap=null))}emit(eventName,data){let eventMap=this.#eventMap;if(!eventMap) +return;let callbacks=eventMap.get(eventName);if(!callbacks)return;let tuple,callback, +context;for(let i2=0,len=callbacks.length;i2c3 instanceof _TreeNode)}get lumeChildCount(){return this.lumeChildren. +length}disconnectedCallback(){super.disconnectedCallback(),this.stopEffects()}};var XYZStringValues=class extends XYZValues{static{__name(this,"XYZStringValues")}get default(){ +return{x:"",y:"",z:""}}checkValue(prop,value){if(!super.checkValue(prop,value)|| +value===void 0)return!1;if(typeof value!="string")throw new TypeError(`Expected ${prop}\ + to be a string. Received: ${value}`);return!0}};var XYZSizeModeValues=class extends XYZStringValues{static{__name(this,"XYZSizeM\ +odeValues")}get default(){return{x:"literal",y:"literal",z:"literal"}}get allowedValues(){ +return["literal","l","proportional","p"]}checkValue(prop,value){if(!super.checkValue( +prop,value))return!1;if(!this.allowedValues.includes(value))throw new TypeError( +`Expected ${prop} to be one of 'literal' ('l' for short) or 'proportional' ('p' \ +for short). Received: '${value}'`);return!0}};var XYZNonNegativeValues=class extends XYZNumberValues{static{__name(this,"XYZNo\ +nNegativeValues")}checkValue(prop,value){if(!super.checkValue(prop,value))return!1; +if(value<0)throw new TypeError(`Expected ${prop} not to be negative. Received: ${value}`); +return!0}};var _Motor=class{static{__name(this,"_Motor")}addRenderTask(fn){if(typeof fn!="f\ +unction")throw new Error("Render task must be a function.");return this.#allRenderTasks. +includes(fn)||(this.#allRenderTasks.push(fn),this.#numberOfTasks+=1,this.#loopStarted|| +this.#startAnimationLoop()),fn}removeRenderTask(fn){let taskIndex=this.#allRenderTasks. +indexOf(fn);taskIndex!=-1&&(this.#allRenderTasks.splice(taskIndex,1),this.#numberOfTasks-= +1,taskIndex<=this.#taskIterationIndex&&(this.#taskIterationIndex-=1))}#onces=new Set;once(fn,allowDuplicates=!0){ +if(!(!allowDuplicates&&this.#onces.has(fn)))return this.#onces.add(fn),this.addRenderTask( +(time,dt)=>(fn(time,dt),!1))}needsUpdate(element2){this.#elementsToUpdate.has(element2)&& +this.#elementsToUpdate.delete(element2),this.#elementsToUpdate.add(element2),this.#startAnimationLoop()}willUpdate(element2){ +return this.#elementsToUpdate.has(element2)}setFrameRequester(requester){this.#requestFrame= +requester}#loopStarted=!1;#taskIterationIndex=0;#numberOfTasks=0;#allRenderTasks=[];#elementsToUpdate=new Set;#modifiedScenes=new Set;#treesToUpdate=new Set;#requestFrame=globalThis. +requestAnimationFrame?.bind(globalThis);async#startAnimationLoop(){if(document.readyState=== +"loading"&&await new Promise(resolve=>setTimeout(resolve)),this.#loopStarted)return; +this.#loopStarted=!0;let lastTime=performance.now();for(;this.#loopStarted;){let timestamp=await this.#animationFrame(), +deltaTime=timestamp-lastTime;this.#runRenderTasks(timestamp,deltaTime),this.#onces. +clear(),await null,this.#updateElements(timestamp,deltaTime),this.#allRenderTasks. +length||(this.#loopStarted=!1),lastTime=timestamp}}#animationFrame(){return new Promise( +r3=>this.#requestFrame(r3))}#runRenderTasks(timestamp,deltaTime){for(this.#taskIterationIndex= +0;this.#taskIterationIndexchildObserver.disconnect()} +__name(observeChildren,"observeChildren");function createChildObserver(onConnect,onDisconnect,includeTextNodes=!1,weighted=!1){ +return new MutationObserver(changes=>{if(!weighted){for(let change of changes){let{ +target,removedNodes,addedNodes}=change;for(let i2=0,l=removedNodes.length;i2 +0&&typeof onConnect=="function"?onConnect.call(target,child):weight<0&&typeof onDisconnect== +"function"&&onDisconnect.call(target,child))})}__name(createChildObserver,"creat\ +eChildObserver");var isScene=__name(el2=>!!el2.isScene,"isScene"),isElement3D=__name(el2=>!!el2.isElement3D, +"isElement3D"),isDomEnvironment=__name(()=>!!globalThis.window?.document,"isDomE\ +nvironment");function CompositionTracker(Base){return class CompositionTracker2 extends Base{static{ +__name(this,"CompositionTracker")}isScene=!1;isElement3D=!1;skipShadowObservation=!1;attachShadow(options){ +let root=super.attachShadow(options);if(this.skipShadowObservation)return root;this. +__shadowRoot=root,observeChildren({target:root,onConnect:this.__shadowRootChildAdded. +bind(this),onDisconnect:this.__shadowRootChildRemoved.bind(this)});let children2=Array. +from(this.children);for(let child of children2)child instanceof CompositionTracker2&& +(child.__isPossiblyDistributedToShadowRoot=!0,this.__triggerChildUncomposedCallback( +child,"actual"));return root}get _hasShadowRoot(){return!!this.__shadowRoot}get _isPossiblyDistributedToShadowRoot(){ +return this.__isPossiblyDistributedToShadowRoot}get _shadowRootParent(){return this. +__shadowRootParent}get _shadowRootChildren(){return this.__shadowRoot?Array.from( +this.__shadowRoot.children).filter(n=>n instanceof CompositionTracker2):[]}get _distributedShadowRootChildren(){ +let result=[];for(let child of Array.from(this.__shadowRoot?.children||[]))if(child instanceof +HTMLSlotElement&&!child.assignedSlot)for(let distributed of child.assignedElements( +{flatten:!0}))distributed instanceof CompositionTracker2&&result.push(distributed); +return result}get _distributedParent(){return this.__distributedParent}get _distributedChildren(){ +return this.__distributedChildren?[...this.__distributedChildren]:null}__composedParent=null;get composedParent(){ +let result=this.__composedParent;return result||(result=this.__getComposedParent()), +result}get __isComposed(){return this.__composedParent}get isComposed(){return this. +composedParent}__getComposedParent(){let parent=this.parentElement;return parent&& +isScene(parent)||(parent=this.__distributedParent||this.__shadowRootParent,parent)? +parent:getComposedParent(this)}get _composedChildren(){return this.__shadowRoot? +[...this._distributedShadowRootChildren,...this._shadowRootChildren]:[...this.__distributedChildren|| +[],...Array.from(this.children).filter(n=>n instanceof CompositionTracker2)]}__shadowRoot;__isPossiblyDistributedToShadowRoot=!1;__prevAssignedNodes;get __previousSlotAssignedNodes(){ +return this.__prevAssignedNodes||(this.__prevAssignedNodes=new WeakMap),this.__prevAssignedNodes}__distributedParent=null;__shadowRootParent=null;__distributedChildren;__shadowRootChildAdded(child){ +child instanceof CompositionTracker2?(child.__shadowRootParent=this,this.__triggerChildComposedCallback( +child,"root")):child instanceof HTMLSlotElement&&(child.addEventListener("slotch\ +ange",this.__onChildSlotChange),this.__handleSlottedChildren(child))}__shadowRootChildRemoved(child){ +child instanceof CompositionTracker2?(child.__shadowRootParent=null,this.__triggerChildUncomposedCallback( +child,"root")):child instanceof HTMLSlotElement&&(child.removeEventListener("slo\ +tchange",this.__onChildSlotChange,{capture:!0}),this.__handleSlottedChildren(child), +this.__previousSlotAssignedNodes.delete(child))}get __onChildSlotChange(){return this. +__onChildSlotChange__?this.__onChildSlotChange__:(this.__onChildSlotChange__=event=>{ +let slot=event.currentTarget;this.__handleSlottedChildren(slot)},this.__onChildSlotChange__)}__onChildSlotChange__;#discrepancy=!1;__triggerChildComposedCallback(child,compositionType){ +if(child.#discrepancy)return;child.__composedParent=this;let trigger=__name(()=>{ +this.childComposedCallback?.(child,compositionType),child.composedCallback?.(this, +compositionType)},"trigger");child.matches(":defined")?trigger():customElements. +whenDefined(child.tagName.toLowerCase()).then(trigger)}__triggerChildUncomposedCallback(child,compositionType){ +child.#discrepancy||(child.__composedParent=null,this.childUncomposedCallback?.( +child,compositionType),child.uncomposedCallback?.(this,compositionType))}__handleSlottedChildren(slot){ +let diff=this.__getSlottedChildDifference(slot),{removed}=diff;for(let l=removed. +length,i2=0;i2{for(let l=added.length,i2=0;i2child.traverseComposed( +visitor,waitForUpgrade)):promise=promise.then(()=>customElements.whenDefined(child. +tagName.toLowerCase())).then(()=>child.traverseComposed(visitor,waitForUpgrade)); +return promise}}}__name(CompositionTracker,"CompositionTracker");var shadowHosts=new WeakSet; +if(isDomEnvironment()){let original=Element.prototype.attachShadow;Element.prototype. +attachShadow=__name(function(...args){let result=original.apply(this,args);return shadowHosts. +add(this),result},"attachShadow")}function hasShadow(el2){return shadowHosts.has( +el2)}__name(hasShadow,"hasShadow");function getComposedParent(el2){let parent=el2. +parentNode;if(parent instanceof HTMLSlotElement){let slot=parent;return slot.assignedElements( +{flatten:!0}).length?null:getComposedParent(slot)}else{let parent2=el2.parentNode; +if(!parent2)return null;if(parent2 instanceof ShadowRoot)return parent2.host;if(hasShadow( +parent2)){if(!el2.assignedSlot)return null;for(;el2.assignedSlot;)el2=el2.assignedSlot; +return getComposedParent(el2)}return parent2}}__name(getComposedParent,"getCompo\ +sedParent");var __esDecorate2=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers2=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{ +let _classDecorators=[element],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=CompositionTracker(TreeNode),_instanceExtraInitializers=[],___calculatedSize_decorators, +___calculatedSize_initializers=[],_set_sizeMode_decorators,_set_size_decorators; +var Sizeable2=class extends _classSuper{static{__name(this,"Sizeable")}static{_classThis= +this}static{let _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create( +_classSuper[Symbol.metadata]??null):void 0;___calculatedSize_decorators=[signal], +_set_sizeMode_decorators=[attribute,noSignal],_set_size_decorators=[attribute,noSignal], +__esDecorate2(this,null,_set_sizeMode_decorators,{kind:"setter",name:"sizeMode", +static:!1,private:!1,access:{has:obj=>"sizeMode"in obj,set:(obj,value)=>{obj.sizeMode= +value}},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate2(this, +null,_set_size_decorators,{kind:"setter",name:"size",static:!1,private:!1,access:{ +has:obj=>"size"in obj,set:(obj,value)=>{obj.size=value}},metadata:_metadata},null, +_instanceExtraInitializers),__esDecorate2(null,null,___calculatedSize_decorators, +{kind:"field",name:"__calculatedSize",static:!1,private:!1,access:{has:obj=>"__c\ +alculatedSize"in obj,get:obj=>obj.__calculatedSize,set:(obj,value)=>{obj.__calculatedSize= +value}},metadata:_metadata},___calculatedSize_initializers,_instanceExtraInitializers), +__esDecorate2(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"c\ +lass",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Sizeable2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers2( +_classThis,_classExtraInitializers)}__calculatedSize=(__runInitializers2(this,_instanceExtraInitializers), +__runInitializers2(this,___calculatedSize_initializers,{x:0,y:0,z:0}));set sizeMode(newValue){ +if(typeof newValue=="function")throw new TypeError("property functions are not a\ +llowed for sizeMode");sizeMode.has(this)||sizeMode.set(this,new XYZSizeModeValues( +"literal","literal","literal")),this._setPropertyXYZ("sizeMode",sizeMode.get(this), +newValue)}get sizeMode(){return sizeMode.has(this)||sizeMode.set(this,new XYZSizeModeValues( +"literal","literal","literal")),sizeMode.get(this)}set size(newValue){size.has(this)|| +size.set(this,new XYZNonNegativeValues(0,0,0)),this._setPropertyXYZ("size",size. +get(this),newValue)}get size(){return size.has(this)||size.set(this,new XYZNonNegativeValues( +0,0,0)),size.get(this)}get calculatedSize(){return{...this.__calculatedSize??{x:0, +y:0,z:0}}}get composedLumeParent(){let result=this.composedParent;return result instanceof +Sizeable2?result:null}get composedLumeChildren(){return super._composedChildren}get parentSize(){ +return this.composedLumeParent?.calculatedSize??{x:0,y:0,z:0}}_calcSize(){let calculatedSize=this. +__calculatedSize??{x:0,y:0,z:0};Object.assign(previousSize,calculatedSize);let size3=this. +size,sizeMode2=this.sizeMode,{x:modeX,y:modeY,z:modeZ}=sizeMode2,parentSize=this. +parentSize;modeX==="literal"||modeX==="l"?calculatedSize.x=size3.x:(modeX==="pro\ +portional"||modeX==="p")&&(calculatedSize.x=parentSize.x*size3.x),modeY==="liter\ +al"||modeY==="l"?calculatedSize.y=size3.y:(modeY==="proportional"||modeY==="p")&& +(calculatedSize.y=parentSize.y*size3.y),modeZ==="literal"||modeZ==="l"?calculatedSize. +z=size3.z:(modeZ==="proportional"||modeZ==="p")&&(calculatedSize.z=parentSize.z* +size3.z),this.__calculatedSize=calculatedSize,(previousSize.x!==calculatedSize.x|| +previousSize.y!==calculatedSize.y||previousSize.z!==calculatedSize.z)&&this.emit( +"sizechange",{...calculatedSize})}#isSettingProperty=!1;get _isSettingProperty(){ +return this.#isSettingProperty}_setPropertyXYZ(name2,xyz,newValue){newValue!==xyz&& +(this.#isSettingProperty=!0,isXYZPropertyFunction(newValue)?this.#handleXYZPropertyFunction( +newValue,name2,xyz):(this.#settingValueFromPropFunction?this.#settingValueFromPropFunction= +!1:this.#removePropertyFunction(name2),xyz.from(newValue)),this.#isSettingProperty= +!1)}_setPropertySingle(name2,setter,newValue){this.#isSettingProperty=!0,isSinglePropertyFunction( +newValue)?this.#handleSinglePropertyFunction(newValue,name2):(this.#settingValueFromPropFunction? +this.#settingValueFromPropFunction=!1:this.#removePropertyFunction(name2),setter( +newValue)),this.#isSettingProperty=!1}#propertyFunctions=null;#settingValueFromPropFunction=!1;#handleXYZPropertyFunction(fn,name2,xyz){ +this.#propertyFunctions||(this.#propertyFunctions=new Map);let propFunction=this.#propertyFunctions. +get(name2);propFunction&&Motor.removeRenderTask(propFunction),this.#propertyFunctions. +set(name2,Motor.addRenderTask((time,deltaTime)=>{let result=fn(xyz.x,xyz.y,xyz.z, +time,deltaTime);if(result===!1)return this.#propertyFunctions.delete(name2),!1;this.#settingValueFromPropFunction= +!0,xyz.from(result)}))}#handleSinglePropertyFunction(fn,name2){this.#propertyFunctions|| +(this.#propertyFunctions=new Map);let propFunction=this.#propertyFunctions.get(name2); +propFunction&&Motor.removeRenderTask(propFunction),this.#propertyFunctions.set(name2, +Motor.addRenderTask(time=>{let result=fn(this[name2],time);if(result===!1)return this.#propertyFunctions. +delete(name2),!1;this.#settingValueFromPropFunction=!0,this[name2]=result}))}#removePropertyFunction(name2){ +if(!this.#propertyFunctions)return;let propFunction=this.#propertyFunctions.get( +name2);propFunction&&(Motor.removeRenderTask(propFunction),this.#propertyFunctions. +delete(name2),this.#propertyFunctions.size||(this.#propertyFunctions=null))}};return Sizeable2= +_classThis})();function isXYZPropertyFunction(f){return typeof f=="function"}__name(isXYZPropertyFunction, +"isXYZPropertyFunction");function isSinglePropertyFunction(f){return typeof f=="\ +function"}__name(isSinglePropertyFunction,"isSinglePropertyFunction");var __esDecorate3=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers3=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[ +element],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Sizeable, +_instanceExtraInitializers=[],_set_position_decorators,_set_rotation_decorators, +_set_scale_decorators,_set_origin_decorators,_set_alignPoint_decorators,_set_mountPoint_decorators; +var Transformable2=class extends _classSuper{static{__name(this,"Transformable")}static{ +_classThis=this}static{let _metadata=typeof Symbol=="function"&&Symbol.metadata? +Object.create(_classSuper[Symbol.metadata]??null):void 0;_set_position_decorators= +[attribute,noSignal],_set_rotation_decorators=[attribute,noSignal],_set_scale_decorators= +[attribute,noSignal],_set_origin_decorators=[attribute,noSignal],_set_alignPoint_decorators= +[attribute,noSignal],_set_mountPoint_decorators=[attribute,noSignal],__esDecorate3( +this,null,_set_position_decorators,{kind:"setter",name:"position",static:!1,private:!1, +access:{has:obj=>"position"in obj,set:(obj,value)=>{obj.position=value}},metadata:_metadata}, +null,_instanceExtraInitializers),__esDecorate3(this,null,_set_rotation_decorators, +{kind:"setter",name:"rotation",static:!1,private:!1,access:{has:obj=>"rotation"in +obj,set:(obj,value)=>{obj.rotation=value}},metadata:_metadata},null,_instanceExtraInitializers), +__esDecorate3(this,null,_set_scale_decorators,{kind:"setter",name:"scale",static:!1, +private:!1,access:{has:obj=>"scale"in obj,set:(obj,value)=>{obj.scale=value}},metadata:_metadata}, +null,_instanceExtraInitializers),__esDecorate3(this,null,_set_origin_decorators, +{kind:"setter",name:"origin",static:!1,private:!1,access:{has:obj=>"origin"in obj, +set:(obj,value)=>{obj.origin=value}},metadata:_metadata},null,_instanceExtraInitializers), +__esDecorate3(this,null,_set_alignPoint_decorators,{kind:"setter",name:"alignPoi\ +nt",static:!1,private:!1,access:{has:obj=>"alignPoint"in obj,set:(obj,value)=>{obj. +alignPoint=value}},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate3( +this,null,_set_mountPoint_decorators,{kind:"setter",name:"mountPoint",static:!1, +private:!1,access:{has:obj=>"mountPoint"in obj,set:(obj,value)=>{obj.mountPoint= +value}},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate3(null, +_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis. +name,metadata:_metadata},null,_classExtraInitializers),Transformable2=_classThis= +_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata, +{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers3( +_classThis,_classExtraInitializers)}set position(newValue){position.has(this)||position. +set(this,new XYZNumberValues(0,0,0)),this._setPropertyXYZ("position",position.get( +this),newValue)}get position(){return position.has(this)||position.set(this,new XYZNumberValues( +0,0,0)),position.get(this)}set rotation(newValue){rotation.has(this)||rotation.set( +this,new XYZNumberValues(0,0,0)),this._setPropertyXYZ("rotation",rotation.get(this), +newValue)}get rotation(){return rotation.has(this)||rotation.set(this,new XYZNumberValues( +0,0,0)),rotation.get(this)}set scale(newValue){scale.has(this)||scale.set(this,new XYZNumberValues( +1,1,1)),this._setPropertyXYZ("scale",scale.get(this),newValue)}get scale(){return scale. +has(this)||scale.set(this,new XYZNumberValues(1,1,1)),scale.get(this)}set origin(newValue){ +origin.has(this)||origin.set(this,new XYZNumberValues(.5,.5,.5)),this._setPropertyXYZ( +"origin",origin.get(this),newValue)}get origin(){return origin.has(this)||origin. +set(this,new XYZNumberValues(.5,.5,.5)),origin.get(this)}set alignPoint(newValue){ +alignPoint.has(this)||alignPoint.set(this,new XYZNumberValues(0,0,0)),this._setPropertyXYZ( +"alignPoint",alignPoint.get(this),newValue)}get alignPoint(){return alignPoint.has( +this)||alignPoint.set(this,new XYZNumberValues(0,0,0)),alignPoint.get(this)}set mountPoint(newValue){ +mountPoint.has(this)||mountPoint.set(this,new XYZNumberValues(0,0,0)),this._setPropertyXYZ( +"mountPoint",mountPoint.get(this),newValue)}get mountPoint(){return mountPoint.has( +this)||mountPoint.set(this,new XYZNumberValues(0,0,0)),mountPoint.get(this)}constructor(){ +super(...arguments),__runInitializers3(this,_instanceExtraInitializers)}};return Transformable2= +_classThis})();var ElementOperations=class{static{__name(this,"ElementOperations")}#element;constructor(element2){ +this.#element=element2}#shouldRender=!1;applyProperties(){this.#shouldRender&&(this.#applyOpacity(), +this.#applySize())}set shouldRender(shouldRender){this.#shouldRender=shouldRender, +requestAnimationFrame(()=>{this.#applyStyle("display",shouldRender?"block":"none")})}get shouldRender(){ +return this.#shouldRender}#applySize(){let{x:x2,y:y2}=this.#element.calculatedSize; +this.#applyStyle("width",`${x2}px`),this.#applyStyle("height",`${y2}px`)}#applyOpacity(){ +this.#applyStyle("opacity",this.#element.opacity.toString())}#applyStyle(property,value){ +this.#element.style.setProperty(property,value)}};var Object3DWithPivot=class extends Object3D{static{__name(this,"Object3DWithPiv\ +ot")}type="Object3DWithPivot";__pivot;get pivot(){return this.__pivot||(this.__pivot= +new Vector3),this.__pivot}set pivot(v){this.__pivot=v}updateMatrix(){this.matrix. +compose(this.position,this.quaternion,this.scale);let pivot=this.pivot;if(pivot. +x!==0||pivot.y!==0||pivot.z!==0){let px2=pivot.x,py2=pivot.y,pz2=pivot.z,te=this. +matrix.elements;te[12]+=px2-te[0]*px2-te[4]*py2-te[8]*pz2,te[13]+=py2-te[1]*px2- +te[5]*py2-te[9]*pz2,te[14]+=pz2-te[2]*px2-te[6]*py2-te[10]*pz2}this.matrixWorldNeedsUpdate= +!0}};Object3D.prototype.updateMatrix=Object3DWithPivot.prototype.updateMatrix;Object. +defineProperty(Object3D.prototype,"pivot",Object.getOwnPropertyDescriptor(Object3DWithPivot. +prototype,"pivot"));var LINEAR_SRGB_TO_LINEAR_DISPLAY_P3=new Matrix3().set(.8224621,.177538,0,.0331941, +.9668058,0,.0170827,.0723974,.9105199),LINEAR_DISPLAY_P3_TO_LINEAR_SRGB=new Matrix3(). +set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),COLOR_SPACES={ +[LinearSRGBColorSpace]:{transfer:LinearTransfer,primaries:Rec709Primaries,toReference:color=>color, +fromReference:color=>color},[SRGBColorSpace]:{transfer:SRGBTransfer,primaries:Rec709Primaries, +toReference:color=>color.convertSRGBToLinear(),fromReference:color=>color.convertLinearToSRGB()}, +[LinearDisplayP3ColorSpace]:{transfer:LinearTransfer,primaries:P3Primaries,toReference:color=>color. +applyMatrix3(LINEAR_DISPLAY_P3_TO_LINEAR_SRGB),fromReference:color=>color.applyMatrix3( +LINEAR_SRGB_TO_LINEAR_DISPLAY_P3)},[DisplayP3ColorSpace]:{transfer:SRGBTransfer, +primaries:P3Primaries,toReference:color=>color.convertSRGBToLinear().applyMatrix3( +LINEAR_DISPLAY_P3_TO_LINEAR_SRGB),fromReference:color=>color.applyMatrix3(LINEAR_SRGB_TO_LINEAR_DISPLAY_P3). +convertLinearToSRGB()}},SUPPORTED_WORKING_COLOR_SPACES=new Set([LinearSRGBColorSpace, +LinearDisplayP3ColorSpace]),ColorManagement={enabled:!0,_workingColorSpace:LinearSRGBColorSpace, +get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(colorSpace){ +if(!SUPPORTED_WORKING_COLOR_SPACES.has(colorSpace))throw new Error(`Unsupported \ +working color space, "${colorSpace}".`);this._workingColorSpace=colorSpace},convert:function(color,sourceColorSpace,targetColorSpace){ +if(this.enabled===!1||sourceColorSpace===targetColorSpace||!sourceColorSpace||!targetColorSpace) +return color;let sourceToReference=COLOR_SPACES[sourceColorSpace].toReference,targetFromReference=COLOR_SPACES[targetColorSpace]. +fromReference;return targetFromReference(sourceToReference(color))},fromWorkingColorSpace:function(color,targetColorSpace){ +return this.convert(color,this._workingColorSpace,targetColorSpace)},toWorkingColorSpace:function(color,sourceColorSpace){ +return this.convert(color,sourceColorSpace,this._workingColorSpace)},getPrimaries:function(colorSpace){ +return COLOR_SPACES[colorSpace].primaries},getTransfer:function(colorSpace){return colorSpace=== +NoColorSpace?LinearTransfer:COLOR_SPACES[colorSpace].transfer}};function SRGBToLinear(c3){ +return c3<.04045?c3*.0773993808:Math.pow(c3*.9478672986+.0521327014,2.4)}__name( +SRGBToLinear,"SRGBToLinear");function LinearToSRGB(c3){return c3<.0031308?c3*12.92: +1.055*Math.pow(c3,.41666)-.055}__name(LinearToSRGB,"LinearToSRGB");var _colorKeywords={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},_hslA={h:0,s:0,l:0},_hslB={h:0,s:0,l:0};function hue2rgb(p2,q2,t){ +return t<0&&(t+=1),t>1&&(t-=1),t<1/6?p2+(q2-p2)*6*t:t<1/2?q2:t<2/3?p2+(q2-p2)*6* +(2/3-t):p2}__name(hue2rgb,"hue2rgb");var Color=class{static{__name(this,"Color")}constructor(r3,g,b){ +return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(r3,g,b)}set(r3,g,b){if(g=== +void 0&&b===void 0){let value=r3;value&&value.isColor?this.copy(value):typeof value== +"number"?this.setHex(value):typeof value=="string"&&this.setStyle(value)}else this. +setRGB(r3,g,b);return this}setScalar(scalar){return this.r=scalar,this.g=scalar, +this.b=scalar,this}setHex(hex,colorSpace=SRGBColorSpace){return hex=Math.floor(hex), +this.r=(hex>>16&255)/255,this.g=(hex>>8&255)/255,this.b=(hex&255)/255,ColorManagement. +toWorkingColorSpace(this,colorSpace),this}setRGB(r3,g,b,colorSpace=ColorManagement. +workingColorSpace){return this.r=r3,this.g=g,this.b=b,ColorManagement.toWorkingColorSpace( +this,colorSpace),this}setHSL(h,s,l,colorSpace=ColorManagement.workingColorSpace){ +if(h=euclideanModulo(h,1),s=clamp(s,0,1),l=clamp(l,0,1),s===0)this.r=this.g=this. +b=l;else{let p2=l<=.5?l*(1+s):l+s-l*s,q2=2*l-p2;this.r=hue2rgb(q2,p2,h+1/3),this. +g=hue2rgb(q2,p2,h),this.b=hue2rgb(q2,p2,h-1/3)}return ColorManagement.toWorkingColorSpace( +this,colorSpace),this}setStyle(style2,colorSpace=SRGBColorSpace){function handleAlpha(string){ +string!==void 0&&parseFloat(string)<1&&console.warn("THREE.Color: Alpha componen\ +t of "+style2+" will be ignored.")}__name(handleAlpha,"handleAlpha");let m;if(m= +/^(\w+)\(([^\)]*)\)/.exec(style2)){let color,name2=m[1],components=m[2];switch(name2){case"\ +rgb":case"rgba":if(color=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/. +exec(components))return handleAlpha(color[4]),this.setRGB(Math.min(255,parseInt( +color[1],10))/255,Math.min(255,parseInt(color[2],10))/255,Math.min(255,parseInt( +color[3],10))/255,colorSpace);if(color=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/. +exec(components))return handleAlpha(color[4]),this.setRGB(Math.min(100,parseInt( +color[1],10))/100,Math.min(100,parseInt(color[2],10))/100,Math.min(100,parseInt( +color[3],10))/100,colorSpace);break;case"hsl":case"hsla":if(color=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/. +exec(components))return handleAlpha(color[4]),this.setHSL(parseFloat(color[1])/360, +parseFloat(color[2])/100,parseFloat(color[3])/100,colorSpace);break;default:console. +warn("THREE.Color: Unknown color model "+style2)}}else if(m=/^\#([A-Fa-f\d]+)$/. +exec(style2)){let hex=m[1],size3=hex.length;if(size3===3)return this.setRGB(parseInt( +hex.charAt(0),16)/15,parseInt(hex.charAt(1),16)/15,parseInt(hex.charAt(2),16)/15, +colorSpace);if(size3===6)return this.setHex(parseInt(hex,16),colorSpace);console. +warn("THREE.Color: Invalid hex color "+style2)}else if(style2&&style2.length>0)return this. +setColorName(style2,colorSpace);return this}setColorName(style2,colorSpace=SRGBColorSpace){ +let hex=_colorKeywords[style2.toLowerCase()];return hex!==void 0?this.setHex(hex, +colorSpace):console.warn("THREE.Color: Unknown color "+style2),this}clone(){return new this. +constructor(this.r,this.g,this.b)}copy(color){return this.r=color.r,this.g=color. +g,this.b=color.b,this}copySRGBToLinear(color){return this.r=SRGBToLinear(color.r), +this.g=SRGBToLinear(color.g),this.b=SRGBToLinear(color.b),this}copyLinearToSRGB(color){ +return this.r=LinearToSRGB(color.r),this.g=LinearToSRGB(color.g),this.b=LinearToSRGB( +color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){ +return this.copyLinearToSRGB(this),this}getHex(colorSpace=SRGBColorSpace){return ColorManagement. +fromWorkingColorSpace(_color.copy(this),colorSpace),Math.round(clamp(_color.r*255, +0,255))*65536+Math.round(clamp(_color.g*255,0,255))*256+Math.round(clamp(_color. +b*255,0,255))}getHexString(colorSpace=SRGBColorSpace){return("000000"+this.getHex( +colorSpace).toString(16)).slice(-6)}getHSL(target,colorSpace=ColorManagement.workingColorSpace){ +ColorManagement.fromWorkingColorSpace(_color.copy(this),colorSpace);let r3=_color. +r,g=_color.g,b=_color.b,max2=Math.max(r3,g,b),min=Math.min(r3,g,b),hue,saturation, +lightness=(min+max2)/2;if(min===max2)hue=0,saturation=0;else{let delta=max2-min; +switch(saturation=lightness<=.5?delta/(max2+min):delta/(2-max2-min),max2){case r3: +hue=(g-b)/delta+(g0!= +value>0&&this.version++,this._alphaTest=value}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){ +return this.onBeforeCompile.toString()}setValues(values){if(values!==void 0)for(let key2 in values){ +let newValue=values[key2];if(newValue===void 0){console.warn(`THREE.Material: pa\ +rameter '${key2}' has value of undefined.`);continue}let currentValue=this[key2]; +if(currentValue===void 0){console.warn(`THREE.Material: '${key2}' is not a prope\ +rty of THREE.${this.type}.`);continue}currentValue&¤tValue.isColor?currentValue. +set(newValue):currentValue&¤tValue.isVector3&&newValue&&newValue.isVector3? +currentValue.copy(newValue):this[key2]=newValue}}toJSON(meta){let isRootObject=meta=== +void 0||typeof meta=="string";isRootObject&&(meta={textures:{},images:{}});let data={ +metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};data.uuid=this. +uuid,data.type=this.type,this.name!==""&&(data.name=this.name),this.color&&this. +color.isColor&&(data.color=this.color.getHex()),this.roughness!==void 0&&(data.roughness= +this.roughness),this.metalness!==void 0&&(data.metalness=this.metalness),this.sheen!== +void 0&&(data.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(data. +sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(data.sheenRoughness= +this.sheenRoughness),this.emissive&&this.emissive.isColor&&(data.emissive=this.emissive. +getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(data.emissiveIntensity= +this.emissiveIntensity),this.specular&&this.specular.isColor&&(data.specular=this. +specular.getHex()),this.specularIntensity!==void 0&&(data.specularIntensity=this. +specularIntensity),this.specularColor&&this.specularColor.isColor&&(data.specularColor= +this.specularColor.getHex()),this.shininess!==void 0&&(data.shininess=this.shininess), +this.clearcoat!==void 0&&(data.clearcoat=this.clearcoat),this.clearcoatRoughness!== +void 0&&(data.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this. +clearcoatMap.isTexture&&(data.clearcoatMap=this.clearcoatMap.toJSON(meta).uuid), +this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(data.clearcoatRoughnessMap= +this.clearcoatRoughnessMap.toJSON(meta).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap. +isTexture&&(data.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(meta).uuid,data. +clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&& +(data.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(data.iridescenceIOR= +this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(data.iridescenceThicknessRange= +this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&& +(data.iridescenceMap=this.iridescenceMap.toJSON(meta).uuid),this.iridescenceThicknessMap&& +this.iridescenceThicknessMap.isTexture&&(data.iridescenceThicknessMap=this.iridescenceThicknessMap. +toJSON(meta).uuid),this.anisotropy!==void 0&&(data.anisotropy=this.anisotropy),this. +anisotropyRotation!==void 0&&(data.anisotropyRotation=this.anisotropyRotation),this. +anisotropyMap&&this.anisotropyMap.isTexture&&(data.anisotropyMap=this.anisotropyMap. +toJSON(meta).uuid),this.map&&this.map.isTexture&&(data.map=this.map.toJSON(meta). +uuid),this.matcap&&this.matcap.isTexture&&(data.matcap=this.matcap.toJSON(meta). +uuid),this.alphaMap&&this.alphaMap.isTexture&&(data.alphaMap=this.alphaMap.toJSON( +meta).uuid),this.lightMap&&this.lightMap.isTexture&&(data.lightMap=this.lightMap. +toJSON(meta).uuid,data.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this. +aoMap.isTexture&&(data.aoMap=this.aoMap.toJSON(meta).uuid,data.aoMapIntensity=this. +aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(data.bumpMap=this.bumpMap. +toJSON(meta).uuid,data.bumpScale=this.bumpScale),this.normalMap&&this.normalMap. +isTexture&&(data.normalMap=this.normalMap.toJSON(meta).uuid,data.normalMapType=this. +normalMapType,data.normalScale=this.normalScale.toArray()),this.displacementMap&& +this.displacementMap.isTexture&&(data.displacementMap=this.displacementMap.toJSON( +meta).uuid,data.displacementScale=this.displacementScale,data.displacementBias=this. +displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(data.roughnessMap= +this.roughnessMap.toJSON(meta).uuid),this.metalnessMap&&this.metalnessMap.isTexture&& +(data.metalnessMap=this.metalnessMap.toJSON(meta).uuid),this.emissiveMap&&this.emissiveMap. +isTexture&&(data.emissiveMap=this.emissiveMap.toJSON(meta).uuid),this.specularMap&& +this.specularMap.isTexture&&(data.specularMap=this.specularMap.toJSON(meta).uuid), +this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(data.specularIntensityMap= +this.specularIntensityMap.toJSON(meta).uuid),this.specularColorMap&&this.specularColorMap. +isTexture&&(data.specularColorMap=this.specularColorMap.toJSON(meta).uuid),this. +envMap&&this.envMap.isTexture&&(data.envMap=this.envMap.toJSON(meta).uuid,this.combine!== +void 0&&(data.combine=this.combine)),this.envMapIntensity!==void 0&&(data.envMapIntensity= +this.envMapIntensity),this.reflectivity!==void 0&&(data.reflectivity=this.reflectivity), +this.refractionRatio!==void 0&&(data.refractionRatio=this.refractionRatio),this. +gradientMap&&this.gradientMap.isTexture&&(data.gradientMap=this.gradientMap.toJSON( +meta).uuid),this.transmission!==void 0&&(data.transmission=this.transmission),this. +transmissionMap&&this.transmissionMap.isTexture&&(data.transmissionMap=this.transmissionMap. +toJSON(meta).uuid),this.thickness!==void 0&&(data.thickness=this.thickness),this. +thicknessMap&&this.thicknessMap.isTexture&&(data.thicknessMap=this.thicknessMap. +toJSON(meta).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!== +1/0&&(data.attenuationDistance=this.attenuationDistance),this.attenuationColor!== +void 0&&(data.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&& +(data.size=this.size),this.shadowSide!==null&&(data.shadowSide=this.shadowSide), +this.sizeAttenuation!==void 0&&(data.sizeAttenuation=this.sizeAttenuation),this. +blending!==NormalBlending&&(data.blending=this.blending),this.side!==FrontSide&& +(data.side=this.side),this.vertexColors===!0&&(data.vertexColors=!0),this.opacity< +1&&(data.opacity=this.opacity),this.transparent===!0&&(data.transparent=!0),this. +blendSrc!==SrcAlphaFactor&&(data.blendSrc=this.blendSrc),this.blendDst!==OneMinusSrcAlphaFactor&& +(data.blendDst=this.blendDst),this.blendEquation!==AddEquation&&(data.blendEquation= +this.blendEquation),this.blendSrcAlpha!==null&&(data.blendSrcAlpha=this.blendSrcAlpha), +this.blendDstAlpha!==null&&(data.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!== +null&&(data.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor. +isColor&&(data.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(data.blendAlpha= +this.blendAlpha),this.depthFunc!==LessEqualDepth&&(data.depthFunc=this.depthFunc), +this.depthTest===!1&&(data.depthTest=this.depthTest),this.depthWrite===!1&&(data. +depthWrite=this.depthWrite),this.colorWrite===!1&&(data.colorWrite=this.colorWrite), +this.stencilWriteMask!==255&&(data.stencilWriteMask=this.stencilWriteMask),this. +stencilFunc!==AlwaysStencilFunc&&(data.stencilFunc=this.stencilFunc),this.stencilRef!== +0&&(data.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(data.stencilFuncMask= +this.stencilFuncMask),this.stencilFail!==KeepStencilOp&&(data.stencilFail=this.stencilFail), +this.stencilZFail!==KeepStencilOp&&(data.stencilZFail=this.stencilZFail),this.stencilZPass!== +KeepStencilOp&&(data.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(data. +stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(data. +rotation=this.rotation),this.polygonOffset===!0&&(data.polygonOffset=!0),this.polygonOffsetFactor!== +0&&(data.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!== +0&&(data.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this. +linewidth!==1&&(data.linewidth=this.linewidth),this.dashSize!==void 0&&(data.dashSize= +this.dashSize),this.gapSize!==void 0&&(data.gapSize=this.gapSize),this.scale!==void 0&& +(data.scale=this.scale),this.dithering===!0&&(data.dithering=!0),this.alphaTest> +0&&(data.alphaTest=this.alphaTest),this.alphaHash===!0&&(data.alphaHash=!0),this. +alphaToCoverage===!0&&(data.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(data. +premultipliedAlpha=!0),this.forceSinglePass===!0&&(data.forceSinglePass=!0),this. +wireframe===!0&&(data.wireframe=!0),this.wireframeLinewidth>1&&(data.wireframeLinewidth= +this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(data.wireframeLinecap= +this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(data.wireframeLinejoin= +this.wireframeLinejoin),this.flatShading===!0&&(data.flatShading=!0),this.visible=== +!1&&(data.visible=!1),this.toneMapped===!1&&(data.toneMapped=!1),this.fog===!1&& +(data.fog=!1),Object.keys(this.userData).length>0&&(data.userData=this.userData); +function extractFromCache(cache2){let values=[];for(let key2 in cache2){let data2=cache2[key2]; +delete data2.metadata,values.push(data2)}return values}if(__name(extractFromCache, +"extractFromCache"),isRootObject){let textures=extractFromCache(meta.textures),images=extractFromCache( +meta.images);textures.length>0&&(data.textures=textures),images.length>0&&(data. +images=images)}return data}clone(){return new this.constructor().copy(this)}copy(source){ +this.name=source.name,this.blending=source.blending,this.side=source.side,this.vertexColors= +source.vertexColors,this.opacity=source.opacity,this.transparent=source.transparent, +this.blendSrc=source.blendSrc,this.blendDst=source.blendDst,this.blendEquation=source. +blendEquation,this.blendSrcAlpha=source.blendSrcAlpha,this.blendDstAlpha=source. +blendDstAlpha,this.blendEquationAlpha=source.blendEquationAlpha,this.blendColor. +copy(source.blendColor),this.blendAlpha=source.blendAlpha,this.depthFunc=source. +depthFunc,this.depthTest=source.depthTest,this.depthWrite=source.depthWrite,this. +stencilWriteMask=source.stencilWriteMask,this.stencilFunc=source.stencilFunc,this. +stencilRef=source.stencilRef,this.stencilFuncMask=source.stencilFuncMask,this.stencilFail= +source.stencilFail,this.stencilZFail=source.stencilZFail,this.stencilZPass=source. +stencilZPass,this.stencilWrite=source.stencilWrite;let srcPlanes=source.clippingPlanes, +dstPlanes=null;if(srcPlanes!==null){let n=srcPlanes.length;dstPlanes=new Array(n); +for(let i2=0;i2!==n;++i2)dstPlanes[i2]=srcPlanes[i2].clone()}return this.clippingPlanes= +dstPlanes,this.clipIntersection=source.clipIntersection,this.clipShadows=source. +clipShadows,this.shadowSide=source.shadowSide,this.colorWrite=source.colorWrite, +this.precision=source.precision,this.polygonOffset=source.polygonOffset,this.polygonOffsetFactor= +source.polygonOffsetFactor,this.polygonOffsetUnits=source.polygonOffsetUnits,this. +dithering=source.dithering,this.alphaTest=source.alphaTest,this.alphaHash=source. +alphaHash,this.alphaToCoverage=source.alphaToCoverage,this.premultipliedAlpha=source. +premultipliedAlpha,this.forceSinglePass=source.forceSinglePass,this.visible=source. +visible,this.toneMapped=source.toneMapped,this.userData=JSON.parse(JSON.stringify( +source.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(value){ +value===!0&&this.version++}};var Vector2=class _Vector2{static{__name(this,"Vector2")}constructor(x2=0,y2=0){ +_Vector2.prototype.isVector2=!0,this.x=x2,this.y=y2}get width(){return this.x}set width(value){ +this.x=value}get height(){return this.y}set height(value){this.y=value}set(x2,y2){ +return this.x=x2,this.y=y2,this}setScalar(scalar){return this.x=scalar,this.y=scalar, +this}setX(x2){return this.x=x2,this}setY(y2){return this.y=y2,this}setComponent(index,value){ +switch(index){case 0:this.x=value;break;case 1:this.y=value;break;default:throw new Error( +"index is out of range: "+index)}return this}getComponent(index){switch(index){case 0: +return this.x;case 1:return this.y;default:throw new Error("index is out of rang\ +e: "+index)}}clone(){return new this.constructor(this.x,this.y)}copy(v){return this. +x=v.x,this.y=v.y,this}add(v){return this.x+=v.x,this.y+=v.y,this}addScalar(s){return this. +x+=s,this.y+=s,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this}addScaledVector(v,s){ +return this.x+=v.x*s,this.y+=v.y*s,this}sub(v){return this.x-=v.x,this.y-=v.y,this}subScalar(s){ +return this.x-=s,this.y-=s,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y- +b.y,this}multiply(v){return this.x*=v.x,this.y*=v.y,this}multiplyScalar(scalar){ +return this.x*=scalar,this.y*=scalar,this}divide(v){return this.x/=v.x,this.y/=v. +y,this}divideScalar(scalar){return this.multiplyScalar(1/scalar)}applyMatrix3(m){ +let x2=this.x,y2=this.y,e=m.elements;return this.x=e[0]*x2+e[3]*y2+e[6],this.y=e[1]* +x2+e[4]*y2+e[7],this}min(v){return this.x=Math.min(this.x,v.x),this.y=Math.min(this. +y,v.y),this}max(v){return this.x=Math.max(this.x,v.x),this.y=Math.max(this.y,v.y), +this}clamp(min,max2){return this.x=Math.max(min.x,Math.min(max2.x,this.x)),this. +y=Math.max(min.y,Math.min(max2.y,this.y)),this}clampScalar(minVal,maxVal){return this. +x=Math.max(minVal,Math.min(maxVal,this.x)),this.y=Math.max(minVal,Math.min(maxVal, +this.y)),this}clampLength(min,max2){let length=this.length();return this.divideScalar( +length||1).multiplyScalar(Math.max(min,Math.min(max2,length)))}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(v){ +return this.x*v.x+this.y*v.y}cross(v){return this.x*v.y-this.y*v.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(v){let denominator=Math. +sqrt(this.lengthSq()*v.lengthSq());if(denominator===0)return Math.PI/2;let theta=this. +dot(v)/denominator;return Math.acos(clamp(theta,-1,1))}distanceTo(v){return Math. +sqrt(this.distanceToSquared(v))}distanceToSquared(v){let dx=this.x-v.x,dy=this.y- +v.y;return dx*dx+dy*dy}manhattanDistanceTo(v){return Math.abs(this.x-v.x)+Math.abs( +this.y-v.y)}setLength(length){return this.normalize().multiplyScalar(length)}lerp(v,alpha){ +return this.x+=(v.x-this.x)*alpha,this.y+=(v.y-this.y)*alpha,this}lerpVectors(v1,v2,alpha){ +return this.x=v1.x+(v2.x-v1.x)*alpha,this.y=v1.y+(v2.y-v1.y)*alpha,this}equals(v){ +return v.x===this.x&&v.y===this.y}fromArray(array,offset=0){return this.x=array[offset], +this.y=array[offset+1],this}toArray(array=[],offset=0){return array[offset]=this. +x,array[offset+1]=this.y,array}fromBufferAttribute(attribute2,index){return this. +x=attribute2.getX(index),this.y=attribute2.getY(index),this}rotateAround(center,angle){ +let c3=Math.cos(angle),s=Math.sin(angle),x2=this.x-center.x,y2=this.y-center.y;return this. +x=x2*c3-y2*s+center.x,this.y=x2*s+y2*c3+center.y,this}random(){return this.x=Math. +random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this. +y}};var MeshPhongMaterial=class extends Material{static{__name(this,"MeshPhongMateri\ +al")}constructor(parameters){super(),this.isMeshPhongMaterial=!0,this.type="Mesh\ +PhongMaterial",this.color=new Color(16777215),this.specular=new Color(1118481),this. +shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap= +null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this. +emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType= +TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null, +this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap= +null,this.envMap=null,this.combine=MultiplyOperation,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(parameters)}copy(source){ +return super.copy(source),this.color.copy(source.color),this.specular.copy(source. +specular),this.shininess=source.shininess,this.map=source.map,this.lightMap=source. +lightMap,this.lightMapIntensity=source.lightMapIntensity,this.aoMap=source.aoMap, +this.aoMapIntensity=source.aoMapIntensity,this.emissive.copy(source.emissive),this. +emissiveMap=source.emissiveMap,this.emissiveIntensity=source.emissiveIntensity,this. +bumpMap=source.bumpMap,this.bumpScale=source.bumpScale,this.normalMap=source.normalMap, +this.normalMapType=source.normalMapType,this.normalScale.copy(source.normalScale), +this.displacementMap=source.displacementMap,this.displacementScale=source.displacementScale, +this.displacementBias=source.displacementBias,this.specularMap=source.specularMap, +this.alphaMap=source.alphaMap,this.envMap=source.envMap,this.combine=source.combine, +this.reflectivity=source.reflectivity,this.refractionRatio=source.refractionRatio, +this.wireframe=source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth, +this.wireframeLinecap=source.wireframeLinecap,this.wireframeLinejoin=source.wireframeLinejoin, +this.flatShading=source.flatShading,this.fog=source.fog,this}};function isRenderItem(obj){return"geometry"in obj&&"material"in obj}__name(isRenderItem, +"isRenderItem");function disposeMaterial(obj){if(!isRenderItem(obj))return;let materials=[]. +concat(obj.material);for(let material of materials)material.dispose()}__name(disposeMaterial, +"disposeMaterial");function disposeObject(obj,removeFromParent=!0,destroyGeometry=!0,destroyMaterial=!0){ +obj&&(isRenderItem(obj)&&(obj.geometry&&destroyGeometry&&obj.geometry.dispose(), +destroyMaterial&&disposeMaterial(obj)),removeFromParent&&queueMicrotask(()=>{obj. +parent&&obj.parent.remove(obj)}))}__name(disposeObject,"disposeObject");function disposeObjectTree(obj,disposeOptions={}){ +obj.traverse(node=>{disposeObject(node,disposeOptions.removeFromParent,disposeOptions. +destroyGeometry,disposeOptions.destroyMaterial)})}__name(disposeObjectTree,"disp\ +oseObjectTree");function applyMaterial(obj,material,dispose=!0){isRenderItem(obj)&&(dispose&&obj. +material&&disposeMaterial(obj),obj.material=material)}__name(applyMaterial,"appl\ +yMaterial");function setRandomColorPhongMaterial(obj,dispose,traverse){let randomColor=5592405* +Math.random()+5592405;setColorPhongMaterial(obj,randomColor,dispose,traverse)}__name( +setRandomColorPhongMaterial,"setRandomColorPhongMaterial");function setColorPhongMaterial(obj,color,dispose,traverse=!0){ +let material=new MeshPhongMaterial;material.color=new Color(color),traverse?obj. +traverse(node=>applyMaterial(node,material,dispose)):applyMaterial(obj,material, +dispose)}__name(setColorPhongMaterial,"setColorPhongMaterial");function isPerspectiveCamera(camera){ +return!!camera.isPerspectiveCamera}__name(isPerspectiveCamera,"isPerspectiveCame\ +ra");function isOrthographicCamera(camera){return!!camera.isOrthographicCamera}__name( +isOrthographicCamera,"isOrthographicCamera");var CSS3DObjectNested=class extends Object3DWithPivot{static{__name(this,"CSS3DO\ +bjectNested")}element;type="CSS3DObjectNested";#initialFrame=requestAnimationFrame( +()=>{this.element.style.position="absolute"});constructor(element2){super(),this. +element=element2}dispose(){cancelAnimationFrame(this.#initialFrame)}},CSS3DNestedSprite=class extends CSS3DObjectNested{static{ +__name(this,"CSS3DNestedSprite")}},CSS3DRendererNested=class{static{__name(this, +"CSS3DRendererNested")}domElement;#matrix=new Matrix4;#cache={camera:{fov:0,style:""}, +objects:new WeakMap};#width=0;#height=0;#widthHalf=0;#heightHalf=0;#cameraElement;constructor(){ +let domElement=document.createElement("div");domElement.classList.add("CSS3DRend\ +ererNested"),domElement.style.overflow="hidden",this.domElement=domElement;let cameraElement=document. +createElement("div");cameraElement.classList.add("cameraElement"),cameraElement. +appendChild(document.createElement("slot")),cameraElement.style.transformStyle="\ +preserve-3d",domElement.appendChild(cameraElement),this.#cameraElement=cameraElement}getSize(){ +return{width:this.#width,height:this.#height}}setSize(width,height){this.#width= +width,this.#height=height,this.#widthHalf=width/2,this.#heightHalf=height/2,this. +domElement.style.width=width+"px",this.domElement.style.height=height+"px",this.#cameraElement. +style.width=width+"px",this.#cameraElement.style.height=height+"px"}#renderObject(object,camera){ +if(object instanceof CSS3DObjectNested){let style2="";object instanceof CSS3DNestedSprite? +(this.#matrix.copy(camera.matrixWorldInverse),this.#matrix.transpose(),this.#matrix. +copyPosition(object.matrixWorld),this.#matrix.scale(object.scale),this.#matrix.elements[3]= +0,this.#matrix.elements[7]=0,this.#matrix.elements[11]=0,this.#matrix.elements[15]= +1,style2=getObjectCSSMatrix(object,this.#matrix)):style2=getObjectCSSMatrix(object, +object.matrix);let element2=object.element,cachedStyle=this.#cache.objects.get(object); +if(cachedStyle===void 0||cachedStyle.style!==style2){element2.style.transform=style2; +let objectData={style:style2};this.#cache.objects.set(object,objectData)}}for(let i2=0, +l=object.children.length;i2{this.#awaitedChildren.delete( +child),this.isConnected&&this.childConnectedCallback?.(child)}))}#runChildDisconnectedCallbacks(){ +for(let el2=this.firstElementChild;el2;el2=el2.nextElementSibling)this.#runChildDisconnect( +el2)}#runChildDisconnect(child){this.#awaitedChildren.has(child)||this.childDisconnectedCallback?.( +child)}#unobserveChildren=null;#createObserver(){this.#unobserveChildren||(this.#unobserveChildren= +observeChildren({target:this,onConnect:child=>{this.isConnected&&this.childConnectedCallback&& +this.childConnectedCallback(child)},onDisconnect:child=>{this.isConnected&&this. +childDisconnectedCallback&&this.childDisconnectedCallback(child)}}))}#destroyObserver(){ +this.#unobserveChildren&&(this.#unobserveChildren(),this.#unobserveChildren=null)}}} +__name(ChildTracker,"ChildTracker");function InitialBehaviors(Base){return class extends Base{static{__name(this,"In\ +itialBehaviors")}initialBehaviors;constructor(...args){super(...args),queueMicrotask( +()=>this.#setBehaviors())}#setBehaviors(){this.initialBehaviors&&setBehaviors(this, +this.initialBehaviors,!1)}}}__name(InitialBehaviors,"InitialBehaviors");function _setBehaviors(el2,behaviors,replace){ +let has=el2.getAttribute("has")??"",parts=has.split(" ");for(let[category,type]of Object. +entries(behaviors))replace?el2.setAttribute("has",has=has.replace(r`/[a-z-]*-${category}/`, +"")+` ${type}-${category}`):parts.some(b=>b.endsWith("-"+category))||el2.setAttribute( +"has",has=has+` ${type}-${category}`)}__name(_setBehaviors,"_setBehaviors");function setBehaviors(el2,behaviors,replace=!0){ +_setBehaviors(el2,behaviors,replace)}__name(setBehaviors,"setBehaviors");var __runInitializers4=function(thisArg,initializers,value){for(var useValue=arguments. +length>2,i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},threeJsPostAdjustment=[ +0,0,0],alignAdjustment=[0,0,0],mountPointAdjustment=[0,0,0],appliedPosition=[0,0, +0],elOps=new WeakMap,ourThreeObjects=new WeakSet,isManagedByUs=__name(obj=>ourThreeObjects. +has(obj),"isManagedByUs"),opacity=new WeakMap,SharedAPI=(()=>{let _classDecorators=[ +element],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=InitialBehaviors( +ChildTracker(Settable(Transformable))),_instanceExtraInitializers=[],_set_opacity_decorators, +_debug_decorators,_debug_initializers=[],__scene_decorators,__scene_initializers=[], +_version_decorators,_version_initializers=[];var SharedAPI2=class extends _classSuper{static{ +__name(this,"SharedAPI")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_set_opacity_decorators=[attribute],_debug_decorators=[booleanAttribute],__scene_decorators= +[signal],_version_decorators=[signal],__esDecorate4(this,null,_set_opacity_decorators, +{kind:"setter",name:"opacity",static:!1,private:!1,access:{has:obj=>"opacity"in obj, +set:(obj,value)=>{obj.opacity=value}},metadata:_metadata},null,_instanceExtraInitializers), +__esDecorate4(null,null,_debug_decorators,{kind:"field",name:"debug",static:!1,private:!1, +access:{has:obj=>"debug"in obj,get:obj=>obj.debug,set:(obj,value)=>{obj.debug=value}}, +metadata:_metadata},_debug_initializers,_instanceExtraInitializers),__esDecorate4( +null,null,__scene_decorators,{kind:"field",name:"_scene",static:!1,private:!1,access:{ +has:obj=>"_scene"in obj,get:obj=>obj._scene,set:(obj,value)=>{obj._scene=value}}, +metadata:_metadata},__scene_initializers,_instanceExtraInitializers),__esDecorate4( +null,null,_version_decorators,{kind:"field",name:"version",static:!1,private:!1, +access:{has:obj=>"version"in obj,get:obj=>obj.version,set:(obj,value)=>{obj.version= +value}},metadata:_metadata},_version_initializers,_instanceExtraInitializers),__esDecorate4( +null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis. +name,metadata:_metadata},null,_classExtraInitializers),SharedAPI2=_classThis=_classDescriptor. +value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0, +configurable:!0,writable:!0,value:_metadata})}static define(name2){this.defineElement( +name2)}isScene=(__runInitializers4(this,_instanceExtraInitializers),!1);isElement3D=!1;set opacity(newValue){ +opacity.has(this)||opacity.set(this,1),this._setPropertySingle("opacity",v=>opacity. +set(this,v),newValue)}get opacity(){return opacity.has(this)||opacity.set(this,1), +opacity.get(this)}debug=__runInitializers4(this,_debug_initializers,!1);get glLoaded(){ +return!0}get cssLoaded(){return!0}_scene=__runInitializers4(this,__scene_initializers, +null);get scene(){return this._scene}__three;get three(){return this.__three||(this. +__three=this.__makeThreeObject3d()),this.__three}__makeThreeObject3d(){let o=this. +makeThreeObject3d();return o.name=`${this.tagName}${this.id?"#"+this.id:""} (web\ +gl, ${o.type})`,ourThreeObjects.add(o),o.matrixAutoUpdate=!1,o}__disposeThree(){ +this.__three&&(disposeObject(this.__three),ourThreeObjects.delete(this.__three), +this.__three=void 0)}recreateThree(){let children2=this.__three?.children;this.__disposeThree(), +this.__reconnectThree(),children2&&children2.length&&this.three.add(...children2)}__threeCSS;get threeCSS(){ +return this.__threeCSS||(this.__threeCSS=this.__makeThreeCSSObject()),this.__threeCSS}__makeThreeCSSObject(){ +let o=this.makeThreeCSSObject();return o.name=`${this.tagName}${this.id?"#"+this. +id:""} (css3d, ${o.type})`,ourThreeObjects.add(o),o.matrixAutoUpdate=!1,o}__disposeThreeCSS(){ +this.__threeCSS&&(disposeObject(this.__threeCSS),ourThreeObjects.delete(this.__threeCSS), +this.__threeCSS=void 0)}recreateThreeCSS(){let children2=this.__threeCSS?.children; +this.__disposeThreeCSS(),this.__reconnectThreeCSS(),children2&&children2.length&& +this.threeCSS.add(...children2)}connectedCallback(){super.connectedCallback(),this. +createEffect(()=>{this.scene,this.sizeMode.asDependency(),this.size.asDependency(), +untrack(()=>{this._calcSize(),this.needsUpdate()})}),this.createEffect(()=>{this. +parentSize,untrack(()=>{let{x:x2,y:y2,z:z2}=this.sizeMode;(x2==="proportional"|| +x2==="p"||y2==="proportional"||y2==="p"||z2==="proportional"||z2==="p")&&this._calcSize()}), +this.needsUpdate()}),this.createEffect(()=>{this.position.asDependency(),this.rotation. +asDependency(),this.scale.asDependency(),this.origin.asDependency(),this.alignPoint. +asDependency(),this.mountPoint.asDependency(),this.opacity,this.needsUpdate()})}disconnectedCallback(){ +super.disconnectedCallback(),this.stopEffects(),this.__disposeThree(),this.__disposeThreeCSS(), +this._scene=null}composedCallback(composedParent,compositionType){super.composedCallback?.( +composedParent,compositionType),this.isScene&&console.warn("Composing `` elements directly into other `` elements is not currently supported\ +. To nest a scene inside a scene, wrap it with a `
` inside of a ``."),this.composedSceneGraphParent.three.add(this.three),this.composedSceneGraphParent. +threeCSS.add(this.threeCSS),this._scene=this.composedSceneGraphParent.scene,this. +_scene&&this.#giveSceneToChildren()}uncomposedCallback(uncomposedParent,compositionType){ +super.uncomposedCallback?.(uncomposedParent,compositionType),this.three.parent?. +remove(this.three),this.threeCSS.parent?.remove(this.threeCSS),this._scene=null, +this.#giveSceneToChildren()}#giveSceneToChildren(){this.traverseSceneGraph(el2=>{ +el2!==this&&el2._scene!==this._scene&&(el2._scene=this._scene)})}childComposedCallback(child,_compositionType){ +child instanceof SharedAPI2&&this.needsUpdate()}childUncomposedCallback(child,_compositionType){ +child instanceof SharedAPI2&&this.needsUpdate()}traverseSceneGraph(_visitor,_waitForUpgrade=!1){ +throw"Element3D and Scene implement this"}get parentLumeElement(){let parent=super. +parentLumeElement;if(parent&&!(parent instanceof SharedAPI2))throw new TypeError( +"Parent must be type SharedAPI.");return parent}needsUpdate(){Motor.needsUpdate( +this)}get _elementOperations(){return elOps.has(this)||elOps.set(this,new ElementOperations( +this)),elOps.get(this)}get composedLumeChildren(){let result=[];for(let child of super. +composedLumeChildren)isElement3D(child)&&result.push(child);return result}makeThreeObject3d(){ +return new Object3D}makeThreeCSSObject(){if(!(this instanceof HTMLElement))throw"\ +API available only in DOM environment.";return new CSS3DObjectNested(this)}__reconnectThree(){ +this.composedSceneGraphParent?.three.add(this.three);for(let child of this.composedLumeChildren) +this.three.add(child.three);this.needsUpdate()}__reconnectThreeCSS(){this.composedSceneGraphParent?. +threeCSS.add(this.threeCSS);for(let child of this.composedLumeChildren)this.threeCSS. +add(child.threeCSS);this.needsUpdate()}get composedLumeParent(){let result=super. +composedLumeParent;return result instanceof SharedAPI2?result:null}get composedSceneGraphParent(){ +let composedLumeParent=this.composedLumeParent;return this.parentLumeElement?.isScene? +this.parentLumeElement:composedLumeParent}_calculateMatrix(){let align=this.alignPoint, +mountPoint2=this.mountPoint,position2=this.position,origin2=this.origin,size3=this. +calculatedSize;threeJsPostAdjustment[0]=size3.x/2,threeJsPostAdjustment[1]=size3. +y/2,threeJsPostAdjustment[2]=size3.z/2;let parentSize=this.parentSize;threeJsPostAdjustment[0]+= +-parentSize.x/2,threeJsPostAdjustment[1]+=-parentSize.y/2,threeJsPostAdjustment[2]+= +-parentSize.z/2,alignAdjustment[0]=parentSize.x*align.x,alignAdjustment[1]=parentSize. +y*align.y,alignAdjustment[2]=parentSize.z*align.z,mountPointAdjustment[0]=size3. +x*mountPoint2.x,mountPointAdjustment[1]=size3.y*mountPoint2.y,mountPointAdjustment[2]= +size3.z*mountPoint2.z,appliedPosition[0]=position2.x+alignAdjustment[0]-mountPointAdjustment[0], +appliedPosition[1]=position2.y+alignAdjustment[1]-mountPointAdjustment[1],appliedPosition[2]= +position2.z+alignAdjustment[2]-mountPointAdjustment[2],this.three.position.set(appliedPosition[0]+ +threeJsPostAdjustment[0],-(appliedPosition[1]+threeJsPostAdjustment[1]),appliedPosition[2]+ +threeJsPostAdjustment[2]),this.composedSceneGraphParent?.isScene?this.threeCSS.position. +set(appliedPosition[0]+threeJsPostAdjustment[0],-(appliedPosition[1]+threeJsPostAdjustment[1]), +appliedPosition[2]+threeJsPostAdjustment[2]):this.threeCSS.position.set(appliedPosition[0], +-appliedPosition[1],appliedPosition[2]+threeJsPostAdjustment[2]),origin2.x!==.5|| +origin2.y!==.5||origin2.z!==.5?(this.three.pivot.set(origin2.x*size3.x-size3.x/2, +-(origin2.y*size3.y-size3.y/2),origin2.z*size3.z-size3.z/2),this.threeCSS.pivot. +set(origin2.x*size3.x-size3.x/2,-(origin2.y*size3.y-size3.y/2),origin2.z*size3.z- +size3.z/2)):(this.three.pivot.set(0,0,0),this.threeCSS.pivot.set(0,0,0)),this.three. +updateMatrix(),this.threeCSS.updateMatrix()}_updateRotation(){let{x:x2,y:y2,z:z2}=this. +rotation;this.three.rotation.set(-toRadians(x2),toRadians(y2),-toRadians(z2));let childOfScene=this. +composedSceneGraphParent?.isScene;this.threeCSS.rotation.set((childOfScene?-1:1)* +toRadians(x2),toRadians(y2),(childOfScene?-1:1)*toRadians(z2))}_updateScale(){let{ +x:x2,y:y2,z:z2}=this.scale;this.three.scale.set(x2,y2,z2),this.threeCSS.scale.set( +x2,y2,z2)}version=__runInitializers4(this,_version_initializers,0);updateWorldMatrices(traverse=!0){ +this.three.updateWorldMatrix(!1,!1);for(let child of this.three.children)isManagedByUs( +child)||child.updateMatrixWorld(!0);this.threeCSS.updateWorldMatrix(!1,!1);for(let child of this. +threeCSS.children)isManagedByUs(child)||child.updateMatrixWorld(!0);traverse&&this. +traverseSceneGraph(n=>n!==this&&n.updateWorldMatrices(!1),!1),untrack(()=>this.version++)}update(_timestamp,_deltaTime){ +this._updateRotation(),this._updateScale(),this._calculateMatrix(),this._elementOperations. +applyProperties()}on(eventName,callback,context){super.on(eventName,callback,context)}emit(eventName,data){ +super.emit(eventName,data)}childConnectedCallback(child){isElement3D(child)?!this. +isScene&&this.__shadowRoot?child.__isPossiblyDistributedToShadowRoot=!0:this.__triggerChildComposedCallback( +child,"actual"):child instanceof HTMLSlotElement&&(child.addEventListener("slotc\ +hange",this.__onChildSlotChange),queueMicrotask(()=>this.__handleSlottedChildren( +child)))}childDisconnectedCallback(child){isElement3D(child)?!this.isScene&&this. +__shadowRoot?child.__isPossiblyDistributedToShadowRoot=!1:this.__triggerChildUncomposedCallback( +child,"actual"):child instanceof HTMLSlotElement&&(child.removeEventListener("sl\ +otchange",this.__onChildSlotChange,{capture:!0}),this.__handleSlottedChildren(child), +this.__previousSlotAssignedNodes.delete(child))}setAttribute(attr,value){super.setAttribute( +attr,value)}get _composedChildren(){return!this.isScene&&this.__shadowRoot?[...this. +_distributedShadowRootChildren.filter(n=>n instanceof SharedAPI2),...this._shadowRootChildren. +filter(n=>n instanceof SharedAPI2)]:[...[...this.__distributedChildren||[]].filter( +n=>n instanceof SharedAPI2),...Array.from(this.children).filter(n=>n instanceof SharedAPI2)]}static css=`\ + + :host { + /* + * All items of the scene graph are hidden until they are mounted in + * a scene (this changes to display:block). This gets toggled + * between "none" and "block" by SharedAPI depending on if CSS + * rendering is enabled. + */ + display: none; + + /* + Layout of a node's CSS rectangle is never affected by anything + outside of it. We don't contain paint because CSS content can + overflow if desired, or size because eventually we'll add natural + sizing to let the node be sized by its content. + */ + contain: layout; + + /* TODO see how content-visibility affects CSS performance with nodes that ar\ +e off-screen. */ + /* content-visibility: auto; implies contain:strict */ + + box-sizing: border-box; + + /* + * Defaults to [0.5,0.5,0.5] (the Z axis doesn't apply for DOM + * elements, but does for 3D objects in WebGL that have any size + * along Z.) + */ + transform-origin: 50% 50% 0; /* default */ + + transform-style: preserve-3d; + + /* + * Force anti-aliasing of 3D element edges using an invisible shadow. + * https://stackoverflow.com/questions/6492027 + * TODO allow to be configured with an antialiased attribute or similar. + */ + /*box-shadow: 0 0 1px rgba(255, 255, 255, 0); currently is very very slow, ht\ +tps://crbug.com/1405629*/ + } + `;static{__runInitializers4(_classThis,_classExtraInitializers)}};return SharedAPI2= +_classThis})();isDomEnvironment()&&globalThis.addEventListener("error",event=>{let error=event. +error;error&&/Illegal constructor/i.test(error.message)&&console.error(` + One of the reasons the following error can happen is if a Custom + Element is called with 'new' before being defined. Did you set + window.$lume.autoDefineElements to false and then forget to call + 'LUME.defineElements()' or to call '.defineElement()' on + individual Lume classes? For other reasons, see: + https://www.google.com/search?q=chrome%20illegal%20constructor + `)});var UserConfig;try{UserConfig=$lume??{}}catch{UserConfig={}}var autoDefineElements=UserConfig. +autoDefineElements??!0;var __runInitializers5=function(thisArg,initializers,value){for(var useValue=arguments. +length>2,i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0};var Element3D=(()=>{let _classDecorators=[element("lume-element3d",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=SharedAPI,_instanceExtraInitializers=[], +_visible_decorators,_visible_initializers=[];var Element3D2=class extends _classSuper{static{ +__name(this,"Element3D")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_visible_decorators=[booleanAttribute],__esDecorate5(null,null,_visible_decorators, +{kind:"field",name:"visible",static:!1,private:!1,access:{has:obj=>"visible"in obj, +get:obj=>obj.visible,set:(obj,value)=>{obj.visible=value}},metadata:_metadata},_visible_initializers, +_instanceExtraInitializers),__esDecorate5(null,_classDescriptor={value:_classThis}, +_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers), +Element3D2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis, +Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}hasShadow=(__runInitializers5( +this,_instanceExtraInitializers),!1);isElement3D=!0;visible=__runInitializers5(this, +_visible_initializers,!0);get parentSize(){let composedLumeParent=this.composedLumeParent; +return this.scene&&this.scene===this.parentElement?this.scene.calculatedSize:composedLumeParent?. +calculatedSize??{x:0,y:0,z:0}}constructor(){super(),this.composedLumeParent&&(this. +_calcSize(),queueMicrotask(()=>this.needsUpdate()))}traverseSceneGraph(visitor,waitForUpgrade=!1){ +if(visitor(this),!waitForUpgrade){for(let child of this.composedLumeChildren)child. +traverseSceneGraph(visitor,waitForUpgrade);return}let promise=Promise.resolve(); +for(let child of this.composedLumeChildren)child.matches(":defined")?promise=promise. +then(()=>child.traverseSceneGraph(visitor,waitForUpgrade)):promise=promise.then( +()=>customElements.whenDefined(child.tagName.toLowerCase())).then(()=>child.traverseSceneGraph( +visitor,waitForUpgrade));return promise}connectedCallback(){super.connectedCallback(), +this.createEffect(()=>{this._elementOperations.shouldRender=this.visible,this.three. +visible=this.visible,this.needsUpdate()})}static css=` + ${Reflect.get(_classSuper,"css",_classThis)} + + :host { + position: absolute; + top: 0; + left: 0; + } + `;static{__runInitializers5(_classThis,_classExtraInitializers)}};return Element3D2= +_classThis})();Element3D.prototype.isElement3D=!0;var RenderableBehavior=class extends Effectful(Behavior){static{__name(this,"Ren\ +derableBehavior")}requiredElementType(){return[Element3D]}connectedCallback(){super. +connectedCallback(),this.element.needsUpdate()}disconnectedCallback(){super.disconnectedCallback(), +this.element.needsUpdate()}};var Box3=class{static{__name(this,"Box3")}constructor(min=new Vector3(1/0,1/0,1/0),max2=new Vector3( +-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=min,this.max=max2}set(min,max2){return this. +min.copy(min),this.max.copy(max2),this}setFromArray(array){this.makeEmpty();for(let i2=0, +il=array.length;i2this.max.x||point.ythis.max.y||point. +zthis.max.z)}containsBox(box){return this.min.x<=box.min.x&& +box.max.x<=this.max.x&&this.min.y<=box.min.y&&box.max.y<=this.max.y&&this.min.z<= +box.min.z&&box.max.z<=this.max.z}getParameter(point,target){return target.set((point. +x-this.min.x)/(this.max.x-this.min.x),(point.y-this.min.y)/(this.max.y-this.min. +y),(point.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(box){return!(box. +max.xthis.max.x||box.max.ythis.max. +y||box.max.zthis.max.z)}intersectsSphere(sphere){return this. +clampPoint(sphere.center,_vector2),_vector2.distanceToSquared(sphere.center)<=sphere. +radius*sphere.radius}intersectsPlane(plane){let min,max2;return plane.normal.x>0? +(min=plane.normal.x*this.min.x,max2=plane.normal.x*this.max.x):(min=plane.normal. +x*this.max.x,max2=plane.normal.x*this.min.x),plane.normal.y>0?(min+=plane.normal. +y*this.min.y,max2+=plane.normal.y*this.max.y):(min+=plane.normal.y*this.max.y,max2+= +plane.normal.y*this.min.y),plane.normal.z>0?(min+=plane.normal.z*this.min.z,max2+= +plane.normal.z*this.max.z):(min+=plane.normal.z*this.max.z,max2+=plane.normal.z* +this.min.z),min<=-plane.constant&&max2>=-plane.constant}intersectsTriangle(triangle){ +if(this.isEmpty())return!1;this.getCenter(_center),_extents.subVectors(this.max, +_center),_v0.subVectors(triangle.a,_center),_v13.subVectors(triangle.b,_center), +_v2.subVectors(triangle.c,_center),_f0.subVectors(_v13,_v0),_f1.subVectors(_v2,_v13), +_f2.subVectors(_v0,_v2);let axes=[0,-_f0.z,_f0.y,0,-_f1.z,_f1.y,0,-_f2.z,_f2.y,_f0. +z,0,-_f0.x,_f1.z,0,-_f1.x,_f2.z,0,-_f2.x,-_f0.y,_f0.x,0,-_f1.y,_f1.x,0,-_f2.y,_f2. +x,0];return!satForAxes(axes,_v0,_v13,_v2,_extents)||(axes=[1,0,0,0,1,0,0,0,1],!satForAxes( +axes,_v0,_v13,_v2,_extents))?!1:(_triangleNormal.crossVectors(_f0,_f1),axes=[_triangleNormal. +x,_triangleNormal.y,_triangleNormal.z],satForAxes(axes,_v0,_v13,_v2,_extents))}clampPoint(point,target){ +return target.copy(point).clamp(this.min,this.max)}distanceToPoint(point){return this. +clampPoint(point,_vector2).distanceTo(point)}getBoundingSphere(target){return this. +isEmpty()?target.makeEmpty():(this.getCenter(target.center),target.radius=this.getSize( +_vector2).length()*.5),target}intersect(box){return this.min.max(box.min),this.max. +min(box.max),this.isEmpty()&&this.makeEmpty(),this}union(box){return this.min.min( +box.min),this.max.max(box.max),this}applyMatrix4(matrix){return this.isEmpty()?this: +(_points[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(matrix),_points[1]. +set(this.min.x,this.min.y,this.max.z).applyMatrix4(matrix),_points[2].set(this.min. +x,this.max.y,this.min.z).applyMatrix4(matrix),_points[3].set(this.min.x,this.max. +y,this.max.z).applyMatrix4(matrix),_points[4].set(this.max.x,this.min.y,this.min. +z).applyMatrix4(matrix),_points[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4( +matrix),_points[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(matrix),_points[7]. +set(this.max.x,this.max.y,this.max.z).applyMatrix4(matrix),this.setFromPoints(_points), +this)}translate(offset){return this.min.add(offset),this.max.add(offset),this}equals(box){ +return box.min.equals(this.min)&&box.max.equals(this.max)}},_points=[new Vector3, +new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3], +_vector2=new Vector3,_box=new Box3,_v0=new Vector3,_v13=new Vector3,_v2=new Vector3, +_f0=new Vector3,_f1=new Vector3,_f2=new Vector3,_center=new Vector3,_extents=new Vector3, +_triangleNormal=new Vector3,_testAxis=new Vector3;function satForAxes(axes,v0,v1,v2,extents){ +for(let i2=0,j2=axes.length-3;i2<=j2;i2+=3){_testAxis.fromArray(axes,i2);let r3=extents. +x*Math.abs(_testAxis.x)+extents.y*Math.abs(_testAxis.y)+extents.z*Math.abs(_testAxis. +z),p0=v0.dot(_testAxis),p1=v1.dot(_testAxis),p2=v2.dot(_testAxis);if(Math.max(-Math. +max(p0,p1,p2),Math.min(p0,p1,p2))>r3)return!1}return!0}__name(satForAxes,"satFor\ +Axes");var _box2=new Box3,_v14=new Vector3,_v22=new Vector3,Sphere=class{static{__name( +this,"Sphere")}constructor(center=new Vector3,radius=-1){this.isSphere=!0,this.center= +center,this.radius=radius}set(center,radius){return this.center.copy(center),this. +radius=radius,this}setFromPoints(points,optionalCenter){let center=this.center;optionalCenter!== +void 0?center.copy(optionalCenter):_box2.setFromPoints(points).getCenter(center); +let maxRadiusSq=0;for(let i2=0,il=points.length;i2this.radius*this. +radius&&(target.sub(this.center).normalize(),target.multiplyScalar(this.radius). +add(this.center)),target}getBoundingBox(target){return this.isEmpty()?(target.makeEmpty(), +target):(target.set(this.center,this.center),target.expandByScalar(this.radius), +target)}applyMatrix4(matrix){return this.center.applyMatrix4(matrix),this.radius= +this.radius*matrix.getMaxScaleOnAxis(),this}translate(offset){return this.center. +add(offset),this}expandByPoint(point){if(this.isEmpty())return this.center.copy( +point),this.radius=0,this;_v14.subVectors(point,this.center);let lengthSq=_v14.lengthSq(); +if(lengthSq>this.radius*this.radius){let length=Math.sqrt(lengthSq),delta=(length- +this.radius)*.5;this.center.addScaledVector(_v14,delta/length),this.radius+=delta} +return this}union(sphere){return sphere.isEmpty()?this:this.isEmpty()?(this.copy( +sphere),this):(this.center.equals(sphere.center)===!0?this.radius=Math.max(this. +radius,sphere.radius):(_v22.subVectors(sphere.center,this.center).setLength(sphere. +radius),this.expandByPoint(_v14.copy(sphere.center).add(_v22)),this.expandByPoint( +_v14.copy(sphere.center).sub(_v22))),this)}equals(sphere){return sphere.center.equals( +this.center)&&sphere.radius===this.radius}clone(){return new this.constructor(). +copy(this)}};var _vector3=new Vector3,_segCenter=new Vector3,_segDir=new Vector3,_diff=new Vector3, +_edge1=new Vector3,_edge2=new Vector3,_normal=new Vector3,Ray=class{static{__name( +this,"Ray")}constructor(origin2=new Vector3,direction=new Vector3(0,0,-1)){this. +origin=origin2,this.direction=direction}set(origin2,direction){return this.origin. +copy(origin2),this.direction.copy(direction),this}copy(ray){return this.origin.copy( +ray.origin),this.direction.copy(ray.direction),this}at(t,target){return target.copy( +this.origin).addScaledVector(this.direction,t)}lookAt(v){return this.direction.copy( +v).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t, +_vector3)),this}closestPointToPoint(point,target){target.subVectors(point,this.origin); +let directionDistance=target.dot(this.direction);return directionDistance<0?target. +copy(this.origin):target.copy(this.origin).addScaledVector(this.direction,directionDistance)}distanceToPoint(point){ +return Math.sqrt(this.distanceSqToPoint(point))}distanceSqToPoint(point){let directionDistance=_vector3. +subVectors(point,this.origin).dot(this.direction);return directionDistance<0?this. +origin.distanceToSquared(point):(_vector3.copy(this.origin).addScaledVector(this. +direction,directionDistance),_vector3.distanceToSquared(point))}distanceSqToSegment(v0,v1,optionalPointOnRay,optionalPointOnSegment){ +_segCenter.copy(v0).add(v1).multiplyScalar(.5),_segDir.copy(v1).sub(v0).normalize(), +_diff.copy(this.origin).sub(_segCenter);let segExtent=v0.distanceTo(v1)*.5,a01=-this. +direction.dot(_segDir),b0=_diff.dot(this.direction),b1=-_diff.dot(_segDir),c3=_diff. +lengthSq(),det=Math.abs(1-a01*a01),s0,s1,sqrDist,extDet;if(det>0)if(s0=a01*b1-b0, +s1=a01*b0-b1,extDet=segExtent*det,s0>=0)if(s1>=-extDet)if(s1<=extDet){let invDet=1/ +det;s0*=invDet,s1*=invDet,sqrDist=s0*(s0+a01*s1+2*b0)+s1*(a01*s0+s1+2*b1)+c3}else +s1=segExtent,s0=Math.max(0,-(a01*s1+b0)),sqrDist=-s0*s0+s1*(s1+2*b1)+c3;else s1= +-segExtent,s0=Math.max(0,-(a01*s1+b0)),sqrDist=-s0*s0+s1*(s1+2*b1)+c3;else s1<=-extDet? +(s0=Math.max(0,-(-a01*segExtent+b0)),s1=s0>0?-segExtent:Math.min(Math.max(-segExtent, +-b1),segExtent),sqrDist=-s0*s0+s1*(s1+2*b1)+c3):s1<=extDet?(s0=0,s1=Math.min(Math. +max(-segExtent,-b1),segExtent),sqrDist=s1*(s1+2*b1)+c3):(s0=Math.max(0,-(a01*segExtent+ +b0)),s1=s0>0?segExtent:Math.min(Math.max(-segExtent,-b1),segExtent),sqrDist=-s0* +s0+s1*(s1+2*b1)+c3);else s1=a01>0?-segExtent:segExtent,s0=Math.max(0,-(a01*s1+b0)), +sqrDist=-s0*s0+s1*(s1+2*b1)+c3;return optionalPointOnRay&&optionalPointOnRay.copy( +this.origin).addScaledVector(this.direction,s0),optionalPointOnSegment&&optionalPointOnSegment. +copy(_segCenter).addScaledVector(_segDir,s1),sqrDist}intersectSphere(sphere,target){ +_vector3.subVectors(sphere.center,this.origin);let tca=_vector3.dot(this.direction), +d2=_vector3.dot(_vector3)-tca*tca,radius2=sphere.radius*sphere.radius;if(d2>radius2) +return null;let thc=Math.sqrt(radius2-d2),t0=tca-thc,t1=tca+thc;return t1<0?null: +t0<0?this.at(t1,target):this.at(t0,target)}intersectsSphere(sphere){return this. +distanceSqToPoint(sphere.center)<=sphere.radius*sphere.radius}distanceToPlane(plane){ +let denominator=plane.normal.dot(this.direction);if(denominator===0)return plane. +distanceToPoint(this.origin)===0?0:null;let t=-(this.origin.dot(plane.normal)+plane. +constant)/denominator;return t>=0?t:null}intersectPlane(plane,target){let t=this. +distanceToPlane(plane);return t===null?null:this.at(t,target)}intersectsPlane(plane){ +let distToPoint=plane.distanceToPoint(this.origin);return distToPoint===0||plane. +normal.dot(this.direction)*distToPoint<0}intersectBox(box,target){let tmin,tmax, +tymin,tymax,tzmin,tzmax,invdirx=1/this.direction.x,invdiry=1/this.direction.y,invdirz=1/ +this.direction.z,origin2=this.origin;return invdirx>=0?(tmin=(box.min.x-origin2. +x)*invdirx,tmax=(box.max.x-origin2.x)*invdirx):(tmin=(box.max.x-origin2.x)*invdirx, +tmax=(box.min.x-origin2.x)*invdirx),invdiry>=0?(tymin=(box.min.y-origin2.y)*invdiry, +tymax=(box.max.y-origin2.y)*invdiry):(tymin=(box.max.y-origin2.y)*invdiry,tymax= +(box.min.y-origin2.y)*invdiry),tmin>tymax||tymin>tmax||((tymin>tmin||isNaN(tmin))&& +(tmin=tymin),(tymax=0?(tzmin=(box.min. +z-origin2.z)*invdirz,tzmax=(box.max.z-origin2.z)*invdirz):(tzmin=(box.max.z-origin2. +z)*invdirz,tzmax=(box.min.z-origin2.z)*invdirz),tmin>tzmax||tzmin>tmax)||((tzmin> +tmin||tmin!==tmin)&&(tmin=tzmin),(tzmax=0?tmin:tmax,target)}intersectsBox(box){return this.intersectBox( +box,_vector3)!==null}intersectTriangle(a,b,c3,backfaceCulling,target){_edge1.subVectors( +b,a),_edge2.subVectors(c3,a),_normal.crossVectors(_edge1,_edge2);let DdN=this.direction. +dot(_normal),sign3;if(DdN>0){if(backfaceCulling)return null;sign3=1}else if(DdN< +0)sign3=-1,DdN=-DdN;else return null;_diff.subVectors(this.origin,a);let DdQxE2=sign3* +this.direction.dot(_edge2.crossVectors(_diff,_edge2));if(DdQxE2<0)return null;let DdE1xQ=sign3* +this.direction.dot(_edge1.cross(_diff));if(DdE1xQ<0||DdQxE2+DdE1xQ>DdN)return null; +let QdN=-sign3*_diff.dot(_normal);return QdN<0?null:this.at(QdN/DdN,target)}applyMatrix4(matrix4){ +return this.origin.applyMatrix4(matrix4),this.direction.transformDirection(matrix4), +this}equals(ray){return ray.origin.equals(this.origin)&&ray.direction.equals(this. +direction)}clone(){return new this.constructor().copy(this)}};var _v02=new Vector3,_v15=new Vector3,_v23=new Vector3,_v3=new Vector3,_vab=new Vector3, +_vac=new Vector3,_vbc=new Vector3,_vap=new Vector3,_vbp=new Vector3,_vcp=new Vector3, +warnedGetUV=!1,Triangle=class _Triangle{static{__name(this,"Triangle")}constructor(a=new Vector3,b=new Vector3,c3=new Vector3){ +this.a=a,this.b=b,this.c=c3}static getNormal(a,b,c3,target){target.subVectors(c3, +b),_v02.subVectors(a,b),target.cross(_v02);let targetLengthSq=target.lengthSq(); +return targetLengthSq>0?target.multiplyScalar(1/Math.sqrt(targetLengthSq)):target. +set(0,0,0)}static getBarycoord(point,a,b,c3,target){_v02.subVectors(c3,a),_v15.subVectors( +b,a),_v23.subVectors(point,a);let dot00=_v02.dot(_v02),dot01=_v02.dot(_v15),dot02=_v02. +dot(_v23),dot11=_v15.dot(_v15),dot12=_v15.dot(_v23),denom=dot00*dot11-dot01*dot01; +if(denom===0)return target.set(0,0,0),null;let invDenom=1/denom,u2=(dot11*dot02- +dot01*dot12)*invDenom,v=(dot00*dot12-dot01*dot02)*invDenom;return target.set(1-u2- +v,v,u2)}static containsPoint(point,a,b,c3){return this.getBarycoord(point,a,b,c3, +_v3)===null?!1:_v3.x>=0&&_v3.y>=0&&_v3.x+_v3.y<=1}static getUV(point,p1,p2,p3,uv1,uv2,uv3,target){ +return warnedGetUV===!1&&(console.warn("THREE.Triangle.getUV() has been renamed \ +to THREE.Triangle.getInterpolation()."),warnedGetUV=!0),this.getInterpolation(point, +p1,p2,p3,uv1,uv2,uv3,target)}static getInterpolation(point,p1,p2,p3,v1,v2,v3,target){ +return this.getBarycoord(point,p1,p2,p3,_v3)===null?(target.x=0,target.y=0,"z"in +target&&(target.z=0),"w"in target&&(target.w=0),null):(target.setScalar(0),target. +addScaledVector(v1,_v3.x),target.addScaledVector(v2,_v3.y),target.addScaledVector( +v3,_v3.z),target)}static isFrontFacing(a,b,c3,direction){return _v02.subVectors( +c3,b),_v15.subVectors(a,b),_v02.cross(_v15).dot(direction)<0}set(a,b,c3){return this. +a.copy(a),this.b.copy(b),this.c.copy(c3),this}setFromPointsAndIndices(points,i0,i1,i2){ +return this.a.copy(points[i0]),this.b.copy(points[i1]),this.c.copy(points[i2]),this}setFromAttributeAndIndices(attribute2,i0,i1,i2){ +return this.a.fromBufferAttribute(attribute2,i0),this.b.fromBufferAttribute(attribute2, +i1),this.c.fromBufferAttribute(attribute2,i2),this}clone(){return new this.constructor(). +copy(this)}copy(triangle){return this.a.copy(triangle.a),this.b.copy(triangle.b), +this.c.copy(triangle.c),this}getArea(){return _v02.subVectors(this.c,this.b),_v15. +subVectors(this.a,this.b),_v02.cross(_v15).length()*.5}getMidpoint(target){return target. +addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(target){return _Triangle. +getNormal(this.a,this.b,this.c,target)}getPlane(target){return target.setFromCoplanarPoints( +this.a,this.b,this.c)}getBarycoord(point,target){return _Triangle.getBarycoord(point, +this.a,this.b,this.c,target)}getUV(point,uv1,uv2,uv3,target){return warnedGetUV=== +!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.get\ +Interpolation()."),warnedGetUV=!0),_Triangle.getInterpolation(point,this.a,this. +b,this.c,uv1,uv2,uv3,target)}getInterpolation(point,v1,v2,v3,target){return _Triangle. +getInterpolation(point,this.a,this.b,this.c,v1,v2,v3,target)}containsPoint(point){ +return _Triangle.containsPoint(point,this.a,this.b,this.c)}isFrontFacing(direction){ +return _Triangle.isFrontFacing(this.a,this.b,this.c,direction)}intersectsBox(box){ +return box.intersectsTriangle(this)}closestPointToPoint(p2,target){let a=this.a, +b=this.b,c3=this.c,v,w2;_vab.subVectors(b,a),_vac.subVectors(c3,a),_vap.subVectors( +p2,a);let d1=_vab.dot(_vap),d2=_vac.dot(_vap);if(d1<=0&&d2<=0)return target.copy( +a);_vbp.subVectors(p2,b);let d3=_vab.dot(_vbp),d4=_vac.dot(_vbp);if(d3>=0&&d4<=d3) +return target.copy(b);let vc=d1*d4-d3*d2;if(vc<=0&&d1>=0&&d3<=0)return v=d1/(d1- +d3),target.copy(a).addScaledVector(_vab,v);_vcp.subVectors(p2,c3);let d5=_vab.dot( +_vcp),d6=_vac.dot(_vcp);if(d6>=0&&d5<=d6)return target.copy(c3);let vb=d5*d2-d1* +d6;if(vb<=0&&d2>=0&&d6<=0)return w2=d2/(d2-d6),target.copy(a).addScaledVector(_vac, +w2);let va=d3*d6-d5*d4;if(va<=0&&d4-d3>=0&&d5-d6>=0)return _vbc.subVectors(c3,b), +w2=(d4-d3)/(d4-d3+(d5-d6)),target.copy(b).addScaledVector(_vbc,w2);let denom=1/(va+ +vb+vc);return v=vb*denom,w2=vc*denom,target.copy(a).addScaledVector(_vab,v).addScaledVector( +_vac,w2)}equals(triangle){return triangle.a.equals(this.a)&&triangle.b.equals(this. +b)&&triangle.c.equals(this.c)}};var MeshBasicMaterial=class extends Material{static{__name(this,"MeshBasicMateri\ +al")}constructor(parameters){super(),this.isMeshBasicMaterial=!0,this.type="Mesh\ +BasicMaterial",this.color=new Color(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.combine=MultiplyOperation,this.reflectivity= +1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap= +"round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(parameters)}copy(source){ +return super.copy(source),this.color.copy(source.color),this.map=source.map,this. +lightMap=source.lightMap,this.lightMapIntensity=source.lightMapIntensity,this.aoMap= +source.aoMap,this.aoMapIntensity=source.aoMapIntensity,this.specularMap=source.specularMap, +this.alphaMap=source.alphaMap,this.envMap=source.envMap,this.combine=source.combine, +this.reflectivity=source.reflectivity,this.refractionRatio=source.refractionRatio, +this.wireframe=source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth, +this.wireframeLinecap=source.wireframeLinecap,this.wireframeLinejoin=source.wireframeLinejoin, +this.fog=source.fog,this}};var _vector4=new Vector3,_vector22=new Vector2,BufferAttribute=class{static{__name( +this,"BufferAttribute")}constructor(array,itemSize,normalized=!1){if(Array.isArray( +array))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array\ +.");this.isBufferAttribute=!0,this.name="",this.array=array,this.itemSize=itemSize, +this.count=array!==void 0?array.length/itemSize:0,this.normalized=normalized,this. +usage=StaticDrawUsage,this._updateRange={offset:0,count:-1},this.updateRanges=[], +this.gpuType=FloatType,this.version=0}onUploadCallback(){}set needsUpdate(value){ +value===!0&&this.version++}get updateRange(){return console.warn("THREE.BufferAt\ +tribute: updateRange() is deprecated and will be removed in r169. Use addUpdateR\ +ange() instead."),this._updateRange}setUsage(value){return this.usage=value,this}addUpdateRange(start,count){ +this.updateRanges.push({start,count})}clearUpdateRanges(){this.updateRanges.length= +0}copy(source){return this.name=source.name,this.array=new source.array.constructor( +source.array),this.itemSize=source.itemSize,this.count=source.count,this.normalized= +source.normalized,this.usage=source.usage,this.gpuType=source.gpuType,this}copyAt(index1,attribute2,index2){ +index1*=this.itemSize,index2*=attribute2.itemSize;for(let i2=0,l=this.itemSize;i2< +l;i2++)this.array[index1+i2]=attribute2.array[index2+i2];return this}copyArray(array){ +return this.array.set(array),this}applyMatrix3(m){if(this.itemSize===2)for(let i2=0, +l=this.count;i2=0;--i2)if(array[i2]>= +65535)return!0;return!1}__name(arrayNeedsUint32,"arrayNeedsUint32");function createElementNS(name2){return document.createElementNS("http://www.w3.o\ +rg/1999/xhtml",name2)}__name(createElementNS,"createElementNS");function createCanvasElement(){ +let canvas=createElementNS("canvas");return canvas.style.display="block",canvas} +__name(createCanvasElement,"createCanvasElement");var _cache={};function warnOnce(message){ +message in _cache||(_cache[message]=!0,console.warn(message))}__name(warnOnce,"w\ +arnOnce");var _id=0,_m13=new Matrix4,_obj=new Object3D,_offset=new Vector3,_box3=new Box3, +_boxMorphTargets=new Box3,_vector5=new Vector3,BufferGeometry=class _BufferGeometry extends EventDispatcher{static{ +__name(this,"BufferGeometry")}constructor(){super(),this.isBufferGeometry=!0,Object. +defineProperty(this,"id",{value:_id++}),this.uuid=generateUUID(),this.name="",this. +type="BufferGeometry",this.index=null,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(index){return Array.isArray(index)?this.index=new(arrayNeedsUint32( +index)?Uint32BufferAttribute:Uint16BufferAttribute)(index,1):this.index=index,this}getAttribute(name2){ +return this.attributes[name2]}setAttribute(name2,attribute2){return this.attributes[name2]= +attribute2,this}deleteAttribute(name2){return delete this.attributes[name2],this}hasAttribute(name2){ +return this.attributes[name2]!==void 0}addGroup(start,count,materialIndex=0){this. +groups.push({start,count,materialIndex})}clearGroups(){this.groups=[]}setDrawRange(start,count){ +this.drawRange.start=start,this.drawRange.count=count}applyMatrix4(matrix){let position2=this. +attributes.position;position2!==void 0&&(position2.applyMatrix4(matrix),position2. +needsUpdate=!0);let normal=this.attributes.normal;if(normal!==void 0){let normalMatrix=new Matrix3(). +getNormalMatrix(matrix);normal.applyNormalMatrix(normalMatrix),normal.needsUpdate= +!0}let tangent=this.attributes.tangent;return tangent!==void 0&&(tangent.transformDirection( +matrix),tangent.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(), +this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(q2){ +return _m13.makeRotationFromQuaternion(q2),this.applyMatrix4(_m13),this}rotateX(angle){ +return _m13.makeRotationX(angle),this.applyMatrix4(_m13),this}rotateY(angle){return _m13. +makeRotationY(angle),this.applyMatrix4(_m13),this}rotateZ(angle){return _m13.makeRotationZ( +angle),this.applyMatrix4(_m13),this}translate(x2,y2,z2){return _m13.makeTranslation( +x2,y2,z2),this.applyMatrix4(_m13),this}scale(x2,y2,z2){return _m13.makeScale(x2, +y2,z2),this.applyMatrix4(_m13),this}lookAt(vector){return _obj.lookAt(vector),_obj. +updateMatrix(),this.applyMatrix4(_obj.matrix),this}center(){return this.computeBoundingBox(), +this.boundingBox.getCenter(_offset).negate(),this.translate(_offset.x,_offset.y, +_offset.z),this}setFromPoints(points){let position2=[];for(let i2=0,l=points.length;i2< +l;i2++){let point=points[i2];position2.push(point.x,point.y,point.z||0)}return this. +setAttribute("position",new Float32BufferAttribute(position2,3)),this}computeBoundingBox(){ +this.boundingBox===null&&(this.boundingBox=new Box3);let position2=this.attributes. +position,morphAttributesPosition=this.morphAttributes.position;if(position2&&position2. +isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): G\ +LBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustum\ +Culled" to "false".',this),this.boundingBox.set(new Vector3(-1/0,-1/0,-1/0),new Vector3( +1/0,1/0,1/0));return}if(position2!==void 0){if(this.boundingBox.setFromBufferAttribute( +position2),morphAttributesPosition)for(let i2=0,il=morphAttributesPosition.length;i2< +il;i2++){let morphAttribute=morphAttributesPosition[i2];_box3.setFromBufferAttribute( +morphAttribute),this.morphTargetsRelative?(_vector5.addVectors(this.boundingBox. +min,_box3.min),this.boundingBox.expandByPoint(_vector5),_vector5.addVectors(this. +boundingBox.max,_box3.max),this.boundingBox.expandByPoint(_vector5)):(this.boundingBox. +expandByPoint(_box3.min),this.boundingBox.expandByPoint(_box3.max))}}else this.boundingBox. +makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN( +this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox\ +(): Computed min/max have NaN values. The "position" attribute is likely to have\ + NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere= +new Sphere);let position2=this.attributes.position,morphAttributesPosition=this. +morphAttributes.position;if(position2&&position2.isGLBufferAttribute){console.error( +'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manu\ +al bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this. +boundingSphere.set(new Vector3,1/0);return}if(position2){let center=this.boundingSphere. +center;if(_box3.setFromBufferAttribute(position2),morphAttributesPosition)for(let i2=0, +il=morphAttributesPosition.length;i20&&(data.userData=this.userData),this.parameters!== +void 0){let parameters=this.parameters;for(let key2 in parameters)parameters[key2]!== +void 0&&(data[key2]=parameters[key2]);return data}data.data={attributes:{}};let index=this. +index;index!==null&&(data.data.index={type:index.array.constructor.name,array:Array. +prototype.slice.call(index.array)});let attributes=this.attributes;for(let key2 in attributes){ +let attribute2=attributes[key2];data.data.attributes[key2]=attribute2.toJSON(data. +data)}let morphAttributes={},hasMorphAttributes=!1;for(let key2 in this.morphAttributes){ +let attributeArray=this.morphAttributes[key2],array=[];for(let i2=0,il=attributeArray. +length;i20&&(morphAttributes[key2]=array,hasMorphAttributes=!0)} +hasMorphAttributes&&(data.data.morphAttributes=morphAttributes,data.data.morphTargetsRelative= +this.morphTargetsRelative);let groups=this.groups;groups.length>0&&(data.data.groups= +JSON.parse(JSON.stringify(groups)));let boundingSphere=this.boundingSphere;return boundingSphere!== +null&&(data.data.boundingSphere={center:boundingSphere.center.toArray(),radius:boundingSphere. +radius}),data}clone(){return new this.constructor().copy(this)}copy(source){this. +index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox= +null,this.boundingSphere=null;let data={};this.name=source.name;let index=source. +index;index!==null&&this.setIndex(index.clone(data));let attributes=source.attributes; +for(let name2 in attributes){let attribute2=attributes[name2];this.setAttribute( +name2,attribute2.clone(data))}let morphAttributes=source.morphAttributes;for(let name2 in morphAttributes){ +let array=[],morphAttribute=morphAttributes[name2];for(let i2=0,l=morphAttribute. +length;i20){let morphAttribute=morphAttributes[keys[0]];if(morphAttribute!== +void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let m=0, +ml=morphAttribute.length;m(raycaster. +far-raycaster.near)**2))&&(_inverseMatrix.copy(matrixWorld).invert(),_ray.copy(raycaster. +ray).applyMatrix4(_inverseMatrix),!(geometry.boundingBox!==null&&_ray.intersectsBox( +geometry.boundingBox)===!1)&&this._computeIntersections(raycaster,intersects3,_ray)))}_computeIntersections(raycaster,intersects3,rayLocalSpace){ +let intersection,geometry=this.geometry,material=this.material,index=geometry.index, +position2=geometry.attributes.position,uv=geometry.attributes.uv,uv1=geometry.attributes. +uv1,normal=geometry.attributes.normal,groups=geometry.groups,drawRange=geometry. +drawRange;if(index!==null)if(Array.isArray(material))for(let i2=0,il=groups.length;i2< +il;i2++){let group=groups[i2],groupMaterial=material[group.materialIndex],start=Math. +max(group.start,drawRange.start),end=Math.min(index.count,Math.min(group.start+group. +count,drawRange.start+drawRange.count));for(let j2=start,jl=end;j2raycaster.far?null:{distance,point:_intersectionPointWorld. +clone(),object}}__name(checkIntersection,"checkIntersection");function checkGeometryIntersection(object,material,raycaster,ray,uv,uv1,normal,a,b,c3){ +object.getVertexPosition(a,_vA),object.getVertexPosition(b,_vB),object.getVertexPosition( +c3,_vC);let intersection=checkIntersection(object,material,raycaster,ray,_vA,_vB, +_vC,_intersectionPoint);if(intersection){uv&&(_uvA.fromBufferAttribute(uv,a),_uvB. +fromBufferAttribute(uv,b),_uvC.fromBufferAttribute(uv,c3),intersection.uv=Triangle. +getInterpolation(_intersectionPoint,_vA,_vB,_vC,_uvA,_uvB,_uvC,new Vector2)),uv1&& +(_uvA.fromBufferAttribute(uv1,a),_uvB.fromBufferAttribute(uv1,b),_uvC.fromBufferAttribute( +uv1,c3),intersection.uv1=Triangle.getInterpolation(_intersectionPoint,_vA,_vB,_vC, +_uvA,_uvB,_uvC,new Vector2),intersection.uv2=intersection.uv1),normal&&(_normalA. +fromBufferAttribute(normal,a),_normalB.fromBufferAttribute(normal,b),_normalC.fromBufferAttribute( +normal,c3),intersection.normal=Triangle.getInterpolation(_intersectionPoint,_vA, +_vB,_vC,_normalA,_normalB,_normalC,new Vector3),intersection.normal.dot(ray.direction)> +0&&intersection.normal.multiplyScalar(-1));let face={a,b,c:c3,normal:new Vector3, +materialIndex:0};Triangle.getNormal(_vA,_vB,_vC,face.normal),intersection.face=face} +return intersection}__name(checkGeometryIntersection,"checkGeometryIntersection");var __esDecorate6=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers6=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-mesh",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D,_instanceExtraInitializers=[], +_castShadow_decorators,_castShadow_initializers=[],_receiveShadow_decorators,_receiveShadow_initializers=[]; +var Mesh4=class extends _classSuper{static{__name(this,"Mesh")}static{_classThis= +this}static{let _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create( +_classSuper[Symbol.metadata]??null):void 0;_castShadow_decorators=[booleanAttribute], +_receiveShadow_decorators=[booleanAttribute],__esDecorate6(null,null,_castShadow_decorators, +{kind:"field",name:"castShadow",static:!1,private:!1,access:{has:obj=>"castShado\ +w"in obj,get:obj=>obj.castShadow,set:(obj,value)=>{obj.castShadow=value}},metadata:_metadata}, +_castShadow_initializers,_instanceExtraInitializers),__esDecorate6(null,null,_receiveShadow_decorators, +{kind:"field",name:"receiveShadow",static:!1,private:!1,access:{has:obj=>"receiv\ +eShadow"in obj,get:obj=>obj.receiveShadow,set:(obj,value)=>{obj.receiveShadow=value}}, +metadata:_metadata},_receiveShadow_initializers,_instanceExtraInitializers),__esDecorate6( +null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis. +name,metadata:_metadata},null,_classExtraInitializers),Mesh4=_classThis=_classDescriptor. +value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0, +configurable:!0,writable:!0,value:_metadata}),__runInitializers6(_classThis,_classExtraInitializers)}castShadow=(__runInitializers6( +this,_instanceExtraInitializers),__runInitializers6(this,_castShadow_initializers, +!0));receiveShadow=__runInitializers6(this,_receiveShadow_initializers,!0);connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{this.three.castShadow=this.castShadow, +this.needsUpdate()}),this.createEffect(()=>{this.three.receiveShadow=this.receiveShadow, +this.three.material.needsUpdate=!0,this.needsUpdate()})}makeThreeObject3d(){return new Mesh}}; +return Mesh4=_classThis})();var PointsMaterial=class extends Material{static{__name(this,"PointsMaterial")}constructor(parameters){ +super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color( +16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this. +fog=!0,this.setValues(parameters)}copy(source){return super.copy(source),this.color. +copy(source.color),this.map=source.map,this.alphaMap=source.alphaMap,this.size=source. +size,this.sizeAttenuation=source.sizeAttenuation,this.fog=source.fog,this}};var _inverseMatrix2=new Matrix4,_ray2=new Ray,_sphere2=new Sphere,_position2=new Vector3, +Points=class extends Object3D{static{__name(this,"Points")}constructor(geometry=new BufferGeometry,material=new PointsMaterial){ +super(),this.isPoints=!0,this.type="Points",this.geometry=geometry,this.material= +material,this.updateMorphTargets()}copy(source,recursive){return super.copy(source, +recursive),this.material=Array.isArray(source.material)?source.material.slice(): +source.material,this.geometry=source.geometry,this}raycast(raycaster,intersects3){ +let geometry=this.geometry,matrixWorld=this.matrixWorld,threshold=raycaster.params. +Points.threshold,drawRange=geometry.drawRange;if(geometry.boundingSphere===null&& +geometry.computeBoundingSphere(),_sphere2.copy(geometry.boundingSphere),_sphere2. +applyMatrix4(matrixWorld),_sphere2.radius+=threshold,raycaster.ray.intersectsSphere( +_sphere2)===!1)return;_inverseMatrix2.copy(matrixWorld).invert(),_ray2.copy(raycaster. +ray).applyMatrix4(_inverseMatrix2);let localThreshold=threshold/((this.scale.x+this. +scale.y+this.scale.z)/3),localThresholdSq=localThreshold*localThreshold,index=geometry. +index,positionAttribute=geometry.attributes.position;if(index!==null){let start=Math. +max(0,drawRange.start),end=Math.min(index.count,drawRange.start+drawRange.count); +for(let i2=start,il=end;i20){let morphAttribute=morphAttributes[keys[0]]; +if(morphAttribute!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary= +{};for(let m=0,ml=morphAttribute.length;mraycaster.far)return;intersects3.push({distance, +distanceToRay:Math.sqrt(rayPointDistanceSq),point:intersectPoint,index,face:null, +object})}}__name(testPoint,"testPoint");var __esDecorate7=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers7=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-points",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D;var Points4=class extends _classSuper{static{ +__name(this,"Points")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate7(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"c\ +lass",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Points4= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers7( +_classThis,_classExtraInitializers)}initialBehaviors={geometry:"box",material:"p\ +oints"};makeThreeObject3d(){return new Points}};return Points4=_classThis})();var InstancedBufferAttribute=class extends BufferAttribute{static{__name(this,"I\ +nstancedBufferAttribute")}constructor(array,itemSize,normalized,meshPerAttribute=1){ +super(array,itemSize,normalized),this.isInstancedBufferAttribute=!0,this.meshPerAttribute= +meshPerAttribute}copy(source){return super.copy(source),this.meshPerAttribute=source. +meshPerAttribute,this}toJSON(){let data=super.toJSON();return data.meshPerAttribute= +this.meshPerAttribute,data.isInstancedBufferAttribute=!0,data}};var _instanceLocalMatrix=new Matrix4,_instanceWorldMatrix=new Matrix4,_instanceIntersects=[], +_box32=new Box3,_identity=new Matrix4,_mesh=new Mesh,_sphere3=new Sphere,InstancedMesh=class extends Mesh{static{ +__name(this,"InstancedMesh")}constructor(geometry,material,count){super(geometry, +material),this.isInstancedMesh=!0,this.instanceMatrix=new InstancedBufferAttribute( +new Float32Array(count*16),16),this.instanceColor=null,this.count=count,this.boundingBox= +null,this.boundingSphere=null;for(let i2=0;i20?1:-1,normals.push(vector.x,vector.y, +vector.z),uvs.push(ix/gridX),uvs.push(1-iy/gridY),vertexCounter+=1}}for(let iy=0;iy< +gridY;iy++)for(let ix=0;ixparseFloat(str)));for(let i2=0,l=v.length;i2{microtask=!1;let _tasks=[...tasks]; +tasks.clear();for(let task2 of _tasks)task2()}))}__name(queueMicrotaskOnceOnly,"\ +queueMicrotaskOnceOnly");var __esDecorate8=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers8=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{ +let _classDecorators=[element("lume-instanced-mesh",autoDefineElements)],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=Mesh2,_instanceExtraInitializers=[], +_count_decorators,_count_initializers=[],_get_rotations_decorators,_get_positions_decorators, +_get_scales_decorators,_get_colors_decorators;var InstancedMesh4=class extends _classSuper{static{ +__name(this,"InstancedMesh")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_count_decorators=[numberAttribute],_get_rotations_decorators=[stringAttribute], +_get_positions_decorators=[stringAttribute],_get_scales_decorators=[stringAttribute], +_get_colors_decorators=[stringAttribute],__esDecorate8(this,null,_get_rotations_decorators, +{kind:"getter",name:"rotations",static:!1,private:!1,access:{has:obj=>"rotations"in +obj,get:obj=>obj.rotations},metadata:_metadata},null,_instanceExtraInitializers), +__esDecorate8(this,null,_get_positions_decorators,{kind:"getter",name:"positions", +static:!1,private:!1,access:{has:obj=>"positions"in obj,get:obj=>obj.positions}, +metadata:_metadata},null,_instanceExtraInitializers),__esDecorate8(this,null,_get_scales_decorators, +{kind:"getter",name:"scales",static:!1,private:!1,access:{has:obj=>"scales"in obj, +get:obj=>obj.scales},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate8( +this,null,_get_colors_decorators,{kind:"getter",name:"colors",static:!1,private:!1, +access:{has:obj=>"colors"in obj,get:obj=>obj.colors},metadata:_metadata},null,_instanceExtraInitializers), +__esDecorate8(null,null,_count_decorators,{kind:"field",name:"count",static:!1,private:!1, +access:{has:obj=>"count"in obj,get:obj=>obj.count,set:(obj,value)=>{obj.count=value}}, +metadata:_metadata},_count_initializers,_instanceExtraInitializers),__esDecorate8( +null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis. +name,metadata:_metadata},null,_classExtraInitializers),InstancedMesh4=_classThis= +_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata, +{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers8( +_classThis,_classExtraInitializers)}count=(__runInitializers8(this,_instanceExtraInitializers), +__runInitializers8(this,_count_initializers,10));#biggestCount=this.count;get rotations(){ +return this.#rotations}set rotations(v){this.#rotations=stringToNumberArray(v,"r\ +otations")}#rotations=[];get positions(){return this.#positions}set positions(v){ +this.#positions=stringToNumberArray(v,"positions")}#positions=[];get scales(){return this.#scales}set scales(v){ +this.#scales=stringToNumberArray(v,"scales")}#scales=[];get colors(){return this.#colors}set colors(v){ +this.#colors=stringToNumberArray(v,"colors")}#colors=[];initialBehaviors={geometry:"\ +box",material:"physical"};makeThreeObject3d(){let geometryBehavior=null,materialBehavior=null; +for(let[name2,behavior2]of this.behaviors)name2.endsWith("-geometry")?geometryBehavior= +behavior2:name2.endsWith("-material")&&(materialBehavior=behavior2);let mesh=new InstancedMesh( +geometryBehavior?.meshComponent||new BoxGeometry,materialBehavior?.meshComponent|| +new MeshPhongMaterial,this.#biggestCount);mesh.instanceMatrix.setUsage(DynamicDrawUsage); +let original=mesh.setColorAt;return mesh.setColorAt=function(index,color){original. +call(mesh,index,color),mesh.instanceColor.setUsage(DynamicDrawUsage)},mesh}#allMatricesNeedUpdate=!1;#allColorsNeedUpdate=!1;#updateSingleInstanceOnly=!1;setInstancePosition(index,x2,y2,z2){ +let arrIndex=index*3;untrack(()=>{this.positions[arrIndex]=x2,this.positions[arrIndex+ +1]=y2,this.positions[arrIndex+2]=z2,this.#setMatrix(arrIndex),this.three.instanceMatrix. +needsUpdate=!0}),queueMicrotaskOnceOnly(this.#triggerPositions)}#triggerPositions=()=>{ +this.#updateSingleInstanceOnly=!0,this.positions=this.positions};setInstanceScale(index,x2,y2,z2){ +let arrIndex=index*3;untrack(()=>{this.scales[arrIndex]=x2,this.scales[arrIndex+ +1]=y2,this.scales[arrIndex+2]=z2,this.#setMatrix(arrIndex),this.three.instanceMatrix. +needsUpdate=!0}),queueMicrotaskOnceOnly(this.#triggerScales)}#triggerScales=()=>{ +this.#updateSingleInstanceOnly=!0,this.scales=this.scales};setInstanceRotation(index,x2,y2,z2){ +let arrIndex=index*3;untrack(()=>{this.rotations[arrIndex]=x2,this.rotations[arrIndex+ +1]=y2,this.rotations[arrIndex+2]=z2,this.#setMatrix(arrIndex),this.three.instanceMatrix. +needsUpdate=!0}),queueMicrotaskOnceOnly(this.#triggerRotations)}#triggerRotations=()=>{ +this.#updateSingleInstanceOnly=!0,this.rotations=this.rotations};setInstanceColor(index,r3,g,b){ +let arrIndex=index*3;untrack(()=>{this.colors[arrIndex]=r3,this.colors[arrIndex+ +1]=g,this.colors[arrIndex+2]=b}),this.#setColor(index,r3,g,b),this.three.instanceColor. +needsUpdate=!0,queueMicrotaskOnceOnly(this.#triggerColors)}#triggerColors=()=>{this.#updateSingleInstanceOnly= +!0,this.colors=this.colors};#setMatrix(index){_rot.set(this.rotations[index+0]?? +0,this.rotations[index+1]??0,this.rotations[index+2]??0),_quat.setFromEuler(_rot), +_pos.set(this.positions[index+0]??0,this.positions[index+1]??0,this.positions[index+ +2]??0),_scale2.set(this.scales[index+0]??1,this.scales[index+1]??1,this.scales[index+ +2]??1),this._calculateInstanceMatrix(_pos,_quat,_scale2,_pivot,_mat),this.three. +setMatrixAt(index/3,_mat)}#setColor(index,r3,g,b){_color2.setRGB(r3,g,b),this.three. +setColorAt(index,_color2)}updateAllMatrices(){for(let i2=0,l=this.count;i2{this.count>this.#biggestCount&& +(this.#biggestCount=this.count,this.recreateThree(),untrack(()=>{batch(()=>{this. +rotations=this.rotations,this.positions=this.positions,this.scales=this.scales,this. +colors=this.colors})})),untrack(()=>this.three.count=this.count),this.needsUpdate()}), +this.createEffect(()=>{this.rotations,this.#updateSingleInstanceOnly||(this.#allMatricesNeedUpdate= +!0),this.#updateSingleInstanceOnly=!1,this.needsUpdate()}),this.createEffect(()=>{ +this.positions,this.#updateSingleInstanceOnly||(this.#allMatricesNeedUpdate=!0), +this.#updateSingleInstanceOnly=!1,this.needsUpdate()}),this.createEffect(()=>{this. +scales,this.#updateSingleInstanceOnly||(this.#allMatricesNeedUpdate=!0),this.#updateSingleInstanceOnly= +!1,this.needsUpdate()}),this.createEffect(()=>{this.colors,this.#updateSingleInstanceOnly|| +(this.#allColorsNeedUpdate=!0),this.#updateSingleInstanceOnly=!1,this.needsUpdate()})}update(t,dt){ +super.update(t,dt),this.#allMatricesNeedUpdate&&(this.#allMatricesNeedUpdate=!1, +this.updateAllMatrices()),this.#allColorsNeedUpdate&&(this.#allColorsNeedUpdate= +!1,this.updateAllColors())}};return InstancedMesh4=_classThis})();var LineBasicMaterial=class extends Material{static{__name(this,"LineBasicMateri\ +al")}constructor(parameters){super(),this.isLineBasicMaterial=!0,this.type="Line\ +BasicMaterial",this.color=new Color(16777215),this.map=null,this.linewidth=1,this. +linecap="round",this.linejoin="round",this.fog=!0,this.setValues(parameters)}copy(source){ +return super.copy(source),this.color.copy(source.color),this.map=source.map,this. +linewidth=source.linewidth,this.linecap=source.linecap,this.linejoin=source.linejoin, +this.fog=source.fog,this}};var _start=new Vector3,_end=new Vector3,_inverseMatrix3=new Matrix4,_ray3=new Ray, +_sphere4=new Sphere,Line=class extends Object3D{static{__name(this,"Line")}constructor(geometry=new BufferGeometry,material=new LineBasicMaterial){ +super(),this.isLine=!0,this.type="Line",this.geometry=geometry,this.material=material, +this.updateMorphTargets()}copy(source,recursive){return super.copy(source,recursive), +this.material=Array.isArray(source.material)?source.material.slice():source.material, +this.geometry=source.geometry,this}computeLineDistances(){let geometry=this.geometry; +if(geometry.index===null){let positionAttribute=geometry.attributes.position,lineDistances=[ +0];for(let i2=1,l=positionAttribute.count;i2localThresholdSq)continue;interRay.applyMatrix4(this.matrixWorld); +let distance=raycaster.ray.origin.distanceTo(interRay);distanceraycaster.far||intersects3.push({distance,point:interSegment.clone().applyMatrix4( +this.matrixWorld),index:i2,face:null,faceIndex:null,object:this})}}else{let start=Math. +max(0,drawRange.start),end=Math.min(positionAttribute.count,drawRange.start+drawRange. +count);for(let i2=start,l=end-1;i2localThresholdSq)continue;interRay.applyMatrix4(this. +matrixWorld);let distance=raycaster.ray.origin.distanceTo(interRay);distanceraycaster.far||intersects3.push({distance,point:interSegment.clone(). +applyMatrix4(this.matrixWorld),index:i2,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){ +let morphAttributes=this.geometry.morphAttributes,keys=Object.keys(morphAttributes); +if(keys.length>0){let morphAttribute=morphAttributes[keys[0]];if(morphAttribute!== +void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let m=0, +ml=morphAttribute.length;m=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers9=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-line",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D;var Line4=class extends _classSuper{static{ +__name(this,"Line")}static{_classThis=this}static{let _metadata=typeof Symbol=="\ +function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate9(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"c\ +lass",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Line4= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers9( +_classThis,_classExtraInitializers)}initialBehaviors={geometry:"line",material:"\ +line"};makeThreeObject3d(){return new Line}};return Line4=_classThis})();var __esDecorate10=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers10=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=RenderableBehavior,_instanceExtraInitializers=[], +_meshComponent_decorators,_meshComponent_initializers=[];var MeshBehavior2=class extends _classSuper{static{ +__name(this,"MeshBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_meshComponent_decorators=[signal],__esDecorate10(null,null,_meshComponent_decorators, +{kind:"field",name:"meshComponent",static:!1,private:!1,access:{has:obj=>"meshCo\ +mponent"in obj,get:obj=>obj.meshComponent,set:(obj,value)=>{obj.meshComponent=value}}, +metadata:_metadata},_meshComponent_initializers,_instanceExtraInitializers),__esDecorate10( +null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis. +name,metadata:_metadata},null,_classExtraInitializers),MeshBehavior2=_classThis= +_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata, +{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers10( +_classThis,_classExtraInitializers)}requiredElementType(){return[Mesh2,Points2,InstancedMesh2, +Line2]}_createComponent(){throw new Error("`_createComponent()` is not implement\ +ed by subclass.")}meshComponent=(__runInitializers10(this,_instanceExtraInitializers), +__runInitializers10(this,_meshComponent_initializers,null))};return MeshBehavior2= +_classThis})();var _vector1=new Vector3,_vector23=new Vector3,_normalMatrix=new Matrix3,Plane=class{static{ +__name(this,"Plane")}constructor(normal=new Vector3(1,0,0),constant=0){this.isPlane= +!0,this.normal=normal,this.constant=constant}set(normal,constant){return this.normal. +copy(normal),this.constant=constant,this}setComponents(x2,y2,z2,w2){return this. +normal.set(x2,y2,z2),this.constant=w2,this}setFromNormalAndCoplanarPoint(normal,point){ +return this.normal.copy(normal),this.constant=-point.dot(this.normal),this}setFromCoplanarPoints(a,b,c3){ +let normal=_vector1.subVectors(c3,b).cross(_vector23.subVectors(a,b)).normalize(); +return this.setFromNormalAndCoplanarPoint(normal,a),this}copy(plane){return this. +normal.copy(plane.normal),this.constant=plane.constant,this}normalize(){let inverseNormalLength=1/ +this.normal.length();return this.normal.multiplyScalar(inverseNormalLength),this. +constant*=inverseNormalLength,this}negate(){return this.constant*=-1,this.normal. +negate(),this}distanceToPoint(point){return this.normal.dot(point)+this.constant}distanceToSphere(sphere){ +return this.distanceToPoint(sphere.center)-sphere.radius}projectPoint(point,target){ +return target.copy(point).addScaledVector(this.normal,-this.distanceToPoint(point))}intersectLine(line,target){ +let direction=line.delta(_vector1),denominator=this.normal.dot(direction);if(denominator=== +0)return this.distanceToPoint(line.start)===0?target.copy(line.start):null;let t=-(line. +start.dot(this.normal)+this.constant)/denominator;return t<0||t>1?null:target.copy( +line.start).addScaledVector(direction,t)}intersectsLine(line){let startSign=this. +distanceToPoint(line.start),endSign=this.distanceToPoint(line.end);return startSign< +0&&endSign>0||endSign<0&&startSign>0}intersectsBox(box){return box.intersectsPlane( +this)}intersectsSphere(sphere){return sphere.intersectsPlane(this)}coplanarPoint(target){ +return target.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(matrix,optionalNormalMatrix){ +let normalMatrix=optionalNormalMatrix||_normalMatrix.getNormalMatrix(matrix),referencePoint=this. +coplanarPoint(_vector1).applyMatrix4(matrix),normal=this.normal.applyMatrix3(normalMatrix). +normalize();return this.constant=-referencePoint.dot(normal),this}translate(offset){ +return this.constant-=offset.dot(this.normal),this}equals(plane){return plane.normal. +equals(this.normal)&&plane.constant===this.constant}clone(){return new this.constructor(). +copy(this)}};var __esDecorate11=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers11=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element( +"lume-clip-plane",autoDefineElements)],_classDescriptor,_classExtraInitializers=[], +_classThis,_classSuper=Element3D;var ClipPlane2=class extends _classSuper{static{ +__name(this,"ClipPlane")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate11(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),ClipPlane2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers11( +_classThis,_classExtraInitializers)}__clip=new Plane(new Vector3(...clipNormal));__inverseClip=new Plane( +new Vector3(...clipNormal).negate());updateWorldMatrices(){super.updateWorldMatrices(); +let plane=this.__clip,inverse=this.__inverseClip;!plane||!inverse||(plane.normal. +set(...clipNormal),plane.constant=0,inverse.normal.set(...clipNormal).negate(),inverse. +constant=0,plane.applyMatrix4(this.three.matrixWorld),inverse.applyMatrix4(this. +three.matrixWorld))}};return ClipPlane2=_classThis})();var __esDecorate12=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers12=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=MeshBehavior, +_instanceExtraInitializers=[],_clipIntersection_decorators,_clipIntersection_initializers=[], +_clipShadows_decorators,_clipShadows_initializers=[],_get_clipPlanes_decorators, +_flipClip_decorators,_flipClip_initializers=[],_clipDisabled_decorators,_clipDisabled_initializers=[]; +var ClipPlanesBehavior2=class extends _classSuper{static{__name(this,"ClipPlanes\ +Behavior")}static{_classThis=this}static{let _metadata=typeof Symbol=="function"&& +Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;_clipIntersection_decorators= +[booleanAttribute,receiver],_clipShadows_decorators=[booleanAttribute,receiver], +_get_clipPlanes_decorators=[stringAttribute,receiver],_flipClip_decorators=[booleanAttribute, +receiver],_clipDisabled_decorators=[booleanAttribute,receiver],__esDecorate12(this, +null,_get_clipPlanes_decorators,{kind:"getter",name:"clipPlanes",static:!1,private:!1, +access:{has:obj=>"clipPlanes"in obj,get:obj=>obj.clipPlanes},metadata:_metadata}, +null,_instanceExtraInitializers),__esDecorate12(null,null,_clipIntersection_decorators, +{kind:"field",name:"clipIntersection",static:!1,private:!1,access:{has:obj=>"cli\ +pIntersection"in obj,get:obj=>obj.clipIntersection,set:(obj,value)=>{obj.clipIntersection= +value}},metadata:_metadata},_clipIntersection_initializers,_instanceExtraInitializers), +__esDecorate12(null,null,_clipShadows_decorators,{kind:"field",name:"clipShadows", +static:!1,private:!1,access:{has:obj=>"clipShadows"in obj,get:obj=>obj.clipShadows, +set:(obj,value)=>{obj.clipShadows=value}},metadata:_metadata},_clipShadows_initializers, +_instanceExtraInitializers),__esDecorate12(null,null,_flipClip_decorators,{kind:"\ +field",name:"flipClip",static:!1,private:!1,access:{has:obj=>"flipClip"in obj,get:obj=>obj. +flipClip,set:(obj,value)=>{obj.flipClip=value}},metadata:_metadata},_flipClip_initializers, +_instanceExtraInitializers),__esDecorate12(null,null,_clipDisabled_decorators,{kind:"\ +field",name:"clipDisabled",static:!1,private:!1,access:{has:obj=>"clipDisabled"in +obj,get:obj=>obj.clipDisabled,set:(obj,value)=>{obj.clipDisabled=value}},metadata:_metadata}, +_clipDisabled_initializers,_instanceExtraInitializers),__esDecorate12(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),ClipPlanesBehavior2=_classThis=_classDescriptor.value, +_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers12(_classThis,_classExtraInitializers)}clipIntersection=(__runInitializers12( +this,_instanceExtraInitializers),__runInitializers12(this,_clipIntersection_initializers, +!1));clipShadows=__runInitializers12(this,_clipShadows_initializers,!0);#clipPlanes=[];#rawClipPlanes=[];get clipPlanes(){ +return this.#clipPlanes}set clipPlanes(value){this.#rawClipPlanes=value;let array=[]; +if(typeof value=="string")array=[value.trim()];else if(Array.isArray(value))array= +value;else throw new TypeError("Invalid value for clipPlanes");this.#clipPlanes= +[];for(let v of array){if(typeof v!="string"){v instanceof ClipPlane&&v.scene&&this.#clipPlanes. +push(v);continue}else if(!v)continue;let root=this.element.getRootNode();for(;root;){ +let els=root.querySelectorAll(v);for(let i2=0,l=els.length;i2name2.endsWith("-ma\ +terial"))?.meshComponent??null}#observer=null;connectedCallback(){super.connectedCallback(); +let lastScene=null;this.createEffect(()=>{this.element.scene&&(lastScene=this.element. +scene,this.clipPlanes=this.#rawClipPlanes,refCount||(this.element.scene.__localClipping= +!0),refCount++,this.#observer=new MutationObserver(()=>{this.clipPlanes=this.#rawClipPlanes}), +this.#observer.observe(this.element.getRootNode(),{childList:!0,subtree:!0}),createEffect( +()=>{let{clipPlanes,clipIntersection,clipShadows,flipClip}=this,mat=this.material; +if(mat){if(this.element.needsUpdate(),!clipPlanes.length||this.clipDisabled){mat. +clippingPlanes=null,mat.clipShadows=!1;return}mat.clippingPlanes||(mat.clippingPlanes= +[]),mat.clippingPlanes.length=0,mat.clipIntersection=clipIntersection,mat.clipShadows= +clipShadows;for(let plane of clipPlanes)mat.clippingPlanes.push(flipClip?plane.__inverseClip: +plane.__clip)}}),onCleanup(()=>{this.#observer?.disconnect(),this.#observer=null, +refCount--,refCount||(lastScene.__localClipping=!1),lastScene=null}))})}};return ClipPlanesBehavior2= +_classThis})();globalThis.window?.document&&!elementBehaviors.has("clip-planes")&&elementBehaviors. +define("clip-planes",ClipPlanesBehavior);var GeometryOrMaterialBehavior=class extends MeshBehavior{static{__name(this,"Ge\ +ometryOrMaterialBehavior")}connectedCallback(){super.connectedCallback(),this.createEffect( +()=>this.resetMeshComponent())}resetMeshComponent(){this.#setMeshComponent(),this. +element.needsUpdate(),onCleanup(this.#disposeMeshComponent)}_createComponent(){throw new Error( +"`_createComponent()` is not implemented by subclass.")}#disposeMeshComponent=()=>{ +this.meshComponent?.dispose(),this.meshComponent=null};#setMeshComponent(){let newComponent=this. +_createComponent();untrack(()=>{this.element.three[this.type]=newComponent}),this. +meshComponent=newComponent}};var GeometryBehavior=class extends GeometryOrMaterialBehavior{static{__name(this, +"GeometryBehavior")}type="geometry";get size(){return this.element.size}set size(val){ +this.element.size=val}get sizeMode(){return this.element.sizeMode}set sizeMode(val){ +this.element.sizeMode=val}get geometry(){return this.meshComponent}_createComponent(){ +return new BufferGeometry}};var BoxGeometryBehavior=class extends GeometryBehavior{static{__name(this,"BoxGe\ +ometryBehavior")}_createComponent(){return new BoxGeometry(this.element.calculatedSize. +x,this.element.calculatedSize.y,this.element.calculatedSize.z)}};globalThis.window?. +document&&!elementBehaviors.has("box-geometry")&&elementBehaviors.define("box-ge\ +ometry",BoxGeometryBehavior);var __runInitializers13=function(thisArg,initializers,value){for(var useValue=arguments. +length>2,i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},LineGeometryBehavior=(()=>{ +let _classDecorators=[behavior],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=GeometryBehavior,_instanceExtraInitializers=[],_get_points_decorators, +_centerGeometry_decorators,_centerGeometry_initializers=[],_fitment_decorators,_fitment_initializers=[]; +var LineGeometryBehavior2=class extends _classSuper{static{__name(this,"LineGeom\ +etryBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol=="funct\ +ion"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;_get_points_decorators= +[attribute,receiver],_centerGeometry_decorators=[booleanAttribute,receiver],_fitment_decorators= +[stringAttribute,receiver],__esDecorate13(this,null,_get_points_decorators,{kind:"\ +getter",name:"points",static:!1,private:!1,access:{has:obj=>"points"in obj,get:obj=>obj. +points},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate13(null, +null,_centerGeometry_decorators,{kind:"field",name:"centerGeometry",static:!1,private:!1, +access:{has:obj=>"centerGeometry"in obj,get:obj=>obj.centerGeometry,set:(obj,value)=>{ +obj.centerGeometry=value}},metadata:_metadata},_centerGeometry_initializers,_instanceExtraInitializers), +__esDecorate13(null,null,_fitment_decorators,{kind:"field",name:"fitment",static:!1, +private:!1,access:{has:obj=>"fitment"in obj,get:obj=>obj.fitment,set:(obj,value)=>{ +obj.fitment=value}},metadata:_metadata},_fitment_initializers,_instanceExtraInitializers), +__esDecorate13(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),LineGeometryBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers13( +_classThis,_classExtraInitializers)}#points=(__runInitializers13(this,_instanceExtraInitializers), +[]);get points(){return this.#points}set points(points){if(!points)this.#points. +length=0;else if(typeof points=="string"||Array.isArray(points)){let _points3=typeof points== +"string"?stringToNumberArray(points,"points"):points;if(!_points3.length)this.#points. +length=0;else{if(_points3.length%3!==0)throw new Error("The points array needs t\ +o have 3 numbers per point.");this.#points.length!==_points3.length&&(this.#points. +length=_points3.length);for(let i2=0,l=_points3.length;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers14=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=GeometryBehavior,_instanceExtraInitializers=[], +_widthSegments_decorators,_widthSegments_initializers=[],_heightSegments_decorators, +_heightSegments_initializers=[];var PlaneGeometryBehavior2=class extends _classSuper{static{ +__name(this,"PlaneGeometryBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_widthSegments_decorators=[numberAttribute,receiver],_heightSegments_decorators= +[numberAttribute,receiver],__esDecorate14(null,null,_widthSegments_decorators,{kind:"\ +field",name:"widthSegments",static:!1,private:!1,access:{has:obj=>"widthSegments"in +obj,get:obj=>obj.widthSegments,set:(obj,value)=>{obj.widthSegments=value}},metadata:_metadata}, +_widthSegments_initializers,_instanceExtraInitializers),__esDecorate14(null,null, +_heightSegments_decorators,{kind:"field",name:"heightSegments",static:!1,private:!1, +access:{has:obj=>"heightSegments"in obj,get:obj=>obj.heightSegments,set:(obj,value)=>{ +obj.heightSegments=value}},metadata:_metadata},_heightSegments_initializers,_instanceExtraInitializers), +__esDecorate14(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),PlaneGeometryBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers14( +_classThis,_classExtraInitializers)}widthSegments=(__runInitializers14(this,_instanceExtraInitializers), +__runInitializers14(this,_widthSegments_initializers,1));heightSegments=__runInitializers14( +this,_heightSegments_initializers,1);_createComponent(){return new PlaneGeometry( +this.element.calculatedSize.x,this.element.calculatedSize.y,this.widthSegments,this. +heightSegments)}};return PlaneGeometryBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("plane-geometry")&&elementBehaviors. +define("plane-geometry",PlaneGeometryBehavior);var REVISION2="160";var CullFaceNone2=0,CullFaceBack2=1,CullFaceFront2=2;var PCFShadowMap2=1,PCFSoftShadowMap2=2,VSMShadowMap2=3,FrontSide2=0,BackSide2=1, +DoubleSide2=2;var NoBlending2=0,NormalBlending2=1,AdditiveBlending2=2,SubtractiveBlending2=3,MultiplyBlending2=4, +CustomBlending2=5,AddEquation2=100,SubtractEquation2=101,ReverseSubtractEquation2=102, +MinEquation2=103,MaxEquation2=104,ZeroFactor2=200,OneFactor2=201,SrcColorFactor2=202, +OneMinusSrcColorFactor2=203,SrcAlphaFactor2=204,OneMinusSrcAlphaFactor2=205,DstAlphaFactor2=206, +OneMinusDstAlphaFactor2=207,DstColorFactor2=208,OneMinusDstColorFactor2=209,SrcAlphaSaturateFactor2=210, +ConstantColorFactor2=211,OneMinusConstantColorFactor2=212,ConstantAlphaFactor2=213, +OneMinusConstantAlphaFactor2=214,NeverDepth2=0,AlwaysDepth2=1,LessDepth2=2,LessEqualDepth2=3, +EqualDepth2=4,GreaterEqualDepth2=5,GreaterDepth2=6,NotEqualDepth2=7,MultiplyOperation2=0, +MixOperation2=1,AddOperation2=2,NoToneMapping2=0,LinearToneMapping2=1,ReinhardToneMapping2=2, +CineonToneMapping2=3,ACESFilmicToneMapping2=4,CustomToneMapping2=5,AgXToneMapping2=6, +AttachedBindMode="attached",DetachedBindMode="detached",UVMapping2=300,CubeReflectionMapping2=301, +CubeRefractionMapping2=302,EquirectangularReflectionMapping2=303,EquirectangularRefractionMapping2=304, +CubeUVReflectionMapping2=306,RepeatWrapping2=1e3,ClampToEdgeWrapping2=1001,MirroredRepeatWrapping2=1002, +NearestFilter2=1003,NearestMipmapNearestFilter2=1004;var NearestMipmapLinearFilter2=1005;var LinearFilter2=1006,LinearMipmapNearestFilter2=1007;var LinearMipmapLinearFilter2=1008;var UnsignedByteType2=1009,ByteType2=1010,ShortType2=1011,UnsignedShortType2=1012, +IntType2=1013,UnsignedIntType2=1014,FloatType2=1015,HalfFloatType2=1016,UnsignedShort4444Type2=1017, +UnsignedShort5551Type2=1018,UnsignedInt248Type2=1020,AlphaFormat2=1021,RGBAFormat2=1023, +LuminanceFormat2=1024,LuminanceAlphaFormat2=1025,DepthFormat2=1026,DepthStencilFormat2=1027, +RedFormat2=1028,RedIntegerFormat2=1029,RGFormat2=1030,RGIntegerFormat2=1031,RGBAIntegerFormat2=1033, +RGB_S3TC_DXT1_Format2=33776,RGBA_S3TC_DXT1_Format2=33777,RGBA_S3TC_DXT3_Format2=33778, +RGBA_S3TC_DXT5_Format2=33779,RGB_PVRTC_4BPPV1_Format2=35840,RGB_PVRTC_2BPPV1_Format2=35841, +RGBA_PVRTC_4BPPV1_Format2=35842,RGBA_PVRTC_2BPPV1_Format2=35843,RGB_ETC1_Format2=36196, +RGB_ETC2_Format2=37492,RGBA_ETC2_EAC_Format2=37496,RGBA_ASTC_4x4_Format2=37808,RGBA_ASTC_5x4_Format2=37809, +RGBA_ASTC_5x5_Format2=37810,RGBA_ASTC_6x5_Format2=37811,RGBA_ASTC_6x6_Format2=37812, +RGBA_ASTC_8x5_Format2=37813,RGBA_ASTC_8x6_Format2=37814,RGBA_ASTC_8x8_Format2=37815, +RGBA_ASTC_10x5_Format2=37816,RGBA_ASTC_10x6_Format2=37817,RGBA_ASTC_10x8_Format2=37818, +RGBA_ASTC_10x10_Format2=37819,RGBA_ASTC_12x10_Format2=37820,RGBA_ASTC_12x12_Format2=37821, +RGBA_BPTC_Format2=36492,RGB_BPTC_SIGNED_Format2=36494,RGB_BPTC_UNSIGNED_Format2=36495, +RED_RGTC1_Format2=36283,SIGNED_RED_RGTC1_Format2=36284,RED_GREEN_RGTC2_Format2=36285, +SIGNED_RED_GREEN_RGTC2_Format2=36286;var InterpolateDiscrete=2300,InterpolateLinear=2301,InterpolateSmooth=2302,ZeroCurvatureEnding=2400, +ZeroSlopeEnding=2401,WrapAroundEnding=2402,NormalAnimationBlendMode=2500;var TrianglesDrawMode=0,TriangleStripDrawMode=1,TriangleFanDrawMode=2,LinearEncoding2=3e3, +sRGBEncoding2=3001,BasicDepthPacking2=3200,RGBADepthPacking2=3201,TangentSpaceNormalMap2=0, +ObjectSpaceNormalMap2=1,NoColorSpace2="",SRGBColorSpace2="srgb",LinearSRGBColorSpace2="\ +srgb-linear",DisplayP3ColorSpace2="display-p3",LinearDisplayP3ColorSpace2="displ\ +ay-p3-linear",LinearTransfer2="linear",SRGBTransfer2="srgb",Rec709Primaries2="re\ +c709",P3Primaries2="p3";var KeepStencilOp2=7680;var AlwaysStencilFunc2=519,NeverCompare2=512,LessCompare2=513,EqualCompare2=514, +LessEqualCompare2=515,GreaterCompare2=516,NotEqualCompare2=517,GreaterEqualCompare2=518, +AlwaysCompare2=519,StaticDrawUsage2=35044;var GLSL32="300 es",_SRGBAFormat2=1035,WebGLCoordinateSystem2=2e3,WebGPUCoordinateSystem2=2001, +EventDispatcher2=class{static{__name(this,"EventDispatcher")}addEventListener(type,listener){ +this._listeners===void 0&&(this._listeners={});let listeners=this._listeners;listeners[type]=== +void 0&&(listeners[type]=[]),listeners[type].indexOf(listener)===-1&&listeners[type]. +push(listener)}hasEventListener(type,listener){if(this._listeners===void 0)return!1; +let listeners=this._listeners;return listeners[type]!==void 0&&listeners[type].indexOf( +listener)!==-1}removeEventListener(type,listener){if(this._listeners===void 0)return; +let listenerArray=this._listeners[type];if(listenerArray!==void 0){let index=listenerArray. +indexOf(listener);index!==-1&&listenerArray.splice(index,1)}}dispatchEvent(event){ +if(this._listeners===void 0)return;let listenerArray=this._listeners[event.type]; +if(listenerArray!==void 0){event.target=this;let array=listenerArray.slice(0);for(let i2=0, +l=array.length;i2>8&255]+ +_lut2[d0>>16&255]+_lut2[d0>>24&255]+"-"+_lut2[d1&255]+_lut2[d1>>8&255]+"-"+_lut2[d1>> +16&15|64]+_lut2[d1>>24&255]+"-"+_lut2[d2&63|128]+_lut2[d2>>8&255]+"-"+_lut2[d2>> +16&255]+_lut2[d2>>24&255]+_lut2[d3&255]+_lut2[d3>>8&255]+_lut2[d3>>16&255]+_lut2[d3>> +24&255]).toLowerCase()}__name(generateUUID2,"generateUUID");function clamp2(value,min,max2){ +return Math.max(min,Math.min(max2,value))}__name(clamp2,"clamp");function euclideanModulo2(n,m){ +return(n%m+m)%m}__name(euclideanModulo2,"euclideanModulo");function mapLinear(x2,a1,a2,b1,b2){ +return b1+(x2-a1)*(b2-b1)/(a2-a1)}__name(mapLinear,"mapLinear");function inverseLerp(x2,y2,value){ +return x2!==y2?(value-x2)/(y2-x2):0}__name(inverseLerp,"inverseLerp");function lerp2(x2,y2,t){ +return(1-t)*x2+t*y2}__name(lerp2,"lerp");function damp(x2,y2,lambda,dt){return lerp2( +x2,y2,1-Math.exp(-lambda*dt))}__name(damp,"damp");function pingpong(x2,length=1){ +return length-Math.abs(euclideanModulo2(x2,length*2)-length)}__name(pingpong,"pi\ +ngpong");function smoothstep(x2,min,max2){return x2<=min?0:x2>=max2?1:(x2=(x2-min)/ +(max2-min),x2*x2*(3-2*x2))}__name(smoothstep,"smoothstep");function smootherstep(x2,min,max2){ +return x2<=min?0:x2>=max2?1:(x2=(x2-min)/(max2-min),x2*x2*x2*(x2*(x2*6-15)+10))} +__name(smootherstep,"smootherstep");function randInt(low,high){return low+Math.floor( +Math.random()*(high-low+1))}__name(randInt,"randInt");function randFloat(low,high){ +return low+Math.random()*(high-low)}__name(randFloat,"randFloat");function randFloatSpread(range){ +return range*(.5-Math.random())}__name(randFloatSpread,"randFloatSpread");function seededRandom(s){ +s!==void 0&&(_seed=s);let t=_seed+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^= +t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}__name(seededRandom,"seede\ +dRandom");function degToRad(degrees){return degrees*DEG2RAD2}__name(degToRad,"de\ +gToRad");function radToDeg(radians){return radians*RAD2DEG2}__name(radToDeg,"rad\ +ToDeg");function isPowerOfTwo2(value){return(value&value-1)===0&&value!==0}__name( +isPowerOfTwo2,"isPowerOfTwo");function ceilPowerOfTwo(value){return Math.pow(2,Math. +ceil(Math.log(value)/Math.LN2))}__name(ceilPowerOfTwo,"ceilPowerOfTwo");function floorPowerOfTwo2(value){ +return Math.pow(2,Math.floor(Math.log(value)/Math.LN2))}__name(floorPowerOfTwo2, +"floorPowerOfTwo");function setQuaternionFromProperEuler(q2,a,b,c3,order){let cos=Math. +cos,sin=Math.sin,c22=cos(b/2),s2=sin(b/2),c13=cos((a+c3)/2),s13=sin((a+c3)/2),c1_3=cos( +(a-c3)/2),s1_3=sin((a-c3)/2),c3_1=cos((c3-a)/2),s3_1=sin((c3-a)/2);switch(order){case"\ +XYX":q2.set(c22*s13,s2*c1_3,s2*s1_3,c22*c13);break;case"YZY":q2.set(s2*s1_3,c22* +s13,s2*c1_3,c22*c13);break;case"ZXZ":q2.set(s2*c1_3,s2*s1_3,c22*s13,c22*c13);break;case"\ +XZX":q2.set(c22*s13,s2*s3_1,s2*c3_1,c22*c13);break;case"YXY":q2.set(s2*c3_1,c22* +s13,s2*s3_1,c22*c13);break;case"ZYZ":q2.set(s2*s3_1,s2*c3_1,c22*s13,c22*c13);break;default: +console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an un\ +known order: "+order)}}__name(setQuaternionFromProperEuler,"setQuaternionFromPro\ +perEuler");function denormalize2(value,array){switch(array.constructor){case Float32Array: +return value;case Uint32Array:return value/4294967295;case Uint16Array:return value/ +65535;case Uint8Array:return value/255;case Int32Array:return Math.max(value/2147483647, +-1);case Int16Array:return Math.max(value/32767,-1);case Int8Array:return Math.max( +value/127,-1);default:throw new Error("Invalid component type.")}}__name(denormalize2, +"denormalize");function normalize2(value,array){switch(array.constructor){case Float32Array: +return value;case Uint32Array:return Math.round(value*4294967295);case Uint16Array: +return Math.round(value*65535);case Uint8Array:return Math.round(value*255);case Int32Array: +return Math.round(value*2147483647);case Int16Array:return Math.round(value*32767);case Int8Array: +return Math.round(value*127);default:throw new Error("Invalid component type.")}} +__name(normalize2,"normalize");var MathUtils={DEG2RAD:DEG2RAD2,RAD2DEG:RAD2DEG2, +generateUUID:generateUUID2,clamp:clamp2,euclideanModulo:euclideanModulo2,mapLinear, +inverseLerp,lerp:lerp2,damp,pingpong,smoothstep,smootherstep,randInt,randFloat,randFloatSpread, +seededRandom,degToRad,radToDeg,isPowerOfTwo:isPowerOfTwo2,ceilPowerOfTwo,floorPowerOfTwo:floorPowerOfTwo2, +setQuaternionFromProperEuler,normalize:normalize2,denormalize:denormalize2},Vector22=class _Vector2{static{ +__name(this,"Vector2")}constructor(x2=0,y2=0){_Vector2.prototype.isVector2=!0,this. +x=x2,this.y=y2}get width(){return this.x}set width(value){this.x=value}get height(){ +return this.y}set height(value){this.y=value}set(x2,y2){return this.x=x2,this.y= +y2,this}setScalar(scalar){return this.x=scalar,this.y=scalar,this}setX(x2){return this. +x=x2,this}setY(y2){return this.y=y2,this}setComponent(index,value){switch(index){case 0: +this.x=value;break;case 1:this.y=value;break;default:throw new Error("index is o\ +ut of range: "+index)}return this}getComponent(index){switch(index){case 0:return this. +x;case 1:return this.y;default:throw new Error("index is out of range: "+index)}}clone(){ +return new this.constructor(this.x,this.y)}copy(v){return this.x=v.x,this.y=v.y, +this}add(v){return this.x+=v.x,this.y+=v.y,this}addScalar(s){return this.x+=s,this. +y+=s,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this}addScaledVector(v,s){ +return this.x+=v.x*s,this.y+=v.y*s,this}sub(v){return this.x-=v.x,this.y-=v.y,this}subScalar(s){ +return this.x-=s,this.y-=s,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y- +b.y,this}multiply(v){return this.x*=v.x,this.y*=v.y,this}multiplyScalar(scalar){ +return this.x*=scalar,this.y*=scalar,this}divide(v){return this.x/=v.x,this.y/=v. +y,this}divideScalar(scalar){return this.multiplyScalar(1/scalar)}applyMatrix3(m){ +let x2=this.x,y2=this.y,e=m.elements;return this.x=e[0]*x2+e[3]*y2+e[6],this.y=e[1]* +x2+e[4]*y2+e[7],this}min(v){return this.x=Math.min(this.x,v.x),this.y=Math.min(this. +y,v.y),this}max(v){return this.x=Math.max(this.x,v.x),this.y=Math.max(this.y,v.y), +this}clamp(min,max2){return this.x=Math.max(min.x,Math.min(max2.x,this.x)),this. +y=Math.max(min.y,Math.min(max2.y,this.y)),this}clampScalar(minVal,maxVal){return this. +x=Math.max(minVal,Math.min(maxVal,this.x)),this.y=Math.max(minVal,Math.min(maxVal, +this.y)),this}clampLength(min,max2){let length=this.length();return this.divideScalar( +length||1).multiplyScalar(Math.max(min,Math.min(max2,length)))}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(v){ +return this.x*v.x+this.y*v.y}cross(v){return this.x*v.y-this.y*v.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(v){let denominator=Math. +sqrt(this.lengthSq()*v.lengthSq());if(denominator===0)return Math.PI/2;let theta=this. +dot(v)/denominator;return Math.acos(clamp2(theta,-1,1))}distanceTo(v){return Math. +sqrt(this.distanceToSquared(v))}distanceToSquared(v){let dx=this.x-v.x,dy=this.y- +v.y;return dx*dx+dy*dy}manhattanDistanceTo(v){return Math.abs(this.x-v.x)+Math.abs( +this.y-v.y)}setLength(length){return this.normalize().multiplyScalar(length)}lerp(v,alpha){ +return this.x+=(v.x-this.x)*alpha,this.y+=(v.y-this.y)*alpha,this}lerpVectors(v1,v2,alpha){ +return this.x=v1.x+(v2.x-v1.x)*alpha,this.y=v1.y+(v2.y-v1.y)*alpha,this}equals(v){ +return v.x===this.x&&v.y===this.y}fromArray(array,offset=0){return this.x=array[offset], +this.y=array[offset+1],this}toArray(array=[],offset=0){return array[offset]=this. +x,array[offset+1]=this.y,array}fromBufferAttribute(attribute2,index){return this. +x=attribute2.getX(index),this.y=attribute2.getY(index),this}rotateAround(center,angle){ +let c3=Math.cos(angle),s=Math.sin(angle),x2=this.x-center.x,y2=this.y-center.y;return this. +x=x2*c3-y2*s+center.x,this.y=x2*s+y2*c3+center.y,this}random(){return this.x=Math. +random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this. +y}},Matrix32=class _Matrix3{static{__name(this,"Matrix3")}constructor(n11,n12,n13,n21,n22,n23,n31,n32,n33){ +_Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],n11!==void 0&& +this.set(n11,n12,n13,n21,n22,n23,n31,n32,n33)}set(n11,n12,n13,n21,n22,n23,n31,n32,n33){ +let te=this.elements;return te[0]=n11,te[1]=n21,te[2]=n31,te[3]=n12,te[4]=n22,te[5]= +n32,te[6]=n13,te[7]=n23,te[8]=n33,this}identity(){return this.set(1,0,0,0,1,0,0, +0,1),this}copy(m){let te=this.elements,me=m.elements;return te[0]=me[0],te[1]=me[1], +te[2]=me[2],te[3]=me[3],te[4]=me[4],te[5]=me[5],te[6]=me[6],te[7]=me[7],te[8]=me[8], +this}extractBasis(xAxis,yAxis,zAxis){return xAxis.setFromMatrix3Column(this,0),yAxis. +setFromMatrix3Column(this,1),zAxis.setFromMatrix3Column(this,2),this}setFromMatrix4(m){ +let me=m.elements;return this.set(me[0],me[4],me[8],me[1],me[5],me[9],me[2],me[6], +me[10]),this}multiply(m){return this.multiplyMatrices(this,m)}premultiply(m){return this. +multiplyMatrices(m,this)}multiplyMatrices(a,b){let ae=a.elements,be=b.elements,te=this. +elements,a11=ae[0],a12=ae[3],a13=ae[6],a21=ae[1],a22=ae[4],a23=ae[7],a31=ae[2],a32=ae[5], +a33=ae[8],b11=be[0],b12=be[3],b13=be[6],b21=be[1],b22=be[4],b23=be[7],b31=be[2], +b32=be[5],b33=be[8];return te[0]=a11*b11+a12*b21+a13*b31,te[3]=a11*b12+a12*b22+a13* +b32,te[6]=a11*b13+a12*b23+a13*b33,te[1]=a21*b11+a22*b21+a23*b31,te[4]=a21*b12+a22* +b22+a23*b32,te[7]=a21*b13+a22*b23+a23*b33,te[2]=a31*b11+a32*b21+a33*b31,te[5]=a31* +b12+a32*b22+a33*b32,te[8]=a31*b13+a32*b23+a33*b33,this}multiplyScalar(s){let te=this. +elements;return te[0]*=s,te[3]*=s,te[6]*=s,te[1]*=s,te[4]*=s,te[7]*=s,te[2]*=s,te[5]*= +s,te[8]*=s,this}determinant(){let te=this.elements,a=te[0],b=te[1],c3=te[2],d2=te[3], +e=te[4],f=te[5],g=te[6],h=te[7],i2=te[8];return a*e*i2-a*f*h-b*d2*i2+b*f*g+c3*d2* +h-c3*e*g}invert(){let te=this.elements,n11=te[0],n21=te[1],n31=te[2],n12=te[3],n22=te[4], +n32=te[5],n13=te[6],n23=te[7],n33=te[8],t11=n33*n22-n32*n23,t12=n32*n13-n33*n12, +t13=n23*n12-n22*n13,det=n11*t11+n21*t12+n31*t13;if(det===0)return this.set(0,0,0, +0,0,0,0,0,0);let detInv=1/det;return te[0]=t11*detInv,te[1]=(n31*n23-n33*n21)*detInv, +te[2]=(n32*n21-n31*n22)*detInv,te[3]=t12*detInv,te[4]=(n33*n11-n31*n13)*detInv,te[5]= +(n31*n12-n32*n11)*detInv,te[6]=t13*detInv,te[7]=(n21*n13-n23*n11)*detInv,te[8]=(n22* +n11-n21*n12)*detInv,this}transpose(){let tmp2,m=this.elements;return tmp2=m[1],m[1]= +m[3],m[3]=tmp2,tmp2=m[2],m[2]=m[6],m[6]=tmp2,tmp2=m[5],m[5]=m[7],m[7]=tmp2,this}getNormalMatrix(matrix4){ +return this.setFromMatrix4(matrix4).invert().transpose()}transposeIntoArray(r3){ +let m=this.elements;return r3[0]=m[0],r3[1]=m[3],r3[2]=m[6],r3[3]=m[1],r3[4]=m[4], +r3[5]=m[7],r3[6]=m[2],r3[7]=m[5],r3[8]=m[8],this}setUvTransform(tx,ty,sx,sy,rotation2,cx,cy){ +let c3=Math.cos(rotation2),s=Math.sin(rotation2);return this.set(sx*c3,sx*s,-sx* +(c3*cx+s*cy)+cx+tx,-sy*s,sy*c3,-sy*(-s*cx+c3*cy)+cy+ty,0,0,1),this}scale(sx,sy){ +return this.premultiply(_m32.makeScale(sx,sy)),this}rotate(theta){return this.premultiply( +_m32.makeRotation(-theta)),this}translate(tx,ty){return this.premultiply(_m32.makeTranslation( +tx,ty)),this}makeTranslation(x2,y2){return x2.isVector2?this.set(1,0,x2.x,0,1,x2. +y,0,0,1):this.set(1,0,x2,0,1,y2,0,0,1),this}makeRotation(theta){let c3=Math.cos( +theta),s=Math.sin(theta);return this.set(c3,-s,0,s,c3,0,0,0,1),this}makeScale(x2,y2){ +return this.set(x2,0,0,0,y2,0,0,0,1),this}equals(matrix){let te=this.elements,me=matrix. +elements;for(let i2=0;i2<9;i2++)if(te[i2]!==me[i2])return!1;return!0}fromArray(array,offset=0){ +for(let i2=0;i2<9;i2++)this.elements[i2]=array[i2+offset];return this}toArray(array=[],offset=0){ +let te=this.elements;return array[offset]=te[0],array[offset+1]=te[1],array[offset+ +2]=te[2],array[offset+3]=te[3],array[offset+4]=te[4],array[offset+5]=te[5],array[offset+ +6]=te[6],array[offset+7]=te[7],array[offset+8]=te[8],array}clone(){return new this. +constructor().fromArray(this.elements)}},_m32=new Matrix32;function arrayNeedsUint322(array){ +for(let i2=array.length-1;i2>=0;--i2)if(array[i2]>=65535)return!0;return!1}__name( +arrayNeedsUint322,"arrayNeedsUint32");function createElementNS2(name2){return document.createElementNS("http://www.w3.\ +org/1999/xhtml",name2)}__name(createElementNS2,"createElementNS");function createCanvasElement2(){ +let canvas=createElementNS2("canvas");return canvas.style.display="block",canvas} +__name(createCanvasElement2,"createCanvasElement");var _cache2={};function warnOnce2(message){ +message in _cache2||(_cache2[message]=!0,console.warn(message))}__name(warnOnce2, +"warnOnce");var LINEAR_SRGB_TO_LINEAR_DISPLAY_P32=new Matrix32().set(.8224621,.177538, +0,.0331941,.9668058,0,.0170827,.0723974,.9105199),LINEAR_DISPLAY_P3_TO_LINEAR_SRGB2=new Matrix32(). +set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),COLOR_SPACES2={ +[LinearSRGBColorSpace2]:{transfer:LinearTransfer2,primaries:Rec709Primaries2,toReference:color=>color, +fromReference:color=>color},[SRGBColorSpace2]:{transfer:SRGBTransfer2,primaries:Rec709Primaries2, +toReference:color=>color.convertSRGBToLinear(),fromReference:color=>color.convertLinearToSRGB()}, +[LinearDisplayP3ColorSpace2]:{transfer:LinearTransfer2,primaries:P3Primaries2,toReference:color=>color. +applyMatrix3(LINEAR_DISPLAY_P3_TO_LINEAR_SRGB2),fromReference:color=>color.applyMatrix3( +LINEAR_SRGB_TO_LINEAR_DISPLAY_P32)},[DisplayP3ColorSpace2]:{transfer:SRGBTransfer2, +primaries:P3Primaries2,toReference:color=>color.convertSRGBToLinear().applyMatrix3( +LINEAR_DISPLAY_P3_TO_LINEAR_SRGB2),fromReference:color=>color.applyMatrix3(LINEAR_SRGB_TO_LINEAR_DISPLAY_P32). +convertLinearToSRGB()}},SUPPORTED_WORKING_COLOR_SPACES2=new Set([LinearSRGBColorSpace2, +LinearDisplayP3ColorSpace2]),ColorManagement2={enabled:!0,_workingColorSpace:LinearSRGBColorSpace2, +get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(colorSpace){ +if(!SUPPORTED_WORKING_COLOR_SPACES2.has(colorSpace))throw new Error(`Unsupported\ + working color space, "${colorSpace}".`);this._workingColorSpace=colorSpace},convert:function(color,sourceColorSpace,targetColorSpace){ +if(this.enabled===!1||sourceColorSpace===targetColorSpace||!sourceColorSpace||!targetColorSpace) +return color;let sourceToReference=COLOR_SPACES2[sourceColorSpace].toReference,targetFromReference=COLOR_SPACES2[targetColorSpace]. +fromReference;return targetFromReference(sourceToReference(color))},fromWorkingColorSpace:function(color,targetColorSpace){ +return this.convert(color,this._workingColorSpace,targetColorSpace)},toWorkingColorSpace:function(color,sourceColorSpace){ +return this.convert(color,sourceColorSpace,this._workingColorSpace)},getPrimaries:function(colorSpace){ +return COLOR_SPACES2[colorSpace].primaries},getTransfer:function(colorSpace){return colorSpace=== +NoColorSpace2?LinearTransfer2:COLOR_SPACES2[colorSpace].transfer}};function SRGBToLinear2(c3){ +return c3<.04045?c3*.0773993808:Math.pow(c3*.9478672986+.0521327014,2.4)}__name( +SRGBToLinear2,"SRGBToLinear");function LinearToSRGB2(c3){return c3<.0031308?c3*12.92: +1.055*Math.pow(c3,.41666)-.055}__name(LinearToSRGB2,"LinearToSRGB");var _canvas, +ImageUtils=class{static{__name(this,"ImageUtils")}static getDataURL(image){if(/^data:/i. +test(image.src)||typeof HTMLCanvasElement>"u")return image.src;let canvas;if(image instanceof +HTMLCanvasElement)canvas=image;else{_canvas===void 0&&(_canvas=createElementNS2( +"canvas")),_canvas.width=image.width,_canvas.height=image.height;let context=_canvas. +getContext("2d");image instanceof ImageData?context.putImageData(image,0,0):context. +drawImage(image,0,0,image.width,image.height),canvas=_canvas}return canvas.width> +2048||canvas.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image conve\ +rted to jpg for performance reasons",image),canvas.toDataURL("image/jpeg",.6)):canvas. +toDataURL("image/png")}static sRGBToLinear(image){if(typeof HTMLImageElement<"u"&& +image instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&image instanceof +HTMLCanvasElement||typeof ImageBitmap<"u"&&image instanceof ImageBitmap){let canvas=createElementNS2( +"canvas");canvas.width=image.width,canvas.height=image.height;let context=canvas. +getContext("2d");context.drawImage(image,0,0,image.width,image.height);let imageData=context. +getImageData(0,0,image.width,image.height),data=imageData.data;for(let i2=0;i20&&(output.userData=this.userData),isRootObject||(meta. +textures[this.uuid]=output),output}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(uv){ +if(this.mapping!==UVMapping2)return uv;if(uv.applyMatrix3(this.matrix),uv.x<0||uv. +x>1)switch(this.wrapS){case RepeatWrapping2:uv.x=uv.x-Math.floor(uv.x);break;case ClampToEdgeWrapping2: +uv.x=uv.x<0?0:1;break;case MirroredRepeatWrapping2:Math.abs(Math.floor(uv.x)%2)=== +1?uv.x=Math.ceil(uv.x)-uv.x:uv.x=uv.x-Math.floor(uv.x);break}if(uv.y<0||uv.y>1)switch(this. +wrapT){case RepeatWrapping2:uv.y=uv.y-Math.floor(uv.y);break;case ClampToEdgeWrapping2: +uv.y=uv.y<0?0:1;break;case MirroredRepeatWrapping2:Math.abs(Math.floor(uv.y)%2)=== +1?uv.y=Math.ceil(uv.y)-uv.y:uv.y=uv.y-Math.floor(uv.y);break}return this.flipY&& +(uv.y=1-uv.y),uv}set needsUpdate(value){value===!0&&(this.version++,this.source. +needsUpdate=!0)}get encoding(){return warnOnce2("THREE.Texture: Property .encodi\ +ng has been replaced by .colorSpace."),this.colorSpace===SRGBColorSpace2?sRGBEncoding2: +LinearEncoding2}set encoding(encoding){warnOnce2("THREE.Texture: Property .encod\ +ing has been replaced by .colorSpace."),this.colorSpace=encoding===sRGBEncoding2? +SRGBColorSpace2:NoColorSpace2}};Texture.DEFAULT_IMAGE=null;Texture.DEFAULT_MAPPING= +UVMapping2;Texture.DEFAULT_ANISOTROPY=1;var Vector4=class _Vector4{static{__name( +this,"Vector4")}constructor(x2=0,y2=0,z2=0,w2=1){_Vector4.prototype.isVector4=!0, +this.x=x2,this.y=y2,this.z=z2,this.w=w2}get width(){return this.z}set width(value){ +this.z=value}get height(){return this.w}set height(value){this.w=value}set(x2,y2,z2,w2){ +return this.x=x2,this.y=y2,this.z=z2,this.w=w2,this}setScalar(scalar){return this. +x=scalar,this.y=scalar,this.z=scalar,this.w=scalar,this}setX(x2){return this.x=x2, +this}setY(y2){return this.y=y2,this}setZ(z2){return this.z=z2,this}setW(w2){return this. +w=w2,this}setComponent(index,value){switch(index){case 0:this.x=value;break;case 1: +this.y=value;break;case 2:this.z=value;break;case 3:this.w=value;break;default:throw new Error( +"index is out of range: "+index)}return this}getComponent(index){switch(index){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: "+index)}}clone(){return new this.constructor( +this.x,this.y,this.z,this.w)}copy(v){return this.x=v.x,this.y=v.y,this.z=v.z,this. +w=v.w!==void 0?v.w:1,this}add(v){return this.x+=v.x,this.y+=v.y,this.z+=v.z,this. +w+=v.w,this}addScalar(s){return this.x+=s,this.y+=s,this.z+=s,this.w+=s,this}addVectors(a,b){ +return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this.w=a.w+b.w,this}addScaledVector(v,s){ +return this.x+=v.x*s,this.y+=v.y*s,this.z+=v.z*s,this.w+=v.w*s,this}sub(v){return this. +x-=v.x,this.y-=v.y,this.z-=v.z,this.w-=v.w,this}subScalar(s){return this.x-=s,this. +y-=s,this.z-=s,this.w-=s,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y-b. +y,this.z=a.z-b.z,this.w=a.w-b.w,this}multiply(v){return this.x*=v.x,this.y*=v.y, +this.z*=v.z,this.w*=v.w,this}multiplyScalar(scalar){return this.x*=scalar,this.y*= +scalar,this.z*=scalar,this.w*=scalar,this}applyMatrix4(m){let x2=this.x,y2=this. +y,z2=this.z,w2=this.w,e=m.elements;return this.x=e[0]*x2+e[4]*y2+e[8]*z2+e[12]*w2, +this.y=e[1]*x2+e[5]*y2+e[9]*z2+e[13]*w2,this.z=e[2]*x2+e[6]*y2+e[10]*z2+e[14]*w2, +this.w=e[3]*x2+e[7]*y2+e[11]*z2+e[15]*w2,this}divideScalar(scalar){return this.multiplyScalar( +1/scalar)}setAxisAngleFromQuaternion(q2){this.w=2*Math.acos(q2.w);let s=Math.sqrt( +1-q2.w*q2.w);return s<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=q2.x/s,this.y=q2. +y/s,this.z=q2.z/s),this}setAxisAngleFromRotationMatrix(m){let angle,x2,y2,z2,te=m. +elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6], +m33=te[10];if(Math.abs(m12-m21)<.01&&Math.abs(m13-m31)<.01&&Math.abs(m23-m32)<.01){ +if(Math.abs(m12+m21)<.1&&Math.abs(m13+m31)<.1&&Math.abs(m23+m32)<.1&&Math.abs(m11+ +m22+m33-3)<.1)return this.set(1,0,0,0),this;angle=Math.PI;let xx=(m11+1)/2,yy=(m22+ +1)/2,zz=(m33+1)/2,xy=(m12+m21)/4,xz=(m13+m31)/4,yz=(m23+m32)/4;return xx>yy&&xx> +zz?xx<.01?(x2=0,y2=.707106781,z2=.707106781):(x2=Math.sqrt(xx),y2=xy/x2,z2=xz/x2): +yy>zz?yy<.01?(x2=.707106781,y2=0,z2=.707106781):(y2=Math.sqrt(yy),x2=xy/y2,z2=yz/ +y2):zz<.01?(x2=.707106781,y2=.707106781,z2=0):(z2=Math.sqrt(zz),x2=xz/z2,y2=yz/z2), +this.set(x2,y2,z2,angle),this}let s=Math.sqrt((m32-m23)*(m32-m23)+(m13-m31)*(m13- +m31)+(m21-m12)*(m21-m12));return Math.abs(s)<.001&&(s=1),this.x=(m32-m23)/s,this. +y=(m13-m31)/s,this.z=(m21-m12)/s,this.w=Math.acos((m11+m22+m33-1)/2),this}min(v){ +return this.x=Math.min(this.x,v.x),this.y=Math.min(this.y,v.y),this.z=Math.min(this. +z,v.z),this.w=Math.min(this.w,v.w),this}max(v){return this.x=Math.max(this.x,v.x), +this.y=Math.max(this.y,v.y),this.z=Math.max(this.z,v.z),this.w=Math.max(this.w,v. +w),this}clamp(min,max2){return this.x=Math.max(min.x,Math.min(max2.x,this.x)),this. +y=Math.max(min.y,Math.min(max2.y,this.y)),this.z=Math.max(min.z,Math.min(max2.z, +this.z)),this.w=Math.max(min.w,Math.min(max2.w,this.w)),this}clampScalar(minVal,maxVal){ +return this.x=Math.max(minVal,Math.min(maxVal,this.x)),this.y=Math.max(minVal,Math. +min(maxVal,this.y)),this.z=Math.max(minVal,Math.min(maxVal,this.z)),this.w=Math. +max(minVal,Math.min(maxVal,this.w)),this}clampLength(min,max2){let length=this.length(); +return this.divideScalar(length||1).multiplyScalar(Math.max(min,Math.min(max2,length)))}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(v){return this. +x*v.x+this.y*v.y+this.z*v.z+this.w*v.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(length){return this.normalize().multiplyScalar(length)}lerp(v,alpha){ +return this.x+=(v.x-this.x)*alpha,this.y+=(v.y-this.y)*alpha,this.z+=(v.z-this.z)* +alpha,this.w+=(v.w-this.w)*alpha,this}lerpVectors(v1,v2,alpha){return this.x=v1. +x+(v2.x-v1.x)*alpha,this.y=v1.y+(v2.y-v1.y)*alpha,this.z=v1.z+(v2.z-v1.z)*alpha, +this.w=v1.w+(v2.w-v1.w)*alpha,this}equals(v){return v.x===this.x&&v.y===this.y&& +v.z===this.z&&v.w===this.w}fromArray(array,offset=0){return this.x=array[offset], +this.y=array[offset+1],this.z=array[offset+2],this.w=array[offset+3],this}toArray(array=[],offset=0){ +return array[offset]=this.x,array[offset+1]=this.y,array[offset+2]=this.z,array[offset+ +3]=this.w,array}fromBufferAttribute(attribute2,index){return this.x=attribute2.getX( +index),this.y=attribute2.getY(index),this.z=attribute2.getZ(index),this.w=attribute2. +getW(index),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}},RenderTarget=class extends EventDispatcher2{static{ +__name(this,"RenderTarget")}constructor(width=1,height=1,options={}){super(),this. +isRenderTarget=!0,this.width=width,this.height=height,this.depth=1,this.scissor= +new Vector4(0,0,width,height),this.scissorTest=!1,this.viewport=new Vector4(0,0, +width,height);let image={width,height,depth:1};options.encoding!==void 0&&(warnOnce2( +"THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace\ +."),options.colorSpace=options.encoding===sRGBEncoding2?SRGBColorSpace2:NoColorSpace2), +options=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:LinearFilter2, +depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},options),this.texture= +new Texture(image,options.mapping,options.wrapS,options.wrapT,options.magFilter, +options.minFilter,options.format,options.type,options.anisotropy,options.colorSpace), +this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps= +options.generateMipmaps,this.texture.internalFormat=options.internalFormat,this. +depthBuffer=options.depthBuffer,this.stencilBuffer=options.stencilBuffer,this.depthTexture= +options.depthTexture,this.samples=options.samples}setSize(width,height,depth=1){ +(this.width!==width||this.height!==height||this.depth!==depth)&&(this.width=width, +this.height=height,this.depth=depth,this.texture.image.width=width,this.texture. +image.height=height,this.texture.image.depth=depth,this.dispose()),this.viewport. +set(0,0,width,height),this.scissor.set(0,0,width,height)}clone(){return new this. +constructor().copy(this)}copy(source){this.width=source.width,this.height=source. +height,this.depth=source.depth,this.scissor.copy(source.scissor),this.scissorTest= +source.scissorTest,this.viewport.copy(source.viewport),this.texture=source.texture. +clone(),this.texture.isRenderTargetTexture=!0;let image=Object.assign({},source. +texture.image);return this.texture.source=new Source(image),this.depthBuffer=source. +depthBuffer,this.stencilBuffer=source.stencilBuffer,source.depthTexture!==null&& +(this.depthTexture=source.depthTexture.clone()),this.samples=source.samples,this}dispose(){ +this.dispatchEvent({type:"dispose"})}},WebGLRenderTarget=class extends RenderTarget{static{ +__name(this,"WebGLRenderTarget")}constructor(width=1,height=1,options={}){super( +width,height,options),this.isWebGLRenderTarget=!0}},DataArrayTexture=class extends Texture{static{ +__name(this,"DataArrayTexture")}constructor(data=null,width=1,height=1,depth=1){ +super(null),this.isDataArrayTexture=!0,this.image={data,width,height,depth},this. +magFilter=NearestFilter2,this.minFilter=NearestFilter2,this.wrapR=ClampToEdgeWrapping2, +this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Data3DTexture=class extends Texture{static{__name(this,"Data3DTexture")}constructor(data=null,width=1,height=1,depth=1){ +super(null),this.isData3DTexture=!0,this.image={data,width,height,depth},this.magFilter= +NearestFilter2,this.minFilter=NearestFilter2,this.wrapR=ClampToEdgeWrapping2,this. +generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Quaternion2=class{static{__name(this,"Quaternion")}constructor(x2=0,y2=0,z2=0,w2=1){ +this.isQuaternion=!0,this._x=x2,this._y=y2,this._z=z2,this._w=w2}static slerpFlat(dst,dstOffset,src0,srcOffset0,src1,srcOffset1,t){ +let x0=src0[srcOffset0+0],y0=src0[srcOffset0+1],z0=src0[srcOffset0+2],w0=src0[srcOffset0+ +3],x1=src1[srcOffset1+0],y1=src1[srcOffset1+1],z1=src1[srcOffset1+2],w1=src1[srcOffset1+ +3];if(t===0){dst[dstOffset+0]=x0,dst[dstOffset+1]=y0,dst[dstOffset+2]=z0,dst[dstOffset+ +3]=w0;return}if(t===1){dst[dstOffset+0]=x1,dst[dstOffset+1]=y1,dst[dstOffset+2]= +z1,dst[dstOffset+3]=w1;return}if(w0!==w1||x0!==x1||y0!==y1||z0!==z1){let s=1-t,cos=x0* +x1+y0*y1+z0*z1+w0*w1,dir=cos>=0?1:-1,sqrSin=1-cos*cos;if(sqrSin>Number.EPSILON){ +let sin=Math.sqrt(sqrSin),len=Math.atan2(sin,cos*dir);s=Math.sin(s*len)/sin,t=Math. +sin(t*len)/sin}let tDir=t*dir;if(x0=x0*s+x1*tDir,y0=y0*s+y1*tDir,z0=z0*s+z1*tDir, +w0=w0*s+w1*tDir,s===1-t){let f=1/Math.sqrt(x0*x0+y0*y0+z0*z0+w0*w0);x0*=f,y0*=f, +z0*=f,w0*=f}}dst[dstOffset]=x0,dst[dstOffset+1]=y0,dst[dstOffset+2]=z0,dst[dstOffset+ +3]=w0}static multiplyQuaternionsFlat(dst,dstOffset,src0,srcOffset0,src1,srcOffset1){ +let x0=src0[srcOffset0],y0=src0[srcOffset0+1],z0=src0[srcOffset0+2],w0=src0[srcOffset0+ +3],x1=src1[srcOffset1],y1=src1[srcOffset1+1],z1=src1[srcOffset1+2],w1=src1[srcOffset1+ +3];return dst[dstOffset]=x0*w1+w0*x1+y0*z1-z0*y1,dst[dstOffset+1]=y0*w1+w0*y1+z0* +x1-x0*z1,dst[dstOffset+2]=z0*w1+w0*z1+x0*y1-y0*x1,dst[dstOffset+3]=w0*w1-x0*x1-y0* +y1-z0*z1,dst}get x(){return this._x}set x(value){this._x=value,this._onChangeCallback()}get y(){ +return this._y}set y(value){this._y=value,this._onChangeCallback()}get z(){return this. +_z}set z(value){this._z=value,this._onChangeCallback()}get w(){return this._w}set w(value){ +this._w=value,this._onChangeCallback()}set(x2,y2,z2,w2){return this._x=x2,this._y= +y2,this._z=z2,this._w=w2,this._onChangeCallback(),this}clone(){return new this.constructor( +this._x,this._y,this._z,this._w)}copy(quaternion){return this._x=quaternion.x,this. +_y=quaternion.y,this._z=quaternion.z,this._w=quaternion.w,this._onChangeCallback(), +this}setFromEuler(euler,update=!0){let x2=euler._x,y2=euler._y,z2=euler._z,order=euler. +_order,cos=Math.cos,sin=Math.sin,c1=cos(x2/2),c22=cos(y2/2),c3=cos(z2/2),s1=sin( +x2/2),s2=sin(y2/2),s3=sin(z2/2);switch(order){case"XYZ":this._x=s1*c22*c3+c1*s2* +s3,this._y=c1*s2*c3-s1*c22*s3,this._z=c1*c22*s3+s1*s2*c3,this._w=c1*c22*c3-s1*s2* +s3;break;case"YXZ":this._x=s1*c22*c3+c1*s2*s3,this._y=c1*s2*c3-s1*c22*s3,this._z= +c1*c22*s3-s1*s2*c3,this._w=c1*c22*c3+s1*s2*s3;break;case"ZXY":this._x=s1*c22*c3- +c1*s2*s3,this._y=c1*s2*c3+s1*c22*s3,this._z=c1*c22*s3+s1*s2*c3,this._w=c1*c22*c3- +s1*s2*s3;break;case"ZYX":this._x=s1*c22*c3-c1*s2*s3,this._y=c1*s2*c3+s1*c22*s3,this. +_z=c1*c22*s3-s1*s2*c3,this._w=c1*c22*c3+s1*s2*s3;break;case"YZX":this._x=s1*c22* +c3+c1*s2*s3,this._y=c1*s2*c3+s1*c22*s3,this._z=c1*c22*s3-s1*s2*c3,this._w=c1*c22* +c3-s1*s2*s3;break;case"XZY":this._x=s1*c22*c3-c1*s2*s3,this._y=c1*s2*c3-s1*c22*s3, +this._z=c1*c22*s3+s1*s2*c3,this._w=c1*c22*c3+s1*s2*s3;break;default:console.warn( +"THREE.Quaternion: .setFromEuler() encountered an unknown order: "+order)}return update=== +!0&&this._onChangeCallback(),this}setFromAxisAngle(axis,angle){let halfAngle=angle/ +2,s=Math.sin(halfAngle);return this._x=axis.x*s,this._y=axis.y*s,this._z=axis.z* +s,this._w=Math.cos(halfAngle),this._onChangeCallback(),this}setFromRotationMatrix(m){ +let te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2], +m32=te[6],m33=te[10],trace=m11+m22+m33;if(trace>0){let s=.5/Math.sqrt(trace+1);this. +_w=.25/s,this._x=(m32-m23)*s,this._y=(m13-m31)*s,this._z=(m21-m12)*s}else if(m11> +m22&&m11>m33){let s=2*Math.sqrt(1+m11-m22-m33);this._w=(m32-m23)/s,this._x=.25*s, +this._y=(m12+m21)/s,this._z=(m13+m31)/s}else if(m22>m33){let s=2*Math.sqrt(1+m22- +m11-m33);this._w=(m13-m31)/s,this._x=(m12+m21)/s,this._y=.25*s,this._z=(m23+m32)/ +s}else{let s=2*Math.sqrt(1+m33-m11-m22);this._w=(m21-m12)/s,this._x=(m13+m31)/s, +this._y=(m23+m32)/s,this._z=.25*s}return this._onChangeCallback(),this}setFromUnitVectors(vFrom,vTo){ +let r3=vFrom.dot(vTo)+1;return r3Math.abs( +vFrom.z)?(this._x=-vFrom.y,this._y=vFrom.x,this._z=0,this._w=r3):(this._x=0,this. +_y=-vFrom.z,this._z=vFrom.y,this._w=r3)):(this._x=vFrom.y*vTo.z-vFrom.z*vTo.y,this. +_y=vFrom.z*vTo.x-vFrom.x*vTo.z,this._z=vFrom.x*vTo.y-vFrom.y*vTo.x,this._w=r3),this. +normalize()}angleTo(q2){return 2*Math.acos(Math.abs(clamp2(this.dot(q2),-1,1)))}rotateTowards(q2,step){ +let angle=this.angleTo(q2);if(angle===0)return this;let t=Math.min(1,step/angle); +return this.slerp(q2,t),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(v){return this._x*v._x+this._y*v._y+this._z*v._z+this._w*v._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 l=this.length();return l===0?(this._x=0,this._y=0,this._z=0,this._w=1):(l=1/ +l,this._x=this._x*l,this._y=this._y*l,this._z=this._z*l,this._w=this._w*l),this. +_onChangeCallback(),this}multiply(q2){return this.multiplyQuaternions(this,q2)}premultiply(q2){ +return this.multiplyQuaternions(q2,this)}multiplyQuaternions(a,b){let qax=a._x,qay=a. +_y,qaz=a._z,qaw=a._w,qbx=b._x,qby=b._y,qbz=b._z,qbw=b._w;return this._x=qax*qbw+ +qaw*qbx+qay*qbz-qaz*qby,this._y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz,this._z=qaz*qbw+ +qaw*qbz+qax*qby-qay*qbx,this._w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz,this._onChangeCallback(), +this}slerp(qb,t){if(t===0)return this;if(t===1)return this.copy(qb);let x2=this. +_x,y2=this._y,z2=this._z,w2=this._w,cosHalfTheta=w2*qb._w+x2*qb._x+y2*qb._y+z2*qb. +_z;if(cosHalfTheta<0?(this._w=-qb._w,this._x=-qb._x,this._y=-qb._y,this._z=-qb._z, +cosHalfTheta=-cosHalfTheta):this.copy(qb),cosHalfTheta>=1)return this._w=w2,this. +_x=x2,this._y=y2,this._z=z2,this;let sqrSinHalfTheta=1-cosHalfTheta*cosHalfTheta; +if(sqrSinHalfTheta<=Number.EPSILON){let s=1-t;return this._w=s*w2+t*this._w,this. +_x=s*x2+t*this._x,this._y=s*y2+t*this._y,this._z=s*z2+t*this._z,this.normalize(), +this}let sinHalfTheta=Math.sqrt(sqrSinHalfTheta),halfTheta=Math.atan2(sinHalfTheta, +cosHalfTheta),ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta,ratioB=Math.sin(t*halfTheta)/ +sinHalfTheta;return this._w=w2*ratioA+this._w*ratioB,this._x=x2*ratioA+this._x*ratioB, +this._y=y2*ratioA+this._y*ratioB,this._z=z2*ratioA+this._z*ratioB,this._onChangeCallback(), +this}slerpQuaternions(qa,qb,t){return this.copy(qa).slerp(qb,t)}random(){let u1=Math. +random(),sqrt1u1=Math.sqrt(1-u1),sqrtu1=Math.sqrt(u1),u2=2*Math.PI*Math.random(), +u3=2*Math.PI*Math.random();return this.set(sqrt1u1*Math.cos(u2),sqrtu1*Math.sin( +u3),sqrtu1*Math.cos(u3),sqrt1u1*Math.sin(u2))}equals(quaternion){return quaternion. +_x===this._x&&quaternion._y===this._y&&quaternion._z===this._z&&quaternion._w=== +this._w}fromArray(array,offset=0){return this._x=array[offset],this._y=array[offset+ +1],this._z=array[offset+2],this._w=array[offset+3],this._onChangeCallback(),this}toArray(array=[],offset=0){ +return array[offset]=this._x,array[offset+1]=this._y,array[offset+2]=this._z,array[offset+ +3]=this._w,array}fromBufferAttribute(attribute2,index){return this._x=attribute2. +getX(index),this._y=attribute2.getY(index),this._z=attribute2.getZ(index),this._w= +attribute2.getW(index),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(callback){ +return this._onChangeCallback=callback,this}_onChangeCallback(){}*[Symbol.iterator](){ +yield this._x,yield this._y,yield this._z,yield this._w}},Vector32=class _Vector3{static{ +__name(this,"Vector3")}constructor(x2=0,y2=0,z2=0){_Vector3.prototype.isVector3= +!0,this.x=x2,this.y=y2,this.z=z2}set(x2,y2,z2){return z2===void 0&&(z2=this.z),this. +x=x2,this.y=y2,this.z=z2,this}setScalar(scalar){return this.x=scalar,this.y=scalar, +this.z=scalar,this}setX(x2){return this.x=x2,this}setY(y2){return this.y=y2,this}setZ(z2){ +return this.z=z2,this}setComponent(index,value){switch(index){case 0:this.x=value; +break;case 1:this.y=value;break;case 2:this.z=value;break;default:throw new Error( +"index is out of range: "+index)}return this}getComponent(index){switch(index){case 0: +return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error( +"index is out of range: "+index)}}clone(){return new this.constructor(this.x,this. +y,this.z)}copy(v){return this.x=v.x,this.y=v.y,this.z=v.z,this}add(v){return this. +x+=v.x,this.y+=v.y,this.z+=v.z,this}addScalar(s){return this.x+=s,this.y+=s,this. +z+=s,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this}addScaledVector(v,s){ +return this.x+=v.x*s,this.y+=v.y*s,this.z+=v.z*s,this}sub(v){return this.x-=v.x, +this.y-=v.y,this.z-=v.z,this}subScalar(s){return this.x-=s,this.y-=s,this.z-=s,this}subVectors(a,b){ +return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this}multiply(v){return this. +x*=v.x,this.y*=v.y,this.z*=v.z,this}multiplyScalar(scalar){return this.x*=scalar, +this.y*=scalar,this.z*=scalar,this}multiplyVectors(a,b){return this.x=a.x*b.x,this. +y=a.y*b.y,this.z=a.z*b.z,this}applyEuler(euler){return this.applyQuaternion(_quaternion$4. +setFromEuler(euler))}applyAxisAngle(axis,angle){return this.applyQuaternion(_quaternion$4. +setFromAxisAngle(axis,angle))}applyMatrix3(m){let x2=this.x,y2=this.y,z2=this.z, +e=m.elements;return this.x=e[0]*x2+e[3]*y2+e[6]*z2,this.y=e[1]*x2+e[4]*y2+e[7]*z2, +this.z=e[2]*x2+e[5]*y2+e[8]*z2,this}applyNormalMatrix(m){return this.applyMatrix3( +m).normalize()}applyMatrix4(m){let x2=this.x,y2=this.y,z2=this.z,e=m.elements,w2=1/ +(e[3]*x2+e[7]*y2+e[11]*z2+e[15]);return this.x=(e[0]*x2+e[4]*y2+e[8]*z2+e[12])*w2, +this.y=(e[1]*x2+e[5]*y2+e[9]*z2+e[13])*w2,this.z=(e[2]*x2+e[6]*y2+e[10]*z2+e[14])* +w2,this}applyQuaternion(q2){let vx=this.x,vy=this.y,vz=this.z,qx=q2.x,qy=q2.y,qz=q2. +z,qw=q2.w,tx=2*(qy*vz-qz*vy),ty=2*(qz*vx-qx*vz),tz=2*(qx*vy-qy*vx);return this.x= +vx+qw*tx+qy*tz-qz*ty,this.y=vy+qw*ty+qz*tx-qx*tz,this.z=vz+qw*tz+qx*ty-qy*tx,this}project(camera){ +return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix)}unproject(camera){ +return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld)}transformDirection(m){ +let x2=this.x,y2=this.y,z2=this.z,e=m.elements;return this.x=e[0]*x2+e[4]*y2+e[8]* +z2,this.y=e[1]*x2+e[5]*y2+e[9]*z2,this.z=e[2]*x2+e[6]*y2+e[10]*z2,this.normalize()}divide(v){ +return this.x/=v.x,this.y/=v.y,this.z/=v.z,this}divideScalar(scalar){return this. +multiplyScalar(1/scalar)}min(v){return this.x=Math.min(this.x,v.x),this.y=Math.min( +this.y,v.y),this.z=Math.min(this.z,v.z),this}max(v){return this.x=Math.max(this. +x,v.x),this.y=Math.max(this.y,v.y),this.z=Math.max(this.z,v.z),this}clamp(min,max2){ +return this.x=Math.max(min.x,Math.min(max2.x,this.x)),this.y=Math.max(min.y,Math. +min(max2.y,this.y)),this.z=Math.max(min.z,Math.min(max2.z,this.z)),this}clampScalar(minVal,maxVal){ +return this.x=Math.max(minVal,Math.min(maxVal,this.x)),this.y=Math.max(minVal,Math. +min(maxVal,this.y)),this.z=Math.max(minVal,Math.min(maxVal,this.z)),this}clampLength(min,max2){ +let length=this.length();return this.divideScalar(length||1).multiplyScalar(Math. +max(min,Math.min(max2,length)))}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(v){ +return this.x*v.x+this.y*v.y+this.z*v.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(length){return this.normalize(). +multiplyScalar(length)}lerp(v,alpha){return this.x+=(v.x-this.x)*alpha,this.y+=(v. +y-this.y)*alpha,this.z+=(v.z-this.z)*alpha,this}lerpVectors(v1,v2,alpha){return this. +x=v1.x+(v2.x-v1.x)*alpha,this.y=v1.y+(v2.y-v1.y)*alpha,this.z=v1.z+(v2.z-v1.z)*alpha, +this}cross(v){return this.crossVectors(this,v)}crossVectors(a,b){let ax=a.x,ay=a. +y,az=a.z,bx=b.x,by=b.y,bz=b.z;return this.x=ay*bz-az*by,this.y=az*bx-ax*bz,this. +z=ax*by-ay*bx,this}projectOnVector(v){let denominator=v.lengthSq();if(denominator=== +0)return this.set(0,0,0);let scalar=v.dot(this)/denominator;return this.copy(v). +multiplyScalar(scalar)}projectOnPlane(planeNormal){return _vector$c.copy(this).projectOnVector( +planeNormal),this.sub(_vector$c)}reflect(normal){return this.sub(_vector$c.copy( +normal).multiplyScalar(2*this.dot(normal)))}angleTo(v){let denominator=Math.sqrt( +this.lengthSq()*v.lengthSq());if(denominator===0)return Math.PI/2;let theta=this. +dot(v)/denominator;return Math.acos(clamp2(theta,-1,1))}distanceTo(v){return Math. +sqrt(this.distanceToSquared(v))}distanceToSquared(v){let dx=this.x-v.x,dy=this.y- +v.y,dz=this.z-v.z;return dx*dx+dy*dy+dz*dz}manhattanDistanceTo(v){return Math.abs( +this.x-v.x)+Math.abs(this.y-v.y)+Math.abs(this.z-v.z)}setFromSpherical(s){return this. +setFromSphericalCoords(s.radius,s.phi,s.theta)}setFromSphericalCoords(radius,phi,theta){ +let sinPhiRadius=Math.sin(phi)*radius;return this.x=sinPhiRadius*Math.sin(theta), +this.y=Math.cos(phi)*radius,this.z=sinPhiRadius*Math.cos(theta),this}setFromCylindrical(c3){ +return this.setFromCylindricalCoords(c3.radius,c3.theta,c3.y)}setFromCylindricalCoords(radius,theta,y2){ +return this.x=radius*Math.sin(theta),this.y=y2,this.z=radius*Math.cos(theta),this}setFromMatrixPosition(m){ +let e=m.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(m){ +let sx=this.setFromMatrixColumn(m,0).length(),sy=this.setFromMatrixColumn(m,1).length(), +sz=this.setFromMatrixColumn(m,2).length();return this.x=sx,this.y=sy,this.z=sz,this}setFromMatrixColumn(m,index){ +return this.fromArray(m.elements,index*4)}setFromMatrix3Column(m,index){return this. +fromArray(m.elements,index*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this. +z=e._z,this}setFromColor(c3){return this.x=c3.r,this.y=c3.g,this.z=c3.b,this}equals(v){ +return v.x===this.x&&v.y===this.y&&v.z===this.z}fromArray(array,offset=0){return this. +x=array[offset],this.y=array[offset+1],this.z=array[offset+2],this}toArray(array=[],offset=0){ +return array[offset]=this.x,array[offset+1]=this.y,array[offset+2]=this.z,array}fromBufferAttribute(attribute2,index){ +return this.x=attribute2.getX(index),this.y=attribute2.getY(index),this.z=attribute2. +getZ(index),this}random(){return this.x=Math.random(),this.y=Math.random(),this. +z=Math.random(),this}randomDirection(){let u2=(Math.random()-.5)*2,t=Math.random()* +Math.PI*2,f=Math.sqrt(1-u2**2);return this.x=f*Math.cos(t),this.y=f*Math.sin(t), +this.z=u2,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},_vector$c=new Vector32, +_quaternion$4=new Quaternion2,Box32=class{static{__name(this,"Box3")}constructor(min=new Vector32( +1/0,1/0,1/0),max2=new Vector32(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=min,this. +max=max2}set(min,max2){return this.min.copy(min),this.max.copy(max2),this}setFromArray(array){ +this.makeEmpty();for(let i2=0,il=array.length;i2this.max.x||point.ythis.max.y||point. +zthis.max.z)}containsBox(box){return this.min.x<=box.min.x&& +box.max.x<=this.max.x&&this.min.y<=box.min.y&&box.max.y<=this.max.y&&this.min.z<= +box.min.z&&box.max.z<=this.max.z}getParameter(point,target){return target.set((point. +x-this.min.x)/(this.max.x-this.min.x),(point.y-this.min.y)/(this.max.y-this.min. +y),(point.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(box){return!(box. +max.xthis.max.x||box.max.ythis.max. +y||box.max.zthis.max.z)}intersectsSphere(sphere){return this. +clampPoint(sphere.center,_vector$b),_vector$b.distanceToSquared(sphere.center)<= +sphere.radius*sphere.radius}intersectsPlane(plane){let min,max2;return plane.normal. +x>0?(min=plane.normal.x*this.min.x,max2=plane.normal.x*this.max.x):(min=plane.normal. +x*this.max.x,max2=plane.normal.x*this.min.x),plane.normal.y>0?(min+=plane.normal. +y*this.min.y,max2+=plane.normal.y*this.max.y):(min+=plane.normal.y*this.max.y,max2+= +plane.normal.y*this.min.y),plane.normal.z>0?(min+=plane.normal.z*this.min.z,max2+= +plane.normal.z*this.max.z):(min+=plane.normal.z*this.max.z,max2+=plane.normal.z* +this.min.z),min<=-plane.constant&&max2>=-plane.constant}intersectsTriangle(triangle){ +if(this.isEmpty())return!1;this.getCenter(_center2),_extents2.subVectors(this.max, +_center2),_v0$2.subVectors(triangle.a,_center2),_v1$7.subVectors(triangle.b,_center2), +_v2$4.subVectors(triangle.c,_center2),_f02.subVectors(_v1$7,_v0$2),_f12.subVectors( +_v2$4,_v1$7),_f22.subVectors(_v0$2,_v2$4);let axes=[0,-_f02.z,_f02.y,0,-_f12.z,_f12. +y,0,-_f22.z,_f22.y,_f02.z,0,-_f02.x,_f12.z,0,-_f12.x,_f22.z,0,-_f22.x,-_f02.y,_f02. +x,0,-_f12.y,_f12.x,0,-_f22.y,_f22.x,0];return!satForAxes2(axes,_v0$2,_v1$7,_v2$4, +_extents2)||(axes=[1,0,0,0,1,0,0,0,1],!satForAxes2(axes,_v0$2,_v1$7,_v2$4,_extents2))? +!1:(_triangleNormal2.crossVectors(_f02,_f12),axes=[_triangleNormal2.x,_triangleNormal2. +y,_triangleNormal2.z],satForAxes2(axes,_v0$2,_v1$7,_v2$4,_extents2))}clampPoint(point,target){ +return target.copy(point).clamp(this.min,this.max)}distanceToPoint(point){return this. +clampPoint(point,_vector$b).distanceTo(point)}getBoundingSphere(target){return this. +isEmpty()?target.makeEmpty():(this.getCenter(target.center),target.radius=this.getSize( +_vector$b).length()*.5),target}intersect(box){return this.min.max(box.min),this. +max.min(box.max),this.isEmpty()&&this.makeEmpty(),this}union(box){return this.min. +min(box.min),this.max.max(box.max),this}applyMatrix4(matrix){return this.isEmpty()? +this:(_points2[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(matrix),_points2[1]. +set(this.min.x,this.min.y,this.max.z).applyMatrix4(matrix),_points2[2].set(this. +min.x,this.max.y,this.min.z).applyMatrix4(matrix),_points2[3].set(this.min.x,this. +max.y,this.max.z).applyMatrix4(matrix),_points2[4].set(this.max.x,this.min.y,this. +min.z).applyMatrix4(matrix),_points2[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4( +matrix),_points2[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(matrix),_points2[7]. +set(this.max.x,this.max.y,this.max.z).applyMatrix4(matrix),this.setFromPoints(_points2), +this)}translate(offset){return this.min.add(offset),this.max.add(offset),this}equals(box){ +return box.min.equals(this.min)&&box.max.equals(this.max)}},_points2=[new Vector32, +new Vector32,new Vector32,new Vector32,new Vector32,new Vector32,new Vector32,new Vector32], +_vector$b=new Vector32,_box$4=new Box32,_v0$2=new Vector32,_v1$7=new Vector32,_v2$4=new Vector32, +_f02=new Vector32,_f12=new Vector32,_f22=new Vector32,_center2=new Vector32,_extents2=new Vector32, +_triangleNormal2=new Vector32,_testAxis2=new Vector32;function satForAxes2(axes,v0,v1,v2,extents){ +for(let i2=0,j2=axes.length-3;i2<=j2;i2+=3){_testAxis2.fromArray(axes,i2);let r3=extents. +x*Math.abs(_testAxis2.x)+extents.y*Math.abs(_testAxis2.y)+extents.z*Math.abs(_testAxis2. +z),p0=v0.dot(_testAxis2),p1=v1.dot(_testAxis2),p2=v2.dot(_testAxis2);if(Math.max( +-Math.max(p0,p1,p2),Math.min(p0,p1,p2))>r3)return!1}return!0}__name(satForAxes2, +"satForAxes");var _box$3=new Box32,_v1$6=new Vector32,_v2$3=new Vector32,Sphere2=class{static{ +__name(this,"Sphere")}constructor(center=new Vector32,radius=-1){this.isSphere=!0, +this.center=center,this.radius=radius}set(center,radius){return this.center.copy( +center),this.radius=radius,this}setFromPoints(points,optionalCenter){let center=this. +center;optionalCenter!==void 0?center.copy(optionalCenter):_box$3.setFromPoints( +points).getCenter(center);let maxRadiusSq=0;for(let i2=0,il=points.length;i2this.radius*this. +radius&&(target.sub(this.center).normalize(),target.multiplyScalar(this.radius). +add(this.center)),target}getBoundingBox(target){return this.isEmpty()?(target.makeEmpty(), +target):(target.set(this.center,this.center),target.expandByScalar(this.radius), +target)}applyMatrix4(matrix){return this.center.applyMatrix4(matrix),this.radius= +this.radius*matrix.getMaxScaleOnAxis(),this}translate(offset){return this.center. +add(offset),this}expandByPoint(point){if(this.isEmpty())return this.center.copy( +point),this.radius=0,this;_v1$6.subVectors(point,this.center);let lengthSq=_v1$6. +lengthSq();if(lengthSq>this.radius*this.radius){let length=Math.sqrt(lengthSq),delta=(length- +this.radius)*.5;this.center.addScaledVector(_v1$6,delta/length),this.radius+=delta} +return this}union(sphere){return sphere.isEmpty()?this:this.isEmpty()?(this.copy( +sphere),this):(this.center.equals(sphere.center)===!0?this.radius=Math.max(this. +radius,sphere.radius):(_v2$3.subVectors(sphere.center,this.center).setLength(sphere. +radius),this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3)),this.expandByPoint( +_v1$6.copy(sphere.center).sub(_v2$3))),this)}equals(sphere){return sphere.center. +equals(this.center)&&sphere.radius===this.radius}clone(){return new this.constructor(). +copy(this)}},_vector$a=new Vector32,_segCenter2=new Vector32,_segDir2=new Vector32, +_diff2=new Vector32,_edge12=new Vector32,_edge22=new Vector32,_normal$1=new Vector32, +Ray2=class{static{__name(this,"Ray")}constructor(origin2=new Vector32,direction=new Vector32( +0,0,-1)){this.origin=origin2,this.direction=direction}set(origin2,direction){return this. +origin.copy(origin2),this.direction.copy(direction),this}copy(ray){return this.origin. +copy(ray.origin),this.direction.copy(ray.direction),this}at(t,target){return target. +copy(this.origin).addScaledVector(this.direction,t)}lookAt(v){return this.direction. +copy(v).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this. +at(t,_vector$a)),this}closestPointToPoint(point,target){target.subVectors(point, +this.origin);let directionDistance=target.dot(this.direction);return directionDistance< +0?target.copy(this.origin):target.copy(this.origin).addScaledVector(this.direction, +directionDistance)}distanceToPoint(point){return Math.sqrt(this.distanceSqToPoint( +point))}distanceSqToPoint(point){let directionDistance=_vector$a.subVectors(point, +this.origin).dot(this.direction);return directionDistance<0?this.origin.distanceToSquared( +point):(_vector$a.copy(this.origin).addScaledVector(this.direction,directionDistance), +_vector$a.distanceToSquared(point))}distanceSqToSegment(v0,v1,optionalPointOnRay,optionalPointOnSegment){ +_segCenter2.copy(v0).add(v1).multiplyScalar(.5),_segDir2.copy(v1).sub(v0).normalize(), +_diff2.copy(this.origin).sub(_segCenter2);let segExtent=v0.distanceTo(v1)*.5,a01=-this. +direction.dot(_segDir2),b0=_diff2.dot(this.direction),b1=-_diff2.dot(_segDir2),c3=_diff2. +lengthSq(),det=Math.abs(1-a01*a01),s0,s1,sqrDist,extDet;if(det>0)if(s0=a01*b1-b0, +s1=a01*b0-b1,extDet=segExtent*det,s0>=0)if(s1>=-extDet)if(s1<=extDet){let invDet=1/ +det;s0*=invDet,s1*=invDet,sqrDist=s0*(s0+a01*s1+2*b0)+s1*(a01*s0+s1+2*b1)+c3}else +s1=segExtent,s0=Math.max(0,-(a01*s1+b0)),sqrDist=-s0*s0+s1*(s1+2*b1)+c3;else s1= +-segExtent,s0=Math.max(0,-(a01*s1+b0)),sqrDist=-s0*s0+s1*(s1+2*b1)+c3;else s1<=-extDet? +(s0=Math.max(0,-(-a01*segExtent+b0)),s1=s0>0?-segExtent:Math.min(Math.max(-segExtent, +-b1),segExtent),sqrDist=-s0*s0+s1*(s1+2*b1)+c3):s1<=extDet?(s0=0,s1=Math.min(Math. +max(-segExtent,-b1),segExtent),sqrDist=s1*(s1+2*b1)+c3):(s0=Math.max(0,-(a01*segExtent+ +b0)),s1=s0>0?segExtent:Math.min(Math.max(-segExtent,-b1),segExtent),sqrDist=-s0* +s0+s1*(s1+2*b1)+c3);else s1=a01>0?-segExtent:segExtent,s0=Math.max(0,-(a01*s1+b0)), +sqrDist=-s0*s0+s1*(s1+2*b1)+c3;return optionalPointOnRay&&optionalPointOnRay.copy( +this.origin).addScaledVector(this.direction,s0),optionalPointOnSegment&&optionalPointOnSegment. +copy(_segCenter2).addScaledVector(_segDir2,s1),sqrDist}intersectSphere(sphere,target){ +_vector$a.subVectors(sphere.center,this.origin);let tca=_vector$a.dot(this.direction), +d2=_vector$a.dot(_vector$a)-tca*tca,radius2=sphere.radius*sphere.radius;if(d2>radius2) +return null;let thc=Math.sqrt(radius2-d2),t0=tca-thc,t1=tca+thc;return t1<0?null: +t0<0?this.at(t1,target):this.at(t0,target)}intersectsSphere(sphere){return this. +distanceSqToPoint(sphere.center)<=sphere.radius*sphere.radius}distanceToPlane(plane){ +let denominator=plane.normal.dot(this.direction);if(denominator===0)return plane. +distanceToPoint(this.origin)===0?0:null;let t=-(this.origin.dot(plane.normal)+plane. +constant)/denominator;return t>=0?t:null}intersectPlane(plane,target){let t=this. +distanceToPlane(plane);return t===null?null:this.at(t,target)}intersectsPlane(plane){ +let distToPoint=plane.distanceToPoint(this.origin);return distToPoint===0||plane. +normal.dot(this.direction)*distToPoint<0}intersectBox(box,target){let tmin,tmax, +tymin,tymax,tzmin,tzmax,invdirx=1/this.direction.x,invdiry=1/this.direction.y,invdirz=1/ +this.direction.z,origin2=this.origin;return invdirx>=0?(tmin=(box.min.x-origin2. +x)*invdirx,tmax=(box.max.x-origin2.x)*invdirx):(tmin=(box.max.x-origin2.x)*invdirx, +tmax=(box.min.x-origin2.x)*invdirx),invdiry>=0?(tymin=(box.min.y-origin2.y)*invdiry, +tymax=(box.max.y-origin2.y)*invdiry):(tymin=(box.max.y-origin2.y)*invdiry,tymax= +(box.min.y-origin2.y)*invdiry),tmin>tymax||tymin>tmax||((tymin>tmin||isNaN(tmin))&& +(tmin=tymin),(tymax=0?(tzmin=(box.min. +z-origin2.z)*invdirz,tzmax=(box.max.z-origin2.z)*invdirz):(tzmin=(box.max.z-origin2. +z)*invdirz,tzmax=(box.min.z-origin2.z)*invdirz),tmin>tzmax||tzmin>tmax)||((tzmin> +tmin||tmin!==tmin)&&(tmin=tzmin),(tzmax=0?tmin:tmax,target)}intersectsBox(box){return this.intersectBox( +box,_vector$a)!==null}intersectTriangle(a,b,c3,backfaceCulling,target){_edge12.subVectors( +b,a),_edge22.subVectors(c3,a),_normal$1.crossVectors(_edge12,_edge22);let DdN=this. +direction.dot(_normal$1),sign3;if(DdN>0){if(backfaceCulling)return null;sign3=1}else if(DdN< +0)sign3=-1,DdN=-DdN;else return null;_diff2.subVectors(this.origin,a);let DdQxE2=sign3* +this.direction.dot(_edge22.crossVectors(_diff2,_edge22));if(DdQxE2<0)return null; +let DdE1xQ=sign3*this.direction.dot(_edge12.cross(_diff2));if(DdE1xQ<0||DdQxE2+DdE1xQ> +DdN)return null;let QdN=-sign3*_diff2.dot(_normal$1);return QdN<0?null:this.at(QdN/ +DdN,target)}applyMatrix4(matrix4){return this.origin.applyMatrix4(matrix4),this. +direction.transformDirection(matrix4),this}equals(ray){return ray.origin.equals( +this.origin)&&ray.direction.equals(this.direction)}clone(){return new this.constructor(). +copy(this)}},Matrix42=class _Matrix4{static{__name(this,"Matrix4")}constructor(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){ +_Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], +n11!==void 0&&this.set(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43, +n44)}set(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){let te=this. +elements;return te[0]=n11,te[4]=n12,te[8]=n13,te[12]=n14,te[1]=n21,te[5]=n22,te[9]= +n23,te[13]=n24,te[2]=n31,te[6]=n32,te[10]=n33,te[14]=n34,te[3]=n41,te[7]=n42,te[11]= +n43,te[15]=n44,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 _Matrix4().fromArray(this.elements)}copy(m){let te=this. +elements,me=m.elements;return te[0]=me[0],te[1]=me[1],te[2]=me[2],te[3]=me[3],te[4]= +me[4],te[5]=me[5],te[6]=me[6],te[7]=me[7],te[8]=me[8],te[9]=me[9],te[10]=me[10], +te[11]=me[11],te[12]=me[12],te[13]=me[13],te[14]=me[14],te[15]=me[15],this}copyPosition(m){ +let te=this.elements,me=m.elements;return te[12]=me[12],te[13]=me[13],te[14]=me[14], +this}setFromMatrix3(m){let me=m.elements;return this.set(me[0],me[3],me[6],0,me[1], +me[4],me[7],0,me[2],me[5],me[8],0,0,0,0,1),this}extractBasis(xAxis,yAxis,zAxis){ +return xAxis.setFromMatrixColumn(this,0),yAxis.setFromMatrixColumn(this,1),zAxis. +setFromMatrixColumn(this,2),this}makeBasis(xAxis,yAxis,zAxis){return this.set(xAxis. +x,yAxis.x,zAxis.x,0,xAxis.y,yAxis.y,zAxis.y,0,xAxis.z,yAxis.z,zAxis.z,0,0,0,0,1), +this}extractRotation(m){let te=this.elements,me=m.elements,scaleX=1/_v1$5.setFromMatrixColumn( +m,0).length(),scaleY=1/_v1$5.setFromMatrixColumn(m,1).length(),scaleZ=1/_v1$5.setFromMatrixColumn( +m,2).length();return te[0]=me[0]*scaleX,te[1]=me[1]*scaleX,te[2]=me[2]*scaleX,te[3]= +0,te[4]=me[4]*scaleY,te[5]=me[5]*scaleY,te[6]=me[6]*scaleY,te[7]=0,te[8]=me[8]*scaleZ, +te[9]=me[9]*scaleZ,te[10]=me[10]*scaleZ,te[11]=0,te[12]=0,te[13]=0,te[14]=0,te[15]= +1,this}makeRotationFromEuler(euler){let te=this.elements,x2=euler.x,y2=euler.y,z2=euler. +z,a=Math.cos(x2),b=Math.sin(x2),c3=Math.cos(y2),d2=Math.sin(y2),e=Math.cos(z2),f=Math. +sin(z2);if(euler.order==="XYZ"){let ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c3*e,te[4]= +-c3*f,te[8]=d2,te[1]=af+be*d2,te[5]=ae-bf*d2,te[9]=-b*c3,te[2]=bf-ae*d2,te[6]=be+ +af*d2,te[10]=a*c3}else if(euler.order==="YXZ"){let ce=c3*e,cf=c3*f,de=d2*e,df=d2* +f;te[0]=ce+df*b,te[4]=de*b-cf,te[8]=a*d2,te[1]=a*f,te[5]=a*e,te[9]=-b,te[2]=cf*b- +de,te[6]=df+ce*b,te[10]=a*c3}else if(euler.order==="ZXY"){let ce=c3*e,cf=c3*f,de=d2* +e,df=d2*f;te[0]=ce-df*b,te[4]=-a*f,te[8]=de+cf*b,te[1]=cf+de*b,te[5]=a*e,te[9]=df- +ce*b,te[2]=-a*d2,te[6]=b,te[10]=a*c3}else if(euler.order==="ZYX"){let ae=a*e,af=a* +f,be=b*e,bf=b*f;te[0]=c3*e,te[4]=be*d2-af,te[8]=ae*d2+bf,te[1]=c3*f,te[5]=bf*d2+ +ae,te[9]=af*d2-be,te[2]=-d2,te[6]=b*c3,te[10]=a*c3}else if(euler.order==="YZX"){ +let ac=a*c3,ad=a*d2,bc=b*c3,bd=b*d2;te[0]=c3*e,te[4]=bd-ac*f,te[8]=bc*f+ad,te[1]= +f,te[5]=a*e,te[9]=-b*e,te[2]=-d2*e,te[6]=ad*f+bc,te[10]=ac-bd*f}else if(euler.order=== +"XZY"){let ac=a*c3,ad=a*d2,bc=b*c3,bd=b*d2;te[0]=c3*e,te[4]=-f,te[8]=d2*e,te[1]= +ac*f+bd,te[5]=a*e,te[9]=ad*f-bc,te[2]=bc*f-ad,te[6]=b*e,te[10]=bd*f+ac}return te[3]= +0,te[7]=0,te[11]=0,te[12]=0,te[13]=0,te[14]=0,te[15]=1,this}makeRotationFromQuaternion(q2){ +return this.compose(_zero2,q2,_one2)}lookAt(eye,target,up){let te=this.elements; +return _z2.subVectors(eye,target),_z2.lengthSq()===0&&(_z2.z=1),_z2.normalize(), +_x2.crossVectors(up,_z2),_x2.lengthSq()===0&&(Math.abs(up.z)===1?_z2.x+=1e-4:_z2. +z+=1e-4,_z2.normalize(),_x2.crossVectors(up,_z2)),_x2.normalize(),_y2.crossVectors( +_z2,_x2),te[0]=_x2.x,te[4]=_y2.x,te[8]=_z2.x,te[1]=_x2.y,te[5]=_y2.y,te[9]=_z2.y, +te[2]=_x2.z,te[6]=_y2.z,te[10]=_z2.z,this}multiply(m){return this.multiplyMatrices( +this,m)}premultiply(m){return this.multiplyMatrices(m,this)}multiplyMatrices(a,b){ +let ae=a.elements,be=b.elements,te=this.elements,a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12], +a21=ae[1],a22=ae[5],a23=ae[9],a24=ae[13],a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14], +a41=ae[3],a42=ae[7],a43=ae[11],a44=ae[15],b11=be[0],b12=be[4],b13=be[8],b14=be[12], +b21=be[1],b22=be[5],b23=be[9],b24=be[13],b31=be[2],b32=be[6],b33=be[10],b34=be[14], +b41=be[3],b42=be[7],b43=be[11],b44=be[15];return te[0]=a11*b11+a12*b21+a13*b31+a14* +b41,te[4]=a11*b12+a12*b22+a13*b32+a14*b42,te[8]=a11*b13+a12*b23+a13*b33+a14*b43, +te[12]=a11*b14+a12*b24+a13*b34+a14*b44,te[1]=a21*b11+a22*b21+a23*b31+a24*b41,te[5]= +a21*b12+a22*b22+a23*b32+a24*b42,te[9]=a21*b13+a22*b23+a23*b33+a24*b43,te[13]=a21* +b14+a22*b24+a23*b34+a24*b44,te[2]=a31*b11+a32*b21+a33*b31+a34*b41,te[6]=a31*b12+ +a32*b22+a33*b32+a34*b42,te[10]=a31*b13+a32*b23+a33*b33+a34*b43,te[14]=a31*b14+a32* +b24+a33*b34+a34*b44,te[3]=a41*b11+a42*b21+a43*b31+a44*b41,te[7]=a41*b12+a42*b22+ +a43*b32+a44*b42,te[11]=a41*b13+a42*b23+a43*b33+a44*b43,te[15]=a41*b14+a42*b24+a43* +b34+a44*b44,this}multiplyScalar(s){let te=this.elements;return te[0]*=s,te[4]*=s, +te[8]*=s,te[12]*=s,te[1]*=s,te[5]*=s,te[9]*=s,te[13]*=s,te[2]*=s,te[6]*=s,te[10]*= +s,te[14]*=s,te[3]*=s,te[7]*=s,te[11]*=s,te[15]*=s,this}determinant(){let te=this. +elements,n11=te[0],n12=te[4],n13=te[8],n14=te[12],n21=te[1],n22=te[5],n23=te[9], +n24=te[13],n31=te[2],n32=te[6],n33=te[10],n34=te[14],n41=te[3],n42=te[7],n43=te[11], +n44=te[15];return n41*(+n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22* +n34-n12*n23*n34)+n42*(+n11*n23*n34-n11*n24*n33+n14*n21*n33-n13*n21*n34+n13*n24*n31- +n14*n23*n31)+n43*(+n11*n24*n32-n11*n22*n34-n14*n21*n32+n12*n21*n34+n14*n22*n31-n12* +n24*n31)+n44*(-n13*n22*n31-n11*n23*n32+n11*n22*n33+n13*n21*n32-n12*n21*n33+n12*n23* +n31)}transpose(){let te=this.elements,tmp2;return tmp2=te[1],te[1]=te[4],te[4]=tmp2, +tmp2=te[2],te[2]=te[8],te[8]=tmp2,tmp2=te[6],te[6]=te[9],te[9]=tmp2,tmp2=te[3],te[3]= +te[12],te[12]=tmp2,tmp2=te[7],te[7]=te[13],te[13]=tmp2,tmp2=te[11],te[11]=te[14], +te[14]=tmp2,this}setPosition(x2,y2,z2){let te=this.elements;return x2.isVector3? +(te[12]=x2.x,te[13]=x2.y,te[14]=x2.z):(te[12]=x2,te[13]=y2,te[14]=z2),this}invert(){ +let te=this.elements,n11=te[0],n21=te[1],n31=te[2],n41=te[3],n12=te[4],n22=te[5], +n32=te[6],n42=te[7],n13=te[8],n23=te[9],n33=te[10],n43=te[11],n14=te[12],n24=te[13], +n34=te[14],n44=te[15],t11=n23*n34*n42-n24*n33*n42+n24*n32*n43-n22*n34*n43-n23*n32* +n44+n22*n33*n44,t12=n14*n33*n42-n13*n34*n42-n14*n32*n43+n12*n34*n43+n13*n32*n44- +n12*n33*n44,t13=n13*n24*n42-n14*n23*n42+n14*n22*n43-n12*n24*n43-n13*n22*n44+n12* +n23*n44,t14=n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23* +n34,det=n11*t11+n21*t12+n31*t13+n41*t14;if(det===0)return this.set(0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0);let detInv=1/det;return te[0]=t11*detInv,te[1]=(n24*n33*n41-n23* +n34*n41-n24*n31*n43+n21*n34*n43+n23*n31*n44-n21*n33*n44)*detInv,te[2]=(n22*n34*n41- +n24*n32*n41+n24*n31*n42-n21*n34*n42-n22*n31*n44+n21*n32*n44)*detInv,te[3]=(n23*n32* +n41-n22*n33*n41-n23*n31*n42+n21*n33*n42+n22*n31*n43-n21*n32*n43)*detInv,te[4]=t12* +detInv,te[5]=(n13*n34*n41-n14*n33*n41+n14*n31*n43-n11*n34*n43-n13*n31*n44+n11*n33* +n44)*detInv,te[6]=(n14*n32*n41-n12*n34*n41-n14*n31*n42+n11*n34*n42+n12*n31*n44-n11* +n32*n44)*detInv,te[7]=(n12*n33*n41-n13*n32*n41+n13*n31*n42-n11*n33*n42-n12*n31*n43+ +n11*n32*n43)*detInv,te[8]=t13*detInv,te[9]=(n14*n23*n41-n13*n24*n41-n14*n21*n43+ +n11*n24*n43+n13*n21*n44-n11*n23*n44)*detInv,te[10]=(n12*n24*n41-n14*n22*n41+n14* +n21*n42-n11*n24*n42-n12*n21*n44+n11*n22*n44)*detInv,te[11]=(n13*n22*n41-n12*n23* +n41-n13*n21*n42+n11*n23*n42+n12*n21*n43-n11*n22*n43)*detInv,te[12]=t14*detInv,te[13]= +(n13*n24*n31-n14*n23*n31+n14*n21*n33-n11*n24*n33-n13*n21*n34+n11*n23*n34)*detInv, +te[14]=(n14*n22*n31-n12*n24*n31-n14*n21*n32+n11*n24*n32+n12*n21*n34-n11*n22*n34)* +detInv,te[15]=(n12*n23*n31-n13*n22*n31+n13*n21*n32-n11*n23*n32-n12*n21*n33+n11*n22* +n33)*detInv,this}scale(v){let te=this.elements,x2=v.x,y2=v.y,z2=v.z;return te[0]*= +x2,te[4]*=y2,te[8]*=z2,te[1]*=x2,te[5]*=y2,te[9]*=z2,te[2]*=x2,te[6]*=y2,te[10]*= +z2,te[3]*=x2,te[7]*=y2,te[11]*=z2,this}getMaxScaleOnAxis(){let te=this.elements, +scaleXSq=te[0]*te[0]+te[1]*te[1]+te[2]*te[2],scaleYSq=te[4]*te[4]+te[5]*te[5]+te[6]* +te[6],scaleZSq=te[8]*te[8]+te[9]*te[9]+te[10]*te[10];return Math.sqrt(Math.max(scaleXSq, +scaleYSq,scaleZSq))}makeTranslation(x2,y2,z2){return x2.isVector3?this.set(1,0,0, +x2.x,0,1,0,x2.y,0,0,1,x2.z,0,0,0,1):this.set(1,0,0,x2,0,1,0,y2,0,0,1,z2,0,0,0,1), +this}makeRotationX(theta){let c3=Math.cos(theta),s=Math.sin(theta);return this.set( +1,0,0,0,0,c3,-s,0,0,s,c3,0,0,0,0,1),this}makeRotationY(theta){let c3=Math.cos(theta), +s=Math.sin(theta);return this.set(c3,0,s,0,0,1,0,0,-s,0,c3,0,0,0,0,1),this}makeRotationZ(theta){ +let c3=Math.cos(theta),s=Math.sin(theta);return this.set(c3,-s,0,0,s,c3,0,0,0,0, +1,0,0,0,0,1),this}makeRotationAxis(axis,angle){let c3=Math.cos(angle),s=Math.sin( +angle),t=1-c3,x2=axis.x,y2=axis.y,z2=axis.z,tx=t*x2,ty=t*y2;return this.set(tx*x2+ +c3,tx*y2-s*z2,tx*z2+s*y2,0,tx*y2+s*z2,ty*y2+c3,ty*z2-s*x2,0,tx*z2-s*y2,ty*z2+s*x2, +t*z2*z2+c3,0,0,0,0,1),this}makeScale(x2,y2,z2){return this.set(x2,0,0,0,0,y2,0,0, +0,0,z2,0,0,0,0,1),this}makeShear(xy,xz,yx,yz,zx,zy){return this.set(1,yx,zx,0,xy, +1,zy,0,xz,yz,1,0,0,0,0,1),this}compose(position2,quaternion,scale2){let te=this. +elements,x2=quaternion._x,y2=quaternion._y,z2=quaternion._z,w2=quaternion._w,x22=x2+ +x2,y22=y2+y2,z22=z2+z2,xx=x2*x22,xy=x2*y22,xz=x2*z22,yy=y2*y22,yz=y2*z22,zz=z2*z22, +wx=w2*x22,wy=w2*y22,wz=w2*z22,sx=scale2.x,sy=scale2.y,sz=scale2.z;return te[0]=(1- +(yy+zz))*sx,te[1]=(xy+wz)*sx,te[2]=(xz-wy)*sx,te[3]=0,te[4]=(xy-wz)*sy,te[5]=(1- +(xx+zz))*sy,te[6]=(yz+wx)*sy,te[7]=0,te[8]=(xz+wy)*sz,te[9]=(yz-wx)*sz,te[10]=(1- +(xx+yy))*sz,te[11]=0,te[12]=position2.x,te[13]=position2.y,te[14]=position2.z,te[15]= +1,this}decompose(position2,quaternion,scale2){let te=this.elements,sx=_v1$5.set( +te[0],te[1],te[2]).length(),sy=_v1$5.set(te[4],te[5],te[6]).length(),sz=_v1$5.set( +te[8],te[9],te[10]).length();this.determinant()<0&&(sx=-sx),position2.x=te[12],position2. +y=te[13],position2.z=te[14],_m1$2.copy(this);let invSX=1/sx,invSY=1/sy,invSZ=1/sz; +return _m1$2.elements[0]*=invSX,_m1$2.elements[1]*=invSX,_m1$2.elements[2]*=invSX, +_m1$2.elements[4]*=invSY,_m1$2.elements[5]*=invSY,_m1$2.elements[6]*=invSY,_m1$2. +elements[8]*=invSZ,_m1$2.elements[9]*=invSZ,_m1$2.elements[10]*=invSZ,quaternion. +setFromRotationMatrix(_m1$2),scale2.x=sx,scale2.y=sy,scale2.z=sz,this}makePerspective(left,right,top,bottom,near,far,coordinateSystem=WebGLCoordinateSystem2){ +let te=this.elements,x2=2*near/(right-left),y2=2*near/(top-bottom),a=(right+left)/ +(right-left),b=(top+bottom)/(top-bottom),c3,d2;if(coordinateSystem===WebGLCoordinateSystem2) +c3=-(far+near)/(far-near),d2=-2*far*near/(far-near);else if(coordinateSystem===WebGPUCoordinateSystem2) +c3=-far/(far-near),d2=-far*near/(far-near);else throw new Error("THREE.Matrix4.m\ +akePerspective(): Invalid coordinate system: "+coordinateSystem);return te[0]=x2, +te[4]=0,te[8]=a,te[12]=0,te[1]=0,te[5]=y2,te[9]=b,te[13]=0,te[2]=0,te[6]=0,te[10]= +c3,te[14]=d2,te[3]=0,te[7]=0,te[11]=-1,te[15]=0,this}makeOrthographic(left,right,top,bottom,near,far,coordinateSystem=WebGLCoordinateSystem2){ +let te=this.elements,w2=1/(right-left),h=1/(top-bottom),p2=1/(far-near),x2=(right+ +left)*w2,y2=(top+bottom)*h,z2,zInv;if(coordinateSystem===WebGLCoordinateSystem2) +z2=(far+near)*p2,zInv=-2*p2;else if(coordinateSystem===WebGPUCoordinateSystem2)z2= +near*p2,zInv=-1*p2;else throw new Error("THREE.Matrix4.makeOrthographic(): Inval\ +id coordinate system: "+coordinateSystem);return te[0]=2*w2,te[4]=0,te[8]=0,te[12]= +-x2,te[1]=0,te[5]=2*h,te[9]=0,te[13]=-y2,te[2]=0,te[6]=0,te[10]=zInv,te[14]=-z2, +te[3]=0,te[7]=0,te[11]=0,te[15]=1,this}equals(matrix){let te=this.elements,me=matrix. +elements;for(let i2=0;i2<16;i2++)if(te[i2]!==me[i2])return!1;return!0}fromArray(array,offset=0){ +for(let i2=0;i2<16;i2++)this.elements[i2]=array[i2+offset];return this}toArray(array=[],offset=0){ +let te=this.elements;return array[offset]=te[0],array[offset+1]=te[1],array[offset+ +2]=te[2],array[offset+3]=te[3],array[offset+4]=te[4],array[offset+5]=te[5],array[offset+ +6]=te[6],array[offset+7]=te[7],array[offset+8]=te[8],array[offset+9]=te[9],array[offset+ +10]=te[10],array[offset+11]=te[11],array[offset+12]=te[12],array[offset+13]=te[13], +array[offset+14]=te[14],array[offset+15]=te[15],array}},_v1$5=new Vector32,_m1$2=new Matrix42, +_zero2=new Vector32(0,0,0),_one2=new Vector32(1,1,1),_x2=new Vector32,_y2=new Vector32, +_z2=new Vector32,_matrix$1=new Matrix42,_quaternion$3=new Quaternion2,Euler2=class _Euler{static{ +__name(this,"Euler")}constructor(x2=0,y2=0,z2=0,order=_Euler.DEFAULT_ORDER){this. +isEuler=!0,this._x=x2,this._y=y2,this._z=z2,this._order=order}get x(){return this. +_x}set x(value){this._x=value,this._onChangeCallback()}get y(){return this._y}set y(value){ +this._y=value,this._onChangeCallback()}get z(){return this._z}set z(value){this. +_z=value,this._onChangeCallback()}get order(){return this._order}set order(value){ +this._order=value,this._onChangeCallback()}set(x2,y2,z2,order=this._order){return this. +_x=x2,this._y=y2,this._z=z2,this._order=order,this._onChangeCallback(),this}clone(){ +return new this.constructor(this._x,this._y,this._z,this._order)}copy(euler){return this. +_x=euler._x,this._y=euler._y,this._z=euler._z,this._order=euler._order,this._onChangeCallback(), +this}setFromRotationMatrix(m,order=this._order,update=!0){let te=m.elements,m11=te[0], +m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10]; +switch(order){case"XYZ":this._y=Math.asin(clamp2(m13,-1,1)),Math.abs(m13)<.9999999? +(this._x=Math.atan2(-m23,m33),this._z=Math.atan2(-m12,m11)):(this._x=Math.atan2( +m32,m22),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp2(m23,-1,1)),Math.abs( +m23)<.9999999?(this._y=Math.atan2(m13,m33),this._z=Math.atan2(m21,m22)):(this._y= +Math.atan2(-m31,m11),this._z=0);break;case"ZXY":this._x=Math.asin(clamp2(m32,-1, +1)),Math.abs(m32)<.9999999?(this._y=Math.atan2(-m31,m33),this._z=Math.atan2(-m12, +m22)):(this._y=0,this._z=Math.atan2(m21,m11));break;case"ZYX":this._y=Math.asin( +-clamp2(m31,-1,1)),Math.abs(m31)<.9999999?(this._x=Math.atan2(m32,m33),this._z=Math. +atan2(m21,m11)):(this._x=0,this._z=Math.atan2(-m12,m22));break;case"YZX":this._z= +Math.asin(clamp2(m21,-1,1)),Math.abs(m21)<.9999999?(this._x=Math.atan2(-m23,m22), +this._y=Math.atan2(-m31,m11)):(this._x=0,this._y=Math.atan2(m13,m33));break;case"\ +XZY":this._z=Math.asin(-clamp2(m12,-1,1)),Math.abs(m12)<.9999999?(this._x=Math.atan2( +m32,m22),this._y=Math.atan2(m13,m11)):(this._x=Math.atan2(-m23,m33),this._y=0);break;default: +console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order\ +: "+order)}return this._order=order,update===!0&&this._onChangeCallback(),this}setFromQuaternion(q2,order,update){ +return _matrix$1.makeRotationFromQuaternion(q2),this.setFromRotationMatrix(_matrix$1, +order,update)}setFromVector3(v,order=this._order){return this.set(v.x,v.y,v.z,order)}reorder(newOrder){ +return _quaternion$3.setFromEuler(this),this.setFromQuaternion(_quaternion$3,newOrder)}equals(euler){ +return euler._x===this._x&&euler._y===this._y&&euler._z===this._z&&euler._order=== +this._order}fromArray(array){return this._x=array[0],this._y=array[1],this._z=array[2], +array[3]!==void 0&&(this._order=array[3]),this._onChangeCallback(),this}toArray(array=[],offset=0){ +return array[offset]=this._x,array[offset+1]=this._y,array[offset+2]=this._z,array[offset+ +3]=this._order,array}_onChange(callback){return this._onChangeCallback=callback, +this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this. +_z,yield this._order}};Euler2.DEFAULT_ORDER="XYZ";var Layers2=class{static{__name( +this,"Layers")}constructor(){this.mask=1}set(channel){this.mask=(1<>> +0}enable(channel){this.mask|=1<1){for(let i2=0;i21){for(let i2=0;i20&&(object.userData=this.userData),object.layers=this.layers.mask, +object.matrix=this.matrix.toArray(),object.up=this.up.toArray(),this.matrixAutoUpdate=== +!1&&(object.matrixAutoUpdate=!1),this.isInstancedMesh&&(object.type="InstancedMe\ +sh",object.count=this.count,object.instanceMatrix=this.instanceMatrix.toJSON(),this. +instanceColor!==null&&(object.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&& +(object.type="BatchedMesh",object.perObjectFrustumCulled=this.perObjectFrustumCulled, +object.sortObjects=this.sortObjects,object.drawRanges=this._drawRanges,object.reservedRanges= +this._reservedRanges,object.visibility=this._visibility,object.active=this._active, +object.bounds=this._bounds.map(bound=>({boxInitialized:bound.boxInitialized,boxMin:bound. +box.min.toArray(),boxMax:bound.box.max.toArray(),sphereInitialized:bound.sphereInitialized, +sphereRadius:bound.sphere.radius,sphereCenter:bound.sphere.center.toArray()})),object. +maxGeometryCount=this._maxGeometryCount,object.maxVertexCount=this._maxVertexCount, +object.maxIndexCount=this._maxIndexCount,object.geometryInitialized=this._geometryInitialized, +object.geometryCount=this._geometryCount,object.matricesTexture=this._matricesTexture. +toJSON(meta),this.boundingSphere!==null&&(object.boundingSphere={center:object.boundingSphere. +center.toArray(),radius:object.boundingSphere.radius}),this.boundingBox!==null&& +(object.boundingBox={min:object.boundingBox.min.toArray(),max:object.boundingBox. +max.toArray()}));function serialize(library,element2){return library[element2.uuid]=== +void 0&&(library[element2.uuid]=element2.toJSON(meta)),element2.uuid}if(__name(serialize, +"serialize"),this.isScene)this.background&&(this.background.isColor?object.background= +this.background.toJSON():this.background.isTexture&&(object.background=this.background. +toJSON(meta).uuid)),this.environment&&this.environment.isTexture&&this.environment. +isRenderTargetTexture!==!0&&(object.environment=this.environment.toJSON(meta).uuid);else if(this. +isMesh||this.isLine||this.isPoints){object.geometry=serialize(meta.geometries,this. +geometry);let parameters=this.geometry.parameters;if(parameters!==void 0&¶meters. +shapes!==void 0){let shapes=parameters.shapes;if(Array.isArray(shapes))for(let i2=0, +l=shapes.length;i2 +0){object.children=[];for(let i2=0;i20){object. +animations=[];for(let i2=0;i20&&(output.geometries= +geometries),materials.length>0&&(output.materials=materials),textures.length>0&& +(output.textures=textures),images.length>0&&(output.images=images),shapes.length> +0&&(output.shapes=shapes),skeletons.length>0&&(output.skeletons=skeletons),animations. +length>0&&(output.animations=animations),nodes.length>0&&(output.nodes=nodes)}return output. +object=object,output;function extractFromCache(cache2){let values=[];for(let key2 in cache2){ +let data=cache2[key2];delete data.metadata,values.push(data)}return values}__name( +extractFromCache,"extractFromCache")}clone(recursive){return new this.constructor(). +copy(this,recursive)}copy(source,recursive=!0){if(this.name=source.name,this.up. +copy(source.up),this.position.copy(source.position),this.rotation.order=source.rotation. +order,this.quaternion.copy(source.quaternion),this.scale.copy(source.scale),this. +matrix.copy(source.matrix),this.matrixWorld.copy(source.matrixWorld),this.matrixAutoUpdate= +source.matrixAutoUpdate,this.matrixWorldAutoUpdate=source.matrixWorldAutoUpdate, +this.matrixWorldNeedsUpdate=source.matrixWorldNeedsUpdate,this.layers.mask=source. +layers.mask,this.visible=source.visible,this.castShadow=source.castShadow,this.receiveShadow= +source.receiveShadow,this.frustumCulled=source.frustumCulled,this.renderOrder=source. +renderOrder,this.animations=source.animations.slice(),this.userData=JSON.parse(JSON. +stringify(source.userData)),recursive===!0)for(let i2=0;i2 +0?target.multiplyScalar(1/Math.sqrt(targetLengthSq)):target.set(0,0,0)}static getBarycoord(point,a,b,c3,target){ +_v0$1.subVectors(c3,a),_v1$3.subVectors(b,a),_v2$2.subVectors(point,a);let dot00=_v0$1. +dot(_v0$1),dot01=_v0$1.dot(_v1$3),dot02=_v0$1.dot(_v2$2),dot11=_v1$3.dot(_v1$3), +dot12=_v1$3.dot(_v2$2),denom=dot00*dot11-dot01*dot01;if(denom===0)return target. +set(0,0,0),null;let invDenom=1/denom,u2=(dot11*dot02-dot01*dot12)*invDenom,v=(dot00* +dot12-dot01*dot02)*invDenom;return target.set(1-u2-v,v,u2)}static containsPoint(point,a,b,c3){ +return this.getBarycoord(point,a,b,c3,_v3$1)===null?!1:_v3$1.x>=0&&_v3$1.y>=0&&_v3$1. +x+_v3$1.y<=1}static getUV(point,p1,p2,p3,uv1,uv2,uv3,target){return warnedGetUV2=== +!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.get\ +Interpolation()."),warnedGetUV2=!0),this.getInterpolation(point,p1,p2,p3,uv1,uv2, +uv3,target)}static getInterpolation(point,p1,p2,p3,v1,v2,v3,target){return this. +getBarycoord(point,p1,p2,p3,_v3$1)===null?(target.x=0,target.y=0,"z"in target&&(target. +z=0),"w"in target&&(target.w=0),null):(target.setScalar(0),target.addScaledVector( +v1,_v3$1.x),target.addScaledVector(v2,_v3$1.y),target.addScaledVector(v3,_v3$1.z), +target)}static isFrontFacing(a,b,c3,direction){return _v0$1.subVectors(c3,b),_v1$3. +subVectors(a,b),_v0$1.cross(_v1$3).dot(direction)<0}set(a,b,c3){return this.a.copy( +a),this.b.copy(b),this.c.copy(c3),this}setFromPointsAndIndices(points,i0,i1,i2){ +return this.a.copy(points[i0]),this.b.copy(points[i1]),this.c.copy(points[i2]),this}setFromAttributeAndIndices(attribute2,i0,i1,i2){ +return this.a.fromBufferAttribute(attribute2,i0),this.b.fromBufferAttribute(attribute2, +i1),this.c.fromBufferAttribute(attribute2,i2),this}clone(){return new this.constructor(). +copy(this)}copy(triangle){return this.a.copy(triangle.a),this.b.copy(triangle.b), +this.c.copy(triangle.c),this}getArea(){return _v0$1.subVectors(this.c,this.b),_v1$3. +subVectors(this.a,this.b),_v0$1.cross(_v1$3).length()*.5}getMidpoint(target){return target. +addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(target){return _Triangle. +getNormal(this.a,this.b,this.c,target)}getPlane(target){return target.setFromCoplanarPoints( +this.a,this.b,this.c)}getBarycoord(point,target){return _Triangle.getBarycoord(point, +this.a,this.b,this.c,target)}getUV(point,uv1,uv2,uv3,target){return warnedGetUV2=== +!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.get\ +Interpolation()."),warnedGetUV2=!0),_Triangle.getInterpolation(point,this.a,this. +b,this.c,uv1,uv2,uv3,target)}getInterpolation(point,v1,v2,v3,target){return _Triangle. +getInterpolation(point,this.a,this.b,this.c,v1,v2,v3,target)}containsPoint(point){ +return _Triangle.containsPoint(point,this.a,this.b,this.c)}isFrontFacing(direction){ +return _Triangle.isFrontFacing(this.a,this.b,this.c,direction)}intersectsBox(box){ +return box.intersectsTriangle(this)}closestPointToPoint(p2,target){let a=this.a, +b=this.b,c3=this.c,v,w2;_vab2.subVectors(b,a),_vac2.subVectors(c3,a),_vap2.subVectors( +p2,a);let d1=_vab2.dot(_vap2),d2=_vac2.dot(_vap2);if(d1<=0&&d2<=0)return target. +copy(a);_vbp2.subVectors(p2,b);let d3=_vab2.dot(_vbp2),d4=_vac2.dot(_vbp2);if(d3>= +0&&d4<=d3)return target.copy(b);let vc=d1*d4-d3*d2;if(vc<=0&&d1>=0&&d3<=0)return v= +d1/(d1-d3),target.copy(a).addScaledVector(_vab2,v);_vcp2.subVectors(p2,c3);let d5=_vab2. +dot(_vcp2),d6=_vac2.dot(_vcp2);if(d6>=0&&d5<=d6)return target.copy(c3);let vb=d5* +d2-d1*d6;if(vb<=0&&d2>=0&&d6<=0)return w2=d2/(d2-d6),target.copy(a).addScaledVector( +_vac2,w2);let va=d3*d6-d5*d4;if(va<=0&&d4-d3>=0&&d5-d6>=0)return _vbc2.subVectors( +c3,b),w2=(d4-d3)/(d4-d3+(d5-d6)),target.copy(b).addScaledVector(_vbc2,w2);let denom=1/ +(va+vb+vc);return v=vb*denom,w2=vc*denom,target.copy(a).addScaledVector(_vab2,v). +addScaledVector(_vac2,w2)}equals(triangle){return triangle.a.equals(this.a)&&triangle. +b.equals(this.b)&&triangle.c.equals(this.c)}},_colorKeywords2={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},_hslA2={h:0,s:0,l:0},_hslB2={h:0,s:0,l:0};function hue2rgb2(p2,q2,t){ +return t<0&&(t+=1),t>1&&(t-=1),t<1/6?p2+(q2-p2)*6*t:t<1/2?q2:t<2/3?p2+(q2-p2)*6* +(2/3-t):p2}__name(hue2rgb2,"hue2rgb");var Color2=class{static{__name(this,"Color")}constructor(r3,g,b){ +return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(r3,g,b)}set(r3,g,b){if(g=== +void 0&&b===void 0){let value=r3;value&&value.isColor?this.copy(value):typeof value== +"number"?this.setHex(value):typeof value=="string"&&this.setStyle(value)}else this. +setRGB(r3,g,b);return this}setScalar(scalar){return this.r=scalar,this.g=scalar, +this.b=scalar,this}setHex(hex,colorSpace=SRGBColorSpace2){return hex=Math.floor( +hex),this.r=(hex>>16&255)/255,this.g=(hex>>8&255)/255,this.b=(hex&255)/255,ColorManagement2. +toWorkingColorSpace(this,colorSpace),this}setRGB(r3,g,b,colorSpace=ColorManagement2. +workingColorSpace){return this.r=r3,this.g=g,this.b=b,ColorManagement2.toWorkingColorSpace( +this,colorSpace),this}setHSL(h,s,l,colorSpace=ColorManagement2.workingColorSpace){ +if(h=euclideanModulo2(h,1),s=clamp2(s,0,1),l=clamp2(l,0,1),s===0)this.r=this.g=this. +b=l;else{let p2=l<=.5?l*(1+s):l+s-l*s,q2=2*l-p2;this.r=hue2rgb2(q2,p2,h+1/3),this. +g=hue2rgb2(q2,p2,h),this.b=hue2rgb2(q2,p2,h-1/3)}return ColorManagement2.toWorkingColorSpace( +this,colorSpace),this}setStyle(style2,colorSpace=SRGBColorSpace2){function handleAlpha(string){ +string!==void 0&&parseFloat(string)<1&&console.warn("THREE.Color: Alpha componen\ +t of "+style2+" will be ignored.")}__name(handleAlpha,"handleAlpha");let m;if(m= +/^(\w+)\(([^\)]*)\)/.exec(style2)){let color,name2=m[1],components=m[2];switch(name2){case"\ +rgb":case"rgba":if(color=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/. +exec(components))return handleAlpha(color[4]),this.setRGB(Math.min(255,parseInt( +color[1],10))/255,Math.min(255,parseInt(color[2],10))/255,Math.min(255,parseInt( +color[3],10))/255,colorSpace);if(color=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/. +exec(components))return handleAlpha(color[4]),this.setRGB(Math.min(100,parseInt( +color[1],10))/100,Math.min(100,parseInt(color[2],10))/100,Math.min(100,parseInt( +color[3],10))/100,colorSpace);break;case"hsl":case"hsla":if(color=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/. +exec(components))return handleAlpha(color[4]),this.setHSL(parseFloat(color[1])/360, +parseFloat(color[2])/100,parseFloat(color[3])/100,colorSpace);break;default:console. +warn("THREE.Color: Unknown color model "+style2)}}else if(m=/^\#([A-Fa-f\d]+)$/. +exec(style2)){let hex=m[1],size3=hex.length;if(size3===3)return this.setRGB(parseInt( +hex.charAt(0),16)/15,parseInt(hex.charAt(1),16)/15,parseInt(hex.charAt(2),16)/15, +colorSpace);if(size3===6)return this.setHex(parseInt(hex,16),colorSpace);console. +warn("THREE.Color: Invalid hex color "+style2)}else if(style2&&style2.length>0)return this. +setColorName(style2,colorSpace);return this}setColorName(style2,colorSpace=SRGBColorSpace2){ +let hex=_colorKeywords2[style2.toLowerCase()];return hex!==void 0?this.setHex(hex, +colorSpace):console.warn("THREE.Color: Unknown color "+style2),this}clone(){return new this. +constructor(this.r,this.g,this.b)}copy(color){return this.r=color.r,this.g=color. +g,this.b=color.b,this}copySRGBToLinear(color){return this.r=SRGBToLinear2(color. +r),this.g=SRGBToLinear2(color.g),this.b=SRGBToLinear2(color.b),this}copyLinearToSRGB(color){ +return this.r=LinearToSRGB2(color.r),this.g=LinearToSRGB2(color.g),this.b=LinearToSRGB2( +color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){ +return this.copyLinearToSRGB(this),this}getHex(colorSpace=SRGBColorSpace2){return ColorManagement2. +fromWorkingColorSpace(_color3.copy(this),colorSpace),Math.round(clamp2(_color3.r* +255,0,255))*65536+Math.round(clamp2(_color3.g*255,0,255))*256+Math.round(clamp2( +_color3.b*255,0,255))}getHexString(colorSpace=SRGBColorSpace2){return("000000"+this. +getHex(colorSpace).toString(16)).slice(-6)}getHSL(target,colorSpace=ColorManagement2. +workingColorSpace){ColorManagement2.fromWorkingColorSpace(_color3.copy(this),colorSpace); +let r3=_color3.r,g=_color3.g,b=_color3.b,max2=Math.max(r3,g,b),min=Math.min(r3,g, +b),hue,saturation,lightness=(min+max2)/2;if(min===max2)hue=0,saturation=0;else{let delta=max2- +min;switch(saturation=lightness<=.5?delta/(max2+min):delta/(2-max2-min),max2){case r3: +hue=(g-b)/delta+(g0!= +value>0&&this.version++,this._alphaTest=value}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){ +return this.onBeforeCompile.toString()}setValues(values){if(values!==void 0)for(let key2 in values){ +let newValue=values[key2];if(newValue===void 0){console.warn(`THREE.Material: pa\ +rameter '${key2}' has value of undefined.`);continue}let currentValue=this[key2]; +if(currentValue===void 0){console.warn(`THREE.Material: '${key2}' is not a prope\ +rty of THREE.${this.type}.`);continue}currentValue&¤tValue.isColor?currentValue. +set(newValue):currentValue&¤tValue.isVector3&&newValue&&newValue.isVector3? +currentValue.copy(newValue):this[key2]=newValue}}toJSON(meta){let isRootObject=meta=== +void 0||typeof meta=="string";isRootObject&&(meta={textures:{},images:{}});let data={ +metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};data.uuid=this. +uuid,data.type=this.type,this.name!==""&&(data.name=this.name),this.color&&this. +color.isColor&&(data.color=this.color.getHex()),this.roughness!==void 0&&(data.roughness= +this.roughness),this.metalness!==void 0&&(data.metalness=this.metalness),this.sheen!== +void 0&&(data.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(data. +sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(data.sheenRoughness= +this.sheenRoughness),this.emissive&&this.emissive.isColor&&(data.emissive=this.emissive. +getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(data.emissiveIntensity= +this.emissiveIntensity),this.specular&&this.specular.isColor&&(data.specular=this. +specular.getHex()),this.specularIntensity!==void 0&&(data.specularIntensity=this. +specularIntensity),this.specularColor&&this.specularColor.isColor&&(data.specularColor= +this.specularColor.getHex()),this.shininess!==void 0&&(data.shininess=this.shininess), +this.clearcoat!==void 0&&(data.clearcoat=this.clearcoat),this.clearcoatRoughness!== +void 0&&(data.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this. +clearcoatMap.isTexture&&(data.clearcoatMap=this.clearcoatMap.toJSON(meta).uuid), +this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(data.clearcoatRoughnessMap= +this.clearcoatRoughnessMap.toJSON(meta).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap. +isTexture&&(data.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(meta).uuid,data. +clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&& +(data.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(data.iridescenceIOR= +this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(data.iridescenceThicknessRange= +this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&& +(data.iridescenceMap=this.iridescenceMap.toJSON(meta).uuid),this.iridescenceThicknessMap&& +this.iridescenceThicknessMap.isTexture&&(data.iridescenceThicknessMap=this.iridescenceThicknessMap. +toJSON(meta).uuid),this.anisotropy!==void 0&&(data.anisotropy=this.anisotropy),this. +anisotropyRotation!==void 0&&(data.anisotropyRotation=this.anisotropyRotation),this. +anisotropyMap&&this.anisotropyMap.isTexture&&(data.anisotropyMap=this.anisotropyMap. +toJSON(meta).uuid),this.map&&this.map.isTexture&&(data.map=this.map.toJSON(meta). +uuid),this.matcap&&this.matcap.isTexture&&(data.matcap=this.matcap.toJSON(meta). +uuid),this.alphaMap&&this.alphaMap.isTexture&&(data.alphaMap=this.alphaMap.toJSON( +meta).uuid),this.lightMap&&this.lightMap.isTexture&&(data.lightMap=this.lightMap. +toJSON(meta).uuid,data.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this. +aoMap.isTexture&&(data.aoMap=this.aoMap.toJSON(meta).uuid,data.aoMapIntensity=this. +aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(data.bumpMap=this.bumpMap. +toJSON(meta).uuid,data.bumpScale=this.bumpScale),this.normalMap&&this.normalMap. +isTexture&&(data.normalMap=this.normalMap.toJSON(meta).uuid,data.normalMapType=this. +normalMapType,data.normalScale=this.normalScale.toArray()),this.displacementMap&& +this.displacementMap.isTexture&&(data.displacementMap=this.displacementMap.toJSON( +meta).uuid,data.displacementScale=this.displacementScale,data.displacementBias=this. +displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(data.roughnessMap= +this.roughnessMap.toJSON(meta).uuid),this.metalnessMap&&this.metalnessMap.isTexture&& +(data.metalnessMap=this.metalnessMap.toJSON(meta).uuid),this.emissiveMap&&this.emissiveMap. +isTexture&&(data.emissiveMap=this.emissiveMap.toJSON(meta).uuid),this.specularMap&& +this.specularMap.isTexture&&(data.specularMap=this.specularMap.toJSON(meta).uuid), +this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(data.specularIntensityMap= +this.specularIntensityMap.toJSON(meta).uuid),this.specularColorMap&&this.specularColorMap. +isTexture&&(data.specularColorMap=this.specularColorMap.toJSON(meta).uuid),this. +envMap&&this.envMap.isTexture&&(data.envMap=this.envMap.toJSON(meta).uuid,this.combine!== +void 0&&(data.combine=this.combine)),this.envMapIntensity!==void 0&&(data.envMapIntensity= +this.envMapIntensity),this.reflectivity!==void 0&&(data.reflectivity=this.reflectivity), +this.refractionRatio!==void 0&&(data.refractionRatio=this.refractionRatio),this. +gradientMap&&this.gradientMap.isTexture&&(data.gradientMap=this.gradientMap.toJSON( +meta).uuid),this.transmission!==void 0&&(data.transmission=this.transmission),this. +transmissionMap&&this.transmissionMap.isTexture&&(data.transmissionMap=this.transmissionMap. +toJSON(meta).uuid),this.thickness!==void 0&&(data.thickness=this.thickness),this. +thicknessMap&&this.thicknessMap.isTexture&&(data.thicknessMap=this.thicknessMap. +toJSON(meta).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!== +1/0&&(data.attenuationDistance=this.attenuationDistance),this.attenuationColor!== +void 0&&(data.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&& +(data.size=this.size),this.shadowSide!==null&&(data.shadowSide=this.shadowSide), +this.sizeAttenuation!==void 0&&(data.sizeAttenuation=this.sizeAttenuation),this. +blending!==NormalBlending2&&(data.blending=this.blending),this.side!==FrontSide2&& +(data.side=this.side),this.vertexColors===!0&&(data.vertexColors=!0),this.opacity< +1&&(data.opacity=this.opacity),this.transparent===!0&&(data.transparent=!0),this. +blendSrc!==SrcAlphaFactor2&&(data.blendSrc=this.blendSrc),this.blendDst!==OneMinusSrcAlphaFactor2&& +(data.blendDst=this.blendDst),this.blendEquation!==AddEquation2&&(data.blendEquation= +this.blendEquation),this.blendSrcAlpha!==null&&(data.blendSrcAlpha=this.blendSrcAlpha), +this.blendDstAlpha!==null&&(data.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!== +null&&(data.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor. +isColor&&(data.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(data.blendAlpha= +this.blendAlpha),this.depthFunc!==LessEqualDepth2&&(data.depthFunc=this.depthFunc), +this.depthTest===!1&&(data.depthTest=this.depthTest),this.depthWrite===!1&&(data. +depthWrite=this.depthWrite),this.colorWrite===!1&&(data.colorWrite=this.colorWrite), +this.stencilWriteMask!==255&&(data.stencilWriteMask=this.stencilWriteMask),this. +stencilFunc!==AlwaysStencilFunc2&&(data.stencilFunc=this.stencilFunc),this.stencilRef!== +0&&(data.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(data.stencilFuncMask= +this.stencilFuncMask),this.stencilFail!==KeepStencilOp2&&(data.stencilFail=this. +stencilFail),this.stencilZFail!==KeepStencilOp2&&(data.stencilZFail=this.stencilZFail), +this.stencilZPass!==KeepStencilOp2&&(data.stencilZPass=this.stencilZPass),this.stencilWrite=== +!0&&(data.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!== +0&&(data.rotation=this.rotation),this.polygonOffset===!0&&(data.polygonOffset=!0), +this.polygonOffsetFactor!==0&&(data.polygonOffsetFactor=this.polygonOffsetFactor), +this.polygonOffsetUnits!==0&&(data.polygonOffsetUnits=this.polygonOffsetUnits),this. +linewidth!==void 0&&this.linewidth!==1&&(data.linewidth=this.linewidth),this.dashSize!== +void 0&&(data.dashSize=this.dashSize),this.gapSize!==void 0&&(data.gapSize=this. +gapSize),this.scale!==void 0&&(data.scale=this.scale),this.dithering===!0&&(data. +dithering=!0),this.alphaTest>0&&(data.alphaTest=this.alphaTest),this.alphaHash=== +!0&&(data.alphaHash=!0),this.alphaToCoverage===!0&&(data.alphaToCoverage=!0),this. +premultipliedAlpha===!0&&(data.premultipliedAlpha=!0),this.forceSinglePass===!0&& +(data.forceSinglePass=!0),this.wireframe===!0&&(data.wireframe=!0),this.wireframeLinewidth> +1&&(data.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="ro\ +und"&&(data.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="ro\ +und"&&(data.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(data. +flatShading=!0),this.visible===!1&&(data.visible=!1),this.toneMapped===!1&&(data. +toneMapped=!1),this.fog===!1&&(data.fog=!1),Object.keys(this.userData).length>0&& +(data.userData=this.userData);function extractFromCache(cache2){let values=[];for(let key2 in cache2){ +let data2=cache2[key2];delete data2.metadata,values.push(data2)}return values}if(__name( +extractFromCache,"extractFromCache"),isRootObject){let textures=extractFromCache( +meta.textures),images=extractFromCache(meta.images);textures.length>0&&(data.textures= +textures),images.length>0&&(data.images=images)}return data}clone(){return new this. +constructor().copy(this)}copy(source){this.name=source.name,this.blending=source. +blending,this.side=source.side,this.vertexColors=source.vertexColors,this.opacity= +source.opacity,this.transparent=source.transparent,this.blendSrc=source.blendSrc, +this.blendDst=source.blendDst,this.blendEquation=source.blendEquation,this.blendSrcAlpha= +source.blendSrcAlpha,this.blendDstAlpha=source.blendDstAlpha,this.blendEquationAlpha= +source.blendEquationAlpha,this.blendColor.copy(source.blendColor),this.blendAlpha= +source.blendAlpha,this.depthFunc=source.depthFunc,this.depthTest=source.depthTest, +this.depthWrite=source.depthWrite,this.stencilWriteMask=source.stencilWriteMask, +this.stencilFunc=source.stencilFunc,this.stencilRef=source.stencilRef,this.stencilFuncMask= +source.stencilFuncMask,this.stencilFail=source.stencilFail,this.stencilZFail=source. +stencilZFail,this.stencilZPass=source.stencilZPass,this.stencilWrite=source.stencilWrite; +let srcPlanes=source.clippingPlanes,dstPlanes=null;if(srcPlanes!==null){let n=srcPlanes. +length;dstPlanes=new Array(n);for(let i2=0;i2!==n;++i2)dstPlanes[i2]=srcPlanes[i2]. +clone()}return this.clippingPlanes=dstPlanes,this.clipIntersection=source.clipIntersection, +this.clipShadows=source.clipShadows,this.shadowSide=source.shadowSide,this.colorWrite= +source.colorWrite,this.precision=source.precision,this.polygonOffset=source.polygonOffset, +this.polygonOffsetFactor=source.polygonOffsetFactor,this.polygonOffsetUnits=source. +polygonOffsetUnits,this.dithering=source.dithering,this.alphaTest=source.alphaTest, +this.alphaHash=source.alphaHash,this.alphaToCoverage=source.alphaToCoverage,this. +premultipliedAlpha=source.premultipliedAlpha,this.forceSinglePass=source.forceSinglePass, +this.visible=source.visible,this.toneMapped=source.toneMapped,this.userData=JSON. +parse(JSON.stringify(source.userData)),this}dispose(){this.dispatchEvent({type:"\ +dispose"})}set needsUpdate(value){value===!0&&this.version++}},MeshBasicMaterial2=class extends Material2{static{ +__name(this,"MeshBasicMaterial")}constructor(parameters){super(),this.isMeshBasicMaterial= +!0,this.type="MeshBasicMaterial",this.color=new Color2(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.combine=MultiplyOperation2, +this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth= +1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this. +setValues(parameters)}copy(source){return super.copy(source),this.color.copy(source. +color),this.map=source.map,this.lightMap=source.lightMap,this.lightMapIntensity= +source.lightMapIntensity,this.aoMap=source.aoMap,this.aoMapIntensity=source.aoMapIntensity, +this.specularMap=source.specularMap,this.alphaMap=source.alphaMap,this.envMap=source. +envMap,this.combine=source.combine,this.reflectivity=source.reflectivity,this.refractionRatio= +source.refractionRatio,this.wireframe=source.wireframe,this.wireframeLinewidth=source. +wireframeLinewidth,this.wireframeLinecap=source.wireframeLinecap,this.wireframeLinejoin= +source.wireframeLinejoin,this.fog=source.fog,this}};var _vector$9=new Vector32,_vector2$1=new Vector22,BufferAttribute2=class{static{ +__name(this,"BufferAttribute")}constructor(array,itemSize,normalized=!1){if(Array. +isArray(array))throw new TypeError("THREE.BufferAttribute: array should be a Typ\ +ed Array.");this.isBufferAttribute=!0,this.name="",this.array=array,this.itemSize= +itemSize,this.count=array!==void 0?array.length/itemSize:0,this.normalized=normalized, +this.usage=StaticDrawUsage2,this._updateRange={offset:0,count:-1},this.updateRanges= +[],this.gpuType=FloatType2,this.version=0}onUploadCallback(){}set needsUpdate(value){ +value===!0&&this.version++}get updateRange(){return console.warn("THREE.BufferAt\ +tribute: updateRange() is deprecated and will be removed in r169. Use addUpdateR\ +ange() instead."),this._updateRange}setUsage(value){return this.usage=value,this}addUpdateRange(start,count){ +this.updateRanges.push({start,count})}clearUpdateRanges(){this.updateRanges.length= +0}copy(source){return this.name=source.name,this.array=new source.array.constructor( +source.array),this.itemSize=source.itemSize,this.count=source.count,this.normalized= +source.normalized,this.usage=source.usage,this.gpuType=source.gpuType,this}copyAt(index1,attribute2,index2){ +index1*=this.itemSize,index2*=attribute2.itemSize;for(let i2=0,l=this.itemSize;i2< +l;i2++)this.array[index1+i2]=attribute2.array[index2+i2];return this}copyArray(array){ +return this.array.set(array),this}applyMatrix3(m){if(this.itemSize===2)for(let i2=0, +l=this.count;i20&&(data.userData=this.userData),this.parameters!== +void 0){let parameters=this.parameters;for(let key2 in parameters)parameters[key2]!== +void 0&&(data[key2]=parameters[key2]);return data}data.data={attributes:{}};let index=this. +index;index!==null&&(data.data.index={type:index.array.constructor.name,array:Array. +prototype.slice.call(index.array)});let attributes=this.attributes;for(let key2 in attributes){ +let attribute2=attributes[key2];data.data.attributes[key2]=attribute2.toJSON(data. +data)}let morphAttributes={},hasMorphAttributes=!1;for(let key2 in this.morphAttributes){ +let attributeArray=this.morphAttributes[key2],array=[];for(let i2=0,il=attributeArray. +length;i20&&(morphAttributes[key2]=array,hasMorphAttributes=!0)} +hasMorphAttributes&&(data.data.morphAttributes=morphAttributes,data.data.morphTargetsRelative= +this.morphTargetsRelative);let groups=this.groups;groups.length>0&&(data.data.groups= +JSON.parse(JSON.stringify(groups)));let boundingSphere=this.boundingSphere;return boundingSphere!== +null&&(data.data.boundingSphere={center:boundingSphere.center.toArray(),radius:boundingSphere. +radius}),data}clone(){return new this.constructor().copy(this)}copy(source){this. +index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox= +null,this.boundingSphere=null;let data={};this.name=source.name;let index=source. +index;index!==null&&this.setIndex(index.clone(data));let attributes=source.attributes; +for(let name2 in attributes){let attribute2=attributes[name2];this.setAttribute( +name2,attribute2.clone(data))}let morphAttributes=source.morphAttributes;for(let name2 in morphAttributes){ +let array=[],morphAttribute=morphAttributes[name2];for(let i2=0,l=morphAttribute. +length;i20){let morphAttribute=morphAttributes[keys[0]];if(morphAttribute!== +void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let m=0, +ml=morphAttribute.length;m(raycaster.far-raycaster.near)**2))&&(_inverseMatrix$3.copy(matrixWorld). +invert(),_ray$3.copy(raycaster.ray).applyMatrix4(_inverseMatrix$3),!(geometry.boundingBox!== +null&&_ray$3.intersectsBox(geometry.boundingBox)===!1)&&this._computeIntersections( +raycaster,intersects3,_ray$3)))}_computeIntersections(raycaster,intersects3,rayLocalSpace){ +let intersection,geometry=this.geometry,material=this.material,index=geometry.index, +position2=geometry.attributes.position,uv=geometry.attributes.uv,uv1=geometry.attributes. +uv1,normal=geometry.attributes.normal,groups=geometry.groups,drawRange=geometry. +drawRange;if(index!==null)if(Array.isArray(material))for(let i2=0,il=groups.length;i2< +il;i2++){let group=groups[i2],groupMaterial=material[group.materialIndex],start=Math. +max(group.start,drawRange.start),end=Math.min(index.count,Math.min(group.start+group. +count,drawRange.start+drawRange.count));for(let j2=start,jl=end;j2raycaster.far?null:{distance,point:_intersectionPointWorld2. +clone(),object}}__name(checkIntersection2,"checkIntersection");function checkGeometryIntersection2(object,material,raycaster,ray,uv,uv1,normal,a,b,c3){ +object.getVertexPosition(a,_vA$1),object.getVertexPosition(b,_vB$1),object.getVertexPosition( +c3,_vC$1);let intersection=checkIntersection2(object,material,raycaster,ray,_vA$1, +_vB$1,_vC$1,_intersectionPoint2);if(intersection){uv&&(_uvA$1.fromBufferAttribute( +uv,a),_uvB$1.fromBufferAttribute(uv,b),_uvC$1.fromBufferAttribute(uv,c3),intersection. +uv=Triangle2.getInterpolation(_intersectionPoint2,_vA$1,_vB$1,_vC$1,_uvA$1,_uvB$1, +_uvC$1,new Vector22)),uv1&&(_uvA$1.fromBufferAttribute(uv1,a),_uvB$1.fromBufferAttribute( +uv1,b),_uvC$1.fromBufferAttribute(uv1,c3),intersection.uv1=Triangle2.getInterpolation( +_intersectionPoint2,_vA$1,_vB$1,_vC$1,_uvA$1,_uvB$1,_uvC$1,new Vector22),intersection. +uv2=intersection.uv1),normal&&(_normalA2.fromBufferAttribute(normal,a),_normalB2. +fromBufferAttribute(normal,b),_normalC2.fromBufferAttribute(normal,c3),intersection. +normal=Triangle2.getInterpolation(_intersectionPoint2,_vA$1,_vB$1,_vC$1,_normalA2, +_normalB2,_normalC2,new Vector32),intersection.normal.dot(ray.direction)>0&&intersection. +normal.multiplyScalar(-1));let face={a,b,c:c3,normal:new Vector32,materialIndex:0}; +Triangle2.getNormal(_vA$1,_vB$1,_vC$1,face.normal),intersection.face=face}return intersection} +__name(checkGeometryIntersection2,"checkGeometryIntersection");var BoxGeometry2=class _BoxGeometry extends BufferGeometry2{static{ +__name(this,"BoxGeometry")}constructor(width=1,height=1,depth=1,widthSegments=1,heightSegments=1,depthSegments=1){ +super(),this.type="BoxGeometry",this.parameters={width,height,depth,widthSegments, +heightSegments,depthSegments};let scope=this;widthSegments=Math.floor(widthSegments), +heightSegments=Math.floor(heightSegments),depthSegments=Math.floor(depthSegments); +let indices=[],vertices=[],normals=[],uvs=[],numberOfVertices=0,groupStart=0;buildPlane( +"z","y","x",-1,-1,depth,height,width,depthSegments,heightSegments,0),buildPlane( +"z","y","x",1,-1,depth,height,-width,depthSegments,heightSegments,1),buildPlane( +"x","z","y",1,1,width,depth,height,widthSegments,depthSegments,2),buildPlane("x", +"z","y",1,-1,width,depth,-height,widthSegments,depthSegments,3),buildPlane("x","\ +y","z",1,-1,width,height,depth,widthSegments,heightSegments,4),buildPlane("x","y", +"z",-1,-1,width,height,-depth,widthSegments,heightSegments,5),this.setIndex(indices), +this.setAttribute("position",new Float32BufferAttribute2(vertices,3)),this.setAttribute( +"normal",new Float32BufferAttribute2(normals,3)),this.setAttribute("uv",new Float32BufferAttribute2( +uvs,2));function buildPlane(u2,v,w2,udir,vdir,width2,height2,depth2,gridX,gridY,materialIndex){ +let segmentWidth=width2/gridX,segmentHeight=height2/gridY,widthHalf=width2/2,heightHalf=height2/ +2,depthHalf=depth2/2,gridX1=gridX+1,gridY1=gridY+1,vertexCounter=0,groupCount=0, +vector=new Vector32;for(let iy=0;iy0?1:-1,normals.push(vector.x,vector.y, +vector.z),uvs.push(ix/gridX),uvs.push(1-iy/gridY),vertexCounter+=1}}for(let iy=0;iy< +gridY;iy++)for(let ix=0;ix0&&(data.defines=this.defines), +data.vertexShader=this.vertexShader,data.fragmentShader=this.fragmentShader,data. +lights=this.lights,data.clipping=this.clipping;let extensions={};for(let key2 in this. +extensions)this.extensions[key2]===!0&&(extensions[key2]=!0);return Object.keys( +extensions).length>0&&(data.extensions=extensions),data}},Camera=class extends Object3D2{static{ +__name(this,"Camera")}constructor(){super(),this.isCamera=!0,this.type="Camera", +this.matrixWorldInverse=new Matrix42,this.projectionMatrix=new Matrix42,this.projectionMatrixInverse= +new Matrix42,this.coordinateSystem=WebGLCoordinateSystem2}copy(source,recursive){ +return super.copy(source,recursive),this.matrixWorldInverse.copy(source.matrixWorldInverse), +this.projectionMatrix.copy(source.projectionMatrix),this.projectionMatrixInverse. +copy(source.projectionMatrixInverse),this.coordinateSystem=source.coordinateSystem, +this}getWorldDirection(target){return super.getWorldDirection(target).negate()}updateMatrixWorld(force){ +super.updateMatrixWorld(force),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(updateParents,updateChildren){ +super.updateWorldMatrix(updateParents,updateChildren),this.matrixWorldInverse.copy( +this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},PerspectiveCamera=class extends Camera{static{ +__name(this,"PerspectiveCamera")}constructor(fov3=50,aspect3=1,near=.1,far=2e3){ +super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=fov3, +this.zoom=1,this.near=near,this.far=far,this.focus=10,this.aspect=aspect3,this.view= +null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(source,recursive){ +return super.copy(source,recursive),this.fov=source.fov,this.zoom=source.zoom,this. +near=source.near,this.far=source.far,this.focus=source.focus,this.aspect=source. +aspect,this.view=source.view===null?null:Object.assign({},source.view),this.filmGauge= +source.filmGauge,this.filmOffset=source.filmOffset,this}setFocalLength(focalLength){ +let vExtentSlope=.5*this.getFilmHeight()/focalLength;this.fov=RAD2DEG2*2*Math.atan( +vExtentSlope),this.updateProjectionMatrix()}getFocalLength(){let vExtentSlope=Math. +tan(DEG2RAD2*.5*this.fov);return .5*this.getFilmHeight()/vExtentSlope}getEffectiveFOV(){ +return RAD2DEG2*2*Math.atan(Math.tan(DEG2RAD2*.5*this.fov)/this.zoom)}getFilmWidth(){ +return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/ +Math.max(this.aspect,1)}setViewOffset(fullWidth,fullHeight,x2,y2,width,height){this. +aspect=fullWidth/fullHeight,this.view===null&&(this.view={enabled:!0,fullWidth:1, +fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view. +fullWidth=fullWidth,this.view.fullHeight=fullHeight,this.view.offsetX=x2,this.view. +offsetY=y2,this.view.width=width,this.view.height=height,this.updateProjectionMatrix()}clearViewOffset(){ +this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){ +let near=this.near,top=near*Math.tan(DEG2RAD2*.5*this.fov)/this.zoom,height=2*top, +width=this.aspect*height,left=-.5*width,view=this.view;if(this.view!==null&&this. +view.enabled){let fullWidth=view.fullWidth,fullHeight=view.fullHeight;left+=view. +offsetX*width/fullWidth,top-=view.offsetY*height/fullHeight,width*=view.width/fullWidth, +height*=view.height/fullHeight}let skew=this.filmOffset;skew!==0&&(left+=near*skew/ +this.getFilmWidth()),this.projectionMatrix.makePerspective(left,left+width,top,top- +height,near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this. +projectionMatrix).invert()}toJSON(meta){let data=super.toJSON(meta);return data. +object.fov=this.fov,data.object.zoom=this.zoom,data.object.near=this.near,data.object. +far=this.far,data.object.focus=this.focus,data.object.aspect=this.aspect,this.view!== +null&&(data.object.view=Object.assign({},this.view)),data.object.filmGauge=this. +filmGauge,data.object.filmOffset=this.filmOffset,data}},fov=-90,aspect=1,CubeCamera=class extends Object3D2{static{ +__name(this,"CubeCamera")}constructor(near,far,renderTarget){super(),this.type="\ +CubeCamera",this.renderTarget=renderTarget,this.coordinateSystem=null,this.activeMipmapLevel= +0;let cameraPX=new PerspectiveCamera(fov,aspect,near,far);cameraPX.layers=this.layers, +this.add(cameraPX);let cameraNX=new PerspectiveCamera(fov,aspect,near,far);cameraNX. +layers=this.layers,this.add(cameraNX);let cameraPY=new PerspectiveCamera(fov,aspect, +near,far);cameraPY.layers=this.layers,this.add(cameraPY);let cameraNY=new PerspectiveCamera( +fov,aspect,near,far);cameraNY.layers=this.layers,this.add(cameraNY);let cameraPZ=new PerspectiveCamera( +fov,aspect,near,far);cameraPZ.layers=this.layers,this.add(cameraPZ);let cameraNZ=new PerspectiveCamera( +fov,aspect,near,far);cameraNZ.layers=this.layers,this.add(cameraNZ)}updateCoordinateSystem(){ +let coordinateSystem=this.coordinateSystem,cameras=this.children.concat(),[cameraPX, +cameraNX,cameraPY,cameraNY,cameraPZ,cameraNZ]=cameras;for(let camera of cameras) +this.remove(camera);if(coordinateSystem===WebGLCoordinateSystem2)cameraPX.up.set( +0,1,0),cameraPX.lookAt(1,0,0),cameraNX.up.set(0,1,0),cameraNX.lookAt(-1,0,0),cameraPY. +up.set(0,0,-1),cameraPY.lookAt(0,1,0),cameraNY.up.set(0,0,1),cameraNY.lookAt(0,-1, +0),cameraPZ.up.set(0,1,0),cameraPZ.lookAt(0,0,1),cameraNZ.up.set(0,1,0),cameraNZ. +lookAt(0,0,-1);else if(coordinateSystem===WebGPUCoordinateSystem2)cameraPX.up.set( +0,-1,0),cameraPX.lookAt(-1,0,0),cameraNX.up.set(0,-1,0),cameraNX.lookAt(1,0,0),cameraPY. +up.set(0,0,1),cameraPY.lookAt(0,1,0),cameraNY.up.set(0,0,-1),cameraNY.lookAt(0,-1, +0),cameraPZ.up.set(0,-1,0),cameraPZ.lookAt(0,0,1),cameraNZ.up.set(0,-1,0),cameraNZ. +lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): \ +Invalid coordinate system: "+coordinateSystem);for(let camera of cameras)this.add( +camera),camera.updateMatrixWorld()}update(renderer,scene2){this.parent===null&&this. +updateMatrixWorld();let{renderTarget,activeMipmapLevel}=this;this.coordinateSystem!== +renderer.coordinateSystem&&(this.coordinateSystem=renderer.coordinateSystem,this. +updateCoordinateSystem());let[cameraPX,cameraNX,cameraPY,cameraNY,cameraPZ,cameraNZ]=this. +children,currentRenderTarget=renderer.getRenderTarget(),currentActiveCubeFace=renderer. +getActiveCubeFace(),currentActiveMipmapLevel=renderer.getActiveMipmapLevel(),currentXrEnabled=renderer. +xr.enabled;renderer.xr.enabled=!1;let generateMipmaps=renderTarget.texture.generateMipmaps; +renderTarget.texture.generateMipmaps=!1,renderer.setRenderTarget(renderTarget,0, +activeMipmapLevel),renderer.render(scene2,cameraPX),renderer.setRenderTarget(renderTarget, +1,activeMipmapLevel),renderer.render(scene2,cameraNX),renderer.setRenderTarget(renderTarget, +2,activeMipmapLevel),renderer.render(scene2,cameraPY),renderer.setRenderTarget(renderTarget, +3,activeMipmapLevel),renderer.render(scene2,cameraNY),renderer.setRenderTarget(renderTarget, +4,activeMipmapLevel),renderer.render(scene2,cameraPZ),renderTarget.texture.generateMipmaps= +generateMipmaps,renderer.setRenderTarget(renderTarget,5,activeMipmapLevel),renderer. +render(scene2,cameraNZ),renderer.setRenderTarget(currentRenderTarget,currentActiveCubeFace, +currentActiveMipmapLevel),renderer.xr.enabled=currentXrEnabled,renderTarget.texture. +needsPMREMUpdate=!0}},CubeTexture=class extends Texture{static{__name(this,"Cube\ +Texture")}constructor(images,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy,colorSpace){ +images=images!==void 0?images:[],mapping=mapping!==void 0?mapping:CubeReflectionMapping2, +super(images,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy,colorSpace), +this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(value){ +this.image=value}},WebGLCubeRenderTarget=class extends WebGLRenderTarget{static{ +__name(this,"WebGLCubeRenderTarget")}constructor(size3=1,options={}){super(size3, +size3,options),this.isWebGLCubeRenderTarget=!0;let image={width:size3,height:size3, +depth:1},images=[image,image,image,image,image,image];options.encoding!==void 0&& +(warnOnce2("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by op\ +tion.colorSpace."),options.colorSpace=options.encoding===sRGBEncoding2?SRGBColorSpace2: +NoColorSpace2),this.texture=new CubeTexture(images,options.mapping,options.wrapS, +options.wrapT,options.magFilter,options.minFilter,options.format,options.type,options. +anisotropy,options.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture. +generateMipmaps=options.generateMipmaps!==void 0?options.generateMipmaps:!1,this. +texture.minFilter=options.minFilter!==void 0?options.minFilter:LinearFilter2}fromEquirectangularTexture(renderer,texture){ +this.texture.type=texture.type,this.texture.colorSpace=texture.colorSpace,this.texture. +generateMipmaps=texture.generateMipmaps,this.texture.minFilter=texture.minFilter, +this.texture.magFilter=texture.magFilter;let shader={uniforms:{tEquirect:{value:null}}, +vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},geometry=new BoxGeometry2(5,5,5),material=new ShaderMaterial({name:"Cubema\ +pFromEquirect",uniforms:cloneUniforms(shader.uniforms),vertexShader:shader.vertexShader, +fragmentShader:shader.fragmentShader,side:BackSide2,blending:NoBlending2});material. +uniforms.tEquirect.value=texture;let mesh=new Mesh3(geometry,material),currentMinFilter=texture. +minFilter;return texture.minFilter===LinearMipmapLinearFilter2&&(texture.minFilter= +LinearFilter2),new CubeCamera(1,10,this).update(renderer,mesh),texture.minFilter= +currentMinFilter,mesh.geometry.dispose(),mesh.material.dispose(),this}clear(renderer,color,depth,stencil){ +let currentRenderTarget=renderer.getRenderTarget();for(let i2=0;i2<6;i2++)renderer. +setRenderTarget(this,i2),renderer.clear(color,depth,stencil);renderer.setRenderTarget( +currentRenderTarget)}},_vector12=new Vector32,_vector24=new Vector32,_normalMatrix2=new Matrix32, +Plane2=class{static{__name(this,"Plane")}constructor(normal=new Vector32(1,0,0),constant=0){ +this.isPlane=!0,this.normal=normal,this.constant=constant}set(normal,constant){return this. +normal.copy(normal),this.constant=constant,this}setComponents(x2,y2,z2,w2){return this. +normal.set(x2,y2,z2),this.constant=w2,this}setFromNormalAndCoplanarPoint(normal,point){ +return this.normal.copy(normal),this.constant=-point.dot(this.normal),this}setFromCoplanarPoints(a,b,c3){ +let normal=_vector12.subVectors(c3,b).cross(_vector24.subVectors(a,b)).normalize(); +return this.setFromNormalAndCoplanarPoint(normal,a),this}copy(plane){return this. +normal.copy(plane.normal),this.constant=plane.constant,this}normalize(){let inverseNormalLength=1/ +this.normal.length();return this.normal.multiplyScalar(inverseNormalLength),this. +constant*=inverseNormalLength,this}negate(){return this.constant*=-1,this.normal. +negate(),this}distanceToPoint(point){return this.normal.dot(point)+this.constant}distanceToSphere(sphere){ +return this.distanceToPoint(sphere.center)-sphere.radius}projectPoint(point,target){ +return target.copy(point).addScaledVector(this.normal,-this.distanceToPoint(point))}intersectLine(line,target){ +let direction=line.delta(_vector12),denominator=this.normal.dot(direction);if(denominator=== +0)return this.distanceToPoint(line.start)===0?target.copy(line.start):null;let t=-(line. +start.dot(this.normal)+this.constant)/denominator;return t<0||t>1?null:target.copy( +line.start).addScaledVector(direction,t)}intersectsLine(line){let startSign=this. +distanceToPoint(line.start),endSign=this.distanceToPoint(line.end);return startSign< +0&&endSign>0||endSign<0&&startSign>0}intersectsBox(box){return box.intersectsPlane( +this)}intersectsSphere(sphere){return sphere.intersectsPlane(this)}coplanarPoint(target){ +return target.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(matrix,optionalNormalMatrix){ +let normalMatrix=optionalNormalMatrix||_normalMatrix2.getNormalMatrix(matrix),referencePoint=this. +coplanarPoint(_vector12).applyMatrix4(matrix),normal=this.normal.applyMatrix3(normalMatrix). +normalize();return this.constant=-referencePoint.dot(normal),this}translate(offset){ +return this.constant-=offset.dot(this.normal),this}equals(plane){return plane.normal. +equals(this.normal)&&plane.constant===this.constant}clone(){return new this.constructor(). +copy(this)}},_sphere$5=new Sphere2,_vector$7=new Vector32,Frustum=class{static{__name( +this,"Frustum")}constructor(p0=new Plane2,p1=new Plane2,p2=new Plane2,p3=new Plane2,p4=new Plane2,p5=new Plane2){ +this.planes=[p0,p1,p2,p3,p4,p5]}set(p0,p1,p2,p3,p4,p5){let planes=this.planes;return planes[0]. +copy(p0),planes[1].copy(p1),planes[2].copy(p2),planes[3].copy(p3),planes[4].copy( +p4),planes[5].copy(p5),this}copy(frustum){let planes=this.planes;for(let i2=0;i2< +6;i2++)planes[i2].copy(frustum.planes[i2]);return this}setFromProjectionMatrix(m,coordinateSystem=WebGLCoordinateSystem2){ +let planes=this.planes,me=m.elements,me0=me[0],me1=me[1],me2=me[2],me3=me[3],me4=me[4], +me5=me[5],me6=me[6],me7=me[7],me8=me[8],me9=me[9],me10=me[10],me11=me[11],me12=me[12], +me13=me[13],me14=me[14],me15=me[15];if(planes[0].setComponents(me3-me0,me7-me4,me11- +me8,me15-me12).normalize(),planes[1].setComponents(me3+me0,me7+me4,me11+me8,me15+ +me12).normalize(),planes[2].setComponents(me3+me1,me7+me5,me11+me9,me15+me13).normalize(), +planes[3].setComponents(me3-me1,me7-me5,me11-me9,me15-me13).normalize(),planes[4]. +setComponents(me3-me2,me7-me6,me11-me10,me15-me14).normalize(),coordinateSystem=== +WebGLCoordinateSystem2)planes[5].setComponents(me3+me2,me7+me6,me11+me10,me15+me14). +normalize();else if(coordinateSystem===WebGPUCoordinateSystem2)planes[5].setComponents( +me2,me6,me10,me14).normalize();else throw new Error("THREE.Frustum.setFromProjec\ +tionMatrix(): Invalid coordinate system: "+coordinateSystem);return this}intersectsObject(object){ +if(object.boundingSphere!==void 0)object.boundingSphere===null&&object.computeBoundingSphere(), +_sphere$5.copy(object.boundingSphere).applyMatrix4(object.matrixWorld);else{let geometry=object. +geometry;geometry.boundingSphere===null&&geometry.computeBoundingSphere(),_sphere$5. +copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld)}return this.intersectsSphere( +_sphere$5)}intersectsSprite(sprite){return _sphere$5.center.set(0,0,0),_sphere$5. +radius=.7071067811865476,_sphere$5.applyMatrix4(sprite.matrixWorld),this.intersectsSphere( +_sphere$5)}intersectsSphere(sphere){let planes=this.planes,center=sphere.center, +negRadius=-sphere.radius;for(let i2=0;i2<6;i2++)if(planes[i2].distanceToPoint(center)< +negRadius)return!1;return!0}intersectsBox(box){let planes=this.planes;for(let i2=0;i2< +6;i2++){let plane=planes[i2];if(_vector$7.x=plane.normal.x>0?box.max.x:box.min.x, +_vector$7.y=plane.normal.y>0?box.max.y:box.min.y,_vector$7.z=plane.normal.z>0?box. +max.z:box.min.z,plane.distanceToPoint(_vector$7)<0)return!1}return!0}containsPoint(point){ +let planes=this.planes;for(let i2=0;i2<6;i2++)if(planes[i2].distanceToPoint(point)< +0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function WebGLAnimation(){ +let context=null,isAnimating=!1,animationLoop=null,requestId=null;function onAnimationFrame(time,frame){ +animationLoop(time,frame),requestId=context.requestAnimationFrame(onAnimationFrame)} +return __name(onAnimationFrame,"onAnimationFrame"),{start:function(){isAnimating!== +!0&&animationLoop!==null&&(requestId=context.requestAnimationFrame(onAnimationFrame), +isAnimating=!0)},stop:function(){context.cancelAnimationFrame(requestId),isAnimating= +!1},setAnimationLoop:function(callback){animationLoop=callback},setContext:function(value){ +context=value}}}__name(WebGLAnimation,"WebGLAnimation");function WebGLAttributes(gl,capabilities){ +let isWebGL2=capabilities.isWebGL2,buffers=new WeakMap;function createBuffer(attribute2,bufferType){ +let array=attribute2.array,usage=attribute2.usage,size3=array.byteLength,buffer=gl. +createBuffer();gl.bindBuffer(bufferType,buffer),gl.bufferData(bufferType,array,usage), +attribute2.onUploadCallback();let type;if(array instanceof Float32Array)type=gl. +FLOAT;else if(array instanceof Uint16Array)if(attribute2.isFloat16BufferAttribute) +if(isWebGL2)type=gl.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usag\ +e of Float16BufferAttribute requires WebGL2.");else type=gl.UNSIGNED_SHORT;else if(array instanceof +Int16Array)type=gl.SHORT;else if(array instanceof Uint32Array)type=gl.UNSIGNED_INT;else if(array instanceof +Int32Array)type=gl.INT;else if(array instanceof Int8Array)type=gl.BYTE;else if(array instanceof +Uint8Array)type=gl.UNSIGNED_BYTE;else if(array instanceof Uint8ClampedArray)type= +gl.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer\ + data format: "+array);return{buffer,type,bytesPerElement:array.BYTES_PER_ELEMENT, +version:attribute2.version,size:size3}}__name(createBuffer,"createBuffer");function updateBuffer(buffer,attribute2,bufferType){ +let array=attribute2.array,updateRange=attribute2._updateRange,updateRanges=attribute2. +updateRanges;if(gl.bindBuffer(bufferType,buffer),updateRange.count===-1&&updateRanges. +length===0&&gl.bufferSubData(bufferType,0,array),updateRanges.length!==0){for(let i2=0, +l=updateRanges.length;i2 0 + vec4 plane; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif +#endif`,clipping_planes_pars_fragment=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,clipping_planes_pars_vertex=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,clipping_planes_vertex=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,color_fragment=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,color_pars_fragment=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,color_pars_vertex=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + varying vec3 vColor; +#endif`,color_vertex=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif`,common=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +float luminance( const in vec3 rgb ) { + const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); + return dot( weights, rgb ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\ + + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,cube_uv_reflection_fragment=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - c\ +ubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - c\ +ubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - c\ +ubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - c\ +ubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,defaultnormal_vertex=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), do\ +t( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), do\ +t( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\ + + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,displacementmap_pars_vertex=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,displacementmap_vertex=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDispl\ +acementMapUv ).x * displacementScale + displacementBias ); +#endif`,emissivemap_fragment=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,emissivemap_pars_fragment=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,colorspace_fragment="gl_FragColor = linearToOutputTexel( gl_FragColor );", +colorspace_pars_fragment=` +const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( + vec3( 0.8224621, 0.177538, 0.0 ), + vec3( 0.0331941, 0.9668058, 0.0 ), + vec3( 0.0170827, 0.0723974, 0.9105199 ) +); +const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( + vec3( 1.2249401, - 0.2249404, 0.0 ), + vec3( - 0.0420569, 1.0420571, 0.0 ), + vec3( - 0.0196376, - 0.0786361, 1.0982735 ) +); +vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { + return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); +} +vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { + return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); +} +vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), va\ +lue.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.\ +a ); +} +vec4 LinearToLinear( in vec4 value ) { + return value; +} +vec4 LinearTosRGB( in vec4 value ) { + return sRGBTransferOETF( value ); +}`,envmap_fragment=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 \ +], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectV\ +ec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStre\ +ngth * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectiv\ +ity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,envmap_common_pars_fragment=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,envmap_pars_fragment=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || d\ +efined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,envmap_pars_vertex=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || d\ +efined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,envmap_vertex=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ \ +2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\ + + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,fog_vertex=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,fog_pars_vertex=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,fog_fragment=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth\ + ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,fog_pars_fragment=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,gradientmap_pars_fragment=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coor\ +d.x ) ); + #endif +}`,lightmap_fragment=`#ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + reflectedLight.indirectDiffuse += lightMapIrradiance; +#endif`,lightmap_pars_fragment=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,lights_lambert_fragment=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,lights_lambert_pars_fragment=`var\ +ying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geomet\ +ryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const i\ +n vec3 geometryClearcoatNormal, const in LambertMaterial material, inout Reflect\ +edLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColo\ +r ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr\ +yPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in\ + vec3 geometryClearcoatNormal, const in LambertMaterial material, inout Reflecte\ +dLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseCo\ +lor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin=`unifo\ +rm bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 norma\ +l ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutof\ +fDistance, const in float decayExponent ) { + #if defined ( LEGACY_LIGHTS ) + if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { + return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent\ + ); + } + return 1.0; + #else + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 )\ +; + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance\ + ) ) ); + } + return distanceFalloff; + #endif +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi\ +ne, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out I\ +ncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryP\ +osition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, poi\ +ntLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosi\ +tion, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penum\ +braCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spo\ +tLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in\ + vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseW\ +eight ); + return irradiance; + } +#endif`,envmap_physical_pars_fragment=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in floa\ +t roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, co\ +nst in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotrop\ +y * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,lights_toon_fragment=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment=`varying ve\ +c3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryP\ +osition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in v\ +ec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLigh\ +t reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction \ +) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColo\ +r ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo\ +sition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in ve\ +c3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight\ + reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseCo\ +lor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment=`Blin\ +nPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,lights_phong_pars_fragment=`varyi\ +ng vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geo\ +metryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, cons\ +t in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout R\ +eflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColo\ +r ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.dire\ +ction, geometryViewDir, geometryNormal, material.specularColor, material.specula\ +rShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom\ +etryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const\ + in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout Re\ +flectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseCo\ +lor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment=`\ +PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal\ + ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geomet\ +ryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb\ +; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensit\ +yMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.io\ +r + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diff\ +useColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor )\ +; + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRou\ +ghnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughnes\ +s = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThic\ +knessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv )\ +.g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv \ +).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotrop\ +yVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2(\ + 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotro\ +py ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,lights_physical_pars_fragment=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) \ +{ + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const i\ +n float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float 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 ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in\ + float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const i\ +n vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 norm\ +al, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, do\ +tBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1\ +e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in m\ +at3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 no\ +rmal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float \ +roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r\ +2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - \ +3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness \ +- 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roug\ +hness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3\ + specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 view\ +Dir, const in vec3 specularColor, const in float specularF90, const in float iri\ +descence, const in vec3 iridescenceF0, const in float roughness, inout vec3 sing\ +leScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const \ +in vec3 specularColor, const in float specularF90, const in float roughness, ino\ +ut vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Em\ +s * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const i\ +n vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryVie\ +wDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material,\ + inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightP\ +os - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.spec\ +ularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, \ +viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evalu\ +ate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geome\ +tryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const \ +in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout Refle\ +ctedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction \ +) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.dire\ +ction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometr\ +yViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, \ +geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColo\ +r ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geomet\ +ryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const i\ +n vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout Reflec\ +tedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseCo\ +lor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia\ +nce, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in v\ +ec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearco\ +atNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLigh\ +t) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClea\ +rcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, mater\ +ial.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geom\ +etryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.s\ +pecularColor, material.specularF90, material.iridescence, material.iridescenceFr\ +esnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColo\ +r, material.specularF90, material.roughness, singleScattering, multiScattering )\ +; + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, tot\ +alScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOccl\ +usion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 \ +) ) - 1.0 + ambientOcclusion ); +}`,lights_fragment_begin=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPo\ +sition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, d\ +otNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotN\ +Vi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOW\ +S ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow\ +( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBi\ +as, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shad\ +owCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geo\ +metryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + \ +NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) \ +) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.x\ +y ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : dire\ +ctLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS\ + ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spo\ +tShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spot\ +LightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geo\ +metryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS \ +) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( dir\ +ectionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightSh\ +adow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i\ + ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geo\ +metryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryV\ +iewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNo\ +rmal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,lights_fragment_maps=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_U\ +V ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, materia\ +l.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughnes\ +s ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal,\ + material.clearcoatRoughness ); + #endif +#endif`,lights_fragment_end=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewD\ +ir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPositi\ +on, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflecte\ +dLight ); +#endif`,logdepthbuf_fragment=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOG\ +DEPTHBUF_EXT ) + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) *\ + logDepthBufFC * 0.5; +#endif`,logdepthbuf_pars_fragment=`#if defined( USE_LOGDEPTHBUF ) && defined( US\ +E_LOGDEPTHBUF_EXT ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_pars_vertex=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + varying float vFragDepth; + varying float vIsPerspective; + #else + uniform float logDepthBufFC; + #endif +#endif`,logdepthbuf_vertex=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); + #else + if ( isPerspectiveMatrix( projectionMatrix ) ) { + gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC -\ + 1.0; + gl_Position.z *= gl_Position.w; + } + #endif +#endif`,map_fragment=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 +\ + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, ve\ +c3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffus\ +eColor.w ); + + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,map_pars_fragment=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,map_particle_fragment=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\ + + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).\ +xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,map_particle_pars_fragment=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,metalnessmap_fragment=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,metalnessmap_pars_fragment=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,morphcolor_vertex=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGE\ +TS_TEXTURE ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, \ +2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, \ +2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,morphnormal_vertex=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexI\ +D, i, 1 ).xyz * morphTargetInfluences[ i ]; + } + #else + objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; + objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; + objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; + objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; + #endif +#endif`,morphtarget_pars_vertex=`#ifdef USE_MORPHTARGETS + uniform float morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const \ +in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } + #else + #ifndef USE_MORPHNORMALS + uniform float morphTargetInfluences[ 8 ]; + #else + uniform float morphTargetInfluences[ 4 ]; + #endif + #endif +#endif`,morphtarget_vertex=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID\ +, i, 0 ).xyz * morphTargetInfluences[ i ]; + } + #else + transformed += morphTarget0 * morphTargetInfluences[ 0 ]; + transformed += morphTarget1 * morphTargetInfluences[ 1 ]; + transformed += morphTarget2 * morphTargetInfluences[ 2 ]; + transformed += morphTarget3 * morphTargetInfluences[ 3 ]; + #ifndef USE_MORPHNORMALS + transformed += morphTarget4 * morphTargetInfluences[ 4 ]; + transformed += morphTarget5 * morphTargetInfluences[ 5 ]; + transformed += morphTarget6 * morphTargetInfluences[ 6 ]; + transformed += morphTarget7 * morphTargetInfluences[ 7 ]; + #endif + #endif +#endif`,normal_fragment_begin=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.\ +0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) \ +|| defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\ + + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,normal_fragment_maps=`#ifdef USE_NORMALMAP_OB\ +JECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection \ +); +#endif`,normal_pars_fragment=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_pars_vertex=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_vertex=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,normalmap_pars_fragment=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || def\ +ined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,clearcoat_normal_fragment_begin=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,clearcoat_normal_fragment_maps=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz\ + * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,clearcoat_pars_fragment=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,iridescence_pars_fragment=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,opaque_fragment=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing=`vec3 packNormalT\ +oRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\ + +const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); +const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); +const float ShiftRight8 = 1. / 256.; +vec4 packDepthToRGBA( const in float v ) { + vec4 r = vec4( fract( v * PackFactors ), v ); + r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors ); +} +vec2 packDepthToRG( in highp float v ) { + return packDepthToRGBA( v ).yx; +} +float unpackRGToDepth( const in highp vec2 v ) { + return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); +} +vec4 pack2HalfToRGBA( vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const\ + in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const\ + in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const \ +in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const \ +in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,premultiplied_alpha_fragment=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,project_vertex=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,dithering_fragment=`#ifdef DITHERI\ +NG + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,dithering_pars_fragment=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_\ +position ); + return color + dither_shift_RGB; + } +#endif`,roughnessmap_fragment=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,roughnessmap_pars_fragment=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,shadowmap_pars_fragment=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS \ +]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); \ +softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0\ +.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1\ +.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, flo\ +at shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y\ + >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.\ +z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z \ +), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z )\ +, + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.\ +z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoor\ +d.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return shadow; + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias\ +, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCame\ +raFar ) { + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + vec3 lightToPosition = shadowCoord.xyz; + float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFa\ +r - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || def\ +ined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + return ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp \ +) + ) * ( 1.0 / 9.0 ); + #else + return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } +#endif`,shadowmap_pars_vertex=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS \ +]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,shadowmap_vertex=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHAD\ +OWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatr\ +ix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLi\ +ghtShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosi\ +tion; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightSha\ +dows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS\ + ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNo\ +rmalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,shadowmask_pars_fragment=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLig\ +ht.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vD\ +irectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSi\ +ze, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shad\ +owMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i \ +], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,skinbase_vertex=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,skinning_pars_vertex=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,skinning_vertex=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,skinnormal_vertex=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,specularmap_fragment=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,specularmap_pars_fragment=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,tonemapping_fragment=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,tonemapping_pars_fragment=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 OptimizedCineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 )\ + + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color *= toneMappingExposure; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + return color; +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment=`#\ +ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, mater\ +ial.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickne\ +ss, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, ma\ +terial.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,transmission_pars_fragment=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( te\ +x, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3,\ + lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod\ + ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod \ +) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float\ + thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, \ +const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness\ +, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 atte\ +nuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\ + + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); \ + return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float r\ +oughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 positio\ +n, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const \ +in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMa\ +trix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, io\ +r ); + vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay\ + ), attenuationColor, attenuationDistance ); + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittanc\ +e.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a )\ + * transmittanceFactor ); + } +#endif`,uv_pars_fragment=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uv_pars_vertex=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uv_vertex=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 )\ + ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\ + +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALM\ +AP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_R\ +OUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).\ +xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESC\ +ENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy\ +; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_\ +UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV,\ + 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTE\ +NSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 )\ + ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,worldpos_vertex=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || def\ +ined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS \ +> 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`,vertex$h=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,fragment$h=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = 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 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,vertex$g=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,fragment$g=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWo\ +rldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness )\ +; + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,vertex$f=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,fragment$f=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDire\ +ction.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,vertex$e=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,fragment$e=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + vec4 diffuseColor = vec4( 1.0 ); + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #endif +}`,vertex$d=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,fragment$d=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + #include + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,vertex$c=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,fragment$c=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,vertex$b=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,fragment$b=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,vertex$a=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,fragment$a=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECI\ +PROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,vertex$9=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,fragment$9=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiff\ +use + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,vertex$8=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,fragment$8=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,vertex$7=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_T\ +ANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_T\ +ANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,fragment$7=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_T\ +ANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,vertex$6=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,fragment$6=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiff\ +use + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmi\ +ssiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,vertex$5=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,fragment$5=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffu\ +se; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpe\ +cular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenS\ +pecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearco\ +atSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,vertex$4=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,fragment$4=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiff\ +use + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,vertex$3=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,fragment$3=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,vertex$2=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,fragment$2=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,vertex$1=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 \ +].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 \ +].z ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * ali\ +gnedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * ali\ +gnedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,fragment$1=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,ShaderChunk={alphahash_fragment,alphahash_pars_fragment,alphamap_fragment,alphamap_pars_fragment, +alphatest_fragment,alphatest_pars_fragment,aomap_fragment,aomap_pars_fragment,batching_pars_vertex, +batching_vertex,begin_vertex,beginnormal_vertex,bsdfs,iridescence_fragment,bumpmap_pars_fragment, +clipping_planes_fragment,clipping_planes_pars_fragment,clipping_planes_pars_vertex, +clipping_planes_vertex,color_fragment,color_pars_fragment,color_pars_vertex,color_vertex, +common,cube_uv_reflection_fragment,defaultnormal_vertex,displacementmap_pars_vertex, +displacementmap_vertex,emissivemap_fragment,emissivemap_pars_fragment,colorspace_fragment, +colorspace_pars_fragment,envmap_fragment,envmap_common_pars_fragment,envmap_pars_fragment, +envmap_pars_vertex,envmap_physical_pars_fragment,envmap_vertex,fog_vertex,fog_pars_vertex, +fog_fragment,fog_pars_fragment,gradientmap_pars_fragment,lightmap_fragment,lightmap_pars_fragment, +lights_lambert_fragment,lights_lambert_pars_fragment,lights_pars_begin,lights_toon_fragment, +lights_toon_pars_fragment,lights_phong_fragment,lights_phong_pars_fragment,lights_physical_fragment, +lights_physical_pars_fragment,lights_fragment_begin,lights_fragment_maps,lights_fragment_end, +logdepthbuf_fragment,logdepthbuf_pars_fragment,logdepthbuf_pars_vertex,logdepthbuf_vertex, +map_fragment,map_pars_fragment,map_particle_fragment,map_particle_pars_fragment, +metalnessmap_fragment,metalnessmap_pars_fragment,morphcolor_vertex,morphnormal_vertex, +morphtarget_pars_vertex,morphtarget_vertex,normal_fragment_begin,normal_fragment_maps, +normal_pars_fragment,normal_pars_vertex,normal_vertex,normalmap_pars_fragment,clearcoat_normal_fragment_begin, +clearcoat_normal_fragment_maps,clearcoat_pars_fragment,iridescence_pars_fragment, +opaque_fragment,packing,premultiplied_alpha_fragment,project_vertex,dithering_fragment, +dithering_pars_fragment,roughnessmap_fragment,roughnessmap_pars_fragment,shadowmap_pars_fragment, +shadowmap_pars_vertex,shadowmap_vertex,shadowmask_pars_fragment,skinbase_vertex, +skinning_pars_vertex,skinning_vertex,skinnormal_vertex,specularmap_fragment,specularmap_pars_fragment, +tonemapping_fragment,tonemapping_pars_fragment,transmission_fragment,transmission_pars_fragment, +uv_pars_fragment,uv_pars_vertex,uv_vertex,worldpos_vertex,background_vert:vertex$h, +background_frag:fragment$h,backgroundCube_vert:vertex$g,backgroundCube_frag:fragment$g, +cube_vert:vertex$f,cube_frag:fragment$f,depth_vert:vertex$e,depth_frag:fragment$e, +distanceRGBA_vert:vertex$d,distanceRGBA_frag:fragment$d,equirect_vert:vertex$c,equirect_frag:fragment$c, +linedashed_vert:vertex$b,linedashed_frag:fragment$b,meshbasic_vert:vertex$a,meshbasic_frag:fragment$a, +meshlambert_vert:vertex$9,meshlambert_frag:fragment$9,meshmatcap_vert:vertex$8,meshmatcap_frag:fragment$8, +meshnormal_vert:vertex$7,meshnormal_frag:fragment$7,meshphong_vert:vertex$6,meshphong_frag:fragment$6, +meshphysical_vert:vertex$5,meshphysical_frag:fragment$5,meshtoon_vert:vertex$4,meshtoon_frag:fragment$4, +points_vert:vertex$3,points_frag:fragment$3,shadow_vert:vertex$2,shadow_frag:fragment$2, +sprite_vert:vertex$1,sprite_frag:fragment$1},UniformsLib={common:{diffuse:{value:new Color2( +16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Matrix32}, +alphaMap:{value:null},alphaMapTransform:{value:new Matrix32},alphaTest:{value:0}}, +specularmap:{specularMap:{value:null},specularMapTransform:{value:new Matrix32}}, +envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5}, +refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}, +aoMapTransform:{value:new Matrix32}},lightmap:{lightMap:{value:null},lightMapIntensity:{ +value:1},lightMapTransform:{value:new Matrix32}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{ +value:new Matrix32},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{ +value:new Matrix32},normalScale:{value:new Vector22(1,1)}},displacementmap:{displacementMap:{ +value:null},displacementMapTransform:{value:new Matrix32},displacementScale:{value:1}, +displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{ +value:new Matrix32}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{ +value:new Matrix32}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{ +value:new Matrix32}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5}, +fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Color2(16777215)}},lights:{ +ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{ +direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{}, +shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]}, +directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{}, +direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{ +value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}}, +spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{ +value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{ +value:[],properties:{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 Color2(16777215)},opacity:{ +value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{ +value:new Matrix32},alphaTest:{value:0},uvTransform:{value:new Matrix32}},sprite:{ +diffuse:{value:new Color2(16777215)},opacity:{value:1},center:{value:new Vector22( +.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Matrix32},alphaMap:{ +value:null},alphaMapTransform:{value:new Matrix32},alphaTest:{value:0}}},ShaderLib={ +basic:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib. +envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.fog]),vertexShader:ShaderChunk. +meshbasic_vert,fragmentShader:ShaderChunk.meshbasic_frag},lambert:{uniforms:mergeUniforms( +[UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap, +UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap, +UniformsLib.displacementmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color2( +0)}}]),vertexShader:ShaderChunk.meshlambert_vert,fragmentShader:ShaderChunk.meshlambert_frag}, +phong:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib. +envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib. +bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,UniformsLib. +lights,{emissive:{value:new Color2(0)},specular:{value:new Color2(1118481)},shininess:{ +value:30}}]),vertexShader:ShaderChunk.meshphong_vert,fragmentShader:ShaderChunk. +meshphong_frag},standard:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib. +envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib. +bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.roughnessmap, +UniformsLib.metalnessmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color2( +0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ShaderChunk. +meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag},toon:{uniforms:mergeUniforms( +[UniformsLib.common,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap, +UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib. +gradientmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:new Color2(0)}}]), +vertexShader:ShaderChunk.meshtoon_vert,fragmentShader:ShaderChunk.meshtoon_frag}, +matcap:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.bumpmap,UniformsLib. +normalmap,UniformsLib.displacementmap,UniformsLib.fog,{matcap:{value:null}}]),vertexShader:ShaderChunk. +meshmatcap_vert,fragmentShader:ShaderChunk.meshmatcap_frag},points:{uniforms:mergeUniforms( +[UniformsLib.points,UniformsLib.fog]),vertexShader:ShaderChunk.points_vert,fragmentShader:ShaderChunk. +points_frag},dashed:{uniforms:mergeUniforms([UniformsLib.common,UniformsLib.fog, +{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ShaderChunk. +linedashed_vert,fragmentShader:ShaderChunk.linedashed_frag},depth:{uniforms:mergeUniforms( +[UniformsLib.common,UniformsLib.displacementmap]),vertexShader:ShaderChunk.depth_vert, +fragmentShader:ShaderChunk.depth_frag},normal:{uniforms:mergeUniforms([UniformsLib. +common,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,{opacity:{ +value:1}}]),vertexShader:ShaderChunk.meshnormal_vert,fragmentShader:ShaderChunk. +meshnormal_frag},sprite:{uniforms:mergeUniforms([UniformsLib.sprite,UniformsLib. +fog]),vertexShader:ShaderChunk.sprite_vert,fragmentShader:ShaderChunk.sprite_frag}, +background:{uniforms:{uvTransform:{value:new Matrix32},t2D:{value:null},backgroundIntensity:{ +value:1}},vertexShader:ShaderChunk.background_vert,fragmentShader:ShaderChunk.background_frag}, +backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{ +value:0},backgroundIntensity:{value:1}},vertexShader:ShaderChunk.backgroundCube_vert, +fragmentShader:ShaderChunk.backgroundCube_frag},cube:{uniforms:{tCube:{value:null}, +tFlip:{value:-1},opacity:{value:1}},vertexShader:ShaderChunk.cube_vert,fragmentShader:ShaderChunk. +cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ShaderChunk. +equirect_vert,fragmentShader:ShaderChunk.equirect_frag},distanceRGBA:{uniforms:mergeUniforms( +[UniformsLib.common,UniformsLib.displacementmap,{referencePosition:{value:new Vector32}, +nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ShaderChunk.distanceRGBA_vert, +fragmentShader:ShaderChunk.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([UniformsLib. +lights,UniformsLib.fog,{color:{value:new Color2(0)},opacity:{value:1}}]),vertexShader:ShaderChunk. +shadow_vert,fragmentShader:ShaderChunk.shadow_frag}};ShaderLib.physical={uniforms:mergeUniforms( +[ShaderLib.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{ +value:new Matrix32},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{ +value:new Matrix32},clearcoatNormalScale:{value:new Vector22(1,1)},clearcoatRoughness:{ +value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Matrix32}, +iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Matrix32}, +iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{ +value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{ +value:new Matrix32},sheen:{value:0},sheenColor:{value:new Color2(0)},sheenColorMap:{ +value:null},sheenColorMapTransform:{value:new Matrix32},sheenRoughness:{value:1}, +sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Matrix32},transmission:{ +value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Matrix32}, +transmissionSamplerSize:{value:new Vector22},transmissionSamplerMap:{value:null}, +thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Matrix32}, +attenuationDistance:{value:0},attenuationColor:{value:new Color2(0)},specularColor:{ +value:new Color2(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{ +value:new Matrix32},specularIntensity:{value:1},specularIntensityMap:{value:null}, +specularIntensityMapTransform:{value:new Matrix32},anisotropyVector:{value:new Vector22}, +anisotropyMap:{value:null},anisotropyMapTransform:{value:new Matrix32}}]),vertexShader:ShaderChunk. +meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag};var _rgb={r:0,b:0, +g:0};function WebGLBackground(renderer,cubemaps,cubeuvmaps,state,objects,alpha,premultipliedAlpha){ +let clearColor=new Color2(0),clearAlpha=alpha===!0?0:1,planeMesh,boxMesh,currentBackground=null, +currentBackgroundVersion=0,currentTonemapping=null;function render2(renderList,scene2){ +let forceClear=!1,background=scene2.isScene===!0?scene2.background:null;background&& +background.isTexture&&(background=(scene2.backgroundBlurriness>0?cubeuvmaps:cubemaps). +get(background)),background===null?setClear(clearColor,clearAlpha):background&&background. +isColor&&(setClear(background,1),forceClear=!0);let environmentBlendMode=renderer. +xr.getEnvironmentBlendMode();environmentBlendMode==="additive"?state.buffers.color. +setClear(0,0,0,1,premultipliedAlpha):environmentBlendMode==="alpha-blend"&&state. +buffers.color.setClear(0,0,0,0,premultipliedAlpha),(renderer.autoClear||forceClear)&& +renderer.clear(renderer.autoClearColor,renderer.autoClearDepth,renderer.autoClearStencil), +background&&(background.isCubeTexture||background.mapping===CubeUVReflectionMapping2)? +(boxMesh===void 0&&(boxMesh=new Mesh3(new BoxGeometry2(1,1,1),new ShaderMaterial( +{name:"BackgroundCubeMaterial",uniforms:cloneUniforms(ShaderLib.backgroundCube.uniforms), +vertexShader:ShaderLib.backgroundCube.vertexShader,fragmentShader:ShaderLib.backgroundCube. +fragmentShader,side:BackSide2,depthTest:!1,depthWrite:!1,fog:!1})),boxMesh.geometry. +deleteAttribute("normal"),boxMesh.geometry.deleteAttribute("uv"),boxMesh.onBeforeRender= +function(renderer2,scene3,camera){this.matrixWorld.copyPosition(camera.matrixWorld)}, +Object.defineProperty(boxMesh.material,"envMap",{get:function(){return this.uniforms. +envMap.value}}),objects.update(boxMesh)),boxMesh.material.uniforms.envMap.value= +background,boxMesh.material.uniforms.flipEnvMap.value=background.isCubeTexture&& +background.isRenderTargetTexture===!1?-1:1,boxMesh.material.uniforms.backgroundBlurriness. +value=scene2.backgroundBlurriness,boxMesh.material.uniforms.backgroundIntensity. +value=scene2.backgroundIntensity,boxMesh.material.toneMapped=ColorManagement2.getTransfer( +background.colorSpace)!==SRGBTransfer2,(currentBackground!==background||currentBackgroundVersion!== +background.version||currentTonemapping!==renderer.toneMapping)&&(boxMesh.material. +needsUpdate=!0,currentBackground=background,currentBackgroundVersion=background. +version,currentTonemapping=renderer.toneMapping),boxMesh.layers.enableAll(),renderList. +unshift(boxMesh,boxMesh.geometry,boxMesh.material,0,0,null)):background&&background. +isTexture&&(planeMesh===void 0&&(planeMesh=new Mesh3(new PlaneGeometry2(2,2),new ShaderMaterial( +{name:"BackgroundMaterial",uniforms:cloneUniforms(ShaderLib.background.uniforms), +vertexShader:ShaderLib.background.vertexShader,fragmentShader:ShaderLib.background. +fragmentShader,side:FrontSide2,depthTest:!1,depthWrite:!1,fog:!1})),planeMesh.geometry. +deleteAttribute("normal"),Object.defineProperty(planeMesh.material,"map",{get:function(){ +return this.uniforms.t2D.value}}),objects.update(planeMesh)),planeMesh.material. +uniforms.t2D.value=background,planeMesh.material.uniforms.backgroundIntensity.value= +scene2.backgroundIntensity,planeMesh.material.toneMapped=ColorManagement2.getTransfer( +background.colorSpace)!==SRGBTransfer2,background.matrixAutoUpdate===!0&&background. +updateMatrix(),planeMesh.material.uniforms.uvTransform.value.copy(background.matrix), +(currentBackground!==background||currentBackgroundVersion!==background.version|| +currentTonemapping!==renderer.toneMapping)&&(planeMesh.material.needsUpdate=!0,currentBackground= +background,currentBackgroundVersion=background.version,currentTonemapping=renderer. +toneMapping),planeMesh.layers.enableAll(),renderList.unshift(planeMesh,planeMesh. +geometry,planeMesh.material,0,0,null))}__name(render2,"render");function setClear(color,alpha2){ +color.getRGB(_rgb,getUnlitUniformColorSpace(renderer)),state.buffers.color.setClear( +_rgb.r,_rgb.g,_rgb.b,alpha2,premultipliedAlpha)}return __name(setClear,"setClear"), +{getClearColor:function(){return clearColor},setClearColor:function(color,alpha2=1){ +clearColor.set(color),clearAlpha=alpha2,setClear(clearColor,clearAlpha)},getClearAlpha:function(){ +return clearAlpha},setClearAlpha:function(alpha2){clearAlpha=alpha2,setClear(clearColor, +clearAlpha)},render:render2}}__name(WebGLBackground,"WebGLBackground");function WebGLBindingStates(gl,extensions,attributes,capabilities){ +let maxVertexAttributes=gl.getParameter(gl.MAX_VERTEX_ATTRIBS),extension=capabilities. +isWebGL2?null:extensions.get("OES_vertex_array_object"),vaoAvailable=capabilities. +isWebGL2||extension!==null,bindingStates={},defaultState=createBindingState(null), +currentState=defaultState,forceUpdate=!1;function setup(object,material,program,geometry,index){ +let updateBuffers=!1;if(vaoAvailable){let state=getBindingState(geometry,program, +material);currentState!==state&&(currentState=state,bindVertexArrayObject(currentState. +object)),updateBuffers=needsUpdate(object,geometry,program,index),updateBuffers&& +saveCache(object,geometry,program,index)}else{let wireframe=material.wireframe=== +!0;(currentState.geometry!==geometry.id||currentState.program!==program.id||currentState. +wireframe!==wireframe)&&(currentState.geometry=geometry.id,currentState.program= +program.id,currentState.wireframe=wireframe,updateBuffers=!0)}index!==null&&attributes. +update(index,gl.ELEMENT_ARRAY_BUFFER),(updateBuffers||forceUpdate)&&(forceUpdate= +!1,setupVertexAttributes(object,material,program,geometry),index!==null&&gl.bindBuffer( +gl.ELEMENT_ARRAY_BUFFER,attributes.get(index).buffer))}__name(setup,"setup");function createVertexArrayObject(){ +return capabilities.isWebGL2?gl.createVertexArray():extension.createVertexArrayOES()} +__name(createVertexArrayObject,"createVertexArrayObject");function bindVertexArrayObject(vao){ +return capabilities.isWebGL2?gl.bindVertexArray(vao):extension.bindVertexArrayOES( +vao)}__name(bindVertexArrayObject,"bindVertexArrayObject");function deleteVertexArrayObject(vao){ +return capabilities.isWebGL2?gl.deleteVertexArray(vao):extension.deleteVertexArrayOES( +vao)}__name(deleteVertexArrayObject,"deleteVertexArrayObject");function getBindingState(geometry,program,material){ +let wireframe=material.wireframe===!0,programMap=bindingStates[geometry.id];programMap=== +void 0&&(programMap={},bindingStates[geometry.id]=programMap);let stateMap=programMap[program. +id];stateMap===void 0&&(stateMap={},programMap[program.id]=stateMap);let state=stateMap[wireframe]; +return state===void 0&&(state=createBindingState(createVertexArrayObject()),stateMap[wireframe]= +state),state}__name(getBindingState,"getBindingState");function createBindingState(vao){ +let newAttributes=[],enabledAttributes=[],attributeDivisors=[];for(let i2=0;i2=0){let cachedAttribute=cachedAttributes[name2], +geometryAttribute=geometryAttributes[name2];if(geometryAttribute===void 0&&(name2=== +"instanceMatrix"&&object.instanceMatrix&&(geometryAttribute=object.instanceMatrix), +name2==="instanceColor"&&object.instanceColor&&(geometryAttribute=object.instanceColor)), +cachedAttribute===void 0||cachedAttribute.attribute!==geometryAttribute||geometryAttribute&& +cachedAttribute.data!==geometryAttribute.data)return!0;attributesNum++}return currentState. +attributesNum!==attributesNum||currentState.index!==index}__name(needsUpdate,"ne\ +edsUpdate");function saveCache(object,geometry,program,index){let cache2={},attributes2=geometry. +attributes,attributesNum=0,programAttributes=program.getAttributes();for(let name2 in programAttributes) +if(programAttributes[name2].location>=0){let attribute2=attributes2[name2];attribute2=== +void 0&&(name2==="instanceMatrix"&&object.instanceMatrix&&(attribute2=object.instanceMatrix), +name2==="instanceColor"&&object.instanceColor&&(attribute2=object.instanceColor)); +let data={};data.attribute=attribute2,attribute2&&attribute2.data&&(data.data=attribute2. +data),cache2[name2]=data,attributesNum++}currentState.attributes=cache2,currentState. +attributesNum=attributesNum,currentState.index=index}__name(saveCache,"saveCache"); +function initAttributes(){let newAttributes=currentState.newAttributes;for(let i2=0, +il=newAttributes.length;i2=0){let geometryAttribute=geometryAttributes[name2]; +if(geometryAttribute===void 0&&(name2==="instanceMatrix"&&object.instanceMatrix&& +(geometryAttribute=object.instanceMatrix),name2==="instanceColor"&&object.instanceColor&& +(geometryAttribute=object.instanceColor)),geometryAttribute!==void 0){let normalized=geometryAttribute. +normalized,size3=geometryAttribute.itemSize,attribute2=attributes.get(geometryAttribute); +if(attribute2===void 0)continue;let buffer=attribute2.buffer,type=attribute2.type, +bytesPerElement=attribute2.bytesPerElement,integer=capabilities.isWebGL2===!0&&(type=== +gl.INT||type===gl.UNSIGNED_INT||geometryAttribute.gpuType===IntType2);if(geometryAttribute. +isInterleavedBufferAttribute){let data=geometryAttribute.data,stride=data.stride, +offset=geometryAttribute.offset;if(data.isInstancedInterleavedBuffer){for(let i2=0;i2< +programAttribute.locationSize;i2++)enableAttributeAndDivisor(programAttribute.location+ +i2,data.meshPerAttribute);object.isInstancedMesh!==!0&&geometry._maxInstanceCount=== +void 0&&(geometry._maxInstanceCount=data.meshPerAttribute*data.count)}else for(let i2=0;i2< +programAttribute.locationSize;i2++)enableAttribute(programAttribute.location+i2); +gl.bindBuffer(gl.ARRAY_BUFFER,buffer);for(let i2=0;i20&&gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, +gl.HIGH_FLOAT).precision>0)return"highp";precision2="mediump"}return precision2=== +"mediump"&&gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.MEDIUM_FLOAT).precision> +0&&gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.MEDIUM_FLOAT).precision>0?"\ +mediump":"lowp"}__name(getMaxPrecision,"getMaxPrecision");let isWebGL2=typeof WebGL2RenderingContext< +"u"&&gl.constructor.name==="WebGL2RenderingContext",precision=parameters.precision!== +void 0?parameters.precision:"highp",maxPrecision=getMaxPrecision(precision);maxPrecision!== +precision&&(console.warn("THREE.WebGLRenderer:",precision,"not supported, using", +maxPrecision,"instead."),precision=maxPrecision);let drawBuffers=isWebGL2||extensions. +has("WEBGL_draw_buffers"),logarithmicDepthBuffer=parameters.logarithmicDepthBuffer=== +!0,maxTextures=gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures=gl. +getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize=gl.getParameter(gl. +MAX_TEXTURE_SIZE),maxCubemapSize=gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes=gl. +getParameter(gl.MAX_VERTEX_ATTRIBS),maxVertexUniforms=gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS), +maxVaryings=gl.getParameter(gl.MAX_VARYING_VECTORS),maxFragmentUniforms=gl.getParameter( +gl.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures=maxVertexTextures>0,floatFragmentTextures=isWebGL2|| +extensions.has("OES_texture_float"),floatVertexTextures=vertexTextures&&floatFragmentTextures, +maxSamples=isWebGL2?gl.getParameter(gl.MAX_SAMPLES):0;return{isWebGL2,drawBuffers, +getMaxAnisotropy,getMaxPrecision,precision,logarithmicDepthBuffer,maxTextures,maxVertexTextures, +maxTextureSize,maxCubemapSize,maxAttributes,maxVertexUniforms,maxVaryings,maxFragmentUniforms, +vertexTextures,floatFragmentTextures,floatVertexTextures,maxSamples}}__name(WebGLCapabilities, +"WebGLCapabilities");function WebGLClipping(properties){let scope=this,globalState=null, +numGlobalPlanes=0,localClippingEnabled=!1,renderingShadows=!1,plane=new Plane2,viewNormalMatrix=new Matrix32, +uniform={value:null,needsUpdate:!1};this.uniform=uniform,this.numPlanes=0,this.numIntersection= +0,this.init=function(planes,enableLocalClipping){let enabled=planes.length!==0|| +enableLocalClipping||numGlobalPlanes!==0||localClippingEnabled;return localClippingEnabled= +enableLocalClipping,numGlobalPlanes=planes.length,enabled},this.beginShadows=function(){ +renderingShadows=!0,projectPlanes(null)},this.endShadows=function(){renderingShadows= +!1},this.setGlobalState=function(planes,camera){globalState=projectPlanes(planes, +camera,0)},this.setState=function(material,camera,useCache){let planes=material. +clippingPlanes,clipIntersection=material.clipIntersection,clipShadows=material.clipShadows, +materialProperties=properties.get(material);if(!localClippingEnabled||planes===null|| +planes.length===0||renderingShadows&&!clipShadows)renderingShadows?projectPlanes( +null):resetGlobalState();else{let nGlobal=renderingShadows?0:numGlobalPlanes,lGlobal=nGlobal* +4,dstArray=materialProperties.clippingState||null;uniform.value=dstArray,dstArray= +projectPlanes(planes,camera,lGlobal,useCache);for(let i2=0;i2!==lGlobal;++i2)dstArray[i2]= +globalState[i2];materialProperties.clippingState=dstArray,this.numIntersection=clipIntersection? +this.numPlanes:0,this.numPlanes+=nGlobal}};function resetGlobalState(){uniform.value!== +globalState&&(uniform.value=globalState,uniform.needsUpdate=numGlobalPlanes>0),scope. +numPlanes=numGlobalPlanes,scope.numIntersection=0}__name(resetGlobalState,"reset\ +GlobalState");function projectPlanes(planes,camera,dstOffset,skipTransform){let nPlanes=planes!== +null?planes.length:0,dstArray=null;if(nPlanes!==0){if(dstArray=uniform.value,skipTransform!== +!0||dstArray===null){let flatSize=dstOffset+nPlanes*4,viewMatrix=camera.matrixWorldInverse; +viewNormalMatrix.getNormalMatrix(viewMatrix),(dstArray===null||dstArray.length0){let renderTarget=new WebGLCubeRenderTarget(image. +height/2);return renderTarget.fromEquirectangularTexture(renderer,texture),cubemaps. +set(texture,renderTarget),texture.addEventListener("dispose",onTextureDispose),mapTextureMapping( +renderTarget.texture,texture.mapping)}else return null}}return texture}__name(get, +"get");function onTextureDispose(event){let texture=event.target;texture.removeEventListener( +"dispose",onTextureDispose);let cubemap=cubemaps.get(texture);cubemap!==void 0&& +(cubemaps.delete(texture),cubemap.dispose())}__name(onTextureDispose,"onTextureD\ +ispose");function dispose(){cubemaps=new WeakMap}return __name(dispose,"dispose"), +{get,dispose}}__name(WebGLCubeMaps,"WebGLCubeMaps");var OrthographicCamera=class extends Camera{static{ +__name(this,"OrthographicCamera")}constructor(left=-1,right=1,top=1,bottom=-1,near=.1,far=2e3){ +super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1, +this.view=null,this.left=left,this.right=right,this.top=top,this.bottom=bottom,this. +near=near,this.far=far,this.updateProjectionMatrix()}copy(source,recursive){return super. +copy(source,recursive),this.left=source.left,this.right=source.right,this.top=source. +top,this.bottom=source.bottom,this.near=source.near,this.far=source.far,this.zoom= +source.zoom,this.view=source.view===null?null:Object.assign({},source.view),this}setViewOffset(fullWidth,fullHeight,x2,y2,width,height){ +this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0, +width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=fullWidth,this.view. +fullHeight=fullHeight,this.view.offsetX=x2,this.view.offsetY=y2,this.view.width= +width,this.view.height=height,this.updateProjectionMatrix()}clearViewOffset(){this. +view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){ +let dx=(this.right-this.left)/(2*this.zoom),dy=(this.top-this.bottom)/(2*this.zoom), +cx=(this.right+this.left)/2,cy=(this.top+this.bottom)/2,left=cx-dx,right=cx+dx,top=cy+ +dy,bottom=cy-dy;if(this.view!==null&&this.view.enabled){let scaleW=(this.right-this. +left)/this.view.fullWidth/this.zoom,scaleH=(this.top-this.bottom)/this.view.fullHeight/ +this.zoom;left+=scaleW*this.view.offsetX,right=left+scaleW*this.view.width,top-= +scaleH*this.view.offsetY,bottom=top-scaleH*this.view.height}this.projectionMatrix. +makeOrthographic(left,right,top,bottom,this.near,this.far,this.coordinateSystem), +this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(meta){let data=super. +toJSON(meta);return data.object.zoom=this.zoom,data.object.left=this.left,data.object. +right=this.right,data.object.top=this.top,data.object.bottom=this.bottom,data.object. +near=this.near,data.object.far=this.far,this.view!==null&&(data.object.view=Object. +assign({},this.view)),data}},LOD_MIN=4,EXTRA_LOD_SIGMA=[.125,.215,.35,.446,.526, +.582],MAX_SAMPLES=20,_flatCamera=new OrthographicCamera,_clearColor=new Color2,_oldTarget=null, +_oldActiveCubeFace=0,_oldActiveMipmapLevel=0,PHI=(1+Math.sqrt(5))/2,INV_PHI=1/PHI, +_axisDirections=[new Vector32(1,1,1),new Vector32(-1,1,1),new Vector32(1,1,-1),new Vector32( +-1,1,-1),new Vector32(0,PHI,INV_PHI),new Vector32(0,PHI,-INV_PHI),new Vector32(INV_PHI, +0,PHI),new Vector32(-INV_PHI,0,PHI),new Vector32(PHI,INV_PHI,0),new Vector32(-PHI, +INV_PHI,0)],PMREMGenerator=class{static{__name(this,"PMREMGenerator")}constructor(renderer){ +this._renderer=renderer,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize= +0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this. +_cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(scene2,sigma=0,near=.1,far=100){ +_oldTarget=this._renderer.getRenderTarget(),_oldActiveCubeFace=this._renderer.getActiveCubeFace(), +_oldActiveMipmapLevel=this._renderer.getActiveMipmapLevel(),this._setSize(256);let cubeUVRenderTarget=this. +_allocateTargets();return cubeUVRenderTarget.depthBuffer=!0,this._sceneToCubeUV( +scene2,near,far,cubeUVRenderTarget),sigma>0&&this._blur(cubeUVRenderTarget,0,0,sigma), +this._applyPMREM(cubeUVRenderTarget),this._cleanup(cubeUVRenderTarget),cubeUVRenderTarget}fromEquirectangular(equirectangular,renderTarget=null){ +return this._fromTexture(equirectangular,renderTarget)}fromCubemap(cubemap,renderTarget=null){ +return this._fromTexture(cubemap,renderTarget)}compileCubemapShader(){this._cubemapMaterial=== +null&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){ +this._equirectMaterial===null&&(this._equirectMaterial=_getEquirectMaterial(),this. +_compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!== +null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial. +dispose()}_setSize(cubeSize){this._lodMax=Math.floor(Math.log2(cubeSize)),this._cubeSize= +Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial. +dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose(); +for(let i2=0;i22?size3:0, +size3,size3),renderer.setRenderTarget(cubeUVRenderTarget),useSolidColor&&renderer. +render(backgroundBox,cubeCamera),renderer.render(scene2,cubeCamera)}backgroundBox. +geometry.dispose(),backgroundBox.material.dispose(),renderer.toneMapping=toneMapping, +renderer.autoClear=originalAutoClear,scene2.background=background}_textureToCubeUV(texture,cubeUVRenderTarget){ +let renderer=this._renderer,isCubeTexture=texture.mapping===CubeReflectionMapping2|| +texture.mapping===CubeRefractionMapping2;isCubeTexture?(this._cubemapMaterial=== +null&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms. +flipEnvMap.value=texture.isRenderTargetTexture===!1?-1:1):this._equirectMaterial=== +null&&(this._equirectMaterial=_getEquirectMaterial());let material=isCubeTexture? +this._cubemapMaterial:this._equirectMaterial,mesh=new Mesh3(this._lodPlanes[0],material), +uniforms=material.uniforms;uniforms.envMap.value=texture;let size3=this._cubeSize; +_setViewport(cubeUVRenderTarget,0,0,3*size3,2*size3),renderer.setRenderTarget(cubeUVRenderTarget), +renderer.render(mesh,_flatCamera)}_applyPMREM(cubeUVRenderTarget){let renderer=this. +_renderer,autoClear=renderer.autoClear;renderer.autoClear=!1;for(let i2=1;i2MAX_SAMPLES&&console. +warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested\ + ${samples} samples when the maximum is set to ${MAX_SAMPLES}`);let weights=[],sum=0; +for(let i2=0;i2_lodMax-LOD_MIN?lodOut-_lodMax+LOD_MIN:0),y2=4*(this._cubeSize-outputSize); +_setViewport(targetOut,x2,y2,3*outputSize,2*outputSize),renderer.setRenderTarget( +targetOut),renderer.render(blurMesh,_flatCamera)}};function _createPlanes(lodMax){ +let lodPlanes=[],sizeLods=[],sigmas=[],lod=lodMax,totalLods=lodMax-LOD_MIN+1+EXTRA_LOD_SIGMA. +length;for(let i2=0;i2lodMax-LOD_MIN?sigma=EXTRA_LOD_SIGMA[i2-lodMax+LOD_MIN- +1]:i2===0&&(sigma=0),sigmas.push(sigma);let texelSize=1/(sizeLod-2),min=-texelSize, +max2=1+texelSize,uv1=[min,min,max2,min,max2,max2,min,min,max2,max2,min,max2],cubeFaces=6, +vertices=6,positionSize=3,uvSize=2,faceIndexSize=1,position2=new Float32Array(positionSize* +vertices*cubeFaces),uv=new Float32Array(uvSize*vertices*cubeFaces),faceIndex=new Float32Array( +faceIndexSize*vertices*cubeFaces);for(let face=0;face2?0:-1,coordinates=[x2,y2,0,x2+2/3,y2,0,x2+2/3,y2+1,0,x2,y2,0,x2+ +2/3,y2+1,0,x2,y2+1,0];position2.set(coordinates,positionSize*vertices*face),uv.set( +uv1,uvSize*vertices*face);let fill=[face,face,face,face,face,face];faceIndex.set( +fill,faceIndexSize*vertices*face)}let planes=new BufferGeometry2;planes.setAttribute( +"position",new BufferAttribute2(position2,positionSize)),planes.setAttribute("uv", +new BufferAttribute2(uv,uvSize)),planes.setAttribute("faceIndex",new BufferAttribute2( +faceIndex,faceIndexSize)),lodPlanes.push(planes),lod>LOD_MIN&&lod--}return{lodPlanes, +sizeLods,sigmas}}__name(_createPlanes,"_createPlanes");function _createRenderTarget(width,height,params){ +let cubeUVRenderTarget=new WebGLRenderTarget(width,height,params);return cubeUVRenderTarget. +texture.mapping=CubeUVReflectionMapping2,cubeUVRenderTarget.texture.name="PMREM.\ +cubeUv",cubeUVRenderTarget.scissorTest=!0,cubeUVRenderTarget}__name(_createRenderTarget, +"_createRenderTarget");function _setViewport(target,x2,y2,width,height){target.viewport. +set(x2,y2,width,height),target.scissor.set(x2,y2,width,height)}__name(_setViewport, +"_setViewport");function _getBlurShader(lodMax,width,height){let weights=new Float32Array( +MAX_SAMPLES),poleAxis=new Vector32(0,1,0);return new ShaderMaterial({name:"Spher\ +icalGaussianBlur",defines:{n:MAX_SAMPLES,CUBEUV_TEXEL_WIDTH:1/width,CUBEUV_TEXEL_HEIGHT:1/ +height,CUBEUV_MAX_MIP:`${lodMax}.0`},uniforms:{envMap:{value:null},samples:{value:1}, +weights:{value:weights},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0}, +poleAxis:{value:poleAxis}},vertexShader:_getCommonVertexShader(),fragmentShader:`\ + + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:NoBlending2,depthTest:!1,depthWrite:!1})}__name(_getBlurShader,"_ge\ +tBlurShader");function _getEquirectMaterial(){return new ShaderMaterial({name:"E\ +quirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader(), +fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:NoBlending2,depthTest:!1,depthWrite:!1})}__name(_getEquirectMaterial, +"_getEquirectMaterial");function _getCubemapMaterial(){return new ShaderMaterial( +{name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader(), +fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, v\ +OutputDirection.yz ) ); + + } + `,blending:NoBlending2,depthTest:!1,depthWrite:!1})}__name(_getCubemapMaterial, +"_getCubemapMaterial");function _getCommonVertexShader(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}__name(_getCommonVertexShader,"_getCommonVertexShader");function WebGLCubeUVMaps(renderer){ +let cubeUVmaps=new WeakMap,pmremGenerator=null;function get(texture){if(texture&& +texture.isTexture){let mapping=texture.mapping,isEquirectMap=mapping===EquirectangularReflectionMapping2|| +mapping===EquirectangularRefractionMapping2,isCubeMap=mapping===CubeReflectionMapping2|| +mapping===CubeRefractionMapping2;if(isEquirectMap||isCubeMap)if(texture.isRenderTargetTexture&& +texture.needsPMREMUpdate===!0){texture.needsPMREMUpdate=!1;let renderTarget=cubeUVmaps. +get(texture);return pmremGenerator===null&&(pmremGenerator=new PMREMGenerator(renderer)), +renderTarget=isEquirectMap?pmremGenerator.fromEquirectangular(texture,renderTarget): +pmremGenerator.fromCubemap(texture,renderTarget),cubeUVmaps.set(texture,renderTarget), +renderTarget.texture}else{if(cubeUVmaps.has(texture))return cubeUVmaps.get(texture). +texture;{let image=texture.image;if(isEquirectMap&&image&&image.height>0||isCubeMap&& +image&&isCubeTextureComplete(image)){pmremGenerator===null&&(pmremGenerator=new PMREMGenerator( +renderer));let renderTarget=isEquirectMap?pmremGenerator.fromEquirectangular(texture): +pmremGenerator.fromCubemap(texture);return cubeUVmaps.set(texture,renderTarget), +texture.addEventListener("dispose",onTextureDispose),renderTarget.texture}else return null}}} +return texture}__name(get,"get");function isCubeTextureComplete(image){let count=0, +length=6;for(let i2=0;i2capabilities.maxTextureSize&&(height=Math.ceil( +width/capabilities.maxTextureSize),width=capabilities.maxTextureSize);let buffer=new Float32Array( +width*height*4*morphTargetsCount),texture=new DataArrayTexture(buffer,width,height, +morphTargetsCount);texture.type=FloatType2,texture.needsUpdate=!0;let vertexDataStride=vertexDataCount* +4;for(let i2=0;i20)return array;let n=nBlocks*blockSize,r3=arrayCacheF32[n]; +if(r3===void 0&&(r3=new Float32Array(n),arrayCacheF32[n]=r3),nBlocks!==0){firstElem. +toArray(r3,0);for(let i2=1,offset=0;i2!==nBlocks;++i2)offset+=blockSize,array[i2]. +toArray(r3,offset)}return r3}__name(flatten,"flatten");function arraysEqual(a,b){ +if(a.length!==b.length)return!1;for(let i2=0,l=a.length;i2":" "}\ + ${line}: ${lines[i2]}`)}return lines2.join(` +`)}__name(handleSource,"handleSource");function getEncodingComponents(colorSpace){ +let workingPrimaries=ColorManagement2.getPrimaries(ColorManagement2.workingColorSpace), +encodingPrimaries=ColorManagement2.getPrimaries(colorSpace),gamutMapping;switch(workingPrimaries=== +encodingPrimaries?gamutMapping="":workingPrimaries===P3Primaries2&&encodingPrimaries=== +Rec709Primaries2?gamutMapping="LinearDisplayP3ToLinearSRGB":workingPrimaries===Rec709Primaries2&& +encodingPrimaries===P3Primaries2&&(gamutMapping="LinearSRGBToLinearDisplayP3"),colorSpace){case LinearSRGBColorSpace2:case LinearDisplayP3ColorSpace2: +return[gamutMapping,"LinearTransferOETF"];case SRGBColorSpace2:case DisplayP3ColorSpace2: +return[gamutMapping,"sRGBTransferOETF"];default:return console.warn("THREE.WebGL\ +Program: Unsupported color space:",colorSpace),[gamutMapping,"LinearTransferOETF"]}} +__name(getEncodingComponents,"getEncodingComponents");function getShaderErrors(gl,shader,type){ +let status=gl.getShaderParameter(shader,gl.COMPILE_STATUS),errors=gl.getShaderInfoLog( +shader).trim();if(status&&errors==="")return"";let errorMatches=/ERROR: 0:(\d+)/. +exec(errors);if(errorMatches){let errorLine=parseInt(errorMatches[1]);return type. +toUpperCase()+` + +`+errors+` + +`+handleSource(gl.getShaderSource(shader),errorLine)}else return errors}__name(getShaderErrors, +"getShaderErrors");function getTexelEncodingFunction(functionName,colorSpace){let components=getEncodingComponents( +colorSpace);return`vec4 ${functionName}( vec4 value ) { return ${components[0]}(\ + ${components[1]}( value ) ); }`}__name(getTexelEncodingFunction,"getTexelEncodi\ +ngFunction");function getToneMappingFunction(functionName,toneMapping){let toneMappingName; +switch(toneMapping){case LinearToneMapping2:toneMappingName="Linear";break;case ReinhardToneMapping2: +toneMappingName="Reinhard";break;case CineonToneMapping2:toneMappingName="Optimi\ +zedCineon";break;case ACESFilmicToneMapping2:toneMappingName="ACESFilmic";break;case AgXToneMapping2: +toneMappingName="AgX";break;case CustomToneMapping2:toneMappingName="Custom";break;default: +console.warn("THREE.WebGLProgram: Unsupported toneMapping:",toneMapping),toneMappingName= +"Linear"}return"vec3 "+functionName+"( vec3 color ) { return "+toneMappingName+"\ +ToneMapping( color ); }"}__name(getToneMappingFunction,"getToneMappingFunction"); +function generateExtensions(parameters){return[parameters.extensionDerivatives|| +parameters.envMapCubeUVHeight||parameters.bumpMap||parameters.normalMapTangentSpace|| +parameters.clearcoatNormalMap||parameters.flatShading||parameters.shaderID==="ph\ +ysical"?"#extension GL_OES_standard_derivatives : enable":"",(parameters.extensionFragDepth|| +parameters.logarithmicDepthBuffer)&¶meters.rendererExtensionFragDepth?"#exte\ +nsion GL_EXT_frag_depth : enable":"",parameters.extensionDrawBuffers&¶meters. +rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(parameters. +extensionShaderTextureLOD||parameters.envMap||parameters.transmission)&¶meters. +rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable": +""].filter(filterEmptyLine).join(` +`)}__name(generateExtensions,"generateExtensions");function generateVertexExtensions(parameters){ +return[parameters.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_dista\ +nce : require":""].filter(filterEmptyLine).join(` +`)}__name(generateVertexExtensions,"generateVertexExtensions");function generateDefines(defines){ +let chunks=[];for(let name2 in defines){let value=defines[name2];value!==!1&&chunks. +push("#define "+name2+" "+value)}return chunks.join(` +`)}__name(generateDefines,"generateDefines");function fetchAttributeLocations(gl,program){ +let attributes={},n=gl.getProgramParameter(program,gl.ACTIVE_ATTRIBUTES);for(let i2=0;i2< +n;i2++){let info=gl.getActiveAttrib(program,i2),name2=info.name,locationSize=1;info. +type===gl.FLOAT_MAT2&&(locationSize=2),info.type===gl.FLOAT_MAT3&&(locationSize= +3),info.type===gl.FLOAT_MAT4&&(locationSize=4),attributes[name2]={type:info.type, +location:gl.getAttribLocation(program,name2),locationSize}}return attributes}__name( +fetchAttributeLocations,"fetchAttributeLocations");function filterEmptyLine(string){ +return string!==""}__name(filterEmptyLine,"filterEmptyLine");function replaceLightNums(string,parameters){ +let numSpotLightCoords=parameters.numSpotLightShadows+parameters.numSpotLightMaps- +parameters.numSpotLightShadowsWithMaps;return string.replace(/NUM_DIR_LIGHTS/g,parameters. +numDirLights).replace(/NUM_SPOT_LIGHTS/g,parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, +parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,numSpotLightCoords). +replace(/NUM_RECT_AREA_LIGHTS/g,parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, +parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g,parameters.numHemiLights). +replace(/NUM_DIR_LIGHT_SHADOWS/g,parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, +parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,parameters. +numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,parameters.numPointLightShadows)} +__name(replaceLightNums,"replaceLightNums");function replaceClippingPlaneNums(string,parameters){ +return string.replace(/NUM_CLIPPING_PLANES/g,parameters.numClippingPlanes).replace( +/UNION_CLIPPING_PLANES/g,parameters.numClippingPlanes-parameters.numClipIntersection)} +__name(replaceClippingPlaneNums,"replaceClippingPlaneNums");var includePattern=/^[ \t]*#include +<([\w\d./]+)>/gm; +function resolveIncludes(string){return string.replace(includePattern,includeReplacer)} +__name(resolveIncludes,"resolveIncludes");var shaderChunkMap=new Map([["encoding\ +s_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_f\ +ragment"],["output_fragment","opaque_fragment"]]);function includeReplacer(match,include){ +let string=ShaderChunk[include];if(string===void 0){let newInclude=shaderChunkMap. +get(include);if(newInclude!==void 0)string=ShaderChunk[newInclude],console.warn( +'THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', +include,newInclude);else throw new Error("Can not resolve #include <"+include+">")} +return resolveIncludes(string)}__name(includeReplacer,"includeReplacer");var unrollLoopPattern=/#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; +function unrollLoops(string){return string.replace(unrollLoopPattern,loopReplacer)} +__name(unrollLoops,"unrollLoops");function loopReplacer(match,start,end,snippet){ +let string="";for(let i2=parseInt(start);i20&&(prefixVertex+=` +`),prefixFragment=[customExtensions,"#define SHADER_TYPE "+parameters.shaderType, +"#define SHADER_NAME "+parameters.shaderName,customDefines].filter(filterEmptyLine). +join(` +`),prefixFragment.length>0&&(prefixFragment+=` +`)):(prefixVertex=[generatePrecision(parameters),"#define SHADER_TYPE "+parameters. +shaderType,"#define SHADER_NAME "+parameters.shaderName,customDefines,parameters. +extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",parameters.batching?"#d\ +efine USE_BATCHING":"",parameters.instancing?"#define USE_INSTANCING":"",parameters. +instancingColor?"#define USE_INSTANCING_COLOR":"",parameters.useFog&¶meters. +fog?"#define USE_FOG":"",parameters.useFog&¶meters.fogExp2?"#define FOG_EXP2": +"",parameters.map?"#define USE_MAP":"",parameters.envMap?"#define USE_ENVMAP":"", +parameters.envMap?"#define "+envMapModeDefine:"",parameters.lightMap?"#define US\ +E_LIGHTMAP":"",parameters.aoMap?"#define USE_AOMAP":"",parameters.bumpMap?"#defi\ +ne USE_BUMPMAP":"",parameters.normalMap?"#define USE_NORMALMAP":"",parameters.normalMapObjectSpace? +"#define USE_NORMALMAP_OBJECTSPACE":"",parameters.normalMapTangentSpace?"#define\ + USE_NORMALMAP_TANGENTSPACE":"",parameters.displacementMap?"#define USE_DISPLACE\ +MENTMAP":"",parameters.emissiveMap?"#define USE_EMISSIVEMAP":"",parameters.anisotropy? +"#define USE_ANISOTROPY":"",parameters.anisotropyMap?"#define USE_ANISOTROPYMAP": +"",parameters.clearcoatMap?"#define USE_CLEARCOATMAP":"",parameters.clearcoatRoughnessMap? +"#define USE_CLEARCOAT_ROUGHNESSMAP":"",parameters.clearcoatNormalMap?"#define U\ +SE_CLEARCOAT_NORMALMAP":"",parameters.iridescenceMap?"#define USE_IRIDESCENCEMAP": +"",parameters.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"", +parameters.specularMap?"#define USE_SPECULARMAP":"",parameters.specularColorMap? +"#define USE_SPECULAR_COLORMAP":"",parameters.specularIntensityMap?"#define USE_\ +SPECULAR_INTENSITYMAP":"",parameters.roughnessMap?"#define USE_ROUGHNESSMAP":"", +parameters.metalnessMap?"#define USE_METALNESSMAP":"",parameters.alphaMap?"#defi\ +ne USE_ALPHAMAP":"",parameters.alphaHash?"#define USE_ALPHAHASH":"",parameters.transmission? +"#define USE_TRANSMISSION":"",parameters.transmissionMap?"#define USE_TRANSMISSI\ +ONMAP":"",parameters.thicknessMap?"#define USE_THICKNESSMAP":"",parameters.sheenColorMap? +"#define USE_SHEEN_COLORMAP":"",parameters.sheenRoughnessMap?"#define USE_SHEEN_\ +ROUGHNESSMAP":"",parameters.mapUv?"#define MAP_UV "+parameters.mapUv:"",parameters. +alphaMapUv?"#define ALPHAMAP_UV "+parameters.alphaMapUv:"",parameters.lightMapUv? +"#define LIGHTMAP_UV "+parameters.lightMapUv:"",parameters.aoMapUv?"#define AOMA\ +P_UV "+parameters.aoMapUv:"",parameters.emissiveMapUv?"#define EMISSIVEMAP_UV "+ +parameters.emissiveMapUv:"",parameters.bumpMapUv?"#define BUMPMAP_UV "+parameters. +bumpMapUv:"",parameters.normalMapUv?"#define NORMALMAP_UV "+parameters.normalMapUv: +"",parameters.displacementMapUv?"#define DISPLACEMENTMAP_UV "+parameters.displacementMapUv: +"",parameters.metalnessMapUv?"#define METALNESSMAP_UV "+parameters.metalnessMapUv: +"",parameters.roughnessMapUv?"#define ROUGHNESSMAP_UV "+parameters.roughnessMapUv: +"",parameters.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+parameters.anisotropyMapUv: +"",parameters.clearcoatMapUv?"#define CLEARCOATMAP_UV "+parameters.clearcoatMapUv: +"",parameters.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+parameters. +clearcoatNormalMapUv:"",parameters.clearcoatRoughnessMapUv?"#define CLEARCOAT_RO\ +UGHNESSMAP_UV "+parameters.clearcoatRoughnessMapUv:"",parameters.iridescenceMapUv? +"#define IRIDESCENCEMAP_UV "+parameters.iridescenceMapUv:"",parameters.iridescenceThicknessMapUv? +"#define IRIDESCENCE_THICKNESSMAP_UV "+parameters.iridescenceThicknessMapUv:"",parameters. +sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+parameters.sheenColorMapUv:"",parameters. +sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+parameters.sheenRoughnessMapUv: +"",parameters.specularMapUv?"#define SPECULARMAP_UV "+parameters.specularMapUv:"", +parameters.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+parameters.specularColorMapUv: +"",parameters.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+parameters. +specularIntensityMapUv:"",parameters.transmissionMapUv?"#define TRANSMISSIONMAP_\ +UV "+parameters.transmissionMapUv:"",parameters.thicknessMapUv?"#define THICKNES\ +SMAP_UV "+parameters.thicknessMapUv:"",parameters.vertexTangents&¶meters.flatShading=== +!1?"#define USE_TANGENT":"",parameters.vertexColors?"#define USE_COLOR":"",parameters. +vertexAlphas?"#define USE_COLOR_ALPHA":"",parameters.vertexUv1s?"#define USE_UV1": +"",parameters.vertexUv2s?"#define USE_UV2":"",parameters.vertexUv3s?"#define USE\ +_UV3":"",parameters.pointsUvs?"#define USE_POINTS_UV":"",parameters.flatShading? +"#define FLAT_SHADED":"",parameters.skinning?"#define USE_SKINNING":"",parameters. +morphTargets?"#define USE_MORPHTARGETS":"",parameters.morphNormals&¶meters.flatShading=== +!1?"#define USE_MORPHNORMALS":"",parameters.morphColors&¶meters.isWebGL2?"#d\ +efine USE_MORPHCOLORS":"",parameters.morphTargetsCount>0&¶meters.isWebGL2?"#\ +define MORPHTARGETS_TEXTURE":"",parameters.morphTargetsCount>0&¶meters.isWebGL2? +"#define MORPHTARGETS_TEXTURE_STRIDE "+parameters.morphTextureStride:"",parameters. +morphTargetsCount>0&¶meters.isWebGL2?"#define MORPHTARGETS_COUNT "+parameters. +morphTargetsCount:"",parameters.doubleSided?"#define DOUBLE_SIDED":"",parameters. +flipSided?"#define FLIP_SIDED":"",parameters.shadowMapEnabled?"#define USE_SHADO\ +WMAP":"",parameters.shadowMapEnabled?"#define "+shadowMapTypeDefine:"",parameters. +sizeAttenuation?"#define USE_SIZEATTENUATION":"",parameters.numLightProbes>0?"#d\ +efine USE_LIGHT_PROBES":"",parameters.useLegacyLights?"#define LEGACY_LIGHTS":"", +parameters.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",parameters.logarithmicDepthBuffer&& +parameters.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform \ +mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatri\ +x;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 camera\ +Position;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute ma\ +t4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 inst\ +anceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attrib\ +ute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2", +" attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif", +"#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR\ +_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3\ + color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_\ +TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," a\ +ttribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHN\ +ORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," att\ +ribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribut\ +e vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTa\ +rget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING", +" attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(filterEmptyLine).join(` +`),prefixFragment=[customExtensions,generatePrecision(parameters),"#define SHADE\ +R_TYPE "+parameters.shaderType,"#define SHADER_NAME "+parameters.shaderName,customDefines, +parameters.useFog&¶meters.fog?"#define USE_FOG":"",parameters.useFog&¶meters. +fogExp2?"#define FOG_EXP2":"",parameters.map?"#define USE_MAP":"",parameters.matcap? +"#define USE_MATCAP":"",parameters.envMap?"#define USE_ENVMAP":"",parameters.envMap? +"#define "+envMapTypeDefine:"",parameters.envMap?"#define "+envMapModeDefine:"", +parameters.envMap?"#define "+envMapBlendingDefine:"",envMapCubeUVSize?"#define C\ +UBEUV_TEXEL_WIDTH "+envMapCubeUVSize.texelWidth:"",envMapCubeUVSize?"#define CUB\ +EUV_TEXEL_HEIGHT "+envMapCubeUVSize.texelHeight:"",envMapCubeUVSize?"#define CUB\ +EUV_MAX_MIP "+envMapCubeUVSize.maxMip+".0":"",parameters.lightMap?"#define USE_L\ +IGHTMAP":"",parameters.aoMap?"#define USE_AOMAP":"",parameters.bumpMap?"#define \ +USE_BUMPMAP":"",parameters.normalMap?"#define USE_NORMALMAP":"",parameters.normalMapObjectSpace? +"#define USE_NORMALMAP_OBJECTSPACE":"",parameters.normalMapTangentSpace?"#define\ + USE_NORMALMAP_TANGENTSPACE":"",parameters.emissiveMap?"#define USE_EMISSIVEMAP": +"",parameters.anisotropy?"#define USE_ANISOTROPY":"",parameters.anisotropyMap?"#\ +define USE_ANISOTROPYMAP":"",parameters.clearcoat?"#define USE_CLEARCOAT":"",parameters. +clearcoatMap?"#define USE_CLEARCOATMAP":"",parameters.clearcoatRoughnessMap?"#de\ +fine USE_CLEARCOAT_ROUGHNESSMAP":"",parameters.clearcoatNormalMap?"#define USE_C\ +LEARCOAT_NORMALMAP":"",parameters.iridescence?"#define USE_IRIDESCENCE":"",parameters. +iridescenceMap?"#define USE_IRIDESCENCEMAP":"",parameters.iridescenceThicknessMap? +"#define USE_IRIDESCENCE_THICKNESSMAP":"",parameters.specularMap?"#define USE_SP\ +ECULARMAP":"",parameters.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",parameters. +specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",parameters.roughnessMap? +"#define USE_ROUGHNESSMAP":"",parameters.metalnessMap?"#define USE_METALNESSMAP": +"",parameters.alphaMap?"#define USE_ALPHAMAP":"",parameters.alphaTest?"#define U\ +SE_ALPHATEST":"",parameters.alphaHash?"#define USE_ALPHAHASH":"",parameters.sheen? +"#define USE_SHEEN":"",parameters.sheenColorMap?"#define USE_SHEEN_COLORMAP":"", +parameters.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",parameters.transmission? +"#define USE_TRANSMISSION":"",parameters.transmissionMap?"#define USE_TRANSMISSI\ +ONMAP":"",parameters.thicknessMap?"#define USE_THICKNESSMAP":"",parameters.vertexTangents&& +parameters.flatShading===!1?"#define USE_TANGENT":"",parameters.vertexColors||parameters. +instancingColor?"#define USE_COLOR":"",parameters.vertexAlphas?"#define USE_COLO\ +R_ALPHA":"",parameters.vertexUv1s?"#define USE_UV1":"",parameters.vertexUv2s?"#d\ +efine USE_UV2":"",parameters.vertexUv3s?"#define USE_UV3":"",parameters.pointsUvs? +"#define USE_POINTS_UV":"",parameters.gradientMap?"#define USE_GRADIENTMAP":"",parameters. +flatShading?"#define FLAT_SHADED":"",parameters.doubleSided?"#define DOUBLE_SIDE\ +D":"",parameters.flipSided?"#define FLIP_SIDED":"",parameters.shadowMapEnabled?"\ +#define USE_SHADOWMAP":"",parameters.shadowMapEnabled?"#define "+shadowMapTypeDefine: +"",parameters.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",parameters.numLightProbes> +0?"#define USE_LIGHT_PROBES":"",parameters.useLegacyLights?"#define LEGACY_LIGHT\ +S":"",parameters.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",parameters. +logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",parameters.logarithmicDepthBuffer&& +parameters.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform \ +mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;", +parameters.toneMapping!==NoToneMapping2?"#define TONE_MAPPING":"",parameters.toneMapping!== +NoToneMapping2?ShaderChunk.tonemapping_pars_fragment:"",parameters.toneMapping!== +NoToneMapping2?getToneMappingFunction("toneMapping",parameters.toneMapping):"",parameters. +dithering?"#define DITHERING":"",parameters.opaque?"#define OPAQUE":"",ShaderChunk. +colorspace_pars_fragment,getTexelEncodingFunction("linearToOutputTexel",parameters. +outputColorSpace),parameters.useDepthPacking?"#define DEPTH_PACKING "+parameters. +depthPacking:"",` +`].filter(filterEmptyLine).join(` +`)),vertexShader=resolveIncludes(vertexShader),vertexShader=replaceLightNums(vertexShader, +parameters),vertexShader=replaceClippingPlaneNums(vertexShader,parameters),fragmentShader= +resolveIncludes(fragmentShader),fragmentShader=replaceLightNums(fragmentShader,parameters), +fragmentShader=replaceClippingPlaneNums(fragmentShader,parameters),vertexShader= +unrollLoops(vertexShader),fragmentShader=unrollLoops(fragmentShader),parameters. +isWebGL2&¶meters.isRawShaderMaterial!==!0&&(versionString=`#version 300 es +`,prefixVertex=[customVertexExtensions,"precision mediump sampler2DArray;","#def\ +ine attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+prefixVertex,prefixFragment=["precision mediump sampler2DArray;","#define vary\ +ing in",parameters.glslVersion===GLSL32?"":"layout(location = 0) out highp vec4 \ +pc_fragColor;",parameters.glslVersion===GLSL32?"":"#define gl_FragColor pc_fragC\ +olor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#defin\ +e textureCube texture","#define texture2DProj textureProj","#define texture2DLod\ +EXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCub\ +eLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DPro\ +jGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+prefixFragment);let vertexGlsl=versionString+prefixVertex+vertexShader,fragmentGlsl=versionString+ +prefixFragment+fragmentShader,glVertexShader=WebGLShader(gl,gl.VERTEX_SHADER,vertexGlsl), +glFragmentShader=WebGLShader(gl,gl.FRAGMENT_SHADER,fragmentGlsl);gl.attachShader( +program,glVertexShader),gl.attachShader(program,glFragmentShader),parameters.index0AttributeName!== +void 0?gl.bindAttribLocation(program,0,parameters.index0AttributeName):parameters. +morphTargets===!0&&gl.bindAttribLocation(program,0,"position"),gl.linkProgram(program); +function onFirstUse(self2){if(renderer.debug.checkShaderErrors){let programLog=gl. +getProgramInfoLog(program).trim(),vertexLog=gl.getShaderInfoLog(glVertexShader). +trim(),fragmentLog=gl.getShaderInfoLog(glFragmentShader).trim(),runnable=!0,haveDiagnostics=!0; +if(gl.getProgramParameter(program,gl.LINK_STATUS)===!1)if(runnable=!1,typeof renderer. +debug.onShaderError=="function")renderer.debug.onShaderError(gl,program,glVertexShader, +glFragmentShader);else{let vertexErrors=getShaderErrors(gl,glVertexShader,"verte\ +x"),fragmentErrors=getShaderErrors(gl,glFragmentShader,"fragment");console.error( +"THREE.WebGLProgram: Shader Error "+gl.getError()+" - VALIDATE_STATUS "+gl.getProgramParameter( +program,gl.VALIDATE_STATUS)+` + +Program Info Log: `+programLog+` +`+vertexErrors+` +`+fragmentErrors)}else programLog!==""?console.warn("THREE.WebGLProgram: Program\ + Info Log:",programLog):(vertexLog===""||fragmentLog==="")&&(haveDiagnostics=!1); +haveDiagnostics&&(self2.diagnostics={runnable,programLog,vertexShader:{log:vertexLog, +prefix:prefixVertex},fragmentShader:{log:fragmentLog,prefix:prefixFragment}})}gl. +deleteShader(glVertexShader),gl.deleteShader(glFragmentShader),cachedUniforms=new WebGLUniforms( +gl,program),cachedAttributes=fetchAttributeLocations(gl,program)}__name(onFirstUse, +"onFirstUse");let cachedUniforms;this.getUniforms=function(){return cachedUniforms=== +void 0&&onFirstUse(this),cachedUniforms};let cachedAttributes;this.getAttributes= +function(){return cachedAttributes===void 0&&onFirstUse(this),cachedAttributes}; +let programReady=parameters.rendererExtensionParallelShaderCompile===!1;return this. +isReady=function(){return programReady===!1&&(programReady=gl.getProgramParameter( +program,COMPLETION_STATUS_KHR)),programReady},this.destroy=function(){bindingStates. +releaseStatesOfProgram(this),gl.deleteProgram(program),this.program=void 0},this. +type=parameters.shaderType,this.name=parameters.shaderName,this.id=programIdCount++, +this.cacheKey=cacheKey,this.usedTimes=1,this.program=program,this.vertexShader=glVertexShader, +this.fragmentShader=glFragmentShader,this}__name(WebGLProgram,"WebGLProgram");var _id$1=0, +WebGLShaderCache=class{static{__name(this,"WebGLShaderCache")}constructor(){this. +shaderCache=new Map,this.materialCache=new Map}update(material){let vertexShader=material. +vertexShader,fragmentShader=material.fragmentShader,vertexShaderStage=this._getShaderStage( +vertexShader),fragmentShaderStage=this._getShaderStage(fragmentShader),materialShaders=this. +_getShaderCacheForMaterial(material);return materialShaders.has(vertexShaderStage)=== +!1&&(materialShaders.add(vertexShaderStage),vertexShaderStage.usedTimes++),materialShaders. +has(fragmentShaderStage)===!1&&(materialShaders.add(fragmentShaderStage),fragmentShaderStage. +usedTimes++),this}remove(material){let materialShaders=this.materialCache.get(material); +for(let shaderStage of materialShaders)shaderStage.usedTimes--,shaderStage.usedTimes=== +0&&this.shaderCache.delete(shaderStage.code);return this.materialCache.delete(material), +this}getVertexShaderID(material){return this._getShaderStage(material.vertexShader). +id}getFragmentShaderID(material){return this._getShaderStage(material.fragmentShader). +id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(material){ +let cache2=this.materialCache,set=cache2.get(material);return set===void 0&&(set= +new Set,cache2.set(material,set)),set}_getShaderStage(code){let cache2=this.shaderCache, +stage=cache2.get(code);return stage===void 0&&(stage=new WebGLShaderStage(code), +cache2.set(code,stage)),stage}},WebGLShaderStage=class{static{__name(this,"WebGL\ +ShaderStage")}constructor(code){this.id=_id$1++,this.code=code,this.usedTimes=0}}; +function WebGLPrograms(renderer,cubemaps,cubeuvmaps,extensions,capabilities,bindingStates,clipping){ +let _programLayers=new Layers2,_customShaders=new WebGLShaderCache,programs=[],IS_WEBGL2=capabilities. +isWebGL2,logarithmicDepthBuffer=capabilities.logarithmicDepthBuffer,SUPPORTS_VERTEX_TEXTURES=capabilities. +vertexTextures,precision=capabilities.precision,shaderIDs={MeshDepthMaterial:"de\ +pth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"\ +basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"\ +toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"\ +matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"po\ +ints",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function getChannel(value){ +return value===0?"uv":`uv${value}`}__name(getChannel,"getChannel");function getParameters(material,lights,shadows,scene2,object){ +let fog=scene2.fog,geometry=object.geometry,environment=material.isMeshStandardMaterial? +scene2.environment:null,envMap=(material.isMeshStandardMaterial?cubeuvmaps:cubemaps). +get(material.envMap||environment),envMapCubeUVHeight=envMap&&envMap.mapping===CubeUVReflectionMapping2? +envMap.image.height:null,shaderID=shaderIDs[material.type];material.precision!== +null&&(precision=capabilities.getMaxPrecision(material.precision),precision!==material. +precision&&console.warn("THREE.WebGLProgram.getParameters:",material.precision,"\ +not supported, using",precision,"instead."));let morphAttribute=geometry.morphAttributes. +position||geometry.morphAttributes.normal||geometry.morphAttributes.color,morphTargetsCount=morphAttribute!== +void 0?morphAttribute.length:0,morphTextureStride=0;geometry.morphAttributes.position!== +void 0&&(morphTextureStride=1),geometry.morphAttributes.normal!==void 0&&(morphTextureStride= +2),geometry.morphAttributes.color!==void 0&&(morphTextureStride=3);let vertexShader, +fragmentShader,customVertexShaderID,customFragmentShaderID;if(shaderID){let shader=ShaderLib[shaderID]; +vertexShader=shader.vertexShader,fragmentShader=shader.fragmentShader}else vertexShader= +material.vertexShader,fragmentShader=material.fragmentShader,_customShaders.update( +material),customVertexShaderID=_customShaders.getVertexShaderID(material),customFragmentShaderID= +_customShaders.getFragmentShaderID(material);let currentRenderTarget=renderer.getRenderTarget(), +IS_INSTANCEDMESH=object.isInstancedMesh===!0,IS_BATCHEDMESH=object.isBatchedMesh=== +!0,HAS_MAP=!!material.map,HAS_MATCAP=!!material.matcap,HAS_ENVMAP=!!envMap,HAS_AOMAP=!!material. +aoMap,HAS_LIGHTMAP=!!material.lightMap,HAS_BUMPMAP=!!material.bumpMap,HAS_NORMALMAP=!!material. +normalMap,HAS_DISPLACEMENTMAP=!!material.displacementMap,HAS_EMISSIVEMAP=!!material. +emissiveMap,HAS_METALNESSMAP=!!material.metalnessMap,HAS_ROUGHNESSMAP=!!material. +roughnessMap,HAS_ANISOTROPY=material.anisotropy>0,HAS_CLEARCOAT=material.clearcoat> +0,HAS_IRIDESCENCE=material.iridescence>0,HAS_SHEEN=material.sheen>0,HAS_TRANSMISSION=material. +transmission>0,HAS_ANISOTROPYMAP=HAS_ANISOTROPY&&!!material.anisotropyMap,HAS_CLEARCOATMAP=HAS_CLEARCOAT&& +!!material.clearcoatMap,HAS_CLEARCOAT_NORMALMAP=HAS_CLEARCOAT&&!!material.clearcoatNormalMap, +HAS_CLEARCOAT_ROUGHNESSMAP=HAS_CLEARCOAT&&!!material.clearcoatRoughnessMap,HAS_IRIDESCENCEMAP=HAS_IRIDESCENCE&& +!!material.iridescenceMap,HAS_IRIDESCENCE_THICKNESSMAP=HAS_IRIDESCENCE&&!!material. +iridescenceThicknessMap,HAS_SHEEN_COLORMAP=HAS_SHEEN&&!!material.sheenColorMap,HAS_SHEEN_ROUGHNESSMAP=HAS_SHEEN&& +!!material.sheenRoughnessMap,HAS_SPECULARMAP=!!material.specularMap,HAS_SPECULAR_COLORMAP=!!material. +specularColorMap,HAS_SPECULAR_INTENSITYMAP=!!material.specularIntensityMap,HAS_TRANSMISSIONMAP=HAS_TRANSMISSION&& +!!material.transmissionMap,HAS_THICKNESSMAP=HAS_TRANSMISSION&&!!material.thicknessMap, +HAS_GRADIENTMAP=!!material.gradientMap,HAS_ALPHAMAP=!!material.alphaMap,HAS_ALPHATEST=material. +alphaTest>0,HAS_ALPHAHASH=!!material.alphaHash,HAS_EXTENSIONS=!!material.extensions, +HAS_ATTRIBUTE_UV1=!!geometry.attributes.uv1,HAS_ATTRIBUTE_UV2=!!geometry.attributes. +uv2,HAS_ATTRIBUTE_UV3=!!geometry.attributes.uv3,toneMapping=NoToneMapping2;return material. +toneMapped&&(currentRenderTarget===null||currentRenderTarget.isXRRenderTarget=== +!0)&&(toneMapping=renderer.toneMapping),{isWebGL2:IS_WEBGL2,shaderID,shaderType:material. +type,shaderName:material.name,vertexShader,fragmentShader,defines:material.defines, +customVertexShaderID,customFragmentShaderID,isRawShaderMaterial:material.isRawShaderMaterial=== +!0,glslVersion:material.glslVersion,precision,batching:IS_BATCHEDMESH,instancing:IS_INSTANCEDMESH, +instancingColor:IS_INSTANCEDMESH&&object.instanceColor!==null,supportsVertexTextures:SUPPORTS_VERTEX_TEXTURES, +outputColorSpace:currentRenderTarget===null?renderer.outputColorSpace:currentRenderTarget. +isXRRenderTarget===!0?currentRenderTarget.texture.colorSpace:LinearSRGBColorSpace2, +map:HAS_MAP,matcap:HAS_MATCAP,envMap:HAS_ENVMAP,envMapMode:HAS_ENVMAP&&envMap.mapping, +envMapCubeUVHeight,aoMap:HAS_AOMAP,lightMap:HAS_LIGHTMAP,bumpMap:HAS_BUMPMAP,normalMap:HAS_NORMALMAP, +displacementMap:SUPPORTS_VERTEX_TEXTURES&&HAS_DISPLACEMENTMAP,emissiveMap:HAS_EMISSIVEMAP, +normalMapObjectSpace:HAS_NORMALMAP&&material.normalMapType===ObjectSpaceNormalMap2, +normalMapTangentSpace:HAS_NORMALMAP&&material.normalMapType===TangentSpaceNormalMap2, +metalnessMap:HAS_METALNESSMAP,roughnessMap:HAS_ROUGHNESSMAP,anisotropy:HAS_ANISOTROPY, +anisotropyMap:HAS_ANISOTROPYMAP,clearcoat:HAS_CLEARCOAT,clearcoatMap:HAS_CLEARCOATMAP, +clearcoatNormalMap:HAS_CLEARCOAT_NORMALMAP,clearcoatRoughnessMap:HAS_CLEARCOAT_ROUGHNESSMAP, +iridescence:HAS_IRIDESCENCE,iridescenceMap:HAS_IRIDESCENCEMAP,iridescenceThicknessMap:HAS_IRIDESCENCE_THICKNESSMAP, +sheen:HAS_SHEEN,sheenColorMap:HAS_SHEEN_COLORMAP,sheenRoughnessMap:HAS_SHEEN_ROUGHNESSMAP, +specularMap:HAS_SPECULARMAP,specularColorMap:HAS_SPECULAR_COLORMAP,specularIntensityMap:HAS_SPECULAR_INTENSITYMAP, +transmission:HAS_TRANSMISSION,transmissionMap:HAS_TRANSMISSIONMAP,thicknessMap:HAS_THICKNESSMAP, +gradientMap:HAS_GRADIENTMAP,opaque:material.transparent===!1&&material.blending=== +NormalBlending2,alphaMap:HAS_ALPHAMAP,alphaTest:HAS_ALPHATEST,alphaHash:HAS_ALPHAHASH, +combine:material.combine,mapUv:HAS_MAP&&getChannel(material.map.channel),aoMapUv:HAS_AOMAP&& +getChannel(material.aoMap.channel),lightMapUv:HAS_LIGHTMAP&&getChannel(material. +lightMap.channel),bumpMapUv:HAS_BUMPMAP&&getChannel(material.bumpMap.channel),normalMapUv:HAS_NORMALMAP&& +getChannel(material.normalMap.channel),displacementMapUv:HAS_DISPLACEMENTMAP&&getChannel( +material.displacementMap.channel),emissiveMapUv:HAS_EMISSIVEMAP&&getChannel(material. +emissiveMap.channel),metalnessMapUv:HAS_METALNESSMAP&&getChannel(material.metalnessMap. +channel),roughnessMapUv:HAS_ROUGHNESSMAP&&getChannel(material.roughnessMap.channel), +anisotropyMapUv:HAS_ANISOTROPYMAP&&getChannel(material.anisotropyMap.channel),clearcoatMapUv:HAS_CLEARCOATMAP&& +getChannel(material.clearcoatMap.channel),clearcoatNormalMapUv:HAS_CLEARCOAT_NORMALMAP&& +getChannel(material.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:HAS_CLEARCOAT_ROUGHNESSMAP&& +getChannel(material.clearcoatRoughnessMap.channel),iridescenceMapUv:HAS_IRIDESCENCEMAP&& +getChannel(material.iridescenceMap.channel),iridescenceThicknessMapUv:HAS_IRIDESCENCE_THICKNESSMAP&& +getChannel(material.iridescenceThicknessMap.channel),sheenColorMapUv:HAS_SHEEN_COLORMAP&& +getChannel(material.sheenColorMap.channel),sheenRoughnessMapUv:HAS_SHEEN_ROUGHNESSMAP&& +getChannel(material.sheenRoughnessMap.channel),specularMapUv:HAS_SPECULARMAP&&getChannel( +material.specularMap.channel),specularColorMapUv:HAS_SPECULAR_COLORMAP&&getChannel( +material.specularColorMap.channel),specularIntensityMapUv:HAS_SPECULAR_INTENSITYMAP&& +getChannel(material.specularIntensityMap.channel),transmissionMapUv:HAS_TRANSMISSIONMAP&& +getChannel(material.transmissionMap.channel),thicknessMapUv:HAS_THICKNESSMAP&&getChannel( +material.thicknessMap.channel),alphaMapUv:HAS_ALPHAMAP&&getChannel(material.alphaMap. +channel),vertexTangents:!!geometry.attributes.tangent&&(HAS_NORMALMAP||HAS_ANISOTROPY), +vertexColors:material.vertexColors,vertexAlphas:material.vertexColors===!0&&!!geometry. +attributes.color&&geometry.attributes.color.itemSize===4,vertexUv1s:HAS_ATTRIBUTE_UV1, +vertexUv2s:HAS_ATTRIBUTE_UV2,vertexUv3s:HAS_ATTRIBUTE_UV3,pointsUvs:object.isPoints=== +!0&&!!geometry.attributes.uv&&(HAS_MAP||HAS_ALPHAMAP),fog:!!fog,useFog:material. +fog===!0,fogExp2:fog&&fog.isFogExp2,flatShading:material.flatShading===!0,sizeAttenuation:material. +sizeAttenuation===!0,logarithmicDepthBuffer,skinning:object.isSkinnedMesh===!0,morphTargets:geometry. +morphAttributes.position!==void 0,morphNormals:geometry.morphAttributes.normal!== +void 0,morphColors:geometry.morphAttributes.color!==void 0,morphTargetsCount,morphTextureStride, +numDirLights:lights.directional.length,numPointLights:lights.point.length,numSpotLights:lights. +spot.length,numSpotLightMaps:lights.spotLightMap.length,numRectAreaLights:lights. +rectArea.length,numHemiLights:lights.hemi.length,numDirLightShadows:lights.directionalShadowMap. +length,numPointLightShadows:lights.pointShadowMap.length,numSpotLightShadows:lights. +spotShadowMap.length,numSpotLightShadowsWithMaps:lights.numSpotLightShadowsWithMaps, +numLightProbes:lights.numLightProbes,numClippingPlanes:clipping.numPlanes,numClipIntersection:clipping. +numIntersection,dithering:material.dithering,shadowMapEnabled:renderer.shadowMap. +enabled&&shadows.length>0,shadowMapType:renderer.shadowMap.type,toneMapping,useLegacyLights:renderer. +_useLegacyLights,decodeVideoTexture:HAS_MAP&&material.map.isVideoTexture===!0&&ColorManagement2. +getTransfer(material.map.colorSpace)===SRGBTransfer2,premultipliedAlpha:material. +premultipliedAlpha,doubleSided:material.side===DoubleSide2,flipSided:material.side=== +BackSide2,useDepthPacking:material.depthPacking>=0,depthPacking:material.depthPacking|| +0,index0AttributeName:material.index0AttributeName,extensionDerivatives:HAS_EXTENSIONS&& +material.extensions.derivatives===!0,extensionFragDepth:HAS_EXTENSIONS&&material. +extensions.fragDepth===!0,extensionDrawBuffers:HAS_EXTENSIONS&&material.extensions. +drawBuffers===!0,extensionShaderTextureLOD:HAS_EXTENSIONS&&material.extensions.shaderTextureLOD=== +!0,extensionClipCullDistance:HAS_EXTENSIONS&&material.extensions.clipCullDistance&& +extensions.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:IS_WEBGL2|| +extensions.has("EXT_frag_depth"),rendererExtensionDrawBuffers:IS_WEBGL2||extensions. +has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:IS_WEBGL2||extensions. +has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:extensions. +has("KHR_parallel_shader_compile"),customProgramCacheKey:material.customProgramCacheKey()}} +__name(getParameters,"getParameters");function getProgramCacheKey(parameters){let array=[]; +if(parameters.shaderID?array.push(parameters.shaderID):(array.push(parameters.customVertexShaderID), +array.push(parameters.customFragmentShaderID)),parameters.defines!==void 0)for(let name2 in parameters. +defines)array.push(name2),array.push(parameters.defines[name2]);return parameters. +isRawShaderMaterial===!1&&(getProgramCacheKeyParameters(array,parameters),getProgramCacheKeyBooleans( +array,parameters),array.push(renderer.outputColorSpace)),array.push(parameters.customProgramCacheKey), +array.join()}__name(getProgramCacheKey,"getProgramCacheKey");function getProgramCacheKeyParameters(array,parameters){ +array.push(parameters.precision),array.push(parameters.outputColorSpace),array.push( +parameters.envMapMode),array.push(parameters.envMapCubeUVHeight),array.push(parameters. +mapUv),array.push(parameters.alphaMapUv),array.push(parameters.lightMapUv),array. +push(parameters.aoMapUv),array.push(parameters.bumpMapUv),array.push(parameters. +normalMapUv),array.push(parameters.displacementMapUv),array.push(parameters.emissiveMapUv), +array.push(parameters.metalnessMapUv),array.push(parameters.roughnessMapUv),array. +push(parameters.anisotropyMapUv),array.push(parameters.clearcoatMapUv),array.push( +parameters.clearcoatNormalMapUv),array.push(parameters.clearcoatRoughnessMapUv), +array.push(parameters.iridescenceMapUv),array.push(parameters.iridescenceThicknessMapUv), +array.push(parameters.sheenColorMapUv),array.push(parameters.sheenRoughnessMapUv), +array.push(parameters.specularMapUv),array.push(parameters.specularColorMapUv),array. +push(parameters.specularIntensityMapUv),array.push(parameters.transmissionMapUv), +array.push(parameters.thicknessMapUv),array.push(parameters.combine),array.push( +parameters.fogExp2),array.push(parameters.sizeAttenuation),array.push(parameters. +morphTargetsCount),array.push(parameters.morphAttributeCount),array.push(parameters. +numDirLights),array.push(parameters.numPointLights),array.push(parameters.numSpotLights), +array.push(parameters.numSpotLightMaps),array.push(parameters.numHemiLights),array. +push(parameters.numRectAreaLights),array.push(parameters.numDirLightShadows),array. +push(parameters.numPointLightShadows),array.push(parameters.numSpotLightShadows), +array.push(parameters.numSpotLightShadowsWithMaps),array.push(parameters.numLightProbes), +array.push(parameters.shadowMapType),array.push(parameters.toneMapping),array.push( +parameters.numClippingPlanes),array.push(parameters.numClipIntersection),array.push( +parameters.depthPacking)}__name(getProgramCacheKeyParameters,"getProgramCacheKey\ +Parameters");function getProgramCacheKeyBooleans(array,parameters){_programLayers. +disableAll(),parameters.isWebGL2&&_programLayers.enable(0),parameters.supportsVertexTextures&& +_programLayers.enable(1),parameters.instancing&&_programLayers.enable(2),parameters. +instancingColor&&_programLayers.enable(3),parameters.matcap&&_programLayers.enable( +4),parameters.envMap&&_programLayers.enable(5),parameters.normalMapObjectSpace&& +_programLayers.enable(6),parameters.normalMapTangentSpace&&_programLayers.enable( +7),parameters.clearcoat&&_programLayers.enable(8),parameters.iridescence&&_programLayers. +enable(9),parameters.alphaTest&&_programLayers.enable(10),parameters.vertexColors&& +_programLayers.enable(11),parameters.vertexAlphas&&_programLayers.enable(12),parameters. +vertexUv1s&&_programLayers.enable(13),parameters.vertexUv2s&&_programLayers.enable( +14),parameters.vertexUv3s&&_programLayers.enable(15),parameters.vertexTangents&& +_programLayers.enable(16),parameters.anisotropy&&_programLayers.enable(17),parameters. +alphaHash&&_programLayers.enable(18),parameters.batching&&_programLayers.enable( +19),array.push(_programLayers.mask),_programLayers.disableAll(),parameters.fog&& +_programLayers.enable(0),parameters.useFog&&_programLayers.enable(1),parameters. +flatShading&&_programLayers.enable(2),parameters.logarithmicDepthBuffer&&_programLayers. +enable(3),parameters.skinning&&_programLayers.enable(4),parameters.morphTargets&& +_programLayers.enable(5),parameters.morphNormals&&_programLayers.enable(6),parameters. +morphColors&&_programLayers.enable(7),parameters.premultipliedAlpha&&_programLayers. +enable(8),parameters.shadowMapEnabled&&_programLayers.enable(9),parameters.useLegacyLights&& +_programLayers.enable(10),parameters.doubleSided&&_programLayers.enable(11),parameters. +flipSided&&_programLayers.enable(12),parameters.useDepthPacking&&_programLayers. +enable(13),parameters.dithering&&_programLayers.enable(14),parameters.transmission&& +_programLayers.enable(15),parameters.sheen&&_programLayers.enable(16),parameters. +opaque&&_programLayers.enable(17),parameters.pointsUvs&&_programLayers.enable(18), +parameters.decodeVideoTexture&&_programLayers.enable(19),array.push(_programLayers. +mask)}__name(getProgramCacheKeyBooleans,"getProgramCacheKeyBooleans");function getUniforms(material){ +let shaderID=shaderIDs[material.type],uniforms;if(shaderID){let shader=ShaderLib[shaderID]; +uniforms=UniformsUtils.clone(shader.uniforms)}else uniforms=material.uniforms;return uniforms} +__name(getUniforms,"getUniforms");function acquireProgram(parameters,cacheKey){let program; +for(let p2=0,pl=programs.length;p20?transmissive.push(renderItem):material.transparent===!0?transparent. +push(renderItem):opaque.push(renderItem)}__name(push,"push");function unshift(object,geometry,material,groupOrder,z2,group){ +let renderItem=getNextRenderItem(object,geometry,material,groupOrder,z2,group);material. +transmission>0?transmissive.unshift(renderItem):material.transparent===!0?transparent. +unshift(renderItem):opaque.unshift(renderItem)}__name(unshift,"unshift");function sort(customOpaqueSort,customTransparentSort){ +opaque.length>1&&opaque.sort(customOpaqueSort||painterSortStable),transmissive.length> +1&&transmissive.sort(customTransparentSort||reversePainterSortStable),transparent. +length>1&&transparent.sort(customTransparentSort||reversePainterSortStable)}__name( +sort,"sort");function finish(){for(let i2=renderItemsIndex,il=renderItems.length;i2< +il;i2++){let renderItem=renderItems[i2];if(renderItem.id===null)break;renderItem. +id=null,renderItem.object=null,renderItem.geometry=null,renderItem.material=null, +renderItem.group=null}}return __name(finish,"finish"),{opaque,transmissive,transparent, +init,push,unshift,finish,sort}}__name(WebGLRenderList,"WebGLRenderList");function WebGLRenderLists(){ +let lists=new WeakMap;function get(scene2,renderCallDepth){let listArray=lists.get( +scene2),list;return listArray===void 0?(list=new WebGLRenderList,lists.set(scene2, +[list])):renderCallDepth>=listArray.length?(list=new WebGLRenderList,listArray.push( +list)):list=listArray[renderCallDepth],list}__name(get,"get");function dispose(){ +lists=new WeakMap}return __name(dispose,"dispose"),{get,dispose}}__name(WebGLRenderLists, +"WebGLRenderLists");function UniformsCache(){let lights={};return{get:function(light){ +if(lights[light.id]!==void 0)return lights[light.id];let uniforms;switch(light.type){case"\ +DirectionalLight":uniforms={direction:new Vector32,color:new Color2};break;case"\ +SpotLight":uniforms={position:new Vector32,direction:new Vector32,color:new Color2, +distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":uniforms={position:new Vector32, +color:new Color2,distance:0,decay:0};break;case"HemisphereLight":uniforms={direction:new Vector32, +skyColor:new Color2,groundColor:new Color2};break;case"RectAreaLight":uniforms={ +color:new Color2,position:new Vector32,halfWidth:new Vector32,halfHeight:new Vector32}; +break}return lights[light.id]=uniforms,uniforms}}}__name(UniformsCache,"Uniforms\ +Cache");function ShadowUniformsCache(){let lights={};return{get:function(light){ +if(lights[light.id]!==void 0)return lights[light.id];let uniforms;switch(light.type){case"\ +DirectionalLight":uniforms={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector22}; +break;case"SpotLight":uniforms={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector22}; +break;case"PointLight":uniforms={shadowBias:0,shadowNormalBias:0,shadowRadius:1, +shadowMapSize:new Vector22,shadowCameraNear:1,shadowCameraFar:1e3};break}return lights[light. +id]=uniforms,uniforms}}}__name(ShadowUniformsCache,"ShadowUniformsCache");var nextVersion=0; +function shadowCastingAndTexturingLightsFirst(lightA,lightB){return(lightB.castShadow? +2:0)-(lightA.castShadow?2:0)+(lightB.map?1:0)-(lightA.map?1:0)}__name(shadowCastingAndTexturingLightsFirst, +"shadowCastingAndTexturingLightsFirst");function WebGLLights(extensions,capabilities){ +let cache2=new UniformsCache,shadowCache=ShadowUniformsCache(),state={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 i2=0;i2<9;i2++)state.probe.push(new Vector32);let vector3=new Vector32,matrix4=new Matrix42, +matrix42=new Matrix42;function setup(lights,useLegacyLights){let r3=0,g=0,b=0;for(let i2=0;i2< +9;i2++)state.probe[i2].set(0,0,0);let directionalLength=0,pointLength=0,spotLength=0, +rectAreaLength=0,hemiLength=0,numDirectionalShadows=0,numPointShadows=0,numSpotShadows=0, +numSpotMaps=0,numSpotShadowsWithMaps=0,numLightProbes=0;lights.sort(shadowCastingAndTexturingLightsFirst); +let scaleFactor=useLegacyLights===!0?Math.PI:1;for(let i2=0,l=lights.length;i20&&(capabilities.isWebGL2?extensions.has("OES_texture_float_linea\ +r")===!0?(state.rectAreaLTC1=UniformsLib.LTC_FLOAT_1,state.rectAreaLTC2=UniformsLib. +LTC_FLOAT_2):(state.rectAreaLTC1=UniformsLib.LTC_HALF_1,state.rectAreaLTC2=UniformsLib. +LTC_HALF_2):extensions.has("OES_texture_float_linear")===!0?(state.rectAreaLTC1= +UniformsLib.LTC_FLOAT_1,state.rectAreaLTC2=UniformsLib.LTC_FLOAT_2):extensions.has( +"OES_texture_half_float_linear")===!0?(state.rectAreaLTC1=UniformsLib.LTC_HALF_1, +state.rectAreaLTC2=UniformsLib.LTC_HALF_2):console.error("THREE.WebGLRenderer: U\ +nable to use RectAreaLight. Missing WebGL extensions.")),state.ambient[0]=r3,state. +ambient[1]=g,state.ambient[2]=b;let hash=state.hash;(hash.directionalLength!==directionalLength|| +hash.pointLength!==pointLength||hash.spotLength!==spotLength||hash.rectAreaLength!== +rectAreaLength||hash.hemiLength!==hemiLength||hash.numDirectionalShadows!==numDirectionalShadows|| +hash.numPointShadows!==numPointShadows||hash.numSpotShadows!==numSpotShadows||hash. +numSpotMaps!==numSpotMaps||hash.numLightProbes!==numLightProbes)&&(state.directional. +length=directionalLength,state.spot.length=spotLength,state.rectArea.length=rectAreaLength, +state.point.length=pointLength,state.hemi.length=hemiLength,state.directionalShadow. +length=numDirectionalShadows,state.directionalShadowMap.length=numDirectionalShadows, +state.pointShadow.length=numPointShadows,state.pointShadowMap.length=numPointShadows, +state.spotShadow.length=numSpotShadows,state.spotShadowMap.length=numSpotShadows, +state.directionalShadowMatrix.length=numDirectionalShadows,state.pointShadowMatrix. +length=numPointShadows,state.spotLightMatrix.length=numSpotShadows+numSpotMaps-numSpotShadowsWithMaps, +state.spotLightMap.length=numSpotMaps,state.numSpotLightShadowsWithMaps=numSpotShadowsWithMaps, +state.numLightProbes=numLightProbes,hash.directionalLength=directionalLength,hash. +pointLength=pointLength,hash.spotLength=spotLength,hash.rectAreaLength=rectAreaLength, +hash.hemiLength=hemiLength,hash.numDirectionalShadows=numDirectionalShadows,hash. +numPointShadows=numPointShadows,hash.numSpotShadows=numSpotShadows,hash.numSpotMaps= +numSpotMaps,hash.numLightProbes=numLightProbes,state.version=nextVersion++)}__name( +setup,"setup");function setupView(lights,camera){let directionalLength=0,pointLength=0, +spotLength=0,rectAreaLength=0,hemiLength=0,viewMatrix=camera.matrixWorldInverse; +for(let i2=0,l=lights.length;i2= +renderStateArray.length?(renderState=new WebGLRenderState(extensions,capabilities), +renderStateArray.push(renderState)):renderState=renderStateArray[renderCallDepth], +renderState}__name(get,"get");function dispose(){renderStates=new WeakMap}return __name( +dispose,"dispose"),{get,dispose}}__name(WebGLRenderStates,"WebGLRenderStates");var MeshDepthMaterial=class extends Material2{static{ +__name(this,"MeshDepthMaterial")}constructor(parameters){super(),this.isMeshDepthMaterial= +!0,this.type="MeshDepthMaterial",this.depthPacking=BasicDepthPacking2,this.map=null, +this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias= +0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(parameters)}copy(source){ +return super.copy(source),this.depthPacking=source.depthPacking,this.map=source. +map,this.alphaMap=source.alphaMap,this.displacementMap=source.displacementMap,this. +displacementScale=source.displacementScale,this.displacementBias=source.displacementBias, +this.wireframe=source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth, +this}},MeshDistanceMaterial=class extends Material2{static{__name(this,"MeshDist\ +anceMaterial")}constructor(parameters){super(),this.isMeshDistanceMaterial=!0,this. +type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap= +null,this.displacementScale=1,this.displacementBias=0,this.setValues(parameters)}copy(source){ +return super.copy(source),this.map=source.map,this.alphaMap=source.alphaMap,this. +displacementMap=source.displacementMap,this.displacementScale=source.displacementScale, +this.displacementBias=source.displacementBias,this}},vertex=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,fragment=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord\ +.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distributi\ +on.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + \ +vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function WebGLShadowMap(_renderer,_objects,_capabilities){let _frustum=new Frustum, +_shadowMapSize=new Vector22,_viewportSize=new Vector22,_viewport=new Vector4,_depthMaterial=new MeshDepthMaterial( +{depthPacking:RGBADepthPacking2}),_distanceMaterial=new MeshDistanceMaterial,_materialCache={}, +_maxTextureSize=_capabilities.maxTextureSize,shadowSide={[FrontSide2]:BackSide2, +[BackSide2]:FrontSide2,[DoubleSide2]:DoubleSide2},shadowMaterialVertical=new ShaderMaterial( +{defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector22}, +radius:{value:4}},vertexShader:vertex,fragmentShader:fragment}),shadowMaterialHorizontal=shadowMaterialVertical. +clone();shadowMaterialHorizontal.defines.HORIZONTAL_PASS=1;let fullScreenTri=new BufferGeometry2; +fullScreenTri.setAttribute("position",new BufferAttribute2(new Float32Array([-1, +-1,.5,3,-1,.5,-1,3,.5]),3));let fullScreenMesh=new Mesh3(fullScreenTri,shadowMaterialVertical), +scope=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=PCFShadowMap2; +let _previousType=this.type;this.render=function(lights,scene2,camera){if(scope. +enabled===!1||scope.autoUpdate===!1&&scope.needsUpdate===!1||lights.length===0)return; +let currentRenderTarget=_renderer.getRenderTarget(),activeCubeFace=_renderer.getActiveCubeFace(), +activeMipmapLevel=_renderer.getActiveMipmapLevel(),_state=_renderer.state;_state. +setBlending(NoBlending2),_state.buffers.color.setClear(1,1,1,1),_state.buffers.depth. +setTest(!0),_state.setScissorTest(!1);let toVSM=_previousType!==VSMShadowMap2&&this. +type===VSMShadowMap2,fromVSM=_previousType===VSMShadowMap2&&this.type!==VSMShadowMap2; +for(let i2=0,il=lights.length;i2_maxTextureSize||_shadowMapSize.y>_maxTextureSize)&&(_shadowMapSize.x>_maxTextureSize&& +(_viewportSize.x=Math.floor(_maxTextureSize/shadowFrameExtents.x),_shadowMapSize. +x=_viewportSize.x*shadowFrameExtents.x,shadow.mapSize.x=_viewportSize.x),_shadowMapSize. +y>_maxTextureSize&&(_viewportSize.y=Math.floor(_maxTextureSize/shadowFrameExtents. +y),_shadowMapSize.y=_viewportSize.y*shadowFrameExtents.y,shadow.mapSize.y=_viewportSize. +y)),shadow.map===null||toVSM===!0||fromVSM===!0){let pars=this.type!==VSMShadowMap2? +{minFilter:NearestFilter2,magFilter:NearestFilter2}:{};shadow.map!==null&&shadow. +map.dispose(),shadow.map=new WebGLRenderTarget(_shadowMapSize.x,_shadowMapSize.y, +pars),shadow.map.texture.name=light.name+".shadowMap",shadow.camera.updateProjectionMatrix()} +_renderer.setRenderTarget(shadow.map),_renderer.clear();let viewportCount=shadow. +getViewportCount();for(let vp=0;vp0||material.map&&material.alphaTest>0){let keyA=result.uuid,keyB=material. +uuid,materialsForVariant=_materialCache[keyA];materialsForVariant===void 0&&(materialsForVariant= +{},_materialCache[keyA]=materialsForVariant);let cachedMaterial=materialsForVariant[keyB]; +cachedMaterial===void 0&&(cachedMaterial=result.clone(),materialsForVariant[keyB]= +cachedMaterial,material.addEventListener("dispose",onMaterialDispose)),result=cachedMaterial} +if(result.visible=material.visible,result.wireframe=material.wireframe,type===VSMShadowMap2? +result.side=material.shadowSide!==null?material.shadowSide:material.side:result. +side=material.shadowSide!==null?material.shadowSide:shadowSide[material.side],result. +alphaMap=material.alphaMap,result.alphaTest=material.alphaTest,result.map=material. +map,result.clipShadows=material.clipShadows,result.clippingPlanes=material.clippingPlanes, +result.clipIntersection=material.clipIntersection,result.displacementMap=material. +displacementMap,result.displacementScale=material.displacementScale,result.displacementBias= +material.displacementBias,result.wireframeLinewidth=material.wireframeLinewidth, +result.linewidth=material.linewidth,light.isPointLight===!0&&result.isMeshDistanceMaterial=== +!0){let materialProperties=_renderer.properties.get(result);materialProperties.light= +light}return result}__name(getDepthMaterial,"getDepthMaterial");function renderObject(object,camera,shadowCamera,light,type){ +if(object.visible===!1)return;if(object.layers.test(camera.layers)&&(object.isMesh|| +object.isLine||object.isPoints)&&(object.castShadow||object.receiveShadow&&type=== +VSMShadowMap2)&&(!object.frustumCulled||_frustum.intersectsObject(object))){object. +modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse,object.matrixWorld); +let geometry=_objects.update(object),material=object.material;if(Array.isArray(material)){ +let groups=geometry.groups;for(let k=0,kl=groups.length;k= +1):glVersion.indexOf("OpenGL ES")!==-1&&(version3=parseFloat(/^OpenGL ES (\d)/.exec( +glVersion)[1]),lineWidthAvailable=version3>=2);let currentTextureSlot=null,currentBoundTextures={}, +scissorParam=gl.getParameter(gl.SCISSOR_BOX),viewportParam=gl.getParameter(gl.VIEWPORT), +currentScissor=new Vector4().fromArray(scissorParam),currentViewport=new Vector4(). +fromArray(viewportParam);function createTexture(type,target,count,dimensions){let data=new Uint8Array( +4),texture=gl.createTexture();gl.bindTexture(type,texture),gl.texParameteri(type, +gl.TEXTURE_MIN_FILTER,gl.NEAREST),gl.texParameteri(type,gl.TEXTURE_MAG_FILTER,gl. +NEAREST);for(let i2=0;i2"u"?!1:/OculusBrowser/g. +test(navigator.userAgent),_videoTextures=new WeakMap,_canvas3,_sources=new WeakMap, +useOffscreenCanvas=!1;try{useOffscreenCanvas=typeof OffscreenCanvas<"u"&&new OffscreenCanvas( +1,1).getContext("2d")!==null}catch{}function createCanvas(width,height){return useOffscreenCanvas? +new OffscreenCanvas(width,height):createElementNS2("canvas")}__name(createCanvas, +"createCanvas");function resizeImage(image,needsPowerOfTwo,needsNewCanvas,maxSize){ +let scale2=1;if((image.width>maxSize||image.height>maxSize)&&(scale2=maxSize/Math. +max(image.width,image.height)),scale2<1||needsPowerOfTwo===!0)if(typeof HTMLImageElement< +"u"&&image instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&image instanceof +HTMLCanvasElement||typeof ImageBitmap<"u"&&image instanceof ImageBitmap){let floor=needsPowerOfTwo? +floorPowerOfTwo2:Math.floor,width=floor(scale2*image.width),height=floor(scale2* +image.height);_canvas3===void 0&&(_canvas3=createCanvas(width,height));let canvas=needsNewCanvas? +createCanvas(width,height):_canvas3;return canvas.width=width,canvas.height=height, +canvas.getContext("2d").drawImage(image,0,0,width,height),console.warn("THREE.We\ +bGLRenderer: Texture has been resized from ("+image.width+"x"+image.height+") to\ + ("+width+"x"+height+")."),canvas}else return"data"in image&&console.warn("THREE\ +.WebGLRenderer: Image in DataTexture is too big ("+image.width+"x"+image.height+ +")."),image;return image}__name(resizeImage,"resizeImage");function isPowerOfTwo$1(image){ +return isPowerOfTwo2(image.width)&&isPowerOfTwo2(image.height)}__name(isPowerOfTwo$1, +"isPowerOfTwo$1");function textureNeedsPowerOfTwo(texture){return isWebGL2?!1:texture. +wrapS!==ClampToEdgeWrapping2||texture.wrapT!==ClampToEdgeWrapping2||texture.minFilter!== +NearestFilter2&&texture.minFilter!==LinearFilter2}__name(textureNeedsPowerOfTwo, +"textureNeedsPowerOfTwo");function textureNeedsGenerateMipmaps(texture,supportsMips){ +return texture.generateMipmaps&&supportsMips&&texture.minFilter!==NearestFilter2&& +texture.minFilter!==LinearFilter2}__name(textureNeedsGenerateMipmaps,"textureNee\ +dsGenerateMipmaps");function generateMipmap(target){_gl.generateMipmap(target)}__name( +generateMipmap,"generateMipmap");function getInternalFormat(internalFormatName,glFormat,glType,colorSpace,forceLinearTransfer=!1){ +if(isWebGL2===!1)return glFormat;if(internalFormatName!==null){if(_gl[internalFormatName]!== +void 0)return _gl[internalFormatName];console.warn("THREE.WebGLRenderer: Attempt\ + to use non-existing WebGL internal format '"+internalFormatName+"'")}let internalFormat=glFormat; +if(glFormat===_gl.RED&&(glType===_gl.FLOAT&&(internalFormat=_gl.R32F),glType===_gl. +HALF_FLOAT&&(internalFormat=_gl.R16F),glType===_gl.UNSIGNED_BYTE&&(internalFormat= +_gl.R8)),glFormat===_gl.RED_INTEGER&&(glType===_gl.UNSIGNED_BYTE&&(internalFormat= +_gl.R8UI),glType===_gl.UNSIGNED_SHORT&&(internalFormat=_gl.R16UI),glType===_gl.UNSIGNED_INT&& +(internalFormat=_gl.R32UI),glType===_gl.BYTE&&(internalFormat=_gl.R8I),glType=== +_gl.SHORT&&(internalFormat=_gl.R16I),glType===_gl.INT&&(internalFormat=_gl.R32I)), +glFormat===_gl.RG&&(glType===_gl.FLOAT&&(internalFormat=_gl.RG32F),glType===_gl. +HALF_FLOAT&&(internalFormat=_gl.RG16F),glType===_gl.UNSIGNED_BYTE&&(internalFormat= +_gl.RG8)),glFormat===_gl.RGBA){let transfer=forceLinearTransfer?LinearTransfer2: +ColorManagement2.getTransfer(colorSpace);glType===_gl.FLOAT&&(internalFormat=_gl. +RGBA32F),glType===_gl.HALF_FLOAT&&(internalFormat=_gl.RGBA16F),glType===_gl.UNSIGNED_BYTE&& +(internalFormat=transfer===SRGBTransfer2?_gl.SRGB8_ALPHA8:_gl.RGBA8),glType===_gl. +UNSIGNED_SHORT_4_4_4_4&&(internalFormat=_gl.RGBA4),glType===_gl.UNSIGNED_SHORT_5_5_5_1&& +(internalFormat=_gl.RGB5_A1)}return(internalFormat===_gl.R16F||internalFormat=== +_gl.R32F||internalFormat===_gl.RG16F||internalFormat===_gl.RG32F||internalFormat=== +_gl.RGBA16F||internalFormat===_gl.RGBA32F)&&extensions.get("EXT_color_buffer_flo\ +at"),internalFormat}__name(getInternalFormat,"getInternalFormat");function getMipLevels(texture,image,supportsMips){ +return textureNeedsGenerateMipmaps(texture,supportsMips)===!0||texture.isFramebufferTexture&& +texture.minFilter!==NearestFilter2&&texture.minFilter!==LinearFilter2?Math.log2( +Math.max(image.width,image.height))+1:texture.mipmaps!==void 0&&texture.mipmaps. +length>0?texture.mipmaps.length:texture.isCompressedTexture&&Array.isArray(texture. +image)?image.mipmaps.length:1}__name(getMipLevels,"getMipLevels");function filterFallback(f){ +return f===NearestFilter2||f===NearestMipmapNearestFilter2||f===NearestMipmapLinearFilter2? +_gl.NEAREST:_gl.LINEAR}__name(filterFallback,"filterFallback");function onTextureDispose(event){ +let texture=event.target;texture.removeEventListener("dispose",onTextureDispose), +deallocateTexture(texture),texture.isVideoTexture&&_videoTextures.delete(texture)} +__name(onTextureDispose,"onTextureDispose");function onRenderTargetDispose(event){ +let renderTarget=event.target;renderTarget.removeEventListener("dispose",onRenderTargetDispose), +deallocateRenderTarget(renderTarget)}__name(onRenderTargetDispose,"onRenderTarge\ +tDispose");function deallocateTexture(texture){let textureProperties=properties. +get(texture);if(textureProperties.__webglInit===void 0)return;let source=texture. +source,webglTextures=_sources.get(source);if(webglTextures){let webglTexture=webglTextures[textureProperties. +__cacheKey];webglTexture.usedTimes--,webglTexture.usedTimes===0&&deleteTexture(texture), +Object.keys(webglTextures).length===0&&_sources.delete(source)}properties.remove( +texture)}__name(deallocateTexture,"deallocateTexture");function deleteTexture(texture){ +let textureProperties=properties.get(texture);_gl.deleteTexture(textureProperties. +__webglTexture);let source=texture.source,webglTextures=_sources.get(source);delete webglTextures[textureProperties. +__cacheKey],info.memory.textures--}__name(deleteTexture,"deleteTexture");function deallocateRenderTarget(renderTarget){ +let texture=renderTarget.texture,renderTargetProperties=properties.get(renderTarget), +textureProperties=properties.get(texture);if(textureProperties.__webglTexture!== +void 0&&(_gl.deleteTexture(textureProperties.__webglTexture),info.memory.textures--), +renderTarget.depthTexture&&renderTarget.depthTexture.dispose(),renderTarget.isWebGLCubeRenderTarget) +for(let i2=0;i2<6;i2++){if(Array.isArray(renderTargetProperties.__webglFramebuffer[i2])) +for(let level=0;level=capabilities.maxTextures&&console.warn("THREE.WebGLTextures:\ + Trying to use "+textureUnit+" texture units while this GPU supports only "+capabilities. +maxTextures),textureUnits+=1,textureUnit}__name(allocateTextureUnit,"allocateTex\ +tureUnit");function getTextureCacheKey(texture){let array=[];return array.push(texture. +wrapS),array.push(texture.wrapT),array.push(texture.wrapR||0),array.push(texture. +magFilter),array.push(texture.minFilter),array.push(texture.anisotropy),array.push( +texture.internalFormat),array.push(texture.format),array.push(texture.type),array. +push(texture.generateMipmaps),array.push(texture.premultiplyAlpha),array.push(texture. +flipY),array.push(texture.unpackAlignment),array.push(texture.colorSpace),array. +join()}__name(getTextureCacheKey,"getTextureCacheKey");function setTexture2D(texture,slot){ +let textureProperties=properties.get(texture);if(texture.isVideoTexture&&updateVideoTexture( +texture),texture.isRenderTargetTexture===!1&&texture.version>0&&textureProperties. +__version!==texture.version){let image=texture.image;if(image===null)console.warn( +"THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(image. +complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but i\ +mage is incomplete");else{uploadTexture(textureProperties,texture,slot);return}} +state.bindTexture(_gl.TEXTURE_2D,textureProperties.__webglTexture,_gl.TEXTURE0+slot)} +__name(setTexture2D,"setTexture2D");function setTexture2DArray(texture,slot){let textureProperties=properties. +get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){ +uploadTexture(textureProperties,texture,slot);return}state.bindTexture(_gl.TEXTURE_2D_ARRAY, +textureProperties.__webglTexture,_gl.TEXTURE0+slot)}__name(setTexture2DArray,"se\ +tTexture2DArray");function setTexture3D(texture,slot){let textureProperties=properties. +get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){ +uploadTexture(textureProperties,texture,slot);return}state.bindTexture(_gl.TEXTURE_3D, +textureProperties.__webglTexture,_gl.TEXTURE0+slot)}__name(setTexture3D,"setText\ +ure3D");function setTextureCube(texture,slot){let textureProperties=properties.get( +texture);if(texture.version>0&&textureProperties.__version!==texture.version){uploadCubeTexture( +textureProperties,texture,slot);return}state.bindTexture(_gl.TEXTURE_CUBE_MAP,textureProperties. +__webglTexture,_gl.TEXTURE0+slot)}__name(setTextureCube,"setTextureCube");let wrappingToGL={ +[RepeatWrapping2]:_gl.REPEAT,[ClampToEdgeWrapping2]:_gl.CLAMP_TO_EDGE,[MirroredRepeatWrapping2]:_gl. +MIRRORED_REPEAT},filterToGL={[NearestFilter2]:_gl.NEAREST,[NearestMipmapNearestFilter2]:_gl. +NEAREST_MIPMAP_NEAREST,[NearestMipmapLinearFilter2]:_gl.NEAREST_MIPMAP_LINEAR,[LinearFilter2]:_gl. +LINEAR,[LinearMipmapNearestFilter2]:_gl.LINEAR_MIPMAP_NEAREST,[LinearMipmapLinearFilter2]:_gl. +LINEAR_MIPMAP_LINEAR},compareToGL={[NeverCompare2]:_gl.NEVER,[AlwaysCompare2]:_gl. +ALWAYS,[LessCompare2]:_gl.LESS,[LessEqualCompare2]:_gl.LEQUAL,[EqualCompare2]:_gl. +EQUAL,[GreaterEqualCompare2]:_gl.GEQUAL,[GreaterCompare2]:_gl.GREATER,[NotEqualCompare2]:_gl. +NOTEQUAL};function setTextureParameters(textureType,texture,supportsMips){if(supportsMips? +(_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_S,wrappingToGL[texture.wrapS]),_gl. +texParameteri(textureType,_gl.TEXTURE_WRAP_T,wrappingToGL[texture.wrapT]),(textureType=== +_gl.TEXTURE_3D||textureType===_gl.TEXTURE_2D_ARRAY)&&_gl.texParameteri(textureType, +_gl.TEXTURE_WRAP_R,wrappingToGL[texture.wrapR]),_gl.texParameteri(textureType,_gl. +TEXTURE_MAG_FILTER,filterToGL[texture.magFilter]),_gl.texParameteri(textureType, +_gl.TEXTURE_MIN_FILTER,filterToGL[texture.minFilter])):(_gl.texParameteri(textureType, +_gl.TEXTURE_WRAP_S,_gl.CLAMP_TO_EDGE),_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_T, +_gl.CLAMP_TO_EDGE),(textureType===_gl.TEXTURE_3D||textureType===_gl.TEXTURE_2D_ARRAY)&& +_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_R,_gl.CLAMP_TO_EDGE),(texture.wrapS!== +ClampToEdgeWrapping2||texture.wrapT!==ClampToEdgeWrapping2)&&console.warn("THREE\ +.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT sho\ +uld be set to THREE.ClampToEdgeWrapping."),_gl.texParameteri(textureType,_gl.TEXTURE_MAG_FILTER, +filterFallback(texture.magFilter)),_gl.texParameteri(textureType,_gl.TEXTURE_MIN_FILTER, +filterFallback(texture.minFilter)),texture.minFilter!==NearestFilter2&&texture.minFilter!== +LinearFilter2&&console.warn("THREE.WebGLRenderer: Texture is not power of two. T\ +exture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")), +texture.compareFunction&&(_gl.texParameteri(textureType,_gl.TEXTURE_COMPARE_MODE, +_gl.COMPARE_REF_TO_TEXTURE),_gl.texParameteri(textureType,_gl.TEXTURE_COMPARE_FUNC, +compareToGL[texture.compareFunction])),extensions.has("EXT_texture_filter_anisot\ +ropic")===!0){let extension=extensions.get("EXT_texture_filter_anisotropic");if(texture. +magFilter===NearestFilter2||texture.minFilter!==NearestMipmapLinearFilter2&&texture. +minFilter!==LinearMipmapLinearFilter2||texture.type===FloatType2&&extensions.has( +"OES_texture_float_linear")===!1||isWebGL2===!1&&texture.type===HalfFloatType2&& +extensions.has("OES_texture_half_float_linear")===!1)return;(texture.anisotropy> +1||properties.get(texture).__currentAnisotropy)&&(_gl.texParameterf(textureType, +extension.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(texture.anisotropy,capabilities.getMaxAnisotropy())), +properties.get(texture).__currentAnisotropy=texture.anisotropy)}}__name(setTextureParameters, +"setTextureParameters");function initTexture(textureProperties,texture){let forceUpload=!1; +textureProperties.__webglInit===void 0&&(textureProperties.__webglInit=!0,texture. +addEventListener("dispose",onTextureDispose));let source=texture.source,webglTextures=_sources. +get(source);webglTextures===void 0&&(webglTextures={},_sources.set(source,webglTextures)); +let textureCacheKey=getTextureCacheKey(texture);if(textureCacheKey!==textureProperties. +__cacheKey){webglTextures[textureCacheKey]===void 0&&(webglTextures[textureCacheKey]= +{texture:_gl.createTexture(),usedTimes:0},info.memory.textures++,forceUpload=!0), +webglTextures[textureCacheKey].usedTimes++;let webglTexture=webglTextures[textureProperties. +__cacheKey];webglTexture!==void 0&&(webglTextures[textureProperties.__cacheKey]. +usedTimes--,webglTexture.usedTimes===0&&deleteTexture(texture)),textureProperties. +__cacheKey=textureCacheKey,textureProperties.__webglTexture=webglTextures[textureCacheKey]. +texture}return forceUpload}__name(initTexture,"initTexture");function uploadTexture(textureProperties,texture,slot){ +let textureType=_gl.TEXTURE_2D;(texture.isDataArrayTexture||texture.isCompressedArrayTexture)&& +(textureType=_gl.TEXTURE_2D_ARRAY),texture.isData3DTexture&&(textureType=_gl.TEXTURE_3D); +let forceUpload=initTexture(textureProperties,texture),source=texture.source;state. +bindTexture(textureType,textureProperties.__webglTexture,_gl.TEXTURE0+slot);let sourceProperties=properties. +get(source);if(source.version!==sourceProperties.__version||forceUpload===!0){state. +activeTexture(_gl.TEXTURE0+slot);let workingPrimaries=ColorManagement2.getPrimaries( +ColorManagement2.workingColorSpace),texturePrimaries=texture.colorSpace===NoColorSpace2? +null:ColorManagement2.getPrimaries(texture.colorSpace),unpackConversion=texture. +colorSpace===NoColorSpace2||workingPrimaries===texturePrimaries?_gl.NONE:_gl.BROWSER_DEFAULT_WEBGL; +_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,texture.flipY),_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, +texture.premultiplyAlpha),_gl.pixelStorei(_gl.UNPACK_ALIGNMENT,texture.unpackAlignment), +_gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,unpackConversion);let needsPowerOfTwo=textureNeedsPowerOfTwo( +texture)&&isPowerOfTwo$1(texture.image)===!1,image=resizeImage(texture.image,needsPowerOfTwo, +!1,capabilities.maxTextureSize);image=verifyColorSpace(texture,image);let supportsMips=isPowerOfTwo$1( +image)||isWebGL2,glFormat=utils.convert(texture.format,texture.colorSpace),glType=utils. +convert(texture.type),glInternalFormat=getInternalFormat(texture.internalFormat, +glFormat,glType,texture.colorSpace,texture.isVideoTexture);setTextureParameters( +textureType,texture,supportsMips);let mipmap,mipmaps=texture.mipmaps,useTexStorage=isWebGL2&& +texture.isVideoTexture!==!0&&glInternalFormat!==RGB_ETC1_Format2,allocateMemory=sourceProperties. +__version===void 0||forceUpload===!0,levels=getMipLevels(texture,image,supportsMips); +if(texture.isDepthTexture)glInternalFormat=_gl.DEPTH_COMPONENT,isWebGL2?texture. +type===FloatType2?glInternalFormat=_gl.DEPTH_COMPONENT32F:texture.type===UnsignedIntType2? +glInternalFormat=_gl.DEPTH_COMPONENT24:texture.type===UnsignedInt248Type2?glInternalFormat= +_gl.DEPTH24_STENCIL8:glInternalFormat=_gl.DEPTH_COMPONENT16:texture.type===FloatType2&& +console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),texture. +format===DepthFormat2&&glInternalFormat===_gl.DEPTH_COMPONENT&&texture.type!==UnsignedShortType2&& +texture.type!==UnsignedIntType2&&(console.warn("THREE.WebGLRenderer: Use Unsigne\ +dShortType or UnsignedIntType for DepthFormat DepthTexture."),texture.type=UnsignedIntType2, +glType=utils.convert(texture.type)),texture.format===DepthStencilFormat2&&glInternalFormat=== +_gl.DEPTH_COMPONENT&&(glInternalFormat=_gl.DEPTH_STENCIL,texture.type!==UnsignedInt248Type2&& +(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilForma\ +t DepthTexture."),texture.type=UnsignedInt248Type2,glType=utils.convert(texture. +type))),allocateMemory&&(useTexStorage?state.texStorage2D(_gl.TEXTURE_2D,1,glInternalFormat, +image.width,image.height):state.texImage2D(_gl.TEXTURE_2D,0,glInternalFormat,image. +width,image.height,0,glFormat,glType,null));else if(texture.isDataTexture)if(mipmaps. +length>0&&supportsMips){useTexStorage&&allocateMemory&&state.texStorage2D(_gl.TEXTURE_2D, +levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(let i2=0,il=mipmaps. +length;i2>=1,height>>=1}}else if(mipmaps. +length>0&&supportsMips){useTexStorage&&allocateMemory&&state.texStorage2D(_gl.TEXTURE_2D, +levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(let i2=0,il=mipmaps. +length;i20&&levels++, +state.texStorage2D(_gl.TEXTURE_CUBE_MAP,levels,glInternalFormat,cubeImage[0].width, +cubeImage[0].height));for(let i2=0;i2<6;i2++)if(isDataTexture){useTexStorage?state. +texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i2,0,0,0,cubeImage[i2].width,cubeImage[i2]. +height,glFormat,glType,cubeImage[i2].data):state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+ +i2,0,glInternalFormat,cubeImage[i2].width,cubeImage[i2].height,0,glFormat,glType, +cubeImage[i2].data);for(let j2=0;j2>level),height=Math.max(1,renderTarget.height>> +level);textureTarget===_gl.TEXTURE_3D||textureTarget===_gl.TEXTURE_2D_ARRAY?state. +texImage3D(textureTarget,level,glInternalFormat,width,height,renderTarget.depth, +0,glFormat,glType,null):state.texImage2D(textureTarget,level,glInternalFormat,width, +height,0,glFormat,glType,null)}state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer), +useMultisampledRTT(renderTarget)?multisampledRTTExt.framebufferTexture2DMultisampleEXT( +_gl.FRAMEBUFFER,attachment,textureTarget,properties.get(texture).__webglTexture, +0,getRenderTargetSamples(renderTarget)):(textureTarget===_gl.TEXTURE_2D||textureTarget>= +_gl.TEXTURE_CUBE_MAP_POSITIVE_X&&textureTarget<=_gl.TEXTURE_CUBE_MAP_NEGATIVE_Z)&& +_gl.framebufferTexture2D(_gl.FRAMEBUFFER,attachment,textureTarget,properties.get( +texture).__webglTexture,level),state.bindFramebuffer(_gl.FRAMEBUFFER,null)}__name( +setupFrameBufferTexture,"setupFrameBufferTexture");function setupRenderBufferStorage(renderbuffer,renderTarget,isMultisample){ +if(_gl.bindRenderbuffer(_gl.RENDERBUFFER,renderbuffer),renderTarget.depthBuffer&& +!renderTarget.stencilBuffer){let glInternalFormat=isWebGL2===!0?_gl.DEPTH_COMPONENT24: +_gl.DEPTH_COMPONENT16;if(isMultisample||useMultisampledRTT(renderTarget)){let depthTexture=renderTarget. +depthTexture;depthTexture&&depthTexture.isDepthTexture&&(depthTexture.type===FloatType2? +glInternalFormat=_gl.DEPTH_COMPONENT32F:depthTexture.type===UnsignedIntType2&&(glInternalFormat= +_gl.DEPTH_COMPONENT24));let samples=getRenderTargetSamples(renderTarget);useMultisampledRTT( +renderTarget)?multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, +samples,glInternalFormat,renderTarget.width,renderTarget.height):_gl.renderbufferStorageMultisample( +_gl.RENDERBUFFER,samples,glInternalFormat,renderTarget.width,renderTarget.height)}else +_gl.renderbufferStorage(_gl.RENDERBUFFER,glInternalFormat,renderTarget.width,renderTarget. +height);_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.DEPTH_ATTACHMENT,_gl.RENDERBUFFER, +renderbuffer)}else if(renderTarget.depthBuffer&&renderTarget.stencilBuffer){let samples=getRenderTargetSamples( +renderTarget);isMultisample&&useMultisampledRTT(renderTarget)===!1?_gl.renderbufferStorageMultisample( +_gl.RENDERBUFFER,samples,_gl.DEPTH24_STENCIL8,renderTarget.width,renderTarget.height): +useMultisampledRTT(renderTarget)?multisampledRTTExt.renderbufferStorageMultisampleEXT( +_gl.RENDERBUFFER,samples,_gl.DEPTH24_STENCIL8,renderTarget.width,renderTarget.height): +_gl.renderbufferStorage(_gl.RENDERBUFFER,_gl.DEPTH_STENCIL,renderTarget.width,renderTarget. +height),_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.DEPTH_STENCIL_ATTACHMENT, +_gl.RENDERBUFFER,renderbuffer)}else{let textures=renderTarget.isWebGLMultipleRenderTargets=== +!0?renderTarget.texture:[renderTarget.texture];for(let i2=0;i20){renderTargetProperties.__webglFramebuffer[i2]=[];for(let level=0;level< +texture.mipmaps.length;level++)renderTargetProperties.__webglFramebuffer[i2][level]= +_gl.createFramebuffer()}else renderTargetProperties.__webglFramebuffer[i2]=_gl.createFramebuffer()}else{ +if(isWebGL2&&texture.mipmaps&&texture.mipmaps.length>0){renderTargetProperties.__webglFramebuffer= +[];for(let level=0;level0&&useMultisampledRTT( +renderTarget)===!1){let textures=isMultipleRenderTargets?texture:[texture];renderTargetProperties. +__webglMultisampledFramebuffer=_gl.createFramebuffer(),renderTargetProperties.__webglColorRenderbuffer= +[],state.bindFramebuffer(_gl.FRAMEBUFFER,renderTargetProperties.__webglMultisampledFramebuffer); +for(let i2=0;i20)for(let level=0;level0)for(let level=0;level< +texture.mipmaps.length;level++)setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[level], +renderTarget,texture,_gl.COLOR_ATTACHMENT0,glTextureType,level);else setupFrameBufferTexture( +renderTargetProperties.__webglFramebuffer,renderTarget,texture,_gl.COLOR_ATTACHMENT0, +glTextureType,0);textureNeedsGenerateMipmaps(texture,supportsMips)&&generateMipmap( +glTextureType),state.unbindTexture()}renderTarget.depthBuffer&&setupDepthRenderbuffer( +renderTarget)}__name(setupRenderTarget,"setupRenderTarget");function updateRenderTargetMipmap(renderTarget){ +let supportsMips=isPowerOfTwo$1(renderTarget)||isWebGL2,textures=renderTarget.isWebGLMultipleRenderTargets=== +!0?renderTarget.texture:[renderTarget.texture];for(let i2=0,il=textures.length;i2< +il;i2++){let texture=textures[i2];if(textureNeedsGenerateMipmaps(texture,supportsMips)){ +let target=renderTarget.isWebGLCubeRenderTarget?_gl.TEXTURE_CUBE_MAP:_gl.TEXTURE_2D, +webglTexture=properties.get(texture).__webglTexture;state.bindTexture(target,webglTexture), +generateMipmap(target),state.unbindTexture()}}}__name(updateRenderTargetMipmap,"\ +updateRenderTargetMipmap");function updateMultisampleRenderTarget(renderTarget){ +if(isWebGL2&&renderTarget.samples>0&&useMultisampledRTT(renderTarget)===!1){let textures=renderTarget. +isWebGLMultipleRenderTargets?renderTarget.texture:[renderTarget.texture],width=renderTarget. +width,height=renderTarget.height,mask=_gl.COLOR_BUFFER_BIT,invalidationArray=[], +depthStyle=renderTarget.stencilBuffer?_gl.DEPTH_STENCIL_ATTACHMENT:_gl.DEPTH_ATTACHMENT, +renderTargetProperties=properties.get(renderTarget),isMultipleRenderTargets=renderTarget. +isWebGLMultipleRenderTargets===!0;if(isMultipleRenderTargets)for(let i2=0;i20&&extensions.has("WEBGL\ +_multisampled_render_to_texture")===!0&&renderTargetProperties.__useRenderToTexture!== +!1}__name(useMultisampledRTT,"useMultisampledRTT");function updateVideoTexture(texture){ +let frame=info.render.frame;_videoTextures.get(texture)!==frame&&(_videoTextures. +set(texture,frame),texture.update())}__name(updateVideoTexture,"updateVideoTextu\ +re");function verifyColorSpace(texture,image){let colorSpace=texture.colorSpace, +format=texture.format,type=texture.type;return texture.isCompressedTexture===!0|| +texture.isVideoTexture===!0||texture.format===_SRGBAFormat2||colorSpace!==LinearSRGBColorSpace2&& +colorSpace!==NoColorSpace2&&(ColorManagement2.getTransfer(colorSpace)===SRGBTransfer2? +isWebGL2===!1?extensions.has("EXT_sRGB")===!0&&format===RGBAFormat2?(texture.format= +_SRGBAFormat2,texture.minFilter=LinearFilter2,texture.generateMipmaps=!1):image= +ImageUtils.sRGBToLinear(image):(format!==RGBAFormat2||type!==UnsignedByteType2)&& +console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat \ +and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture \ +color space:",colorSpace)),image}__name(verifyColorSpace,"verifyColorSpace"),this. +allocateTextureUnit=allocateTextureUnit,this.resetTextureUnits=resetTextureUnits, +this.setTexture2D=setTexture2D,this.setTexture2DArray=setTexture2DArray,this.setTexture3D= +setTexture3D,this.setTextureCube=setTextureCube,this.rebindTextures=rebindTextures, +this.setupRenderTarget=setupRenderTarget,this.updateRenderTargetMipmap=updateRenderTargetMipmap, +this.updateMultisampleRenderTarget=updateMultisampleRenderTarget,this.setupDepthRenderbuffer= +setupDepthRenderbuffer,this.setupFrameBufferTexture=setupFrameBufferTexture,this. +useMultisampledRTT=useMultisampledRTT}__name(WebGLTextures,"WebGLTextures");function WebGLUtils(gl,extensions,capabilities){ +let isWebGL2=capabilities.isWebGL2;function convert(p2,colorSpace=NoColorSpace2){ +let extension,transfer=ColorManagement2.getTransfer(colorSpace);if(p2===UnsignedByteType2) +return gl.UNSIGNED_BYTE;if(p2===UnsignedShort4444Type2)return gl.UNSIGNED_SHORT_4_4_4_4; +if(p2===UnsignedShort5551Type2)return gl.UNSIGNED_SHORT_5_5_5_1;if(p2===ByteType2) +return gl.BYTE;if(p2===ShortType2)return gl.SHORT;if(p2===UnsignedShortType2)return gl. +UNSIGNED_SHORT;if(p2===IntType2)return gl.INT;if(p2===UnsignedIntType2)return gl. +UNSIGNED_INT;if(p2===FloatType2)return gl.FLOAT;if(p2===HalfFloatType2)return isWebGL2? +gl.HALF_FLOAT:(extension=extensions.get("OES_texture_half_float"),extension!==null? +extension.HALF_FLOAT_OES:null);if(p2===AlphaFormat2)return gl.ALPHA;if(p2===RGBAFormat2) +return gl.RGBA;if(p2===LuminanceFormat2)return gl.LUMINANCE;if(p2===LuminanceAlphaFormat2) +return gl.LUMINANCE_ALPHA;if(p2===DepthFormat2)return gl.DEPTH_COMPONENT;if(p2=== +DepthStencilFormat2)return gl.DEPTH_STENCIL;if(p2===_SRGBAFormat2)return extension= +extensions.get("EXT_sRGB"),extension!==null?extension.SRGB_ALPHA_EXT:null;if(p2=== +RedFormat2)return gl.RED;if(p2===RedIntegerFormat2)return gl.RED_INTEGER;if(p2=== +RGFormat2)return gl.RG;if(p2===RGIntegerFormat2)return gl.RG_INTEGER;if(p2===RGBAIntegerFormat2) +return gl.RGBA_INTEGER;if(p2===RGB_S3TC_DXT1_Format2||p2===RGBA_S3TC_DXT1_Format2|| +p2===RGBA_S3TC_DXT3_Format2||p2===RGBA_S3TC_DXT5_Format2)if(transfer===SRGBTransfer2) +if(extension=extensions.get("WEBGL_compressed_texture_s3tc_srgb"),extension!==null){ +if(p2===RGB_S3TC_DXT1_Format2)return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(p2=== +RGBA_S3TC_DXT1_Format2)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(p2=== +RGBA_S3TC_DXT3_Format2)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(p2=== +RGBA_S3TC_DXT5_Format2)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else +return null;else if(extension=extensions.get("WEBGL_compressed_texture_s3tc"),extension!== +null){if(p2===RGB_S3TC_DXT1_Format2)return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; +if(p2===RGBA_S3TC_DXT1_Format2)return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(p2=== +RGBA_S3TC_DXT3_Format2)return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(p2===RGBA_S3TC_DXT5_Format2) +return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(p2===RGB_PVRTC_4BPPV1_Format2|| +p2===RGB_PVRTC_2BPPV1_Format2||p2===RGBA_PVRTC_4BPPV1_Format2||p2===RGBA_PVRTC_2BPPV1_Format2) +if(extension=extensions.get("WEBGL_compressed_texture_pvrtc"),extension!==null){ +if(p2===RGB_PVRTC_4BPPV1_Format2)return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; +if(p2===RGB_PVRTC_2BPPV1_Format2)return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; +if(p2===RGBA_PVRTC_4BPPV1_Format2)return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; +if(p2===RGBA_PVRTC_2BPPV1_Format2)return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else +return null;if(p2===RGB_ETC1_Format2)return extension=extensions.get("WEBGL_comp\ +ressed_texture_etc1"),extension!==null?extension.COMPRESSED_RGB_ETC1_WEBGL:null; +if(p2===RGB_ETC2_Format2||p2===RGBA_ETC2_EAC_Format2)if(extension=extensions.get( +"WEBGL_compressed_texture_etc"),extension!==null){if(p2===RGB_ETC2_Format2)return transfer=== +SRGBTransfer2?extension.COMPRESSED_SRGB8_ETC2:extension.COMPRESSED_RGB8_ETC2;if(p2=== +RGBA_ETC2_EAC_Format2)return transfer===SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: +extension.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(p2===RGBA_ASTC_4x4_Format2|| +p2===RGBA_ASTC_5x4_Format2||p2===RGBA_ASTC_5x5_Format2||p2===RGBA_ASTC_6x5_Format2|| +p2===RGBA_ASTC_6x6_Format2||p2===RGBA_ASTC_8x5_Format2||p2===RGBA_ASTC_8x6_Format2|| +p2===RGBA_ASTC_8x8_Format2||p2===RGBA_ASTC_10x5_Format2||p2===RGBA_ASTC_10x6_Format2|| +p2===RGBA_ASTC_10x8_Format2||p2===RGBA_ASTC_10x10_Format2||p2===RGBA_ASTC_12x10_Format2|| +p2===RGBA_ASTC_12x12_Format2)if(extension=extensions.get("WEBGL_compressed_textu\ +re_astc"),extension!==null){if(p2===RGBA_ASTC_4x4_Format2)return transfer===SRGBTransfer2? +extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:extension.COMPRESSED_RGBA_ASTC_4x4_KHR; +if(p2===RGBA_ASTC_5x4_Format2)return transfer===SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: +extension.COMPRESSED_RGBA_ASTC_5x4_KHR;if(p2===RGBA_ASTC_5x5_Format2)return transfer=== +SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:extension.COMPRESSED_RGBA_ASTC_5x5_KHR; +if(p2===RGBA_ASTC_6x5_Format2)return transfer===SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: +extension.COMPRESSED_RGBA_ASTC_6x5_KHR;if(p2===RGBA_ASTC_6x6_Format2)return transfer=== +SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:extension.COMPRESSED_RGBA_ASTC_6x6_KHR; +if(p2===RGBA_ASTC_8x5_Format2)return transfer===SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: +extension.COMPRESSED_RGBA_ASTC_8x5_KHR;if(p2===RGBA_ASTC_8x6_Format2)return transfer=== +SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:extension.COMPRESSED_RGBA_ASTC_8x6_KHR; +if(p2===RGBA_ASTC_8x8_Format2)return transfer===SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: +extension.COMPRESSED_RGBA_ASTC_8x8_KHR;if(p2===RGBA_ASTC_10x5_Format2)return transfer=== +SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:extension.COMPRESSED_RGBA_ASTC_10x5_KHR; +if(p2===RGBA_ASTC_10x6_Format2)return transfer===SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: +extension.COMPRESSED_RGBA_ASTC_10x6_KHR;if(p2===RGBA_ASTC_10x8_Format2)return transfer=== +SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:extension.COMPRESSED_RGBA_ASTC_10x8_KHR; +if(p2===RGBA_ASTC_10x10_Format2)return transfer===SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: +extension.COMPRESSED_RGBA_ASTC_10x10_KHR;if(p2===RGBA_ASTC_12x10_Format2)return transfer=== +SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:extension.COMPRESSED_RGBA_ASTC_12x10_KHR; +if(p2===RGBA_ASTC_12x12_Format2)return transfer===SRGBTransfer2?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: +extension.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(p2===RGBA_BPTC_Format2|| +p2===RGB_BPTC_SIGNED_Format2||p2===RGB_BPTC_UNSIGNED_Format2)if(extension=extensions. +get("EXT_texture_compression_bptc"),extension!==null){if(p2===RGBA_BPTC_Format2) +return transfer===SRGBTransfer2?extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:extension. +COMPRESSED_RGBA_BPTC_UNORM_EXT;if(p2===RGB_BPTC_SIGNED_Format2)return extension. +COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(p2===RGB_BPTC_UNSIGNED_Format2)return extension. +COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(p2===RED_RGTC1_Format2|| +p2===SIGNED_RED_RGTC1_Format2||p2===RED_GREEN_RGTC2_Format2||p2===SIGNED_RED_GREEN_RGTC2_Format2) +if(extension=extensions.get("EXT_texture_compression_rgtc"),extension!==null){if(p2=== +RGBA_BPTC_Format2)return extension.COMPRESSED_RED_RGTC1_EXT;if(p2===SIGNED_RED_RGTC1_Format2) +return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(p2===RED_GREEN_RGTC2_Format2) +return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;if(p2===SIGNED_RED_GREEN_RGTC2_Format2) +return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return p2=== +UnsignedInt248Type2?isWebGL2?gl.UNSIGNED_INT_24_8:(extension=extensions.get("WEB\ +GL_depth_texture"),extension!==null?extension.UNSIGNED_INT_24_8_WEBGL:null):gl[p2]!== +void 0?gl[p2]:null}return __name(convert,"convert"),{convert}}__name(WebGLUtils, +"WebGLUtils");var ArrayCamera=class extends PerspectiveCamera{static{__name(this, +"ArrayCamera")}constructor(array=[]){super(),this.isArrayCamera=!0,this.cameras= +array}},Group=class extends Object3D2{static{__name(this,"Group")}constructor(){ +super(),this.isGroup=!0,this.type="Group"}},_moveEvent={type:"move"},WebXRController=class{static{ +__name(this,"WebXRController")}constructor(){this._targetRay=null,this._grip=null, +this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Group,this. +_hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand. +inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay=== +null&&(this._targetRay=new Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay. +visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector32, +this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector32), +this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Group,this. +_grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1, +this._grip.linearVelocity=new Vector32,this._grip.hasAngularVelocity=!1,this._grip. +angularVelocity=new Vector32),this._grip}dispatchEvent(event){return this._targetRay!== +null&&this._targetRay.dispatchEvent(event),this._grip!==null&&this._grip.dispatchEvent( +event),this._hand!==null&&this._hand.dispatchEvent(event),this}connect(inputSource){ +if(inputSource&&inputSource.hand){let hand=this._hand;if(hand)for(let inputjoint of inputSource. +hand.values())this._getHandJoint(hand,inputjoint)}return this.dispatchEvent({type:"\ +connected",data:inputSource}),this}disconnect(inputSource){return this.dispatchEvent( +{type:"disconnected",data:inputSource}),this._targetRay!==null&&(this._targetRay. +visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this. +_hand.visible=!1),this}update(inputSource,frame,referenceSpace){let inputPose=null, +gripPose=null,handPose=null,targetRay=this._targetRay,grip=this._grip,hand=this. +_hand;if(inputSource&&frame.session.visibilityState!=="visible-blurred"){if(hand&& +inputSource.hand){handPose=!0;for(let inputjoint of inputSource.hand.values()){let jointPose=frame. +getJointPose(inputjoint,referenceSpace),joint=this._getHandJoint(hand,inputjoint); +jointPose!==null&&(joint.matrix.fromArray(jointPose.transform.matrix),joint.matrix. +decompose(joint.position,joint.rotation,joint.scale),joint.matrixWorldNeedsUpdate= +!0,joint.jointRadius=jointPose.radius),joint.visible=jointPose!==null}let indexTip=hand. +joints["index-finger-tip"],thumbTip=hand.joints["thumb-tip"],distance=indexTip.position. +distanceTo(thumbTip.position),distanceToPinch=.02,threshold=.005;hand.inputState. +pinching&&distance>distanceToPinch+threshold?(hand.inputState.pinching=!1,this.dispatchEvent( +{type:"pinchend",handedness:inputSource.handedness,target:this})):!hand.inputState. +pinching&&distance<=distanceToPinch-threshold&&(hand.inputState.pinching=!0,this. +dispatchEvent({type:"pinchstart",handedness:inputSource.handedness,target:this}))}else +grip!==null&&inputSource.gripSpace&&(gripPose=frame.getPose(inputSource.gripSpace, +referenceSpace),gripPose!==null&&(grip.matrix.fromArray(gripPose.transform.matrix), +grip.matrix.decompose(grip.position,grip.rotation,grip.scale),grip.matrixWorldNeedsUpdate= +!0,gripPose.linearVelocity?(grip.hasLinearVelocity=!0,grip.linearVelocity.copy(gripPose. +linearVelocity)):grip.hasLinearVelocity=!1,gripPose.angularVelocity?(grip.hasAngularVelocity= +!0,grip.angularVelocity.copy(gripPose.angularVelocity)):grip.hasAngularVelocity= +!1));targetRay!==null&&(inputPose=frame.getPose(inputSource.targetRaySpace,referenceSpace), +inputPose===null&&gripPose!==null&&(inputPose=gripPose),inputPose!==null&&(targetRay. +matrix.fromArray(inputPose.transform.matrix),targetRay.matrix.decompose(targetRay. +position,targetRay.rotation,targetRay.scale),targetRay.matrixWorldNeedsUpdate=!0, +inputPose.linearVelocity?(targetRay.hasLinearVelocity=!0,targetRay.linearVelocity. +copy(inputPose.linearVelocity)):targetRay.hasLinearVelocity=!1,inputPose.angularVelocity? +(targetRay.hasAngularVelocity=!0,targetRay.angularVelocity.copy(inputPose.angularVelocity)): +targetRay.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent)))}return targetRay!== +null&&(targetRay.visible=inputPose!==null),grip!==null&&(grip.visible=gripPose!== +null),hand!==null&&(hand.visible=handPose!==null),this}_getHandJoint(hand,inputjoint){ +if(hand.joints[inputjoint.jointName]===void 0){let joint=new Group;joint.matrixAutoUpdate= +!1,joint.visible=!1,hand.joints[inputjoint.jointName]=joint,hand.add(joint)}return hand. +joints[inputjoint.jointName]}},WebXRManager=class extends EventDispatcher2{static{ +__name(this,"WebXRManager")}constructor(renderer,gl){super();let scope=this,session=null, +framebufferScaleFactor=1,referenceSpace=null,referenceSpaceType="local-floor",foveation=1, +customReferenceSpace=null,pose=null,glBinding=null,glProjLayer=null,glBaseLayer=null, +xrFrame=null,attributes=gl.getContextAttributes(),initialRenderTarget=null,newRenderTarget=null, +controllers=[],controllerInputSources=[],currentSize=new Vector22,currentPixelRatio=null, +cameraL=new PerspectiveCamera;cameraL.layers.enable(1),cameraL.viewport=new Vector4; +let cameraR=new PerspectiveCamera;cameraR.layers.enable(2),cameraR.viewport=new Vector4; +let cameras=[cameraL,cameraR],cameraXR=new ArrayCamera;cameraXR.layers.enable(1), +cameraXR.layers.enable(2);let _currentDepthNear=null,_currentDepthFar=null;this. +cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(index){ +let controller=controllers[index];return controller===void 0&&(controller=new WebXRController, +controllers[index]=controller),controller.getTargetRaySpace()},this.getControllerGrip= +function(index){let controller=controllers[index];return controller===void 0&&(controller= +new WebXRController,controllers[index]=controller),controller.getGripSpace()},this. +getHand=function(index){let controller=controllers[index];return controller===void 0&& +(controller=new WebXRController,controllers[index]=controller),controller.getHandSpace()}; +function onSessionEvent(event){let controllerIndex=controllerInputSources.indexOf( +event.inputSource);if(controllerIndex===-1)return;let controller=controllers[controllerIndex]; +controller!==void 0&&(controller.update(event.inputSource,event.frame,customReferenceSpace|| +referenceSpace),controller.dispatchEvent({type:event.type,data:event.inputSource}))} +__name(onSessionEvent,"onSessionEvent");function onSessionEnd(){session.removeEventListener( +"select",onSessionEvent),session.removeEventListener("selectstart",onSessionEvent), +session.removeEventListener("selectend",onSessionEvent),session.removeEventListener( +"squeeze",onSessionEvent),session.removeEventListener("squeezestart",onSessionEvent), +session.removeEventListener("squeezeend",onSessionEvent),session.removeEventListener( +"end",onSessionEnd),session.removeEventListener("inputsourceschange",onInputSourcesChange); +for(let i2=0;i2=0&&(controllerInputSources[index]=null,controllers[index]. +disconnect(inputSource))}for(let i2=0;i2=controllerInputSources.length){ +controllerInputSources.push(inputSource),controllerIndex=i3;break}else if(controllerInputSources[i3]=== +null){controllerInputSources[i3]=inputSource,controllerIndex=i3;break}if(controllerIndex=== +-1)break}let controller=controllers[controllerIndex];controller&&controller.connect( +inputSource)}}__name(onInputSourcesChange,"onInputSourcesChange");let cameraLPos=new Vector32, +cameraRPos=new Vector32;function setProjectionFromUnion(camera,cameraL2,cameraR2){ +cameraLPos.setFromMatrixPosition(cameraL2.matrixWorld),cameraRPos.setFromMatrixPosition( +cameraR2.matrixWorld);let ipd=cameraLPos.distanceTo(cameraRPos),projL=cameraL2.projectionMatrix. +elements,projR=cameraR2.projectionMatrix.elements,near=projL[14]/(projL[10]-1),far=projL[14]/ +(projL[10]+1),topFov=(projL[9]+1)/projL[5],bottomFov=(projL[9]-1)/projL[5],leftFov=(projL[8]- +1)/projL[0],rightFov=(projR[8]+1)/projR[0],left=near*leftFov,right=near*rightFov, +zOffset=ipd/(-leftFov+rightFov),xOffset=zOffset*-leftFov;cameraL2.matrixWorld.decompose( +camera.position,camera.quaternion,camera.scale),camera.translateX(xOffset),camera. +translateZ(zOffset),camera.matrixWorld.compose(camera.position,camera.quaternion, +camera.scale),camera.matrixWorldInverse.copy(camera.matrixWorld).invert();let near2=near+ +zOffset,far2=far+zOffset,left2=left-xOffset,right2=right+(ipd-xOffset),top2=topFov* +far/far2*near2,bottom2=bottomFov*far/far2*near2;camera.projectionMatrix.makePerspective( +left2,right2,top2,bottom2,near2,far2),camera.projectionMatrixInverse.copy(camera. +projectionMatrix).invert()}__name(setProjectionFromUnion,"setProjectionFromUnion"); +function updateCamera(camera,parent){parent===null?camera.matrixWorld.copy(camera. +matrix):camera.matrixWorld.multiplyMatrices(parent.matrixWorld,camera.matrix),camera. +matrixWorldInverse.copy(camera.matrixWorld).invert()}__name(updateCamera,"update\ +Camera"),this.updateCamera=function(camera){if(session===null)return;cameraXR.near= +cameraR.near=cameraL.near=camera.near,cameraXR.far=cameraR.far=cameraL.far=camera. +far,(_currentDepthNear!==cameraXR.near||_currentDepthFar!==cameraXR.far)&&(session. +updateRenderState({depthNear:cameraXR.near,depthFar:cameraXR.far}),_currentDepthNear= +cameraXR.near,_currentDepthFar=cameraXR.far);let parent=camera.parent,cameras2=cameraXR. +cameras;updateCamera(cameraXR,parent);for(let i2=0;i20&&(uniforms.alphaTest.value= +material.alphaTest);let envMap=properties.get(material).envMap;if(envMap&&(uniforms. +envMap.value=envMap,uniforms.flipEnvMap.value=envMap.isCubeTexture&&envMap.isRenderTargetTexture=== +!1?-1:1,uniforms.reflectivity.value=material.reflectivity,uniforms.ior.value=material. +ior,uniforms.refractionRatio.value=material.refractionRatio),material.lightMap){ +uniforms.lightMap.value=material.lightMap;let scaleFactor=renderer._useLegacyLights=== +!0?Math.PI:1;uniforms.lightMapIntensity.value=material.lightMapIntensity*scaleFactor, +refreshTransformUniform(material.lightMap,uniforms.lightMapTransform)}material.aoMap&& +(uniforms.aoMap.value=material.aoMap,uniforms.aoMapIntensity.value=material.aoMapIntensity, +refreshTransformUniform(material.aoMap,uniforms.aoMapTransform))}__name(refreshUniformsCommon, +"refreshUniformsCommon");function refreshUniformsLine(uniforms,material){uniforms. +diffuse.value.copy(material.color),uniforms.opacity.value=material.opacity,material. +map&&(uniforms.map.value=material.map,refreshTransformUniform(material.map,uniforms. +mapTransform))}__name(refreshUniformsLine,"refreshUniformsLine");function refreshUniformsDash(uniforms,material){ +uniforms.dashSize.value=material.dashSize,uniforms.totalSize.value=material.dashSize+ +material.gapSize,uniforms.scale.value=material.scale}__name(refreshUniformsDash, +"refreshUniformsDash");function refreshUniformsPoints(uniforms,material,pixelRatio,height){ +uniforms.diffuse.value.copy(material.color),uniforms.opacity.value=material.opacity, +uniforms.size.value=material.size*pixelRatio,uniforms.scale.value=height*.5,material. +map&&(uniforms.map.value=material.map,refreshTransformUniform(material.map,uniforms. +uvTransform)),material.alphaMap&&(uniforms.alphaMap.value=material.alphaMap,refreshTransformUniform( +material.alphaMap,uniforms.alphaMapTransform)),material.alphaTest>0&&(uniforms.alphaTest. +value=material.alphaTest)}__name(refreshUniformsPoints,"refreshUniformsPoints"); +function refreshUniformsSprites(uniforms,material){uniforms.diffuse.value.copy(material. +color),uniforms.opacity.value=material.opacity,uniforms.rotation.value=material. +rotation,material.map&&(uniforms.map.value=material.map,refreshTransformUniform( +material.map,uniforms.mapTransform)),material.alphaMap&&(uniforms.alphaMap.value= +material.alphaMap,refreshTransformUniform(material.alphaMap,uniforms.alphaMapTransform)), +material.alphaTest>0&&(uniforms.alphaTest.value=material.alphaTest)}__name(refreshUniformsSprites, +"refreshUniformsSprites");function refreshUniformsPhong(uniforms,material){uniforms. +specular.value.copy(material.specular),uniforms.shininess.value=Math.max(material. +shininess,1e-4)}__name(refreshUniformsPhong,"refreshUniformsPhong");function refreshUniformsToon(uniforms,material){ +material.gradientMap&&(uniforms.gradientMap.value=material.gradientMap)}__name(refreshUniformsToon, +"refreshUniformsToon");function refreshUniformsStandard(uniforms,material){uniforms. +metalness.value=material.metalness,material.metalnessMap&&(uniforms.metalnessMap. +value=material.metalnessMap,refreshTransformUniform(material.metalnessMap,uniforms. +metalnessMapTransform)),uniforms.roughness.value=material.roughness,material.roughnessMap&& +(uniforms.roughnessMap.value=material.roughnessMap,refreshTransformUniform(material. +roughnessMap,uniforms.roughnessMapTransform)),properties.get(material).envMap&&(uniforms. +envMapIntensity.value=material.envMapIntensity)}__name(refreshUniformsStandard,"\ +refreshUniformsStandard");function refreshUniformsPhysical(uniforms,material,transmissionRenderTarget){ +uniforms.ior.value=material.ior,material.sheen>0&&(uniforms.sheenColor.value.copy( +material.sheenColor).multiplyScalar(material.sheen),uniforms.sheenRoughness.value= +material.sheenRoughness,material.sheenColorMap&&(uniforms.sheenColorMap.value=material. +sheenColorMap,refreshTransformUniform(material.sheenColorMap,uniforms.sheenColorMapTransform)), +material.sheenRoughnessMap&&(uniforms.sheenRoughnessMap.value=material.sheenRoughnessMap, +refreshTransformUniform(material.sheenRoughnessMap,uniforms.sheenRoughnessMapTransform))), +material.clearcoat>0&&(uniforms.clearcoat.value=material.clearcoat,uniforms.clearcoatRoughness. +value=material.clearcoatRoughness,material.clearcoatMap&&(uniforms.clearcoatMap. +value=material.clearcoatMap,refreshTransformUniform(material.clearcoatMap,uniforms. +clearcoatMapTransform)),material.clearcoatRoughnessMap&&(uniforms.clearcoatRoughnessMap. +value=material.clearcoatRoughnessMap,refreshTransformUniform(material.clearcoatRoughnessMap, +uniforms.clearcoatRoughnessMapTransform)),material.clearcoatNormalMap&&(uniforms. +clearcoatNormalMap.value=material.clearcoatNormalMap,refreshTransformUniform(material. +clearcoatNormalMap,uniforms.clearcoatNormalMapTransform),uniforms.clearcoatNormalScale. +value.copy(material.clearcoatNormalScale),material.side===BackSide2&&uniforms.clearcoatNormalScale. +value.negate())),material.iridescence>0&&(uniforms.iridescence.value=material.iridescence, +uniforms.iridescenceIOR.value=material.iridescenceIOR,uniforms.iridescenceThicknessMinimum. +value=material.iridescenceThicknessRange[0],uniforms.iridescenceThicknessMaximum. +value=material.iridescenceThicknessRange[1],material.iridescenceMap&&(uniforms.iridescenceMap. +value=material.iridescenceMap,refreshTransformUniform(material.iridescenceMap,uniforms. +iridescenceMapTransform)),material.iridescenceThicknessMap&&(uniforms.iridescenceThicknessMap. +value=material.iridescenceThicknessMap,refreshTransformUniform(material.iridescenceThicknessMap, +uniforms.iridescenceThicknessMapTransform))),material.transmission>0&&(uniforms. +transmission.value=material.transmission,uniforms.transmissionSamplerMap.value=transmissionRenderTarget. +texture,uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, +transmissionRenderTarget.height),material.transmissionMap&&(uniforms.transmissionMap. +value=material.transmissionMap,refreshTransformUniform(material.transmissionMap, +uniforms.transmissionMapTransform)),uniforms.thickness.value=material.thickness, +material.thicknessMap&&(uniforms.thicknessMap.value=material.thicknessMap,refreshTransformUniform( +material.thicknessMap,uniforms.thicknessMapTransform)),uniforms.attenuationDistance. +value=material.attenuationDistance,uniforms.attenuationColor.value.copy(material. +attenuationColor)),material.anisotropy>0&&(uniforms.anisotropyVector.value.set(material. +anisotropy*Math.cos(material.anisotropyRotation),material.anisotropy*Math.sin(material. +anisotropyRotation)),material.anisotropyMap&&(uniforms.anisotropyMap.value=material. +anisotropyMap,refreshTransformUniform(material.anisotropyMap,uniforms.anisotropyMapTransform))), +uniforms.specularIntensity.value=material.specularIntensity,uniforms.specularColor. +value.copy(material.specularColor),material.specularColorMap&&(uniforms.specularColorMap. +value=material.specularColorMap,refreshTransformUniform(material.specularColorMap, +uniforms.specularColorMapTransform)),material.specularIntensityMap&&(uniforms.specularIntensityMap. +value=material.specularIntensityMap,refreshTransformUniform(material.specularIntensityMap, +uniforms.specularIntensityMapTransform))}__name(refreshUniformsPhysical,"refresh\ +UniformsPhysical");function refreshUniformsMatcap(uniforms,material){material.matcap&& +(uniforms.matcap.value=material.matcap)}__name(refreshUniformsMatcap,"refreshUni\ +formsMatcap");function refreshUniformsDistance(uniforms,material){let light=properties. +get(material).light;uniforms.referencePosition.value.setFromMatrixPosition(light. +matrixWorld),uniforms.nearDistance.value=light.shadow.camera.near,uniforms.farDistance. +value=light.shadow.camera.far}return __name(refreshUniformsDistance,"refreshUnif\ +ormsDistance"),{refreshFogUniforms,refreshMaterialUniforms}}__name(WebGLMaterials, +"WebGLMaterials");function WebGLUniformsGroups(gl,info,capabilities,state){let buffers={}, +updateList={},allocatedBindingPoints=[],maxBindingPoints=capabilities.isWebGL2?gl. +getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS):0;function bind(uniformsGroup,program){ +let webglProgram=program.program;state.uniformBlockBinding(uniformsGroup,webglProgram)} +__name(bind,"bind");function update(uniformsGroup,program){let buffer=buffers[uniformsGroup. +id];buffer===void 0&&(prepareUniformsGroup(uniformsGroup),buffer=createBuffer(uniformsGroup), +buffers[uniformsGroup.id]=buffer,uniformsGroup.addEventListener("dispose",onUniformsGroupsDispose)); +let webglProgram=program.program;state.updateUBOMapping(uniformsGroup,webglProgram); +let frame=info.render.frame;updateList[uniformsGroup.id]!==frame&&(updateBufferData( +uniformsGroup),updateList[uniformsGroup.id]=frame)}__name(update,"update");function createBuffer(uniformsGroup){ +let bindingPointIndex=allocateBindingPointIndex();uniformsGroup.__bindingPointIndex= +bindingPointIndex;let buffer=gl.createBuffer(),size3=uniformsGroup.__size,usage=uniformsGroup. +usage;return gl.bindBuffer(gl.UNIFORM_BUFFER,buffer),gl.bufferData(gl.UNIFORM_BUFFER, +size3,usage),gl.bindBuffer(gl.UNIFORM_BUFFER,null),gl.bindBufferBase(gl.UNIFORM_BUFFER, +bindingPointIndex,buffer),buffer}__name(createBuffer,"createBuffer");function allocateBindingPointIndex(){ +for(let i2=0;i20&&(offset+=chunkSize-chunkOffset),uniformsGroup.__size= +offset,uniformsGroup.__cache={},this}__name(prepareUniformsGroup,"prepareUniform\ +sGroup");function getUniformSize(value){let info2={boundary:0,storage:0};return typeof value== +"number"||typeof value=="boolean"?(info2.boundary=4,info2.storage=4):value.isVector2? +(info2.boundary=8,info2.storage=8):value.isVector3||value.isColor?(info2.boundary= +16,info2.storage=12):value.isVector4?(info2.boundary=16,info2.storage=16):value. +isMatrix3?(info2.boundary=48,info2.storage=48):value.isMatrix4?(info2.boundary=64, +info2.storage=64):value.isTexture?console.warn("THREE.WebGLRenderer: Texture sam\ +plers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer:\ + Unsupported uniform value type.",value),info2}__name(getUniformSize,"getUniform\ +Size");function onUniformsGroupsDispose(event){let uniformsGroup=event.target;uniformsGroup. +removeEventListener("dispose",onUniformsGroupsDispose);let index=allocatedBindingPoints. +indexOf(uniformsGroup.__bindingPointIndex);allocatedBindingPoints.splice(index,1), +gl.deleteBuffer(buffers[uniformsGroup.id]),delete buffers[uniformsGroup.id],delete updateList[uniformsGroup. +id]}__name(onUniformsGroupsDispose,"onUniformsGroupsDispose");function dispose(){ +for(let id in buffers)gl.deleteBuffer(buffers[id]);allocatedBindingPoints=[],buffers= +{},updateList={}}return __name(dispose,"dispose"),{bind,update,dispose}}__name(WebGLUniformsGroups, +"WebGLUniformsGroups");var WebGLRenderer=class{static{__name(this,"WebGLRenderer")}constructor(parameters={}){ +let{canvas=createCanvasElement2(),context=null,depth=!0,stencil=!0,alpha=!1,antialias=!1, +premultipliedAlpha=!0,preserveDrawingBuffer=!1,powerPreference="default",failIfMajorPerformanceCaveat=!1}=parameters; +this.isWebGLRenderer=!0;let _alpha;context!==null?_alpha=context.getContextAttributes(). +alpha:_alpha=alpha;let uintClearColor=new Uint32Array(4),intClearColor=new Int32Array( +4),currentRenderList=null,currentRenderState=null,renderListStack=[],renderStateStack=[]; +this.domElement=canvas,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. +_outputColorSpace=SRGBColorSpace2,this._useLegacyLights=!1,this.toneMapping=NoToneMapping2, +this.toneMappingExposure=1;let _this=this,_isContextLost=!1,_currentActiveCubeFace=0, +_currentActiveMipmapLevel=0,_currentRenderTarget=null,_currentMaterialId=-1,_currentCamera=null, +_currentViewport=new Vector4,_currentScissor=new Vector4,_currentScissorTest=null, +_currentClearColor=new Color2(0),_currentClearAlpha=0,_width=canvas.width,_height=canvas. +height,_pixelRatio=1,_opaqueSort=null,_transparentSort=null,_viewport=new Vector4( +0,0,_width,_height),_scissor=new Vector4(0,0,_width,_height),_scissorTest=!1,_frustum=new Frustum, +_clippingEnabled=!1,_localClippingEnabled=!1,_transmissionRenderTarget=null,_projScreenMatrix4=new Matrix42, +_vector25=new Vector22,_vector33=new Vector32,_emptyScene={background:null,fog:null, +environment:null,overrideMaterial:null,isScene:!0};function getTargetPixelRatio(){ +return _currentRenderTarget===null?_pixelRatio:1}__name(getTargetPixelRatio,"get\ +TargetPixelRatio");let _gl=context;function getContext(contextNames,contextAttributes){ +for(let i2=0;i2{function checkMaterialsReady(){ +if(materials2.forEach(function(material){properties.get(material).currentProgram. +isReady()&&materials2.delete(material)}),materials2.size===0){resolve(scene2);return} +setTimeout(checkMaterialsReady,10)}__name(checkMaterialsReady,"checkMaterialsRea\ +dy"),extensions.get("KHR_parallel_shader_compile")!==null?checkMaterialsReady(): +setTimeout(checkMaterialsReady,10)})};let onAnimationFrameCallback=null;function onAnimationFrame(time){ +onAnimationFrameCallback&&onAnimationFrameCallback(time)}__name(onAnimationFrame, +"onAnimationFrame");function onXRSessionStart(){animation.stop()}__name(onXRSessionStart, +"onXRSessionStart");function onXRSessionEnd(){animation.start()}__name(onXRSessionEnd, +"onXRSessionEnd");let animation=new WebGLAnimation;animation.setAnimationLoop(onAnimationFrame), +typeof self<"u"&&animation.setContext(self),this.setAnimationLoop=function(callback){ +onAnimationFrameCallback=callback,xr2.setAnimationLoop(callback),callback===null? +animation.stop():animation.start()},xr2.addEventListener("sessionstart",onXRSessionStart), +xr2.addEventListener("sessionend",onXRSessionEnd),this.render=function(scene2,camera){ +if(camera!==void 0&&camera.isCamera!==!0){console.error("THREE.WebGLRenderer.ren\ +der: camera is not an instance of THREE.Camera.");return}if(_isContextLost===!0) +return;scene2.matrixWorldAutoUpdate===!0&&scene2.updateMatrixWorld(),camera.parent=== +null&&camera.matrixWorldAutoUpdate===!0&&camera.updateMatrixWorld(),xr2.enabled=== +!0&&xr2.isPresenting===!0&&(xr2.cameraAutoUpdate===!0&&xr2.updateCamera(camera), +camera=xr2.getCamera()),scene2.isScene===!0&&scene2.onBeforeRender(_this,scene2, +camera,_currentRenderTarget),currentRenderState=renderStates.get(scene2,renderStateStack. +length),currentRenderState.init(),renderStateStack.push(currentRenderState),_projScreenMatrix4. +multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse),_frustum.setFromProjectionMatrix( +_projScreenMatrix4),_localClippingEnabled=this.localClippingEnabled,_clippingEnabled= +clipping.init(this.clippingPlanes,_localClippingEnabled),currentRenderList=renderLists. +get(scene2,renderListStack.length),currentRenderList.init(),renderListStack.push( +currentRenderList),projectObject(scene2,camera,0,_this.sortObjects),currentRenderList. +finish(),_this.sortObjects===!0&¤tRenderList.sort(_opaqueSort,_transparentSort), +this.info.render.frame++,_clippingEnabled===!0&&clipping.beginShadows();let shadowsArray=currentRenderState. +state.shadowsArray;if(shadowMap.render(shadowsArray,scene2,camera),_clippingEnabled=== +!0&&clipping.endShadows(),this.info.autoReset===!0&&this.info.reset(),background. +render(currentRenderList,scene2),currentRenderState.setupLights(_this._useLegacyLights), +camera.isArrayCamera){let cameras=camera.cameras;for(let i2=0,l=cameras.length;i2< +l;i2++){let camera2=cameras[i2];renderScene(currentRenderList,scene2,camera2,camera2. +viewport)}}else renderScene(currentRenderList,scene2,camera);_currentRenderTarget!== +null&&(textures.updateMultisampleRenderTarget(_currentRenderTarget),textures.updateRenderTargetMipmap( +_currentRenderTarget)),scene2.isScene===!0&&scene2.onAfterRender(_this,scene2,camera), +bindingStates.resetDefaultState(),_currentMaterialId=-1,_currentCamera=null,renderStateStack. +pop(),renderStateStack.length>0?currentRenderState=renderStateStack[renderStateStack. +length-1]:currentRenderState=null,renderListStack.pop(),renderListStack.length>0? +currentRenderList=renderListStack[renderListStack.length-1]:currentRenderList=null}; +function projectObject(object,camera,groupOrder,sortObjects){if(object.visible=== +!1)return;if(object.layers.test(camera.layers)){if(object.isGroup)groupOrder=object. +renderOrder;else if(object.isLOD)object.autoUpdate===!0&&object.update(camera);else if(object. +isLight)currentRenderState.pushLight(object),object.castShadow&¤tRenderState. +pushShadow(object);else if(object.isSprite){if(!object.frustumCulled||_frustum.intersectsSprite( +object)){sortObjects&&_vector33.setFromMatrixPosition(object.matrixWorld).applyMatrix4( +_projScreenMatrix4);let geometry=objects.update(object),material=object.material; +material.visible&¤tRenderList.push(object,geometry,material,groupOrder,_vector33. +z,null)}}else if((object.isMesh||object.isLine||object.isPoints)&&(!object.frustumCulled|| +_frustum.intersectsObject(object))){let geometry=objects.update(object),material=object. +material;if(sortObjects&&(object.boundingSphere!==void 0?(object.boundingSphere=== +null&&object.computeBoundingSphere(),_vector33.copy(object.boundingSphere.center)): +(geometry.boundingSphere===null&&geometry.computeBoundingSphere(),_vector33.copy( +geometry.boundingSphere.center)),_vector33.applyMatrix4(object.matrixWorld).applyMatrix4( +_projScreenMatrix4)),Array.isArray(material)){let groups=geometry.groups;for(let i2=0, +l=groups.length;i20&&renderTransmissionPass(opaqueObjects,transmissiveObjects, +scene2,camera),viewport&&state.viewport(_currentViewport.copy(viewport)),opaqueObjects. +length>0&&renderObjects(opaqueObjects,scene2,camera),transmissiveObjects.length> +0&&renderObjects(transmissiveObjects,scene2,camera),transparentObjects.length>0&& +renderObjects(transparentObjects,scene2,camera),state.buffers.depth.setTest(!0), +state.buffers.depth.setMask(!0),state.buffers.color.setMask(!0),state.setPolygonOffset( +!1)}__name(renderScene,"renderScene");function renderTransmissionPass(opaqueObjects,transmissiveObjects,scene2,camera){ +if((scene2.isScene===!0?scene2.overrideMaterial:null)!==null)return;let isWebGL2=capabilities. +isWebGL2;_transmissionRenderTarget===null&&(_transmissionRenderTarget=new WebGLRenderTarget( +1,1,{generateMipmaps:!0,type:extensions.has("EXT_color_buffer_half_float")?HalfFloatType2: +UnsignedByteType2,minFilter:LinearMipmapLinearFilter2,samples:isWebGL2?4:0})),_this. +getDrawingBufferSize(_vector25),isWebGL2?_transmissionRenderTarget.setSize(_vector25. +x,_vector25.y):_transmissionRenderTarget.setSize(floorPowerOfTwo2(_vector25.x),floorPowerOfTwo2( +_vector25.y));let currentRenderTarget=_this.getRenderTarget();_this.setRenderTarget( +_transmissionRenderTarget),_this.getClearColor(_currentClearColor),_currentClearAlpha= +_this.getClearAlpha(),_currentClearAlpha<1&&_this.setClearColor(16777215,.5),_this. +clear();let currentToneMapping=_this.toneMapping;_this.toneMapping=NoToneMapping2, +renderObjects(opaqueObjects,scene2,camera),textures.updateMultisampleRenderTarget( +_transmissionRenderTarget),textures.updateRenderTargetMipmap(_transmissionRenderTarget); +let renderTargetNeedsUpdate=!1;for(let i2=0,l=transmissiveObjects.length;i20),morphTargets=!!geometry. +morphAttributes.position,morphNormals=!!geometry.morphAttributes.normal,morphColors=!!geometry. +morphAttributes.color,toneMapping=NoToneMapping2;material.toneMapped&&(_currentRenderTarget=== +null||_currentRenderTarget.isXRRenderTarget===!0)&&(toneMapping=_this.toneMapping); +let morphAttribute=geometry.morphAttributes.position||geometry.morphAttributes.normal|| +geometry.morphAttributes.color,morphTargetsCount=morphAttribute!==void 0?morphAttribute. +length:0,materialProperties=properties.get(material),lights=currentRenderState.state. +lights;if(_clippingEnabled===!0&&(_localClippingEnabled===!0||camera!==_currentCamera)){ +let useCache=camera===_currentCamera&&material.id===_currentMaterialId;clipping. +setState(material,camera,useCache)}let needsProgramChange=!1;material.version=== +materialProperties.__version?(materialProperties.needsLights&&materialProperties. +lightsStateVersion!==lights.state.version||materialProperties.outputColorSpace!== +colorSpace||object.isBatchedMesh&&materialProperties.batching===!1||!object.isBatchedMesh&& +materialProperties.batching===!0||object.isInstancedMesh&&materialProperties.instancing=== +!1||!object.isInstancedMesh&&materialProperties.instancing===!0||object.isSkinnedMesh&& +materialProperties.skinning===!1||!object.isSkinnedMesh&&materialProperties.skinning=== +!0||object.isInstancedMesh&&materialProperties.instancingColor===!0&&object.instanceColor=== +null||object.isInstancedMesh&&materialProperties.instancingColor===!1&&object.instanceColor!== +null||materialProperties.envMap!==envMap||material.fog===!0&&materialProperties. +fog!==fog||materialProperties.numClippingPlanes!==void 0&&(materialProperties.numClippingPlanes!== +clipping.numPlanes||materialProperties.numIntersection!==clipping.numIntersection)|| +materialProperties.vertexAlphas!==vertexAlphas||materialProperties.vertexTangents!== +vertexTangents||materialProperties.morphTargets!==morphTargets||materialProperties. +morphNormals!==morphNormals||materialProperties.morphColors!==morphColors||materialProperties. +toneMapping!==toneMapping||capabilities.isWebGL2===!0&&materialProperties.morphTargetsCount!== +morphTargetsCount)&&(needsProgramChange=!0):(needsProgramChange=!0,materialProperties. +__version=material.version);let program=materialProperties.currentProgram;needsProgramChange=== +!0&&(program=getProgram(material,scene2,object));let refreshProgram=!1,refreshMaterial=!1, +refreshLights=!1,p_uniforms=program.getUniforms(),m_uniforms=materialProperties. +uniforms;if(state.useProgram(program.program)&&(refreshProgram=!0,refreshMaterial= +!0,refreshLights=!0),material.id!==_currentMaterialId&&(_currentMaterialId=material. +id,refreshMaterial=!0),refreshProgram||_currentCamera!==camera){p_uniforms.setValue( +_gl,"projectionMatrix",camera.projectionMatrix),p_uniforms.setValue(_gl,"viewMat\ +rix",camera.matrixWorldInverse);let uCamPos=p_uniforms.map.cameraPosition;uCamPos!== +void 0&&uCamPos.setValue(_gl,_vector33.setFromMatrixPosition(camera.matrixWorld)), +capabilities.logarithmicDepthBuffer&&p_uniforms.setValue(_gl,"logDepthBufFC",2/(Math. +log(camera.far+1)/Math.LN2)),(material.isMeshPhongMaterial||material.isMeshToonMaterial|| +material.isMeshLambertMaterial||material.isMeshBasicMaterial||material.isMeshStandardMaterial|| +material.isShaderMaterial)&&p_uniforms.setValue(_gl,"isOrthographic",camera.isOrthographicCamera=== +!0),_currentCamera!==camera&&(_currentCamera=camera,refreshMaterial=!0,refreshLights= +!0)}if(object.isSkinnedMesh){p_uniforms.setOptional(_gl,object,"bindMatrix"),p_uniforms. +setOptional(_gl,object,"bindMatrixInverse");let skeleton=object.skeleton;skeleton&& +(capabilities.floatVertexTextures?(skeleton.boneTexture===null&&skeleton.computeBoneTexture(), +p_uniforms.setValue(_gl,"boneTexture",skeleton.boneTexture,textures)):console.warn( +"THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OE\ +S_texture_float and vertex textures support is required."))}object.isBatchedMesh&& +(p_uniforms.setOptional(_gl,object,"batchingTexture"),p_uniforms.setValue(_gl,"b\ +atchingTexture",object._matricesTexture,textures));let morphAttributes=geometry. +morphAttributes;if((morphAttributes.position!==void 0||morphAttributes.normal!== +void 0||morphAttributes.color!==void 0&&capabilities.isWebGL2===!0)&&morphtargets. +update(object,geometry,program),(refreshMaterial||materialProperties.receiveShadow!== +object.receiveShadow)&&(materialProperties.receiveShadow=object.receiveShadow,p_uniforms. +setValue(_gl,"receiveShadow",object.receiveShadow)),material.isMeshGouraudMaterial&& +material.envMap!==null&&(m_uniforms.envMap.value=envMap,m_uniforms.flipEnvMap.value= +envMap.isCubeTexture&&envMap.isRenderTargetTexture===!1?-1:1),refreshMaterial&&(p_uniforms. +setValue(_gl,"toneMappingExposure",_this.toneMappingExposure),materialProperties. +needsLights&&markUniformsLightsNeedsUpdate(m_uniforms,refreshLights),fog&&material. +fog===!0&&materials.refreshFogUniforms(m_uniforms,fog),materials.refreshMaterialUniforms( +m_uniforms,material,_pixelRatio,_height,_transmissionRenderTarget),WebGLUniforms. +upload(_gl,getUniformList(materialProperties),m_uniforms,textures)),material.isShaderMaterial&& +material.uniformsNeedUpdate===!0&&(WebGLUniforms.upload(_gl,getUniformList(materialProperties), +m_uniforms,textures),material.uniformsNeedUpdate=!1),material.isSpriteMaterial&& +p_uniforms.setValue(_gl,"center",object.center),p_uniforms.setValue(_gl,"modelVi\ +ewMatrix",object.modelViewMatrix),p_uniforms.setValue(_gl,"normalMatrix",object. +normalMatrix),p_uniforms.setValue(_gl,"modelMatrix",object.matrixWorld),material. +isShaderMaterial||material.isRawShaderMaterial){let groups=material.uniformsGroups; +for(let i2=0,l=groups.length;i20&&textures.useMultisampledRTT( +renderTarget)===!1?framebuffer=properties.get(renderTarget).__webglMultisampledFramebuffer: +Array.isArray(__webglFramebuffer)?framebuffer=__webglFramebuffer[activeMipmapLevel]: +framebuffer=__webglFramebuffer,_currentViewport.copy(renderTarget.viewport),_currentScissor. +copy(renderTarget.scissor),_currentScissorTest=renderTarget.scissorTest}else _currentViewport. +copy(_viewport).multiplyScalar(_pixelRatio).floor(),_currentScissor.copy(_scissor). +multiplyScalar(_pixelRatio).floor(),_currentScissorTest=_scissorTest;if(state.bindFramebuffer( +_gl.FRAMEBUFFER,framebuffer)&&capabilities.drawBuffers&&useDefaultFramebuffer&&state. +drawBuffers(renderTarget,framebuffer),state.viewport(_currentViewport),state.scissor( +_currentScissor),state.setScissorTest(_currentScissorTest),isCube){let textureProperties=properties. +get(renderTarget.texture);_gl.framebufferTexture2D(_gl.FRAMEBUFFER,_gl.COLOR_ATTACHMENT0, +_gl.TEXTURE_CUBE_MAP_POSITIVE_X+activeCubeFace,textureProperties.__webglTexture, +activeMipmapLevel)}else if(isRenderTarget3D){let textureProperties=properties.get( +renderTarget.texture),layer=activeCubeFace||0;_gl.framebufferTextureLayer(_gl.FRAMEBUFFER, +_gl.COLOR_ATTACHMENT0,textureProperties.__webglTexture,activeMipmapLevel||0,layer)} +_currentMaterialId=-1},this.readRenderTargetPixels=function(renderTarget,x2,y2,width,height,buffer,activeCubeFaceIndex){ +if(!(renderTarget&&renderTarget.isWebGLRenderTarget)){console.error("THREE.WebGL\ +Renderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); +return}let framebuffer=properties.get(renderTarget).__webglFramebuffer;if(renderTarget. +isWebGLCubeRenderTarget&&activeCubeFaceIndex!==void 0&&(framebuffer=framebuffer[activeCubeFaceIndex]), +framebuffer){state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);try{let texture=renderTarget. +texture,textureFormat=texture.format,textureType=texture.type;if(textureFormat!== +RGBAFormat2&&utils.convert(textureFormat)!==_gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_FORMAT)){ +console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not i\ +n RGBA or implementation defined format.");return}let halfFloatSupportedByExt=textureType=== +HalfFloatType2&&(extensions.has("EXT_color_buffer_half_float")||capabilities.isWebGL2&& +extensions.has("EXT_color_buffer_float"));if(textureType!==UnsignedByteType2&&utils. +convert(textureType)!==_gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE)&&!(textureType=== +FloatType2&&(capabilities.isWebGL2||extensions.has("OES_texture_float")||extensions. +has("WEBGL_color_buffer_float")))&&!halfFloatSupportedByExt){console.error("THRE\ +E.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType \ +or implementation defined type.");return}x2>=0&&x2<=renderTarget.width-width&&y2>= +0&&y2<=renderTarget.height-height&&_gl.readPixels(x2,y2,width,height,utils.convert( +textureFormat),utils.convert(textureType),buffer)}finally{let framebuffer2=_currentRenderTarget!== +null?properties.get(_currentRenderTarget).__webglFramebuffer:null;state.bindFramebuffer( +_gl.FRAMEBUFFER,framebuffer2)}}},this.copyFramebufferToTexture=function(position2,texture,level=0){ +let levelScale=Math.pow(2,-level),width=Math.floor(texture.image.width*levelScale), +height=Math.floor(texture.image.height*levelScale);textures.setTexture2D(texture, +0),_gl.copyTexSubImage2D(_gl.TEXTURE_2D,level,0,0,position2.x,position2.y,width, +height),state.unbindTexture()},this.copyTextureToTexture=function(position2,srcTexture,dstTexture,level=0){ +let width=srcTexture.image.width,height=srcTexture.image.height,glFormat=utils.convert( +dstTexture.format),glType=utils.convert(dstTexture.type);textures.setTexture2D(dstTexture, +0),_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,dstTexture.flipY),_gl.pixelStorei(_gl. +UNPACK_PREMULTIPLY_ALPHA_WEBGL,dstTexture.premultiplyAlpha),_gl.pixelStorei(_gl. +UNPACK_ALIGNMENT,dstTexture.unpackAlignment),srcTexture.isDataTexture?_gl.texSubImage2D( +_gl.TEXTURE_2D,level,position2.x,position2.y,width,height,glFormat,glType,srcTexture. +image.data):srcTexture.isCompressedTexture?_gl.compressedTexSubImage2D(_gl.TEXTURE_2D, +level,position2.x,position2.y,srcTexture.mipmaps[0].width,srcTexture.mipmaps[0]. +height,glFormat,srcTexture.mipmaps[0].data):_gl.texSubImage2D(_gl.TEXTURE_2D,level, +position2.x,position2.y,glFormat,glType,srcTexture.image),level===0&&dstTexture. +generateMipmaps&&_gl.generateMipmap(_gl.TEXTURE_2D),state.unbindTexture()},this. +copyTextureToTexture3D=function(sourceBox,position2,srcTexture,dstTexture,level=0){ +if(_this.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTextur\ +e3D: can only be used with WebGL2.");return}let width=sourceBox.max.x-sourceBox. +min.x+1,height=sourceBox.max.y-sourceBox.min.y+1,depth2=sourceBox.max.z-sourceBox. +min.z+1,glFormat=utils.convert(dstTexture.format),glType=utils.convert(dstTexture. +type),glTarget;if(dstTexture.isData3DTexture)textures.setTexture3D(dstTexture,0), +glTarget=_gl.TEXTURE_3D;else if(dstTexture.isDataArrayTexture||dstTexture.isCompressedArrayTexture) +textures.setTexture2DArray(dstTexture,0),glTarget=_gl.TEXTURE_2D_ARRAY;else{console. +warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTextur\ +e3D and THREE.DataTexture2DArray.");return}_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, +dstTexture.flipY),_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,dstTexture. +premultiplyAlpha),_gl.pixelStorei(_gl.UNPACK_ALIGNMENT,dstTexture.unpackAlignment); +let unpackRowLen=_gl.getParameter(_gl.UNPACK_ROW_LENGTH),unpackImageHeight=_gl.getParameter( +_gl.UNPACK_IMAGE_HEIGHT),unpackSkipPixels=_gl.getParameter(_gl.UNPACK_SKIP_PIXELS), +unpackSkipRows=_gl.getParameter(_gl.UNPACK_SKIP_ROWS),unpackSkipImages=_gl.getParameter( +_gl.UNPACK_SKIP_IMAGES),image=srcTexture.isCompressedTexture?srcTexture.mipmaps[level]: +srcTexture.image;_gl.pixelStorei(_gl.UNPACK_ROW_LENGTH,image.width),_gl.pixelStorei( +_gl.UNPACK_IMAGE_HEIGHT,image.height),_gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS,sourceBox. +min.x),_gl.pixelStorei(_gl.UNPACK_SKIP_ROWS,sourceBox.min.y),_gl.pixelStorei(_gl. +UNPACK_SKIP_IMAGES,sourceBox.min.z),srcTexture.isDataTexture||srcTexture.isData3DTexture? +_gl.texSubImage3D(glTarget,level,position2.x,position2.y,position2.z,width,height, +depth2,glFormat,glType,image.data):srcTexture.isCompressedArrayTexture?(console. +warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compresse\ +d srcTexture."),_gl.compressedTexSubImage3D(glTarget,level,position2.x,position2. +y,position2.z,width,height,depth2,glFormat,image.data)):_gl.texSubImage3D(glTarget, +level,position2.x,position2.y,position2.z,width,height,depth2,glFormat,glType,image), +_gl.pixelStorei(_gl.UNPACK_ROW_LENGTH,unpackRowLen),_gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, +unpackImageHeight),_gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS,unpackSkipPixels),_gl. +pixelStorei(_gl.UNPACK_SKIP_ROWS,unpackSkipRows),_gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, +unpackSkipImages),level===0&&dstTexture.generateMipmaps&&_gl.generateMipmap(glTarget), +state.unbindTexture()},this.initTexture=function(texture){texture.isCubeTexture? +textures.setTextureCube(texture,0):texture.isData3DTexture?textures.setTexture3D( +texture,0):texture.isDataArrayTexture||texture.isCompressedArrayTexture?textures. +setTexture2DArray(texture,0):textures.setTexture2D(texture,0),state.unbindTexture()}, +this.resetState=function(){_currentActiveCubeFace=0,_currentActiveMipmapLevel=0, +_currentRenderTarget=null,state.reset(),bindingStates.reset()},typeof __THREE_DEVTOOLS__< +"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){ +return WebGLCoordinateSystem2}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(colorSpace){ +this._outputColorSpace=colorSpace;let gl=this.getContext();gl.drawingBufferColorSpace= +colorSpace===DisplayP3ColorSpace2?"display-p3":"srgb",gl.unpackColorSpace=ColorManagement2. +workingColorSpace===LinearDisplayP3ColorSpace2?"display-p3":"srgb"}get outputEncoding(){ +return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been remo\ +ved. Use .outputColorSpace instead."),this.outputColorSpace===SRGBColorSpace2?sRGBEncoding2: +LinearEncoding2}set outputEncoding(encoding){console.warn("THREE.WebGLRenderer: \ +Property .outputEncoding has been removed. Use .outputColorSpace instead."),this. +outputColorSpace=encoding===sRGBEncoding2?SRGBColorSpace2:LinearSRGBColorSpace2}get useLegacyLights(){ +return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been\ + deprecated. Migrate your lighting according to the following guide: https://dis\ +course.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(value){ +console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprec\ +ated. Migrate your lighting according to the following guide: https://discourse.\ +threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights= +value}},WebGL1Renderer=class extends WebGLRenderer{static{__name(this,"WebGL1Ren\ +derer")}};WebGL1Renderer.prototype.isWebGL1Renderer=!0;var Scene=class extends Object3D2{static{__name(this,"Scene")}constructor(){super(), +this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this. +fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial= +null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent( +"observe",{detail:this}))}copy(source,recursive){return super.copy(source,recursive), +source.background!==null&&(this.background=source.background.clone()),source.environment!== +null&&(this.environment=source.environment.clone()),source.fog!==null&&(this.fog= +source.fog.clone()),this.backgroundBlurriness=source.backgroundBlurriness,this.backgroundIntensity= +source.backgroundIntensity,source.overrideMaterial!==null&&(this.overrideMaterial= +source.overrideMaterial.clone()),this.matrixAutoUpdate=source.matrixAutoUpdate,this}toJSON(meta){ +let data=super.toJSON(meta);return this.fog!==null&&(data.object.fog=this.fog.toJSON()), +this.backgroundBlurriness>0&&(data.object.backgroundBlurriness=this.backgroundBlurriness), +this.backgroundIntensity!==1&&(data.object.backgroundIntensity=this.backgroundIntensity), +data}},InterleavedBuffer=class{static{__name(this,"InterleavedBuffer")}constructor(array,stride){ +this.isInterleavedBuffer=!0,this.array=array,this.stride=stride,this.count=array!== +void 0?array.length/stride:0,this.usage=StaticDrawUsage2,this._updateRange={offset:0, +count:-1},this.updateRanges=[],this.version=0,this.uuid=generateUUID2()}onUploadCallback(){}set needsUpdate(value){ +value===!0&&this.version++}get updateRange(){return console.warn("THREE.Interlea\ +vedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdat\ +eRange() instead."),this._updateRange}setUsage(value){return this.usage=value,this}addUpdateRange(start,count){ +this.updateRanges.push({start,count})}clearUpdateRanges(){this.updateRanges.length= +0}copy(source){return this.array=new source.array.constructor(source.array),this. +count=source.count,this.stride=source.stride,this.usage=source.usage,this}copyAt(index1,attribute2,index2){ +index1*=this.stride,index2*=attribute2.stride;for(let i2=0,l=this.stride;i2localThresholdSq)continue;interRay.applyMatrix4(this.matrixWorld); +let distance=raycaster.ray.origin.distanceTo(interRay);distanceraycaster.far||intersects3.push({distance,point:interSegment.clone().applyMatrix4( +this.matrixWorld),index:i2,face:null,faceIndex:null,object:this})}}else{let start=Math. +max(0,drawRange.start),end=Math.min(positionAttribute.count,drawRange.start+drawRange. +count);for(let i2=start,l=end-1;i2localThresholdSq)continue;interRay.applyMatrix4( +this.matrixWorld);let distance=raycaster.ray.origin.distanceTo(interRay);distance< +raycaster.near||distance>raycaster.far||intersects3.push({distance,point:interSegment. +clone().applyMatrix4(this.matrixWorld),index:i2,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){ +let morphAttributes=this.geometry.morphAttributes,keys=Object.keys(morphAttributes); +if(keys.length>0){let morphAttribute=morphAttributes[keys[0]];if(morphAttribute!== +void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let m=0, +ml=morphAttribute.length;m0){let morphAttribute=morphAttributes[keys[0]]; +if(morphAttribute!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary= +{};for(let m=0,ml=morphAttribute.length;mraycaster.far)return;intersects3. +push({distance,distanceToRay:Math.sqrt(rayPointDistanceSq),point:intersectPoint, +index,face:null,object})}}__name(testPoint2,"testPoint");var Curve=class{static{__name(this,"Curve")}constructor(){this.type="Curve",this. +arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() \ +not implemented."),null}getPointAt(u2,optionalTarget){let t=this.getUtoTmapping( +u2);return this.getPoint(t,optionalTarget)}getPoints(divisions=5){let points=[]; +for(let d2=0;d2<=divisions;d2++)points.push(this.getPoint(d2/divisions));return points}getSpacedPoints(divisions=5){ +let points=[];for(let d2=0;d2<=divisions;d2++)points.push(this.getPointAt(d2/divisions)); +return points}getLength(){let lengths=this.getLengths();return lengths[lengths.length- +1]}getLengths(divisions=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths. +length===divisions+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate= +!1;let cache2=[],current,last=this.getPoint(0),sum=0;cache2.push(0);for(let p2=1;p2<= +divisions;p2++)current=this.getPoint(p2/divisions),sum+=current.distanceTo(last), +cache2.push(sum),last=current;return this.cacheArcLengths=cache2,cache2}updateArcLengths(){ +this.needsUpdate=!0,this.getLengths()}getUtoTmapping(u2,distance){let arcLengths=this. +getLengths(),i2=0,il=arcLengths.length,targetArcLength;distance?targetArcLength= +distance:targetArcLength=u2*arcLengths[il-1];let low=0,high=il-1,comparison;for(;low<= +high;)if(i2=Math.floor(low+(high-low)/2),comparison=arcLengths[i2]-targetArcLength, +comparison<0)low=i2+1;else if(comparison>0)high=i2-1;else{high=i2;break}if(i2=high, +arcLengths[i2]===targetArcLength)return i2/(il-1);let lengthBefore=arcLengths[i2], +segmentLength=arcLengths[i2+1]-lengthBefore,segmentFraction=(targetArcLength-lengthBefore)/ +segmentLength;return(i2+segmentFraction)/(il-1)}getTangent(t,optionalTarget){let t1=t- +1e-4,t2=t+1e-4;t1<0&&(t1=0),t2>1&&(t2=1);let pt1=this.getPoint(t1),pt2=this.getPoint( +t2),tangent=optionalTarget||(pt1.isVector2?new Vector22:new Vector32);return tangent. +copy(pt2).sub(pt1).normalize(),tangent}getTangentAt(u2,optionalTarget){let t=this. +getUtoTmapping(u2);return this.getTangent(t,optionalTarget)}computeFrenetFrames(segments,closed){ +let normal=new Vector32,tangents=[],normals=[],binormals=[],vec=new Vector32,mat=new Matrix42; +for(let i2=0;i2<=segments;i2++){let u2=i2/segments;tangents[i2]=this.getTangentAt( +u2,new Vector32)}normals[0]=new Vector32,binormals[0]=new Vector32;let min=Number. +MAX_VALUE,tx=Math.abs(tangents[0].x),ty=Math.abs(tangents[0].y),tz=Math.abs(tangents[0]. +z);tx<=min&&(min=tx,normal.set(1,0,0)),ty<=min&&(min=ty,normal.set(0,1,0)),tz<=min&& +normal.set(0,0,1),vec.crossVectors(tangents[0],normal).normalize(),normals[0].crossVectors( +tangents[0],vec),binormals[0].crossVectors(tangents[0],normals[0]);for(let i2=1;i2<= +segments;i2++){if(normals[i2]=normals[i2-1].clone(),binormals[i2]=binormals[i2-1]. +clone(),vec.crossVectors(tangents[i2-1],tangents[i2]),vec.length()>Number.EPSILON){ +vec.normalize();let theta=Math.acos(clamp2(tangents[i2-1].dot(tangents[i2]),-1,1)); +normals[i2].applyMatrix4(mat.makeRotationAxis(vec,theta))}binormals[i2].crossVectors( +tangents[i2],normals[i2])}if(closed===!0){let theta=Math.acos(clamp2(normals[0]. +dot(normals[segments]),-1,1));theta/=segments,tangents[0].dot(vec.crossVectors(normals[0], +normals[segments]))>0&&(theta=-theta);for(let i2=1;i2<=segments;i2++)normals[i2]. +applyMatrix4(mat.makeRotationAxis(tangents[i2],theta*i2)),binormals[i2].crossVectors( +tangents[i2],normals[i2])}return{tangents,normals,binormals}}clone(){return new this. +constructor().copy(this)}copy(source){return this.arcLengthDivisions=source.arcLengthDivisions, +this}toJSON(){let data={metadata:{version:4.6,type:"Curve",generator:"Curve.toJS\ +ON"}};return data.arcLengthDivisions=this.arcLengthDivisions,data.type=this.type, +data}fromJSON(json){return this.arcLengthDivisions=json.arcLengthDivisions,this}};var Earcut={triangulate:function(data,holeIndices,dim=2){let hasHoles=holeIndices&& +holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,outerNode=linkedList( +data,0,outerLen,dim,!0),triangles=[];if(!outerNode||outerNode.next===outerNode.prev) +return triangles;let minX,minY,maxX,maxY,x2,y2,invSize;if(hasHoles&&(outerNode=eliminateHoles( +data,holeIndices,outerNode,dim)),data.length>80*dim){minX=maxX=data[0],minY=maxY= +data[1];for(let i2=dim;i2maxX&&(maxX=x2),y2>maxY&&(maxY=y2);invSize=Math.max(maxX- +minX,maxY-minY),invSize=invSize!==0?32767/invSize:0}return earcutLinked(outerNode, +triangles,dim,minX,minY,invSize,0),triangles}};function linkedList(data,start,end,dim,clockwise){ +let i2,last;if(clockwise===signedArea(data,start,end,dim)>0)for(i2=start;i2=start;i2-= +dim)last=insertNode(i2,data[i2],data[i2+1],last);return last&&equals(last,last.next)&& +(removeNode(last),last=last.next),last}__name(linkedList,"linkedList");function filterPoints(start,end){ +if(!start)return start;end||(end=start);let p2=start,again;do if(again=!1,!p2.steiner&& +(equals(p2,p2.next)||area(p2.prev,p2,p2.next)===0)){if(removeNode(p2),p2=end=p2. +prev,p2===p2.next)break;again=!0}else p2=p2.next;while(again||p2!==end);return end} +__name(filterPoints,"filterPoints");function earcutLinked(ear,triangles,dim,minX,minY,invSize,pass){ +if(!ear)return;!pass&&invSize&&indexCurve(ear,minX,minY,invSize);let stop=ear,prev, +next;for(;ear.prev!==ear.next;){if(prev=ear.prev,next=ear.next,invSize?isEarHashed( +ear,minX,minY,invSize):isEar(ear)){triangles.push(prev.i/dim|0),triangles.push(ear. +i/dim|0),triangles.push(next.i/dim|0),removeNode(ear),ear=next.next,stop=next.next; +continue}if(ear=next,ear===stop){pass?pass===1?(ear=cureLocalIntersections(filterPoints( +ear),triangles,dim),earcutLinked(ear,triangles,dim,minX,minY,invSize,2)):pass=== +2&&splitEarcut(ear,triangles,dim,minX,minY,invSize):earcutLinked(filterPoints(ear), +triangles,dim,minX,minY,invSize,1);break}}}__name(earcutLinked,"earcutLinked");function isEar(ear){ +let a=ear.prev,b=ear,c3=ear.next;if(area(a,b,c3)>=0)return!1;let ax=a.x,bx=b.x,cx=c3. +x,ay=a.y,by=b.y,cy=c3.y,x0=axbx?ax>cx?ax:cx:bx>cx?bx:cx,y1=ay>by?ay>cy?ay:cy:by>cy?by:cy,p2=c3. +next;for(;p2!==a;){if(p2.x>=x0&&p2.x<=x1&&p2.y>=y0&&p2.y<=y1&&pointInTriangle(ax, +ay,bx,by,cx,cy,p2.x,p2.y)&&area(p2.prev,p2,p2.next)>=0)return!1;p2=p2.next}return!0} +__name(isEar,"isEar");function isEarHashed(ear,minX,minY,invSize){let a=ear.prev, +b=ear,c3=ear.next;if(area(a,b,c3)>=0)return!1;let ax=a.x,bx=b.x,cx=c3.x,ay=a.y,by=b. +y,cy=c3.y,x0=ax +bx?ax>cx?ax:cx:bx>cx?bx:cx,y1=ay>by?ay>cy?ay:cy:by>cy?by:cy,minZ=zOrder(x0,y0,minX, +minY,invSize),maxZ=zOrder(x1,y1,minX,minY,invSize),p2=ear.prevZ,n=ear.nextZ;for(;p2&& +p2.z>=minZ&&n&&n.z<=maxZ;){if(p2.x>=x0&&p2.x<=x1&&p2.y>=y0&&p2.y<=y1&&p2!==a&&p2!== +c3&&pointInTriangle(ax,ay,bx,by,cx,cy,p2.x,p2.y)&&area(p2.prev,p2,p2.next)>=0||(p2= +p2.prevZ,n.x>=x0&&n.x<=x1&&n.y>=y0&&n.y<=y1&&n!==a&&n!==c3&&pointInTriangle(ax,ay, +bx,by,cx,cy,n.x,n.y)&&area(n.prev,n,n.next)>=0))return!1;n=n.nextZ}for(;p2&&p2.z>= +minZ;){if(p2.x>=x0&&p2.x<=x1&&p2.y>=y0&&p2.y<=y1&&p2!==a&&p2!==c3&&pointInTriangle( +ax,ay,bx,by,cx,cy,p2.x,p2.y)&&area(p2.prev,p2,p2.next)>=0)return!1;p2=p2.prevZ}for(;n&& +n.z<=maxZ;){if(n.x>=x0&&n.x<=x1&&n.y>=y0&&n.y<=y1&&n!==a&&n!==c3&&pointInTriangle( +ax,ay,bx,by,cx,cy,n.x,n.y)&&area(n.prev,n,n.next)>=0)return!1;n=n.nextZ}return!0} +__name(isEarHashed,"isEarHashed");function cureLocalIntersections(start,triangles,dim){ +let p2=start;do{let a=p2.prev,b=p2.next.next;!equals(a,b)&&intersects(a,p2,p2.next, +b)&&locallyInside(a,b)&&locallyInside(b,a)&&(triangles.push(a.i/dim|0),triangles. +push(p2.i/dim|0),triangles.push(b.i/dim|0),removeNode(p2),removeNode(p2.next),p2= +start=b),p2=p2.next}while(p2!==start);return filterPoints(p2)}__name(cureLocalIntersections, +"cureLocalIntersections");function splitEarcut(start,triangles,dim,minX,minY,invSize){ +let a=start;do{let b=a.next.next;for(;b!==a.prev;){if(a.i!==b.i&&isValidDiagonal( +a,b)){let c3=splitPolygon(a,b);a=filterPoints(a,a.next),c3=filterPoints(c3,c3.next), +earcutLinked(a,triangles,dim,minX,minY,invSize,0),earcutLinked(c3,triangles,dim, +minX,minY,invSize,0);return}b=b.next}a=a.next}while(a!==start)}__name(splitEarcut, +"splitEarcut");function eliminateHoles(data,holeIndices,outerNode,dim){let queue=[], +i2,len,start,end,list;for(i2=0,len=holeIndices.length;i2=p2.next.y&&p2. +next.y!==p2.y){let x2=p2.x+(hy-p2.y)*(p2.next.x-p2.x)/(p2.next.y-p2.y);if(x2<=hx&& +x2>qx&&(qx=x2,m=p2.x= +p2.x&&p2.x>=mx&&hx!==p2.x&&pointInTriangle(hym.x||p2.x===m.x&§orContainsSector(m,p2)))&&(m=p2,tanMin=tan)), +p2=p2.next;while(p2!==stop);return m}__name(findHoleBridge,"findHoleBridge");function sectorContainsSector(m,p2){ +return area(m.prev,m,p2.prev)<0&&area(p2.next,m,m.next)<0}__name(sectorContainsSector, +"sectorContainsSector");function indexCurve(start,minX,minY,invSize){let p2=start; +do p2.z===0&&(p2.z=zOrder(p2.x,p2.y,minX,minY,invSize)),p2.prevZ=p2.prev,p2.nextZ= +p2.next,p2=p2.next;while(p2!==start);p2.prevZ.nextZ=null,p2.prevZ=null,sortLinked( +p2)}__name(indexCurve,"indexCurve");function sortLinked(list){let i2,p2,q2,e,tail, +numMerges,pSize,qSize,inSize=1;do{for(p2=list,list=null,tail=null,numMerges=0;p2;){ +for(numMerges++,q2=p2,pSize=0,i2=0;i20||qSize>0&&q2;)pSize!==0&&(qSize===0||!q2||p2.z<=q2.z)?(e=p2,p2=p2. +nextZ,pSize--):(e=q2,q2=q2.nextZ,qSize--),tail?tail.nextZ=e:list=e,e.prevZ=tail, +tail=e;p2=q2}tail.nextZ=null,inSize*=2}while(numMerges>1);return list}__name(sortLinked, +"sortLinked");function zOrder(x2,y2,minX,minY,invSize){return x2=(x2-minX)*invSize| +0,y2=(y2-minY)*invSize|0,x2=(x2|x2<<8)&16711935,x2=(x2|x2<<4)&252645135,x2=(x2|x2<< +2)&858993459,x2=(x2|x2<<1)&1431655765,y2=(y2|y2<<8)&16711935,y2=(y2|y2<<4)&252645135, +y2=(y2|y2<<2)&858993459,y2=(y2|y2<<1)&1431655765,x2|y2<<1}__name(zOrder,"zOrder"); +function getLeftmost(start){let p2=start,leftmost=start;do(p2.x=(ax-px2)*(cy-py2)&&(ax-px2)*(by-py2)>=(bx-px2)*(ay-py2)&& +(bx-px2)*(cy-py2)>=(cx-px2)*(by-py2)}__name(pointInTriangle,"pointInTriangle");function isValidDiagonal(a,b){ +return a.next.i!==b.i&&a.prev.i!==b.i&&!intersectsPolygon(a,b)&&(locallyInside(a, +b)&&locallyInside(b,a)&&middleInside(a,b)&&(area(a.prev,a,b.prev)||area(a,b.prev, +b))||equals(a,b)&&area(a.prev,a,a.next)>0&&area(b.prev,b,b.next)>0)}__name(isValidDiagonal, +"isValidDiagonal");function area(p2,q2,r3){return(q2.y-p2.y)*(r3.x-q2.x)-(q2.x-p2. +x)*(r3.y-q2.y)}__name(area,"area");function equals(p1,p2){return p1.x===p2.x&&p1. +y===p2.y}__name(equals,"equals");function intersects(p1,q1,p2,q2){let o1=sign(area( +p1,q1,p2)),o2=sign(area(p1,q1,q2)),o3=sign(area(p2,q2,p1)),o4=sign(area(p2,q2,q1)); +return!!(o1!==o2&&o3!==o4||o1===0&&onSegment(p1,p2,q1)||o2===0&&onSegment(p1,q2, +q1)||o3===0&&onSegment(p2,p1,q2)||o4===0&&onSegment(p2,q1,q2))}__name(intersects, +"intersects");function onSegment(p2,q2,r3){return q2.x<=Math.max(p2.x,r3.x)&&q2. +x>=Math.min(p2.x,r3.x)&&q2.y<=Math.max(p2.y,r3.y)&&q2.y>=Math.min(p2.y,r3.y)}__name( +onSegment,"onSegment");function sign(num){return num>0?1:num<0?-1:0}__name(sign, +"sign");function intersectsPolygon(a,b){let p2=a;do{if(p2.i!==a.i&&p2.next.i!==a. +i&&p2.i!==b.i&&p2.next.i!==b.i&&intersects(p2,p2.next,a,b))return!0;p2=p2.next}while(p2!== +a);return!1}__name(intersectsPolygon,"intersectsPolygon");function locallyInside(a,b){ +return area(a.prev,a,a.next)<0?area(a,b,a.next)>=0&&area(a,a.prev,b)>=0:area(a,b, +a.prev)<0||area(a,a.next,b)<0}__name(locallyInside,"locallyInside");function middleInside(a,b){ +let p2=a,inside=!1,px2=(a.x+b.x)/2,py2=(a.y+b.y)/2;do p2.y>py2!=p2.next.y>py2&&p2. +next.y!==p2.y&&px2<(p2.next.x-p2.x)*(py2-p2.y)/(p2.next.y-p2.y)+p2.x&&(inside=!inside), +p2=p2.next;while(p2!==a);return inside}__name(middleInside,"middleInside");function splitPolygon(a,b){ +let a2=new Node2(a.i,a.x,a.y),b2=new Node2(b.i,b.x,b.y),an=a.next,bp=b.prev;return a. +next=b,b.prev=a,a2.next=an,an.prev=a2,b2.next=a2,a2.prev=b2,bp.next=b2,b2.prev=bp, +b2}__name(splitPolygon,"splitPolygon");function insertNode(i2,x2,y2,last){let p2=new Node2( +i2,x2,y2);return last?(p2.next=last.next,p2.prev=last,last.next.prev=p2,last.next= +p2):(p2.prev=p2,p2.next=p2),p2}__name(insertNode,"insertNode");function removeNode(p2){ +p2.next.prev=p2.prev,p2.prev.next=p2.next,p2.prevZ&&(p2.prevZ.nextZ=p2.nextZ),p2. +nextZ&&(p2.nextZ.prevZ=p2.prevZ)}__name(removeNode,"removeNode");function Node2(i2,x2,y2){ +this.i=i2,this.x=x2,this.y=y2,this.prev=null,this.next=null,this.z=0,this.prevZ= +null,this.nextZ=null,this.steiner=!1}__name(Node2,"Node");function signedArea(data,start,end,dim){ +let sum=0;for(let i2=start,j2=end-dim;i22&&points[l-1].equals(points[0])&&points.pop()}__name(removeDupEndPts, +"removeDupEndPts");function addContour(vertices,contour){for(let i2=0;i20!=value>0&&this.version++,this._anisotropy=value}get clearcoat(){ +return this._clearcoat}set clearcoat(value){this._clearcoat>0!=value>0&&this.version++, +this._clearcoat=value}get iridescence(){return this._iridescence}set iridescence(value){ +this._iridescence>0!=value>0&&this.version++,this._iridescence=value}get sheen(){ +return this._sheen}set sheen(value){this._sheen>0!=value>0&&this.version++,this. +_sheen=value}get transmission(){return this._transmission}set transmission(value){ +this._transmission>0!=value>0&&this.version++,this._transmission=value}copy(source){ +return super.copy(source),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy= +source.anisotropy,this.anisotropyRotation=source.anisotropyRotation,this.anisotropyMap= +source.anisotropyMap,this.clearcoat=source.clearcoat,this.clearcoatMap=source.clearcoatMap, +this.clearcoatRoughness=source.clearcoatRoughness,this.clearcoatRoughnessMap=source. +clearcoatRoughnessMap,this.clearcoatNormalMap=source.clearcoatNormalMap,this.clearcoatNormalScale. +copy(source.clearcoatNormalScale),this.ior=source.ior,this.iridescence=source.iridescence, +this.iridescenceMap=source.iridescenceMap,this.iridescenceIOR=source.iridescenceIOR, +this.iridescenceThicknessRange=[...source.iridescenceThicknessRange],this.iridescenceThicknessMap= +source.iridescenceThicknessMap,this.sheen=source.sheen,this.sheenColor.copy(source. +sheenColor),this.sheenColorMap=source.sheenColorMap,this.sheenRoughness=source.sheenRoughness, +this.sheenRoughnessMap=source.sheenRoughnessMap,this.transmission=source.transmission, +this.transmissionMap=source.transmissionMap,this.thickness=source.thickness,this. +thicknessMap=source.thicknessMap,this.attenuationDistance=source.attenuationDistance, +this.attenuationColor.copy(source.attenuationColor),this.specularIntensity=source. +specularIntensity,this.specularIntensityMap=source.specularIntensityMap,this.specularColor. +copy(source.specularColor),this.specularColorMap=source.specularColorMap,this}}, +MeshPhongMaterial2=class extends Material2{static{__name(this,"MeshPhongMaterial")}constructor(parameters){ +super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Color2( +16777215),this.specular=new Color2(1118481),this.shininess=30,this.map=null,this. +lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this. +emissive=new Color2(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap= +null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap2, +this.normalScale=new Vector22(1,1),this.displacementMap=null,this.displacementScale= +1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null, +this.combine=MultiplyOperation2,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(parameters)}copy(source){ +return super.copy(source),this.color.copy(source.color),this.specular.copy(source. +specular),this.shininess=source.shininess,this.map=source.map,this.lightMap=source. +lightMap,this.lightMapIntensity=source.lightMapIntensity,this.aoMap=source.aoMap, +this.aoMapIntensity=source.aoMapIntensity,this.emissive.copy(source.emissive),this. +emissiveMap=source.emissiveMap,this.emissiveIntensity=source.emissiveIntensity,this. +bumpMap=source.bumpMap,this.bumpScale=source.bumpScale,this.normalMap=source.normalMap, +this.normalMapType=source.normalMapType,this.normalScale.copy(source.normalScale), +this.displacementMap=source.displacementMap,this.displacementScale=source.displacementScale, +this.displacementBias=source.displacementBias,this.specularMap=source.specularMap, +this.alphaMap=source.alphaMap,this.envMap=source.envMap,this.combine=source.combine, +this.reflectivity=source.reflectivity,this.refractionRatio=source.refractionRatio, +this.wireframe=source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth, +this.wireframeLinecap=source.wireframeLinecap,this.wireframeLinejoin=source.wireframeLinejoin, +this.flatShading=source.flatShading,this.fog=source.fog,this}};var MeshLambertMaterial=class extends Material2{static{__name(this,"MeshLambertM\ +aterial")}constructor(parameters){super(),this.isMeshLambertMaterial=!0,this.type= +"MeshLambertMaterial",this.color=new Color2(16777215),this.map=null,this.lightMap= +null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive= +new Color2(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this. +bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap2,this.normalScale= +new Vector22(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias= +0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=MultiplyOperation2, +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(parameters)}copy(source){return super.copy(source), +this.color.copy(source.color),this.map=source.map,this.lightMap=source.lightMap, +this.lightMapIntensity=source.lightMapIntensity,this.aoMap=source.aoMap,this.aoMapIntensity= +source.aoMapIntensity,this.emissive.copy(source.emissive),this.emissiveMap=source. +emissiveMap,this.emissiveIntensity=source.emissiveIntensity,this.bumpMap=source. +bumpMap,this.bumpScale=source.bumpScale,this.normalMap=source.normalMap,this.normalMapType= +source.normalMapType,this.normalScale.copy(source.normalScale),this.displacementMap= +source.displacementMap,this.displacementScale=source.displacementScale,this.displacementBias= +source.displacementBias,this.specularMap=source.specularMap,this.alphaMap=source. +alphaMap,this.envMap=source.envMap,this.combine=source.combine,this.reflectivity= +source.reflectivity,this.refractionRatio=source.refractionRatio,this.wireframe=source. +wireframe,this.wireframeLinewidth=source.wireframeLinewidth,this.wireframeLinecap= +source.wireframeLinecap,this.wireframeLinejoin=source.wireframeLinejoin,this.flatShading= +source.flatShading,this.fog=source.fog,this}};function convertArray(array,type,forceClone){return!array||!forceClone&&array.constructor=== +type?array:typeof type.BYTES_PER_ELEMENT=="number"?new type(array):Array.prototype. +slice.call(array)}__name(convertArray,"convertArray");function isTypedArray(object){ +return ArrayBuffer.isView(object)&&!(object instanceof DataView)}__name(isTypedArray, +"isTypedArray");function getKeyframeOrder(times){function compareTime(i2,j2){return times[i2]- +times[j2]}__name(compareTime,"compareTime");let n=times.length,result=new Array( +n);for(let i2=0;i2!==n;++i2)result[i2]=i2;return result.sort(compareTime),result} +__name(getKeyframeOrder,"getKeyframeOrder");function sortedArray(values,stride,order){ +let nValues=values.length,result=new values.constructor(nValues);for(let i2=0,dstOffset=0;dstOffset!== +nValues;++i2){let srcOffset=order[i2]*stride;for(let j2=0;j2!==stride;++j2)result[dstOffset++]= +values[srcOffset+j2]}return result}__name(sortedArray,"sortedArray");function flattenJSON(jsonKeys,times,values,valuePropertyName){ +let i2=1,key2=jsonKeys[0];for(;key2!==void 0&&key2[valuePropertyName]===void 0;) +key2=jsonKeys[i2++];if(key2===void 0)return;let value=key2[valuePropertyName];if(value!== +void 0)if(Array.isArray(value))do value=key2[valuePropertyName],value!==void 0&& +(times.push(key2.time),values.push.apply(values,value)),key2=jsonKeys[i2++];while(key2!== +void 0);else if(value.toArray!==void 0)do value=key2[valuePropertyName],value!== +void 0&&(times.push(key2.time),value.toArray(values,values.length)),key2=jsonKeys[i2++];while(key2!== +void 0);else do value=key2[valuePropertyName],value!==void 0&&(times.push(key2.time), +values.push(value)),key2=jsonKeys[i2++];while(key2!==void 0)}__name(flattenJSON, +"flattenJSON");var Interpolant=class{static{__name(this,"Interpolant")}constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){ +this.parameterPositions=parameterPositions,this._cachedIndex=0,this.resultBuffer= +resultBuffer!==void 0?resultBuffer:new sampleValues.constructor(sampleSize),this. +sampleValues=sampleValues,this.valueSize=sampleSize,this.settings=null,this.DefaultSettings_= +{}}evaluate(t){let pp=this.parameterPositions,i1=this._cachedIndex,t1=pp[i1],t0=pp[i1- +1];validate_interval:{seek:{let right;linear_scan:{forward_scan:if(!(t=t0)){let t1global=pp[1];t=t0)break seek} +right=i1,i1=0;break linear_scan}break validate_interval}for(;i1>>1;tendTime;)--to;if(++to,from!==0||to!==nKeys){ +from>=to&&(to=Math.max(to,1),from=to-1);let stride=this.getValueSize();this.times= +times.slice(from,to),this.values=this.values.slice(from*stride,to*stride)}return this}validate(){ +let valid=!0,valueSize=this.getValueSize();valueSize-Math.floor(valueSize)!==0&& +(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),valid=!1); +let times=this.times,values=this.values,nKeys=times.length;nKeys===0&&(console.error( +"THREE.KeyframeTrack: Track is empty.",this),valid=!1);let prevTime=null;for(let i2=0;i2!== +nKeys;i2++){let currTime=times[i2];if(typeof currTime=="number"&&isNaN(currTime)){ +console.error("THREE.KeyframeTrack: Time is not a valid number.",this,i2,currTime), +valid=!1;break}if(prevTime!==null&&prevTime>currTime){console.error("THREE.Keyfr\ +ameTrack: Out of order keys.",this,i2,currTime,prevTime),valid=!1;break}prevTime= +currTime}if(values!==void 0&&isTypedArray(values))for(let i2=0,n=values.length;i2!== +n;++i2){let value=values[i2];if(isNaN(value)){console.error("THREE.KeyframeTrack\ +: Value is not a valid number.",this,i2,value),valid=!1;break}}return valid}optimize(){ +let times=this.times.slice(),values=this.values.slice(),stride=this.getValueSize(), +smoothInterpolation=this.getInterpolation()===InterpolateSmooth,lastIndex=times. +length-1,writeIndex=1;for(let i2=1;i2 +0){times[writeIndex]=times[lastIndex];for(let readOffset=lastIndex*stride,writeOffset=writeIndex* +stride,j2=0;j2!==stride;++j2)values[writeOffset+j2]=values[readOffset+j2];++writeIndex} +return writeIndex!==times.length?(this.times=times.slice(0,writeIndex),this.values= +values.slice(0,writeIndex*stride)):(this.times=times,this.values=values),this}clone(){ +let times=this.times.slice(),values=this.values.slice(),TypedKeyframeTrack=this. +constructor,track=new TypedKeyframeTrack(this.name,times,values);return track.createInterpolant= +this.createInterpolant,track}};KeyframeTrack.prototype.TimeBufferType=Float32Array; +KeyframeTrack.prototype.ValueBufferType=Float32Array;KeyframeTrack.prototype.DefaultInterpolation= +InterpolateLinear;var BooleanKeyframeTrack=class extends KeyframeTrack{static{__name( +this,"BooleanKeyframeTrack")}};BooleanKeyframeTrack.prototype.ValueTypeName="boo\ +l";BooleanKeyframeTrack.prototype.ValueBufferType=Array;BooleanKeyframeTrack.prototype. +DefaultInterpolation=InterpolateDiscrete;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear= +void 0;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;var ColorKeyframeTrack=class extends KeyframeTrack{static{ +__name(this,"ColorKeyframeTrack")}};ColorKeyframeTrack.prototype.ValueTypeName="\ +color";var NumberKeyframeTrack=class extends KeyframeTrack{static{__name(this,"N\ +umberKeyframeTrack")}};NumberKeyframeTrack.prototype.ValueTypeName="number";var QuaternionLinearInterpolant=class extends Interpolant{static{ +__name(this,"QuaternionLinearInterpolant")}constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){ +super(parameterPositions,sampleValues,sampleSize,resultBuffer)}interpolate_(i1,t0,t,t1){ +let result=this.resultBuffer,values=this.sampleValues,stride=this.valueSize,alpha=(t- +t0)/(t1-t0),offset=i1*stride;for(let end=offset+stride;offset!==end;offset+=4)Quaternion2. +slerpFlat(result,0,values,offset-stride,values,offset,alpha);return result}},QuaternionKeyframeTrack=class extends KeyframeTrack{static{ +__name(this,"QuaternionKeyframeTrack")}InterpolantFactoryMethodLinear(result){return new QuaternionLinearInterpolant( +this.times,this.values,this.getValueSize(),result)}};QuaternionKeyframeTrack.prototype. +ValueTypeName="quaternion";QuaternionKeyframeTrack.prototype.DefaultInterpolation= +InterpolateLinear;QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth= +void 0;var StringKeyframeTrack=class extends KeyframeTrack{static{__name(this,"S\ +tringKeyframeTrack")}};StringKeyframeTrack.prototype.ValueTypeName="string";StringKeyframeTrack. +prototype.ValueBufferType=Array;StringKeyframeTrack.prototype.DefaultInterpolation= +InterpolateDiscrete;StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear= +void 0;StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;var VectorKeyframeTrack=class extends KeyframeTrack{static{ +__name(this,"VectorKeyframeTrack")}};VectorKeyframeTrack.prototype.ValueTypeName= +"vector";var AnimationClip=class{static{__name(this,"AnimationClip")}constructor(name2,duration=-1,tracks,blendMode=NormalAnimationBlendMode){ +this.name=name2,this.tracks=tracks,this.duration=duration,this.blendMode=blendMode, +this.uuid=generateUUID2(),this.duration<0&&this.resetDuration()}static parse(json){ +let tracks=[],jsonTracks=json.tracks,frameTime=1/(json.fps||1);for(let i2=0,n=jsonTracks. +length;i2!==n;++i2)tracks.push(parseKeyframeTrack(jsonTracks[i2]).scale(frameTime)); +let clip=new this(json.name,json.duration,tracks,json.blendMode);return clip.uuid= +json.uuid,clip}static toJSON(clip){let tracks=[],clipTracks=clip.tracks,json={name:clip. +name,duration:clip.duration,tracks,uuid:clip.uuid,blendMode:clip.blendMode};for(let i2=0, +n=clipTracks.length;i2!==n;++i2)tracks.push(KeyframeTrack.toJSON(clipTracks[i2])); +return json}static CreateFromMorphTargetSequence(name2,morphTargetSequence,fps,noLoop){ +let numMorphTargets=morphTargetSequence.length,tracks=[];for(let i2=0;i21){let name2=parts[1],animationMorphTargets=animationToMorphTargets[name2]; +animationMorphTargets||(animationToMorphTargets[name2]=animationMorphTargets=[]), +animationMorphTargets.push(morphTarget)}}let clips=[];for(let name2 in animationToMorphTargets) +clips.push(this.CreateFromMorphTargetSequence(name2,animationToMorphTargets[name2], +fps,noLoop));return clips}static parseAnimation(animation,bones){if(!animation)return console. +error("THREE.AnimationClip: No animation in JSONLoader data."),null;let addNonemptyTrack=__name( +function(trackType,trackName,animationKeys,propertyName,destTracks){if(animationKeys. +length!==0){let times=[],values=[];flattenJSON(animationKeys,times,values,propertyName), +times.length!==0&&destTracks.push(new trackType(trackName,times,values))}},"addN\ +onemptyTrack"),tracks=[],clipName=animation.name||"default",fps=animation.fps||30, +blendMode=animation.blendMode,duration=animation.length||-1,hierarchyTracks=animation. +hierarchy||[];for(let h=0;h{onLoad&&onLoad(cached),this.manager.itemEnd(url)}, +0),cached;if(loading[url]!==void 0){loading[url].push({onLoad,onProgress,onError}); +return}loading[url]=[],loading[url].push({onLoad,onProgress,onError});let req=new Request( +url,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"i\ +nclude":"same-origin"}),mimeType=this.mimeType,responseType=this.responseType;fetch( +req).then(response=>{if(response.status===200||response.status===0){if(response. +status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream> +"u"||response.body===void 0||response.body.getReader===void 0)return response;let callbacks=loading[url], +reader=response.body.getReader(),contentLength=response.headers.get("Content-Len\ +gth")||response.headers.get("X-File-Size"),total=contentLength?parseInt(contentLength): +0,lengthComputable=total!==0,loaded=0,stream=new ReadableStream({start(controller){ +readData();function readData(){reader.read().then(({done,value})=>{if(done)controller. +close();else{loaded+=value.byteLength;let event=new ProgressEvent("progress",{lengthComputable, +loaded,total});for(let i2=0,il=callbacks.length;i2{switch(responseType){case"arraybuffer":return response. +arrayBuffer();case"blob":return response.blob();case"document":return response.text(). +then(text=>new DOMParser().parseFromString(text,mimeType));case"json":return response. +json();default:if(mimeType===void 0)return response.text();{let exec=/charset="?([^;"\s]*)"?/i. +exec(mimeType),label=exec&&exec[1]?exec[1].toLowerCase():void 0,decoder=new TextDecoder( +label);return response.arrayBuffer().then(ab=>decoder.decode(ab))}}}).then(data=>{ +Cache.add(url,data);let callbacks=loading[url];delete loading[url];for(let i2=0, +il=callbacks.length;i2{let callbacks=loading[url];if(callbacks===void 0)throw this. +manager.itemError(url),err;delete loading[url];for(let i2=0,il=callbacks.length;i2< +il;i2++){let callback=callbacks[i2];callback.onError&&callback.onError(err)}this. +manager.itemError(url)}).finally(()=>{this.manager.itemEnd(url)}),this.manager.itemStart( +url)}setResponseType(value){return this.responseType=value,this}setMimeType(value){ +return this.mimeType=value,this}};var ImageLoader=class extends Loader{static{__name(this,"ImageLoader")}constructor(manager){ +super(manager)}load(url,onLoad,onProgress,onError){this.path!==void 0&&(url=this. +path+url),url=this.manager.resolveURL(url);let scope=this,cached=Cache.get(url); +if(cached!==void 0)return scope.manager.itemStart(url),setTimeout(function(){onLoad&& +onLoad(cached),scope.manager.itemEnd(url)},0),cached;let image=createElementNS2( +"img");function onImageLoad(){removeEventListeners(),Cache.add(url,this),onLoad&& +onLoad(this),scope.manager.itemEnd(url)}__name(onImageLoad,"onImageLoad");function onImageError(event){ +removeEventListeners(),onError&&onError(event),scope.manager.itemError(url),scope. +manager.itemEnd(url)}__name(onImageError,"onImageError");function removeEventListeners(){ +image.removeEventListener("load",onImageLoad,!1),image.removeEventListener("erro\ +r",onImageError,!1)}return __name(removeEventListeners,"removeEventListeners"),image. +addEventListener("load",onImageLoad,!1),image.addEventListener("error",onImageError, +!1),url.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(image.crossOrigin=this. +crossOrigin),scope.manager.itemStart(url),image.src=url,image}};var DataTextureLoader=class extends Loader{static{__name(this,"DataTextureLoader")}constructor(manager){ +super(manager)}load(url,onLoad,onProgress,onError){let scope=this,texture=new DataTexture, +loader=new FileLoader(this.manager);return loader.setResponseType("arraybuffer"), +loader.setRequestHeader(this.requestHeader),loader.setPath(this.path),loader.setWithCredentials( +scope.withCredentials),loader.load(url,function(buffer){let texData;try{texData= +scope.parse(buffer)}catch(error){if(onError!==void 0)onError(error);else{console. +error(error);return}}texData.image!==void 0?texture.image=texData.image:texData. +data!==void 0&&(texture.image.width=texData.width,texture.image.height=texData.height, +texture.image.data=texData.data),texture.wrapS=texData.wrapS!==void 0?texData.wrapS: +ClampToEdgeWrapping2,texture.wrapT=texData.wrapT!==void 0?texData.wrapT:ClampToEdgeWrapping2, +texture.magFilter=texData.magFilter!==void 0?texData.magFilter:LinearFilter2,texture. +minFilter=texData.minFilter!==void 0?texData.minFilter:LinearFilter2,texture.anisotropy= +texData.anisotropy!==void 0?texData.anisotropy:1,texData.colorSpace!==void 0?texture. +colorSpace=texData.colorSpace:texData.encoding!==void 0&&(texture.encoding=texData. +encoding),texData.flipY!==void 0&&(texture.flipY=texData.flipY),texData.format!== +void 0&&(texture.format=texData.format),texData.type!==void 0&&(texture.type=texData. +type),texData.mipmaps!==void 0&&(texture.mipmaps=texData.mipmaps,texture.minFilter= +LinearMipmapLinearFilter2),texData.mipmapCount===1&&(texture.minFilter=LinearFilter2), +texData.generateMipmaps!==void 0&&(texture.generateMipmaps=texData.generateMipmaps), +texture.needsUpdate=!0,onLoad&&onLoad(texture,texData)},onProgress,onError),texture}}, +TextureLoader=class extends Loader{static{__name(this,"TextureLoader")}constructor(manager){ +super(manager)}load(url,onLoad,onProgress,onError){let texture=new Texture,loader=new ImageLoader( +this.manager);return loader.setCrossOrigin(this.crossOrigin),loader.setPath(this. +path),loader.load(url,function(image){texture.image=image,texture.needsUpdate=!0, +onLoad!==void 0&&onLoad(texture)},onProgress,onError),texture}},Light=class extends Object3D2{static{ +__name(this,"Light")}constructor(color,intensity=1){super(),this.isLight=!0,this. +type="Light",this.color=new Color2(color),this.intensity=intensity}dispose(){}copy(source,recursive){ +return super.copy(source,recursive),this.color.copy(source.color),this.intensity= +source.intensity,this}toJSON(meta){let data=super.toJSON(meta);return data.object. +color=this.color.getHex(),data.object.intensity=this.intensity,this.groundColor!== +void 0&&(data.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&& +(data.object.distance=this.distance),this.angle!==void 0&&(data.object.angle=this. +angle),this.decay!==void 0&&(data.object.decay=this.decay),this.penumbra!==void 0&& +(data.object.penumbra=this.penumbra),this.shadow!==void 0&&(data.object.shadow=this. +shadow.toJSON()),data}};var _projScreenMatrix$1=new Matrix42,_lightPositionWorld$1=new Vector32,_lookTarget$1=new Vector32, +LightShadow=class{static{__name(this,"LightShadow")}constructor(camera){this.camera= +camera,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize= +new Vector22(512,512),this.map=null,this.mapPass=null,this.matrix=new Matrix42,this. +autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Frustum,this._frameExtents=new Vector22( +1,1),this._viewportCount=1,this._viewports=[new Vector4(0,0,1,1)]}getViewportCount(){ +return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(light){ +let shadowCamera=this.camera,shadowMatrix=this.matrix;_lightPositionWorld$1.setFromMatrixPosition( +light.matrixWorld),shadowCamera.position.copy(_lightPositionWorld$1),_lookTarget$1. +setFromMatrixPosition(light.target.matrixWorld),shadowCamera.lookAt(_lookTarget$1), +shadowCamera.updateMatrixWorld(),_projScreenMatrix$1.multiplyMatrices(shadowCamera. +projectionMatrix,shadowCamera.matrixWorldInverse),this._frustum.setFromProjectionMatrix( +_projScreenMatrix$1),shadowMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),shadowMatrix. +multiply(_projScreenMatrix$1)}getViewport(viewportIndex){return this._viewports[viewportIndex]}getFrameExtents(){ +return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this. +mapPass.dispose()}copy(source){return this.camera=source.camera.clone(),this.bias= +source.bias,this.radius=source.radius,this.mapSize.copy(source.mapSize),this}clone(){ +return new this.constructor().copy(this)}toJSON(){let object={};return this.bias!== +0&&(object.bias=this.bias),this.normalBias!==0&&(object.normalBias=this.normalBias), +this.radius!==1&&(object.radius=this.radius),(this.mapSize.x!==512||this.mapSize. +y!==512)&&(object.mapSize=this.mapSize.toArray()),object.camera=this.camera.toJSON( +!1).object,delete object.camera.matrix,object}},SpotLightShadow=class extends LightShadow{static{ +__name(this,"SpotLightShadow")}constructor(){super(new PerspectiveCamera(50,1,.5, +500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(light){let camera=this. +camera,fov3=RAD2DEG2*2*light.angle*this.focus,aspect3=this.mapSize.width/this.mapSize. +height,far=light.distance||camera.far;(fov3!==camera.fov||aspect3!==camera.aspect|| +far!==camera.far)&&(camera.fov=fov3,camera.aspect=aspect3,camera.far=far,camera. +updateProjectionMatrix()),super.updateMatrices(light)}copy(source){return super. +copy(source),this.focus=source.focus,this}},SpotLight=class extends Light{static{ +__name(this,"SpotLight")}constructor(color,intensity,distance=0,angle=Math.PI/3,penumbra=0,decay=2){ +super(color,intensity),this.isSpotLight=!0,this.type="SpotLight",this.position.copy( +Object3D2.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D2,this.distance= +distance,this.angle=angle,this.penumbra=penumbra,this.decay=decay,this.map=null, +this.shadow=new SpotLightShadow}get power(){return this.intensity*Math.PI}set power(power){ +this.intensity=power/Math.PI}dispose(){this.shadow.dispose()}copy(source,recursive){ +return super.copy(source,recursive),this.distance=source.distance,this.angle=source. +angle,this.penumbra=source.penumbra,this.decay=source.decay,this.target=source.target. +clone(),this.shadow=source.shadow.clone(),this}},_projScreenMatrix=new Matrix42, +_lightPositionWorld=new Vector32,_lookTarget=new Vector32,PointLightShadow=class extends LightShadow{static{ +__name(this,"PointLightShadow")}constructor(){super(new PerspectiveCamera(90,1,.5, +500)),this.isPointLightShadow=!0,this._frameExtents=new Vector22(4,2),this._viewportCount= +6,this._viewports=[new Vector4(2,1,1,1),new Vector4(0,1,1,1),new Vector4(3,1,1,1), +new Vector4(1,1,1,1),new Vector4(3,0,1,1),new Vector4(1,0,1,1)],this._cubeDirections= +[new Vector32(1,0,0),new Vector32(-1,0,0),new Vector32(0,0,1),new Vector32(0,0,-1), +new Vector32(0,1,0),new Vector32(0,-1,0)],this._cubeUps=[new Vector32(0,1,0),new Vector32( +0,1,0),new Vector32(0,1,0),new Vector32(0,1,0),new Vector32(0,0,1),new Vector32( +0,0,-1)]}updateMatrices(light,viewportIndex=0){let camera=this.camera,shadowMatrix=this. +matrix,far=light.distance||camera.far;far!==camera.far&&(camera.far=far,camera.updateProjectionMatrix()), +_lightPositionWorld.setFromMatrixPosition(light.matrixWorld),camera.position.copy( +_lightPositionWorld),_lookTarget.copy(camera.position),_lookTarget.add(this._cubeDirections[viewportIndex]), +camera.up.copy(this._cubeUps[viewportIndex]),camera.lookAt(_lookTarget),camera.updateMatrixWorld(), +shadowMatrix.makeTranslation(-_lightPositionWorld.x,-_lightPositionWorld.y,-_lightPositionWorld. +z),_projScreenMatrix.multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse), +this._frustum.setFromProjectionMatrix(_projScreenMatrix)}},PointLight=class extends Light{static{ +__name(this,"PointLight")}constructor(color,intensity,distance=0,decay=2){super( +color,intensity),this.isPointLight=!0,this.type="PointLight",this.distance=distance, +this.decay=decay,this.shadow=new PointLightShadow}get power(){return this.intensity* +4*Math.PI}set power(power){this.intensity=power/(4*Math.PI)}dispose(){this.shadow. +dispose()}copy(source,recursive){return super.copy(source,recursive),this.distance= +source.distance,this.decay=source.decay,this.shadow=source.shadow.clone(),this}}, +DirectionalLightShadow=class extends LightShadow{static{__name(this,"Directional\ +LightShadow")}constructor(){super(new OrthographicCamera(-5,5,5,-5,.5,500)),this. +isDirectionalLightShadow=!0}},DirectionalLight=class extends Light{static{__name( +this,"DirectionalLight")}constructor(color,intensity){super(color,intensity),this. +isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D2. +DEFAULT_UP),this.updateMatrix(),this.target=new Object3D2,this.shadow=new DirectionalLightShadow}dispose(){ +this.shadow.dispose()}copy(source){return super.copy(source),this.target=source. +target.clone(),this.shadow=source.shadow.clone(),this}},AmbientLight=class extends Light{static{ +__name(this,"AmbientLight")}constructor(color,intensity){super(color,intensity), +this.isAmbientLight=!0,this.type="AmbientLight"}};var LoaderUtils=class{static{__name(this,"LoaderUtils")}static decodeText(array){ +if(typeof TextDecoder<"u")return new TextDecoder().decode(array);let s="";for(let i2=0, +il=array.length;i2"u"&&console. +warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch> +"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options= +{premultiplyAlpha:"none"}}setOptions(options){return this.options=options,this}load(url,onLoad,onProgress,onError){ +url===void 0&&(url=""),this.path!==void 0&&(url=this.path+url),url=this.manager. +resolveURL(url);let scope=this,cached=Cache.get(url);if(cached!==void 0){if(scope. +manager.itemStart(url),cached.then){cached.then(imageBitmap=>{onLoad&&onLoad(imageBitmap), +scope.manager.itemEnd(url)}).catch(e=>{onError&&onError(e)});return}return setTimeout( +function(){onLoad&&onLoad(cached),scope.manager.itemEnd(url)},0),cached}let fetchOptions={}; +fetchOptions.credentials=this.crossOrigin==="anonymous"?"same-origin":"include", +fetchOptions.headers=this.requestHeader;let promise=fetch(url,fetchOptions).then( +function(res){return res.blob()}).then(function(blob){return createImageBitmap(blob, +Object.assign(scope.options,{colorSpaceConversion:"none"}))}).then(function(imageBitmap){ +return Cache.add(url,imageBitmap),onLoad&&onLoad(imageBitmap),scope.manager.itemEnd( +url),imageBitmap}).catch(function(e){onError&&onError(e),Cache.remove(url),scope. +manager.itemError(url),scope.manager.itemEnd(url)});Cache.add(url,promise),scope. +manager.itemStart(url)}};var _RESERVED_CHARS_RE="\\[\\]\\.:\\/",_reservedRe=new RegExp("["+_RESERVED_CHARS_RE+ +"]","g"),_wordChar="[^"+_RESERVED_CHARS_RE+"]",_wordCharOrDot="[^"+_RESERVED_CHARS_RE. +replace("\\.","")+"]",_directoryRe=/((?:WC+[\/:])*)/.source.replace("WC",_wordChar), +_nodeRe=/(WCOD+)?/.source.replace("WCOD",_wordCharOrDot),_objectRe=/(?:\.(WC+)(?:\[(.+)\])?)?/. +source.replace("WC",_wordChar),_propertyRe=/\.(WC+)(?:\[(.+)\])?/.source.replace( +"WC",_wordChar),_trackRe=new RegExp("^"+_directoryRe+_nodeRe+_objectRe+_propertyRe+ +"$"),_supportedObjectNames=["material","materials","bones","map"],Composite=class{static{ +__name(this,"Composite")}constructor(targetGroup,path,optionalParsedPath){let parsedPath=optionalParsedPath|| +PropertyBinding.parseTrackName(path);this._targetGroup=targetGroup,this._bindings= +targetGroup.subscribe_(path,parsedPath)}getValue(array,offset){this.bind();let firstValidIndex=this. +_targetGroup.nCachedObjects_,binding=this._bindings[firstValidIndex];binding!==void 0&& +binding.getValue(array,offset)}setValue(array,offset){let bindings=this._bindings; +for(let i2=this._targetGroup.nCachedObjects_,n=bindings.length;i2!==n;++i2)bindings[i2]. +setValue(array,offset)}bind(){let bindings=this._bindings;for(let i2=this._targetGroup. +nCachedObjects_,n=bindings.length;i2!==n;++i2)bindings[i2].bind()}unbind(){let bindings=this. +_bindings;for(let i2=this._targetGroup.nCachedObjects_,n=bindings.length;i2!==n;++i2) +bindings[i2].unbind()}},PropertyBinding=class _PropertyBinding{static{__name(this, +"PropertyBinding")}constructor(rootNode,path,parsedPath){this.path=path,this.parsedPath= +parsedPath||_PropertyBinding.parseTrackName(path),this.node=_PropertyBinding.findNode( +rootNode,this.parsedPath.nodeName),this.rootNode=rootNode,this.getValue=this._getValue_unbound, +this.setValue=this._setValue_unbound}static create(root,path,parsedPath){return root&& +root.isAnimationObjectGroup?new _PropertyBinding.Composite(root,path,parsedPath): +new _PropertyBinding(root,path,parsedPath)}static sanitizeNodeName(name2){return name2. +replace(/\s/g,"_").replace(_reservedRe,"")}static parseTrackName(trackName){let matches=_trackRe. +exec(trackName);if(matches===null)throw new Error("PropertyBinding: Cannot parse\ + trackName: "+trackName);let results={nodeName:matches[2],objectName:matches[3], +objectIndex:matches[4],propertyName:matches[5],propertyIndex:matches[6]},lastDot=results. +nodeName&&results.nodeName.lastIndexOf(".");if(lastDot!==void 0&&lastDot!==-1){let objectName=results. +nodeName.substring(lastDot+1);_supportedObjectNames.indexOf(objectName)!==-1&&(results. +nodeName=results.nodeName.substring(0,lastDot),results.objectName=objectName)}if(results. +propertyName===null||results.propertyName.length===0)throw new Error("PropertyBi\ +nding: can not parse propertyName from trackName: "+trackName);return results}static findNode(root,nodeName){ +if(nodeName===void 0||nodeName===""||nodeName==="."||nodeName===-1||nodeName===root. +name||nodeName===root.uuid)return root;if(root.skeleton){let bone=root.skeleton. +getBoneByName(nodeName);if(bone!==void 0)return bone}if(root.children){let searchNodeSubtree=__name( +function(children2){for(let i2=0;i2property.name);function findAttrName(names){for(let i2=0,l=names.length;i2< +l;i2++){let name2=names[i2];if(elementNames.includes(name2))return name2}return null} +return __name(findAttrName,"findAttrName"),{attrX:findAttrName(["x","px","posx"])|| +"x",attrY:findAttrName(["y","py","posy"])||"y",attrZ:findAttrName(["z","pz","pos\ +z"])||"z",attrNX:findAttrName(["nx","normalx"]),attrNY:findAttrName(["ny","norma\ +ly"]),attrNZ:findAttrName(["nz","normalz"]),attrS:findAttrName(["s","u","texture\ +_u","tx"]),attrT:findAttrName(["t","v","texture_v","ty"]),attrR:findAttrName(["r\ +ed","diffuse_red","r","diffuse_r"]),attrG:findAttrName(["green","diffuse_green", +"g","diffuse_g"]),attrB:findAttrName(["blue","diffuse_blue","b","diffuse_b"])}}__name( +mapElementAttributes,"mapElementAttributes");function parseASCII(data2,header){let buffer=createBuffer(), +patternBody=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,body,matches;(matches=patternBody. +exec(data2))!==null?body=matches[1].split(/\s+/):body=[];let tokens=new ArrayStream( +body);loop:for(let i2=0;i20&&geometry2.setIndex(buffer.indices),geometry2.setAttribute( +"position",new Float32BufferAttribute2(buffer.vertices,3)),buffer.normals.length> +0&&geometry2.setAttribute("normal",new Float32BufferAttribute2(buffer.normals,3)), +buffer.uvs.length>0&&geometry2.setAttribute("uv",new Float32BufferAttribute2(buffer. +uvs,2)),buffer.colors.length>0&&geometry2.setAttribute("color",new Float32BufferAttribute2( +buffer.colors,3)),(buffer.faceVertexUvs.length>0||buffer.faceVertexColors.length> +0)&&(geometry2=geometry2.toNonIndexed(),buffer.faceVertexUvs.length>0&&geometry2. +setAttribute("uv",new Float32BufferAttribute2(buffer.faceVertexUvs,2)),buffer.faceVertexColors. +length>0&&geometry2.setAttribute("color",new Float32BufferAttribute2(buffer.faceVertexColors, +3)));for(let customProperty of Object.keys(scope.customPropertyMapping))buffer[customProperty]. +length>0&&geometry2.setAttribute(customProperty,new Float32BufferAttribute2(buffer[customProperty], +scope.customPropertyMapping[customProperty].length));return geometry2.computeBoundingSphere(), +geometry2}__name(postProcess,"postProcess");function handleElement(buffer,elementName,element2,cacheEntry){ +if(elementName==="vertex"){buffer.vertices.push(element2[cacheEntry.attrX],element2[cacheEntry. +attrY],element2[cacheEntry.attrZ]),cacheEntry.attrNX!==null&&cacheEntry.attrNY!== +null&&cacheEntry.attrNZ!==null&&buffer.normals.push(element2[cacheEntry.attrNX], +element2[cacheEntry.attrNY],element2[cacheEntry.attrNZ]),cacheEntry.attrS!==null&& +cacheEntry.attrT!==null&&buffer.uvs.push(element2[cacheEntry.attrS],element2[cacheEntry. +attrT]),cacheEntry.attrR!==null&&cacheEntry.attrG!==null&&cacheEntry.attrB!==null&& +(_color4.setRGB(element2[cacheEntry.attrR]/255,element2[cacheEntry.attrG]/255,element2[cacheEntry. +attrB]/255).convertSRGBToLinear(),buffer.colors.push(_color4.r,_color4.g,_color4. +b));for(let customProperty of Object.keys(scope.customPropertyMapping))for(let elementProperty of scope. +customPropertyMapping[customProperty])buffer[customProperty].push(element2[elementProperty])}else if(elementName=== +"face"){let vertex_indices=element2.vertex_indices||element2.vertex_index,texcoord=element2. +texcoord;vertex_indices.length===3?(buffer.indices.push(vertex_indices[0],vertex_indices[1], +vertex_indices[2]),texcoord&&texcoord.length===6&&(buffer.faceVertexUvs.push(texcoord[0], +texcoord[1]),buffer.faceVertexUvs.push(texcoord[2],texcoord[3]),buffer.faceVertexUvs. +push(texcoord[4],texcoord[5]))):vertex_indices.length===4&&(buffer.indices.push( +vertex_indices[0],vertex_indices[1],vertex_indices[3]),buffer.indices.push(vertex_indices[1], +vertex_indices[2],vertex_indices[3])),cacheEntry.attrR!==null&&cacheEntry.attrG!== +null&&cacheEntry.attrB!==null&&(_color4.setRGB(element2[cacheEntry.attrR]/255,element2[cacheEntry. +attrG]/255,element2[cacheEntry.attrB]/255).convertSRGBToLinear(),buffer.faceVertexColors. +push(_color4.r,_color4.g,_color4.b),buffer.faceVertexColors.push(_color4.r,_color4. +g,_color4.b),buffer.faceVertexColors.push(_color4.r,_color4.g,_color4.b))}}__name( +handleElement,"handleElement");function binaryReadElement(at,properties){let element2={}, +read=0;for(let i2=0;i2dataview.getInt8(at),size:1};case"uint8":case"uchar":return{ +read:at=>dataview.getUint8(at),size:1};case"int16":case"short":return{read:at=>dataview. +getInt16(at,little_endian2),size:2};case"uint16":case"ushort":return{read:at=>dataview. +getUint16(at,little_endian2),size:2};case"int32":case"int":return{read:at=>dataview. +getInt32(at,little_endian2),size:4};case"uint32":case"uint":return{read:at=>dataview. +getUint32(at,little_endian2),size:4};case"float32":case"float":return{read:at=>dataview. +getFloat32(at,little_endian2),size:4};case"float64":case"double":return{read:at=>dataview. +getFloat64(at,little_endian2),size:8}}}__name(getBinaryReader,"getBinaryReader"); +for(let i2=0,l=properties.length;i2=this.arr. +length}next(){return this.arr[this.i++]}};var EventTypes=class{static{__name(this,"EventTypes")}MODEL_LOAD;MODEL_ERROR;PROGRESS;constructor(MODEL_LOAD,MODEL_ERROR,PROGRESS){ +this.MODEL_LOAD=MODEL_LOAD,this.MODEL_ERROR=MODEL_ERROR,this.PROGRESS=PROGRESS}}, +Events=makeEnumFromClassProperties(EventTypes);function makeEnumFromClassProperties(Class2){ +let Enum={};for(let key2 in new Class2)Enum[key2]=key2;return Object.freeze(Enum)} +__name(makeEnumFromClassProperties,"makeEnumFromClassProperties");var __esDecorate15=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers15=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=GeometryBehavior,_instanceExtraInitializers=[], +_src_decorators,_src_initializers=[],_model_decorators,_model_initializers=[];var PlyGeometryBehavior2=class extends _classSuper{static{ +__name(this,"PlyGeometryBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_src_decorators=[stringAttribute,receiver],_model_decorators=[signal],__esDecorate15( +null,null,_src_decorators,{kind:"field",name:"src",static:!1,private:!1,access:{ +has:obj=>"src"in obj,get:obj=>obj.src,set:(obj,value)=>{obj.src=value}},metadata:_metadata}, +_src_initializers,_instanceExtraInitializers),__esDecorate15(null,null,_model_decorators, +{kind:"field",name:"model",static:!1,private:!1,access:{has:obj=>"model"in obj,get:obj=>obj. +model,set:(obj,value)=>{obj.model=value}},metadata:_metadata},_model_initializers, +_instanceExtraInitializers),__esDecorate15(null,_classDescriptor={value:_classThis}, +_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers), +PlyGeometryBehavior2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty( +_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}), +__runInitializers15(_classThis,_classExtraInitializers)}src=(__runInitializers15( +this,_instanceExtraInitializers),__runInitializers15(this,_src_initializers,""));loader=new PLYLoader;model=__runInitializers15( +this,_model_initializers,null);_createComponent(){return this.model?this.model:new BufferGeometry}#version=0;connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{this.src,this.#loadModel(),onCleanup( +()=>{this.model?.dispose(),this.model=null,this.#version++})})}#loadModel(){let{ +src}=this,version3=this.#version;src&&this.loader.load(src,model=>version3===this.#version&& +this.#setModel(model),progress=>version3===this.#version&&this.element.emit(Events. +PROGRESS,progress),error=>version3===this.#version&&this.#onError(error))}#onError(error){ +let message=`Failed to load ${this.element.tagName.toLowerCase()} with src "${this. +src}". See the following error.`;console.warn(message);let err=error instanceof ErrorEvent&& +error.error?error.error:error;console.error(err),this.element.emit(Events.MODEL_ERROR, +err)}#setModel(model){model.computeVertexNormals(),this.model=model,this.element. +emit(Events.MODEL_LOAD,{format:"ply",model})}};return PlyGeometryBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("ply-geometry")&&elementBehaviors. +define("ply-geometry",PlyGeometryBehavior);var Curve2=class{static{__name(this,"Curve")}constructor(){this.type="Curve",this. +arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() \ +not implemented."),null}getPointAt(u2,optionalTarget){let t=this.getUtoTmapping( +u2);return this.getPoint(t,optionalTarget)}getPoints(divisions=5){let points=[]; +for(let d2=0;d2<=divisions;d2++)points.push(this.getPoint(d2/divisions));return points}getSpacedPoints(divisions=5){ +let points=[];for(let d2=0;d2<=divisions;d2++)points.push(this.getPointAt(d2/divisions)); +return points}getLength(){let lengths=this.getLengths();return lengths[lengths.length- +1]}getLengths(divisions=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths. +length===divisions+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate= +!1;let cache2=[],current,last=this.getPoint(0),sum=0;cache2.push(0);for(let p2=1;p2<= +divisions;p2++)current=this.getPoint(p2/divisions),sum+=current.distanceTo(last), +cache2.push(sum),last=current;return this.cacheArcLengths=cache2,cache2}updateArcLengths(){ +this.needsUpdate=!0,this.getLengths()}getUtoTmapping(u2,distance){let arcLengths=this. +getLengths(),i2=0,il=arcLengths.length,targetArcLength;distance?targetArcLength= +distance:targetArcLength=u2*arcLengths[il-1];let low=0,high=il-1,comparison;for(;low<= +high;)if(i2=Math.floor(low+(high-low)/2),comparison=arcLengths[i2]-targetArcLength, +comparison<0)low=i2+1;else if(comparison>0)high=i2-1;else{high=i2;break}if(i2=high, +arcLengths[i2]===targetArcLength)return i2/(il-1);let lengthBefore=arcLengths[i2], +segmentLength=arcLengths[i2+1]-lengthBefore,segmentFraction=(targetArcLength-lengthBefore)/ +segmentLength;return(i2+segmentFraction)/(il-1)}getTangent(t,optionalTarget){let t1=t- +1e-4,t2=t+1e-4;t1<0&&(t1=0),t2>1&&(t2=1);let pt1=this.getPoint(t1),pt2=this.getPoint( +t2),tangent=optionalTarget||(pt1.isVector2?new Vector2:new Vector3);return tangent. +copy(pt2).sub(pt1).normalize(),tangent}getTangentAt(u2,optionalTarget){let t=this. +getUtoTmapping(u2);return this.getTangent(t,optionalTarget)}computeFrenetFrames(segments,closed){ +let normal=new Vector3,tangents=[],normals=[],binormals=[],vec=new Vector3,mat=new Matrix4; +for(let i2=0;i2<=segments;i2++){let u2=i2/segments;tangents[i2]=this.getTangentAt( +u2,new Vector3)}normals[0]=new Vector3,binormals[0]=new Vector3;let min=Number.MAX_VALUE, +tx=Math.abs(tangents[0].x),ty=Math.abs(tangents[0].y),tz=Math.abs(tangents[0].z); +tx<=min&&(min=tx,normal.set(1,0,0)),ty<=min&&(min=ty,normal.set(0,1,0)),tz<=min&& +normal.set(0,0,1),vec.crossVectors(tangents[0],normal).normalize(),normals[0].crossVectors( +tangents[0],vec),binormals[0].crossVectors(tangents[0],normals[0]);for(let i2=1;i2<= +segments;i2++){if(normals[i2]=normals[i2-1].clone(),binormals[i2]=binormals[i2-1]. +clone(),vec.crossVectors(tangents[i2-1],tangents[i2]),vec.length()>Number.EPSILON){ +vec.normalize();let theta=Math.acos(clamp(tangents[i2-1].dot(tangents[i2]),-1,1)); +normals[i2].applyMatrix4(mat.makeRotationAxis(vec,theta))}binormals[i2].crossVectors( +tangents[i2],normals[i2])}if(closed===!0){let theta=Math.acos(clamp(normals[0].dot( +normals[segments]),-1,1));theta/=segments,tangents[0].dot(vec.crossVectors(normals[0], +normals[segments]))>0&&(theta=-theta);for(let i2=1;i2<=segments;i2++)normals[i2]. +applyMatrix4(mat.makeRotationAxis(tangents[i2],theta*i2)),binormals[i2].crossVectors( +tangents[i2],normals[i2])}return{tangents,normals,binormals}}clone(){return new this. +constructor().copy(this)}copy(source){return this.arcLengthDivisions=source.arcLengthDivisions, +this}toJSON(){let data={metadata:{version:4.6,type:"Curve",generator:"Curve.toJS\ +ON"}};return data.arcLengthDivisions=this.arcLengthDivisions,data.type=this.type, +data}fromJSON(json){return this.arcLengthDivisions=json.arcLengthDivisions,this}};var Curves_exports={};__export(Curves_exports,{ArcCurve:()=>ArcCurve,CatmullRomCurve3:()=>CatmullRomCurve3, +CubicBezierCurve:()=>CubicBezierCurve,CubicBezierCurve3:()=>CubicBezierCurve3,EllipseCurve:()=>EllipseCurve, +LineCurve:()=>LineCurve,LineCurve3:()=>LineCurve3,QuadraticBezierCurve:()=>QuadraticBezierCurve, +QuadraticBezierCurve3:()=>QuadraticBezierCurve3,SplineCurve:()=>SplineCurve});var EllipseCurve=class extends Curve2{static{__name(this,"EllipseCurve")}constructor(aX=0,aY=0,xRadius=1,yRadius=1,aStartAngle=0,aEndAngle=Math. +PI*2,aClockwise=!1,aRotation=0){super(),this.isEllipseCurve=!0,this.type="Ellips\ +eCurve",this.aX=aX,this.aY=aY,this.xRadius=xRadius,this.yRadius=yRadius,this.aStartAngle= +aStartAngle,this.aEndAngle=aEndAngle,this.aClockwise=aClockwise,this.aRotation=aRotation}getPoint(t,optionalTarget){ +let point=optionalTarget||new Vector2,twoPi=Math.PI*2,deltaAngle=this.aEndAngle- +this.aStartAngle,samePoints=Math.abs(deltaAngle)twoPi;)deltaAngle-=twoPi;deltaAngle0?0:(Math.floor(Math.abs(intPoint)/l)+1)* +l:weight===0&&intPoint===l-1&&(intPoint=l-2,weight=1);let p0,p3;this.closed||intPoint> +0?p0=points[(intPoint-1)%l]:(tmp.subVectors(points[0],points[1]).add(points[0]), +p0=tmp);let p1=points[intPoint%l],p22=points[(intPoint+1)%l];if(this.closed||intPoint+ +2points.length-2?points.length-1:intPoint+1],p3=points[intPoint> +points.length-3?points.length-1:intPoint+2];return point.set(CatmullRom(weight,p0. +x,p1.x,p22.x,p3.x),CatmullRom(weight,p0.y,p1.y,p22.y,p3.y)),point}copy(source){super. +copy(source),this.points=[];for(let i2=0,l=source.points.length;i2= +d2){let diff=curveLengths[i2]-d2,curve=this.curves[i2],segmentLength=curve.getLength(), +u2=segmentLength===0?0:1-diff/segmentLength;return curve.getPointAt(u2,optionalTarget)} +i2++}return null}getLength(){let lens=this.getCurveLengths();return lens[lens.length- +1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){ +if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this. +cacheLengths;let lengths=[],sums=0;for(let i2=0,l=this.curves.length;i21&&!points[points.length-1].equals(points[0])&&points.push( +points[0]),points}copy(source){super.copy(source),this.curves=[];for(let i2=0,l=source. +curves.length;i20){let firstPoint=curve.getPoint(0);firstPoint. +equals(this.currentPoint)||this.lineTo(firstPoint.x,firstPoint.y)}this.curves.push( +curve);let lastPoint=curve.getPoint(1);return this.currentPoint.copy(lastPoint), +this}copy(source){return super.copy(source),this.currentPoint.copy(source.currentPoint), +this}toJSON(){let data=super.toJSON();return data.currentPoint=this.currentPoint. +toArray(),data}fromJSON(json){return super.fromJSON(json),this.currentPoint.fromArray( +json.currentPoint),this}};var Shape=class extends Path{static{__name(this,"Shape")}constructor(points){super( +points),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(divisions){ +let holesPts=[];for(let i2=0,l=this.holes.length;i280*dim){minX=maxX=data[0],minY=maxY= +data[1];for(let i2=dim;i2maxX&&(maxX=x2),y2>maxY&&(maxY=y2);invSize=Math.max(maxX- +minX,maxY-minY),invSize=invSize!==0?32767/invSize:0}return earcutLinked2(outerNode, +triangles,dim,minX,minY,invSize,0),triangles}};function linkedList2(data,start,end,dim,clockwise){ +let i2,last;if(clockwise===signedArea2(data,start,end,dim)>0)for(i2=start;i2=start;i2-= +dim)last=insertNode2(i2,data[i2],data[i2+1],last);return last&&equals2(last,last. +next)&&(removeNode2(last),last=last.next),last}__name(linkedList2,"linkedList"); +function filterPoints2(start,end){if(!start)return start;end||(end=start);let p2=start, +again;do if(again=!1,!p2.steiner&&(equals2(p2,p2.next)||area2(p2.prev,p2,p2.next)=== +0)){if(removeNode2(p2),p2=end=p2.prev,p2===p2.next)break;again=!0}else p2=p2.next;while(again|| +p2!==end);return end}__name(filterPoints2,"filterPoints");function earcutLinked2(ear,triangles,dim,minX,minY,invSize,pass){ +if(!ear)return;!pass&&invSize&&indexCurve2(ear,minX,minY,invSize);let stop=ear,prev, +next;for(;ear.prev!==ear.next;){if(prev=ear.prev,next=ear.next,invSize?isEarHashed2( +ear,minX,minY,invSize):isEar2(ear)){triangles.push(prev.i/dim|0),triangles.push( +ear.i/dim|0),triangles.push(next.i/dim|0),removeNode2(ear),ear=next.next,stop=next. +next;continue}if(ear=next,ear===stop){pass?pass===1?(ear=cureLocalIntersections2( +filterPoints2(ear),triangles,dim),earcutLinked2(ear,triangles,dim,minX,minY,invSize, +2)):pass===2&&splitEarcut2(ear,triangles,dim,minX,minY,invSize):earcutLinked2(filterPoints2( +ear),triangles,dim,minX,minY,invSize,1);break}}}__name(earcutLinked2,"earcutLink\ +ed");function isEar2(ear){let a=ear.prev,b=ear,c3=ear.next;if(area2(a,b,c3)>=0)return!1; +let ax=a.x,bx=b.x,cx=c3.x,ay=a.y,by=b.y,cy=c3.y,x0=axbx?ax>cx?ax:cx:bx>cx?bx:cx,y1=ay>by?ay>cy? +ay:cy:by>cy?by:cy,p2=c3.next;for(;p2!==a;){if(p2.x>=x0&&p2.x<=x1&&p2.y>=y0&&p2.y<= +y1&&pointInTriangle2(ax,ay,bx,by,cx,cy,p2.x,p2.y)&&area2(p2.prev,p2,p2.next)>=0) +return!1;p2=p2.next}return!0}__name(isEar2,"isEar");function isEarHashed2(ear,minX,minY,invSize){ +let a=ear.prev,b=ear,c3=ear.next;if(area2(a,b,c3)>=0)return!1;let ax=a.x,bx=b.x, +cx=c3.x,ay=a.y,by=b.y,cy=c3.y,x0=axbx?ax>cx?ax:cx:bx>cx?bx:cx,y1=ay>by?ay>cy?ay:cy:by>cy?by:cy, +minZ=zOrder2(x0,y0,minX,minY,invSize),maxZ=zOrder2(x1,y1,minX,minY,invSize),p2=ear. +prevZ,n=ear.nextZ;for(;p2&&p2.z>=minZ&&n&&n.z<=maxZ;){if(p2.x>=x0&&p2.x<=x1&&p2. +y>=y0&&p2.y<=y1&&p2!==a&&p2!==c3&&pointInTriangle2(ax,ay,bx,by,cx,cy,p2.x,p2.y)&& +area2(p2.prev,p2,p2.next)>=0||(p2=p2.prevZ,n.x>=x0&&n.x<=x1&&n.y>=y0&&n.y<=y1&&n!== +a&&n!==c3&&pointInTriangle2(ax,ay,bx,by,cx,cy,n.x,n.y)&&area2(n.prev,n,n.next)>= +0))return!1;n=n.nextZ}for(;p2&&p2.z>=minZ;){if(p2.x>=x0&&p2.x<=x1&&p2.y>=y0&&p2. +y<=y1&&p2!==a&&p2!==c3&&pointInTriangle2(ax,ay,bx,by,cx,cy,p2.x,p2.y)&&area2(p2. +prev,p2,p2.next)>=0)return!1;p2=p2.prevZ}for(;n&&n.z<=maxZ;){if(n.x>=x0&&n.x<=x1&& +n.y>=y0&&n.y<=y1&&n!==a&&n!==c3&&pointInTriangle2(ax,ay,bx,by,cx,cy,n.x,n.y)&&area2( +n.prev,n,n.next)>=0)return!1;n=n.nextZ}return!0}__name(isEarHashed2,"isEarHashed"); +function cureLocalIntersections2(start,triangles,dim){let p2=start;do{let a=p2.prev, +b=p2.next.next;!equals2(a,b)&&intersects2(a,p2,p2.next,b)&&locallyInside2(a,b)&& +locallyInside2(b,a)&&(triangles.push(a.i/dim|0),triangles.push(p2.i/dim|0),triangles. +push(b.i/dim|0),removeNode2(p2),removeNode2(p2.next),p2=start=b),p2=p2.next}while(p2!== +start);return filterPoints2(p2)}__name(cureLocalIntersections2,"cureLocalInterse\ +ctions");function splitEarcut2(start,triangles,dim,minX,minY,invSize){let a=start; +do{let b=a.next.next;for(;b!==a.prev;){if(a.i!==b.i&&isValidDiagonal2(a,b)){let c3=splitPolygon2( +a,b);a=filterPoints2(a,a.next),c3=filterPoints2(c3,c3.next),earcutLinked2(a,triangles, +dim,minX,minY,invSize,0),earcutLinked2(c3,triangles,dim,minX,minY,invSize,0);return} +b=b.next}a=a.next}while(a!==start)}__name(splitEarcut2,"splitEarcut");function eliminateHoles2(data,holeIndices,outerNode,dim){ +let queue=[],i2,len,start,end,list;for(i2=0,len=holeIndices.length;i2=p2.next.y&&p2. +next.y!==p2.y){let x2=p2.x+(hy-p2.y)*(p2.next.x-p2.x)/(p2.next.y-p2.y);if(x2<=hx&& +x2>qx&&(qx=x2,m=p2.x= +p2.x&&p2.x>=mx&&hx!==p2.x&&pointInTriangle2(hym.x||p2.x===m.x&§orContainsSector2(m,p2)))&&(m=p2,tanMin= +tan)),p2=p2.next;while(p2!==stop);return m}__name(findHoleBridge2,"findHoleBridg\ +e");function sectorContainsSector2(m,p2){return area2(m.prev,m,p2.prev)<0&&area2( +p2.next,m,m.next)<0}__name(sectorContainsSector2,"sectorContainsSector");function indexCurve2(start,minX,minY,invSize){ +let p2=start;do p2.z===0&&(p2.z=zOrder2(p2.x,p2.y,minX,minY,invSize)),p2.prevZ=p2. +prev,p2.nextZ=p2.next,p2=p2.next;while(p2!==start);p2.prevZ.nextZ=null,p2.prevZ= +null,sortLinked2(p2)}__name(indexCurve2,"indexCurve");function sortLinked2(list){ +let i2,p2,q2,e,tail,numMerges,pSize,qSize,inSize=1;do{for(p2=list,list=null,tail= +null,numMerges=0;p2;){for(numMerges++,q2=p2,pSize=0,i2=0;i20||qSize>0&&q2;)pSize!==0&&(qSize=== +0||!q2||p2.z<=q2.z)?(e=p2,p2=p2.nextZ,pSize--):(e=q2,q2=q2.nextZ,qSize--),tail?tail. +nextZ=e:list=e,e.prevZ=tail,tail=e;p2=q2}tail.nextZ=null,inSize*=2}while(numMerges> +1);return list}__name(sortLinked2,"sortLinked");function zOrder2(x2,y2,minX,minY,invSize){ +return x2=(x2-minX)*invSize|0,y2=(y2-minY)*invSize|0,x2=(x2|x2<<8)&16711935,x2=(x2| +x2<<4)&252645135,x2=(x2|x2<<2)&858993459,x2=(x2|x2<<1)&1431655765,y2=(y2|y2<<8)& +16711935,y2=(y2|y2<<4)&252645135,y2=(y2|y2<<2)&858993459,y2=(y2|y2<<1)&1431655765, +x2|y2<<1}__name(zOrder2,"zOrder");function getLeftmost2(start){let p2=start,leftmost=start; +do(p2.x=(ax-px2)*(cy-py2)&&(ax-px2)*(by-py2)>=(bx-px2)*(ay-py2)&& +(bx-px2)*(cy-py2)>=(cx-px2)*(by-py2)}__name(pointInTriangle2,"pointInTriangle"); +function isValidDiagonal2(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!intersectsPolygon2( +a,b)&&(locallyInside2(a,b)&&locallyInside2(b,a)&&middleInside2(a,b)&&(area2(a.prev, +a,b.prev)||area2(a,b.prev,b))||equals2(a,b)&&area2(a.prev,a,a.next)>0&&area2(b.prev, +b,b.next)>0)}__name(isValidDiagonal2,"isValidDiagonal");function area2(p2,q2,r3){ +return(q2.y-p2.y)*(r3.x-q2.x)-(q2.x-p2.x)*(r3.y-q2.y)}__name(area2,"area");function equals2(p1,p2){ +return p1.x===p2.x&&p1.y===p2.y}__name(equals2,"equals");function intersects2(p1,q1,p2,q2){ +let o1=sign2(area2(p1,q1,p2)),o2=sign2(area2(p1,q1,q2)),o3=sign2(area2(p2,q2,p1)), +o4=sign2(area2(p2,q2,q1));return!!(o1!==o2&&o3!==o4||o1===0&&onSegment2(p1,p2,q1)|| +o2===0&&onSegment2(p1,q2,q1)||o3===0&&onSegment2(p2,p1,q2)||o4===0&&onSegment2(p2, +q1,q2))}__name(intersects2,"intersects");function onSegment2(p2,q2,r3){return q2. +x<=Math.max(p2.x,r3.x)&&q2.x>=Math.min(p2.x,r3.x)&&q2.y<=Math.max(p2.y,r3.y)&&q2. +y>=Math.min(p2.y,r3.y)}__name(onSegment2,"onSegment");function sign2(num){return num> +0?1:num<0?-1:0}__name(sign2,"sign");function intersectsPolygon2(a,b){let p2=a;do{ +if(p2.i!==a.i&&p2.next.i!==a.i&&p2.i!==b.i&&p2.next.i!==b.i&&intersects2(p2,p2.next, +a,b))return!0;p2=p2.next}while(p2!==a);return!1}__name(intersectsPolygon2,"inter\ +sectsPolygon");function locallyInside2(a,b){return area2(a.prev,a,a.next)<0?area2( +a,b,a.next)>=0&&area2(a,a.prev,b)>=0:area2(a,b,a.prev)<0||area2(a,a.next,b)<0}__name( +locallyInside2,"locallyInside");function middleInside2(a,b){let p2=a,inside=!1,px2=(a. +x+b.x)/2,py2=(a.y+b.y)/2;do p2.y>py2!=p2.next.y>py2&&p2.next.y!==p2.y&&px2<(p2.next. +x-p2.x)*(py2-p2.y)/(p2.next.y-p2.y)+p2.x&&(inside=!inside),p2=p2.next;while(p2!== +a);return inside}__name(middleInside2,"middleInside");function splitPolygon2(a,b){ +let a2=new Node3(a.i,a.x,a.y),b2=new Node3(b.i,b.x,b.y),an=a.next,bp=b.prev;return a. +next=b,b.prev=a,a2.next=an,an.prev=a2,b2.next=a2,a2.prev=b2,bp.next=b2,b2.prev=bp, +b2}__name(splitPolygon2,"splitPolygon");function insertNode2(i2,x2,y2,last){let p2=new Node3( +i2,x2,y2);return last?(p2.next=last.next,p2.prev=last,last.next.prev=p2,last.next= +p2):(p2.prev=p2,p2.next=p2),p2}__name(insertNode2,"insertNode");function removeNode2(p2){ +p2.next.prev=p2.prev,p2.prev.next=p2.next,p2.prevZ&&(p2.prevZ.nextZ=p2.nextZ),p2. +nextZ&&(p2.nextZ.prevZ=p2.prevZ)}__name(removeNode2,"removeNode");function Node3(i2,x2,y2){ +this.i=i2,this.x=x2,this.y=y2,this.prev=null,this.next=null,this.z=0,this.prevZ= +null,this.nextZ=null,this.steiner=!1}__name(Node3,"Node");function signedArea2(data,start,end,dim){ +let sum=0;for(let i2=start,j2=end-dim;i22&&points[l-1].equals(points[0])&&points.pop()}__name(removeDupEndPts2, +"removeDupEndPts");function addContour2(vertices,contour){for(let i2=0;i2 +Number.EPSILON){let v_prev_len=Math.sqrt(v_prev_lensq),v_next_len=Math.sqrt(v_next_x* +v_next_x+v_next_y*v_next_y),ptPrevShift_x=inPrev.x-v_prev_y/v_prev_len,ptPrevShift_y=inPrev. +y+v_prev_x/v_prev_len,ptNextShift_x=inNext.x-v_next_y/v_next_len,ptNextShift_y=inNext. +y+v_next_x/v_next_len,sf=((ptNextShift_x-ptPrevShift_x)*v_next_y-(ptNextShift_y- +ptPrevShift_y)*v_next_x)/(v_prev_x*v_next_y-v_prev_y*v_next_x);v_trans_x=ptPrevShift_x+ +v_prev_x*sf-inPt.x,v_trans_y=ptPrevShift_y+v_prev_y*sf-inPt.y;let v_trans_lensq=v_trans_x* +v_trans_x+v_trans_y*v_trans_y;if(v_trans_lensq<=2)return new Vector2(v_trans_x,v_trans_y); +shrink_by=Math.sqrt(v_trans_lensq/2)}else{let direction_eq=!1;v_prev_x>Number.EPSILON? +v_next_x>Number.EPSILON&&(direction_eq=!0):v_prev_x<-Number.EPSILON?v_next_x<-Number. +EPSILON&&(direction_eq=!0):Math.sign(v_prev_y)===Math.sign(v_next_y)&&(direction_eq= +!0),direction_eq?(v_trans_x=-v_prev_y,v_trans_y=v_prev_x,shrink_by=Math.sqrt(v_prev_lensq)): +(v_trans_x=v_prev_x,v_trans_y=v_prev_y,shrink_by=Math.sqrt(v_prev_lensq/2))}return new Vector2( +v_trans_x/shrink_by,v_trans_y/shrink_by)}__name(getBevelVec,"getBevelVec");let contourMovements=[]; +for(let i2=0,il=contour.length,j2=il-1,k=i2+1;i2=0;b--){ +let t=b/bevelSegments,z2=bevelThickness*Math.cos(t*Math.PI/2),bs2=bevelSize*Math. +sin(t*Math.PI/2)+bevelOffset;for(let i2=0,il=contour.length;i2=0;){let j2=i2,k=i2-1;k<0&&(k=contour2.length-1);for(let s=0,sl=steps+ +bevelSegments*2;s=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers16=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=GeometryBehavior, +_instanceExtraInitializers=[],_cornerRadius_decorators,_cornerRadius_initializers=[], +_thickness_decorators,_thickness_initializers=[],_get_quadraticCorners_decorators; +var RoundedRectangleGeometryBehavior2=class extends _classSuper{static{__name(this, +"RoundedRectangleGeometryBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_cornerRadius_decorators=[attribute({from:Number}),receiver],_thickness_decorators= +[attribute({from:Number}),receiver],_get_quadraticCorners_decorators=[attribute, +receiver],__esDecorate16(this,null,_get_quadraticCorners_decorators,{kind:"gette\ +r",name:"quadraticCorners",static:!1,private:!1,access:{has:obj=>"quadraticCorne\ +rs"in obj,get:obj=>obj.quadraticCorners},metadata:_metadata},null,_instanceExtraInitializers), +__esDecorate16(null,null,_cornerRadius_decorators,{kind:"field",name:"cornerRadi\ +us",static:!1,private:!1,access:{has:obj=>"cornerRadius"in obj,get:obj=>obj.cornerRadius, +set:(obj,value)=>{obj.cornerRadius=value}},metadata:_metadata},_cornerRadius_initializers, +_instanceExtraInitializers),__esDecorate16(null,null,_thickness_decorators,{kind:"\ +field",name:"thickness",static:!1,private:!1,access:{has:obj=>"thickness"in obj, +get:obj=>obj.thickness,set:(obj,value)=>{obj.thickness=value}},metadata:_metadata}, +_thickness_initializers,_instanceExtraInitializers),__esDecorate16(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),RoundedRectangleGeometryBehavior2=_classThis=_classDescriptor. +value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0, +configurable:!0,writable:!0,value:_metadata}),__runInitializers16(_classThis,_classExtraInitializers)}cornerRadius=(__runInitializers16( +this,_instanceExtraInitializers),__runInitializers16(this,_cornerRadius_initializers, +0));thickness=__runInitializers16(this,_thickness_initializers,0);#quadraticCorners=!1;get quadraticCorners(){ +return this.#quadraticCorners}set quadraticCorners(val){val===null||val==="false"? +this.#quadraticCorners=!1:this.#quadraticCorners=!0}_createComponent(){let thickness=this. +thickness,geom,roundedRectShape=new RoundedRectShape(0,0,this.element.calculatedSize. +x,this.element.calculatedSize.y,this.cornerRadius,this.quadraticCorners);return thickness> +0?geom=new ExtrudeGeometry(roundedRectShape,{bevelEnabled:!0,steps:1,bevelSegments:1, +bevelSize:0,bevelThickness:0,depth:thickness}):geom=new ShapeGeometry(roundedRectShape), +geom.translate(-this.element.calculatedSize.x/2,-this.element.calculatedSize.y/2, +-thickness/2),geom}};return RoundedRectangleGeometryBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("rounded-rectangle-geometry")&& +elementBehaviors.define("rounded-rectangle-geometry",RoundedRectangleGeometryBehavior); +var RoundedRectShape=class extends Shape{static{__name(this,"RoundedRectShape")}constructor(x2,y2,width,height,radius,quadraticCorners=!1){ +if(super(),quadraticCorners){this.moveTo(x2,y2+radius),this.lineTo(x2,y2+height- +radius),this.quadraticCurveTo(x2,y2+height,x2+radius,y2+height),this.lineTo(x2+width- +radius,y2+height),this.quadraticCurveTo(x2+width,y2+height,x2+width,y2+height-radius), +this.lineTo(x2+width,y2+radius),this.quadraticCurveTo(x2+width,y2,x2+width-radius, +y2),this.lineTo(x2+radius,y2),this.quadraticCurveTo(x2,y2,x2,y2+radius);return}this. +absarc(x2+width-radius,y2+radius,radius,-Math.PI/2,0,!1),this.absarc(x2+width-radius, +y2+height-radius,radius,0,Math.PI/2,!1),this.absarc(x2+radius,y2+height-radius,radius, +Math.PI/2,Math.PI,!1),this.absarc(x2+radius,y2+radius,radius,Math.PI,Math.PI+Math. +PI/2,!1),this.lineTo(x2+width-radius,y2)}};function handleInvertedGeometry(geometry){let x2=0,y2=0,z2=0,normals=geometry.attributes. +normal.array;for(let i2=0,l=normals.length/9;i2Number.EPSILON){if(edgeDy< +0&&(edgeLowPt=inPolygon[q2],edgeDx=-edgeDx,edgeHighPt=inPolygon[p2],edgeDy=-edgeDy), +inPt.yedgeHighPt.y)continue;if(inPt.y===edgeLowPt.y){if(inPt. +x===edgeLowPt.x)return!0}else{let perpEdge=edgeDy*(inPt.x-edgeLowPt.x)-edgeDx*(inPt. +y-edgeLowPt.y);if(perpEdge===0)return!0;if(perpEdge<0)continue;inside=!inside}}else{ +if(inPt.y!==edgeLowPt.y)continue;if(edgeHighPt.x<=inPt.x&&inPt.x<=edgeLowPt.x||edgeLowPt. +x<=inPt.x&&inPt.x<=edgeHighPt.x)return!0}}return inside}__name(isPointInsidePolygon, +"isPointInsidePolygon");let isClockWise=ShapeUtils2.isClockWise,subPaths=this.subPaths; +if(subPaths.length===0)return[];let solid,tmpPath,tmpShape,shapes=[];if(subPaths. +length===1)return tmpPath=subPaths[0],tmpShape=new Shape,tmpShape.curves=tmpPath. +curves,shapes.push(tmpShape),shapes;let holesFirst=!isClockWise(subPaths[0].getPoints()); +holesFirst=isCCW?!holesFirst:holesFirst;let betterShapeHoles=[],newShapes=[],newShapeHoles=[], +mainIdx=0,tmpPoints;newShapes[mainIdx]=void 0,newShapeHoles[mainIdx]=[];for(let i2=0, +l=subPaths.length;i21){let ambiguous=!1,toChange=0;for(let sIdx=0,sLen=newShapes. +length;sIdx0&&ambiguous===!1&&(newShapeHoles=betterShapeHoles)} +let tmpHoles;for(let i2=0,il=newShapes.length;i20&&(point.copy(firstPoint),path.currentPath.currentPoint. +copy(point),isFirstPoint=!0);break;default:console.warn(command)}doSetFirstPoint= +!1}return path}__name(parseSvgPathDAttribute,"parseSvgPathDAttribute");function parseFloats(input,flags,stride){ +if(typeof input!="string")throw new TypeError("Invalid input: "+typeof input);let RE={ +SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./, +COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},SEP=0,INT=1,FLOAT=2,EXP=3,state=SEP,seenComma=!0, +number="",exponent="",result=[];class NumberSyntaxError extends SyntaxError{static{ +__name(this,"NumberSyntaxError")}partial}function throwSyntaxError(current2,i2,partial){ +let error=new NumberSyntaxError('Unexpected character "'+current2+'" at index '+ +i2+".");throw error.partial=partial,error}__name(throwSyntaxError,"throwSyntaxEr\ +ror");function newNumber(){number!==""&&(exponent===""?result.push(Number(number)): +result.push(Number(number)*Math.pow(10,Number(exponent)))),number="",exponent=""} +__name(newNumber,"newNumber");let current,length=input.length;for(let i2=0;i21){let s=Math.sqrt(cr2);rx=s*rx,ry= +s*ry,rxs=rx*rx,rys=ry*ry}let dq=rxs*y1ps+rys*x1ps,pq=(rxs*rys-dq)/dq,q2=Math.sqrt( +Math.max(0,pq));large_arc_flag===sweep_flag&&(q2=-q2);let cxp=q2*rx*y1p/ry,cyp=-q2* +ry*x1p/rx,cx=Math.cos(x_axis_rotation)*cxp-Math.sin(x_axis_rotation)*cyp+(start. +x+end.x)/2,cy=Math.sin(x_axis_rotation)*cxp+Math.cos(x_axis_rotation)*cyp+(start. +y+end.y)/2,theta=svgAngle(1,0,(x1p-cxp)/rx,(y1p-cyp)/ry),delta=svgAngle((x1p-cxp)/ +rx,(y1p-cyp)/ry,(-x1p-cxp)/rx,(-y1p-cyp)/ry)%(Math.PI*2);path.currentPath.absellipse( +cx,cy,rx,ry,theta,theta+delta,sweep_flag===0,x_axis_rotation)}__name(parseArcCommand, +"parseArcCommand");function getReflection(a,b){return a-(b-a)}__name(getReflection, +"getReflection");function svgAngle(ux,uy,vx,vy){let dot=ux*vx+uy*vy,len=Math.sqrt( +ux*ux+uy*uy)*Math.sqrt(vx*vx+vy*vy),ang=Math.acos(Math.max(-1,Math.min(1,dot/len))); +return ux*vy-uy*vx<0&&(ang=-ang),ang}__name(svgAngle,"svgAngle");var __runInitializers17=function(thisArg,initializers,value){for(var useValue=arguments. +length>2,i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},defaultShape=new Shape; +defaultShape.moveTo(5,5);defaultShape.bezierCurveTo(5,5,4,0,0,0);defaultShape.bezierCurveTo( +-6,0,-6,7,-6,7);defaultShape.bezierCurveTo(-6,11,-3,15.4,5,19);defaultShape.bezierCurveTo( +12,15.4,16,11,16,7);defaultShape.bezierCurveTo(16,7,16,0,10,0);defaultShape.bezierCurveTo( +7,0,5,5,5,5);var emptyShape=new Shape,isPathStringRe=/^[mlhvcsqtaz][^a-z]/i,ShapeGeometryBehavior=(()=>{ +let _classDecorators=[behavior],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=GeometryBehavior,_instanceExtraInitializers=[],_get_shape_decorators, +_curveSegments_decorators,_curveSegments_initializers=[],_bevel_decorators,_bevel_initializers=[], +_bevelSegments_decorators,_bevelSegments_initializers=[],_bevelThickness_decorators, +_bevelThickness_initializers=[],_centerGeometry_decorators,_centerGeometry_initializers=[], +_fitment_decorators,_fitment_initializers=[];var ShapeGeometryBehavior2=class extends _classSuper{static{ +__name(this,"ShapeGeometryBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_get_shape_decorators=[attribute,receiver],_curveSegments_decorators=[numberAttribute, +receiver],_bevel_decorators=[booleanAttribute,receiver],_bevelSegments_decorators= +[numberAttribute,receiver],_bevelThickness_decorators=[numberAttribute,receiver], +_centerGeometry_decorators=[booleanAttribute,receiver],_fitment_decorators=[stringAttribute, +receiver],__esDecorate17(this,null,_get_shape_decorators,{kind:"getter",name:"sh\ +ape",static:!1,private:!1,access:{has:obj=>"shape"in obj,get:obj=>obj.shape},metadata:_metadata}, +null,_instanceExtraInitializers),__esDecorate17(null,null,_curveSegments_decorators, +{kind:"field",name:"curveSegments",static:!1,private:!1,access:{has:obj=>"curveS\ +egments"in obj,get:obj=>obj.curveSegments,set:(obj,value)=>{obj.curveSegments=value}}, +metadata:_metadata},_curveSegments_initializers,_instanceExtraInitializers),__esDecorate17( +null,null,_bevel_decorators,{kind:"field",name:"bevel",static:!1,private:!1,access:{ +has:obj=>"bevel"in obj,get:obj=>obj.bevel,set:(obj,value)=>{obj.bevel=value}},metadata:_metadata}, +_bevel_initializers,_instanceExtraInitializers),__esDecorate17(null,null,_bevelSegments_decorators, +{kind:"field",name:"bevelSegments",static:!1,private:!1,access:{has:obj=>"bevelS\ +egments"in obj,get:obj=>obj.bevelSegments,set:(obj,value)=>{obj.bevelSegments=value}}, +metadata:_metadata},_bevelSegments_initializers,_instanceExtraInitializers),__esDecorate17( +null,null,_bevelThickness_decorators,{kind:"field",name:"bevelThickness",static:!1, +private:!1,access:{has:obj=>"bevelThickness"in obj,get:obj=>obj.bevelThickness,set:(obj,value)=>{ +obj.bevelThickness=value}},metadata:_metadata},_bevelThickness_initializers,_instanceExtraInitializers), +__esDecorate17(null,null,_centerGeometry_decorators,{kind:"field",name:"centerGe\ +ometry",static:!1,private:!1,access:{has:obj=>"centerGeometry"in obj,get:obj=>obj. +centerGeometry,set:(obj,value)=>{obj.centerGeometry=value}},metadata:_metadata}, +_centerGeometry_initializers,_instanceExtraInitializers),__esDecorate17(null,null, +_fitment_decorators,{kind:"field",name:"fitment",static:!1,private:!1,access:{has:obj=>"\ +fitment"in obj,get:obj=>obj.fitment,set:(obj,value)=>{obj.fitment=value}},metadata:_metadata}, +_fitment_initializers,_instanceExtraInitializers),__esDecorate17(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),ShapeGeometryBehavior2=_classThis=_classDescriptor. +value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0, +configurable:!0,writable:!0,value:_metadata}),__runInitializers17(_classThis,_classExtraInitializers)}#shape=(__runInitializers17( +this,_instanceExtraInitializers),new Shape().copy(defaultShape));get shape(){return this.#shape}set shape(shape){ +if(!shape)this.#shape.copy(defaultShape);else if(typeof shape=="string"&&(shape= +shape.trim())&&shape.match(isPathStringRe)){let shapePath=parseSvgPathDAttribute( +shape);this.#shape.copy(shapePath.toShapes(!0)[0]??defaultShape)}else if(typeof shape== +"string"&&!shape.match(/^-?[0-9]/))console.error("Unsupported shape path: ",shape), +this.#shape.copy(defaultShape);else if(typeof shape=="string"||Array.isArray(shape)){ +let points=typeof shape=="string"?stringToNumberArray(shape,"shape"):shape;if(!points. +length)this.#shape.copy(defaultShape);else{if(points.length%2!==0)throw new Error( +"shape path must have an even number of numbers, each pair of numbers being a po\ +int.");if(this.#shape.copy(emptyShape),this.#shape.moveTo(points[0],points[1]),points. +length>2)for(let i2=2;i2maxX&&(maxX=x2),y2maxY&&(maxY= +y2)}let shapeSizeX=maxX-minX,shapeSizeY=maxY-minY,scaleX=shapeSizeX/this.element. +calculatedSize.x,scaleY=shapeSizeY/this.element.calculatedSize.y;if(this.fitment=== +"fill")return geometry.scale(1/scaleX,1/scaleY,1);let shapeAspect=shapeSizeX/shapeSizeY, +sizeAspect=this.element.calculatedSize.x/this.element.calculatedSize.y;return this. +fitment==="contain"?shapeAspect0)&&indices.push(a,b,d2),(iy!==heightSegments-1||thetaEnd=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers18=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=GeometryBehavior,_instanceExtraInitializers=[], +_horizontalSegments_decorators,_horizontalSegments_initializers=[],_verticalSegments_decorators, +_verticalSegments_initializers=[];var SphereGeometryBehavior2=class extends _classSuper{static{ +__name(this,"SphereGeometryBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_horizontalSegments_decorators=[numberAttribute,receiver],_verticalSegments_decorators= +[numberAttribute,receiver],__esDecorate18(null,null,_horizontalSegments_decorators, +{kind:"field",name:"horizontalSegments",static:!1,private:!1,access:{has:obj=>"h\ +orizontalSegments"in obj,get:obj=>obj.horizontalSegments,set:(obj,value)=>{obj.horizontalSegments= +value}},metadata:_metadata},_horizontalSegments_initializers,_instanceExtraInitializers), +__esDecorate18(null,null,_verticalSegments_decorators,{kind:"field",name:"vertic\ +alSegments",static:!1,private:!1,access:{has:obj=>"verticalSegments"in obj,get:obj=>obj. +verticalSegments,set:(obj,value)=>{obj.verticalSegments=value}},metadata:_metadata}, +_verticalSegments_initializers,_instanceExtraInitializers),__esDecorate18(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),SphereGeometryBehavior2=_classThis=_classDescriptor. +value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0, +configurable:!0,writable:!0,value:_metadata}),__runInitializers18(_classThis,_classExtraInitializers)}horizontalSegments=(__runInitializers18( +this,_instanceExtraInitializers),__runInitializers18(this,_horizontalSegments_initializers, +32));verticalSegments=__runInitializers18(this,_verticalSegments_initializers,32);_createComponent(){ +return new SphereGeometry(this.element.calculatedSize.x/2,this.horizontalSegments, +this.verticalSegments)}};return SphereGeometryBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("sphere-geometry")&&elementBehaviors. +define("sphere-geometry",SphereGeometryBehavior);var TorusGeometry=class _TorusGeometry extends BufferGeometry{static{__name(this, +"TorusGeometry")}constructor(radius=1,tube=.4,radialSegments=12,tubularSegments=48,arc=Math. +PI*2){super(),this.type="TorusGeometry",this.parameters={radius,tube,radialSegments, +tubularSegments,arc},radialSegments=Math.floor(radialSegments),tubularSegments=Math. +floor(tubularSegments);let indices=[],vertices=[],normals=[],uvs=[],center=new Vector3, +vertex20=new Vector3,normal=new Vector3;for(let j2=0;j2<=radialSegments;j2++)for(let i2=0;i2<= +tubularSegments;i2++){let u2=i2/tubularSegments*arc,v=j2/radialSegments*Math.PI* +2;vertex20.x=(radius+tube*Math.cos(v))*Math.cos(u2),vertex20.y=(radius+tube*Math. +cos(v))*Math.sin(u2),vertex20.z=tube*Math.sin(v),vertices.push(vertex20.x,vertex20. +y,vertex20.z),center.x=radius*Math.cos(u2),center.y=radius*Math.sin(u2),normal.subVectors( +vertex20,center).normalize(),normals.push(normal.x,normal.y,normal.z),uvs.push(i2/ +tubularSegments),uvs.push(j2/radialSegments)}for(let j2=1;j2<=radialSegments;j2++) +for(let i2=1;i2<=tubularSegments;i2++){let a=(tubularSegments+1)*j2+i2-1,b=(tubularSegments+ +1)*(j2-1)+i2-1,c3=(tubularSegments+1)*(j2-1)+i2,d2=(tubularSegments+1)*j2+i2;indices. +push(a,b,d2),indices.push(b,c3,d2)}this.setIndex(indices),this.setAttribute("pos\ +ition",new Float32BufferAttribute(vertices,3)),this.setAttribute("normal",new Float32BufferAttribute( +normals,3)),this.setAttribute("uv",new Float32BufferAttribute(uvs,2))}copy(source){ +return super.copy(source),this.parameters=Object.assign({},source.parameters),this}static fromJSON(data){ +return new _TorusGeometry(data.radius,data.tube,data.radialSegments,data.tubularSegments, +data.arc)}};var __esDecorate19=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers19=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=GeometryBehavior,_instanceExtraInitializers=[], +_tubeThickness_decorators,_tubeThickness_initializers=[],_radialSegments_decorators, +_radialSegments_initializers=[],_tubularSegments_decorators,_tubularSegments_initializers=[], +_arc_decorators,_arc_initializers=[];var TorusGeometryBehavior2=class extends _classSuper{static{ +__name(this,"TorusGeometryBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_tubeThickness_decorators=[numberAttribute,receiver],_radialSegments_decorators= +[numberAttribute,receiver],_tubularSegments_decorators=[numberAttribute,receiver], +_arc_decorators=[numberAttribute,receiver],__esDecorate19(null,null,_tubeThickness_decorators, +{kind:"field",name:"tubeThickness",static:!1,private:!1,access:{has:obj=>"tubeTh\ +ickness"in obj,get:obj=>obj.tubeThickness,set:(obj,value)=>{obj.tubeThickness=value}}, +metadata:_metadata},_tubeThickness_initializers,_instanceExtraInitializers),__esDecorate19( +null,null,_radialSegments_decorators,{kind:"field",name:"radialSegments",static:!1, +private:!1,access:{has:obj=>"radialSegments"in obj,get:obj=>obj.radialSegments,set:(obj,value)=>{ +obj.radialSegments=value}},metadata:_metadata},_radialSegments_initializers,_instanceExtraInitializers), +__esDecorate19(null,null,_tubularSegments_decorators,{kind:"field",name:"tubular\ +Segments",static:!1,private:!1,access:{has:obj=>"tubularSegments"in obj,get:obj=>obj. +tubularSegments,set:(obj,value)=>{obj.tubularSegments=value}},metadata:_metadata}, +_tubularSegments_initializers,_instanceExtraInitializers),__esDecorate19(null,null, +_arc_decorators,{kind:"field",name:"arc",static:!1,private:!1,access:{has:obj=>"\ +arc"in obj,get:obj=>obj.arc,set:(obj,value)=>{obj.arc=value}},metadata:_metadata}, +_arc_initializers,_instanceExtraInitializers),__esDecorate19(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),TorusGeometryBehavior2=_classThis=_classDescriptor. +value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0, +configurable:!0,writable:!0,value:_metadata}),__runInitializers19(_classThis,_classExtraInitializers)}tubeThickness=(__runInitializers19( +this,_instanceExtraInitializers),__runInitializers19(this,_tubeThickness_initializers, +.1));radialSegments=__runInitializers19(this,_radialSegments_initializers,16);tubularSegments=__runInitializers19( +this,_tubularSegments_initializers,32);arc=__runInitializers19(this,_arc_initializers, +360);_createComponent(){let outerDiameter=this.element.calculatedSize.x,outerRadius=outerDiameter/ +2,{tubeThickness,radialSegments,tubularSegments,arc}=this,literalThickness=tubeThickness* +outerDiameter,radius=outerRadius-literalThickness/2;return new TorusGeometry(radius, +literalThickness,radialSegments,tubularSegments,toRadians(arc))}};return TorusGeometryBehavior2= +_classThis})();globalThis.window?.document&&!elementBehaviors.has("torus-geometry")&&elementBehaviors. +define("torus-geometry",TorusGeometryBehavior);var Cache2={enabled:!1,files:{},add:function(key2,file){this.enabled!==!1&&(this. +files[key2]=file)},get:function(key2){if(this.enabled!==!1)return this.files[key2]}, +remove:function(key2){delete this.files[key2]},clear:function(){this.files={}}};var LoadingManager2=class{static{__name(this,"LoadingManager")}constructor(onLoad,onProgress,onError){ +let scope=this,isLoading=!1,itemsLoaded=0,itemsTotal=0,urlModifier,handlers=[];this. +onStart=void 0,this.onLoad=onLoad,this.onProgress=onProgress,this.onError=onError, +this.itemStart=function(url){itemsTotal++,isLoading===!1&&scope.onStart!==void 0&& +scope.onStart(url,itemsLoaded,itemsTotal),isLoading=!0},this.itemEnd=function(url){ +itemsLoaded++,scope.onProgress!==void 0&&scope.onProgress(url,itemsLoaded,itemsTotal), +itemsLoaded===itemsTotal&&(isLoading=!1,scope.onLoad!==void 0&&scope.onLoad())}, +this.itemError=function(url){scope.onError!==void 0&&scope.onError(url)},this.resolveURL= +function(url){return urlModifier?urlModifier(url):url},this.setURLModifier=function(transform){ +return urlModifier=transform,this},this.addHandler=function(regex,loader){return handlers. +push(regex,loader),this},this.removeHandler=function(regex){let index=handlers.indexOf( +regex);return index!==-1&&handlers.splice(index,2),this},this.getHandler=function(file){ +for(let i2=0,l=handlers.length;i2"u")return image.src;let canvas; +if(image instanceof HTMLCanvasElement)canvas=image;else{_canvas2===void 0&&(_canvas2= +createElementNS("canvas")),_canvas2.width=image.width,_canvas2.height=image.height; +let context=_canvas2.getContext("2d");image instanceof ImageData?context.putImageData( +image,0,0):context.drawImage(image,0,0,image.width,image.height),canvas=_canvas2} +return canvas.width>2048||canvas.height>2048?(console.warn("THREE.ImageUtils.get\ +DataURL: Image converted to jpg for performance reasons",image),canvas.toDataURL( +"image/jpeg",.6)):canvas.toDataURL("image/png")}static sRGBToLinear(image){if(typeof HTMLImageElement< +"u"&&image instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&image instanceof +HTMLCanvasElement||typeof ImageBitmap<"u"&&image instanceof ImageBitmap){let canvas=createElementNS( +"canvas");canvas.width=image.width,canvas.height=image.height;let context=canvas. +getContext("2d");context.drawImage(image,0,0,image.width,image.height);let imageData=context. +getImageData(0,0,image.width,image.height),data=imageData.data;for(let i2=0;i20&& +(output.userData=this.userData),isRootObject||(meta.textures[this.uuid]=output), +output}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(uv){if(this.mapping!== +UVMapping)return uv;if(uv.applyMatrix3(this.matrix),uv.x<0||uv.x>1)switch(this.wrapS){case RepeatWrapping: +uv.x=uv.x-Math.floor(uv.x);break;case ClampToEdgeWrapping:uv.x=uv.x<0?0:1;break;case MirroredRepeatWrapping: +Math.abs(Math.floor(uv.x)%2)===1?uv.x=Math.ceil(uv.x)-uv.x:uv.x=uv.x-Math.floor( +uv.x);break}if(uv.y<0||uv.y>1)switch(this.wrapT){case RepeatWrapping:uv.y=uv.y-Math. +floor(uv.y);break;case ClampToEdgeWrapping:uv.y=uv.y<0?0:1;break;case MirroredRepeatWrapping: +Math.abs(Math.floor(uv.y)%2)===1?uv.y=Math.ceil(uv.y)-uv.y:uv.y=uv.y-Math.floor( +uv.y);break}return this.flipY&&(uv.y=1-uv.y),uv}set needsUpdate(value){value===!0&& +(this.version++,this.source.needsUpdate=!0)}get encoding(){return warnOnce("THRE\ +E.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=== +SRGBColorSpace?sRGBEncoding:LinearEncoding}set encoding(encoding){warnOnce("THRE\ +E.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace= +encoding===sRGBEncoding?SRGBColorSpace:NoColorSpace}};Texture2.DEFAULT_IMAGE=null; +Texture2.DEFAULT_MAPPING=UVMapping;Texture2.DEFAULT_ANISOTROPY=1;var TextureLoader2=class extends Loader2{static{__name(this,"TextureLoader")}constructor(manager){ +super(manager)}load(url,onLoad,onProgress,onError){let texture=new Texture2,loader=new ImageLoader2( +this.manager);return loader.setCrossOrigin(this.crossOrigin),loader.setPath(this. +path),loader.load(url,function(image){texture.image=image,texture.needsUpdate=!0, +onLoad!==void 0&&onLoad(texture)},onProgress,onError),texture}};var __runInitializers20=function(thisArg,initializers,value){for(var useValue=arguments. +length>2,i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},MaterialBehavior=(()=>{ +let _classDecorators=[behavior],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=GeometryOrMaterialBehavior,_instanceExtraInitializers=[],_alphaTest_decorators, +_alphaTest_initializers=[],_colorWrite_decorators,_colorWrite_initializers=[],_depthTest_decorators, +_depthTest_initializers=[],_depthWrite_decorators,_depthWrite_initializers=[],_dithering_decorators, +_dithering_initializers=[],_fog_decorators,_fog_initializers=[],_wireframe_decorators, +_wireframe_initializers=[],_sidedness_decorators,_sidedness_initializers=[],_materialOpacity_decorators, +_materialOpacity_initializers=[],_get_color_decorators;var MaterialBehavior2=class extends _classSuper{static{ +__name(this,"MaterialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_alphaTest_decorators=[numberAttribute,receiver],_colorWrite_decorators=[booleanAttribute, +receiver],_depthTest_decorators=[booleanAttribute,receiver],_depthWrite_decorators= +[booleanAttribute,receiver],_dithering_decorators=[booleanAttribute,receiver],_fog_decorators= +[booleanAttribute,receiver],_wireframe_decorators=[booleanAttribute,receiver],_sidedness_decorators= +[stringAttribute,receiver],_materialOpacity_decorators=[numberAttribute,receiver], +_get_color_decorators=[stringAttribute,receiver],__esDecorate20(this,null,_get_color_decorators, +{kind:"getter",name:"color",static:!1,private:!1,access:{has:obj=>"color"in obj, +get:obj=>obj.color},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate20( +null,null,_alphaTest_decorators,{kind:"field",name:"alphaTest",static:!1,private:!1, +access:{has:obj=>"alphaTest"in obj,get:obj=>obj.alphaTest,set:(obj,value)=>{obj. +alphaTest=value}},metadata:_metadata},_alphaTest_initializers,_instanceExtraInitializers), +__esDecorate20(null,null,_colorWrite_decorators,{kind:"field",name:"colorWrite", +static:!1,private:!1,access:{has:obj=>"colorWrite"in obj,get:obj=>obj.colorWrite, +set:(obj,value)=>{obj.colorWrite=value}},metadata:_metadata},_colorWrite_initializers, +_instanceExtraInitializers),__esDecorate20(null,null,_depthTest_decorators,{kind:"\ +field",name:"depthTest",static:!1,private:!1,access:{has:obj=>"depthTest"in obj, +get:obj=>obj.depthTest,set:(obj,value)=>{obj.depthTest=value}},metadata:_metadata}, +_depthTest_initializers,_instanceExtraInitializers),__esDecorate20(null,null,_depthWrite_decorators, +{kind:"field",name:"depthWrite",static:!1,private:!1,access:{has:obj=>"depthWrit\ +e"in obj,get:obj=>obj.depthWrite,set:(obj,value)=>{obj.depthWrite=value}},metadata:_metadata}, +_depthWrite_initializers,_instanceExtraInitializers),__esDecorate20(null,null,_dithering_decorators, +{kind:"field",name:"dithering",static:!1,private:!1,access:{has:obj=>"dithering"in +obj,get:obj=>obj.dithering,set:(obj,value)=>{obj.dithering=value}},metadata:_metadata}, +_dithering_initializers,_instanceExtraInitializers),__esDecorate20(null,null,_fog_decorators, +{kind:"field",name:"fog",static:!1,private:!1,access:{has:obj=>"fog"in obj,get:obj=>obj. +fog,set:(obj,value)=>{obj.fog=value}},metadata:_metadata},_fog_initializers,_instanceExtraInitializers), +__esDecorate20(null,null,_wireframe_decorators,{kind:"field",name:"wireframe",static:!1, +private:!1,access:{has:obj=>"wireframe"in obj,get:obj=>obj.wireframe,set:(obj,value)=>{ +obj.wireframe=value}},metadata:_metadata},_wireframe_initializers,_instanceExtraInitializers), +__esDecorate20(null,null,_sidedness_decorators,{kind:"field",name:"sidedness",static:!1, +private:!1,access:{has:obj=>"sidedness"in obj,get:obj=>obj.sidedness,set:(obj,value)=>{ +obj.sidedness=value}},metadata:_metadata},_sidedness_initializers,_instanceExtraInitializers), +__esDecorate20(null,null,_materialOpacity_decorators,{kind:"field",name:"materia\ +lOpacity",static:!1,private:!1,access:{has:obj=>"materialOpacity"in obj,get:obj=>obj. +materialOpacity,set:(obj,value)=>{obj.materialOpacity=value}},metadata:_metadata}, +_materialOpacity_initializers,_instanceExtraInitializers),__esDecorate20(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),MaterialBehavior2=_classThis=_classDescriptor.value, +_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers20(_classThis,_classExtraInitializers)}type=(__runInitializers20( +this,_instanceExtraInitializers),"material");alphaTest=__runInitializers20(this, +_alphaTest_initializers,0);colorWrite=__runInitializers20(this,_colorWrite_initializers, +!0);depthTest=__runInitializers20(this,_depthTest_initializers,!0);depthWrite=__runInitializers20( +this,_depthWrite_initializers,!0);dithering=__runInitializers20(this,_dithering_initializers, +!1);fog=__runInitializers20(this,_fog_initializers,!0);wireframe=__runInitializers20( +this,_wireframe_initializers,!1);sidedness=__runInitializers20(this,_sidedness_initializers, +"front");materialOpacity=__runInitializers20(this,_materialOpacity_initializers, +1);__color="white";get color(){return this.__color}set color(val){typeof val=="o\ +bject"?this.__color=val.getStyle():this.__color=val}get transparent(){return this. +element.opacity<1||this.materialOpacity<1}connectedCallback(){super.connectedCallback(), +this.createEffect(()=>{let mat=this.meshComponent;mat&&(mat.alphaTest=this.alphaTest, +mat.colorWrite=this.colorWrite,mat.depthTest=this.depthTest,mat.depthWrite=this. +depthWrite,mat.dithering=this.dithering,this.element.needsUpdate())}),this.createEffect( +()=>{let mat=this.meshComponent;mat&&isWireframeMaterial(mat)&&(mat.wireframe=this. +wireframe,this.element.needsUpdate())}),this.createEffect(()=>{let mat=this.meshComponent; +if(!(mat&&"side"in mat))return;let side;switch(this.sidedness){case"front":side= +FrontSide;break;case"back":side=BackSide;break;case"double":side=DoubleSide;break} +mat.side=side,this.element.needsUpdate()}),this.createEffect(()=>{let mat=this.meshComponent; +mat&&isColoredMaterial(mat)&&(mat.color.set(this.color),this.element.needsUpdate())}), +this.createEffect(()=>{let mat=this.meshComponent;mat&&(mat.opacity=this.element. +opacity*this.materialOpacity,mat.transparent=this.transparent,this.element.needsUpdate())})}_createComponent(){ +return new Material}_handleTexture(textureUrl,setTexture,hasTexture,onLoad,isColor=!1){ +this.createEffect(()=>{let mat=this.meshComponent;if(!mat)return;let url=textureUrl(); +if(!url)return;let cleaned=!1,texture=new TextureLoader2().load(url,()=>{cleaned|| +(hasTexture(mat)||(mat.needsUpdate=!0),setTexture(mat,texture),this.element.needsUpdate(), +onLoad?.(),this.element.dispatchEvent(new TextureLoadEvent(url)))});isColor&&(texture. +colorSpace=SRGBColorSpace),mat.needsUpdate=!0,this.element.needsUpdate(),onCleanup( +()=>{cleaned=!0,texture.dispose(),setTexture(mat,null),mat.needsUpdate=!0,this.element. +needsUpdate()})})}};return MaterialBehavior2=_classThis})();function isColoredMaterial(mat){return"color"in mat}__name(isColoredMaterial,"is\ +ColoredMaterial");function isWireframeMaterial(mat){return"wireframe"in mat}__name( +isWireframeMaterial,"isWireframeMaterial");var TextureLoadEvent=class extends Event{static{ +__name(this,"TextureLoadEvent")}type="textureload";src="";constructor(src){super( +"textureload",{bubbles:!0,composed:!0,cancelable:!0}),this.src=src}};var __esDecorate21=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers21=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=MaterialBehavior,_instanceExtraInitializers=[], +_texture_decorators,_texture_initializers=[],_specularMap_decorators,_specularMap_initializers=[]; +var BasicMaterialBehavior2=class extends _classSuper{static{__name(this,"BasicMa\ +terialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol=="fun\ +ction"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_texture_decorators=[stringAttribute,receiver],_specularMap_decorators=[stringAttribute, +receiver],__esDecorate21(null,null,_texture_decorators,{kind:"field",name:"textu\ +re",static:!1,private:!1,access:{has:obj=>"texture"in obj,get:obj=>obj.texture,set:(obj,value)=>{ +obj.texture=value}},metadata:_metadata},_texture_initializers,_instanceExtraInitializers), +__esDecorate21(null,null,_specularMap_decorators,{kind:"field",name:"specularMap", +static:!1,private:!1,access:{has:obj=>"specularMap"in obj,get:obj=>obj.specularMap, +set:(obj,value)=>{obj.specularMap=value}},metadata:_metadata},_specularMap_initializers, +_instanceExtraInitializers),__esDecorate21(null,_classDescriptor={value:_classThis}, +_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers), +BasicMaterialBehavior2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty( +_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}), +__runInitializers21(_classThis,_classExtraInitializers)}texture=(__runInitializers21( +this,_instanceExtraInitializers),__runInitializers21(this,_texture_initializers, +""));specularMap=__runInitializers21(this,_specularMap_initializers,"");_createComponent(){ +return new MeshBasicMaterial}connectedCallback(){super.connectedCallback(),this. +_handleTexture(()=>this.texture,(mat,tex)=>mat.map=tex,mat=>!!mat.map,()=>{},!0), +this._handleTexture(()=>this.specularMap,(mat,tex)=>mat.specularMap=tex,mat=>!!mat. +specularMap,()=>{},!0)}};return BasicMaterialBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("basic-material")&&elementBehaviors. +define("basic-material",BasicMaterialBehavior);var MeshLambertMaterial2=class extends Material{static{__name(this,"MeshLambertM\ +aterial")}constructor(parameters){super(),this.isMeshLambertMaterial=!0,this.type= +"MeshLambertMaterial",this.color=new Color(16777215),this.map=null,this.lightMap= +null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive= +new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this. +bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale= +new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias= +0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=MultiplyOperation, +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(parameters)}copy(source){return super.copy(source), +this.color.copy(source.color),this.map=source.map,this.lightMap=source.lightMap, +this.lightMapIntensity=source.lightMapIntensity,this.aoMap=source.aoMap,this.aoMapIntensity= +source.aoMapIntensity,this.emissive.copy(source.emissive),this.emissiveMap=source. +emissiveMap,this.emissiveIntensity=source.emissiveIntensity,this.bumpMap=source. +bumpMap,this.bumpScale=source.bumpScale,this.normalMap=source.normalMap,this.normalMapType= +source.normalMapType,this.normalScale.copy(source.normalScale),this.displacementMap= +source.displacementMap,this.displacementScale=source.displacementScale,this.displacementBias= +source.displacementBias,this.specularMap=source.specularMap,this.alphaMap=source. +alphaMap,this.envMap=source.envMap,this.combine=source.combine,this.reflectivity= +source.reflectivity,this.refractionRatio=source.refractionRatio,this.wireframe=source. +wireframe,this.wireframeLinewidth=source.wireframeLinewidth,this.wireframeLinecap= +source.wireframeLinecap,this.wireframeLinejoin=source.wireframeLinejoin,this.flatShading= +source.flatShading,this.fog=source.fog,this}};var __esDecorate22=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers22=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=MaterialBehavior,_instanceExtraInitializers=[], +_texture_decorators,_texture_initializers=[],_specularMap_decorators,_specularMap_initializers=[]; +var LambertMaterialBehavior2=class extends _classSuper{static{__name(this,"Lambe\ +rtMaterialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_texture_decorators=[stringAttribute,receiver],_specularMap_decorators=[stringAttribute, +receiver],__esDecorate22(null,null,_texture_decorators,{kind:"field",name:"textu\ +re",static:!1,private:!1,access:{has:obj=>"texture"in obj,get:obj=>obj.texture,set:(obj,value)=>{ +obj.texture=value}},metadata:_metadata},_texture_initializers,_instanceExtraInitializers), +__esDecorate22(null,null,_specularMap_decorators,{kind:"field",name:"specularMap", +static:!1,private:!1,access:{has:obj=>"specularMap"in obj,get:obj=>obj.specularMap, +set:(obj,value)=>{obj.specularMap=value}},metadata:_metadata},_specularMap_initializers, +_instanceExtraInitializers),__esDecorate22(null,_classDescriptor={value:_classThis}, +_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers), +LambertMaterialBehavior2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty( +_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}), +__runInitializers22(_classThis,_classExtraInitializers)}texture=(__runInitializers22( +this,_instanceExtraInitializers),__runInitializers22(this,_texture_initializers, +""));specularMap=__runInitializers22(this,_specularMap_initializers,"");_createComponent(){ +return new MeshLambertMaterial2({color:65280})}connectedCallback(){super.connectedCallback(), +this._handleTexture(()=>this.texture,(mat,tex)=>mat.map=tex,mat=>!!mat.map,()=>{}, +!0),this._handleTexture(()=>this.specularMap,(mat,tex)=>mat.specularMap=tex,mat=>!!mat. +specularMap,()=>{},!0)}};return LambertMaterialBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("lambert-material")&&elementBehaviors. +define("lambert-material",LambertMaterialBehavior);var __esDecorate23=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers23=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=MaterialBehavior,_instanceExtraInitializers=[], +_texture_decorators,_texture_initializers=[];var LineBasicMaterialBehavior2=class extends _classSuper{static{ +__name(this,"LineBasicMaterialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_texture_decorators=[stringAttribute,receiver],__esDecorate23(null,null,_texture_decorators, +{kind:"field",name:"texture",static:!1,private:!1,access:{has:obj=>"texture"in obj, +get:obj=>obj.texture,set:(obj,value)=>{obj.texture=value}},metadata:_metadata},_texture_initializers, +_instanceExtraInitializers),__esDecorate23(null,_classDescriptor={value:_classThis}, +_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers), +LineBasicMaterialBehavior2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty( +_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}), +__runInitializers23(_classThis,_classExtraInitializers)}texture=(__runInitializers23( +this,_instanceExtraInitializers),__runInitializers23(this,_texture_initializers, +""));_createComponent(){return new LineBasicMaterial}connectedCallback(){super.connectedCallback(), +this._handleTexture(()=>this.texture,(mat,tex)=>mat.map=tex,mat=>!!mat.map,()=>{}, +!0)}};return LineBasicMaterialBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("line-material")&&elementBehaviors. +define("line-material",LineBasicMaterialBehavior);var MeshStandardMaterial2=class extends Material{static{__name(this,"MeshStandar\ +dMaterial")}constructor(parameters){super(),this.isMeshStandardMaterial=!0,this. +defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Color(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 Color(0),this.emissiveIntensity= +1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this. +normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap= +null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this. +metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this. +wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin= +"round",this.flatShading=!1,this.fog=!0,this.setValues(parameters)}copy(source){ +return super.copy(source),this.defines={STANDARD:""},this.color.copy(source.color), +this.roughness=source.roughness,this.metalness=source.metalness,this.map=source. +map,this.lightMap=source.lightMap,this.lightMapIntensity=source.lightMapIntensity, +this.aoMap=source.aoMap,this.aoMapIntensity=source.aoMapIntensity,this.emissive. +copy(source.emissive),this.emissiveMap=source.emissiveMap,this.emissiveIntensity= +source.emissiveIntensity,this.bumpMap=source.bumpMap,this.bumpScale=source.bumpScale, +this.normalMap=source.normalMap,this.normalMapType=source.normalMapType,this.normalScale. +copy(source.normalScale),this.displacementMap=source.displacementMap,this.displacementScale= +source.displacementScale,this.displacementBias=source.displacementBias,this.roughnessMap= +source.roughnessMap,this.metalnessMap=source.metalnessMap,this.alphaMap=source.alphaMap, +this.envMap=source.envMap,this.envMapIntensity=source.envMapIntensity,this.wireframe= +source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth,this.wireframeLinecap= +source.wireframeLinecap,this.wireframeLinejoin=source.wireframeLinejoin,this.flatShading= +source.flatShading,this.fog=source.fog,this}};var MeshPhysicalMaterial2=class extends MeshStandardMaterial2{static{__name(this, +"MeshPhysicalMaterial")}constructor(parameters){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 Vector2(1,1),this. +clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{ +get:function(){return clamp(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(reflectivity){ +this.ior=(1+.4*reflectivity)/(1-.4*reflectivity)}}),this.iridescenceMap=null,this. +iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap= +null,this.sheenColor=new Color(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 Color(1,1,1),this.specularIntensity= +1,this.specularIntensityMap=null,this.specularColor=new Color(1,1,1),this.specularColorMap= +null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this. +_transmission=0,this.setValues(parameters)}get anisotropy(){return this._anisotropy}set anisotropy(value){ +this._anisotropy>0!=value>0&&this.version++,this._anisotropy=value}get clearcoat(){ +return this._clearcoat}set clearcoat(value){this._clearcoat>0!=value>0&&this.version++, +this._clearcoat=value}get iridescence(){return this._iridescence}set iridescence(value){ +this._iridescence>0!=value>0&&this.version++,this._iridescence=value}get sheen(){ +return this._sheen}set sheen(value){this._sheen>0!=value>0&&this.version++,this. +_sheen=value}get transmission(){return this._transmission}set transmission(value){ +this._transmission>0!=value>0&&this.version++,this._transmission=value}copy(source){ +return super.copy(source),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy= +source.anisotropy,this.anisotropyRotation=source.anisotropyRotation,this.anisotropyMap= +source.anisotropyMap,this.clearcoat=source.clearcoat,this.clearcoatMap=source.clearcoatMap, +this.clearcoatRoughness=source.clearcoatRoughness,this.clearcoatRoughnessMap=source. +clearcoatRoughnessMap,this.clearcoatNormalMap=source.clearcoatNormalMap,this.clearcoatNormalScale. +copy(source.clearcoatNormalScale),this.ior=source.ior,this.iridescence=source.iridescence, +this.iridescenceMap=source.iridescenceMap,this.iridescenceIOR=source.iridescenceIOR, +this.iridescenceThicknessRange=[...source.iridescenceThicknessRange],this.iridescenceThicknessMap= +source.iridescenceThicknessMap,this.sheen=source.sheen,this.sheenColor.copy(source. +sheenColor),this.sheenColorMap=source.sheenColorMap,this.sheenRoughness=source.sheenRoughness, +this.sheenRoughnessMap=source.sheenRoughnessMap,this.transmission=source.transmission, +this.transmissionMap=source.transmissionMap,this.thickness=source.thickness,this. +thicknessMap=source.thicknessMap,this.attenuationDistance=source.attenuationDistance, +this.attenuationColor.copy(source.attenuationColor),this.specularIntensity=source. +specularIntensity,this.specularIntensityMap=source.specularIntensityMap,this.specularColor. +copy(source.specularColor),this.specularColorMap=source.specularColorMap,this}};var __esDecorate24=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers24=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=MaterialBehavior,_instanceExtraInitializers=[], +_alphaMap_decorators,_alphaMap_initializers=[],_aoMap_decorators,_aoMap_initializers=[], +_aoMapIntensity_decorators,_aoMapIntensity_initializers=[],_bumpMap_decorators,_bumpMap_initializers=[], +_bumpScale_decorators,_bumpScale_initializers=[],_displacementMap_decorators,_displacementMap_initializers=[], +_displacementScale_decorators,_displacementScale_initializers=[],_displacementBias_decorators, +_displacementBias_initializers=[],_texture_decorators,_texture_initializers=[],_normalMap_decorators, +_normalMap_initializers=[],_normalScale_decorators,_normalScale_initializers=[], +_metalness_decorators,_metalness_initializers=[],_metalnessMap_decorators,_metalnessMap_initializers=[], +_roughness_decorators,_roughness_initializers=[],_roughnessMap_decorators,_roughnessMap_initializers=[], +_vertexTangents_decorators,_vertexTangents_initializers=[],_morphTargets_decorators, +_morphTargets_initializers=[],_morphNormals_decorators,_morphNormals_initializers=[]; +var StandardMaterialBehavior2=class extends _classSuper{static{__name(this,"Stan\ +dardMaterialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_alphaMap_decorators=[stringAttribute,receiver],_aoMap_decorators=[stringAttribute, +receiver],_aoMapIntensity_decorators=[numberAttribute,receiver],_bumpMap_decorators= +[stringAttribute,receiver],_bumpScale_decorators=[numberAttribute,receiver],_displacementMap_decorators= +[stringAttribute,receiver],_displacementScale_decorators=[numberAttribute,receiver], +_displacementBias_decorators=[numberAttribute,receiver],_texture_decorators=[stringAttribute, +receiver],_normalMap_decorators=[stringAttribute,receiver],_normalScale_decorators= +[numberAttribute,receiver],_metalness_decorators=[numberAttribute,receiver],_metalnessMap_decorators= +[stringAttribute,receiver],_roughness_decorators=[numberAttribute,receiver],_roughnessMap_decorators= +[stringAttribute,receiver],_vertexTangents_decorators=[booleanAttribute,receiver], +_morphTargets_decorators=[booleanAttribute,receiver],_morphNormals_decorators=[booleanAttribute, +receiver],__esDecorate24(null,null,_alphaMap_decorators,{kind:"field",name:"alph\ +aMap",static:!1,private:!1,access:{has:obj=>"alphaMap"in obj,get:obj=>obj.alphaMap, +set:(obj,value)=>{obj.alphaMap=value}},metadata:_metadata},_alphaMap_initializers, +_instanceExtraInitializers),__esDecorate24(null,null,_aoMap_decorators,{kind:"fi\ +eld",name:"aoMap",static:!1,private:!1,access:{has:obj=>"aoMap"in obj,get:obj=>obj. +aoMap,set:(obj,value)=>{obj.aoMap=value}},metadata:_metadata},_aoMap_initializers, +_instanceExtraInitializers),__esDecorate24(null,null,_aoMapIntensity_decorators, +{kind:"field",name:"aoMapIntensity",static:!1,private:!1,access:{has:obj=>"aoMap\ +Intensity"in obj,get:obj=>obj.aoMapIntensity,set:(obj,value)=>{obj.aoMapIntensity= +value}},metadata:_metadata},_aoMapIntensity_initializers,_instanceExtraInitializers), +__esDecorate24(null,null,_bumpMap_decorators,{kind:"field",name:"bumpMap",static:!1, +private:!1,access:{has:obj=>"bumpMap"in obj,get:obj=>obj.bumpMap,set:(obj,value)=>{ +obj.bumpMap=value}},metadata:_metadata},_bumpMap_initializers,_instanceExtraInitializers), +__esDecorate24(null,null,_bumpScale_decorators,{kind:"field",name:"bumpScale",static:!1, +private:!1,access:{has:obj=>"bumpScale"in obj,get:obj=>obj.bumpScale,set:(obj,value)=>{ +obj.bumpScale=value}},metadata:_metadata},_bumpScale_initializers,_instanceExtraInitializers), +__esDecorate24(null,null,_displacementMap_decorators,{kind:"field",name:"displac\ +ementMap",static:!1,private:!1,access:{has:obj=>"displacementMap"in obj,get:obj=>obj. +displacementMap,set:(obj,value)=>{obj.displacementMap=value}},metadata:_metadata}, +_displacementMap_initializers,_instanceExtraInitializers),__esDecorate24(null,null, +_displacementScale_decorators,{kind:"field",name:"displacementScale",static:!1,private:!1, +access:{has:obj=>"displacementScale"in obj,get:obj=>obj.displacementScale,set:(obj,value)=>{ +obj.displacementScale=value}},metadata:_metadata},_displacementScale_initializers, +_instanceExtraInitializers),__esDecorate24(null,null,_displacementBias_decorators, +{kind:"field",name:"displacementBias",static:!1,private:!1,access:{has:obj=>"dis\ +placementBias"in obj,get:obj=>obj.displacementBias,set:(obj,value)=>{obj.displacementBias= +value}},metadata:_metadata},_displacementBias_initializers,_instanceExtraInitializers), +__esDecorate24(null,null,_texture_decorators,{kind:"field",name:"texture",static:!1, +private:!1,access:{has:obj=>"texture"in obj,get:obj=>obj.texture,set:(obj,value)=>{ +obj.texture=value}},metadata:_metadata},_texture_initializers,_instanceExtraInitializers), +__esDecorate24(null,null,_normalMap_decorators,{kind:"field",name:"normalMap",static:!1, +private:!1,access:{has:obj=>"normalMap"in obj,get:obj=>obj.normalMap,set:(obj,value)=>{ +obj.normalMap=value}},metadata:_metadata},_normalMap_initializers,_instanceExtraInitializers), +__esDecorate24(null,null,_normalScale_decorators,{kind:"field",name:"normalScale", +static:!1,private:!1,access:{has:obj=>"normalScale"in obj,get:obj=>obj.normalScale, +set:(obj,value)=>{obj.normalScale=value}},metadata:_metadata},_normalScale_initializers, +_instanceExtraInitializers),__esDecorate24(null,null,_metalness_decorators,{kind:"\ +field",name:"metalness",static:!1,private:!1,access:{has:obj=>"metalness"in obj, +get:obj=>obj.metalness,set:(obj,value)=>{obj.metalness=value}},metadata:_metadata}, +_metalness_initializers,_instanceExtraInitializers),__esDecorate24(null,null,_metalnessMap_decorators, +{kind:"field",name:"metalnessMap",static:!1,private:!1,access:{has:obj=>"metalne\ +ssMap"in obj,get:obj=>obj.metalnessMap,set:(obj,value)=>{obj.metalnessMap=value}}, +metadata:_metadata},_metalnessMap_initializers,_instanceExtraInitializers),__esDecorate24( +null,null,_roughness_decorators,{kind:"field",name:"roughness",static:!1,private:!1, +access:{has:obj=>"roughness"in obj,get:obj=>obj.roughness,set:(obj,value)=>{obj. +roughness=value}},metadata:_metadata},_roughness_initializers,_instanceExtraInitializers), +__esDecorate24(null,null,_roughnessMap_decorators,{kind:"field",name:"roughnessM\ +ap",static:!1,private:!1,access:{has:obj=>"roughnessMap"in obj,get:obj=>obj.roughnessMap, +set:(obj,value)=>{obj.roughnessMap=value}},metadata:_metadata},_roughnessMap_initializers, +_instanceExtraInitializers),__esDecorate24(null,null,_vertexTangents_decorators, +{kind:"field",name:"vertexTangents",static:!1,private:!1,access:{has:obj=>"verte\ +xTangents"in obj,get:obj=>obj.vertexTangents,set:(obj,value)=>{obj.vertexTangents= +value}},metadata:_metadata},_vertexTangents_initializers,_instanceExtraInitializers), +__esDecorate24(null,null,_morphTargets_decorators,{kind:"field",name:"morphTarge\ +ts",static:!1,private:!1,access:{has:obj=>"morphTargets"in obj,get:obj=>obj.morphTargets, +set:(obj,value)=>{obj.morphTargets=value}},metadata:_metadata},_morphTargets_initializers, +_instanceExtraInitializers),__esDecorate24(null,null,_morphNormals_decorators,{kind:"\ +field",name:"morphNormals",static:!1,private:!1,access:{has:obj=>"morphNormals"in +obj,get:obj=>obj.morphNormals,set:(obj,value)=>{obj.morphNormals=value}},metadata:_metadata}, +_morphNormals_initializers,_instanceExtraInitializers),__esDecorate24(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),StandardMaterialBehavior2=_classThis=_classDescriptor. +value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0, +configurable:!0,writable:!0,value:_metadata}),__runInitializers24(_classThis,_classExtraInitializers)}alphaMap=(__runInitializers24( +this,_instanceExtraInitializers),__runInitializers24(this,_alphaMap_initializers, +""));aoMap=__runInitializers24(this,_aoMap_initializers,"");aoMapIntensity=__runInitializers24( +this,_aoMapIntensity_initializers,1);bumpMap=__runInitializers24(this,_bumpMap_initializers, +"");bumpScale=__runInitializers24(this,_bumpScale_initializers,1);displacementMap=__runInitializers24( +this,_displacementMap_initializers,"");displacementScale=__runInitializers24(this, +_displacementScale_initializers,1);displacementBias=__runInitializers24(this,_displacementBias_initializers, +0);texture=__runInitializers24(this,_texture_initializers,"");normalMap=__runInitializers24( +this,_normalMap_initializers,"");normalScale=__runInitializers24(this,_normalScale_initializers, +1);metalness=__runInitializers24(this,_metalness_initializers,0);metalnessMap=__runInitializers24( +this,_metalnessMap_initializers,"");roughness=__runInitializers24(this,_roughness_initializers, +1);roughnessMap=__runInitializers24(this,_roughnessMap_initializers,"");vertexTangents=__runInitializers24( +this,_vertexTangents_initializers,!1);morphTargets=__runInitializers24(this,_morphTargets_initializers, +!1);morphNormals=__runInitializers24(this,_morphNormals_initializers,!1);_createComponent(){ +return new MeshStandardMaterial2}connectedCallback(){super.connectedCallback(),this. +createEffect(()=>{let mat=this.meshComponent;mat&&(mat.aoMapIntensity=this.aoMapIntensity, +mat.bumpScale=this.bumpScale,mat.displacementScale=this.displacementScale,mat.displacementBias= +this.displacementBias,mat.normalScale.set(this.normalScale,this.normalScale),mat. +metalness=this.metalness,mat.roughness=this.roughness,this.element.needsUpdate())}), +this._handleTexture(()=>this.alphaMap,(mat,tex)=>mat.alphaMap=tex,mat=>!!mat.alphaMap), +this._handleTexture(()=>this.aoMap,(mat,tex)=>mat.aoMap=tex,mat=>!!mat.aoMap),this. +_handleTexture(()=>this.bumpMap,(mat,tex)=>mat.bumpMap=tex,mat=>!!mat.bumpMap),this. +_handleTexture(()=>this.displacementMap,(mat,tex)=>mat.displacementMap=tex,mat=>!!mat. +displacementMap),this._handleTexture(()=>this.texture,(mat,tex)=>mat.map=tex,mat=>!!mat. +map,()=>{},!0),this._handleTexture(()=>this.normalMap,(mat,tex)=>mat.normalMap=tex, +mat=>!!mat.normalMap),this._handleTexture(()=>this.metalnessMap,(mat,tex)=>mat.metalnessMap= +tex,mat=>!!mat.metalnessMap),this._handleTexture(()=>this.roughnessMap,(mat,tex)=>mat. +roughnessMap=tex,mat=>!!mat.roughnessMap)}};return StandardMaterialBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("standard-material")&&elementBehaviors. +define("standard-material",StandardMaterialBehavior);var __esDecorate25=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers25=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=StandardMaterialBehavior,_instanceExtraInitializers=[], +_clearcoat_decorators,_clearcoat_initializers=[],_clearcoatRoughness_decorators, +_clearcoatRoughness_initializers=[],_refractiveIndex_decorators,_refractiveIndex_initializers=[], +_reflectivity_decorators,_reflectivity_initializers=[],_transmission_decorators, +_transmission_initializers=[],_transmissionMap_decorators,_transmissionMap_initializers=[]; +var PhysicalMaterialBehavior2=class extends _classSuper{static{__name(this,"Phys\ +icalMaterialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_clearcoat_decorators=[numberAttribute,receiver],_clearcoatRoughness_decorators= +[numberAttribute,receiver],_refractiveIndex_decorators=[numberAttribute,receiver], +_reflectivity_decorators=[numberAttribute,receiver],_transmission_decorators=[numberAttribute, +receiver],_transmissionMap_decorators=[stringAttribute,receiver],__esDecorate25( +null,null,_clearcoat_decorators,{kind:"field",name:"clearcoat",static:!1,private:!1, +access:{has:obj=>"clearcoat"in obj,get:obj=>obj.clearcoat,set:(obj,value)=>{obj. +clearcoat=value}},metadata:_metadata},_clearcoat_initializers,_instanceExtraInitializers), +__esDecorate25(null,null,_clearcoatRoughness_decorators,{kind:"field",name:"clea\ +rcoatRoughness",static:!1,private:!1,access:{has:obj=>"clearcoatRoughness"in obj, +get:obj=>obj.clearcoatRoughness,set:(obj,value)=>{obj.clearcoatRoughness=value}}, +metadata:_metadata},_clearcoatRoughness_initializers,_instanceExtraInitializers), +__esDecorate25(null,null,_refractiveIndex_decorators,{kind:"field",name:"refract\ +iveIndex",static:!1,private:!1,access:{has:obj=>"refractiveIndex"in obj,get:obj=>obj. +refractiveIndex,set:(obj,value)=>{obj.refractiveIndex=value}},metadata:_metadata}, +_refractiveIndex_initializers,_instanceExtraInitializers),__esDecorate25(null,null, +_reflectivity_decorators,{kind:"field",name:"reflectivity",static:!1,private:!1, +access:{has:obj=>"reflectivity"in obj,get:obj=>obj.reflectivity,set:(obj,value)=>{ +obj.reflectivity=value}},metadata:_metadata},_reflectivity_initializers,_instanceExtraInitializers), +__esDecorate25(null,null,_transmission_decorators,{kind:"field",name:"transmissi\ +on",static:!1,private:!1,access:{has:obj=>"transmission"in obj,get:obj=>obj.transmission, +set:(obj,value)=>{obj.transmission=value}},metadata:_metadata},_transmission_initializers, +_instanceExtraInitializers),__esDecorate25(null,null,_transmissionMap_decorators, +{kind:"field",name:"transmissionMap",static:!1,private:!1,access:{has:obj=>"tran\ +smissionMap"in obj,get:obj=>obj.transmissionMap,set:(obj,value)=>{obj.transmissionMap= +value}},metadata:_metadata},_transmissionMap_initializers,_instanceExtraInitializers), +__esDecorate25(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),PhysicalMaterialBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers25( +_classThis,_classExtraInitializers)}clearcoat=(__runInitializers25(this,_instanceExtraInitializers), +__runInitializers25(this,_clearcoat_initializers,0));clearcoatRoughness=__runInitializers25( +this,_clearcoatRoughness_initializers,0);refractiveIndex=__runInitializers25(this, +_refractiveIndex_initializers,1.5);reflectivity=__runInitializers25(this,_reflectivity_initializers, +.5);transmission=__runInitializers25(this,_transmission_initializers,0);transmissionMap=__runInitializers25( +this,_transmissionMap_initializers,"");_createComponent(){return new MeshPhysicalMaterial2( +{})}connectedCallback(){super.connectedCallback(),this.createEffect(()=>{let mat=this. +meshComponent;mat&&(mat.clearcoat=this.clearcoat,mat.clearcoatRoughness=this.clearcoatRoughness, +mat.ior=this.refractiveIndex,mat.reflectivity=this.reflectivity,mat.transmission= +this.transmission,this.element.needsUpdate())}),this._handleTexture(()=>this.transmissionMap, +(mat,tex)=>mat.transmissionMap=tex,mat=>!!mat.transmissionMap)}};return PhysicalMaterialBehavior2= +_classThis})();globalThis.window?.document&&!elementBehaviors.has("physical-material")&&elementBehaviors. +define("physical-material",PhysicalMaterialBehavior);var MixedPlaneMaterialBehavior=class extends PhysicalMaterialBehavior{static{__name( +this,"MixedPlaneMaterialBehavior")}constructor(element2){super(element2),this.materialOpacity= +.3,this.color="#444"}_createComponent(){return new MeshPhysicalMaterial2({blending:NoBlending})}}; +globalThis.window?.document&&!elementBehaviors.has("mixedplane-material")&&elementBehaviors. +define("mixedplane-material",MixedPlaneMaterialBehavior);var __esDecorate26=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers26=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=MaterialBehavior,_instanceExtraInitializers=[], +_alphaMap_decorators,_alphaMap_initializers=[],_aoMap_decorators,_aoMap_initializers=[], +_aoMapIntensity_decorators,_aoMapIntensity_initializers=[],_bumpMap_decorators,_bumpMap_initializers=[], +_bumpScale_decorators,_bumpScale_initializers=[],_displacementMap_decorators,_displacementMap_initializers=[], +_displacementScale_decorators,_displacementScale_initializers=[],_displacementBias_decorators, +_displacementBias_initializers=[],_emissiveMap_decorators,_emissiveMap_initializers=[], +_get_emissive_decorators,_emissiveIntensity_decorators,_emissiveIntensity_initializers=[], +_envMap_decorators,_envMap_initializers=[],_flatShading_decorators,_flatShading_initializers=[], +_lightMap_decorators,_lightMap_initializers=[],_lightMapIntensity_decorators,_lightMapIntensity_initializers=[], +_texture_decorators,_texture_initializers=[],_normalMap_decorators,_normalMap_initializers=[], +_normalScale_decorators,_normalScale_initializers=[],_reflectivity_decorators,_reflectivity_initializers=[], +_specularMap_decorators,_specularMap_initializers=[],_get_specular_decorators,_shininess_decorators, +_shininess_initializers=[];var PhongMaterialBehavior2=class extends _classSuper{static{ +__name(this,"PhongMaterialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_alphaMap_decorators=[stringAttribute,receiver],_aoMap_decorators=[stringAttribute, +receiver],_aoMapIntensity_decorators=[numberAttribute,receiver],_bumpMap_decorators= +[stringAttribute,receiver],_bumpScale_decorators=[numberAttribute,receiver],_displacementMap_decorators= +[stringAttribute,receiver],_displacementScale_decorators=[numberAttribute,receiver], +_displacementBias_decorators=[numberAttribute,receiver],_emissiveMap_decorators= +[stringAttribute,receiver],_get_emissive_decorators=[stringAttribute,receiver],_emissiveIntensity_decorators= +[numberAttribute,receiver],_envMap_decorators=[stringAttribute,receiver],_flatShading_decorators= +[booleanAttribute,receiver],_lightMap_decorators=[stringAttribute,receiver],_lightMapIntensity_decorators= +[numberAttribute,receiver],_texture_decorators=[stringAttribute,receiver],_normalMap_decorators= +[stringAttribute,receiver],_normalScale_decorators=[numberAttribute,receiver],_reflectivity_decorators= +[numberAttribute,receiver],_specularMap_decorators=[stringAttribute,receiver],_get_specular_decorators= +[stringAttribute,receiver],_shininess_decorators=[numberAttribute,receiver],__esDecorate26( +this,null,_get_emissive_decorators,{kind:"getter",name:"emissive",static:!1,private:!1, +access:{has:obj=>"emissive"in obj,get:obj=>obj.emissive},metadata:_metadata},null, +_instanceExtraInitializers),__esDecorate26(this,null,_get_specular_decorators,{kind:"\ +getter",name:"specular",static:!1,private:!1,access:{has:obj=>"specular"in obj,get:obj=>obj. +specular},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate26(null, +null,_alphaMap_decorators,{kind:"field",name:"alphaMap",static:!1,private:!1,access:{ +has:obj=>"alphaMap"in obj,get:obj=>obj.alphaMap,set:(obj,value)=>{obj.alphaMap=value}}, +metadata:_metadata},_alphaMap_initializers,_instanceExtraInitializers),__esDecorate26( +null,null,_aoMap_decorators,{kind:"field",name:"aoMap",static:!1,private:!1,access:{ +has:obj=>"aoMap"in obj,get:obj=>obj.aoMap,set:(obj,value)=>{obj.aoMap=value}},metadata:_metadata}, +_aoMap_initializers,_instanceExtraInitializers),__esDecorate26(null,null,_aoMapIntensity_decorators, +{kind:"field",name:"aoMapIntensity",static:!1,private:!1,access:{has:obj=>"aoMap\ +Intensity"in obj,get:obj=>obj.aoMapIntensity,set:(obj,value)=>{obj.aoMapIntensity= +value}},metadata:_metadata},_aoMapIntensity_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_bumpMap_decorators,{kind:"field",name:"bumpMap",static:!1, +private:!1,access:{has:obj=>"bumpMap"in obj,get:obj=>obj.bumpMap,set:(obj,value)=>{ +obj.bumpMap=value}},metadata:_metadata},_bumpMap_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_bumpScale_decorators,{kind:"field",name:"bumpScale",static:!1, +private:!1,access:{has:obj=>"bumpScale"in obj,get:obj=>obj.bumpScale,set:(obj,value)=>{ +obj.bumpScale=value}},metadata:_metadata},_bumpScale_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_displacementMap_decorators,{kind:"field",name:"displac\ +ementMap",static:!1,private:!1,access:{has:obj=>"displacementMap"in obj,get:obj=>obj. +displacementMap,set:(obj,value)=>{obj.displacementMap=value}},metadata:_metadata}, +_displacementMap_initializers,_instanceExtraInitializers),__esDecorate26(null,null, +_displacementScale_decorators,{kind:"field",name:"displacementScale",static:!1,private:!1, +access:{has:obj=>"displacementScale"in obj,get:obj=>obj.displacementScale,set:(obj,value)=>{ +obj.displacementScale=value}},metadata:_metadata},_displacementScale_initializers, +_instanceExtraInitializers),__esDecorate26(null,null,_displacementBias_decorators, +{kind:"field",name:"displacementBias",static:!1,private:!1,access:{has:obj=>"dis\ +placementBias"in obj,get:obj=>obj.displacementBias,set:(obj,value)=>{obj.displacementBias= +value}},metadata:_metadata},_displacementBias_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_emissiveMap_decorators,{kind:"field",name:"emissiveMap", +static:!1,private:!1,access:{has:obj=>"emissiveMap"in obj,get:obj=>obj.emissiveMap, +set:(obj,value)=>{obj.emissiveMap=value}},metadata:_metadata},_emissiveMap_initializers, +_instanceExtraInitializers),__esDecorate26(null,null,_emissiveIntensity_decorators, +{kind:"field",name:"emissiveIntensity",static:!1,private:!1,access:{has:obj=>"em\ +issiveIntensity"in obj,get:obj=>obj.emissiveIntensity,set:(obj,value)=>{obj.emissiveIntensity= +value}},metadata:_metadata},_emissiveIntensity_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_envMap_decorators,{kind:"field",name:"envMap",static:!1, +private:!1,access:{has:obj=>"envMap"in obj,get:obj=>obj.envMap,set:(obj,value)=>{ +obj.envMap=value}},metadata:_metadata},_envMap_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_flatShading_decorators,{kind:"field",name:"flatShading", +static:!1,private:!1,access:{has:obj=>"flatShading"in obj,get:obj=>obj.flatShading, +set:(obj,value)=>{obj.flatShading=value}},metadata:_metadata},_flatShading_initializers, +_instanceExtraInitializers),__esDecorate26(null,null,_lightMap_decorators,{kind:"\ +field",name:"lightMap",static:!1,private:!1,access:{has:obj=>"lightMap"in obj,get:obj=>obj. +lightMap,set:(obj,value)=>{obj.lightMap=value}},metadata:_metadata},_lightMap_initializers, +_instanceExtraInitializers),__esDecorate26(null,null,_lightMapIntensity_decorators, +{kind:"field",name:"lightMapIntensity",static:!1,private:!1,access:{has:obj=>"li\ +ghtMapIntensity"in obj,get:obj=>obj.lightMapIntensity,set:(obj,value)=>{obj.lightMapIntensity= +value}},metadata:_metadata},_lightMapIntensity_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_texture_decorators,{kind:"field",name:"texture",static:!1, +private:!1,access:{has:obj=>"texture"in obj,get:obj=>obj.texture,set:(obj,value)=>{ +obj.texture=value}},metadata:_metadata},_texture_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_normalMap_decorators,{kind:"field",name:"normalMap",static:!1, +private:!1,access:{has:obj=>"normalMap"in obj,get:obj=>obj.normalMap,set:(obj,value)=>{ +obj.normalMap=value}},metadata:_metadata},_normalMap_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_normalScale_decorators,{kind:"field",name:"normalScale", +static:!1,private:!1,access:{has:obj=>"normalScale"in obj,get:obj=>obj.normalScale, +set:(obj,value)=>{obj.normalScale=value}},metadata:_metadata},_normalScale_initializers, +_instanceExtraInitializers),__esDecorate26(null,null,_reflectivity_decorators,{kind:"\ +field",name:"reflectivity",static:!1,private:!1,access:{has:obj=>"reflectivity"in +obj,get:obj=>obj.reflectivity,set:(obj,value)=>{obj.reflectivity=value}},metadata:_metadata}, +_reflectivity_initializers,_instanceExtraInitializers),__esDecorate26(null,null, +_specularMap_decorators,{kind:"field",name:"specularMap",static:!1,private:!1,access:{ +has:obj=>"specularMap"in obj,get:obj=>obj.specularMap,set:(obj,value)=>{obj.specularMap= +value}},metadata:_metadata},_specularMap_initializers,_instanceExtraInitializers), +__esDecorate26(null,null,_shininess_decorators,{kind:"field",name:"shininess",static:!1, +private:!1,access:{has:obj=>"shininess"in obj,get:obj=>obj.shininess,set:(obj,value)=>{ +obj.shininess=value}},metadata:_metadata},_shininess_initializers,_instanceExtraInitializers), +__esDecorate26(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),PhongMaterialBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers26( +_classThis,_classExtraInitializers)}alphaMap=(__runInitializers26(this,_instanceExtraInitializers), +__runInitializers26(this,_alphaMap_initializers,""));aoMap=__runInitializers26(this, +_aoMap_initializers,"");aoMapIntensity=__runInitializers26(this,_aoMapIntensity_initializers, +1);bumpMap=__runInitializers26(this,_bumpMap_initializers,"");bumpScale=__runInitializers26( +this,_bumpScale_initializers,1);displacementMap=__runInitializers26(this,_displacementMap_initializers, +"");displacementScale=__runInitializers26(this,_displacementScale_initializers,1);displacementBias=__runInitializers26( +this,_displacementBias_initializers,0);emissiveMap=__runInitializers26(this,_emissiveMap_initializers, +"");get emissive(){return this.#emissive}set emissive(val){typeof val=="object"? +this.#emissive=val.getStyle():this.#emissive=val}#emissive="black";emissiveIntensity=__runInitializers26( +this,_emissiveIntensity_initializers,1);envMap=__runInitializers26(this,_envMap_initializers, +"");flatShading=__runInitializers26(this,_flatShading_initializers,!1);lightMap=__runInitializers26( +this,_lightMap_initializers,"");lightMapIntensity=__runInitializers26(this,_lightMapIntensity_initializers, +1);texture=__runInitializers26(this,_texture_initializers,"");normalMap=__runInitializers26( +this,_normalMap_initializers,"");normalScale=__runInitializers26(this,_normalScale_initializers, +1);reflectivity=__runInitializers26(this,_reflectivity_initializers,1);specularMap=__runInitializers26( +this,_specularMap_initializers,"");get specular(){return this.#specular}set specular(val){ +typeof val=="object"?this.#specular=val.getStyle():this.#specular=val}#specular="\ +#111";shininess=__runInitializers26(this,_shininess_initializers,30);_createComponent(){ +return new MeshPhongMaterial({color:65280})}connectedCallback(){super.connectedCallback(), +this.createEffect(()=>{let mat=this.meshComponent;mat&&(mat.aoMapIntensity=this. +aoMapIntensity,mat.bumpScale=this.bumpScale,mat.displacementScale=this.displacementScale, +mat.displacementBias=this.displacementBias,mat.emissiveIntensity=this.emissiveIntensity, +mat.flatShading=this.flatShading,mat.lightMapIntensity=this.lightMapIntensity,mat. +normalScale.set(this.normalScale,this.normalScale),mat.reflectivity=this.reflectivity, +mat.shininess=this.shininess,this.element.needsUpdate())}),this.createEffect(()=>{ +this.meshComponent?.emissive.set(this.emissive),this.element.needsUpdate()}),this. +createEffect(()=>{this.meshComponent?.specular.set(this.specular),this.element.needsUpdate()}), +this._handleTexture(()=>this.alphaMap,(mat,tex)=>mat.alphaMap=tex,mat=>!!mat.alphaMap), +this._handleTexture(()=>this.aoMap,(mat,tex)=>mat.aoMap=tex,mat=>!!mat.aoMap),this. +_handleTexture(()=>this.bumpMap,(mat,tex)=>mat.bumpMap=tex,mat=>!!mat.bumpMap),this. +_handleTexture(()=>this.displacementMap,(mat,tex)=>mat.displacementMap=tex,mat=>!!mat. +displacementMap),this._handleTexture(()=>this.emissiveMap,(mat,tex)=>mat.emissiveMap= +tex,mat=>!!mat.emissiveMap,()=>{},!0),this._handleTexture(()=>this.envMap,(mat,tex)=>mat. +envMap=tex,mat=>!!mat.envMap),this._handleTexture(()=>this.lightMap,(mat,tex)=>mat. +lightMap=tex,mat=>!!mat.lightMap),this._handleTexture(()=>this.texture,(mat,tex)=>mat. +map=tex,mat=>!!mat.map,()=>{},!0),this._handleTexture(()=>this.normalMap,(mat,tex)=>mat. +normalMap=tex,mat=>!!mat.normalMap),this._handleTexture(()=>this.specularMap,(mat,tex)=>mat. +specularMap=tex,mat=>!!mat.specularMap,()=>{},!0)}};return PhongMaterialBehavior2= +_classThis})();globalThis.window?.document&&!elementBehaviors.has("phong-material")&&elementBehaviors. +define("phong-material",PhongMaterialBehavior);var __esDecorate27=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers27=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=MaterialBehavior,_instanceExtraInitializers=[], +_texture_decorators,_texture_initializers=[],_sizeAttenuation_decorators,_sizeAttenuation_initializers=[], +_pointSize_decorators,_pointSize_initializers=[];var PointsMaterialBehavior2=class extends _classSuper{static{ +__name(this,"PointsMaterialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_texture_decorators=[stringAttribute,receiver],_sizeAttenuation_decorators=[booleanAttribute, +receiver],_pointSize_decorators=[numberAttribute,receiver],__esDecorate27(null,null, +_texture_decorators,{kind:"field",name:"texture",static:!1,private:!1,access:{has:obj=>"\ +texture"in obj,get:obj=>obj.texture,set:(obj,value)=>{obj.texture=value}},metadata:_metadata}, +_texture_initializers,_instanceExtraInitializers),__esDecorate27(null,null,_sizeAttenuation_decorators, +{kind:"field",name:"sizeAttenuation",static:!1,private:!1,access:{has:obj=>"size\ +Attenuation"in obj,get:obj=>obj.sizeAttenuation,set:(obj,value)=>{obj.sizeAttenuation= +value}},metadata:_metadata},_sizeAttenuation_initializers,_instanceExtraInitializers), +__esDecorate27(null,null,_pointSize_decorators,{kind:"field",name:"pointSize",static:!1, +private:!1,access:{has:obj=>"pointSize"in obj,get:obj=>obj.pointSize,set:(obj,value)=>{ +obj.pointSize=value}},metadata:_metadata},_pointSize_initializers,_instanceExtraInitializers), +__esDecorate27(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),PointsMaterialBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers27( +_classThis,_classExtraInitializers)}texture=(__runInitializers27(this,_instanceExtraInitializers), +__runInitializers27(this,_texture_initializers,""));sizeAttenuation=__runInitializers27( +this,_sizeAttenuation_initializers,!0);pointSize=__runInitializers27(this,_pointSize_initializers, +1);_createComponent(){return new PointsMaterial({color:65280})}connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{let mat=this.meshComponent;mat&& +(mat.sizeAttenuation=this.sizeAttenuation,mat.size=this.pointSize,this.element.needsUpdate())}), +this._handleTexture(()=>this.texture,(mat,tex)=>mat.map=tex,mat=>!!mat.map,()=>{}, +!0)}};return PointsMaterialBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("points-material")&&elementBehaviors. +define("points-material",PointsMaterialBehavior);var Camera2=class extends Object3D{static{__name(this,"Camera")}constructor(){super(), +this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this.projectionMatrix= +new Matrix4,this.projectionMatrixInverse=new Matrix4,this.coordinateSystem=WebGLCoordinateSystem}copy(source,recursive){ +return super.copy(source,recursive),this.matrixWorldInverse.copy(source.matrixWorldInverse), +this.projectionMatrix.copy(source.projectionMatrix),this.projectionMatrixInverse. +copy(source.projectionMatrixInverse),this.coordinateSystem=source.coordinateSystem, +this}getWorldDirection(target){return super.getWorldDirection(target).negate()}updateMatrixWorld(force){ +super.updateMatrixWorld(force),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(updateParents,updateChildren){ +super.updateWorldMatrix(updateParents,updateChildren),this.matrixWorldInverse.copy( +this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};var PerspectiveCamera2=class extends Camera2{static{__name(this,"PerspectiveCame\ +ra")}constructor(fov3=50,aspect3=1,near=.1,far=2e3){super(),this.isPerspectiveCamera= +!0,this.type="PerspectiveCamera",this.fov=fov3,this.zoom=1,this.near=near,this.far= +far,this.focus=10,this.aspect=aspect3,this.view=null,this.filmGauge=35,this.filmOffset= +0,this.updateProjectionMatrix()}copy(source,recursive){return super.copy(source, +recursive),this.fov=source.fov,this.zoom=source.zoom,this.near=source.near,this. +far=source.far,this.focus=source.focus,this.aspect=source.aspect,this.view=source. +view===null?null:Object.assign({},source.view),this.filmGauge=source.filmGauge,this. +filmOffset=source.filmOffset,this}setFocalLength(focalLength){let vExtentSlope=.5* +this.getFilmHeight()/focalLength;this.fov=RAD2DEG*2*Math.atan(vExtentSlope),this. +updateProjectionMatrix()}getFocalLength(){let vExtentSlope=Math.tan(DEG2RAD*.5*this. +fov);return .5*this.getFilmHeight()/vExtentSlope}getEffectiveFOV(){return RAD2DEG* +2*Math.atan(Math.tan(DEG2RAD*.5*this.fov)/this.zoom)}getFilmWidth(){return this. +filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max( +this.aspect,1)}setViewOffset(fullWidth,fullHeight,x2,y2,width,height){this.aspect= +fullWidth/fullHeight,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1, +offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth= +fullWidth,this.view.fullHeight=fullHeight,this.view.offsetX=x2,this.view.offsetY= +y2,this.view.width=width,this.view.height=height,this.updateProjectionMatrix()}clearViewOffset(){ +this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){ +let near=this.near,top=near*Math.tan(DEG2RAD*.5*this.fov)/this.zoom,height=2*top, +width=this.aspect*height,left=-.5*width,view=this.view;if(this.view!==null&&this. +view.enabled){let fullWidth=view.fullWidth,fullHeight=view.fullHeight;left+=view. +offsetX*width/fullWidth,top-=view.offsetY*height/fullHeight,width*=view.width/fullWidth, +height*=view.height/fullHeight}let skew=this.filmOffset;skew!==0&&(left+=near*skew/ +this.getFilmWidth()),this.projectionMatrix.makePerspective(left,left+width,top,top- +height,near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this. +projectionMatrix).invert()}toJSON(meta){let data=super.toJSON(meta);return data. +object.fov=this.fov,data.object.zoom=this.zoom,data.object.near=this.near,data.object. +far=this.far,data.object.focus=this.focus,data.object.aspect=this.aspect,this.view!== +null&&(data.object.view=Object.assign({},this.view)),data.object.filmGauge=this. +filmGauge,data.object.filmOffset=this.filmOffset,data}};function monkeyPatch(shader,{defines={},header="",main="",...replacements}){let patchedShader=shader, +replaceAll=__name((str,find,rep)=>str.split(find).join(rep),"replaceAll");return Object. +keys(replacements).forEach(key2=>{patchedShader=replaceAll(patchedShader,key2,replacements[key2])}), +patchedShader=patchedShader.replace("void main() {",` + ${header} + void main() { + ${main} + `),` + ${Object.keys(defines).map(d2=>`#define ${d2} ${defines[d2]}`).join(` +`)} + ${patchedShader} + `}__name(monkeyPatch,"monkeyPatch");function addLoadListener(texture,callback){ +if(texture.image&&texture.image.videoWidth!==0&&texture.image.videoHeight!==0)return; +let interval=setInterval(()=>{if(texture.image&&texture.image.videoWidth!==0&&texture. +image.videoHeight!==0)return clearInterval(interval),callback(texture)},16)}__name( +addLoadListener,"addLoadListener");var version="0.3.1";var ProjectedMaterial=class extends MeshPhysicalMaterial2{static{__name(this,"Pr\ +ojectedMaterial")}static version=version;#camera=new PerspectiveCamera2;#fitment="\ +contain";#textureScale=1;get camera(){return this.#camera}set camera(camera){if(!camera|| +!camera.isCamera)throw new Error("Invalid camera set to the ProjectedMaterial"); +this.#camera=camera,this.#saveDimensions(),this.needsUpdate=!0,this.onBeforeCompile= +isPerspectiveCamera2(this.#camera)?this.#onBeforeCompilePerspective:this.#onBeforeCompileOrtho}get texture(){ +return this.uniforms.projectedTexture.value}set texture(texture){if(!texture?.isTexture) +throw new Error("Invalid texture set to the ProjectedMaterial");this.uniforms.projectedTexture. +value=texture,this.uniforms.isTextureLoaded.value=!!texture.image,this.uniforms. +isTextureLoaded.value?this.#saveDimensions():addLoadListener(texture,()=>{this.uniforms. +isTextureLoaded.value=!0,this.#saveDimensions()})}get textureScale(){return this.#textureScale}set textureScale(textureScale){ +this.#textureScale=textureScale,this.#saveDimensions()}get textureOffset(){return this. +uniforms.textureOffset.value}set textureOffset(textureOffset){this.uniforms.textureOffset. +value=textureOffset}get fitment(){return this.#fitment}set fitment(value){this.#fitment= +value,this.#saveDimensions()}get frontFacesOnly(){return this.uniforms.frontFacesOnly. +value}set frontFacesOnly(frontFacesOnly){this.uniforms.frontFacesOnly.value=frontFacesOnly}uniforms;isProjectedMaterial=!0;constructor({ +camera,texture=new Texture2,textureScale,textureOffset=new Vector2,fitment,frontFacesOnly=!0, +...options}={}){if(!texture.isTexture)throw new Error("Invalid texture passed to\ + the ProjectedMaterial");if(camera&&!camera.isCamera)throw new Error("Invalid ca\ +mera passed to the ProjectedMaterial");super(options),Object.defineProperty(this, +"isProjectedMaterial",{value:this.isProjectedMaterial}),this.#fitment=fitment??this.#fitment, +this.#textureScale=textureScale??this.#textureScale,this.uniforms={projectedTexture:{ +value:texture},isTextureLoaded:{value:!!texture.image},isTextureProjected:{value:!1}, +backgroundOpacity:{value:1},viewMatrixCamera:{value:new Matrix4},projectionMatrixCamera:{ +value:new Matrix4},projPosition:{value:new Vector3},projDirection:{value:new Vector3( +0,0,-1)},savedModelMatrix:{value:new Matrix4},widthScaled:{value:1},heightScaled:{ +value:1},textureOffset:{value:textureOffset},frontFacesOnly:{value:frontFacesOnly}}, +camera&&(this.camera=camera),this.#saveDimensions(),addLoadListener(texture,()=>{ +this.uniforms.isTextureLoaded.value=!0,this.#saveDimensions()})}#onBeforeCompilePerspective=(shader,...args)=>{ +delete shader.defines.ORTHOGRAPHIC,this.#onBeforeCompileCommon(shader,...args)};#onBeforeCompileOrtho=(shader,...args)=>{ +shader.defines.ORTHOGRAPHIC="",this.#onBeforeCompileCommon(shader,...args)};#onBeforeCompileCommon=shader=>{ +Object.assign(this.uniforms,shader.uniforms),shader.uniforms=this.uniforms,shader. +vertexShader=monkeyPatch(shader.vertexShader,{header:` + uniform mat4 viewMatrixCamera; + uniform mat4 projectionMatrixCamera; + + #ifdef USE_INSTANCING + attribute vec4 savedModelMatrix0; + attribute vec4 savedModelMatrix1; + attribute vec4 savedModelMatrix2; + attribute vec4 savedModelMatrix3; + #else + uniform mat4 savedModelMatrix; + #endif + + varying vec3 vSavedNormal; + varying vec4 vTexCoords; + #ifndef ORTHOGRAPHIC + varying vec4 vWorldPosition; + #endif + `,main:` + #ifdef USE_INSTANCING + mat4 savedModelMatrix = mat4( + savedModelMatrix0, + savedModelMatrix1, + savedModelMatrix2, + savedModelMatrix3 + ); + #endif + + vSavedNormal = mat3(savedModelMatrix) * normal; + vTexCoords = projectionMatrixCamera * viewMatrixCamera * savedModelMatrix *\ + vec4(position, 1.0); + #ifndef ORTHOGRAPHIC + vWorldPosition = savedModelMatrix * vec4(position, 1.0); + #endif + `}),shader.fragmentShader=monkeyPatch(shader.fragmentShader,{header:` + uniform sampler2D projectedTexture; + uniform bool isTextureLoaded; + uniform bool isTextureProjected; + uniform float backgroundOpacity; + uniform vec3 projPosition; + uniform vec3 projDirection; + uniform float widthScaled; + uniform float heightScaled; + uniform vec2 textureOffset; + uniform bool frontFacesOnly; + + varying vec3 vSavedNormal; + varying vec4 vTexCoords; + #ifndef ORTHOGRAPHIC + varying vec4 vWorldPosition; + #endif + + float mapRange(float value, float min1, float max1, float min2, float max2)\ + { + return min2 + (value - min1) * (max2 - min2) / (max1 - min1); + } + `,"vec4 diffuseColor = vec4( diffuse, opacity );":` + // clamp the w to make sure we don't project behind + float w = max(vTexCoords.w, 0.0); + + vec2 uv = (vTexCoords.xy / w) * 0.5 + 0.5; + + uv += textureOffset; + + // apply the corrected width and height + uv.x = mapRange(uv.x, 0.0, 1.0, 0.5 - widthScaled / 2.0, 0.5 + widthScaled \ +/ 2.0); + uv.y = mapRange(uv.y, 0.0, 1.0, 0.5 - heightScaled / 2.0, 0.5 + heightScale\ +d / 2.0); + + // this makes sure we don't sample out of the texture + bool isInTexture = (max(uv.x, uv.y) <= 1.0 && min(uv.x, uv.y) >= 0.0); + + // this makes sure we don't render also the back of the object if frontFace\ +sOnly is true + // FIXME projection direction is wrong in some cases, namely + // when the camera and the target are both a child and not at the + // scene origin. + #ifdef ORTHOGRAPHIC + vec3 projectorDirection = projDirection; + #else + vec3 projectorDirection = normalize(projPosition - vWorldPosition.xyz); + #endif + float dotProduct = dot(vSavedNormal, projectorDirection); + bool isFacingProjector = frontFacesOnly ? dotProduct > 0.0000001 : true; + + + vec4 diffuseColor = vec4(diffuse, opacity * backgroundOpacity); + + if (isFacingProjector && isInTexture && isTextureLoaded && isTextureProject\ +ed) { + vec4 textureColor = texture2D(projectedTexture, uv); + + // apply the material opacity + textureColor.a *= opacity; + + // https://learnopengl.com/Advanced-OpenGL/Blending + diffuseColor = textureColor * textureColor.a + diffuseColor * (1.0 - textu\ +reColor.a); + } + `})};updateFromCamera(){this.uniforms.projectionMatrixCamera.value.copy(this. +camera.projectionMatrix),this.#saveDimensions()}#saveDimensions(){computeScaledDimensions( +this.texture,this.camera,this.textureScale,this.fitment,size2),this.uniforms.widthScaled. +value=size2.x,this.uniforms.heightScaled.value=size2.y}#saveCameraMatrices(updateWorldMatrices=!0){ +this.camera.updateProjectionMatrix(),updateWorldMatrices&&(this.camera.updateMatrixWorld(), +this.camera.updateWorldMatrix(!0,!1));let viewMatrixCamera=this.camera.matrixWorldInverse, +projectionMatrixCamera=this.camera.projectionMatrix,modelMatrixCamera=this.camera. +matrixWorld;this.uniforms.viewMatrixCamera.value.copy(viewMatrixCamera),this.uniforms. +projectionMatrixCamera.value.copy(projectionMatrixCamera),this.uniforms.projPosition. +value.copy(this.camera.position),this.uniforms.projDirection.value.set(0,0,1).applyMatrix4( +modelMatrixCamera),this.uniforms.isTextureProjected.value=!0}project(mesh,updateWorldMatrices=!0){ +if(!isProjectedMaterial(mesh.material))throw new Error("The mesh material must b\ +e a ProjectedMaterial");if(!(Array.isArray(mesh.material)?mesh.material.some(m=>m=== +this):mesh.material===this))throw new Error("The provided mesh doesn't have the \ +same material as where project() has been called from");if(updateWorldMatrices&& +mesh.updateWorldMatrix(!0,!1),this.uniforms.savedModelMatrix.value.copy(mesh.matrixWorld), +Array.isArray(mesh.material)){let materialIndex=mesh.material.indexOf(this);if(!mesh. +material[materialIndex].transparent)throw new Error(`You have to pass "transpare\ +nt: true" to the ProjectedMaterial if you're working with multiple materials.`); +materialIndex>0&&(this.uniforms.backgroundOpacity.value=0)}this.#saveCameraMatrices( +updateWorldMatrices)}projectInstanceAt(index,instancedMesh,matrixWorld,{forceCameraSave=!1}={}){ +if(!instancedMesh.isInstancedMesh)throw new Error("The provided mesh is not an I\ +nstancedMesh");if(!isProjectedMaterial(instancedMesh.material))throw new Error("\ +The InstancedMesh material must be a ProjectedMaterial");if(!(Array.isArray(instancedMesh. +material)?instancedMesh.material.some(m=>m===this):instancedMesh.material===this)) +throw new Error("The provided InstancedMeshhave't i samenclude thas e material w\ +here project() has been called from");if(!instancedMesh.geometry.attributes.savedModelMatrix0|| +!instancedMesh.geometry.attributes.savedModelMatrix1||!instancedMesh.geometry.attributes. +savedModelMatrix2||!instancedMesh.geometry.attributes.savedModelMatrix3)throw new Error( +"No allocated data found on the geometry, please call 'allocateProjectionData(ge\ +ometry, instancesCount)'");if(instancedMesh.geometry.attributes.savedModelMatrix0. +setXYZW(index,matrixWorld.elements[0],matrixWorld.elements[1],matrixWorld.elements[2], +matrixWorld.elements[3]),instancedMesh.geometry.attributes.savedModelMatrix1.setXYZW( +index,matrixWorld.elements[4],matrixWorld.elements[5],matrixWorld.elements[6],matrixWorld. +elements[7]),instancedMesh.geometry.attributes.savedModelMatrix2.setXYZW(index,matrixWorld. +elements[8],matrixWorld.elements[9],matrixWorld.elements[10],matrixWorld.elements[11]), +instancedMesh.geometry.attributes.savedModelMatrix3.setXYZW(index,matrixWorld.elements[12], +matrixWorld.elements[13],matrixWorld.elements[14],matrixWorld.elements[15]),Array. +isArray(instancedMesh.material)){let materialIndex=instancedMesh.material.indexOf( +this);if(!instancedMesh.material[materialIndex].transparent)throw new Error(`You\ + have to pass "transparent: true" to the ProjectedMaterial if you're working wit\ +h multiple materials.`);materialIndex>0&&(this.uniforms.backgroundOpacity.value= +0)}(index===0||forceCameraSave)&&this.#saveCameraMatrices()}copy(source){return super. +copy(source),this.camera=source.camera,this.texture=source.texture,this.textureScale= +source.textureScale,this.textureOffset=source.textureOffset,this.fitment=source. +fitment,this}};function getCameraRatio(camera){switch(camera.type){case"Perspect\ +iveCamera":return camera=camera,camera.aspect;case"OrthographicCamera":{camera=camera; +let width=Math.abs(camera.right-camera.left),height=Math.abs(camera.top-camera.bottom); +return width/height}default:throw new Error("The given type of camera is current\ +ly not supported in ProjectedMaterial")}}__name(getCameraRatio,"getCameraRatio"); +var size2={x:1,y:1};function computeScaledDimensions(texture,camera,textureScale,fitment,outputSize){ +if(!texture.image){outputSize.x=1,outputSize.y=1;return}if(texture.image.videoWidth=== +0&&texture.image.videoHeight===0){outputSize.x=1,outputSize.y=1;return}let sourceWidth=texture. +image.naturalWidth||texture.image.videoWidth||texture.image.clientWidth,sourceHeight=texture. +image.naturalHeight||texture.image.videoHeight||texture.image.clientHeight,cameraWidth=1, +ratioCamera=getCameraRatio(camera),cameraHeight=cameraWidth*(1/ratioCamera),ratio=sourceWidth/ +sourceHeight;if(fitment==="cover"?ratio>ratioCamera:ratiom.isProjectedMaterial):_mat2.isProjectedMaterial}__name( +isProjectedMaterial,"isProjectedMaterial");var OrthographicCamera2=class extends Camera2{static{__name(this,"OrthographicCa\ +mera")}constructor(left=-1,right=1,top=1,bottom=-1,near=.1,far=2e3){super(),this. +isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null, +this.left=left,this.right=right,this.top=top,this.bottom=bottom,this.near=near,this. +far=far,this.updateProjectionMatrix()}copy(source,recursive){return super.copy(source, +recursive),this.left=source.left,this.right=source.right,this.top=source.top,this. +bottom=source.bottom,this.near=source.near,this.far=source.far,this.zoom=source. +zoom,this.view=source.view===null?null:Object.assign({},source.view),this}setViewOffset(fullWidth,fullHeight,x2,y2,width,height){ +this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0, +width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=fullWidth,this.view. +fullHeight=fullHeight,this.view.offsetX=x2,this.view.offsetY=y2,this.view.width= +width,this.view.height=height,this.updateProjectionMatrix()}clearViewOffset(){this. +view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){ +let dx=(this.right-this.left)/(2*this.zoom),dy=(this.top-this.bottom)/(2*this.zoom), +cx=(this.right+this.left)/2,cy=(this.top+this.bottom)/2,left=cx-dx,right=cx+dx,top=cy+ +dy,bottom=cy-dy;if(this.view!==null&&this.view.enabled){let scaleW=(this.right-this. +left)/this.view.fullWidth/this.zoom,scaleH=(this.top-this.bottom)/this.view.fullHeight/ +this.zoom;left+=scaleW*this.view.offsetX,right=left+scaleW*this.view.width,top-= +scaleH*this.view.offsetY,bottom=top-scaleH*this.view.height}this.projectionMatrix. +makeOrthographic(left,right,top,bottom,this.near,this.far,this.coordinateSystem), +this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(meta){let data=super. +toJSON(meta);return data.object.zoom=this.zoom,data.object.left=this.left,data.object. +right=this.right,data.object.top=this.top,data.object.bottom=this.bottom,data.object. +near=this.near,data.object.far=this.far,this.view!==null&&(data.object.view=Object. +assign({},this.view)),data}};var __esDecorate28=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers28=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-texture\ +-projector",autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=Element3D,_instanceExtraInitializers=[],_src_decorators,_src_initializers=[], +_fitment_decorators,_fitment_initializers=[],_frontFacesOnly_decorators,_frontFacesOnly_initializers=[], +__camera_decorators,__camera_initializers=[];var TextureProjector2=class extends _classSuper{static{ +__name(this,"TextureProjector")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_src_decorators=[stringAttribute],_fitment_decorators=[stringAttribute],_frontFacesOnly_decorators= +[booleanAttribute],__camera_decorators=[signal],__esDecorate28(null,null,_src_decorators, +{kind:"field",name:"src",static:!1,private:!1,access:{has:obj=>"src"in obj,get:obj=>obj. +src,set:(obj,value)=>{obj.src=value}},metadata:_metadata},_src_initializers,_instanceExtraInitializers), +__esDecorate28(null,null,_fitment_decorators,{kind:"field",name:"fitment",static:!1, +private:!1,access:{has:obj=>"fitment"in obj,get:obj=>obj.fitment,set:(obj,value)=>{ +obj.fitment=value}},metadata:_metadata},_fitment_initializers,_instanceExtraInitializers), +__esDecorate28(null,null,_frontFacesOnly_decorators,{kind:"field",name:"frontFac\ +esOnly",static:!1,private:!1,access:{has:obj=>"frontFacesOnly"in obj,get:obj=>obj. +frontFacesOnly,set:(obj,value)=>{obj.frontFacesOnly=value}},metadata:_metadata}, +_frontFacesOnly_initializers,_instanceExtraInitializers),__esDecorate28(null,null, +__camera_decorators,{kind:"field",name:"_camera",static:!1,private:!1,access:{has:obj=>"\ +_camera"in obj,get:obj=>obj._camera,set:(obj,value)=>{obj._camera=value}},metadata:_metadata}, +__camera_initializers,_instanceExtraInitializers),__esDecorate28(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),TextureProjector2=_classThis=_classDescriptor.value, +_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers28(_classThis,_classExtraInitializers)}src=(__runInitializers28( +this,_instanceExtraInitializers),__runInitializers28(this,_src_initializers,""));fitment=__runInitializers28( +this,_fitment_initializers,"cover");frontFacesOnly=__runInitializers28(this,_frontFacesOnly_initializers, +!1);_camera=__runInitializers28(this,__camera_initializers,null);connectedCallback(){ +super.connectedCallback(),this._camera=new OrthographicCamera2,this.three.add(this. +_camera),this.createEffect(()=>{createEffect(()=>{let size3=this.calculatedSize, +cam=this._camera;cam instanceof OrthographicCamera2?(cam.left=-size3.x/2,cam.right= +size3.x/2,cam.top=size3.y/2,cam.bottom=-size3.y/2):(cam.near=1,cam.far=1e4,cam.aspect= +1,cam.fov=45),cam.updateProjectionMatrix(),this.needsUpdate()})})}disconnectedCallback(){ +super.disconnectedCallback(),this.three.remove(this._camera),this._camera=null}}; +return TextureProjector2=_classThis})();function*upwardRoots(el2){let root=el2.getRootNode();for(;root;)yield root,root= +root instanceof ShadowRoot?root.host.getRootNode():null}__name(upwardRoots,"upwa\ +rdRoots");function*querySelectorUpward(el2,selector){if(selector)for(let root of upwardRoots( +el2)){let els=root.querySelectorAll(selector);for(let i2=0,l=els.length;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers29=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=PhysicalMaterialBehavior,_instanceExtraInitializers=[], +___associatedProjectors_decorators,___associatedProjectors_initializers=[],_get_textureProjectors_decorators, +_get_projectedTextures_decorators;var ProjectedMaterialBehavior2=class extends _classSuper{static{ +__name(this,"ProjectedMaterialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +___associatedProjectors_decorators=[signal],_get_textureProjectors_decorators=[stringAttribute, +receiver],_get_projectedTextures_decorators=[stringAttribute,receiver],__esDecorate29( +this,null,_get_textureProjectors_decorators,{kind:"getter",name:"textureProjecto\ +rs",static:!1,private:!1,access:{has:obj=>"textureProjectors"in obj,get:obj=>obj. +textureProjectors},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate29( +this,null,_get_projectedTextures_decorators,{kind:"getter",name:"projectedTextur\ +es",static:!1,private:!1,access:{has:obj=>"projectedTextures"in obj,get:obj=>obj. +projectedTextures},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate29( +null,null,___associatedProjectors_decorators,{kind:"field",name:"__associatedPro\ +jectors",static:!1,private:!1,access:{has:obj=>"__associatedProjectors"in obj,get:obj=>obj. +__associatedProjectors,set:(obj,value)=>{obj.__associatedProjectors=value}},metadata:_metadata}, +___associatedProjectors_initializers,_instanceExtraInitializers),__esDecorate29( +null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis. +name,metadata:_metadata},null,_classExtraInitializers),ProjectedMaterialBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers29( +_classThis,_classExtraInitializers)}__associatedProjectors=(__runInitializers29( +this,_instanceExtraInitializers),__runInitializers29(this,___associatedProjectors_initializers, +[]));get associatedProjectors(){return this.__associatedProjectors}#textureProjectorsRaw=[];get textureProjectors(){ +return this.#textureProjectorsRaw}set textureProjectors(value){this.#textureProjectorsRaw= +value}get projectedTextures(){return this.textureProjectors}set projectedTextures(value){ +this.textureProjectors=value}_createComponent(){return new ProjectedMaterial}#observer=null;connectedCallback(){ +super.connectedCallback();let queuedRequery=!1;this.#observer=new MutationObserver( +()=>{queuedRequery||(queuedRequery=!0,setTimeout(()=>{queuedRequery=!1,this.textureProjectors= +this.#textureProjectorsRaw},0))});for(let root of upwardRoots(this.element))this.#observer. +observe(root,{childList:!0,subtree:!0});this.createEffect(()=>{let mat=this.meshComponent; +if(!mat)return;let three=this.element.three;three.material===mat&&(createEffect( +()=>{this.textureProjectors;let array=[];if(typeof this.#textureProjectorsRaw=="\ +string")array=[this.#textureProjectorsRaw.trim()];else if(Array.isArray(this.#textureProjectorsRaw)) +array=this.#textureProjectorsRaw;else throw new TypeError("Invalid value for tex\ +tureProjectors");let projectors=[];for(let value of array){if(typeof value!="str\ +ing"){value.scene&&value instanceof TextureProjector&&projectors.push(value);continue}else if(!value) +continue;for(let el2 of querySelectorUpward(this.element,value))el2&&el2.scene&& +el2 instanceof TextureProjector&&projectors.push(el2)}this.__associatedProjectors= +projectors}),this._handleTexture(()=>this.__associatedProjectors[0]?.src??"",(mat2,tex)=>mat2. +texture=tex||new Texture2,mat2=>!!mat2.texture,()=>{},!0),createEffect(()=>{let tex=this. +__associatedProjectors[0];tex&&createEffect(()=>{mat.fitment=tex.fitment,mat.frontFacesOnly= +tex.frontFacesOnly,this.element.needsUpdate()})}),createEffect(()=>{let tex=this. +__associatedProjectors[0];if(!tex)return;let cam=tex._camera;cam&&three.material=== +mat&&(mat.camera=cam,mat.updateFromCamera(),mat.project(three,!1),this.element.needsUpdate(), +onCleanup(()=>{let mat2=this.meshComponent;mat2&&three.material===mat2&&(mat2.camera= +new OrthographicCamera2(1e-8,1e-8,1e-8,1e-8),mat2.updateFromCamera(),mat2.project( +three,!1),this.element.needsUpdate())}))}),createEffect(()=>{let tex=this.__associatedProjectors[0]; +tex&&createEffect(()=>{tex.calculatedSize,mat.updateFromCamera(),this.element.needsUpdate()})}), +createEffect(()=>{three.material===mat&&(this.element.version,mat.project(three, +!1))}),createEffect(()=>{let tex=this.__associatedProjectors[0];tex&&createEffect( +()=>{three.material===mat&&(tex.version,mat.project(three,!1),this.element.needsUpdate())})}))})}disconnectedCallback(){ +super.disconnectedCallback(),this.#observer?.disconnect(),this.#observer=null}}; +return ProjectedMaterialBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("projected-material")&&elementBehaviors. +define("projected-material",ProjectedMaterialBehavior);function cloneUniforms2(src){let dst={};for(let u2 in src){dst[u2]={};for(let p2 in src[u2]){ +let property=src[u2][p2];property&&(property.isColor||property.isMatrix3||property. +isMatrix4||property.isVector2||property.isVector3||property.isVector4||property. +isTexture||property.isQuaternion)?property.isRenderTargetTexture?(console.warn("\ +UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() o\ +r mergeUniforms()."),dst[u2][p2]=null):dst[u2][p2]=property.clone():Array.isArray( +property)?dst[u2][p2]=property.slice():dst[u2][p2]=property}}return dst}__name(cloneUniforms2, +"cloneUniforms");function mergeUniforms2(uniforms){let merged={};for(let u2=0;u2< +uniforms.length;u2++){let tmp2=cloneUniforms2(uniforms[u2]);for(let p2 in tmp2)merged[p2]= +tmp2[p2]}return merged}__name(mergeUniforms2,"mergeUniforms");function cloneUniformsGroups2(src){ +let dst=[];for(let u2=0;u20&&(data.defines=this.defines), +data.vertexShader=this.vertexShader,data.fragmentShader=this.fragmentShader,data. +lights=this.lights,data.clipping=this.clipping;let extensions={};for(let key2 in this. +extensions)this.extensions[key2]===!0&&(extensions[key2]=!0);return Object.keys( +extensions).length>0&&(data.extensions=extensions),data}};var __esDecorate30=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers30=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=MaterialBehavior,_instanceExtraInitializers=[], +_get_uniforms_decorators,_vertexShader_decorators,_vertexShader_initializers=[], +_fragmentShader_decorators,_fragmentShader_initializers=[];var ShaderMaterialBehavior2=class extends _classSuper{static{ +__name(this,"ShaderMaterialBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_get_uniforms_decorators=[attribute,receiver],_vertexShader_decorators=[stringAttribute, +receiver],_fragmentShader_decorators=[stringAttribute,receiver],__esDecorate30(this, +null,_get_uniforms_decorators,{kind:"getter",name:"uniforms",static:!1,private:!1, +access:{has:obj=>"uniforms"in obj,get:obj=>obj.uniforms},metadata:_metadata},null, +_instanceExtraInitializers),__esDecorate30(null,null,_vertexShader_decorators,{kind:"\ +field",name:"vertexShader",static:!1,private:!1,access:{has:obj=>"vertexShader"in +obj,get:obj=>obj.vertexShader,set:(obj,value)=>{obj.vertexShader=value}},metadata:_metadata}, +_vertexShader_initializers,_instanceExtraInitializers),__esDecorate30(null,null, +_fragmentShader_decorators,{kind:"field",name:"fragmentShader",static:!1,private:!1, +access:{has:obj=>"fragmentShader"in obj,get:obj=>obj.fragmentShader,set:(obj,value)=>{ +obj.fragmentShader=value}},metadata:_metadata},_fragmentShader_initializers,_instanceExtraInitializers), +__esDecorate30(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),ShaderMaterialBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers30( +_classThis,_classExtraInitializers)}get uniforms(){return this.#uniforms}set uniforms(u2){ +if(!u2){this.#uniforms={};return}if(typeof u2=="string")try{this.#uniforms=JSON. +parse(u2)}catch{console.warn("Unparsable uniform value:",u2)}else this.#uniforms= +u2}#uniforms=(__runInitializers30(this,_instanceExtraInitializers),{});vertexShader=__runInitializers30( +this,_vertexShader_initializers,default_vertex_glsl_default);fragmentShader=__runInitializers30( +this,_fragmentShader_initializers,default_fragment_glsl_default);_createComponent(){ +return untrack(()=>new ShaderMaterial2({uniforms:this.uniforms,vertexShader:this. +vertexShader,fragmentShader:this.fragmentShader}))}connectedCallback(){this.createEffect( +()=>{let mat=this.meshComponent;mat&&(mat.uniforms=this.uniforms,mat.vertexShader= +this.vertexShader||default_vertex_glsl_default,mat.fragmentShader=this.fragmentShader|| +default_fragment_glsl_default,mat.needsUpdate=!0,this.element.needsUpdate())}),super. +connectedCallback()}};return ShaderMaterialBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("shader-material")&&elementBehaviors. +define("shader-material",ShaderMaterialBehavior);var TGALoader=class extends DataTextureLoader{static{__name(this,"TGALoader")}constructor(manager){ +super(manager)}parse(buffer){function tgaCheckHeader(header2){switch(header2.image_type){case TGA_TYPE_INDEXED:case TGA_TYPE_RLE_INDEXED: +if(header2.colormap_length>256||header2.colormap_size!==24||header2.colormap_type!== +1)throw new Error("THREE.TGALoader: Invalid type colormap data for indexed type."); +break;case TGA_TYPE_RGB:case TGA_TYPE_GREY:case TGA_TYPE_RLE_RGB:case TGA_TYPE_RLE_GREY: +if(header2.colormap_type)throw new Error("THREE.TGALoader: Invalid type colormap\ + data for colormap type.");break;case TGA_TYPE_NO_DATA:throw new Error("THREE.TG\ +ALoader: No data.");default:throw new Error("THREE.TGALoader: Invalid type "+header2. +image_type)}if(header2.width<=0||header2.height<=0)throw new Error("THREE.TGALoa\ +der: Invalid image size.");if(header2.pixel_size!==8&&header2.pixel_size!==16&&header2. +pixel_size!==24&&header2.pixel_size!==32)throw new Error("THREE.TGALoader: Inval\ +id pixel size "+header2.pixel_size)}__name(tgaCheckHeader,"tgaCheckHeader");function tgaParse(use_rle2,use_pal2,header2,offset2,data){ +let pixel_data,palettes,pixel_size=header2.pixel_size>>3,pixel_total=header2.width* +header2.height*pixel_size;if(use_pal2&&(palettes=data.subarray(offset2,offset2+= +header2.colormap_length*(header2.colormap_size>>3))),use_rle2){pixel_data=new Uint8Array( +pixel_total);let c3,count,i2,shift=0,pixels=new Uint8Array(pixel_size);for(;shift< +pixel_total;)if(c3=data[offset2++],count=(c3&127)+1,c3&128){for(i2=0;i2>7,imageData2[(x2+width*y2)*4+1]=(color&992)>>2,imageData2[(x2+ +width*y2)*4+2]=(color&31)<<3,imageData2[(x2+width*y2)*4+3]=color&32768?0:255;return imageData2} +__name(tgaGetImageData16bits,"tgaGetImageData16bits");function tgaGetImageData24bits(imageData2,y_start,y_step,y_end,x_start,x_step,x_end,image){ +let i2=0,x2,y2,width=header.width;for(y2=y_start;y2!==y_end;y2+=y_step)for(x2=x_start;x2!== +x_end;x2+=x_step,i2+=3)imageData2[(x2+width*y2)*4+3]=255,imageData2[(x2+width*y2)* +4+2]=image[i2+0],imageData2[(x2+width*y2)*4+1]=image[i2+1],imageData2[(x2+width* +y2)*4+0]=image[i2+2];return imageData2}__name(tgaGetImageData24bits,"tgaGetImage\ +Data24bits");function tgaGetImageData32bits(imageData2,y_start,y_step,y_end,x_start,x_step,x_end,image){ +let i2=0,x2,y2,width=header.width;for(y2=y_start;y2!==y_end;y2+=y_step)for(x2=x_start;x2!== +x_end;x2+=x_step,i2+=4)imageData2[(x2+width*y2)*4+2]=image[i2+0],imageData2[(x2+ +width*y2)*4+1]=image[i2+1],imageData2[(x2+width*y2)*4+0]=image[i2+2],imageData2[(x2+ +width*y2)*4+3]=image[i2+3];return imageData2}__name(tgaGetImageData32bits,"tgaGe\ +tImageData32bits");function tgaGetImageDataGrey8bits(imageData2,y_start,y_step,y_end,x_start,x_step,x_end,image){ +let color,i2=0,x2,y2,width=header.width;for(y2=y_start;y2!==y_end;y2+=y_step)for(x2= +x_start;x2!==x_end;x2+=x_step,i2++)color=image[i2],imageData2[(x2+width*y2)*4+0]= +color,imageData2[(x2+width*y2)*4+1]=color,imageData2[(x2+width*y2)*4+2]=color,imageData2[(x2+ +width*y2)*4+3]=255;return imageData2}__name(tgaGetImageDataGrey8bits,"tgaGetImag\ +eDataGrey8bits");function tgaGetImageDataGrey16bits(imageData2,y_start,y_step,y_end,x_start,x_step,x_end,image){ +let i2=0,x2,y2,width=header.width;for(y2=y_start;y2!==y_end;y2+=y_step)for(x2=x_start;x2!== +x_end;x2+=x_step,i2+=2)imageData2[(x2+width*y2)*4+0]=image[i2+0],imageData2[(x2+ +width*y2)*4+1]=image[i2+0],imageData2[(x2+width*y2)*4+2]=image[i2+0],imageData2[(x2+ +width*y2)*4+3]=image[i2+1];return imageData2}__name(tgaGetImageDataGrey16bits,"t\ +gaGetImageDataGrey16bits");function getTgaRGBA(data,width,height,image,palette){ +let x_start,y_start,x_step,y_step,x_end,y_end;switch((header.flags&TGA_ORIGIN_MASK)>> +TGA_ORIGIN_SHIFT){default:case TGA_ORIGIN_UL:x_start=0,x_step=1,x_end=width,y_start= +0,y_step=1,y_end=height;break;case TGA_ORIGIN_BL:x_start=0,x_step=1,x_end=width, +y_start=height-1,y_step=-1,y_end=-1;break;case TGA_ORIGIN_UR:x_start=width-1,x_step= +-1,x_end=-1,y_start=0,y_step=1,y_end=height;break;case TGA_ORIGIN_BR:x_start=width- +1,x_step=-1,x_end=-1,y_start=height-1,y_step=-1,y_end=-1;break}if(use_grey)switch(header. +pixel_size){case 8:tgaGetImageDataGrey8bits(data,y_start,y_step,y_end,x_start,x_step, +x_end,image);break;case 16:tgaGetImageDataGrey16bits(data,y_start,y_step,y_end,x_start, +x_step,x_end,image);break;default:throw new Error("THREE.TGALoader: Format not s\ +upported.")}else switch(header.pixel_size){case 8:tgaGetImageData8bits(data,y_start, +y_step,y_end,x_start,x_step,x_end,image,palette);break;case 16:tgaGetImageData16bits( +data,y_start,y_step,y_end,x_start,x_step,x_end,image);break;case 24:tgaGetImageData24bits( +data,y_start,y_step,y_end,x_start,x_step,x_end,image);break;case 32:tgaGetImageData32bits( +data,y_start,y_step,y_end,x_start,x_step,x_end,image);break;default:throw new Error( +"THREE.TGALoader: Format not supported.")}return data}__name(getTgaRGBA,"getTgaR\ +GBA");let TGA_TYPE_NO_DATA=0,TGA_TYPE_INDEXED=1,TGA_TYPE_RGB=2,TGA_TYPE_GREY=3,TGA_TYPE_RLE_INDEXED=9, +TGA_TYPE_RLE_RGB=10,TGA_TYPE_RLE_GREY=11,TGA_ORIGIN_MASK=48,TGA_ORIGIN_SHIFT=4,TGA_ORIGIN_BL=0, +TGA_ORIGIN_BR=1,TGA_ORIGIN_UL=2,TGA_ORIGIN_UR=3;if(buffer.length<19)throw new Error( +"THREE.TGALoader: Not enough data to contain header.");let offset=0,content=new Uint8Array( +buffer),header={id_length:content[offset++],colormap_type:content[offset++],image_type:content[offset++], +colormap_index:content[offset++]|content[offset++]<<8,colormap_length:content[offset++]| +content[offset++]<<8,colormap_size:content[offset++],origin:[content[offset++]|content[offset++]<< +8,content[offset++]|content[offset++]<<8],width:content[offset++]|content[offset++]<< +8,height:content[offset++]|content[offset++]<<8,pixel_size:content[offset++],flags:content[offset++]}; +if(tgaCheckHeader(header),header.id_length+offset>buffer.length)throw new Error( +"THREE.TGALoader: No data.");offset+=header.id_length;let use_rle=!1,use_pal=!1, +use_grey=!1;switch(header.image_type){case TGA_TYPE_RLE_INDEXED:use_rle=!0,use_pal= +!0;break;case TGA_TYPE_INDEXED:use_pal=!0;break;case TGA_TYPE_RLE_RGB:use_rle=!0; +break;case TGA_TYPE_RGB:break;case TGA_TYPE_RLE_GREY:use_rle=!0,use_grey=!0;break;case TGA_TYPE_GREY: +use_grey=!0;break}let imageData=new Uint8Array(header.width*header.height*4),result=tgaParse( +use_rle,use_pal,header,offset,content);return getTgaRGBA(imageData,header.width, +header.height,result.pixel_data,result.palettes),{data:imageData,width:header.width, +height:header.height,flipY:!0,generateMipmaps:!0,minFilter:LinearMipmapLinearFilter2}}};var ColladaLoader=class extends Loader{static{__name(this,"ColladaLoader")}load(url,onLoad,onProgress,onError){ +let scope=this,path=scope.path===""?LoaderUtils.extractUrlBase(url):scope.path,loader=new FileLoader( +scope.manager);loader.setPath(scope.path),loader.setRequestHeader(scope.requestHeader), +loader.setWithCredentials(scope.withCredentials),loader.load(url,function(text){ +try{onLoad(scope.parse(text,path))}catch(e){onError?onError(e):console.error(e), +scope.manager.itemError(url)}},onProgress,onError)}parse(text,path){function getElementsByTagName(xml2,name2){ +let array=[],childNodes=xml2.childNodes;for(let i2=0,l=childNodes.length;i2 +0&&tracks.push(new VectorKeyframeTrack(name2+".position",times,positionData)),quaternionData. +length>0&&tracks.push(new QuaternionKeyframeTrack(name2+".quaternion",times,quaternionData)), +scaleData.length>0&&tracks.push(new VectorKeyframeTrack(name2+".scale",times,scaleData)), +tracks}__name(createKeyframeTracks,"createKeyframeTracks");function transformAnimationData(keyframes,property,defaultValue){ +let keyframe,empty=!0,i2,l;for(i2=0,l=keyframes.length;i2=0;){let keyframe=keyframes[i2]; +if(keyframe.value[property]!==null)return keyframe;i2--}return null}__name(getPrev, +"getPrev");function getNext(keyframes,i2,property){for(;i2>>0)+2);switch(extension=extension. +toLowerCase(),extension){case"tga":loader=tgaLoader;break;default:loader=textureLoader} +return loader}__name(getTextureLoader,"getTextureLoader");function buildMaterial(data){ +let effect=getEffect(data.url),technique=effect.profile.technique,material;switch(technique. +type){case"phong":case"blinn":material=new MeshPhongMaterial2;break;case"lambert": +material=new MeshLambertMaterial;break;default:material=new MeshBasicMaterial2;break} +material.name=data.name||"";function getTexture(textureObject,colorSpace=null){let sampler=effect. +profile.samplers[textureObject.id],image=null;if(sampler!==void 0){let surface=effect. +profile.surfaces[sampler.source];image=getImage(surface.init_from)}else console. +warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)\ +."),image=getImage(textureObject.id);if(image!==null){let loader=getTextureLoader( +image);if(loader!==void 0){let texture=loader.load(image),extra=textureObject.extra; +if(extra!==void 0&&extra.technique!==void 0&&isEmpty(extra.technique)===!1){let technique2=extra. +technique;texture.wrapS=technique2.wrapU?RepeatWrapping2:ClampToEdgeWrapping2,texture. +wrapT=technique2.wrapV?RepeatWrapping2:ClampToEdgeWrapping2,texture.offset.set(technique2. +offsetU||0,technique2.offsetV||0),texture.repeat.set(technique2.repeatU||1,technique2. +repeatV||1)}else texture.wrapS=RepeatWrapping2,texture.wrapT=RepeatWrapping2;return colorSpace!== +null&&(texture.colorSpace=colorSpace),texture}else return console.warn("THREE.Co\ +lladaLoader: Loader for texture %s not found.",image),null}else return console.warn( +"THREE.ColladaLoader: Couldn't create texture with ID:",textureObject.id),null}__name( +getTexture,"getTexture");let parameters=technique.parameters;for(let key2 in parameters){ +let parameter=parameters[key2];switch(key2){case"diffuse":parameter.color&&material. +color.fromArray(parameter.color),parameter.texture&&(material.map=getTexture(parameter. +texture,SRGBColorSpace2));break;case"specular":parameter.color&&material.specular&& +material.specular.fromArray(parameter.color),parameter.texture&&(material.specularMap= +getTexture(parameter.texture));break;case"bump":parameter.texture&&(material.normalMap= +getTexture(parameter.texture));break;case"ambient":parameter.texture&&(material. +lightMap=getTexture(parameter.texture,SRGBColorSpace2));break;case"shininess":parameter. +float&&material.shininess&&(material.shininess=parameter.float);break;case"emiss\ +ion":parameter.color&&material.emissive&&material.emissive.fromArray(parameter.color), +parameter.texture&&(material.emissiveMap=getTexture(parameter.texture,SRGBColorSpace2)); +break}}material.color.convertSRGBToLinear(),material.specular&&material.specular. +convertSRGBToLinear(),material.emissive&&material.emissive.convertSRGBToLinear(); +let transparent=parameters.transparent,transparency=parameters.transparency;if(transparency=== +void 0&&transparent&&(transparency={float:1}),transparent===void 0&&transparency&& +(transparent={opaque:"A_ONE",data:{color:[1,1,1,1]}}),transparent&&transparency) +if(transparent.data.texture)material.transparent=!0;else{let color=transparent.data. +color;switch(transparent.opaque){case"A_ONE":material.opacity=color[3]*transparency. +float;break;case"RGB_ZERO":material.opacity=1-color[0]*transparency.float;break;case"\ +A_ZERO":material.opacity=1-color[3]*transparency.float;break;case"RGB_ONE":material. +opacity=color[0]*transparency.float;break;default:console.warn('THREE.ColladaLoa\ +der: Invalid opaque type "%s" of transparent tag.',transparent.opaque)}material. +opacity<1&&(material.transparent=!0)}if(technique.extra!==void 0&&technique.extra. +technique!==void 0){let techniques=technique.extra.technique;for(let k in techniques){ +let v=techniques[k];switch(k){case"double_sided":material.side=v===1?DoubleSide2: +FrontSide2;break;case"bump":material.normalMap=getTexture(v.texture),material.normalScale= +new Vector22(1,1);break}}}return material}__name(buildMaterial,"buildMaterial"); +function getMaterial(id){return getBuild(library.materials[id],buildMaterial)}__name( +getMaterial,"getMaterial");function parseCamera(xml2){let data={name:xml2.getAttribute( +"name")};for(let i2=0,l=xml2.childNodes.length;i20?semantic+set:semantic;primitive.inputs[inputname]= +{id,offset},primitive.stride=Math.max(primitive.stride,offset+1),semantic==="TEX\ +COORD"&&(primitive.hasUV=!0);break;case"vcount":primitive.vcount=parseInts(child. +textContent);break;case"p":primitive.p=parseInts(child.textContent);break}}return primitive} +__name(parseGeometryPrimitive,"parseGeometryPrimitive");function groupPrimitives(primitives){ +let build={};for(let i2=0;i20&&count20&&geometry.setAttribute("position",new Float32BufferAttribute2(position3. +array,position3.stride)),normal.array.length>0&&geometry.setAttribute("normal",new Float32BufferAttribute2( +normal.array,normal.stride)),color.array.length>0&&geometry.setAttribute("color", +new Float32BufferAttribute2(color.array,color.stride)),uv.array.length>0&&geometry. +setAttribute("uv",new Float32BufferAttribute2(uv.array,uv.stride)),uv1.array.length> +0&&geometry.setAttribute("uv1",new Float32BufferAttribute2(uv1.array,uv1.stride)), +skinIndex.array.length>0&&geometry.setAttribute("skinIndex",new Float32BufferAttribute2( +skinIndex.array,skinIndex.stride)),skinWeight.array.length>0&&geometry.setAttribute( +"skinWeight",new Float32BufferAttribute2(skinWeight.array,skinWeight.stride)),build. +data=geometry,build.type=primitives[0].type,build.materialKeys=materialKeys,build} +__name(buildGeometryType,"buildGeometryType");function buildGeometryData(primitive,source,offset,array,isColor=!1){ +let indices=primitive.p,stride=primitive.stride,vcount=primitive.vcount;function pushVector(i2){ +let index=indices[i2+offset]*sourceStride,length=index+sourceStride;for(;index4)for(let k=1,kl=count2-2;k<=kl;k++){let a=index+ +stride*0,b=index+stride*k,c3=index+stride*(k+1);pushVector(a),pushVector(b),pushVector( +c3)}index+=stride*count2}}else for(let i2=0,l=indices.length;i2=data.limits.max&&(data.static=!0),data.middlePosition=(data.limits.min+data. +limits.max)/2,data}__name(parseKinematicsJointParameter,"parseKinematicsJointPar\ +ameter");function parseKinematicsLink(xml2){let data={sid:xml2.getAttribute("sid"), +name:xml2.getAttribute("name")||"",attachments:[],transforms:[]};for(let i2=0;i2< +xml2.childNodes.length;i2++){let child=xml2.childNodes[i2];if(child.nodeType===1) +switch(child.nodeName){case"attachment_full":data.attachments.push(parseKinematicsAttachment( +child));break;case"matrix":case"translate":case"rotate":data.transforms.push(parseKinematicsTransform( +child));break}}return data}__name(parseKinematicsLink,"parseKinematicsLink");function parseKinematicsAttachment(xml2){ +let data={joint:xml2.getAttribute("joint").split("/").pop(),transforms:[],links:[]}; +for(let i2=0;i2joint.limits.max||value=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers31=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=RenderableBehavior,_instanceExtraInitializers=[], +_src_decorators,_src_initializers=[];var ColladaModelBehavior2=class extends _classSuper{static{ +__name(this,"ColladaModelBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_src_decorators=[stringAttribute,receiver],__esDecorate31(null,null,_src_decorators, +{kind:"field",name:"src",static:!1,private:!1,access:{has:obj=>"src"in obj,get:obj=>obj. +src,set:(obj,value)=>{obj.src=value}},metadata:_metadata},_src_initializers,_instanceExtraInitializers), +__esDecorate31(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),ColladaModelBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers31( +_classThis,_classExtraInitializers)}src=(__runInitializers31(this,_instanceExtraInitializers), +__runInitializers31(this,_src_initializers,""));loader=new ColladaLoader;model;#version=0;connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{this.src,this.#loadModel(),onCleanup( +()=>{this.model&&disposeObjectTree(this.model.scene),this.model=void 0,this.#version++})})}#loadModel(){ +let{src}=this,version3=this.#version;src&&this.loader.load(src,model=>version3=== +this.#version&&this.#setModel(model),progress=>version3===this.#version&&this.element. +emit(Events.PROGRESS,progress),error=>version3===this.#version&&this.#onError(error))}#onError(error){ +let message=`Failed to load ${this.element.tagName.toLowerCase()} with src "${this. +src}". See the following error.`;console.warn(message);let err=error instanceof ErrorEvent&& +error.error?error.error:error;console.error(err),this.element.emit(Events.MODEL_ERROR, +err)}#setModel(model){this.model=model,this.element.three.add(model.scene),this. +element.emit(Events.MODEL_LOAD,{format:"collada",model}),this.element.needsUpdate()}}; +return ColladaModelBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("collada-model")&&elementBehaviors. +define("collada-model",ColladaModelBehavior);var durl=__name(function(c3){return URL.createObjectURL(new Blob([c3],{type:"tex\ +t/javascript"}))},"durl"),cwk=__name(function(u2){return new Worker(u2)},"cwk"); +try{URL.revokeObjectURL(durl(""))}catch{durl=__name(function(c3){return"data:app\ +lication/javascript;charset=UTF-8,"+encodeURI(c3)},"durl"),cwk=__name(function(u2){ +return new Worker(u2,{type:"module"})},"cwk")}var u8=Uint8Array,u16=Uint16Array,u32=Uint32Array,fleb=new u8([0,0,0,0,0,0,0,0,1, +1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fdeb=new u8([0,0,0,0,1,1,2,2,3,3, +4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),clim=new u8([16,17,18,0,8, +7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=__name(function(eb,start){for(var b=new u16( +31),i2=0;i2<31;++i2)b[i2]=start+=1<>>1|(i2&21845)<< +1,x2=(x2&52428)>>>2|(x2&13107)<<2,x2=(x2&61680)>>>4|(x2&3855)<<4,rev[i2]=((x2&65280)>>> +8|(x2&255)<<8)>>>1;var x2,i2,hMap=__name(function(cd,mb,r3){for(var s=cd.length, +i2=0,l=new u16(mb);i2>>rvb]=sv}else for(co=new u16(s),i2=0;i2>>15-cd[i2]);return co},"hMap"),flt=new u8(288); +for(i2=0;i2<144;++i2)flt[i2]=8;var i2;for(i2=144;i2<256;++i2)flt[i2]=9;var i2;for(i2= +256;i2<280;++i2)flt[i2]=7;var i2;for(i2=280;i2<288;++i2)flt[i2]=8;var i2,fdt=new u8( +32);for(i2=0;i2<32;++i2)fdt[i2]=5;var i2;var flrm=hMap(flt,9,1);var fdrm=hMap(fdt,5,1),max=__name(function(a){for(var m=a[0],i2=1;i2m&&(m=a[i2]);return m},"max"),bits=__name(function(d2,p2,m){var o=p2/8|0;return(d2[o]| +d2[o+1]<<8)>>(p2&7)&m},"bits"),bits16=__name(function(d2,p2){var o=p2/8|0;return(d2[o]| +d2[o+1]<<8|d2[o+2]<<16)>>(p2&7)},"bits16"),shft=__name(function(p2){return(p2/8| +0)+(p2&7&&1)},"shft"),slc=__name(function(v,s,e){(s==null||s<0)&&(s=0),(e==null|| +e>v.length)&&(e=v.length);var n=new(v instanceof u16?u16:v instanceof u32?u32:u8)( +e-s);return n.set(v.subarray(s,e)),n},"slc"),inflt=__name(function(dat,buf,st){var sl=dat. +length;if(!sl||st&&!st.l&&sl<5)return buf||new u8(0);var noBuf=!buf||st,noSt=!st|| +st.i;st||(st={}),buf||(buf=new u8(sl*3));var cbuf=__name(function(l2){var bl=buf. +length;if(l2>bl){var nbuf=new u8(Math.max(bl*2,l2));nbuf.set(buf),buf=nbuf}},"cb\ +uf"),final=st.f||0,pos=st.p||0,bt=st.b||0,lm=st.l,dm=st.d,lbt=st.m,dbt=st.n,tbts=sl* +8;do{if(!lm){st.f=final=bits(dat,pos,1);var type=bits(dat,pos+1,3);if(pos+=3,type) +if(type==1)lm=flrm,dm=fdrm,lbt=9,dbt=5;else if(type==2){var hLit=bits(dat,pos,31)+ +257,hcLen=bits(dat,pos+10,15)+4,tl=hLit+bits(dat,pos+5,31)+1;pos+=14;for(var ldt=new u8( +tl),clt=new u8(19),i2=0;i2>>4;if(s<16)ldt[i2++]=s;else{var c3=0,n=0;for(s== +16?(n=3+bits(dat,pos,3),pos+=2,c3=ldt[i2-1]):s==17?(n=3+bits(dat,pos,7),pos+=3): +s==18&&(n=11+bits(dat,pos,127),pos+=7);n--;)ldt[i2++]=c3}}var lt=ldt.subarray(0, +hLit),dt=ldt.subarray(hLit);lbt=max(lt),dbt=max(dt),lm=hMap(lt,lbt,1),dm=hMap(dt, +dbt,1)}else throw"invalid block type";else{var s=shft(pos)+4,l=dat[s-4]|dat[s-3]<< +8,t=s+l;if(t>sl){if(noSt)throw"unexpected EOF";break}noBuf&&cbuf(bt+l),buf.set(dat. +subarray(s,t),bt),st.b=bt+=l,st.p=pos=t*8;continue}if(pos>tbts){if(noSt)throw"un\ +expected EOF";break}}noBuf&&cbuf(bt+131072);for(var lms=(1<>>4;if(pos+=c3&15,pos> +tbts){if(noSt)throw"unexpected EOF";break}if(!c3)throw"invalid length/literal";if(sym< +256)buf[bt++]=sym;else if(sym==256){lpos=pos,lm=null;break}else{var add=sym-254; +if(sym>264){var i2=sym-257,b=fleb[i2];add=bits(dat,pos,(1<>>4;if(!d2)throw"invalid distance";pos+=d2&15;var dt=fd[dsym]; +if(dsym>3){var b=fdeb[dsym];dt+=bits16(dat,pos)&(1<tbts){if(noSt) +throw"unexpected EOF";break}noBuf&&cbuf(bt+131072);for(var end=bt+add;bt>>4>7||(d2[0]<<8|d2[1])%31)throw"\ +invalid zlib data";if(d2[1]&32)throw"invalid zlib data: preset dictionaries not \ +supported"},"zlv");function unzlibSync(data,out){return inflt((zlv(data),data.subarray(2,-4)),out)} +__name(unzlibSync,"unzlibSync");var td=typeof TextDecoder<"u"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}), +tds=1}catch{}function findSpan(p2,u2,U){let n=U.length-p2-1;if(u2>=U[n])return n-1;if(u2<=U[p2]) +return p2;let low=p2,high=n,mid=Math.floor((low+high)/2);for(;u2=U[mid+ +1];)u2=k&&(a[s2][0]=a[s1][0]/ndu[pk+1][rk],d2=a[s2][0]*ndu[rk][pk]);let j1=rk>=-1?1: +-rk,j2=r4-1<=pk?k-1:p2-r4;for(let j4=j1;j4<=j2;++j4)a[s2][j4]=(a[s1][j4]-a[s1][j4- +1])/ndu[pk+1][rk+j4],d2+=a[s2][j4]*ndu[rk+j4][pk];r4<=pk&&(a[s2][k]=-a[s1][k-1]/ +ndu[pk+1][r4],d2+=a[s2][k]*ndu[r4][pk]),ders[k][r4]=d2;let j3=s1;s1=s2,s2=j3}}let r3=p2; +for(let k=1;k<=n;++k){for(let j2=0;j2<=p2;++j2)ders[k][j2]*=r3;r3*=p2-k}return ders} +__name(calcBasisFunctionDerivatives,"calcBasisFunctionDerivatives");function calcBSplineDerivatives(p2,U,P2,u2,nd){ +let du=nd0,base64Content=typeof videoNode.Content=="string"&&videoNode. +Content!=="";if(arrayBufferContent||base64Content){let image=this.parseImage(videoNodes[nodeID]); +blobs[videoNode.RelativeFilename||videoNode.Filename]=image}}}}for(let id in images){ +let filename=images[id];blobs[filename]!==void 0?images[id]=blobs[filename]:images[id]= +images[id].split("\\").pop()}return images}parseImage(videoNode){let content=videoNode. +Content,fileName=videoNode.RelativeFilename||videoNode.Filename,extension=fileName. +slice(fileName.lastIndexOf(".")+1).toLowerCase(),type;switch(extension){case"bmp": +type="image/bmp";break;case"jpg":case"jpeg":type="image/jpeg";break;case"png":type= +"image/png";break;case"tif":type="image/tiff";break;case"tga":this.manager.getHandler( +".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",fileName), +type="image/tga";break;default:console.warn('FBXLoader: Image type "'+extension+ +'" is not supported.');return}if(typeof content=="string")return"data:"+type+";b\ +ase64,"+content;{let array=new Uint8Array(content);return window.URL.createObjectURL( +new Blob([array],{type}))}}parseTextures(images){let textureMap=new Map;if("Text\ +ure"in fbxTree.Objects){let textureNodes=fbxTree.Objects.Texture;for(let nodeID in textureNodes){ +let texture=this.parseTexture(textureNodes[nodeID],images);textureMap.set(parseInt( +nodeID),texture)}}return textureMap}parseTexture(textureNode,images){let texture=this. +loadTexture(textureNode,images);texture.ID=textureNode.id,texture.name=textureNode. +attrName;let wrapModeU=textureNode.WrapModeU,wrapModeV=textureNode.WrapModeV,valueU=wrapModeU!== +void 0?wrapModeU.value:0,valueV=wrapModeV!==void 0?wrapModeV.value:0;if(texture. +wrapS=valueU===0?RepeatWrapping2:ClampToEdgeWrapping2,texture.wrapT=valueV===0?RepeatWrapping2: +ClampToEdgeWrapping2,"Scaling"in textureNode){let values=textureNode.Scaling.value; +texture.repeat.x=values[0],texture.repeat.y=values[1]}if("Translation"in textureNode){ +let values=textureNode.Translation.value;texture.offset.x=values[0],texture.offset. +y=values[1]}return texture}loadTexture(textureNode,images){let fileName,currentPath=this. +textureLoader.path,children2=connections.get(textureNode.id).children;children2!== +void 0&&children2.length>0&&images[children2[0].ID]!==void 0&&(fileName=images[children2[0]. +ID],(fileName.indexOf("blob:")===0||fileName.indexOf("data:")===0)&&this.textureLoader. +setPath(void 0));let texture,extension=textureNode.FileName.slice(-3).toLowerCase(); +if(extension==="tga"){let loader=this.manager.getHandler(".tga");loader===null?(console. +warn("FBXLoader: TGA loader not found, creating placeholder texture for",textureNode. +RelativeFilename),texture=new Texture):(loader.setPath(this.textureLoader.path), +texture=loader.load(fileName))}else if(extension==="dds"){let loader=this.manager. +getHandler(".dds");loader===null?(console.warn("FBXLoader: DDS loader not found,\ + creating placeholder texture for",textureNode.RelativeFilename),texture=new Texture): +(loader.setPath(this.textureLoader.path),texture=loader.load(fileName))}else extension=== +"psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeho\ +lder texture for",textureNode.RelativeFilename),texture=new Texture):texture=this. +textureLoader.load(fileName);return this.textureLoader.setPath(currentPath),texture}parseMaterials(textureMap){ +let materialMap=new Map;if("Material"in fbxTree.Objects){let materialNodes=fbxTree. +Objects.Material;for(let nodeID in materialNodes){let material=this.parseMaterial( +materialNodes[nodeID],textureMap);material!==null&&materialMap.set(parseInt(nodeID), +material)}}return materialMap}parseMaterial(materialNode,textureMap){let ID=materialNode. +id,name2=materialNode.attrName,type=materialNode.ShadingModel;if(typeof type=="o\ +bject"&&(type=type.value),!connections.has(ID))return null;let parameters=this.parseParameters( +materialNode,textureMap,ID),material;switch(type.toLowerCase()){case"phong":material= +new MeshPhongMaterial2;break;case"lambert":material=new MeshLambertMaterial;break;default: +console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPho\ +ngMaterial.',type),material=new MeshPhongMaterial2;break}return material.setValues( +parameters),material.name=name2,material}parseParameters(materialNode,textureMap,ID){ +let parameters={};materialNode.BumpFactor&&(parameters.bumpScale=materialNode.BumpFactor. +value),materialNode.Diffuse?parameters.color=new Color2().fromArray(materialNode. +Diffuse.value).convertSRGBToLinear():materialNode.DiffuseColor&&(materialNode.DiffuseColor. +type==="Color"||materialNode.DiffuseColor.type==="ColorRGB")&&(parameters.color= +new Color2().fromArray(materialNode.DiffuseColor.value).convertSRGBToLinear()),materialNode. +DisplacementFactor&&(parameters.displacementScale=materialNode.DisplacementFactor. +value),materialNode.Emissive?parameters.emissive=new Color2().fromArray(materialNode. +Emissive.value).convertSRGBToLinear():materialNode.EmissiveColor&&(materialNode. +EmissiveColor.type==="Color"||materialNode.EmissiveColor.type==="ColorRGB")&&(parameters. +emissive=new Color2().fromArray(materialNode.EmissiveColor.value).convertSRGBToLinear()), +materialNode.EmissiveFactor&&(parameters.emissiveIntensity=parseFloat(materialNode. +EmissiveFactor.value)),materialNode.Opacity&&(parameters.opacity=parseFloat(materialNode. +Opacity.value)),parameters.opacity<1&&(parameters.transparent=!0),materialNode.ReflectionFactor&& +(parameters.reflectivity=materialNode.ReflectionFactor.value),materialNode.Shininess&& +(parameters.shininess=materialNode.Shininess.value),materialNode.Specular?parameters. +specular=new Color2().fromArray(materialNode.Specular.value).convertSRGBToLinear(): +materialNode.SpecularColor&&materialNode.SpecularColor.type==="Color"&&(parameters. +specular=new Color2().fromArray(materialNode.SpecularColor.value).convertSRGBToLinear()); +let scope=this;return connections.get(ID).children.forEach(function(child){let type=child. +relationship;switch(type){case"Bump":parameters.bumpMap=scope.getTexture(textureMap, +child.ID);break;case"Maya|TEX_ao_map":parameters.aoMap=scope.getTexture(textureMap, +child.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":parameters.map=scope. +getTexture(textureMap,child.ID),parameters.map!==void 0&&(parameters.map.colorSpace= +SRGBColorSpace2);break;case"DisplacementColor":parameters.displacementMap=scope. +getTexture(textureMap,child.ID);break;case"EmissiveColor":parameters.emissiveMap= +scope.getTexture(textureMap,child.ID),parameters.emissiveMap!==void 0&&(parameters. +emissiveMap.colorSpace=SRGBColorSpace2);break;case"NormalMap":case"Maya|TEX_norm\ +al_map":parameters.normalMap=scope.getTexture(textureMap,child.ID);break;case"Re\ +flectionColor":parameters.envMap=scope.getTexture(textureMap,child.ID),parameters. +envMap!==void 0&&(parameters.envMap.mapping=EquirectangularReflectionMapping2,parameters. +envMap.colorSpace=SRGBColorSpace2);break;case"SpecularColor":parameters.specularMap= +scope.getTexture(textureMap,child.ID),parameters.specularMap!==void 0&&(parameters. +specularMap.colorSpace=SRGBColorSpace2);break;case"TransparentColor":case"Transp\ +arencyFactor":parameters.alphaMap=scope.getTexture(textureMap,child.ID),parameters. +transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFac\ +tor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map\ + is not supported in three.js, skipping texture.",type);break}}),parameters}getTexture(textureMap,id){ +return"LayeredTexture"in fbxTree.Objects&&id in fbxTree.Objects.LayeredTexture&& +(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. \ +Discarding all but first layer."),id=connections.get(id).children[0].ID),textureMap. +get(id)}parseDeformers(){let skeletons={},morphTargets={};if("Deformer"in fbxTree. +Objects){let DeformerNodes=fbxTree.Objects.Deformer;for(let nodeID in DeformerNodes){ +let deformerNode=DeformerNodes[nodeID],relationships=connections.get(parseInt(nodeID)); +if(deformerNode.attrType==="Skin"){let skeleton=this.parseSkeleton(relationships, +DeformerNodes);skeleton.ID=nodeID,relationships.parents.length>1&&console.warn("\ +THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), +skeleton.geometryID=relationships.parents[0].ID,skeletons[nodeID]=skeleton}else if(deformerNode. +attrType==="BlendShape"){let morphTarget={id:nodeID};morphTarget.rawTargets=this. +parseMorphTargets(relationships,DeformerNodes),morphTarget.id=nodeID,relationships. +parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more t\ +han one geometry is not supported."),morphTargets[nodeID]=morphTarget}}}return{skeletons, +morphTargets}}parseSkeleton(relationships,deformerNodes){let rawBones=[];return relationships. +children.forEach(function(child){let boneNode=deformerNodes[child.ID];if(boneNode. +attrType!=="Cluster")return;let rawBone={ID:child.ID,indices:[],weights:[],transformLink:new Matrix42(). +fromArray(boneNode.TransformLink.a)};"Indexes"in boneNode&&(rawBone.indices=boneNode. +Indexes.a,rawBone.weights=boneNode.Weights.a),rawBones.push(rawBone)}),{rawBones, +bones:[]}}parseMorphTargets(relationships,deformerNodes){let rawMorphTargets=[]; +for(let i2=0;i21?material=materials:materials.length>0?material=materials[0]:(material=new MeshPhongMaterial2( +{name:Loader.DEFAULT_MATERIAL_NAME,color:13421772}),materials.push(material)),"c\ +olor"in geometry.attributes&&materials.forEach(function(material2){material2.vertexColors= +!0}),geometry.FBX_Deformer?(model=new SkinnedMesh(geometry,material),model.normalizeSkinWeights()): +model=new Mesh3(geometry,material),model}createCurve(relationships,geometryMap){ +let geometry=relationships.children.reduce(function(geo,child){return geometryMap. +has(child.ID)&&(geo=geometryMap.get(child.ID)),geo},null),material=new LineBasicMaterial2( +{name:Loader.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Line3( +geometry,material)}getTransformData(model,modelNode){let transformData={};"Inher\ +itType"in modelNode&&(transformData.inheritType=parseInt(modelNode.InheritType.value)), +"RotationOrder"in modelNode?transformData.eulerOrder=getEulerOrder(modelNode.RotationOrder. +value):transformData.eulerOrder="ZYX","Lcl_Translation"in modelNode&&(transformData. +translation=modelNode.Lcl_Translation.value),"PreRotation"in modelNode&&(transformData. +preRotation=modelNode.PreRotation.value),"Lcl_Rotation"in modelNode&&(transformData. +rotation=modelNode.Lcl_Rotation.value),"PostRotation"in modelNode&&(transformData. +postRotation=modelNode.PostRotation.value),"Lcl_Scaling"in modelNode&&(transformData. +scale=modelNode.Lcl_Scaling.value),"ScalingOffset"in modelNode&&(transformData.scalingOffset= +modelNode.ScalingOffset.value),"ScalingPivot"in modelNode&&(transformData.scalingPivot= +modelNode.ScalingPivot.value),"RotationOffset"in modelNode&&(transformData.rotationOffset= +modelNode.RotationOffset.value),"RotationPivot"in modelNode&&(transformData.rotationPivot= +modelNode.RotationPivot.value),model.userData.transformData=transformData}setLookAtProperties(model,modelNode){ +"LookAtProperty"in modelNode&&connections.get(model.ID).children.forEach(function(child){ +if(child.relationship==="LookAtProperty"){let lookAtTarget=fbxTree.Objects.Model[child. +ID];if("Lcl_Translation"in lookAtTarget){let pos=lookAtTarget.Lcl_Translation.value; +model.target!==void 0?(model.target.position.fromArray(pos),sceneGraph.add(model. +target)):model.lookAt(new Vector32().fromArray(pos))}}})}bindSkeleton(skeletons,geometryMap,modelMap){ +let bindMatrices=this.parsePoseNodes();for(let ID in skeletons){let skeleton=skeletons[ID]; +connections.get(parseInt(skeleton.ID)).parents.forEach(function(parent){if(geometryMap. +has(parent.ID)){let geoID=parent.ID;connections.get(geoID).parents.forEach(function(geoConnParent){ +modelMap.has(geoConnParent.ID)&&modelMap.get(geoConnParent.ID).bind(new Skeleton( +skeleton.bones),bindMatrices[geoConnParent.ID])})}})}}parsePoseNodes(){let bindMatrices={}; +if("Pose"in fbxTree.Objects){let BindPoseNode=fbxTree.Objects.Pose;for(let nodeID in BindPoseNode) +if(BindPoseNode[nodeID].attrType==="BindPose"&&BindPoseNode[nodeID].NbPoseNodes> +0){let poseNodes=BindPoseNode[nodeID].PoseNode;Array.isArray(poseNodes)?poseNodes. +forEach(function(poseNode){bindMatrices[poseNode.Node]=new Matrix42().fromArray( +poseNode.Matrix.a)}):bindMatrices[poseNodes.Node]=new Matrix42().fromArray(poseNodes. +Matrix.a)}}return bindMatrices}addGlobalSceneSettings(){if("GlobalSettings"in fbxTree){ +if("AmbientColor"in fbxTree.GlobalSettings){let ambientColor=fbxTree.GlobalSettings. +AmbientColor.value,r3=ambientColor[0],g=ambientColor[1],b=ambientColor[2];if(r3!== +0||g!==0||b!==0){let color=new Color2(r3,g,b).convertSRGBToLinear();sceneGraph.add( +new AmbientLight(color,1))}}"UnitScaleFactor"in fbxTree.GlobalSettings&&(sceneGraph. +userData.unitScaleFactor=fbxTree.GlobalSettings.UnitScaleFactor.value)}}},GeometryParser=class{static{ +__name(this,"GeometryParser")}constructor(){this.negativeMaterialIndices=!1}parse(deformers){ +let geometryMap=new Map;if("Geometry"in fbxTree.Objects){let geoNodes=fbxTree.Objects. +Geometry;for(let nodeID in geoNodes){let relationships=connections.get(parseInt( +nodeID)),geo=this.parseGeometry(relationships,geoNodes[nodeID],deformers);geometryMap. +set(parseInt(nodeID),geo)}}return this.negativeMaterialIndices===!0&&console.warn( +"THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The\ + asset might not render as expected."),geometryMap}parseGeometry(relationships,geoNode,deformers){ +switch(geoNode.attrType){case"Mesh":return this.parseMeshGeometry(relationships, +geoNode,deformers);case"NurbsCurve":return this.parseNurbsGeometry(geoNode)}}parseMeshGeometry(relationships,geoNode,deformers){ +let skeletons=deformers.skeletons,morphTargets=[],modelNodes=relationships.parents. +map(function(parent){return fbxTree.Objects.Model[parent.ID]});if(modelNodes.length=== +0)return;let skeleton=relationships.children.reduce(function(skeleton2,child){return skeletons[child. +ID]!==void 0&&(skeleton2=skeletons[child.ID]),skeleton2},null);relationships.children. +forEach(function(child){deformers.morphTargets[child.ID]!==void 0&&morphTargets. +push(deformers.morphTargets[child.ID])});let modelNode=modelNodes[0],transformData={}; +"RotationOrder"in modelNode&&(transformData.eulerOrder=getEulerOrder(modelNode.RotationOrder. +value)),"InheritType"in modelNode&&(transformData.inheritType=parseInt(modelNode. +InheritType.value)),"GeometricTranslation"in modelNode&&(transformData.translation= +modelNode.GeometricTranslation.value),"GeometricRotation"in modelNode&&(transformData. +rotation=modelNode.GeometricRotation.value),"GeometricScaling"in modelNode&&(transformData. +scale=modelNode.GeometricScaling.value);let transform=generateTransform(transformData); +return this.genGeometry(geoNode,skeleton,morphTargets,transform)}genGeometry(geoNode,skeleton,morphTargets,preTransform){ +let geo=new BufferGeometry2;geoNode.attrName&&(geo.name=geoNode.attrName);let geoInfo=this. +parseGeoNode(geoNode,skeleton),buffers=this.genBuffers(geoInfo),positionAttribute=new Float32BufferAttribute2( +buffers.vertex,3);if(positionAttribute.applyMatrix4(preTransform),geo.setAttribute( +"position",positionAttribute),buffers.colors.length>0&&geo.setAttribute("color", +new Float32BufferAttribute2(buffers.colors,3)),skeleton&&(geo.setAttribute("skin\ +Index",new Uint16BufferAttribute2(buffers.weightsIndices,4)),geo.setAttribute("s\ +kinWeight",new Float32BufferAttribute2(buffers.vertexWeights,4)),geo.FBX_Deformer= +skeleton),buffers.normal.length>0){let normalMatrix=new Matrix32().getNormalMatrix( +preTransform),normalAttribute=new Float32BufferAttribute2(buffers.normal,3);normalAttribute. +applyNormalMatrix(normalMatrix),geo.setAttribute("normal",normalAttribute)}if(buffers. +uvs.forEach(function(uvBuffer,i2){let name2=i2===0?"uv":`uv${i2}`;geo.setAttribute( +name2,new Float32BufferAttribute2(buffers.uvs[i2],2))}),geoInfo.material&&geoInfo. +material.mappingType!=="AllSame"){let prevMaterialIndex=buffers.materialIndex[0], +startIndex=0;if(buffers.materialIndex.forEach(function(currentIndex,i2){currentIndex!== +prevMaterialIndex&&(geo.addGroup(startIndex,i2-startIndex,prevMaterialIndex),prevMaterialIndex= +currentIndex,startIndex=i2)}),geo.groups.length>0){let lastGroup=geo.groups[geo. +groups.length-1],lastIndex=lastGroup.start+lastGroup.count;lastIndex!==buffers.materialIndex. +length&&geo.addGroup(lastIndex,buffers.materialIndex.length-lastIndex,prevMaterialIndex)} +geo.groups.length===0&&geo.addGroup(0,buffers.materialIndex.length,buffers.materialIndex[0])} +return this.addMorphTargets(geo,geoNode,morphTargets,preTransform),geo}parseGeoNode(geoNode,skeleton){ +let geoInfo={};if(geoInfo.vertexPositions=geoNode.Vertices!==void 0?geoNode.Vertices. +a:[],geoInfo.vertexIndices=geoNode.PolygonVertexIndex!==void 0?geoNode.PolygonVertexIndex. +a:[],geoNode.LayerElementColor&&(geoInfo.color=this.parseVertexColors(geoNode.LayerElementColor[0])), +geoNode.LayerElementMaterial&&(geoInfo.material=this.parseMaterialIndices(geoNode. +LayerElementMaterial[0])),geoNode.LayerElementNormal&&(geoInfo.normal=this.parseNormals( +geoNode.LayerElementNormal[0])),geoNode.LayerElementUV){geoInfo.uv=[];let i2=0;for(;geoNode. +LayerElementUV[i2];)geoNode.LayerElementUV[i2].UV&&geoInfo.uv.push(this.parseUVs( +geoNode.LayerElementUV[i2])),i2++}return geoInfo.weightTable={},skeleton!==null&& +(geoInfo.skeleton=skeleton,skeleton.rawBones.forEach(function(rawBone,i2){rawBone. +indices.forEach(function(index,j2){geoInfo.weightTable[index]===void 0&&(geoInfo. +weightTable[index]=[]),geoInfo.weightTable[index].push({id:i2,weight:rawBone.weights[j2]})})})), +geoInfo}genBuffers(geoInfo){let buffers={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[], +vertexWeights:[],weightsIndices:[]},polygonIndex=0,faceLength=0,displayedWeightsWarning=!1, +facePositionIndexes=[],faceNormals=[],faceColors=[],faceUVs=[],faceWeights=[],faceWeightIndices=[], +scope=this;return geoInfo.vertexIndices.forEach(function(vertexIndex,polygonVertexIndex){ +let materialIndex,endOfFace=!1;vertexIndex<0&&(vertexIndex=vertexIndex^-1,endOfFace= +!0);let weightIndices=[],weights=[];if(facePositionIndexes.push(vertexIndex*3,vertexIndex* +3+1,vertexIndex*3+2),geoInfo.color){let data=getData(polygonVertexIndex,polygonIndex, +vertexIndex,geoInfo.color);faceColors.push(data[0],data[1],data[2])}if(geoInfo.skeleton){ +if(geoInfo.weightTable[vertexIndex]!==void 0&&geoInfo.weightTable[vertexIndex].forEach( +function(wt){weights.push(wt.weight),weightIndices.push(wt.id)}),weights.length> +4){displayedWeightsWarning||(console.warn("THREE.FBXLoader: Vertex has more than\ + 4 skinning weights assigned to vertex. Deleting additional weights."),displayedWeightsWarning= +!0);let wIndex=[0,0,0,0],Weight=[0,0,0,0];weights.forEach(function(weight,weightIndex){ +let currentWeight=weight,currentIndex=weightIndices[weightIndex];Weight.forEach( +function(comparedWeight,comparedWeightIndex,comparedWeightArray){if(currentWeight> +comparedWeight){comparedWeightArray[comparedWeightIndex]=currentWeight,currentWeight= +comparedWeight;let tmp2=wIndex[comparedWeightIndex];wIndex[comparedWeightIndex]= +currentIndex,currentIndex=tmp2}})}),weightIndices=wIndex,weights=Weight}for(;weights. +length<4;)weights.push(0),weightIndices.push(0);for(let i2=0;i2<4;++i2)faceWeights. +push(weights[i2]),faceWeightIndices.push(weightIndices[i2])}if(geoInfo.normal){let data=getData( +polygonVertexIndex,polygonIndex,vertexIndex,geoInfo.normal);faceNormals.push(data[0], +data[1],data[2])}geoInfo.material&&geoInfo.material.mappingType!=="AllSame"&&(materialIndex= +getData(polygonVertexIndex,polygonIndex,vertexIndex,geoInfo.material)[0],materialIndex< +0&&(scope.negativeMaterialIndices=!0,materialIndex=0)),geoInfo.uv&&geoInfo.uv.forEach( +function(uv,i2){let data=getData(polygonVertexIndex,polygonIndex,vertexIndex,uv); +faceUVs[i2]===void 0&&(faceUVs[i2]=[]),faceUVs[i2].push(data[0]),faceUVs[i2].push( +data[1])}),faceLength++,endOfFace&&(scope.genFace(buffers,geoInfo,facePositionIndexes, +materialIndex,faceNormals,faceColors,faceUVs,faceWeights,faceWeightIndices,faceLength), +polygonIndex++,faceLength=0,facePositionIndexes=[],faceNormals=[],faceColors=[], +faceUVs=[],faceWeights=[],faceWeightIndices=[])}),buffers}getNormalNewell(vertices){ +let normal=new Vector32(0,0,0);for(let i2=0;i2 +.5?new Vector32(0,1,0):new Vector32(0,0,1)).cross(normalVector).normalize(),bitangent=normalVector. +clone().cross(tangent).normalize();return{normal:normalVector,tangent,bitangent}}flattenVertex(vertex20,normalTangent,normalBitangent){ +return new Vector22(vertex20.dot(normalTangent),vertex20.dot(normalBitangent))}genFace(buffers,geoInfo,facePositionIndexes,materialIndex,faceNormals,faceColors,faceUVs,faceWeights,faceWeightIndices,faceLength){ +let triangles;if(faceLength>3){let vertices=[];for(let i2=0;i21&&console. +warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this\ + is currently not supported. Ignoring subsequent layers.");let layer=layersMap.get( +children2[0].ID);rawClips[nodeID]={name:rawStacks[nodeID].attrName,layer}}return rawClips}addClip(rawClip){ +let tracks=[],scope=this;return rawClip.layer.forEach(function(rawTracks){tracks= +tracks.concat(scope.generateTracks(rawTracks))}),new AnimationClip(rawClip.name, +-1,tracks)}generateTracks(rawTracks){let tracks=[],initialPosition=new Vector32, +initialScale=new Vector32;if(rawTracks.transform&&rawTracks.transform.decompose( +initialPosition,new Quaternion2,initialScale),initialPosition=initialPosition.toArray(), +initialScale=initialScale.toArray(),rawTracks.T!==void 0&&Object.keys(rawTracks. +T.curves).length>0){let positionTrack=this.generateVectorTrack(rawTracks.modelName, +rawTracks.T.curves,initialPosition,"position");positionTrack!==void 0&&tracks.push( +positionTrack)}if(rawTracks.R!==void 0&&Object.keys(rawTracks.R.curves).length>0){ +let rotationTrack=this.generateRotationTrack(rawTracks.modelName,rawTracks.R.curves, +rawTracks.preRotation,rawTracks.postRotation,rawTracks.eulerOrder);rotationTrack!== +void 0&&tracks.push(rotationTrack)}if(rawTracks.S!==void 0&&Object.keys(rawTracks. +S.curves).length>0){let scaleTrack=this.generateVectorTrack(rawTracks.modelName, +rawTracks.S.curves,initialScale,"scale");scaleTrack!==void 0&&tracks.push(scaleTrack)} +if(rawTracks.DeformPercent!==void 0){let morphTrack=this.generateMorphTrack(rawTracks); +morphTrack!==void 0&&tracks.push(morphTrack)}return tracks}generateVectorTrack(modelName,curves,initialValue,type){ +let times=this.getTimesForAllAxes(curves),values=this.getKeyframeTrackValues(times, +curves,initialValue);return new VectorKeyframeTrack(modelName+"."+type,times,values)}generateRotationTrack(modelName,curves,preRotation,postRotation,eulerOrder){ +let times,values;if(curves.x!==void 0&&curves.y!==void 0&&curves.z!==void 0){let result=this. +interpolateRotations(curves.x,curves.y,curves.z,eulerOrder);times=result[0],values= +result[1]}preRotation!==void 0&&(preRotation=preRotation.map(MathUtils.degToRad), +preRotation.push(eulerOrder),preRotation=new Euler2().fromArray(preRotation),preRotation= +new Quaternion2().setFromEuler(preRotation)),postRotation!==void 0&&(postRotation= +postRotation.map(MathUtils.degToRad),postRotation.push(eulerOrder),postRotation= +new Euler2().fromArray(postRotation),postRotation=new Quaternion2().setFromEuler( +postRotation).invert());let quaternion=new Quaternion2,euler=new Euler2,quaternionValues=[]; +if(!values||!times)return new QuaternionKeyframeTrack(modelName+".quaternion",[], +[]);for(let i2=0;i22&&new Quaternion2(). +fromArray(quaternionValues,(i2-3)/3*4).dot(quaternion)<0&&quaternion.set(-quaternion. +x,-quaternion.y,-quaternion.z,-quaternion.w),quaternion.toArray(quaternionValues, +i2/3*4);return new QuaternionKeyframeTrack(modelName+".quaternion",times,quaternionValues)}generateMorphTrack(rawTracks){ +let curves=rawTracks.DeformPercent.curves.morph,values=curves.values.map(function(val){ +return val/100}),morphNum=sceneGraph.getObjectByName(rawTracks.modelName).morphTargetDictionary[rawTracks. +morphName];return new NumberKeyframeTrack(rawTracks.modelName+".morphTargetInflu\ +ences["+morphNum+"]",curves.times,values)}getTimesForAllAxes(curves){let times=[]; +if(curves.x!==void 0&&(times=times.concat(curves.x.times)),curves.y!==void 0&&(times= +times.concat(curves.y.times)),curves.z!==void 0&&(times=times.concat(curves.z.times)), +times=times.sort(function(a,b){return a-b}),times.length>1){let targetIndex=1,lastValue=times[0]; +for(let i2=1;i2=180||absoluteSpan[1]>=180||absoluteSpan[2]>=180){let numSubIntervals=Math. +max(...absoluteSpan)/180,E1=new Euler2(...initialValueRad,eulerOrder),E2=new Euler2( +...currentValueRad,eulerOrder),Q1=new Quaternion2().setFromEuler(E1),Q2=new Quaternion2(). +setFromEuler(E2);Q1.dot(Q2)&&Q2.set(-Q2.x,-Q2.y,-Q2.z,-Q2.w);let initialTime=curvex. +times[i2-1],timeSpan=curvex.times[i2]-initialTime,Q3=new Quaternion2,E=new Euler2; +for(let t=0;t<1;t+=1/numSubIntervals)Q3.copy(Q1.clone().slerp(Q2.clone(),t)),times. +push(initialTime+t*timeSpan),E.setFromQuaternion(Q3,eulerOrder),values.push(E.x), +values.push(E.y),values.push(E.z)}else times.push(curvex.times[i2]),values.push( +MathUtils.degToRad(curvex.values[i2])),values.push(MathUtils.degToRad(curvey.values[i2])), +values.push(MathUtils.degToRad(curvez.values[i2]))}return[times,values]}},TextParser=class{static{ +__name(this,"TextParser")}getPrevNode(){return this.nodeStack[this.currentIndent- +2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){ +return this.currentProp}pushStack(node){this.nodeStack.push(node),this.currentIndent+= +1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(val,name2){ +this.currentProp=val,this.currentPropName=name2}parse(text){this.currentIndent=0, +this.allNodes=new FBXTree,this.nodeStack=[],this.currentProp=[],this.currentPropName= +"";let scope=this,split=text.split(/[\r\n]+/);return split.forEach(function(line,i2){ +let matchComment=line.match(/^[\s\t]*;/),matchEmpty=line.match(/^[\s\t]*$/);if(matchComment|| +matchEmpty)return;let matchBeginning=line.match("^\\t{"+scope.currentIndent+"}(\\\ +w+):(.*){",""),matchProperty=line.match("^\\t{"+scope.currentIndent+"}(\\w+):[\\s\\\ +t\\r\\n](.*)"),matchEnd=line.match("^\\t{"+(scope.currentIndent-1)+"}}");matchBeginning? +scope.parseNodeBegin(line,matchBeginning):matchProperty?scope.parseNodeProperty( +line,matchProperty,split[++i2]):matchEnd?scope.popStack():line.match(/^[^\s\t}]/)&& +scope.parseNodePropertyContinued(line)}),this.allNodes}parseNodeBegin(line,property){ +let nodeName=property[1].trim().replace(/^"/,"").replace(/"$/,""),nodeAttrs=property[2]. +split(",").map(function(attr){return attr.trim().replace(/^"/,"").replace(/"$/,"")}), +node={name:nodeName},attrs=this.parseNodeAttr(nodeAttrs),currentNode=this.getCurrentNode(); +this.currentIndent===0?this.allNodes.add(nodeName,node):nodeName in currentNode? +(nodeName==="PoseNode"?currentNode.PoseNode.push(node):currentNode[nodeName].id!== +void 0&&(currentNode[nodeName]={},currentNode[nodeName][currentNode[nodeName].id]= +currentNode[nodeName]),attrs.id!==""&&(currentNode[nodeName][attrs.id]=node)):typeof attrs. +id=="number"?(currentNode[nodeName]={},currentNode[nodeName][attrs.id]=node):nodeName!== +"Properties70"&&(nodeName==="PoseNode"?currentNode[nodeName]=[node]:currentNode[nodeName]= +node),typeof attrs.id=="number"&&(node.id=attrs.id),attrs.name!==""&&(node.attrName= +attrs.name),attrs.type!==""&&(node.attrType=attrs.type),this.pushStack(node)}parseNodeAttr(attrs){ +let id=attrs[0];attrs[0]!==""&&(id=parseInt(attrs[0]),isNaN(id)&&(id=attrs[0])); +let name2="",type="";return attrs.length>1&&(name2=attrs[1].replace(/^(\w+)::/,""), +type=attrs[2]),{id,name:name2,type}}parseNodeProperty(line,property,contentLine){ +let propName=property[1].replace(/^"/,"").replace(/"$/,"").trim(),propValue=property[2]. +replace(/^"/,"").replace(/"$/,"").trim();propName==="Content"&&propValue===","&& +(propValue=contentLine.replace(/"/g,"").replace(/,$/,"").trim());let currentNode=this. +getCurrentNode();if(currentNode.name==="Properties70"){this.parseNodeSpecialProperty( +line,propName,propValue);return}if(propName==="C"){let connProps=propValue.split( +",").slice(1),from=parseInt(connProps[0]),to=parseInt(connProps[1]),rest=propValue. +split(",").slice(3);rest=rest.map(function(elem){return elem.trim().replace(/^"/, +"")}),propName="connections",propValue=[from,to],append(propValue,rest),currentNode[propName]=== +void 0&&(currentNode[propName]=[])}propName==="Node"&&(currentNode.id=propValue), +propName in currentNode&&Array.isArray(currentNode[propName])?currentNode[propName]. +push(propValue):propName!=="a"?currentNode[propName]=propValue:currentNode.a=propValue, +this.setCurrentProp(currentNode,propName),propName==="a"&&propValue.slice(-1)!== +","&&(currentNode.a=parseNumberArray(propValue))}parseNodePropertyContinued(line){ +let currentNode=this.getCurrentNode();currentNode.a+=line,line.slice(-1)!==","&& +(currentNode.a=parseNumberArray(currentNode.a))}parseNodeSpecialProperty(line,propName,propValue){ +let props=propValue.split('",').map(function(prop){return prop.trim().replace(/^\"/, +"").replace(/\s/,"_")}),innerPropName=props[0],innerPropType1=props[1],innerPropType2=props[2], +innerPropFlag=props[3],innerPropValue=props[4];switch(innerPropType1){case"int":case"\ +enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":innerPropValue= +parseFloat(innerPropValue);break;case"Color":case"ColorRGB":case"Vector3D":case"\ +Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":innerPropValue=parseNumberArray( +innerPropValue);break}this.getPrevNode()[innerPropName]={type:innerPropType1,type2:innerPropType2, +flag:innerPropFlag,value:innerPropValue},this.setCurrentProp(this.getPrevNode(), +innerPropName)}},BinaryParser=class{static{__name(this,"BinaryParser")}parse(buffer){ +let reader=new BinaryReader(buffer);reader.skip(23);let version3=reader.getUint32(); +if(version3<6400)throw new Error("THREE.FBXLoader: FBX version not supported, Fi\ +leVersion: "+version3);let allNodes=new FBXTree;for(;!this.endOfContent(reader);){ +let node=this.parseNode(reader,version3);node!==null&&allNodes.add(node.name,node)} +return allNodes}endOfContent(reader){return reader.size()%16===0?(reader.getOffset()+ +160+16&-16)>=reader.size():reader.getOffset()+160+16>=reader.size()}parseNode(reader,version3){ +let node={},endOffset=version3>=7500?reader.getUint64():reader.getUint32(),numProperties=version3>= +7500?reader.getUint64():reader.getUint32();version3>=7500?reader.getUint64():reader. +getUint32();let nameLen=reader.getUint8(),name2=reader.getString(nameLen);if(endOffset=== +0)return null;let propertyList=[];for(let i2=0;i20?propertyList[0]:"", +attrName2=propertyList.length>1?propertyList[1]:"",attrType=propertyList.length> +2?propertyList[2]:"";for(node.singleProperty=numProperties===1&&reader.getOffset()=== +endOffset;endOffset>reader.getOffset();){let subNode=this.parseNode(reader,version3); +subNode!==null&&this.parseSubNode(name2,node,subNode)}return node.propertyList=propertyList, +typeof id=="number"&&(node.id=id),attrName2!==""&&(node.attrName=attrName2),attrType!== +""&&(node.attrType=attrType),name2!==""&&(node.name=name2),node}parseSubNode(name2,node,subNode){ +if(subNode.singleProperty===!0){let value=subNode.propertyList[0];Array.isArray( +value)?(node[subNode.name]=subNode,subNode.a=value):node[subNode.name]=value}else if(name2=== +"Connections"&&subNode.name==="C"){let array=[];subNode.propertyList.forEach(function(property,i2){ +i2!==0&&array.push(property)}),node.connections===void 0&&(node.connections=[]), +node.connections.push(array)}else if(subNode.name==="Properties70")Object.keys(subNode). +forEach(function(key2){node[key2]=subNode[key2]});else if(name2==="Properties70"&& +subNode.name==="P"){let innerPropName=subNode.propertyList[0],innerPropType1=subNode. +propertyList[1],innerPropType2=subNode.propertyList[2],innerPropFlag=subNode.propertyList[3], +innerPropValue;innerPropName.indexOf("Lcl ")===0&&(innerPropName=innerPropName.replace( +"Lcl ","Lcl_")),innerPropType1.indexOf("Lcl ")===0&&(innerPropType1=innerPropType1. +replace("Lcl ","Lcl_")),innerPropType1==="Color"||innerPropType1==="ColorRGB"||innerPropType1=== +"Vector"||innerPropType1==="Vector3D"||innerPropType1.indexOf("Lcl_")===0?innerPropValue= +[subNode.propertyList[4],subNode.propertyList[5],subNode.propertyList[6]]:innerPropValue= +subNode.propertyList[4],node[innerPropName]={type:innerPropType1,type2:innerPropType2, +flag:innerPropFlag,value:innerPropValue}}else node[subNode.name]===void 0?typeof subNode. +id=="number"?(node[subNode.name]={},node[subNode.name][subNode.id]=subNode):node[subNode. +name]=subNode:subNode.name==="PoseNode"?(Array.isArray(node[subNode.name])||(node[subNode. +name]=[node[subNode.name]]),node[subNode.name].push(subNode)):node[subNode.name][subNode. +id]===void 0&&(node[subNode.name][subNode.id]=subNode)}parseProperty(reader){let type=reader. +getString(1),length;switch(type){case"C":return reader.getBoolean();case"D":return reader. +getFloat64();case"F":return reader.getFloat32();case"I":return reader.getInt32();case"\ +L":return reader.getInt64();case"R":return length=reader.getUint32(),reader.getArrayBuffer( +length);case"S":return length=reader.getUint32(),reader.getString(length);case"Y": +return reader.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":let arrayLength=reader. +getUint32(),encoding=reader.getUint32(),compressedLength=reader.getUint32();if(encoding=== +0)switch(type){case"b":case"c":return reader.getBooleanArray(arrayLength);case"d": +return reader.getFloat64Array(arrayLength);case"f":return reader.getFloat32Array( +arrayLength);case"i":return reader.getInt32Array(arrayLength);case"l":return reader. +getInt64Array(arrayLength)}let data=unzlibSync(new Uint8Array(reader.getArrayBuffer( +compressedLength))),reader2=new BinaryReader(data.buffer);switch(type){case"b":case"\ +c":return reader2.getBooleanArray(arrayLength);case"d":return reader2.getFloat64Array( +arrayLength);case"f":return reader2.getFloat32Array(arrayLength);case"i":return reader2. +getInt32Array(arrayLength);case"l":return reader2.getInt64Array(arrayLength)}break;default: +throw new Error("THREE.FBXLoader: Unknown property type "+type)}}},BinaryReader=class{static{ +__name(this,"BinaryReader")}constructor(buffer,littleEndian){this.dv=new DataView( +buffer),this.offset=0,this.littleEndian=littleEndian!==void 0?littleEndian:!0,this. +_textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv. +buffer.byteLength}skip(length){this.offset+=length}getBoolean(){return(this.getUint8()& +1)===1}getBooleanArray(size3){let a=[];for(let i2=0;i2=0&&(a=new Uint8Array( +this.dv.buffer,start,nullByte)),this._textDecoder.decode(a)}},FBXTree=class{static{ +__name(this,"FBXTree")}add(key2,val){this[key2]=val}};function isFbxFormatBinary(buffer){ +let CORRECT="Kaydara FBX Binary \0";return buffer.byteLength>=CORRECT.length&&CORRECT=== +convertArrayBufferToString(buffer,0,CORRECT.length)}__name(isFbxFormatBinary,"is\ +FbxFormatBinary");function isFbxFormatASCII(text){let CORRECT=["K","a","y","d","\ +a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],cursor=0;function read(offset){ +let result=text[offset-1];return text=text.slice(cursor+offset),cursor++,result} +__name(read,"read");for(let i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers32=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=RenderableBehavior,_instanceExtraInitializers=[], +_src_decorators,_src_initializers=[],_centerGeometry_decorators,_centerGeometry_initializers=[]; +var FbxModelBehavior2=class extends _classSuper{static{__name(this,"FbxModelBeha\ +vior")}static{_classThis=this}static{let _metadata=typeof Symbol=="function"&&Symbol. +metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;_src_decorators= +[stringAttribute,receiver],_centerGeometry_decorators=[booleanAttribute,receiver], +__esDecorate32(null,null,_src_decorators,{kind:"field",name:"src",static:!1,private:!1, +access:{has:obj=>"src"in obj,get:obj=>obj.src,set:(obj,value)=>{obj.src=value}}, +metadata:_metadata},_src_initializers,_instanceExtraInitializers),__esDecorate32( +null,null,_centerGeometry_decorators,{kind:"field",name:"centerGeometry",static:!1, +private:!1,access:{has:obj=>"centerGeometry"in obj,get:obj=>obj.centerGeometry,set:(obj,value)=>{ +obj.centerGeometry=value}},metadata:_metadata},_centerGeometry_initializers,_instanceExtraInitializers), +__esDecorate32(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),FbxModelBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers32( +_classThis,_classExtraInitializers)}src=(__runInitializers32(this,_instanceExtraInitializers), +__runInitializers32(this,_src_initializers,""));centerGeometry=__runInitializers32( +this,_centerGeometry_initializers,!1);loader=new FBXLoader;model;#version=0;connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{let src=createMemo(()=>this.src), +center=createMemo(()=>this.centerGeometry);createEffect(()=>{src(),center(),untrack( +()=>this.#loadModel()),onCleanup(()=>{this.model&&disposeObjectTree(this.model), +this.model=void 0,this.#version++})})})}#loadModel(){let{src}=this,version3=this.#version; +src&&this.loader.load(src,model=>version3===this.#version&&this.#setModel(model), +progress=>version3===this.#version&&this.element.emit(Events.PROGRESS,progress), +error=>version3===this.#version&&this.#onError(error))}#onError(error){let message=`\ +Failed to load ${this.element.tagName.toLowerCase()} with src "${this.src}". See\ + the following error.`;console.warn(message);let err=error instanceof ErrorEvent&& +error.error?error.error:error;console.error(err),this.element.emit(Events.MODEL_ERROR, +err)}#setModel(model){if(this.model=model,this.centerGeometry){let box=new Box3; +box.setFromObject(model);let center=new Vector3;box.getCenter(center),model.position. +copy(center.negate())}this.element.three.add(model),this.element.emit(Events.MODEL_LOAD, +{format:"fbx",model}),this.element.needsUpdate()}};return FbxModelBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("fbx-model")&&elementBehaviors. +define("fbx-model",FbxModelBehavior);var Scene2=class extends Object3D{static{__name(this,"Scene")}constructor(){super(), +this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this. +fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial= +null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent( +"observe",{detail:this}))}copy(source,recursive){return super.copy(source,recursive), +source.background!==null&&(this.background=source.background.clone()),source.environment!== +null&&(this.environment=source.environment.clone()),source.fog!==null&&(this.fog= +source.fog.clone()),this.backgroundBlurriness=source.backgroundBlurriness,this.backgroundIntensity= +source.backgroundIntensity,source.overrideMaterial!==null&&(this.overrideMaterial= +source.overrideMaterial.clone()),this.matrixAutoUpdate=source.matrixAutoUpdate,this}toJSON(meta){ +let data=super.toJSON(meta);return this.fog!==null&&(data.object.fog=this.fog.toJSON()), +this.backgroundBlurriness>0&&(data.object.backgroundBlurriness=this.backgroundBlurriness), +this.backgroundIntensity!==1&&(data.object.backgroundIntensity=this.backgroundIntensity), +data}};var _taskCache=new WeakMap,DRACOLoader=class extends Loader{static{__name(this,"\ +DRACOLoader")}constructor(manager){super(manager),this.decoderPath="",this.decoderConfig= +{},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool= +[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"\ +POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes= +{position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32A\ +rray"}}setDecoderPath(path){return this.decoderPath=path,this}setDecoderConfig(config){ +return this.decoderConfig=config,this}setWorkerLimit(workerLimit){return this.workerLimit= +workerLimit,this}load(url,onLoad,onProgress,onError){let loader=new FileLoader(this. +manager);loader.setPath(this.path),loader.setResponseType("arraybuffer"),loader. +setRequestHeader(this.requestHeader),loader.setWithCredentials(this.withCredentials), +loader.load(url,buffer=>{this.parse(buffer,onLoad,onError)},onProgress,onError)}parse(buffer,onLoad,onError=()=>{}){ +this.decodeDracoFile(buffer,onLoad,null,null,SRGBColorSpace2).catch(onError)}decodeDracoFile(buffer,callback,attributeIDs,attributeTypes,vertexColorSpace=LinearSRGBColorSpace2,onError=()=>{}){ +let taskConfig={attributeIDs:attributeIDs||this.defaultAttributeIDs,attributeTypes:attributeTypes|| +this.defaultAttributeTypes,useUniqueIDs:!!attributeIDs,vertexColorSpace};return this. +decodeGeometry(buffer,taskConfig).then(callback).catch(onError)}decodeGeometry(buffer,taskConfig){ +let taskKey=JSON.stringify(taskConfig);if(_taskCache.has(buffer)){let cachedTask=_taskCache. +get(buffer);if(cachedTask.key===taskKey)return cachedTask.promise;if(buffer.byteLength=== +0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with differen\ +t settings. Buffer has already been transferred.")}let worker,taskID=this.workerNextTaskID++, +taskCost=buffer.byteLength,geometryPending=this._getWorker(taskID,taskCost).then( +_worker=>(worker=_worker,new Promise((resolve,reject)=>{worker._callbacks[taskID]= +{resolve,reject},worker.postMessage({type:"decode",id:taskID,taskConfig,buffer}, +[buffer])}))).then(message=>this._createGeometry(message.geometry));return geometryPending. +catch(()=>!0).then(()=>{worker&&taskID&&this._releaseTask(worker,taskID)}),_taskCache. +set(buffer,{key:taskKey,promise:geometryPending}),geometryPending}_createGeometry(geometryData){ +let geometry=new BufferGeometry2;geometryData.index&&geometry.setIndex(new BufferAttribute2( +geometryData.index.array,1));for(let i2=0;i2{loader.load(url,resolve,void 0,reject)})}preload(){ +return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this. +decoderPending;let useJS=typeof WebAssembly!="object"||this.decoderConfig.type=== +"js",librariesPending=[];return useJS?librariesPending.push(this._loadLibrary("d\ +raco_decoder.js","text")):(librariesPending.push(this._loadLibrary("draco_wasm_w\ +rapper.js","text")),librariesPending.push(this._loadLibrary("draco_decoder.wasm", +"arraybuffer"))),this.decoderPending=Promise.all(librariesPending).then(libraries=>{ +let jsContent=libraries[0];useJS||(this.decoderConfig.wasmBinary=libraries[1]);let fn=DRACOWorker. +toString(),body=["/* draco decoder */",jsContent,"","/* worker */",fn.substring( +fn.indexOf("{")+1,fn.lastIndexOf("}"))].join(` +`);this.workerSourceURL=URL.createObjectURL(new Blob([body]))}),this.decoderPending}_getWorker(taskID,taskCost){ +return this._initDecoder().then(()=>{if(this.workerPool.lengthb._taskLoad?-1:1});let worker=this.workerPool[this. +workerPool.length-1];return worker._taskCosts[taskID]=taskCost,worker._taskLoad+= +taskCost,worker})}_releaseTask(worker,taskID){worker._taskLoad-=worker._taskCosts[taskID], +delete worker._callbacks[taskID],delete worker._taskCosts[taskID]}debug(){console. +log("Task load: ",this.workerPool.map(worker=>worker._taskLoad))}dispose(){for(let i2=0;i2< +this.workerPool.length;++i2)this.workerPool[i2].terminate();return this.workerPool. +length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}; +function DRACOWorker(){let decoderConfig,decoderPending;onmessage=__name(function(e){ +let message=e.data;switch(message.type){case"init":decoderConfig=message.decoderConfig, +decoderPending=new Promise(function(resolve){decoderConfig.onModuleLoaded=function(draco){ +resolve({draco})},DracoDecoderModule(decoderConfig)});break;case"decode":let buffer=message. +buffer,taskConfig=message.taskConfig;decoderPending.then(module=>{let draco=module. +draco,decoder=new draco.Decoder;try{let geometry=decodeGeometry(draco,decoder,new Int8Array( +buffer),taskConfig),buffers=geometry.attributes.map(attr=>attr.array.buffer);geometry. +index&&buffers.push(geometry.index.array.buffer),self.postMessage({type:"decode", +id:message.id,geometry},buffers)}catch(error){console.error(error),self.postMessage( +{type:"error",id:message.id,error:error.message})}finally{draco.destroy(decoder)}}); +break}},"onmessage");function decodeGeometry(draco,decoder,array,taskConfig){let attributeIDs=taskConfig. +attributeIDs,attributeTypes=taskConfig.attributeTypes,dracoGeometry,decodingStatus, +geometryType=decoder.GetEncodedGeometryType(array);if(geometryType===draco.TRIANGULAR_MESH) +dracoGeometry=new draco.Mesh,decodingStatus=decoder.DecodeArrayToMesh(array,array. +byteLength,dracoGeometry);else if(geometryType===draco.POINT_CLOUD)dracoGeometry= +new draco.PointCloud,decodingStatus=decoder.DecodeArrayToPointCloud(array,array. +byteLength,dracoGeometry);else throw new Error("THREE.DRACOLoader: Unexpected ge\ +ometry type.");if(!decodingStatus.ok()||dracoGeometry.ptr===0)throw new Error("T\ +HREE.DRACOLoader: Decoding failed: "+decodingStatus.error_msg());let geometry={index:null, +attributes:[]};for(let attributeName in attributeIDs){let attributeType=self[attributeTypes[attributeName]], +attribute2,attributeID;if(taskConfig.useUniqueIDs)attributeID=attributeIDs[attributeName], +attribute2=decoder.GetAttributeByUniqueId(dracoGeometry,attributeID);else{if(attributeID= +decoder.GetAttributeId(dracoGeometry,draco[attributeIDs[attributeName]]),attributeID=== +-1)continue;attribute2=decoder.GetAttribute(dracoGeometry,attributeID)}let attributeResult=decodeAttribute( +draco,decoder,dracoGeometry,attributeName,attributeType,attribute2);attributeName=== +"color"&&(attributeResult.vertexColorSpace=taskConfig.vertexColorSpace),geometry. +attributes.push(attributeResult)}return geometryType===draco.TRIANGULAR_MESH&&(geometry. +index=decodeIndex(draco,decoder,dracoGeometry)),draco.destroy(dracoGeometry),geometry} +__name(decodeGeometry,"decodeGeometry");function decodeIndex(draco,decoder,dracoGeometry){ +let numIndices=dracoGeometry.num_faces()*3,byteLength=numIndices*4,ptr=draco._malloc( +byteLength);decoder.GetTrianglesUInt32Array(dracoGeometry,byteLength,ptr);let index=new Uint32Array( +draco.HEAPF32.buffer,ptr,numIndices).slice();return draco._free(ptr),{array:index, +itemSize:1}}__name(decodeIndex,"decodeIndex");function decodeAttribute(draco,decoder,dracoGeometry,attributeName,attributeType,attribute2){ +let numComponents=attribute2.num_components(),numValues=dracoGeometry.num_points()* +numComponents,byteLength=numValues*attributeType.BYTES_PER_ELEMENT,dataType=getDracoDataType( +draco,attributeType),ptr=draco._malloc(byteLength);decoder.GetAttributeDataArrayForAllPoints( +dracoGeometry,attribute2,dataType,byteLength,ptr);let array=new attributeType(draco. +HEAPF32.buffer,ptr,numValues).slice();return draco._free(ptr),{name:attributeName, +array,itemSize:numComponents}}__name(decodeAttribute,"decodeAttribute");function getDracoDataType(draco,attributeType){ +switch(attributeType){case Float32Array:return draco.DT_FLOAT32;case Int8Array:return draco. +DT_INT8;case Int16Array:return draco.DT_INT16;case Int32Array:return draco.DT_INT32;case Uint8Array: +return draco.DT_UINT8;case Uint16Array:return draco.DT_UINT16;case Uint32Array:return draco. +DT_UINT32}}__name(getDracoDataType,"getDracoDataType")}__name(DRACOWorker,"DRACO\ +Worker");function toTrianglesDrawMode(geometry,drawMode){if(drawMode===TrianglesDrawMode) +return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry a\ +lready defined as triangles."),geometry;if(drawMode===TriangleFanDrawMode||drawMode=== +TriangleStripDrawMode){let index=geometry.getIndex();if(index===null){let indices=[], +position2=geometry.getAttribute("position");if(position2!==void 0){for(let i2=0;i2< +position2.count;i2++)indices.push(i2);geometry.setIndex(indices),index=geometry. +getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawM\ +ode(): Undefined position attribute. Processing not possible."),geometry}let numberOfTriangles=index. +count-2,newIndices=[];if(drawMode===TriangleFanDrawMode)for(let i2=1;i2<=numberOfTriangles;i2++) +newIndices.push(index.getX(0)),newIndices.push(index.getX(i2)),newIndices.push(index. +getX(i2+1));else for(let i2=0;i2=2.0 are supported."));return}let parser=new GLTFParser( +json,{path:path||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this. +requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this. +meshoptDecoder});parser.fileLoader.setRequestHeader(this.requestHeader);for(let i2=0;i2< +this.pluginCallbacks.length;i2++){let plugin=this.pluginCallbacks[i2](parser);plugin. +name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),plugins[plugin. +name]=plugin,extensions[plugin.name]=!0}if(json.extensionsUsed)for(let i2=0;i2= +0&&plugins[extensionName]===void 0&&console.warn('THREE.GLTFLoader: Unknown exte\ +nsion "'+extensionName+'".')}}parser.setExtensions(extensions),parser.setPlugins( +plugins),parser.parse(onLoad,onError)}parseAsync(data,path){let scope=this;return new Promise( +function(resolve,reject){scope.parse(data,path,resolve,reject)})}};function GLTFRegistry(){ +let objects={};return{get:function(key2){return objects[key2]},add:function(key2,object){ +objects[key2]=object},remove:function(key2){delete objects[key2]},removeAll:function(){ +objects={}}}}__name(GLTFRegistry,"GLTFRegistry");var EXTENSIONS={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_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:"E\ +XT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},GLTFLightsExtension=class{static{ +__name(this,"GLTFLightsExtension")}constructor(parser){this.parser=parser,this.name= +EXTENSIONS.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let parser=this. +parser,nodeDefs=this.parser.json.nodes||[];for(let nodeIndex=0,nodeLength=nodeDefs. +length;nodeIndex=0)throw new Error("THREE.GLTFLoader: setK\ +TX2Loader must be called before loading KTX2 textures");return null}return parser. +loadTextureImage(textureIndex,extension.source,loader)}},GLTFTextureWebPExtension=class{static{ +__name(this,"GLTFTextureWebPExtension")}constructor(parser){this.parser=parser,this. +name=EXTENSIONS.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(textureIndex){ +let name2=this.name,parser=this.parser,json=parser.json,textureDef=json.textures[textureIndex]; +if(!textureDef.extensions||!textureDef.extensions[name2])return null;let extension=textureDef. +extensions[name2],source=json.images[extension.source],loader=parser.textureLoader; +if(source.uri){let handler=parser.options.manager.getHandler(source.uri);handler!== +null&&(loader=handler)}return this.detectSupport().then(function(isSupported){if(isSupported) +return parser.loadTextureImage(textureIndex,extension.source,loader);if(json.extensionsRequired&& +json.extensionsRequired.indexOf(name2)>=0)throw new Error("THREE.GLTFLoader: Web\ +P required by asset but unsupported.");return parser.loadTexture(textureIndex)})}detectSupport(){ +return this.isSupported||(this.isSupported=new Promise(function(resolve){let image=new Image; +image.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+Ja\ +QAA3AAAAAA",image.onload=image.onerror=function(){resolve(image.height===1)}})), +this.isSupported}},GLTFTextureAVIFExtension=class{static{__name(this,"GLTFTextur\ +eAVIFExtension")}constructor(parser){this.parser=parser,this.name=EXTENSIONS.EXT_TEXTURE_AVIF, +this.isSupported=null}loadTexture(textureIndex){let name2=this.name,parser=this. +parser,json=parser.json,textureDef=json.textures[textureIndex];if(!textureDef.extensions|| +!textureDef.extensions[name2])return null;let extension=textureDef.extensions[name2], +source=json.images[extension.source],loader=parser.textureLoader;if(source.uri){ +let handler=parser.options.manager.getHandler(source.uri);handler!==null&&(loader= +handler)}return this.detectSupport().then(function(isSupported){if(isSupported)return parser. +loadTextureImage(textureIndex,extension.source,loader);if(json.extensionsRequired&& +json.extensionsRequired.indexOf(name2)>=0)throw new Error("THREE.GLTFLoader: AVI\ +F required by asset but unsupported.");return parser.loadTexture(textureIndex)})}detectSupport(){ +return this.isSupported||(this.isSupported=new Promise(function(resolve){let image=new Image; +image.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAA\ +DybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAA\ +AAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAA\ +ABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAA\ +AAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBA\ +AAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",image.onload=image.onerror=function(){ +resolve(image.height===1)}})),this.isSupported}},GLTFMeshoptCompression=class{static{ +__name(this,"GLTFMeshoptCompression")}constructor(parser){this.name=EXTENSIONS.EXT_MESHOPT_COMPRESSION, +this.parser=parser}loadBufferView(index){let json=this.parser.json,bufferView=json. +bufferViews[index];if(bufferView.extensions&&bufferView.extensions[this.name]){let extensionDef=bufferView. +extensions[this.name],buffer=this.parser.getDependency("buffer",extensionDef.buffer), +decoder=this.parser.options.meshoptDecoder;if(!decoder||!decoder.supported){if(json. +extensionsRequired&&json.extensionsRequired.indexOf(this.name)>=0)throw new Error( +"THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed fi\ +les");return null}return buffer.then(function(res){let byteOffset=extensionDef.byteOffset|| +0,byteLength=extensionDef.byteLength||0,count=extensionDef.count,stride=extensionDef. +byteStride,source=new Uint8Array(res,byteOffset,byteLength);return decoder.decodeGltfBufferAsync? +decoder.decodeGltfBufferAsync(count,stride,source,extensionDef.mode,extensionDef. +filter).then(function(res2){return res2.buffer}):decoder.ready.then(function(){let result=new ArrayBuffer( +count*stride);return decoder.decodeGltfBuffer(new Uint8Array(result),count,stride, +source,extensionDef.mode,extensionDef.filter),result})})}else return null}},GLTFMeshGpuInstancing=class{static{ +__name(this,"GLTFMeshGpuInstancing")}constructor(parser){this.name=EXTENSIONS.EXT_MESH_GPU_INSTANCING, +this.parser=parser}createNodeMesh(nodeIndex){let json=this.parser.json,nodeDef=json. +nodes[nodeIndex];if(!nodeDef.extensions||!nodeDef.extensions[this.name]||nodeDef. +mesh===void 0)return null;let meshDef=json.meshes[nodeDef.mesh];for(let primitive of meshDef. +primitives)if(primitive.mode!==WEBGL_CONSTANTS.TRIANGLES&&primitive.mode!==WEBGL_CONSTANTS. +TRIANGLE_STRIP&&primitive.mode!==WEBGL_CONSTANTS.TRIANGLE_FAN&&primitive.mode!== +void 0)return null;let attributesDef=nodeDef.extensions[this.name].attributes,pending=[], +attributes={};for(let key2 in attributesDef)pending.push(this.parser.getDependency( +"accessor",attributesDef[key2]).then(accessor=>(attributes[key2]=accessor,attributes[key2]))); +return pending.length<1?null:(pending.push(this.parser.createNodeMesh(nodeIndex)), +Promise.all(pending).then(results=>{let nodeObject=results.pop(),meshes=nodeObject. +isGroup?nodeObject.children:[nodeObject],count=results[0].count,instancedMeshes=[]; +for(let mesh of meshes){let m=new Matrix42,p2=new Vector32,q2=new Quaternion2,s=new Vector32( +1,1,1),instancedMesh=new InstancedMesh3(mesh.geometry,mesh.material,count);for(let i2=0;i2< +count;i2++)attributes.TRANSLATION&&p2.fromBufferAttribute(attributes.TRANSLATION, +i2),attributes.ROTATION&&q2.fromBufferAttribute(attributes.ROTATION,i2),attributes. +SCALE&&s.fromBufferAttribute(attributes.SCALE,i2),instancedMesh.setMatrixAt(i2,m. +compose(p2,q2,s));for(let attributeName in attributes)if(attributeName==="_COLOR\ +_0"){let attr=attributes[attributeName];instancedMesh.instanceColor=new InstancedBufferAttribute2( +attr.array,attr.itemSize,attr.normalized)}else attributeName!=="TRANSLATION"&&attributeName!== +"ROTATION"&&attributeName!=="SCALE"&&mesh.geometry.setAttribute(attributeName,attributes[attributeName]); +Object3D2.prototype.copy.call(instancedMesh,mesh),this.parser.assignFinalMaterial( +instancedMesh),instancedMeshes.push(instancedMesh)}return nodeObject.isGroup?(nodeObject. +clear(),nodeObject.add(...instancedMeshes),nodeObject):instancedMeshes[0]}))}},BINARY_EXTENSION_HEADER_MAGIC="\ +glTF",BINARY_EXTENSION_HEADER_LENGTH=12,BINARY_EXTENSION_CHUNK_TYPES={JSON:1313821514, +BIN:5130562},GLTFBinaryExtension=class{static{__name(this,"GLTFBinaryExtension")}constructor(data){ +this.name=EXTENSIONS.KHR_BINARY_GLTF,this.content=null,this.body=null;let headerView=new DataView( +data,0,BINARY_EXTENSION_HEADER_LENGTH),textDecoder=new TextDecoder;if(this.header= +{magic:textDecoder.decode(new Uint8Array(data.slice(0,4))),version:headerView.getUint32( +4,!0),length:headerView.getUint32(8,!0)},this.header.magic!==BINARY_EXTENSION_HEADER_MAGIC) +throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header. +version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let chunkContentsLength=this. +header.length-BINARY_EXTENSION_HEADER_LENGTH,chunkView=new DataView(data,BINARY_EXTENSION_HEADER_LENGTH), +chunkIndex=0;for(;chunkIndex0||uri.search(/^data\:image\/jpeg/)===0?"image/jpeg":uri.search( +/\.webp($|\?)/i)>0||uri.search(/^data\:image\/webp/)===0?"image/webp":"image/png"} +__name(getImageURIMimeType,"getImageURIMimeType");var _identityMatrix=new Matrix42, +GLTFParser=class{static{__name(this,"GLTFParser")}constructor(json={},options={}){ +this.json=json,this.extensions={},this.plugins={},this.options=options,this.cache= +new GLTFRegistry,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 isSafari=!1,isFirefox=!1,firefoxVersion=-1;typeof navigator<"u"&&(isSafari=/^((?!chrome|android).)*safari/i. +test(navigator.userAgent)===!0,isFirefox=navigator.userAgent.indexOf("Firefox")> +-1,firefoxVersion=isFirefox?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]: +-1),typeof createImageBitmap>"u"||isSafari||isFirefox&&firefoxVersion<98?this.textureLoader= +new TextureLoader(this.options.manager):this.textureLoader=new ImageBitmapLoader( +this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin), +this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader= +new FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffe\ +r"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials( +!0)}setExtensions(extensions){this.extensions=extensions}setPlugins(plugins){this. +plugins=plugins}parse(onLoad,onError){let parser=this,json=this.json,extensions=this. +extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(ext){ +return ext._markDefs&&ext._markDefs()}),Promise.all(this._invokeAll(function(ext){ +return ext.beforeRoot&&ext.beforeRoot()})).then(function(){return Promise.all([parser. +getDependencies("scene"),parser.getDependencies("animation"),parser.getDependencies( +"camera")])}).then(function(dependencies){let result={scene:dependencies[0][json. +scene||0],scenes:dependencies[0],animations:dependencies[1],cameras:dependencies[2], +asset:json.asset,parser,userData:{}};return addUnknownExtensionsToUserData(extensions, +result,json),assignExtrasToUserData(result,json),Promise.all(parser._invokeAll(function(ext){ +return ext.afterRoot&&ext.afterRoot(result)})).then(function(){onLoad(result)})}). +catch(onError)}_markDefs(){let nodeDefs=this.json.nodes||[],skinDefs=this.json.skins|| +[],meshDefs=this.json.meshes||[];for(let skinIndex=0,skinLength=skinDefs.length;skinIndex< +skinLength;skinIndex++){let joints=skinDefs[skinIndex].joints;for(let i2=0,il=joints. +length;i2{let mappings=this.associations.get(original);mappings!=null&& +this.associations.set(clone,mappings);for(let[i2,child]of original.children.entries()) +updateMappings(child,clone.children[i2])},"updateMappings");return updateMappings( +object,ref),ref.name+="_instance_"+cache2.uses[index]++,ref}_invokeOne(func){let extensions=Object. +values(this.plugins);extensions.push(this);for(let i2=0;i2=2&&bufferAttribute. +setY(index,sparseValues[i2*itemSize+1]),itemSize>=3&&bufferAttribute.setZ(index, +sparseValues[i2*itemSize+2]),itemSize>=4&&bufferAttribute.setW(index,sparseValues[i2* +itemSize+3]),itemSize>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize\ + in sparse BufferAttribute.")}}return bufferAttribute})}loadTexture(textureIndex){ +let json=this.json,options=this.options,sourceIndex=json.textures[textureIndex]. +source,sourceDef=json.images[sourceIndex],loader=this.textureLoader;if(sourceDef. +uri){let handler=options.manager.getHandler(sourceDef.uri);handler!==null&&(loader= +handler)}return this.loadTextureImage(textureIndex,sourceIndex,loader)}loadTextureImage(textureIndex,sourceIndex,loader){ +let parser=this,json=this.json,textureDef=json.textures[textureIndex],sourceDef=json. +images[sourceIndex],cacheKey=(sourceDef.uri||sourceDef.bufferView)+":"+textureDef. +sampler;if(this.textureCache[cacheKey])return this.textureCache[cacheKey];let promise=this. +loadImageSource(sourceIndex,loader).then(function(texture){texture.flipY=!1,texture. +name=textureDef.name||sourceDef.name||"",texture.name===""&&typeof sourceDef.uri== +"string"&&sourceDef.uri.startsWith("data:image/")===!1&&(texture.name=sourceDef. +uri);let sampler=(json.samplers||{})[textureDef.sampler]||{};return texture.magFilter= +WEBGL_FILTERS[sampler.magFilter]||LinearFilter2,texture.minFilter=WEBGL_FILTERS[sampler. +minFilter]||LinearMipmapLinearFilter2,texture.wrapS=WEBGL_WRAPPINGS[sampler.wrapS]|| +RepeatWrapping2,texture.wrapT=WEBGL_WRAPPINGS[sampler.wrapT]||RepeatWrapping2,parser. +associations.set(texture,{textures:textureIndex}),texture}).catch(function(){return null}); +return this.textureCache[cacheKey]=promise,promise}loadImageSource(sourceIndex,loader){ +let parser=this,json=this.json,options=this.options;if(this.sourceCache[sourceIndex]!== +void 0)return this.sourceCache[sourceIndex].then(texture=>texture.clone());let sourceDef=json. +images[sourceIndex],URL2=self.URL||self.webkitURL,sourceURI=sourceDef.uri||"",isObjectURL=!1; +if(sourceDef.bufferView!==void 0)sourceURI=parser.getDependency("bufferView",sourceDef. +bufferView).then(function(bufferView){isObjectURL=!0;let blob=new Blob([bufferView], +{type:sourceDef.mimeType});return sourceURI=URL2.createObjectURL(blob),sourceURI});else if(sourceDef. +uri===void 0)throw new Error("THREE.GLTFLoader: Image "+sourceIndex+" is missing\ + URI and bufferView");let promise=Promise.resolve(sourceURI).then(function(sourceURI2){ +return new Promise(function(resolve,reject){let onLoad=resolve;loader.isImageBitmapLoader=== +!0&&(onLoad=__name(function(imageBitmap){let texture=new Texture(imageBitmap);texture. +needsUpdate=!0,resolve(texture)},"onLoad")),loader.load(LoaderUtils.resolveURL(sourceURI2, +options.path),onLoad,void 0,reject)})}).then(function(texture){return isObjectURL=== +!0&&URL2.revokeObjectURL(sourceURI),texture.userData.mimeType=sourceDef.mimeType|| +getImageURIMimeType(sourceDef.uri),texture}).catch(function(error){throw console. +error("THREE.GLTFLoader: Couldn't load texture",sourceURI),error});return this.sourceCache[sourceIndex]= +promise,promise}assignTexture(materialParams,mapName,mapDef,colorSpace){let parser=this; +return this.getDependency("texture",mapDef.index).then(function(texture){if(!texture) +return null;if(mapDef.texCoord!==void 0&&mapDef.texCoord>0&&(texture=texture.clone(), +texture.channel=mapDef.texCoord),parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]){ +let transform=mapDef.extensions!==void 0?mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]: +void 0;if(transform){let gltfReference=parser.associations.get(texture);texture= +parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture,transform), +parser.associations.set(texture,gltfReference)}}return colorSpace!==void 0&&(texture. +colorSpace=colorSpace),materialParams[mapName]=texture,texture})}assignFinalMaterial(mesh){ +let geometry=mesh.geometry,material=mesh.material,useDerivativeTangents=geometry. +attributes.tangent===void 0,useVertexColors=geometry.attributes.color!==void 0,useFlatShading=geometry. +attributes.normal===void 0;if(mesh.isPoints){let cacheKey="PointsMaterial:"+material. +uuid,pointsMaterial=this.cache.get(cacheKey);pointsMaterial||(pointsMaterial=new PointsMaterial2, +Material2.prototype.copy.call(pointsMaterial,material),pointsMaterial.color.copy( +material.color),pointsMaterial.map=material.map,pointsMaterial.sizeAttenuation=!1, +this.cache.add(cacheKey,pointsMaterial)),material=pointsMaterial}else if(mesh.isLine){ +let cacheKey="LineBasicMaterial:"+material.uuid,lineMaterial=this.cache.get(cacheKey); +lineMaterial||(lineMaterial=new LineBasicMaterial2,Material2.prototype.copy.call( +lineMaterial,material),lineMaterial.color.copy(material.color),lineMaterial.map= +material.map,this.cache.add(cacheKey,lineMaterial)),material=lineMaterial}if(useDerivativeTangents|| +useVertexColors||useFlatShading){let cacheKey="ClonedMaterial:"+material.uuid+":"; +useDerivativeTangents&&(cacheKey+="derivative-tangents:"),useVertexColors&&(cacheKey+= +"vertex-colors:"),useFlatShading&&(cacheKey+="flat-shading:");let cachedMaterial=this. +cache.get(cacheKey);cachedMaterial||(cachedMaterial=material.clone(),useVertexColors&& +(cachedMaterial.vertexColors=!0),useFlatShading&&(cachedMaterial.flatShading=!0), +useDerivativeTangents&&(cachedMaterial.normalScale&&(cachedMaterial.normalScale. +y*=-1),cachedMaterial.clearcoatNormalScale&&(cachedMaterial.clearcoatNormalScale. +y*=-1)),this.cache.add(cacheKey,cachedMaterial),this.associations.set(cachedMaterial, +this.associations.get(material))),material=cachedMaterial}mesh.material=material}getMaterialType(){ +return MeshStandardMaterial}loadMaterial(materialIndex){let parser=this,json=this. +json,extensions=this.extensions,materialDef=json.materials[materialIndex],materialType, +materialParams={},materialExtensions=materialDef.extensions||{},pending=[];if(materialExtensions[EXTENSIONS. +KHR_MATERIALS_UNLIT]){let kmuExtension=extensions[EXTENSIONS.KHR_MATERIALS_UNLIT]; +materialType=kmuExtension.getMaterialType(),pending.push(kmuExtension.extendParams( +materialParams,materialDef,parser))}else{let metallicRoughness=materialDef.pbrMetallicRoughness|| +{};if(materialParams.color=new Color2(1,1,1),materialParams.opacity=1,Array.isArray( +metallicRoughness.baseColorFactor)){let array=metallicRoughness.baseColorFactor; +materialParams.color.setRGB(array[0],array[1],array[2],LinearSRGBColorSpace2),materialParams. +opacity=array[3]}metallicRoughness.baseColorTexture!==void 0&&pending.push(parser. +assignTexture(materialParams,"map",metallicRoughness.baseColorTexture,SRGBColorSpace2)), +materialParams.metalness=metallicRoughness.metallicFactor!==void 0?metallicRoughness. +metallicFactor:1,materialParams.roughness=metallicRoughness.roughnessFactor!==void 0? +metallicRoughness.roughnessFactor:1,metallicRoughness.metallicRoughnessTexture!== +void 0&&(pending.push(parser.assignTexture(materialParams,"metalnessMap",metallicRoughness. +metallicRoughnessTexture)),pending.push(parser.assignTexture(materialParams,"rou\ +ghnessMap",metallicRoughness.metallicRoughnessTexture))),materialType=this._invokeOne( +function(ext){return ext.getMaterialType&&ext.getMaterialType(materialIndex)}),pending. +push(Promise.all(this._invokeAll(function(ext){return ext.extendMaterialParams&& +ext.extendMaterialParams(materialIndex,materialParams)})))}materialDef.doubleSided=== +!0&&(materialParams.side=DoubleSide2);let alphaMode=materialDef.alphaMode||ALPHA_MODES. +OPAQUE;if(alphaMode===ALPHA_MODES.BLEND?(materialParams.transparent=!0,materialParams. +depthWrite=!1):(materialParams.transparent=!1,alphaMode===ALPHA_MODES.MASK&&(materialParams. +alphaTest=materialDef.alphaCutoff!==void 0?materialDef.alphaCutoff:.5)),materialDef. +normalTexture!==void 0&&materialType!==MeshBasicMaterial2&&(pending.push(parser. +assignTexture(materialParams,"normalMap",materialDef.normalTexture)),materialParams. +normalScale=new Vector22(1,1),materialDef.normalTexture.scale!==void 0)){let scale2=materialDef. +normalTexture.scale;materialParams.normalScale.set(scale2,scale2)}if(materialDef. +occlusionTexture!==void 0&&materialType!==MeshBasicMaterial2&&(pending.push(parser. +assignTexture(materialParams,"aoMap",materialDef.occlusionTexture)),materialDef. +occlusionTexture.strength!==void 0&&(materialParams.aoMapIntensity=materialDef.occlusionTexture. +strength)),materialDef.emissiveFactor!==void 0&&materialType!==MeshBasicMaterial2){ +let emissiveFactor=materialDef.emissiveFactor;materialParams.emissive=new Color2(). +setRGB(emissiveFactor[0],emissiveFactor[1],emissiveFactor[2],LinearSRGBColorSpace2)} +return materialDef.emissiveTexture!==void 0&&materialType!==MeshBasicMaterial2&& +pending.push(parser.assignTexture(materialParams,"emissiveMap",materialDef.emissiveTexture, +SRGBColorSpace2)),Promise.all(pending).then(function(){let material=new materialType( +materialParams);return materialDef.name&&(material.name=materialDef.name),assignExtrasToUserData( +material,materialDef),parser.associations.set(material,{materials:materialIndex}), +materialDef.extensions&&addUnknownExtensionsToUserData(extensions,material,materialDef), +material})}createUniqueName(originalName){let sanitizedName=PropertyBinding.sanitizeNodeName( +originalName||"");return sanitizedName in this.nodeNamesUsed?sanitizedName+"_"+ ++this. +nodeNamesUsed[sanitizedName]:(this.nodeNamesUsed[sanitizedName]=0,sanitizedName)}loadGeometries(primitives){ +let parser=this,extensions=this.extensions,cache2=this.primitiveCache;function createDracoPrimitive(primitive){ +return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, +parser).then(function(geometry){return addPrimitiveAttributes(geometry,primitive, +parser)})}__name(createDracoPrimitive,"createDracoPrimitive");let pending=[];for(let i2=0, +il=primitives.length;i20&&updateMorphTargets(mesh,meshDef),mesh.name=parser. +createUniqueName(meshDef.name||"mesh_"+meshIndex),assignExtrasToUserData(mesh,meshDef), +primitive.extensions&&addUnknownExtensionsToUserData(extensions,mesh,primitive), +parser.assignFinalMaterial(mesh),meshes.push(mesh)}for(let i2=0,il=meshes.length;i2< +il;i2++)parser.associations.set(meshes[i2],{meshes:meshIndex,primitives:i2});if(meshes. +length===1)return meshDef.extensions&&addUnknownExtensionsToUserData(extensions, +meshes[0],meshDef),meshes[0];let group=new Group;meshDef.extensions&&addUnknownExtensionsToUserData( +extensions,group,meshDef),parser.associations.set(group,{meshes:meshIndex});for(let i2=0, +il=meshes.length;i21?node=new Group:objects.length===1?node= +objects[0]:node=new Object3D2,node!==objects[0])for(let i2=0,il=objects.length;i2< +il;i2++)node.add(objects[i2]);if(nodeDef.name&&(node.userData.name=nodeDef.name, +node.name=nodeName),assignExtrasToUserData(node,nodeDef),nodeDef.extensions&&addUnknownExtensionsToUserData( +extensions,node,nodeDef),nodeDef.matrix!==void 0){let matrix=new Matrix42;matrix. +fromArray(nodeDef.matrix),node.applyMatrix4(matrix)}else nodeDef.translation!==void 0&& +node.position.fromArray(nodeDef.translation),nodeDef.rotation!==void 0&&node.quaternion. +fromArray(nodeDef.rotation),nodeDef.scale!==void 0&&node.scale.fromArray(nodeDef. +scale);return parser.associations.has(node)||parser.associations.set(node,{}),parser. +associations.get(node).nodes=nodeIndex,node}),this.nodeCache[nodeIndex]}loadScene(sceneIndex){ +let extensions=this.extensions,sceneDef=this.json.scenes[sceneIndex],parser=this, +scene2=new Group;sceneDef.name&&(scene2.name=parser.createUniqueName(sceneDef.name)), +assignExtrasToUserData(scene2,sceneDef),sceneDef.extensions&&addUnknownExtensionsToUserData( +extensions,scene2,sceneDef);let nodeIds=sceneDef.nodes||[],pending=[];for(let i2=0, +il=nodeIds.length;i2{let reducedAssociations=new Map; +for(let[key2,value]of parser.associations)(key2 instanceof Material2||key2 instanceof +Texture)&&reducedAssociations.set(key2,value);return node.traverse(node2=>{let mappings=parser. +associations.get(node2);mappings!=null&&reducedAssociations.set(node2,mappings)}), +reducedAssociations},"reduceAssociations");return parser.associations=reduceAssociations( +scene2),scene2})}_createAnimationTracks(node,inputAccessor,outputAccessor,sampler,target){ +let tracks=[],targetName=node.name?node.name:node.uuid,targetNames=[];PATH_PROPERTIES[target. +path]===PATH_PROPERTIES.weights?node.traverse(function(object){object.morphTargetInfluences&& +targetNames.push(object.name?object.name:object.uuid)}):targetNames.push(targetName); +let TypedKeyframeTrack;switch(PATH_PROPERTIES[target.path]){case PATH_PROPERTIES. +weights:TypedKeyframeTrack=NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation: +TypedKeyframeTrack=QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES. +scale:TypedKeyframeTrack=VectorKeyframeTrack;break;default:switch(outputAccessor. +itemSize){case 1:TypedKeyframeTrack=NumberKeyframeTrack;break;case 2:case 3:default: +TypedKeyframeTrack=VectorKeyframeTrack;break}break}let interpolation=sampler.interpolation!== +void 0?INTERPOLATION[sampler.interpolation]:InterpolateLinear,outputArray=this._getArrayFromAccessor( +outputAccessor);for(let j2=0,jl=targetNames.length;j2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers33=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor,_classExtraInitializers=[], +_classThis,_classSuper=RenderableBehavior,_instanceExtraInitializers=[],_src_decorators, +_src_initializers=[],_dracoDecoder_decorators,_dracoDecoder_initializers=[],_centerGeometry_decorators, +_centerGeometry_initializers=[];var GltfModelBehavior2=class extends _classSuper{static{ +__name(this,"GltfModelBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_src_decorators=[attribute,receiver],_dracoDecoder_decorators=[stringAttribute,receiver], +_centerGeometry_decorators=[booleanAttribute,receiver],__esDecorate33(null,null, +_src_decorators,{kind:"field",name:"src",static:!1,private:!1,access:{has:obj=>"\ +src"in obj,get:obj=>obj.src,set:(obj,value)=>{obj.src=value}},metadata:_metadata}, +_src_initializers,_instanceExtraInitializers),__esDecorate33(null,null,_dracoDecoder_decorators, +{kind:"field",name:"dracoDecoder",static:!1,private:!1,access:{has:obj=>"dracoDe\ +coder"in obj,get:obj=>obj.dracoDecoder,set:(obj,value)=>{obj.dracoDecoder=value}}, +metadata:_metadata},_dracoDecoder_initializers,_instanceExtraInitializers),__esDecorate33( +null,null,_centerGeometry_decorators,{kind:"field",name:"centerGeometry",static:!1, +private:!1,access:{has:obj=>"centerGeometry"in obj,get:obj=>obj.centerGeometry,set:(obj,value)=>{ +obj.centerGeometry=value}},metadata:_metadata},_centerGeometry_initializers,_instanceExtraInitializers), +__esDecorate33(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),GltfModelBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers33( +_classThis,_classExtraInitializers)}src=(__runInitializers33(this,_instanceExtraInitializers), +__runInitializers33(this,_src_initializers,""));dracoDecoder=__runInitializers33( +this,_dracoDecoder_initializers,defaultDracoDecoder);centerGeometry=__runInitializers33( +this,_centerGeometry_initializers,!1);loader=new GLTFLoader;model=null;#version=0;connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{let decoderPath=createMemo(()=>this. +dracoDecoder);createEffect(()=>{if(!decoderPath())return;let dracoLoader=getDracoLoader( +decoderPath());this.loader.dracoLoader=dracoLoader,onCleanup(()=>{disposeDracoLoader( +decoderPath()),this.loader.dracoLoader=null})});let gltfPath=createMemo(()=>this. +src),center=createMemo(()=>this.centerGeometry);createEffect(()=>{gltfPath(),decoderPath(), +center(),untrack(()=>this.#loadModel()),onCleanup(()=>{this.model&&disposeObjectTree( +this.model.scene),this.model=null,this.#version++})})})}#loadModel(){let{src}=this, +version3=this.#version;src&&this.loader.load(src,model=>version3==this.#version&& +this.#setModel(model),progress=>version3==this.#version&&this.element.emit(Events. +PROGRESS,progress),error=>version3==this.#version&&this.#onError(error))}#onError(error){ +let message=`Failed to load ${this.element.tagName.toLowerCase()} with src "${this. +src}" and dracoDecoder "${this.dracoDecoder}". See the following error.`;console. +warn(message);let err=error instanceof ErrorEvent&&error.error?error.error:error; +console.error(err),this.element.emit(Events.MODEL_ERROR,err)}#setModel(model){if(this. +model=model,model.scene=model.scene||new Scene2().add(...model.scenes),this.centerGeometry){ +let box=new Box3;box.setFromObject(model.scene);let center=new Vector3;box.getCenter( +center),model.scene.position.copy(center.negate())}this.element.three.add(model. +scene),this.element.emit(Events.MODEL_LOAD,{format:"gltf",model}),this.element.needsUpdate()}}; +return GltfModelBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("gltf-model")&&elementBehaviors. +define("gltf-model",GltfModelBehavior);function getDracoLoader(url){let dracoLoader; +if(!dracoLoaders.has(url))dracoLoader=new DRACOLoader,dracoLoader.setDecoderPath( +url),dracoLoaders.set(url,{count:1,dracoLoader});else{let ref=dracoLoaders.get(url); +ref.count++,dracoLoader=ref.dracoLoader}return dracoLoader}__name(getDracoLoader, +"getDracoLoader");function disposeDracoLoader(url){if(!dracoLoaders.has(url))return; +let ref=dracoLoaders.get(url);ref.count--,ref.count||(ref.dracoLoader.dispose(), +dracoLoaders.delete(url))}__name(disposeDracoLoader,"disposeDracoLoader");var _object_pattern=/^[og]\s*(.+)?/,_material_library_pattern=/^mtllib /,_material_use_pattern=/^usemtl /, +_map_use_pattern=/^usemap /,_face_vertex_data_separator_pattern=/\s+/,_vA2=new Vector32, +_vB2=new Vector32,_vC2=new Vector32,_ab=new Vector32,_cb=new Vector32,_color5=new Color2; +function ParserState(){let state={objects:[],object:{},vertices:[],normals:[],colors:[], +uvs:[],materials:{},materialLibraries:[],startObject:function(name2,fromDeclaration){ +if(this.object&&this.object.fromDeclaration===!1){this.object.name=name2,this.object. +fromDeclaration=fromDeclaration!==!1;return}let previousMaterial=this.object&&typeof this. +object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this. +object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this. +object={name:name2||"",fromDeclaration:fromDeclaration!==!1,geometry:{vertices:[], +normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(name3,libraries){ +let previous=this._finalize(!1);previous&&(previous.inherited||previous.groupCount<= +0)&&this.materials.splice(previous.index,1);let material={index:this.materials.length, +name:name3||"",mtllib:Array.isArray(libraries)&&libraries.length>0?libraries[libraries. +length-1]:"",smooth:previous!==void 0?previous.smooth:this.smooth,groupStart:previous!== +void 0?previous.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(index){ +let cloned={index:typeof index=="number"?index:this.index,name:this.name,mtllib:this. +mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return cloned. +clone=this.clone.bind(cloned),cloned}};return this.materials.push(material),material}, +currentMaterial:function(){if(this.materials.length>0)return this.materials[this. +materials.length-1]},_finalize:function(end){let lastMultiMaterial=this.currentMaterial(); +if(lastMultiMaterial&&lastMultiMaterial.groupEnd===-1&&(lastMultiMaterial.groupEnd= +this.geometry.vertices.length/3,lastMultiMaterial.groupCount=lastMultiMaterial.groupEnd- +lastMultiMaterial.groupStart,lastMultiMaterial.inherited=!1),end&&this.materials. +length>1)for(let mi=this.materials.length-1;mi>=0;mi--)this.materials[mi].groupCount<= +0&&this.materials.splice(mi,1);return end&&this.materials.length===0&&this.materials. +push({name:"",smooth:this.smooth}),lastMultiMaterial}},previousMaterial&&previousMaterial. +name&&typeof previousMaterial.clone=="function"){let declared=previousMaterial.clone( +0);declared.inherited=!0,this.object.materials.push(declared)}this.objects.push( +this.object)},finalize:function(){this.object&&typeof this.object._finalize=="fu\ +nction"&&this.object._finalize(!0)},parseVertexIndex:function(value,len){let index=parseInt( +value,10);return(index>=0?index-1:index+len/3)*3},parseNormalIndex:function(value,len){ +let index=parseInt(value,10);return(index>=0?index-1:index+len/3)*3},parseUVIndex:function(value,len){ +let index=parseInt(value,10);return(index>=0?index-1:index+len/2)*2},addVertex:function(a,b,c3){ +let src=this.vertices,dst=this.object.geometry.vertices;dst.push(src[a+0],src[a+ +1],src[a+2]),dst.push(src[b+0],src[b+1],src[b+2]),dst.push(src[c3+0],src[c3+1],src[c3+ +2])},addVertexPoint:function(a){let src=this.vertices;this.object.geometry.vertices. +push(src[a+0],src[a+1],src[a+2])},addVertexLine:function(a){let src=this.vertices; +this.object.geometry.vertices.push(src[a+0],src[a+1],src[a+2])},addNormal:function(a,b,c3){ +let src=this.normals,dst=this.object.geometry.normals;dst.push(src[a+0],src[a+1], +src[a+2]),dst.push(src[b+0],src[b+1],src[b+2]),dst.push(src[c3+0],src[c3+1],src[c3+ +2])},addFaceNormal:function(a,b,c3){let src=this.vertices,dst=this.object.geometry. +normals;_vA2.fromArray(src,a),_vB2.fromArray(src,b),_vC2.fromArray(src,c3),_cb.subVectors( +_vC2,_vB2),_ab.subVectors(_vA2,_vB2),_cb.cross(_ab),_cb.normalize(),dst.push(_cb. +x,_cb.y,_cb.z),dst.push(_cb.x,_cb.y,_cb.z),dst.push(_cb.x,_cb.y,_cb.z)},addColor:function(a,b,c3){ +let src=this.colors,dst=this.object.geometry.colors;src[a]!==void 0&&dst.push(src[a+ +0],src[a+1],src[a+2]),src[b]!==void 0&&dst.push(src[b+0],src[b+1],src[b+2]),src[c3]!== +void 0&&dst.push(src[c3+0],src[c3+1],src[c3+2])},addUV:function(a,b,c3){let src=this. +uvs,dst=this.object.geometry.uvs;dst.push(src[a+0],src[a+1]),dst.push(src[b+0],src[b+ +1]),dst.push(src[c3+0],src[c3+1])},addDefaultUV:function(){let dst=this.object.geometry. +uvs;dst.push(0,0),dst.push(0,0),dst.push(0,0)},addUVLine:function(a){let src=this. +uvs;this.object.geometry.uvs.push(src[a+0],src[a+1])},addFace:function(a,b,c3,ua,ub,uc,na,nb,nc){ +let vLen=this.vertices.length,ia=this.parseVertexIndex(a,vLen),ib=this.parseVertexIndex( +b,vLen),ic=this.parseVertexIndex(c3,vLen);if(this.addVertex(ia,ib,ic),this.addColor( +ia,ib,ic),na!==void 0&&na!==""){let nLen=this.normals.length;ia=this.parseNormalIndex( +na,nLen),ib=this.parseNormalIndex(nb,nLen),ic=this.parseNormalIndex(nc,nLen),this. +addNormal(ia,ib,ic)}else this.addFaceNormal(ia,ib,ic);if(ua!==void 0&&ua!==""){let uvLen=this. +uvs.length;ia=this.parseUVIndex(ua,uvLen),ib=this.parseUVIndex(ub,uvLen),ic=this. +parseUVIndex(uc,uvLen),this.addUV(ia,ib,ic),this.object.geometry.hasUVIndices=!0}else +this.addDefaultUV()},addPointGeometry:function(vertices){this.object.geometry.type= +"Points";let vLen=this.vertices.length;for(let vi=0,l=vertices.length;vi=7?(_color5.setRGB(parseFloat(data[4]),parseFloat( +data[5]),parseFloat(data[6])).convertSRGBToLinear(),state.colors.push(_color5.r, +_color5.g,_color5.b)):state.colors.push(void 0,void 0,void 0);break;case"vn":state. +normals.push(parseFloat(data[1]),parseFloat(data[2]),parseFloat(data[3]));break;case"\ +vt":state.uvs.push(parseFloat(data[1]),parseFloat(data[2]));break}}else if(lineFirstChar=== +"f"){let vertexData=line.slice(1).trim().split(_face_vertex_data_separator_pattern), +faceVertices=[];for(let j2=0,jl=vertexData.length;j20){let vertexParts=vertex20.split("/");faceVertices.push(vertexParts)}} +let v1=faceVertices[0];for(let j2=1,jl=faceVertices.length-1;j21){let value=result[1].trim().toLowerCase();state. +object.smooth=value!=="0"&&value!=="off"}else state.object.smooth=!0;let material=state. +object.currentMaterial();material&&(material.smooth=state.object.smooth)}else{if(line=== +"\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+line+'"')}}state. +finalize();let container=new Group;if(container.materialLibraries=[].concat(state. +materialLibraries),!(state.objects.length===1&&state.objects[0].geometry.vertices. +length===0)===!0)for(let i2=0,l=state.objects.length;i2 +0&&buffergeometry.setAttribute("normal",new Float32BufferAttribute2(geometry.normals, +3)),geometry.colors.length>0&&(hasVertexColors=!0,buffergeometry.setAttribute("c\ +olor",new Float32BufferAttribute2(geometry.colors,3))),geometry.hasUVIndices===!0&& +buffergeometry.setAttribute("uv",new Float32BufferAttribute2(geometry.uvs,2));let createdMaterials=[]; +for(let mi=0,miLen=materials.length;mi1){for(let mi=0,miLen=materials. +length;mi0){let material=new PointsMaterial2({size:1, +sizeAttenuation:!1}),buffergeometry=new BufferGeometry2;buffergeometry.setAttribute( +"position",new Float32BufferAttribute2(state.vertices,3)),state.colors.length>0&& +state.colors[0]!==void 0&&(buffergeometry.setAttribute("color",new Float32BufferAttribute2( +state.colors,3)),material.vertexColors=!0);let points=new Points3(buffergeometry, +material);container.add(points)}return container}};var MTLLoader=class extends Loader{static{__name(this,"MTLLoader")}constructor(manager){ +super(manager)}load(url,onLoad,onProgress,onError){let scope=this,path=this.path=== +""?LoaderUtils.extractUrlBase(url):this.path,loader=new FileLoader(this.manager); +loader.setPath(this.path),loader.setRequestHeader(this.requestHeader),loader.setWithCredentials( +this.withCredentials),loader.load(url,function(text){try{onLoad(scope.parse(text, +path))}catch(e){onError?onError(e):console.error(e),scope.manager.itemError(url)}}, +onProgress,onError)}setMaterialOptions(value){return this.materialOptions=value, +this}parse(text,path){let lines=text.split(` +`),info={},delimiter_pattern=/\s+/,materialsInfo={};for(let i2=0;i2=0?line.substring(0,pos):line;key2=key2.toLowerCase(); +let value=pos>=0?line.substring(pos+1):"";if(value=value.trim(),key2==="newmtl") +info={name:value},materialsInfo[value]=info;else if(key2==="ka"||key2==="kd"||key2=== +"ks"||key2==="ke"){let ss=value.split(delimiter_pattern,3);info[key2]=[parseFloat( +ss[0]),parseFloat(ss[1]),parseFloat(ss[2])]}else info[key2]=value}let materialCreator=new MaterialCreator( +this.resourcePath||path,this.materialOptions);return materialCreator.setCrossOrigin( +this.crossOrigin),materialCreator.setManager(this.manager),materialCreator.setMaterials( +materialsInfo),materialCreator}},MaterialCreator=class{static{__name(this,"Mater\ +ialCreator")}constructor(baseUrl="",options={}){this.baseUrl=baseUrl,this.options= +options,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup= +{},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options. +side:FrontSide2,this.wrap=this.options.wrap!==void 0?this.options.wrap:RepeatWrapping2}setCrossOrigin(value){ +return this.crossOrigin=value,this}setManager(value){this.manager=value}setMaterials(materialsInfo){ +this.materialsInfo=this.convert(materialsInfo),this.materials={},this.materialsArray= +[],this.nameLookup={}}convert(materialsInfo){if(!this.options)return materialsInfo; +let converted={};for(let mn in materialsInfo){let mat=materialsInfo[mn],covmat={}; +converted[mn]=covmat;for(let prop in mat){let save=!0,value=mat[prop],lprop=prop. +toLowerCase();switch(lprop){case"kd":case"ka":case"ks":this.options&&this.options. +normalizeRGB&&(value=[value[0]/255,value[1]/255,value[2]/255]),this.options&&this. +options.ignoreZeroRGBs&&value[0]===0&&value[1]===0&&value[2]===0&&(save=!1);break;default: +break}save&&(covmat[lprop]=value)}}return converted}preload(){for(let mn in this. +materialsInfo)this.create(mn)}getIndex(materialName){return this.nameLookup[materialName]}getAsArray(){ +let index=0;for(let mn in this.materialsInfo)this.materialsArray[index]=this.create( +mn),this.nameLookup[mn]=index,index++;return this.materialsArray}create(materialName){ +return this.materials[materialName]===void 0&&this.createMaterial_(materialName), +this.materials[materialName]}createMaterial_(materialName){let scope=this,mat=this. +materialsInfo[materialName],params={name:materialName,side:this.side};function resolveURL(baseUrl,url){ +return typeof url!="string"||url===""?"":/^https?:\/\//i.test(url)?url:baseUrl+url} +__name(resolveURL,"resolveURL");function setMapForType(mapType,value){if(params[mapType]) +return;let texParams=scope.getTextureParams(value,params),map=scope.loadTexture( +resolveURL(scope.baseUrl,texParams.url));map.repeat.copy(texParams.scale),map.offset. +copy(texParams.offset),map.wrapS=scope.wrap,map.wrapT=scope.wrap,(mapType==="map"|| +mapType==="emissiveMap")&&(map.colorSpace=SRGBColorSpace2),params[mapType]=map}__name( +setMapForType,"setMapForType");for(let prop in mat){let value=mat[prop],n;if(value!== +"")switch(prop.toLowerCase()){case"kd":params.color=new Color2().fromArray(value). +convertSRGBToLinear();break;case"ks":params.specular=new Color2().fromArray(value). +convertSRGBToLinear();break;case"ke":params.emissive=new Color2().fromArray(value). +convertSRGBToLinear();break;case"map_kd":setMapForType("map",value);break;case"m\ +ap_ks":setMapForType("specularMap",value);break;case"map_ke":setMapForType("emis\ +siveMap",value);break;case"norm":setMapForType("normalMap",value);break;case"map\ +_bump":case"bump":setMapForType("bumpMap",value);break;case"map_d":setMapForType( +"alphaMap",value),params.transparent=!0;break;case"ns":params.shininess=parseFloat( +value);break;case"d":n=parseFloat(value),n<1&&(params.opacity=n,params.transparent= +!0);break;case"tr":n=parseFloat(value),this.options&&this.options.invertTrProperty&& +(n=1-n),n>0&&(params.opacity=1-n,params.transparent=!0);break;default:break}}return this. +materials[materialName]=new MeshPhongMaterial2(params),this.materials[materialName]}getTextureParams(value,matParams){ +let texParams={scale:new Vector22(1,1),offset:new Vector22(0,0)},items=value.split( +/\s+/),pos;return pos=items.indexOf("-bm"),pos>=0&&(matParams.bumpScale=parseFloat( +items[pos+1]),items.splice(pos,2)),pos=items.indexOf("-s"),pos>=0&&(texParams.scale. +set(parseFloat(items[pos+1]),parseFloat(items[pos+2])),items.splice(pos,4)),pos= +items.indexOf("-o"),pos>=0&&(texParams.offset.set(parseFloat(items[pos+1]),parseFloat( +items[pos+2])),items.splice(pos,4)),texParams.url=items.join(" ").trim(),texParams}loadTexture(url,mapping,onLoad,onProgress,onError){ +let manager=this.manager!==void 0?this.manager:DefaultLoadingManager,loader=manager. +getHandler(url);loader===null&&(loader=new TextureLoader(manager)),loader.setCrossOrigin&& +loader.setCrossOrigin(this.crossOrigin);let texture=loader.load(url,onLoad,onProgress, +onError);return mapping!==void 0&&(texture.mapping=mapping),texture}};var __esDecorate34=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers34=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=RenderableBehavior,_instanceExtraInitializers=[], +_obj_decorators,_obj_initializers=[],_mtl_decorators,_mtl_initializers=[];var ObjModelBehavior2=class extends _classSuper{static{ +__name(this,"ObjModelBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_obj_decorators=[stringAttribute,receiver],_mtl_decorators=[stringAttribute,receiver], +__esDecorate34(null,null,_obj_decorators,{kind:"field",name:"obj",static:!1,private:!1, +access:{has:obj=>"obj"in obj,get:obj=>obj.obj,set:(obj,value)=>{obj.obj=value}}, +metadata:_metadata},_obj_initializers,_instanceExtraInitializers),__esDecorate34( +null,null,_mtl_decorators,{kind:"field",name:"mtl",static:!1,private:!1,access:{ +has:obj=>"mtl"in obj,get:obj=>obj.mtl,set:(obj,value)=>{obj.mtl=value}},metadata:_metadata}, +_mtl_initializers,_instanceExtraInitializers),__esDecorate34(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),ObjModelBehavior2=_classThis=_classDescriptor.value, +_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers34(_classThis,_classExtraInitializers)}obj=(__runInitializers34( +this,_instanceExtraInitializers),__runInitializers34(this,_obj_initializers,""));mtl=__runInitializers34( +this,_mtl_initializers,"");model;objLoader=(()=>{let loader=new OBJLoader;return loader. +manager.onLoad=()=>this.element.needsUpdate(),loader})();mtlLoader=(()=>{let loader=new MTLLoader( +this.objLoader.manager);return loader.crossOrigin="",loader})();#version=0;connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{this.mtl,this.obj,this.#loadModel(), +onCleanup(()=>{this.model&&disposeObjectTree(this.model,{destroyMaterial:!this.#materialIsFromMaterialBehavior}), +this.#materialIsFromMaterialBehavior=!1,this.model=void 0,this.#version++})})}#materialIsFromMaterialBehavior=!1;#loadModel(){ +let{obj,mtl,mtlLoader,objLoader}=this,version3=this.#version;obj&&(mtl?(mtlLoader. +setResourcePath(mtl.substr(0,mtl.lastIndexOf("/")+1)),mtlLoader.load(mtl,materials=>{ +version3===this.#version&&(materials.preload(),objLoader.setMaterials(materials), +this.#loadObj(version3,!0))})):this.#loadObj(version3,!1))}#loadObj(version3,hasMtl){ +this.objLoader.load(this.obj,model=>version3==this.#version&&this.#setModel(model, +hasMtl),progress=>version3===this.#version&&this.element.emit(Events.PROGRESS,progress), +error=>version3===this.#version&&this.#onError(error))}#onError(error){let message=`\ +Failed to load ${this.element.tagName.toLowerCase()} with obj value "${this.obj}\ +" and mtl value "${this.mtl}". See the following error.`;console.warn(message);let err=error instanceof +ErrorEvent&&error.error?error.error:error;console.error(err),this.element.emit(Events. +MODEL_ERROR,err)}#setModel(model,hasMtl){if(!hasMtl){let materialBehavior=this.element. +behaviors.get("basic-material");materialBehavior||(materialBehavior=this.element. +behaviors.get("phong-material")),materialBehavior||(materialBehavior=this.element. +behaviors.get("standard-material")),materialBehavior||(materialBehavior=this.element. +behaviors.get("lambert-material")),materialBehavior?(this.#materialIsFromMaterialBehavior= +!0,model.traverse(child=>{isRenderItem(child)&&(child.material=materialBehavior. +meshComponent||thro(new Error("Expected a material")))})):setRandomColorPhongMaterial( +model)}this.model=model,this.element.three.add(model),this.element.emit(Events.MODEL_LOAD, +{format:"obj",model}),this.element.needsUpdate()}};return ObjModelBehavior2=_classThis})();globalThis.window?.document&&!elementBehaviors.has("obj-model")&&elementBehaviors. +define("obj-model",ObjModelBehavior);var thro=__name(err=>{throw err},"thro");var TDSLoader=class extends Loader{static{__name(this,"TDSLoader")}constructor(manager){ +super(manager),this.debug=!1,this.group=null,this.materials=[],this.meshes=[]}load(url,onLoad,onProgress,onError){ +let scope=this,path=this.path===""?LoaderUtils.extractUrlBase(url):this.path,loader=new FileLoader( +this.manager);loader.setPath(this.path),loader.setResponseType("arraybuffer"),loader. +setRequestHeader(this.requestHeader),loader.setWithCredentials(this.withCredentials), +loader.load(url,function(data){try{onLoad(scope.parse(data,path))}catch(e){onError? +onError(e):console.error(e),scope.manager.itemError(url)}},onProgress,onError)}parse(arraybuffer,path){ +this.group=new Group,this.materials=[],this.meshes=[],this.readFile(arraybuffer, +path);for(let i2=0;i2 +data.byteLength&&this.debugMessage("Bad chunk size for chunk at "+position2)}readChunk(){ +if(this.endOfChunk)return null;try{let next=new _Chunk(this.data,this.position,this. +debugMessage);return this.position+=next.size,next}catch{return this.debugMessage( +"Unable to read chunk at "+this.position),null}}get hexId(){return this.id.toString( +16)}get endOfChunk(){return this.position>=this.end}readByte(){let v=this.data.getUint8( +this.position,!0);return this.position+=1,v}readFloat(){try{let v=this.data.getFloat32( +this.position,!0);return this.position+=4,v}catch(e){return this.debugMessage(e+ +" "+this.position+" "+this.data.byteLength),0}}readInt(){let v=this.data.getInt32( +this.position,!0);return this.position+=4,v}readShort(){let v=this.data.getInt16( +this.position,!0);return this.position+=2,v}readDWord(){let v=this.data.getUint32( +this.position,!0);return this.position+=4,v}readWord(){let v=this.data.getUint16( +this.position,!0);return this.position+=2,v}readString(){let s="",c3=this.readByte(); +for(;c3;)s+=String.fromCharCode(c3),c3=this.readByte();return s}},M3DMAGIC=19789, +MLIBMAGIC=15786,CMAGIC=49725,M3D_VERSION=2,COLOR_F=16,COLOR_24=17,LIN_COLOR_24=18, +LIN_COLOR_F=19,INT_PERCENTAGE=48,FLOAT_PERCENTAGE=49,MDATA=15677,MESH_VERSION=15678, +MASTER_SCALE=256,MAT_ENTRY=45055,MAT_NAME=40960,MAT_AMBIENT=40976,MAT_DIFFUSE=40992, +MAT_SPECULAR=41008,MAT_SHININESS=41024,MAT_TRANSPARENCY=41040,MAT_TWO_SIDE=41089, +MAT_ADDITIVE=41091,MAT_WIRE=41093,MAT_WIRE_SIZE=41095,MAT_TEXMAP=41472,MAT_OPACMAP=41488, +MAT_BUMPMAP=41520,MAT_SPECMAP=41476,MAT_MAPNAME=41728,MAT_MAP_USCALE=41812,MAT_MAP_VSCALE=41814, +MAT_MAP_UOFFSET=41816,MAT_MAP_VOFFSET=41818,NAMED_OBJECT=16384,N_TRI_OBJECT=16640, +POINT_ARRAY=16656,FACE_ARRAY=16672,MSH_MAT_GROUP=16688,TEX_VERTS=16704,MESH_MATRIX=16736;var __esDecorate35=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers35=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[behavior],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=RenderableBehavior,_instanceExtraInitializers=[], +_src_decorators,_src_initializers=[];var TdsModelBehavior2=class extends _classSuper{static{ +__name(this,"TdsModelBehavior")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_src_decorators=[stringAttribute,receiver],__esDecorate35(null,null,_src_decorators, +{kind:"field",name:"src",static:!1,private:!1,access:{has:obj=>"src"in obj,get:obj=>obj. +src,set:(obj,value)=>{obj.src=value}},metadata:_metadata},_src_initializers,_instanceExtraInitializers), +__esDecorate35(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),TdsModelBehavior2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers35( +_classThis,_classExtraInitializers)}src=(__runInitializers35(this,_instanceExtraInitializers), +__runInitializers35(this,_src_initializers,""));loader=new TDSLoader;model;#version=0;connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{this.src,this.#loadModel(),onCleanup( +()=>{this.model&&disposeObjectTree(this.model),this.model=void 0,this.#version++})})}#loadModel(){ +let{src}=this,version3=this.#version;src&&this.loader.load(src,model=>version3=== +this.#version&&this.#setModel(model),progress=>version3===this.#version&&this.element. +emit(Events.PROGRESS,progress),error=>version3===this.#version&&this.#onError(error))}#onError(error){ +let message=`Failed to load ${this.element.tagName.toLowerCase()} with src "${this. +src}". See the following error.`;console.warn(message);let err=error instanceof ErrorEvent&& +error.error?error.error:error;console.error(err),this.element.emit(Events.MODEL_ERROR, +err)}#setModel(model){this.model=model,this.element.three.add(model),this.element. +emit(Events.MODEL_LOAD,{format:"3ds",model}),this.element.needsUpdate()}};return TdsModelBehavior2= +_classThis})();globalThis.window?.document&&!elementBehaviors.has("3ds-model")&&elementBehaviors. +define("3ds-model",TdsModelBehavior);function clamp3(n,min,max2){return Math.max(Math.min(n,max2),min)}__name(clamp3, +"clamp");var __esDecorate36=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers36=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[reactive],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=Effects2,_instanceExtraInitializers=[], +_rotationYTarget_decorators,_rotationYTarget_initializers=[],_rotationXTarget_decorators, +_rotationXTarget_initializers=[],_interactionInitiator_decorators,_interactionInitiator_initializers=[], +_interactionContainer_decorators,_interactionContainer_initializers=[];var FlingRotation2=class extends _classSuper{static{ +__name(this,"FlingRotation")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_rotationYTarget_decorators=[signal],_rotationXTarget_decorators=[signal],_interactionInitiator_decorators= +[signal],_interactionContainer_decorators=[signal],__esDecorate36(null,null,_rotationYTarget_decorators, +{kind:"field",name:"rotationYTarget",static:!1,private:!1,access:{has:obj=>"rota\ +tionYTarget"in obj,get:obj=>obj.rotationYTarget,set:(obj,value)=>{obj.rotationYTarget= +value}},metadata:_metadata},_rotationYTarget_initializers,_instanceExtraInitializers), +__esDecorate36(null,null,_rotationXTarget_decorators,{kind:"field",name:"rotatio\ +nXTarget",static:!1,private:!1,access:{has:obj=>"rotationXTarget"in obj,get:obj=>obj. +rotationXTarget,set:(obj,value)=>{obj.rotationXTarget=value}},metadata:_metadata}, +_rotationXTarget_initializers,_instanceExtraInitializers),__esDecorate36(null,null, +_interactionInitiator_decorators,{kind:"field",name:"interactionInitiator",static:!1, +private:!1,access:{has:obj=>"interactionInitiator"in obj,get:obj=>obj.interactionInitiator, +set:(obj,value)=>{obj.interactionInitiator=value}},metadata:_metadata},_interactionInitiator_initializers, +_instanceExtraInitializers),__esDecorate36(null,null,_interactionContainer_decorators, +{kind:"field",name:"interactionContainer",static:!1,private:!1,access:{has:obj=>"\ +interactionContainer"in obj,get:obj=>obj.interactionContainer,set:(obj,value)=>{ +obj.interactionContainer=value}},metadata:_metadata},_interactionContainer_initializers, +_instanceExtraInitializers),__esDecorate36(null,_classDescriptor={value:_classThis}, +_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers), +FlingRotation2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty( +_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}), +__runInitializers36(_classThis,_classExtraInitializers)}rotationYTarget=(__runInitializers36( +this,_instanceExtraInitializers),__runInitializers36(this,_rotationYTarget_initializers, +void 0));rotationXTarget=__runInitializers36(this,_rotationXTarget_initializers, +void 0);interactionInitiator=__runInitializers36(this,_interactionInitiator_initializers, +void 0);interactionContainer=__runInitializers36(this,_interactionContainer_initializers, +document.documentElement);minFlingRotationX=-90;maxFlingRotationX=90;minFlingRotationY=-1/0;maxFlingRotationY=1/0;factor=1;#aborter=new AbortController;constructor(options={}){ +super(),Object.assign(this,options)}#mainPointer=-1;#pointerCount=0;#lastX=0;#lastY=0;#deltaX=0;#deltaY=0;#onPointerDown=event=>{ +if(this.#pointerCount++,this.#pointerCount===1)this.#mainPointer=event.pointerId;else +return;this.interactionContainer.setPointerCapture(this.#mainPointer),this.rotationXTarget. +rotation=()=>!1,this.rotationYTarget.rotation=()=>!1,this.#lastX=event.x,this.#lastY= +event.y,this.#deltaX=0,this.#deltaY=0,this.interactionContainer.addEventListener( +"pointermove",this.#onMove,{signal:this.#aborter.signal}),this.interactionContainer. +addEventListener("pointerup",this.#onPointerUp,{signal:this.#aborter.signal})};#onMove=event=>{ +if(event.pointerId!==this.#mainPointer)return;let movementX=event.x-this.#lastX, +movementY=event.y-this.#lastY;this.#lastX=event.x,this.#lastY=event.y,this.#deltaX= +movementY*.15*this.factor,this.rotationXTarget.rotation.x=clamp3(this.rotationXTarget. +rotation.x+this.#deltaX,this.minFlingRotationX,this.maxFlingRotationX),this.#deltaY= +-movementX*.15*this.factor,this.rotationYTarget.rotation.y=clamp3(this.rotationYTarget. +rotation.y+this.#deltaY,this.minFlingRotationY,this.maxFlingRotationY)};#onPointerUp=()=>{ +this.#pointerCount--,this.#pointerCount===0&&(this.interactionContainer.hasPointerCapture( +this.#mainPointer)&&this.interactionContainer.releasePointerCapture(this.#mainPointer), +this.#mainPointer=-1,this.interactionContainer.removeEventListener("pointerup",this.#onPointerUp)), +this.interactionContainer.removeEventListener("pointermove",this.#onMove),!(this.#deltaX=== +0&&this.#deltaY===0)&&(this.rotationXTarget.rotation=(x2,y2,z2)=>(this.#deltaX=this.#deltaX* +.95,Math.abs(this.#deltaX)<.01?!1:[clamp3(x2+this.#deltaX,this.minFlingRotationX, +this.maxFlingRotationX),y2,z2]),this.rotationYTarget.rotation=(x2,y2,z2)=>(this.#deltaY= +this.#deltaY*.95,Math.abs(this.#deltaY)<.01?!1:[x2,clamp3(y2+this.#deltaY,this.minFlingRotationY, +this.maxFlingRotationY),z2]))};#onDragStart=event=>event.preventDefault();#isStarted=!1;start(){ +return this.#isStarted?this:(this.#isStarted=!0,this.createEffect(()=>{this.rotationYTarget&& +this.rotationXTarget&&this.interactionInitiator&&this.interactionContainer&&(this.#aborter= +new AbortController,this.interactionInitiator.addEventListener("pointerdown",this.#onPointerDown, +{signal:this.#aborter.signal}),this.interactionInitiator.addEventListener("drags\ +tart",this.#onDragStart,{signal:this.#aborter.signal}),this.interactionInitiator. +addEventListener("pointercancel",()=>{console.error("Pointercancel should not be\ + happening. If so, please kindly open an issue at https://github.com/lume/lume/i\ +ssues.")},{signal:this.#aborter.signal}),onCleanup(()=>{this.#mainPointer=-1,this.#pointerCount= +0,this.rotationXTarget.rotation=()=>!1,this.rotationYTarget.rotation=()=>!1,this.#aborter. +abort()}))}),this)}stop(){return this.#isStarted?(this.#isStarted=!1,this.stopEffects(), +this):this}};return FlingRotation2=_classThis})();var __esDecorate37=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers37=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[reactive], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Effects2,_instanceExtraInitializers=[], +_x_decorators,_x_initializers=[],_y_decorators,_y_initializers=[],_hasInteracted_decorators, +_hasInteracted_initializers=[];var ScrollFling2=class extends _classSuper{static{ +__name(this,"ScrollFling")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_x_decorators=[signal],_y_decorators=[signal],_hasInteracted_decorators=[signal], +__esDecorate37(null,null,_x_decorators,{kind:"field",name:"x",static:!1,private:!1, +access:{has:obj=>"x"in obj,get:obj=>obj.x,set:(obj,value)=>{obj.x=value}},metadata:_metadata}, +_x_initializers,_instanceExtraInitializers),__esDecorate37(null,null,_y_decorators, +{kind:"field",name:"y",static:!1,private:!1,access:{has:obj=>"y"in obj,get:obj=>obj. +y,set:(obj,value)=>{obj.y=value}},metadata:_metadata},_y_initializers,_instanceExtraInitializers), +__esDecorate37(null,null,_hasInteracted_decorators,{kind:"field",name:"hasIntera\ +cted",static:!1,private:!1,access:{has:obj=>"hasInteracted"in obj,get:obj=>obj.hasInteracted, +set:(obj,value)=>{obj.hasInteracted=value}},metadata:_metadata},_hasInteracted_initializers, +_instanceExtraInitializers),__esDecorate37(null,_classDescriptor={value:_classThis}, +_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers), +ScrollFling2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty( +_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}), +__runInitializers37(_classThis,_classExtraInitializers)}x=(__runInitializers37(this, +_instanceExtraInitializers),__runInitializers37(this,_x_initializers,0));y=__runInitializers37( +this,_y_initializers,0);minX=-1/0;maxX=1/0;minY=-1/0;maxY=1/0;target=document.documentElement;sensitivity=1;hasInteracted=__runInitializers37( +this,_hasInteracted_initializers,!1);#task;#isStarted=(()=>{let{0:get,1:set}=createSignal( +!1);return{get,set}})();get isStarted(){return this.#isStarted.get()}#aborter=new AbortController;constructor(options={}){ +super(),Object.assign(this,options)}#onWheel=event=>{this.hasInteracted=!0,event. +preventDefault();let dx=event.deltaX*this.sensitivity,dy=event.deltaY*this.sensitivity; +this.x=clamp3(this.x+dx,this.minX,this.maxX),this.y=clamp3(this.y+dy,this.minY,this. +maxY),!(dx===0&&dy===0)&&(this.#task&&Motor.removeRenderTask(this.#task),this.#task= +Motor.addRenderTask(()=>{if(dx=dx*.95,dy=dy*.95,this.x=clamp3(this.x+dx,this.minX, +this.maxX),this.y=clamp3(this.y+dy,this.minY,this.maxY),Math.abs(dx)<.01&&Math.abs( +dy)<.01)return!1}))};start(){return untrack(this.#isStarted.get)?this:(this.#isStarted. +set(!0),this.createEffect(()=>{this.target,this.#aborter=new AbortController,this. +target.addEventListener("wheel",this.#onWheel,{signal:this.#aborter.signal}),onCleanup( +()=>{this.#task&&Motor.removeRenderTask(this.#task),this.#aborter.abort()})}),this)}stop(){ +return untrack(this.#isStarted.get)?(this.#isStarted.set(!1),this.stopEffects(), +this):this}};return ScrollFling2=_classThis})();window.debug=!1;var __esDecorate38=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers38=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[reactive],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=Effects2,_instanceExtraInitializers=[], +_x_decorators,_x_initializers=[],_target_decorators,_target_initializers=[],_hasInteracted_decorators, +_hasInteracted_initializers=[];var PinchFling2=class extends _classSuper{static{ +__name(this,"PinchFling")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_x_decorators=[signal],_target_decorators=[signal],_hasInteracted_decorators=[signal], +__esDecorate38(null,null,_x_decorators,{kind:"field",name:"x",static:!1,private:!1, +access:{has:obj=>"x"in obj,get:obj=>obj.x,set:(obj,value)=>{obj.x=value}},metadata:_metadata}, +_x_initializers,_instanceExtraInitializers),__esDecorate38(null,null,_target_decorators, +{kind:"field",name:"target",static:!1,private:!1,access:{has:obj=>"target"in obj, +get:obj=>obj.target,set:(obj,value)=>{obj.target=value}},metadata:_metadata},_target_initializers, +_instanceExtraInitializers),__esDecorate38(null,null,_hasInteracted_decorators,{ +kind:"field",name:"hasInteracted",static:!1,private:!1,access:{has:obj=>"hasInte\ +racted"in obj,get:obj=>obj.hasInteracted,set:(obj,value)=>{obj.hasInteracted=value}}, +metadata:_metadata},_hasInteracted_initializers,_instanceExtraInitializers),__esDecorate38( +null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis. +name,metadata:_metadata},null,_classExtraInitializers),PinchFling2=_classThis=_classDescriptor. +value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0, +configurable:!0,writable:!0,value:_metadata}),__runInitializers38(_classThis,_classExtraInitializers)}x=(__runInitializers38( +this,_instanceExtraInitializers),__runInitializers38(this,_x_initializers,0));minX=-1/0;maxX=1/0;target=__runInitializers38( +this,_target_initializers,document.documentElement);sensitivity=1;hasInteracted=__runInitializers38( +this,_hasInteracted_initializers,!1);#task;#interacting=(()=>{let{0:get,1:set}=createSignal( +!1);return{get,set}})();get interacting(){return this.#interacting.get()}#isStarted=(()=>{ +let{0:get,1:set}=createSignal(!1);return{get,set}})();get isStarted(){return this.#isStarted. +get()}#aborter=new AbortController;constructor(options={}){super(),Object.assign( +this,options)}#onPinch=dx=>{this.hasInteracted=!0,dx=dx*this.sensitivity,this.x= +clamp3(this.x+dx,this.minX,this.maxX),dx!==0&&(this.#task&&Motor.removeRenderTask( +this.#task),this.#task=Motor.addRenderTask(()=>{if(dx=dx*.95,this.x=clamp3(this. +x+dx,this.minX,this.maxX),Math.abs(dx)<.01)return!1}))};#pointers=new Map;#onDown=event=>{ +event.clientX,this.#pointers.set(event.pointerId,{id:event.pointerId,x:event.clientX, +y:event.clientY}),this.#pointers.size===2&&(this.target.addEventListener("pointe\ +rmove",this.#onMove,{signal:this.#aborter.signal}),this.#interacting.set(!0))};#lastDistance=-1;#onMove=event=>{ +if(!this.#pointers.has(event.pointerId)||this.#pointers.size<2)return;let[one,two]=this.#pointers. +values();event.pointerId===one.id?(one.x=event.clientX,one.y=event.clientY):(two. +x=event.clientX,two.y=event.clientY);let distance=Math.abs(Math.sqrt((two.x-one. +x)**2+(two.y-one.y)**2));this.#lastDistance===-1&&(this.#lastDistance=distance); +let dx=this.#lastDistance-distance;this.#onPinch(dx),this.#lastDistance=distance};#onUp=event=>{ +this.#pointers.has(event.pointerId)&&(this.#pointers.delete(event.pointerId),this.#lastDistance= +-1,this.#pointers.size===1&&(this.target.removeEventListener("pointermove",this.#onMove), +this.#interacting.set(!1)))};start(){return untrack(this.#isStarted.get)?this:(this.#isStarted. +set(!0),this.createEffect(()=>{this.target,this.#aborter=new AbortController,this. +target.addEventListener("pointerdown",this.#onDown,{signal:this.#aborter.signal}), +this.target.addEventListener("pointerup",this.#onUp,{signal:this.#aborter.signal}), +onCleanup(()=>{this.#task&&Motor.removeRenderTask(this.#task),this.#aborter.abort()})}), +this)}stop(){return untrack(this.#isStarted.get)?(this.#isStarted.set(!1),this.stopEffects(), +this):this}};return PinchFling2=_classThis})();var __runInitializers39=function(thisArg,initializers,value){for(var useValue=arguments. +length>2,i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},CameraRig=(()=>{ +let _classDecorators=[element("lume-camera-rig",autoDefineElements)],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=Element3D,_instanceExtraInitializers=[], +_verticalAngle_decorators,_verticalAngle_initializers=[],_get_initialPolarAngle_decorators, +_minVerticalAngle_decorators,_minVerticalAngle_initializers=[],_get_minPolarAngle_decorators, +_maxVerticalAngle_decorators,_maxVerticalAngle_initializers=[],_get_maxPolarAngle_decorators, +_horizontalAngle_decorators,_horizontalAngle_initializers=[],_minHorizontalAngle_decorators, +_minHorizontalAngle_initializers=[],_maxHorizontalAngle_decorators,_maxHorizontalAngle_initializers=[], +_distance_decorators,_distance_initializers=[],___appliedDistance_decorators,___appliedDistance_initializers=[], +_get_initialDistance_decorators,_minDistance_decorators,_minDistance_initializers=[], +___appliedMinDistance_decorators,___appliedMinDistance_initializers=[],_maxDistance_decorators, +_maxDistance_initializers=[],___appliedMaxDistance_decorators,___appliedMaxDistance_initializers=[], +_active_decorators,_active_initializers=[],_dollySpeed_decorators,_dollySpeed_initializers=[], +_interactive_decorators,_interactive_initializers=[],_threeCamera_decorators,_threeCamera_initializers=[], +_rotationYTarget_decorators,_rotationYTarget_initializers=[],_rotationXTarget_decorators, +_rotationXTarget_initializers=[];var CameraRig2=class extends _classSuper{static{ +__name(this,"CameraRig")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_verticalAngle_decorators=[numberAttribute],_get_initialPolarAngle_decorators=[numberAttribute], +_minVerticalAngle_decorators=[numberAttribute],_get_minPolarAngle_decorators=[numberAttribute], +_maxVerticalAngle_decorators=[numberAttribute],_get_maxPolarAngle_decorators=[numberAttribute], +_horizontalAngle_decorators=[numberAttribute],_minHorizontalAngle_decorators=[numberAttribute], +_maxHorizontalAngle_decorators=[numberAttribute],_distance_decorators=[numberAttribute], +___appliedDistance_decorators=[signal],_get_initialDistance_decorators=[numberAttribute], +_minDistance_decorators=[numberAttribute],___appliedMinDistance_decorators=[signal], +_maxDistance_decorators=[numberAttribute],___appliedMaxDistance_decorators=[signal], +_active_decorators=[booleanAttribute],_dollySpeed_decorators=[numberAttribute],_interactive_decorators= +[booleanAttribute],_threeCamera_decorators=[signal],_rotationYTarget_decorators= +[signal],_rotationXTarget_decorators=[signal],__esDecorate39(this,null,_get_initialPolarAngle_decorators, +{kind:"getter",name:"initialPolarAngle",static:!1,private:!1,access:{has:obj=>"i\ +nitialPolarAngle"in obj,get:obj=>obj.initialPolarAngle},metadata:_metadata},null, +_instanceExtraInitializers),__esDecorate39(this,null,_get_minPolarAngle_decorators, +{kind:"getter",name:"minPolarAngle",static:!1,private:!1,access:{has:obj=>"minPo\ +larAngle"in obj,get:obj=>obj.minPolarAngle},metadata:_metadata},null,_instanceExtraInitializers), +__esDecorate39(this,null,_get_maxPolarAngle_decorators,{kind:"getter",name:"maxP\ +olarAngle",static:!1,private:!1,access:{has:obj=>"maxPolarAngle"in obj,get:obj=>obj. +maxPolarAngle},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate39( +this,null,_get_initialDistance_decorators,{kind:"getter",name:"initialDistance", +static:!1,private:!1,access:{has:obj=>"initialDistance"in obj,get:obj=>obj.initialDistance}, +metadata:_metadata},null,_instanceExtraInitializers),__esDecorate39(null,null,_verticalAngle_decorators, +{kind:"field",name:"verticalAngle",static:!1,private:!1,access:{has:obj=>"vertic\ +alAngle"in obj,get:obj=>obj.verticalAngle,set:(obj,value)=>{obj.verticalAngle=value}}, +metadata:_metadata},_verticalAngle_initializers,_instanceExtraInitializers),__esDecorate39( +null,null,_minVerticalAngle_decorators,{kind:"field",name:"minVerticalAngle",static:!1, +private:!1,access:{has:obj=>"minVerticalAngle"in obj,get:obj=>obj.minVerticalAngle, +set:(obj,value)=>{obj.minVerticalAngle=value}},metadata:_metadata},_minVerticalAngle_initializers, +_instanceExtraInitializers),__esDecorate39(null,null,_maxVerticalAngle_decorators, +{kind:"field",name:"maxVerticalAngle",static:!1,private:!1,access:{has:obj=>"max\ +VerticalAngle"in obj,get:obj=>obj.maxVerticalAngle,set:(obj,value)=>{obj.maxVerticalAngle= +value}},metadata:_metadata},_maxVerticalAngle_initializers,_instanceExtraInitializers), +__esDecorate39(null,null,_horizontalAngle_decorators,{kind:"field",name:"horizon\ +talAngle",static:!1,private:!1,access:{has:obj=>"horizontalAngle"in obj,get:obj=>obj. +horizontalAngle,set:(obj,value)=>{obj.horizontalAngle=value}},metadata:_metadata}, +_horizontalAngle_initializers,_instanceExtraInitializers),__esDecorate39(null,null, +_minHorizontalAngle_decorators,{kind:"field",name:"minHorizontalAngle",static:!1, +private:!1,access:{has:obj=>"minHorizontalAngle"in obj,get:obj=>obj.minHorizontalAngle, +set:(obj,value)=>{obj.minHorizontalAngle=value}},metadata:_metadata},_minHorizontalAngle_initializers, +_instanceExtraInitializers),__esDecorate39(null,null,_maxHorizontalAngle_decorators, +{kind:"field",name:"maxHorizontalAngle",static:!1,private:!1,access:{has:obj=>"m\ +axHorizontalAngle"in obj,get:obj=>obj.maxHorizontalAngle,set:(obj,value)=>{obj.maxHorizontalAngle= +value}},metadata:_metadata},_maxHorizontalAngle_initializers,_instanceExtraInitializers), +__esDecorate39(null,null,_distance_decorators,{kind:"field",name:"distance",static:!1, +private:!1,access:{has:obj=>"distance"in obj,get:obj=>obj.distance,set:(obj,value)=>{ +obj.distance=value}},metadata:_metadata},_distance_initializers,_instanceExtraInitializers), +__esDecorate39(null,null,___appliedDistance_decorators,{kind:"field",name:"__app\ +liedDistance",static:!1,private:!1,access:{has:obj=>"__appliedDistance"in obj,get:obj=>obj. +__appliedDistance,set:(obj,value)=>{obj.__appliedDistance=value}},metadata:_metadata}, +___appliedDistance_initializers,_instanceExtraInitializers),__esDecorate39(null, +null,_minDistance_decorators,{kind:"field",name:"minDistance",static:!1,private:!1, +access:{has:obj=>"minDistance"in obj,get:obj=>obj.minDistance,set:(obj,value)=>{ +obj.minDistance=value}},metadata:_metadata},_minDistance_initializers,_instanceExtraInitializers), +__esDecorate39(null,null,___appliedMinDistance_decorators,{kind:"field",name:"__\ +appliedMinDistance",static:!1,private:!1,access:{has:obj=>"__appliedMinDistance"in +obj,get:obj=>obj.__appliedMinDistance,set:(obj,value)=>{obj.__appliedMinDistance= +value}},metadata:_metadata},___appliedMinDistance_initializers,_instanceExtraInitializers), +__esDecorate39(null,null,_maxDistance_decorators,{kind:"field",name:"maxDistance", +static:!1,private:!1,access:{has:obj=>"maxDistance"in obj,get:obj=>obj.maxDistance, +set:(obj,value)=>{obj.maxDistance=value}},metadata:_metadata},_maxDistance_initializers, +_instanceExtraInitializers),__esDecorate39(null,null,___appliedMaxDistance_decorators, +{kind:"field",name:"__appliedMaxDistance",static:!1,private:!1,access:{has:obj=>"\ +__appliedMaxDistance"in obj,get:obj=>obj.__appliedMaxDistance,set:(obj,value)=>{ +obj.__appliedMaxDistance=value}},metadata:_metadata},___appliedMaxDistance_initializers, +_instanceExtraInitializers),__esDecorate39(null,null,_active_decorators,{kind:"f\ +ield",name:"active",static:!1,private:!1,access:{has:obj=>"active"in obj,get:obj=>obj. +active,set:(obj,value)=>{obj.active=value}},metadata:_metadata},_active_initializers, +_instanceExtraInitializers),__esDecorate39(null,null,_dollySpeed_decorators,{kind:"\ +field",name:"dollySpeed",static:!1,private:!1,access:{has:obj=>"dollySpeed"in obj, +get:obj=>obj.dollySpeed,set:(obj,value)=>{obj.dollySpeed=value}},metadata:_metadata}, +_dollySpeed_initializers,_instanceExtraInitializers),__esDecorate39(null,null,_interactive_decorators, +{kind:"field",name:"interactive",static:!1,private:!1,access:{has:obj=>"interact\ +ive"in obj,get:obj=>obj.interactive,set:(obj,value)=>{obj.interactive=value}},metadata:_metadata}, +_interactive_initializers,_instanceExtraInitializers),__esDecorate39(null,null,_threeCamera_decorators, +{kind:"field",name:"threeCamera",static:!1,private:!1,access:{has:obj=>"threeCam\ +era"in obj,get:obj=>obj.threeCamera,set:(obj,value)=>{obj.threeCamera=value}},metadata:_metadata}, +_threeCamera_initializers,_instanceExtraInitializers),__esDecorate39(null,null,_rotationYTarget_decorators, +{kind:"field",name:"rotationYTarget",static:!1,private:!1,access:{has:obj=>"rota\ +tionYTarget"in obj,get:obj=>obj.rotationYTarget,set:(obj,value)=>{obj.rotationYTarget= +value}},metadata:_metadata},_rotationYTarget_initializers,_instanceExtraInitializers), +__esDecorate39(null,null,_rotationXTarget_decorators,{kind:"field",name:"rotatio\ +nXTarget",static:!1,private:!1,access:{has:obj=>"rotationXTarget"in obj,get:obj=>obj. +rotationXTarget,set:(obj,value)=>{obj.rotationXTarget=value}},metadata:_metadata}, +_rotationXTarget_initializers,_instanceExtraInitializers),__esDecorate39(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),CameraRig2=_classThis=_classDescriptor.value,_metadata&& +Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers39(_classThis,_classExtraInitializers)}hasShadow=(__runInitializers39( +this,_instanceExtraInitializers),!0);verticalAngle=__runInitializers39(this,_verticalAngle_initializers, +0);get initialPolarAngle(){return this.verticalAngle}set initialPolarAngle(value){ +this.verticalAngle=value}minVerticalAngle=__runInitializers39(this,_minVerticalAngle_initializers, +-90);get minPolarAngle(){return this.minVerticalAngle}set minPolarAngle(value){this. +minVerticalAngle=value}maxVerticalAngle=__runInitializers39(this,_maxVerticalAngle_initializers, +90);get maxPolarAngle(){return this.maxVerticalAngle}set maxPolarAngle(value){this. +maxVerticalAngle=value}horizontalAngle=__runInitializers39(this,_horizontalAngle_initializers, +0);minHorizontalAngle=__runInitializers39(this,_minHorizontalAngle_initializers, +-1/0);maxHorizontalAngle=__runInitializers39(this,_maxHorizontalAngle_initializers, +1/0);distance=__runInitializers39(this,_distance_initializers,-1);__appliedDistance=__runInitializers39( +this,___appliedDistance_initializers,800);get initialDistance(){return this.distance}set initialDistance(value){ +this.distance=value}minDistance=__runInitializers39(this,_minDistance_initializers, +-1);__appliedMinDistance=__runInitializers39(this,___appliedMinDistance_initializers, +200);maxDistance=__runInitializers39(this,_maxDistance_initializers,-1);__appliedMaxDistance=__runInitializers39( +this,___appliedMaxDistance_initializers,800);active=__runInitializers39(this,_active_initializers, +!0);dollySpeed=__runInitializers39(this,_dollySpeed_initializers,1);interactive=__runInitializers39( +this,_interactive_initializers,!0);threeCamera=__runInitializers39(this,_threeCamera_initializers, +void 0);get cam(){return this.threeCamera}rotationYTarget=__runInitializers39(this, +_rotationYTarget_initializers,void 0);rotationXTarget=__runInitializers39(this,_rotationXTarget_initializers, +void 0);flingRotation=new FlingRotation;scrollFling=new ScrollFling;pinchFling=new PinchFling;get#derivedInputDistance(){ +return this.distance!==-1?this.distance:this.scene?.perspective??800}connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{if(!(this.scene&&this.rotationYTarget&& +this.rotationXTarget&&this.threeCamera))return;this.createEffect(()=>{this.__appliedDistance= +this.#derivedInputDistance,this.__appliedMinDistance=this.minDistance!==-1?this. +minDistance:this.#derivedInputDistance/2,this.__appliedMaxDistance=this.maxDistance!== +-1?this.maxDistance:this.#derivedInputDistance*2}),this.createEffect(()=>this.threeCamera. +position.z=this.__appliedDistance);let{scrollFling,pinchFling,flingRotation}=this; +flingRotation.interactionInitiator=this.scene,flingRotation.interactionContainer= +this.scene,flingRotation.rotationYTarget=this.rotationYTarget,flingRotation.rotationXTarget= +this.rotationXTarget,scrollFling.target=this.scene,pinchFling.target=this.scene, +syncSignals(()=>this.__appliedDistance,d2=>this.__appliedDistance=d2,()=>this.scrollFling. +y,y2=>this.scrollFling.y=y2),syncSignals(()=>this.scrollFling.y,y2=>this.scrollFling. +y=y2,()=>this.pinchFling.x,x2=>this.pinchFling.x=x2),this.createEffect(()=>{flingRotation. +minFlingRotationX=this.minVerticalAngle,flingRotation.maxFlingRotationX=this.maxVerticalAngle, +flingRotation.minFlingRotationY=this.minHorizontalAngle,flingRotation.maxFlingRotationY= +this.maxHorizontalAngle,scrollFling.minY=pinchFling.minX=this.__appliedMinDistance, +scrollFling.maxY=pinchFling.maxX=this.__appliedMaxDistance,scrollFling.sensitivity= +pinchFling.sensitivity=this.dollySpeed}),this.createEffect(()=>{this.interactive&& +!this.pinchFling?.interacting?flingRotation.start():flingRotation.stop()}),this. +createEffect(()=>{this.interactive?(scrollFling.start(),pinchFling.start()):(scrollFling. +stop(),pinchFling.stop())}),onCleanup(()=>{this.flingRotation.stop(),this.scrollFling. +stop(),this.pinchFling.stop()})})}template=()=>html` + this.rotationYTarget=el2} + size="1 1 1" + size-mode="proportional proportional proportional" + rotation=${()=>[0,this.horizontalAngle,0]} + > + this.rotationXTarget=el2} + size="1 1 1" + rotation=${()=>[this.verticalAngle,0,0]} + size-mode="proportional proportional proportional" + > + + this.threeCamera=cam} + id="camera-rig-perspective-camera" + active=${()=>this.active} + comment="We don't set position here because it triggers the pre-upgrade handling due to the template running before perspective-camera is upgraded (due to Solid specifics) which causes the initial value to override the initial position calculated from scene.perspective." + xposition=${()=>[0,0,this.__appliedDistance]} + align-point="0.5 0.5 0.5" + far="10000" + > + + + + + + + + `};return CameraRig2=_classThis})();var __esDecorate40=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers40=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element],_classDescriptor,_classExtraInitializers=[], +_classThis,_classSuper=Element3D,_instanceExtraInitializers=[],_aspect_decorators, +_aspect_initializers=[],_near_decorators,_near_initializers=[],_far_decorators,_far_initializers=[], +_active_decorators,_active_initializers=[],_zoom_decorators,_zoom_initializers=[]; +var Camera4=class extends _classSuper{static{__name(this,"Camera")}static{_classThis= +this}static{let _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create( +_classSuper[Symbol.metadata]??null):void 0;_aspect_decorators=[numberAttribute], +_near_decorators=[numberAttribute],_far_decorators=[numberAttribute],_active_decorators= +[booleanAttribute],_zoom_decorators=[numberAttribute],__esDecorate40(null,null,_aspect_decorators, +{kind:"field",name:"aspect",static:!1,private:!1,access:{has:obj=>"aspect"in obj, +get:obj=>obj.aspect,set:(obj,value)=>{obj.aspect=value}},metadata:_metadata},_aspect_initializers, +_instanceExtraInitializers),__esDecorate40(null,null,_near_decorators,{kind:"fie\ +ld",name:"near",static:!1,private:!1,access:{has:obj=>"near"in obj,get:obj=>obj. +near,set:(obj,value)=>{obj.near=value}},metadata:_metadata},_near_initializers,_instanceExtraInitializers), +__esDecorate40(null,null,_far_decorators,{kind:"field",name:"far",static:!1,private:!1, +access:{has:obj=>"far"in obj,get:obj=>obj.far,set:(obj,value)=>{obj.far=value}}, +metadata:_metadata},_far_initializers,_instanceExtraInitializers),__esDecorate40( +null,null,_active_decorators,{kind:"field",name:"active",static:!1,private:!1,access:{ +has:obj=>"active"in obj,get:obj=>obj.active,set:(obj,value)=>{obj.active=value}}, +metadata:_metadata},_active_initializers,_instanceExtraInitializers),__esDecorate40( +null,null,_zoom_decorators,{kind:"field",name:"zoom",static:!1,private:!1,access:{ +has:obj=>"zoom"in obj,get:obj=>obj.zoom,set:(obj,value)=>{obj.zoom=value}},metadata:_metadata}, +_zoom_initializers,_instanceExtraInitializers),__esDecorate40(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),Camera4=_classThis=_classDescriptor.value,_metadata&& +Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers40(_classThis,_classExtraInitializers)}aspect=(__runInitializers40( +this,_instanceExtraInitializers),__runInitializers40(this,_aspect_initializers,0));near=__runInitializers40( +this,_near_initializers,1);far=__runInitializers40(this,_far_initializers,3e3);active=__runInitializers40( +this,_active_initializers,!1);zoom=__runInitializers40(this,_zoom_initializers,1);connectedCallback(){ +super.connectedCallback();let lastScene=this.scene;this.createEffect(()=>{!this. +scene||!this.active||(lastScene=this.scene,untrack(()=>this.scene._addCamera(this)), +onCleanup(()=>{lastScene._removeCamera(this),lastScene=null}))})}makeThreeObject3d(){ +return new Camera2}};return Camera4=_classThis})();var __esDecorate41=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers41=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-persp\ +ective-camera",autoDefineElements)],_classDescriptor,_classExtraInitializers=[], +_classThis,_classSuper=Camera3,_instanceExtraInitializers=[],_fov_decorators,_fov_initializers=[]; +var PerspectiveCamera4=class extends _classSuper{static{__name(this,"Perspective\ +Camera")}static{_classThis=this}static{let _metadata=typeof Symbol=="function"&& +Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;_fov_decorators= +[numberAttribute],__esDecorate41(null,null,_fov_decorators,{kind:"field",name:"f\ +ov",static:!1,private:!1,access:{has:obj=>"fov"in obj,get:obj=>obj.fov,set:(obj,value)=>{ +obj.fov=value}},metadata:_metadata},_fov_initializers,_instanceExtraInitializers), +__esDecorate41(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),PerspectiveCamera4= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers41( +_classThis,_classExtraInitializers)}fov=(__runInitializers41(this,_instanceExtraInitializers), +__runInitializers41(this,_fov_initializers,0));connectedCallback(){super.connectedCallback(), +this.createEffect(()=>{if(this.fov!==0){this.three.fov=this.fov,this.three.updateProjectionMatrix(), +this.needsUpdate();return}let perspective=this.scene?.perspective??800,sceneSize=this. +scene?.calculatedSize??{x:1,y:1,z:0};this.three.fov=180*(2*Math.atan(sceneSize.y/ +2/perspective))/Math.PI,this.three.updateProjectionMatrix(),this.needsUpdate()}), +this.createEffect(()=>{if(this.aspect!==0){this.three.aspect=this.aspect,this.three. +updateProjectionMatrix(),this.needsUpdate();return}let sceneSize=this.scene?.calculatedSize|| +{x:1,y:1};this.three.aspect=sceneSize.x/sceneSize.y||1,this.three.updateProjectionMatrix(), +this.needsUpdate()}),this.createEffect(()=>{this.three.near=this.near,this.three. +updateProjectionMatrix(),this.needsUpdate()}),this.createEffect(()=>{this.three. +far=this.far,this.three.updateProjectionMatrix(),this.needsUpdate()}),this.createEffect( +()=>{this.three.zoom=this.zoom,this.three.updateProjectionMatrix(),this.needsUpdate()})}makeThreeObject3d(){ +return new PerspectiveCamera2(75,16/9,1,1e3)}};return PerspectiveCamera4=_classThis})();var __esDecorate42=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers42=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-node",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D;var Node5=class extends _classSuper{static{ +__name(this,"Node")}static{_classThis=this}static{let _metadata=typeof Symbol=="\ +function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate42(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Node5= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers42( +_classThis,_classExtraInitializers)}isNode=!0};return Node5=_classThis})();Node4.prototype.isNode=!0;var Fog=class _Fog{static{__name(this,"Fog")}constructor(color,near=1,far=1e3){this. +isFog=!0,this.name="",this.color=new Color(color),this.near=near,this.far=far}clone(){ +return new _Fog(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this. +name,color:this.color.getHex(),near:this.near,far:this.far}}};var FogExp2=class _FogExp2{static{__name(this,"FogExp2")}constructor(color,density=25e-5){ +this.isFogExp2=!0,this.name="",this.color=new Color(color),this.density=density}clone(){ +return new _FogExp2(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this. +name,color:this.color.getHex(),density:this.density}}};var _sphere6=new Sphere,_vector6=new Vector3,Frustum2=class{static{__name(this,"\ +Frustum")}constructor(p0=new Plane,p1=new Plane,p2=new Plane,p3=new Plane,p4=new Plane,p5=new Plane){ +this.planes=[p0,p1,p2,p3,p4,p5]}set(p0,p1,p2,p3,p4,p5){let planes=this.planes;return planes[0]. +copy(p0),planes[1].copy(p1),planes[2].copy(p2),planes[3].copy(p3),planes[4].copy( +p4),planes[5].copy(p5),this}copy(frustum){let planes=this.planes;for(let i2=0;i2< +6;i2++)planes[i2].copy(frustum.planes[i2]);return this}setFromProjectionMatrix(m,coordinateSystem=WebGLCoordinateSystem){ +let planes=this.planes,me=m.elements,me0=me[0],me1=me[1],me2=me[2],me3=me[3],me4=me[4], +me5=me[5],me6=me[6],me7=me[7],me8=me[8],me9=me[9],me10=me[10],me11=me[11],me12=me[12], +me13=me[13],me14=me[14],me15=me[15];if(planes[0].setComponents(me3-me0,me7-me4,me11- +me8,me15-me12).normalize(),planes[1].setComponents(me3+me0,me7+me4,me11+me8,me15+ +me12).normalize(),planes[2].setComponents(me3+me1,me7+me5,me11+me9,me15+me13).normalize(), +planes[3].setComponents(me3-me1,me7-me5,me11-me9,me15-me13).normalize(),planes[4]. +setComponents(me3-me2,me7-me6,me11-me10,me15-me14).normalize(),coordinateSystem=== +WebGLCoordinateSystem)planes[5].setComponents(me3+me2,me7+me6,me11+me10,me15+me14). +normalize();else if(coordinateSystem===WebGPUCoordinateSystem)planes[5].setComponents( +me2,me6,me10,me14).normalize();else throw new Error("THREE.Frustum.setFromProjec\ +tionMatrix(): Invalid coordinate system: "+coordinateSystem);return this}intersectsObject(object){ +if(object.boundingSphere!==void 0)object.boundingSphere===null&&object.computeBoundingSphere(), +_sphere6.copy(object.boundingSphere).applyMatrix4(object.matrixWorld);else{let geometry=object. +geometry;geometry.boundingSphere===null&&geometry.computeBoundingSphere(),_sphere6. +copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld)}return this.intersectsSphere( +_sphere6)}intersectsSprite(sprite){return _sphere6.center.set(0,0,0),_sphere6.radius= +.7071067811865476,_sphere6.applyMatrix4(sprite.matrixWorld),this.intersectsSphere( +_sphere6)}intersectsSphere(sphere){let planes=this.planes,center=sphere.center,negRadius=-sphere. +radius;for(let i2=0;i2<6;i2++)if(planes[i2].distanceToPoint(center)0?box.max.x:box.min.x,_vector6.y=plane.normal.y>0?box. +max.y:box.min.y,_vector6.z=plane.normal.z>0?box.max.z:box.min.z,plane.distanceToPoint( +_vector6)<0)return!1}return!0}containsPoint(point){let planes=this.planes;for(let i2=0;i2< +6;i2++)if(planes[i2].distanceToPoint(point)<0)return!1;return!0}clone(){return new this. +constructor().copy(this)}};var Vector42=class _Vector4{static{__name(this,"Vector4")}constructor(x2=0,y2=0,z2=0,w2=1){ +_Vector4.prototype.isVector4=!0,this.x=x2,this.y=y2,this.z=z2,this.w=w2}get width(){ +return this.z}set width(value){this.z=value}get height(){return this.w}set height(value){ +this.w=value}set(x2,y2,z2,w2){return this.x=x2,this.y=y2,this.z=z2,this.w=w2,this}setScalar(scalar){ +return this.x=scalar,this.y=scalar,this.z=scalar,this.w=scalar,this}setX(x2){return this. +x=x2,this}setY(y2){return this.y=y2,this}setZ(z2){return this.z=z2,this}setW(w2){ +return this.w=w2,this}setComponent(index,value){switch(index){case 0:this.x=value; +break;case 1:this.y=value;break;case 2:this.z=value;break;case 3:this.w=value;break;default: +throw new Error("index is out of range: "+index)}return this}getComponent(index){ +switch(index){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: "+index)}}clone(){ +return new this.constructor(this.x,this.y,this.z,this.w)}copy(v){return this.x=v. +x,this.y=v.y,this.z=v.z,this.w=v.w!==void 0?v.w:1,this}add(v){return this.x+=v.x, +this.y+=v.y,this.z+=v.z,this.w+=v.w,this}addScalar(s){return this.x+=s,this.y+=s, +this.z+=s,this.w+=s,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this. +z=a.z+b.z,this.w=a.w+b.w,this}addScaledVector(v,s){return this.x+=v.x*s,this.y+= +v.y*s,this.z+=v.z*s,this.w+=v.w*s,this}sub(v){return this.x-=v.x,this.y-=v.y,this. +z-=v.z,this.w-=v.w,this}subScalar(s){return this.x-=s,this.y-=s,this.z-=s,this.w-= +s,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this. +w=a.w-b.w,this}multiply(v){return this.x*=v.x,this.y*=v.y,this.z*=v.z,this.w*=v. +w,this}multiplyScalar(scalar){return this.x*=scalar,this.y*=scalar,this.z*=scalar, +this.w*=scalar,this}applyMatrix4(m){let x2=this.x,y2=this.y,z2=this.z,w2=this.w, +e=m.elements;return this.x=e[0]*x2+e[4]*y2+e[8]*z2+e[12]*w2,this.y=e[1]*x2+e[5]* +y2+e[9]*z2+e[13]*w2,this.z=e[2]*x2+e[6]*y2+e[10]*z2+e[14]*w2,this.w=e[3]*x2+e[7]* +y2+e[11]*z2+e[15]*w2,this}divideScalar(scalar){return this.multiplyScalar(1/scalar)}setAxisAngleFromQuaternion(q2){ +this.w=2*Math.acos(q2.w);let s=Math.sqrt(1-q2.w*q2.w);return s<1e-4?(this.x=1,this. +y=0,this.z=0):(this.x=q2.x/s,this.y=q2.y/s,this.z=q2.z/s),this}setAxisAngleFromRotationMatrix(m){ +let angle,x2,y2,z2,te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5], +m23=te[9],m31=te[2],m32=te[6],m33=te[10];if(Math.abs(m12-m21)<.01&&Math.abs(m13- +m31)<.01&&Math.abs(m23-m32)<.01){if(Math.abs(m12+m21)<.1&&Math.abs(m13+m31)<.1&& +Math.abs(m23+m32)<.1&&Math.abs(m11+m22+m33-3)<.1)return this.set(1,0,0,0),this;angle= +Math.PI;let xx=(m11+1)/2,yy=(m22+1)/2,zz=(m33+1)/2,xy=(m12+m21)/4,xz=(m13+m31)/4, +yz=(m23+m32)/4;return xx>yy&&xx>zz?xx<.01?(x2=0,y2=.707106781,z2=.707106781):(x2= +Math.sqrt(xx),y2=xy/x2,z2=xz/x2):yy>zz?yy<.01?(x2=.707106781,y2=0,z2=.707106781): +(y2=Math.sqrt(yy),x2=xy/y2,z2=yz/y2):zz<.01?(x2=.707106781,y2=.707106781,z2=0):(z2= +Math.sqrt(zz),x2=xz/z2,y2=yz/z2),this.set(x2,y2,z2,angle),this}let s=Math.sqrt((m32- +m23)*(m32-m23)+(m13-m31)*(m13-m31)+(m21-m12)*(m21-m12));return Math.abs(s)<.001&& +(s=1),this.x=(m32-m23)/s,this.y=(m13-m31)/s,this.z=(m21-m12)/s,this.w=Math.acos( +(m11+m22+m33-1)/2),this}min(v){return this.x=Math.min(this.x,v.x),this.y=Math.min( +this.y,v.y),this.z=Math.min(this.z,v.z),this.w=Math.min(this.w,v.w),this}max(v){ +return this.x=Math.max(this.x,v.x),this.y=Math.max(this.y,v.y),this.z=Math.max(this. +z,v.z),this.w=Math.max(this.w,v.w),this}clamp(min,max2){return this.x=Math.max(min. +x,Math.min(max2.x,this.x)),this.y=Math.max(min.y,Math.min(max2.y,this.y)),this.z= +Math.max(min.z,Math.min(max2.z,this.z)),this.w=Math.max(min.w,Math.min(max2.w,this. +w)),this}clampScalar(minVal,maxVal){return this.x=Math.max(minVal,Math.min(maxVal, +this.x)),this.y=Math.max(minVal,Math.min(maxVal,this.y)),this.z=Math.max(minVal, +Math.min(maxVal,this.z)),this.w=Math.max(minVal,Math.min(maxVal,this.w)),this}clampLength(min,max2){ +let length=this.length();return this.divideScalar(length||1).multiplyScalar(Math. +max(min,Math.min(max2,length)))}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(v){return this.x*v.x+this.y*v.y+this.z*v. +z+this.w*v.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(length){ +return this.normalize().multiplyScalar(length)}lerp(v,alpha){return this.x+=(v.x- +this.x)*alpha,this.y+=(v.y-this.y)*alpha,this.z+=(v.z-this.z)*alpha,this.w+=(v.w- +this.w)*alpha,this}lerpVectors(v1,v2,alpha){return this.x=v1.x+(v2.x-v1.x)*alpha, +this.y=v1.y+(v2.y-v1.y)*alpha,this.z=v1.z+(v2.z-v1.z)*alpha,this.w=v1.w+(v2.w-v1. +w)*alpha,this}equals(v){return v.x===this.x&&v.y===this.y&&v.z===this.z&&v.w===this. +w}fromArray(array,offset=0){return this.x=array[offset],this.y=array[offset+1],this. +z=array[offset+2],this.w=array[offset+3],this}toArray(array=[],offset=0){return array[offset]= +this.x,array[offset+1]=this.y,array[offset+2]=this.z,array[offset+3]=this.w,array}fromBufferAttribute(attribute2,index){ +return this.x=attribute2.getX(index),this.y=attribute2.getY(index),this.z=attribute2. +getZ(index),this.w=attribute2.getW(index),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}};function WebGLAnimation2(){let context=null,isAnimating=!1,animationLoop=null,requestId=null; +function onAnimationFrame(time,frame){animationLoop(time,frame),requestId=context. +requestAnimationFrame(onAnimationFrame)}return __name(onAnimationFrame,"onAnimat\ +ionFrame"),{start:function(){isAnimating!==!0&&animationLoop!==null&&(requestId= +context.requestAnimationFrame(onAnimationFrame),isAnimating=!0)},stop:function(){ +context.cancelAnimationFrame(requestId),isAnimating=!1},setAnimationLoop:function(callback){ +animationLoop=callback},setContext:function(value){context=value}}}__name(WebGLAnimation2, +"WebGLAnimation");function WebGLAttributes2(gl,capabilities){let isWebGL2=capabilities.isWebGL2,buffers=new WeakMap; +function createBuffer(attribute2,bufferType){let array=attribute2.array,usage=attribute2. +usage,size3=array.byteLength,buffer=gl.createBuffer();gl.bindBuffer(bufferType,buffer), +gl.bufferData(bufferType,array,usage),attribute2.onUploadCallback();let type;if(array instanceof +Float32Array)type=gl.FLOAT;else if(array instanceof Uint16Array)if(attribute2.isFloat16BufferAttribute) +if(isWebGL2)type=gl.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usag\ +e of Float16BufferAttribute requires WebGL2.");else type=gl.UNSIGNED_SHORT;else if(array instanceof +Int16Array)type=gl.SHORT;else if(array instanceof Uint32Array)type=gl.UNSIGNED_INT;else if(array instanceof +Int32Array)type=gl.INT;else if(array instanceof Int8Array)type=gl.BYTE;else if(array instanceof +Uint8Array)type=gl.UNSIGNED_BYTE;else if(array instanceof Uint8ClampedArray)type= +gl.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer\ + data format: "+array);return{buffer,type,bytesPerElement:array.BYTES_PER_ELEMENT, +version:attribute2.version,size:size3}}__name(createBuffer,"createBuffer");function updateBuffer(buffer,attribute2,bufferType){ +let array=attribute2.array,updateRange=attribute2._updateRange,updateRanges=attribute2. +updateRanges;if(gl.bindBuffer(bufferType,buffer),updateRange.count===-1&&updateRanges. +length===0&&gl.bufferSubData(bufferType,0,array),updateRanges.length!==0){for(let i2=0, +l=updateRanges.length;i2 outsideIOR when thinFilmThickness -> 0.0 + float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmT\ +hickness ) ); + // Evaluate the cosTheta on the base layer (Snell law) + float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosThe\ +ta1 ) ); + + // Handle TIR: + float cosTheta2Sq = 1.0 - sinTheta2Sq; + if ( cosTheta2Sq < 0.0 ) { + + return vec3( 1.0 ); + + } + + float cosTheta2 = sqrt( cosTheta2Sq ); + + // First interface + float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); + float R12 = F_Schlick( R0, 1.0, cosTheta1 ); + float T121 = 1.0 - R12; + float phi12 = 0.0; + if ( iridescenceIOR < outsideIOR ) phi12 = PI; + float phi21 = PI - phi12; + + // Second interface + vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against\ + 1.0 + vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); + vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); + vec3 phi23 = vec3( 0.0 ); + if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; + if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; + if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; + + // Phase shift + float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; + vec3 phi = vec3( phi21 ) + phi23; + + // Compound terms + vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); + vec3 r123 = sqrt( R123 ); + vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); + + // Reflectance term for m = 0 (DC term amplitude) + vec3 C0 = R12 + Rs; + I = C0; + + // Reflectance term for m > 0 (pairs of diracs) + vec3 Cm = Rs - T121; + for ( int m = 1; m <= 2; ++ m ) { + + Cm *= r123; + vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); + I += Cm * Sm; + + } + + // Since out of gamut colors might be produced, negative color values are clam\ +ped to 0. + return max( I, vec3( 0.0 ) ); + + } + +#endif + +`;var bumpmap_pars_fragment_glsl_default=` +#ifdef USE_BUMPMAP + + uniform sampler2D bumpMap; + uniform float bumpScale; + + // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen + // https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf + + // Evaluate the derivative of the height w.r.t. screen-space using forward diff\ +erencing (listing 2) + + vec2 dHdxy_fwd() { + + vec2 dSTdx = dFdx( vBumpMapUv ); + vec2 dSTdy = dFdy( vBumpMapUv ); + + float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; + float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; + float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; + + return vec2( dBx, dBy ); + + } + + vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDir\ +ection ) { + + // normalize is done to ensure that the bump map looks the same regardless of \ +the texture's scale + vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); + vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); + vec3 vN = surf_norm; // normalized + + vec3 R1 = cross( vSigmaY, vN ); + vec3 R2 = cross( vN, vSigmaX ); + + float fDet = dot( vSigmaX, R1 ) * faceDirection; + + vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); + return normalize( abs( fDet ) * surf_norm - vGrad ); + + } + +#endif +`;var clipping_planes_fragment_glsl_default=` +#if NUM_CLIPPING_PLANES > 0 + + vec4 plane; + + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + + } + #pragma unroll_loop_end + + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + + bool clipped = true; + + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + + } + #pragma unroll_loop_end + + if ( clipped ) discard; + + #endif + +#endif +`;var clipping_planes_pars_fragment_glsl_default=` +#if NUM_CLIPPING_PLANES > 0 + + varying vec3 vClipPosition; + + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; + +#endif +`;var clipping_planes_pars_vertex_glsl_default=` +#if NUM_CLIPPING_PLANES > 0 + + varying vec3 vClipPosition; + +#endif +`;var clipping_planes_vertex_glsl_default=` +#if NUM_CLIPPING_PLANES > 0 + + vClipPosition = - mvPosition.xyz; + +#endif +`;var color_fragment_glsl_default=` +#if defined( USE_COLOR_ALPHA ) + + diffuseColor *= vColor; + +#elif defined( USE_COLOR ) + + diffuseColor.rgb *= vColor; + +#endif +`;var color_pars_fragment_glsl_default=` +#if defined( USE_COLOR_ALPHA ) + + varying vec4 vColor; + +#elif defined( USE_COLOR ) + + varying vec3 vColor; + +#endif +`;var color_pars_vertex_glsl_default=` +#if defined( USE_COLOR_ALPHA ) + + varying vec4 vColor; + +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + + varying vec3 vColor; + +#endif +`;var color_vertex_glsl_default=` +#if defined( USE_COLOR_ALPHA ) + + vColor = vec4( 1.0 ); + +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + + vColor = vec3( 1.0 ); + +#endif + +#ifdef USE_COLOR + + vColor *= color; + +#endif + +#ifdef USE_INSTANCING_COLOR + + vColor.xyz *= instanceColor.xyz; + +#endif +`;var common_glsl_default=` +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 + +#ifndef saturate +// may have defined saturate() already +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) + +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } + +// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range\ +. +// do not collapse into a single function per: http://byteblacksmith.com/improve\ +ments-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ +highp float rand( const in vec2 uv ) { + + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + + return fract( sin( sn ) * c ); + +} + +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif + +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; + +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; + +#ifdef USE_ALPHAHASH + + varying vec3 vPosition; + +#endif + +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + +} + +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + + // dir can be either a direction vector or a normal vector + // upper-left 3x3 of matrix is assumed to be orthogonal + + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); + +} + +mat3 transposeMat3( const in mat3 m ) { + + mat3 tmp; + + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + + return tmp; + +} + +float luminance( const in vec3 rgb ) { + + // assumes rgb is in linear color space with sRGB primaries and D65 white point\ + + + const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); + + return dot( weights, rgb ); + +} + +bool isPerspectiveMatrix( mat4 m ) { + + return m[ 2 ][ 3 ] == - 1.0; + +} + +vec2 equirectUv( in vec3 dir ) { + + // dir is assumed to be unit length + + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + + return vec2( u, v ); + +} + +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + + return RECIPROCAL_PI * diffuseColor; + +} // validated + +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + + // Original approximation by Christophe Schlick '94 + // float fresnel = pow( 1.0 - dotVH, 5.0 ); + + // Optimized variant (presented by Epic at SIGGRAPH '13) + // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes\ +-26915738.pdf + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); + +} // validated + +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\ + + + // Original approximation by Christophe Schlick '94 + // float fresnel = pow( 1.0 - dotVH, 5.0 ); + + // Optimized variant (presented by Epic at SIGGRAPH '13) + // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes\ +-26915738.pdf + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); + +} // validated +`;var cube_uv_reflection_fragment_glsl_default=` +#ifdef ENVMAP_TYPE_CUBE_UV + + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + + // These shader functions convert between the UV coordinates of a single face o\ +f + // a cubemap, the 0-5 integer index of a cube face, and the direction vector fo\ +r + // sampling a textureCube (not generally normalized ). + + float getFace( vec3 direction ) { + + vec3 absDirection = abs( direction ); + + float face = - 1.0; + + if ( absDirection.x > absDirection.z ) { + + if ( absDirection.x > absDirection.y ) + + face = direction.x > 0.0 ? 0.0 : 3.0; + + else + + face = direction.y > 0.0 ? 1.0 : 4.0; + + } else { + + if ( absDirection.z > absDirection.y ) + + face = direction.z > 0.0 ? 2.0 : 5.0; + + else + + face = direction.y > 0.0 ? 1.0 : 4.0; + + } + + return face; + + } + + // RH coordinate system; PMREM face-indexing convention + vec2 getUV( vec3 direction, float face ) { + + vec2 uv; + + if ( face == 0.0 ) { + + uv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x + + } else if ( face == 1.0 ) { + + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y + + } else if ( face == 2.0 ) { + + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z + + } else if ( face == 3.0 ) { + + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x + + } else if ( face == 4.0 ) { + + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y + + } else { + + uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z + + } + + return 0.5 * ( uv + 1.0 ); + + } + + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + + float face = getFace( direction ); + + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + + mipInt = max( mipInt, cubeUV_minMipLevel ); + + float faceSize = exp2( mipInt ); + + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; // #25071\ + + + if ( face > 2.0 ) { + + uv.y += faceSize; + + face -= 3.0; + + } + + uv.x += face * faceSize; + + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + + #ifdef texture2DGradEXT + + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; // disab\ +le anisotropic filtering + + #else + + return texture2D( envMap, uv ).rgb; + + #endif + + } + + // These defines must match with PMREMGenerator + + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + + float roughnessToMip( float roughness ) { + + float mip = 0.0; + + if ( roughness >= cubeUV_r1 ) { + + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - c\ +ubeUV_r1 ) + cubeUV_m0; + + } else if ( roughness >= cubeUV_r4 ) { + + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - c\ +ubeUV_r4 ) + cubeUV_m1; + + } else if ( roughness >= cubeUV_r5 ) { + + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - c\ +ubeUV_r5 ) + cubeUV_m4; + + } else if ( roughness >= cubeUV_r6 ) { + + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - c\ +ubeUV_r6 ) + cubeUV_m5; + + } else { + + mip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25 + } + + return mip; + + } + + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + + float mipF = fract( mip ); + + float mipInt = floor( mip ); + + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + + if ( mipF == 0.0 ) { + + return vec4( color0, 1.0 ); + + } else { + + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + + return vec4( mix( color0, color1, mipF ), 1.0 ); + + } + + } + +#endif +`;var defaultnormal_vertex_glsl_default=` + +vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + + vec3 transformedTangent = objectTangent; + +#endif + +#ifdef USE_BATCHING + + // this is in lieu of a per-instance normal-matrix + // shear transforms in the instance matrix are not supported + + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), do\ +t( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + + #ifdef USE_TANGENT + + transformedTangent = bm * transformedTangent; + + #endif + +#endif + +#ifdef USE_INSTANCING + + // this is in lieu of a per-instance normal-matrix + // shear transforms in the instance matrix are not supported + + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), do\ +t( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + + #ifdef USE_TANGENT + + transformedTangent = im * transformedTangent; + + #endif + +#endif + +transformedNormal = normalMatrix * transformedNormal; + +#ifdef FLIP_SIDED + + transformedNormal = - transformedNormal; + +#endif + +#ifdef USE_TANGENT + + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\ + + + #ifdef FLIP_SIDED + + transformedTangent = - transformedTangent; + + #endif + +#endif +`;var displacementmap_pars_vertex_glsl_default=` +#ifdef USE_DISPLACEMENTMAP + + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; + +#endif +`;var displacementmap_vertex_glsl_default=` +#ifdef USE_DISPLACEMENTMAP + + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDispl\ +acementMapUv ).x * displacementScale + displacementBias ); + +#endif +`;var emissivemap_fragment_glsl_default=` +#ifdef USE_EMISSIVEMAP + + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + + totalEmissiveRadiance *= emissiveColor.rgb; + +#endif +`;var emissivemap_pars_fragment_glsl_default=` +#ifdef USE_EMISSIVEMAP + + uniform sampler2D emissiveMap; + +#endif +`;var colorspace_fragment_glsl_default=` +gl_FragColor = linearToOutputTexel( gl_FragColor ); +`;var colorspace_pars_fragment_glsl_default=` + +// http://www.russellcottrell.com/photo/matrixCalculator.htm + +// Linear sRGB => XYZ => Linear Display P3 +const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( + vec3( 0.8224621, 0.177538, 0.0 ), + vec3( 0.0331941, 0.9668058, 0.0 ), + vec3( 0.0170827, 0.0723974, 0.9105199 ) +); + +// Linear Display P3 => XYZ => Linear sRGB +const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( + vec3( 1.2249401, - 0.2249404, 0.0 ), + vec3( - 0.0420569, 1.0420571, 0.0 ), + vec3( - 0.0196376, - 0.0786361, 1.0982735 ) +); + +vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { + return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); +} + +vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { + return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); +} + +vec4 LinearTransferOETF( in vec4 value ) { + return value; +} + +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), va\ +lue.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.\ +a ); +} + +// @deprecated, r156 +vec4 LinearToLinear( in vec4 value ) { + return value; +} + +// @deprecated, r156 +vec4 LinearTosRGB( in vec4 value ) { + return sRGBTransferOETF( value ); +} +`;var envmap_fragment_glsl_default=` +#ifdef USE_ENVMAP + + #ifdef ENV_WORLDPOS + + vec3 cameraToFrag; + + if ( isOrthographic ) { + + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 \ +], - viewMatrix[ 2 ][ 2 ] ) ); + + } else { + + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + + } + + // Transforming Normal Vectors with the Inverse Transformation + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + + #ifdef ENVMAP_MODE_REFLECTION + + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + + #else + + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + + #endif + + #else + + vec3 reflectVec = vReflect; + + #endif + + #ifdef ENVMAP_TYPE_CUBE + + vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectV\ +ec.yz ) ); + + #else + + vec4 envColor = vec4( 0.0 ); + + #endif + + #ifdef ENVMAP_BLENDING_MULTIPLY + + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStre\ +ngth * reflectivity ); + + #elif defined( ENVMAP_BLENDING_MIX ) + + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectiv\ +ity ); + + #elif defined( ENVMAP_BLENDING_ADD ) + + outgoingLight += envColor.xyz * specularStrength * reflectivity; + + #endif + +#endif +`;var envmap_common_pars_fragment_glsl_default=` +#ifdef USE_ENVMAP + + uniform float envMapIntensity; + uniform float flipEnvMap; + + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif +`;var envmap_pars_fragment_glsl_default=` +#ifdef USE_ENVMAP + + uniform float reflectivity; + + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || d\ +efined( LAMBERT ) + + #define ENV_WORLDPOS + + #endif + + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif + +#endif +`;var envmap_pars_vertex_glsl_default=` +#ifdef USE_ENVMAP + + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || d\ +efined( LAMBERT ) + + #define ENV_WORLDPOS + + #endif + + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + + #else + + varying vec3 vReflect; + uniform float refractionRatio; + + #endif + +#endif +`;var envmap_vertex_glsl_default=` +#ifdef USE_ENVMAP + + #ifdef ENV_WORLDPOS + + vWorldPosition = worldPosition.xyz; + + #else + + vec3 cameraToVertex; + + if ( isOrthographic ) { + + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ \ +2 ], - viewMatrix[ 2 ][ 2 ] ) ); + + } else { + + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + + } + + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\ + + + #ifdef ENVMAP_MODE_REFLECTION + + vReflect = reflect( cameraToVertex, worldNormal ); + + #else + + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + + #endif + + #endif + +#endif +`;var fog_vertex_glsl_default=` +#ifdef USE_FOG + + vFogDepth = - mvPosition.z; + +#endif +`;var fog_pars_vertex_glsl_default=` +#ifdef USE_FOG + + varying float vFogDepth; + +#endif +`;var fog_fragment_glsl_default=` +#ifdef USE_FOG + + #ifdef FOG_EXP2 + + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth\ + ); + + #else + + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + + #endif + + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); + +#endif +`;var fog_pars_fragment_glsl_default=` +#ifdef USE_FOG + + uniform vec3 fogColor; + varying float vFogDepth; + + #ifdef FOG_EXP2 + + uniform float fogDensity; + + #else + + uniform float fogNear; + uniform float fogFar; + + #endif + +#endif +`;var gradientmap_pars_fragment_glsl_default=` + +#ifdef USE_GRADIENTMAP + + uniform sampler2D gradientMap; + +#endif + +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + + // dotNL will be from -1.0 to 1.0 + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + + #ifdef USE_GRADIENTMAP + + return vec3( texture2D( gradientMap, coord ).r ); + + #else + + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coor\ +d.x ) ); + + #endif + +} +`;var lightmap_fragment_glsl_default=` +#ifdef USE_LIGHTMAP + + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + + reflectedLight.indirectDiffuse += lightMapIrradiance; + +#endif +`;var lightmap_pars_fragment_glsl_default=` +#ifdef USE_LIGHTMAP + + uniform sampler2D lightMap; + uniform float lightMapIntensity; + +#endif +`;var lights_lambert_fragment_glsl_default=` +LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength; +`;var lights_lambert_pars_fragment_glsl_default=` +varying vec3 vViewPosition; + +struct LambertMaterial { + + vec3 diffuseColor; + float specularStrength; + +}; + +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geomet\ +ryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const i\ +n vec3 geometryClearcoatNormal, const in LambertMaterial material, inout Reflect\ +edLight reflectedLight ) { + + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColo\ +r ); + +} + +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr\ +yPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in\ + vec3 geometryClearcoatNormal, const in LambertMaterial material, inout Reflecte\ +dLight reflectedLight ) { + + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseCo\ +lor ); + +} + +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert +`;var lights_pars_begin_glsl_default=` +uniform bool receiveShadow; +uniform vec3 ambientLightColor; + +#if defined( USE_LIGHT_PROBES ) + + uniform vec3 lightProbe[ 9 ]; + +#endif + +// get the irradiance (radiance convolved with cosine lobe) at the point 'normal\ +' on the unit sphere +// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + + // normal is assumed to have unit length + + float x = normal.x, y = normal.y, z = normal.z; + + // band 0 + vec3 result = shCoefficients[ 0 ] * 0.886227; + + // band 1 + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + + // band 2 + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + + return result; + +} + +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 norma\ +l ) { + + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + + return irradiance; + +} + +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + + vec3 irradiance = ambientLightColor; + + return irradiance; + +} + +float getDistanceAttenuation( const in float lightDistance, const in float cutof\ +fDistance, const in float decayExponent ) { + + #if defined ( LEGACY_LIGHTS ) + + if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { + + return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent\ + ); + + } + + return 1.0; + + #else + + // based upon Frostbite 3 Moving to Physically-based Rendering + // page 32, equation 26: E[window1] + // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbit\ +e_to_pbr_v32.pdf + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 )\ +; + + if ( cutoffDistance > 0.0 ) { + + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance\ + ) ) ); + + } + + return distanceFalloff; + + #endif + +} + +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi\ +ne, const in float angleCosine ) { + + return smoothstep( coneCosine, penumbraCosine, angleCosine ); + +} + +#if NUM_DIR_LIGHTS > 0 + + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out I\ +ncidentLight light ) { + + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + + } + +#endif + + +#if NUM_POINT_LIGHTS > 0 + + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + + // light is an out parameter as having it as a return value caused compiler err\ +ors on some devices + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryP\ +osition, out IncidentLight light ) { + + vec3 lVector = pointLight.position - geometryPosition; + + light.direction = normalize( lVector ); + + float lightDistance = length( lVector ); + + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, poi\ +ntLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + + } + +#endif + + +#if NUM_SPOT_LIGHTS > 0 + + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + + // light is an out parameter as having it as a return value caused compiler err\ +ors on some devices + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosi\ +tion, out IncidentLight light ) { + + vec3 lVector = spotLight.position - geometryPosition; + + light.direction = normalize( lVector ); + + float angleCos = dot( light.direction, spotLight.direction ); + + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penum\ +braCos, angleCos ); + + if ( spotAttenuation > 0.0 ) { + + float lightDistance = length( lVector ); + + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spo\ +tLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + + } else { + + light.color = vec3( 0.0 ); + light.visible = false; + + } + + } + +#endif + + +#if NUM_RECT_AREA_LIGHTS > 0 + + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + + // Pre-computed values of LinearTransformedCosine approximation of BRDF + // BRDF approximation Texture is 64x64 + uniform sampler2D ltc_1; // RGBA Float + uniform sampler2D ltc_2; // RGBA Float + + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; + +#endif + + +#if NUM_HEMI_LIGHTS > 0 + + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in\ + vec3 normal ) { + + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseW\ +eight ); + + return irradiance; + + } + +#endif +`;var envmap_physical_pars_fragment_glsl_default=` +#ifdef USE_ENVMAP + + vec3 getIBLIrradiance( const in vec3 normal ) { + + #ifdef ENVMAP_TYPE_CUBE_UV + + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + + vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); + + return PI * envMapColor.rgb * envMapIntensity; + + #else + + return vec3( 0.0 ); + + #endif + + } + + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in floa\ +t roughness ) { + + #ifdef ENVMAP_TYPE_CUBE_UV + + vec3 reflectVec = reflect( - viewDir, normal ); + + // Mixing the reflection with the normal is more accurate and keeps rough obj\ +ects from gathering light from behind their tangent plane. + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + + vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); + + return envMapColor.rgb * envMapIntensity; + + #else + + return vec3( 0.0 ); + + #endif + + } + + #ifdef USE_ANISOTROPY + + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, co\ +nst in float roughness, const in vec3 bitangent, const in float anisotropy ) { + + #ifdef ENVMAP_TYPE_CUBE_UV + + // https://google.github.io/filament/Filament.md.html#lighting/imagebasedli\ +ghts/anisotropy + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotrop\ +y * ( 1.0 - roughness ) ) ) ) ); + + return getIBLRadiance( viewDir, bentNormal, roughness ); + + #else + + return vec3( 0.0 ); + + #endif + + } + + #endif + +#endif +`;var lights_toon_fragment_glsl_default=` +ToonMaterial material; +material.diffuseColor = diffuseColor.rgb; +`;var lights_toon_pars_fragment_glsl_default=` +varying vec3 vViewPosition; + +struct ToonMaterial { + + vec3 diffuseColor; + +}; + +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryP\ +osition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in v\ +ec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLigh\ +t reflectedLight ) { + + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction \ +) * directLight.color; + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColo\ +r ); + +} + +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo\ +sition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in ve\ +c3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight\ + reflectedLight ) { + + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseCo\ +lor ); + +} + +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon +`;var lights_phong_fragment_glsl_default=` +BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength; +`;var lights_phong_pars_fragment_glsl_default=` +varying vec3 vViewPosition; + +struct BlinnPhongMaterial { + + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; + +}; + +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geo\ +metryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, cons\ +t in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout R\ +eflectedLight reflectedLight ) { + + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColo\ +r ); + + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.dire\ +ction, geometryViewDir, geometryNormal, material.specularColor, material.specula\ +rShininess ) * material.specularStrength; + +} + +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom\ +etryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const\ + in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout Re\ +flectedLight reflectedLight ) { + + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseCo\ +lor ); + +} + +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong +`;var lights_physical_fragment_glsl_default=` +PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); + +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal\ + ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); + +material.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the\ + base mip of a 256 cubemap. +material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); + +#ifdef IOR + + material.ior = ior; + + #ifdef USE_SPECULAR + + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + + #ifdef USE_SPECULAR_COLORMAP + + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb\ +; + + #endif + + #ifdef USE_SPECULAR_INTENSITYMAP + + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensit\ +yMapUv ).a; + + #endif + + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + + #else + + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + + #endif + + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.io\ +r + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diff\ +useColor.rgb, metalnessFactor ); + +#else + + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor )\ +; + material.specularF90 = 1.0; + +#endif + +#ifdef USE_CLEARCOAT + + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + + #ifdef USE_CLEARCOATMAP + + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + + #endif + + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRou\ +ghnessMapUv ).y; + + #endif + + material.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model + material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); + +#endif + +#ifdef USE_IRIDESCENCE + + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + + #ifdef USE_IRIDESCENCEMAP + + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + + #endif + + #ifdef USE_IRIDESCENCE_THICKNESSMAP + + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThic\ +knessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv )\ +.g + iridescenceThicknessMinimum; + + #else + + material.iridescenceThickness = iridescenceThicknessMaximum; + + #endif + +#endif + +#ifdef USE_SHEEN + + material.sheenColor = sheenColor; + + #ifdef USE_SHEEN_COLORMAP + + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + + #endif + + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + + #ifdef USE_SHEEN_ROUGHNESSMAP + + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv \ +).a; + + #endif + +#endif + +#ifdef USE_ANISOTROPY + + #ifdef USE_ANISOTROPYMAP + + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotrop\ +yVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2(\ + 1.0 ) ) * anisotropyPolar.b; + + #else + + vec2 anisotropyV = anisotropyVector; + + #endif + + material.anisotropy = length( anisotropyV ); + + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + + // Roughness along the anisotropy bitangent is the material roughness, while th\ +e tangent roughness increases with anisotropy. + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotro\ +py ) ); + + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; + +#endif +`;var lights_physical_pars_fragment_glsl_default=` + +struct PhysicalMaterial { + + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + + #ifdef IOR + float ior; + #endif + + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif + +}; + +// temporary +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); + +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) \ +{ + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} + +// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2 +// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_\ +to_pbr_v32.pdf +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const i\ +n float dotNV ) { + + float a2 = pow2( alpha ); + + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + + return 0.5 / max( gv + gl, EPSILON ); + +} + +// Microfacet Models for Refraction through Rough Surfaces - equation (33) +// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html +// alpha is "roughness squared" in Disney\u2019s reparameterization +float D_GGX( const in float alpha, const in float dotNH ) { + + float a2 = pow2( alpha ); + + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH\ + = 1 + + return RECIPROCAL_PI * a2 / pow2( denom ); + +} + +// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropic\ +model/anisotropicspecularbrdf +#ifdef USE_ANISOTROPY + + float 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 ) { + + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + + return saturate(v); + + } + + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in\ + float dotNH, const in float dotTH, const in float dotBH ) { + + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + + } + +#endif + +#ifdef USE_CLEARCOAT + + // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const i\ +n vec3 normal, const in PhysicalMaterial material) { + + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + + float alpha = pow2( roughness ); // UE4's roughness + + vec3 halfDir = normalize( lightDir + viewDir ); + + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + + vec3 F = F_Schlick( f0, f90, dotVH ); + + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + + float D = D_GGX( alpha, dotNH ); + + return F * ( V * D ); + + } + +#endif + +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 norm\ +al, const in PhysicalMaterial material ) { + + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + + float alpha = pow2( roughness ); // UE4's roughness + + vec3 halfDir = normalize( lightDir + viewDir ); + + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + + vec3 F = F_Schlick( f0, f90, dotVH ); + + #ifdef USE_IRIDESCENCE + + F = mix( F, material.iridescenceFresnel, material.iridescence ); + + #endif + + #ifdef USE_ANISOTROPY + + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, do\ +tBV, dotTL, dotBL, dotNV, dotNL ); + + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + + #else + + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + + float D = D_GGX( alpha, dotNH ); + + #endif + + return F * ( V * D ); + +} + +// Rect Area Light + +// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines +// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt +// code: https://github.com/selfshadow/ltc_code/ + +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + + float dotNV = saturate( dot( N, V ) ); + + // texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) ) + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + + uv = uv * LUT_SCALE + LUT_BIAS; + + return uv; + +} + +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + + // Real-Time Area Lighting: a Journey from Research to Production (p.102) + // An approximation of the form factor of a horizon-clipped rectangle. + + float l = length( f ); + + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); + +} + +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + + float x = dot( v1, v2 ); + + float y = abs( x ); + + // rational polynomial approximation to theta / sin( theta ) / 2PI + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1\ +e-7 ) ) - v; + + return cross( v1, v2 ) * theta_sintheta; + +} + +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in m\ +at3 mInv, const in vec3 rectCoords[ 4 ] ) { + + // bail if point is on back side of plane of light + // assumes ccw winding order of light vertices + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + + // construct orthonormal basis around N + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); // negated from paper; possibly due to a different hande\ +dness of world coordinate system + + // compute transform + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + + // transform rect + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + + // project rect onto sphere + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + + // calculate vector form factor + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + + // adjust for horizon clipping + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + +/* + // alternate method of adjusting for horizon clipping (see referece) + // refactoring required + float len = length( vectorFormFactor ); + float z = vectorFormFactor.z / len; + + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + + // tabulated horizon-clipped sphere, apparently... + vec2 uv = vec2( z * 0.5 + 0.5, len ); + uv = uv * LUT_SCALE + LUT_BIAS; + + float scale = texture2D( ltc_2, uv ).w; + + float result = len * scale; +*/ + + return vec3( result ); + +} + +// End Rect Area Light + +#if defined( USE_SHEEN ) + +// https://github.com/google/filament/blob/master/shaders/src/brdf.fs +float D_Charlie( float roughness, float dotNH ) { + + float alpha = pow2( roughness ); + + // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF" + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp\ +16 + + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); + +} + +// https://github.com/google/filament/blob/master/shaders/src/brdf.fs +float V_Neubelt( float dotNV, float dotNL ) { + + // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Or\ +der: 1886" + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); + +} + +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 no\ +rmal, vec3 sheenColor, const in float sheenRoughness ) { + + vec3 halfDir = normalize( lightDir + viewDir ); + + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + + return sheenColor * ( D * V ); + +} + +#endif + +// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over \ +the hemisphere from +// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The anal\ +ysis can be found +// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAra\ +EIzjlb5h4FKH/view?usp=sharing +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float \ +roughness ) { + + float dotNV = saturate( dot( normal, viewDir ) ); + + float r2 = roughness * roughness; + + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r\ +2 + 14.3 * roughness - 9.95; + + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - \ +3.27 * roughness + 0.72; + + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness \ +- 0.25 ) ); + + return saturate( DG * RECIPROCAL_PI ); + +} + +// Analytical approximation of the DFG LUT, one half of the +// split-sum approximation used in indirect specular lighting. +// via 'environmentBRDF' from "Physically Based Shading on Mobile" +// https://www.unrealengine.com/blog/physically-based-shading-on-mobile +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roug\ +hness ) { + + float dotNV = saturate( dot( normal, viewDir ) ); + + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + + vec4 r = roughness * c0 + c1; + + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + + return fab; + +} + +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3\ + specularColor, const in float specularF90, const in float roughness ) { + + vec2 fab = DFGApprox( normal, viewDir, roughness ); + + return specularColor * fab.x + specularF90 * fab.y; + +} + +// Fdez-Ag\xFCera's "Multiple-Scattering Microfacet Model for Real-Time Image Based\ + Lighting" +// Approximates multiscattering in order to preserve energy. +// http://www.jcgt.org/published/0008/01/03/ +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 view\ +Dir, const in vec3 specularColor, const in float specularF90, const in float iri\ +descence, const in vec3 iridescenceF0, const in float roughness, inout vec3 sing\ +leScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const \ +in vec3 specularColor, const in float specularF90, const in float roughness, ino\ +ut vec3 singleScatter, inout vec3 multiScatter ) { +#endif + + vec2 fab = DFGApprox( normal, viewDir, roughness ); + + #ifdef USE_IRIDESCENCE + + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + + #else + + vec3 Fr = specularColor; + + #endif + + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21 + vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + + singleScatter += FssEss; + multiScatter += Fms * Ems; + +} + +#if NUM_RECT_AREA_LIGHTS > 0 + + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const i\ +n vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryVie\ +wDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material,\ + inout ReflectedLight reflectedLight ) { + + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; ligh\ +t shines in local neg z direction + rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + + // LTC Fresnel Approximation by Stephen Hill + // http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pd\ +f + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.spec\ +ularColor ) * t2.y ); + + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, \ +viewDir, position, mInv, rectCoords ); + + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evalu\ +ate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + + } + +#endif + +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geome\ +tryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const \ +in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout Refle\ +ctedLight reflectedLight ) { + + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + + vec3 irradiance = dotNL * directLight.color; + + #ifdef USE_CLEARCOAT + + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction \ +) ); + + vec3 ccIrradiance = dotNLcc * directLight.color; + + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.dire\ +ction, geometryViewDir, geometryClearcoatNormal, material ); + + #endif + + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometr\ +yViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + #endif + + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, \ +geometryViewDir, geometryNormal, material ); + + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColo\ +r ); +} + +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geomet\ +ryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const i\ +n vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout Reflec\ +tedLight reflectedLight ) { + + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseCo\ +lor ); + +} + +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia\ +nce, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in v\ +ec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearco\ +atNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLigh\ +t) { + + #ifdef USE_CLEARCOAT + + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClea\ +rcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, mater\ +ial.clearcoatRoughness ); + + #endif + + #ifdef USE_SHEEN + + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geom\ +etryNormal, geometryViewDir, material.sheenRoughness ); + + #endif + + // Both indirect specular and indirect diffuse light accumulate here + + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + + #ifdef USE_IRIDESCENCE + + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.s\ +pecularColor, material.specularF90, material.iridescence, material.iridescenceFr\ +esnel, material.roughness, singleScattering, multiScattering ); + + #else + + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColo\ +r, material.specularF90, material.roughness, singleScattering, multiScattering )\ +; + + #endif + + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, tot\ +alScattering.g ), totalScattering.b ) ); + + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; + +} + +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical + +// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frost\ +bite_to_pbr_v32.pdf +float computeSpecularOcclusion( const in float dotNV, const in float ambientOccl\ +usion, const in float roughness ) { + + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 \ +) ) - 1.0 + ambientOcclusion ); + +} +`;var lights_fragment_begin_glsl_default=` +/** + * This is a template that can be used to light a material, it uses pluggable + * RenderEquations (RE)for specific lighting scenarios. + * + * Instructions for use: + * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are \ +defined + * - Create a material parameter that is to be passed as the third parameter to \ +your lighting functions. + * + * TODO: + * - Add area light support. + * - Add sphere light support. + * - Add diffuse light probe (irradiance cubemap) support. + */ + +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPo\ +sition ); + +vec3 geometryClearcoatNormal = vec3( 0.0 ); + +#ifdef USE_CLEARCOAT + + geometryClearcoatNormal = clearcoatNormal; + +#endif + +#ifdef USE_IRIDESCENCE + + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + + if ( material.iridescenceThickness == 0.0 ) { + + material.iridescence = 0.0; + + } else { + + material.iridescence = saturate( material.iridescence ); + + } + + if ( material.iridescence > 0.0 ) { + + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, d\ +otNVi, material.iridescenceThickness, material.specularColor ); + + // Iridescence F0 approximation + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotN\ +Vi ); + + } + +#endif + +IncidentLight directLight; + +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + + pointLight = pointLights[ i ]; + + getPointLightInfo( pointLight, geometryPosition, directLight ); + + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOW\ +S ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow\ +( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBi\ +as, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shad\ +owCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geo\ +metryClearcoatNormal, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + + spotLight = spotLights[ i ]; + + getSpotLightInfo( spotLight, geometryPosition, directLight ); + + // spot lights are ordered [shadows with maps, shadows without maps, maps with\ +out shadows, none] + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + \ +NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) \ +) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.x\ +y ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : dire\ +ctLight.color; + #endif + + #undef SPOT_LIGHT_MAP_INDEX + + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS\ + ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spo\ +tShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spot\ +LightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geo\ +metryClearcoatNormal, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + + directionalLight = directionalLights[ i ]; + + getDirectionalLightInfo( directionalLight, directLight ); + + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS \ +) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( dir\ +ectionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightSh\ +adow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i\ + ] ) : 1.0; + #endif + + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geo\ +metryClearcoatNormal, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + + RectAreaLight rectAreaLight; + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryV\ +iewDir, geometryClearcoatNormal, material, reflectedLight ); + + } + #pragma unroll_loop_end + +#endif + +#if defined( RE_IndirectDiffuse ) + + vec3 iblIrradiance = vec3( 0.0 ); + + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + + #if defined( USE_LIGHT_PROBES ) + + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + + #endif + + #if ( NUM_HEMI_LIGHTS > 0 ) + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNo\ +rmal ); + + } + #pragma unroll_loop_end + + #endif + +#endif + +#if defined( RE_IndirectSpecular ) + + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); + +#endif +`;var lights_fragment_maps_glsl_default=` +#if defined( RE_IndirectDiffuse ) + + #ifdef USE_LIGHTMAP + + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + + irradiance += lightMapIrradiance; + + #endif + + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_U\ +V ) + + iblIrradiance += getIBLIrradiance( geometryNormal ); + + #endif + +#endif + +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + + #ifdef USE_ANISOTROPY + + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, materia\ +l.roughness, material.anisotropyB, material.anisotropy ); + + #else + + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughnes\ +s ); + + #endif + + #ifdef USE_CLEARCOAT + + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal,\ + material.clearcoatRoughness ); + + #endif + +#endif +`;var lights_fragment_end_glsl_default=` +#if defined( RE_IndirectDiffuse ) + + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewD\ +ir, geometryClearcoatNormal, material, reflectedLight ); + +#endif + +#if defined( RE_IndirectSpecular ) + + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPositi\ +on, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflecte\ +dLight ); + +#endif +`;var logdepthbuf_fragment_glsl_default=` +#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + + // Doing a strict comparison with == 1.0 can cause noise artifacts + // on some platforms. See issue #17623. + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) *\ + logDepthBufFC * 0.5; + +#endif +`;var logdepthbuf_pars_fragment_glsl_default=` +#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; + +#endif +`;var logdepthbuf_pars_vertex_glsl_default=` +#ifdef USE_LOGDEPTHBUF + + #ifdef USE_LOGDEPTHBUF_EXT + + varying float vFragDepth; + varying float vIsPerspective; + + #else + + uniform float logDepthBufFC; + + #endif + +#endif +`;var logdepthbuf_vertex_glsl_default=` +#ifdef USE_LOGDEPTHBUF + + #ifdef USE_LOGDEPTHBUF_EXT + + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); + + #else + + if ( isPerspectiveMatrix( projectionMatrix ) ) { + + gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC -\ + 1.0; + + gl_Position.z *= gl_Position.w; + + } + + #endif + +#endif +`;var map_fragment_glsl_default=` +#ifdef USE_MAP + + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + + #ifdef DECODE_VIDEO_TEXTURE + + // use inline sRGB decode until browsers properly support SRGB8_APLHA8 with vi\ +deo textures + + sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 +\ + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, ve\ +c3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffus\ +eColor.w ); + + #endif + + diffuseColor *= sampledDiffuseColor; + +#endif +`;var map_pars_fragment_glsl_default=` +#ifdef USE_MAP + + uniform sampler2D map; + +#endif +`;var map_particle_fragment_glsl_default=` +#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + + #if defined( USE_POINTS_UV ) + + vec2 uv = vUv; + + #else + + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).\ +xy; + + #endif + +#endif + +#ifdef USE_MAP + + diffuseColor *= texture2D( map, uv ); + +#endif + +#ifdef USE_ALPHAMAP + + diffuseColor.a *= texture2D( alphaMap, uv ).g; + +#endif +`;var map_particle_pars_fragment_glsl_default=` +#if defined( USE_POINTS_UV ) + + varying vec2 vUv; + +#else + + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + + uniform mat3 uvTransform; + + #endif + +#endif + +#ifdef USE_MAP + + uniform sampler2D map; + +#endif + +#ifdef USE_ALPHAMAP + + uniform sampler2D alphaMap; + +#endif +`;var metalnessmap_fragment_glsl_default=` +float metalnessFactor = metalness; + +#ifdef USE_METALNESSMAP + + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + + // reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB)\ + texture + metalnessFactor *= texelMetalness.b; + +#endif +`;var metalnessmap_pars_fragment_glsl_default=` +#ifdef USE_METALNESSMAP + + uniform sampler2D metalnessMap; + +#endif +`;var morphcolor_vertex_glsl_default=` +#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) + + // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative\ + value: + // When morphTargetsRelative is false, this is set to 1 - sum(influences); this\ + results in normal = sum((target - base) * influence) + // When morphTargetsRelative is true, this is set to 1; as a result, all morph \ +targets are simply added to the base after weighting + vColor *= morphTargetBaseInfluence; + + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + + #if defined( USE_COLOR_ALPHA ) + + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, \ +2 ) * morphTargetInfluences[ i ]; + + #elif defined( USE_COLOR ) + + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, \ +2 ).rgb * morphTargetInfluences[ i ]; + + #endif + + } + +#endif +`;var morphnormal_vertex_glsl_default=` +#ifdef USE_MORPHNORMALS + + // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative\ + value: + // When morphTargetsRelative is false, this is set to 1 - sum(influences); this\ + results in normal = sum((target - base) * influence) + // When morphTargetsRelative is true, this is set to 1; as a result, all morph \ +targets are simply added to the base after weighting + objectNormal *= morphTargetBaseInfluence; + + #ifdef MORPHTARGETS_TEXTURE + + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexI\ +D, i, 1 ).xyz * morphTargetInfluences[ i ]; + + } + + #else + + objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; + objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; + objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; + objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; + + #endif + +#endif +`;var morphtarget_pars_vertex_glsl_default=` +#ifdef USE_MORPHTARGETS + + uniform float morphTargetBaseInfluence; + + #ifdef MORPHTARGETS_TEXTURE + + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const \ +in int offset ) { + + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + + } + + #else + + #ifndef USE_MORPHNORMALS + + uniform float morphTargetInfluences[ 8 ]; + + #else + + uniform float morphTargetInfluences[ 4 ]; + + #endif + + #endif + +#endif +`;var morphtarget_vertex_glsl_default=` +#ifdef USE_MORPHTARGETS + + // morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative\ + value: + // When morphTargetsRelative is false, this is set to 1 - sum(influences); this\ + results in position = sum((target - base) * influence) + // When morphTargetsRelative is true, this is set to 1; as a result, all morph \ +targets are simply added to the base after weighting + transformed *= morphTargetBaseInfluence; + + #ifdef MORPHTARGETS_TEXTURE + + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID\ +, i, 0 ).xyz * morphTargetInfluences[ i ]; + + } + + #else + + transformed += morphTarget0 * morphTargetInfluences[ 0 ]; + transformed += morphTarget1 * morphTargetInfluences[ 1 ]; + transformed += morphTarget2 * morphTargetInfluences[ 2 ]; + transformed += morphTarget3 * morphTargetInfluences[ 3 ]; + + #ifndef USE_MORPHNORMALS + + transformed += morphTarget4 * morphTargetInfluences[ 4 ]; + transformed += morphTarget5 * morphTargetInfluences[ 5 ]; + transformed += morphTarget6 * morphTargetInfluences[ 6 ]; + transformed += morphTarget7 * morphTargetInfluences[ 7 ]; + + #endif + + #endif + +#endif +`;var normal_fragment_begin_glsl_default=` +float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; + +#ifdef FLAT_SHADED + + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); + +#else + + vec3 normal = normalize( vNormal ); + + #ifdef DOUBLE_SIDED + + normal *= faceDirection; + + #endif + +#endif + +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) \ +|| defined( USE_ANISOTROPY ) + + #ifdef USE_TANGENT + + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + + #else + + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + + #endif + + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + + #endif + +#endif + +#ifdef USE_CLEARCOAT_NORMALMAP + + #ifdef USE_TANGENT + + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + + #else + + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\ + + + #endif + + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + + #endif + +#endif + +// non perturbed normal for clearcoat among others + +vec3 nonPerturbedNormal = normal; + +`;var normal_fragment_maps_glsl_default=` + +#ifdef USE_NORMALMAP_OBJECTSPACE + + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; // overrides bot\ +h flatShading and attribute normals + + #ifdef FLIP_SIDED + + normal = - normal; + + #endif + + #ifdef DOUBLE_SIDED + + normal = normal * faceDirection; + + #endif + + normal = normalize( normalMatrix * normal ); + +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + + normal = normalize( tbn * mapN ); + +#elif defined( USE_BUMPMAP ) + + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection \ +); + +#endif +`;var normal_pars_fragment_glsl_default=` +#ifndef FLAT_SHADED + + varying vec3 vNormal; + + #ifdef USE_TANGENT + + varying vec3 vTangent; + varying vec3 vBitangent; + + #endif + +#endif +`;var normal_pars_vertex_glsl_default=` +#ifndef FLAT_SHADED + + varying vec3 vNormal; + + #ifdef USE_TANGENT + + varying vec3 vTangent; + varying vec3 vBitangent; + + #endif + +#endif +`;var normal_vertex_glsl_default=` +#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED + + vNormal = normalize( transformedNormal ); + + #ifdef USE_TANGENT + + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + + #endif + +#endif +`;var normalmap_pars_fragment_glsl_default=` +#ifdef USE_NORMALMAP + + uniform sampler2D normalMap; + uniform vec2 normalScale; + +#endif + +#ifdef USE_NORMALMAP_OBJECTSPACE + + uniform mat3 normalMatrix; + +#endif + +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || def\ +ined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + + // Normal Mapping Without Precomputed Tangents + // http://www.thetenthplanet.de/archives/1180 + + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + + vec3 N = surf_norm; // normalized + + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + + return mat3( T * scale, B * scale, N ); + + } + +#endif +`;var clearcoat_normal_fragment_begin_glsl_default=` +#ifdef USE_CLEARCOAT + + vec3 clearcoatNormal = nonPerturbedNormal; + +#endif +`;var clearcoat_normal_fragment_maps_glsl_default=` +#ifdef USE_CLEARCOAT_NORMALMAP + + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz\ + * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); + +#endif +`;var clearcoat_pars_fragment_glsl_default=` + +#ifdef USE_CLEARCOATMAP + + uniform sampler2D clearcoatMap; + +#endif + +#ifdef USE_CLEARCOAT_NORMALMAP + + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; + +#endif + +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + + uniform sampler2D clearcoatRoughnessMap; + +#endif +`;var iridescence_pars_fragment_glsl_default=` + +#ifdef USE_IRIDESCENCEMAP + + uniform sampler2D iridescenceMap; + +#endif + +#ifdef USE_IRIDESCENCE_THICKNESSMAP + + uniform sampler2D iridescenceThicknessMap; + +#endif +`;var opaque_fragment_glsl_default=` +#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif + +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif + +gl_FragColor = vec4( outgoingLight, diffuseColor.a ); +`;var packing_glsl_default=` +vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} + +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} + +const float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1) +const float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1) + +const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); +const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); + +const float ShiftRight8 = 1. / 256.; + +vec4 packDepthToRGBA( const in float v ) { + vec4 r = vec4( fract( v * PackFactors ), v ); + r.yzw -= r.xyz * ShiftRight8; // tidy overflow + return r * PackUpscale; +} + +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors ); +} + +vec2 packDepthToRG( in highp float v ) { + return packDepthToRGBA( v ).yx; +} + +float unpackRGToDepth( const in highp vec2 v ) { + return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); +} + +vec4 pack2HalfToRGBA( vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} + +vec2 unpackRGBATo2Half( vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} + +// NOTE: viewZ, the z-coordinate in camera space, is negative for points in fron\ +t of the camera + +float viewZToOrthographicDepth( const in float viewZ, const in float near, const\ + in float far ) { + // -near maps to 0; -far maps to 1 + return ( viewZ + near ) / ( near - far ); +} + +float orthographicDepthToViewZ( const in float depth, const in float near, const\ + in float far ) { + // maps orthographic depth in [ 0, 1 ] to viewZ + return depth * ( near - far ) - near; +} + +// NOTE: https://twitter.com/gonnavis/status/1377183786949959682 + +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const \ +in float far ) { + // -near maps to 0; -far maps to 1 + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} + +float perspectiveDepthToViewZ( const in float depth, const in float near, const \ +in float far ) { + // maps perspective depth in [ 0, 1 ] to viewZ + return ( near * far ) / ( ( far - near ) * depth - far ); +} +`;var premultiplied_alpha_fragment_glsl_default=` +#ifdef PREMULTIPLIED_ALPHA + + // Get get normal blending with premultipled, use with CustomBlending, OneFacto\ +r, OneMinusSrcAlphaFactor, AddEquation. + gl_FragColor.rgb *= gl_FragColor.a; + +#endif +`;var project_vertex_glsl_default=` +vec4 mvPosition = vec4( transformed, 1.0 ); + +#ifdef USE_BATCHING + + mvPosition = batchingMatrix * mvPosition; + +#endif + +#ifdef USE_INSTANCING + + mvPosition = instanceMatrix * mvPosition; + +#endif + +mvPosition = modelViewMatrix * mvPosition; + +gl_Position = projectionMatrix * mvPosition; +`;var dithering_fragment_glsl_default=` +#ifdef DITHERING + + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); + +#endif +`;var dithering_pars_fragment_glsl_default=` +#ifdef DITHERING + + // based on https://www.shadertoy.com/view/MslGR8 + vec3 dithering( vec3 color ) { + //Calculate grid position + float grid_position = rand( gl_FragCoord.xy ); + + //Shift the individual colors differently, thus making it even harder to see t\ +he dithering pattern + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + + //modify shift according to grid position. + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_\ +position ); + + //shift the color by dither_shift + return color + dither_shift_RGB; + } + +#endif +`;var roughnessmap_fragment_glsl_default=` +float roughnessFactor = roughness; + +#ifdef USE_ROUGHNESSMAP + + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + + // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB)\ + texture + roughnessFactor *= texelRoughness.g; + +#endif +`;var roughnessmap_pars_fragment_glsl_default=` +#ifdef USE_ROUGHNESSMAP + + uniform sampler2D roughnessMap; + +#endif +`;var shadowmap_pars_fragment_glsl_default=` +#if NUM_SPOT_LIGHT_COORDS > 0 + + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; + +#endif + +#if NUM_SPOT_LIGHT_MAPS > 0 + + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; + +#endif + +#ifdef USE_SHADOWMAP + + #if NUM_DIR_LIGHT_SHADOWS > 0 + + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS \ +]; + + #endif + + #if NUM_SPOT_LIGHT_SHADOWS > 0 + + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + + #endif + + #if NUM_POINT_LIGHT_SHADOWS > 0 + + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): create uniforms for area light shadows + + #endif + */ + + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + + } + + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + + } + + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + + float occlusion = 1.0; + + vec2 distribution = texture2DDistribution( shadow, uv ); + + float hard_shadow = step( compare , distribution.x ); // Hard Shadow + + if (hard_shadow != 1.0 ) { + + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); //\ + Chebeyshevs inequality + softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 )\ +, 0.0, 1.0 ); // 0.3 reduces light bleed + occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + + } + return occlusion; + + } + + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, flo\ +at shadowRadius, vec4 shadowCoord ) { + + float shadow = 1.0; + + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y\ + >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + + if ( frustumTest ) { + + #if defined( SHADOWMAP_TYPE_PCF ) + + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.\ +z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.\ +z ) + ) * ( 1.0 / 17.0 ); + + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z \ +), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z )\ +, + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.\ +z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoor\ +d.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + + #elif defined( SHADOWMAP_TYPE_VSM ) + + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + + #else // no percentage-closer filtering: + + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + + #endif + + } + + return shadow; + + } + + // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a\ + 2D + // vector suitable for 2D texture mapping. This code uses the following layout \ +for the + // 2D texture: + // + // xzXZ + // y Y + // + // Y - Positive y direction + // y - Negative y direction + // X - Positive x direction + // x - Negative x direction + // Z - Positive z direction + // z - Negative z direction + // + // Source and test bed: + // https://gist.github.com/tschw/da10c43c467ce8afd0c4 + + vec2 cubeToUV( vec3 v, float texelSizeY ) { + + // Number of texels to avoid at the edge of each square + + vec3 absV = abs( v ); + + // Intersect unit cube + + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + + // Apply scale to avoid seams + + // two texels less per square (one texel will do for NEAREST) + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + + // Unwrap + + // space: -1 ... 1 range for each square + // + // #X## dim := ( 4 , 2 ) + // # # center := ( 1 , 1 ) + + vec2 planar = v.xy; + + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + + if ( absV.z >= almostOne ) { + + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + + } else if ( absV.x >= almostOne ) { + + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + + } else if ( absV.y >= almostOne ) { + + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + + } + + // Transform to UV space + + // scale := 0.5 / dim + // translate := ( center + 0.5 ) / dim + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + + } + + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias\ +, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCame\ +raFar ) { + + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + + // for point lights, the uniform @vShadowCoord is re-purposed to hold + // the vector from the light to the world-space position of the fragment. + vec3 lightToPosition = shadowCoord.xyz; + + // dp = normalized distance from light to fragment position + float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFa\ +r - shadowCameraNear ); // need to clamp? + dp += shadowBias; + + // bd3D = base direction 3D + vec3 bd3D = normalize( lightToPosition ); + + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || def\ +ined( SHADOWMAP_TYPE_VSM ) + + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + + return ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp \ +) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp \ +) + ) * ( 1.0 / 9.0 ); + + #else // no percentage-closer filtering + + return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + + #endif + + } + +#endif +`;var shadowmap_pars_vertex_glsl_default=` + +#if NUM_SPOT_LIGHT_COORDS > 0 + + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; + +#endif + +#ifdef USE_SHADOWMAP + + #if NUM_DIR_LIGHT_SHADOWS > 0 + + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS \ +]; + + #endif + + #if NUM_SPOT_LIGHT_SHADOWS > 0 + + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + + #endif + + #if NUM_POINT_LIGHT_SHADOWS > 0 + + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): uniforms for area light shadows + + #endif + */ + +#endif +`;var shadowmap_vertex_glsl_default=` + +#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT\ +_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + + // Offsetting the position used for querying occlusion along the world normal c\ +an be used to reduce shadow acne. + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatr\ +ix ); + vec4 shadowWorldPosition; + +#endif + +#if defined( USE_SHADOWMAP ) + + #if NUM_DIR_LIGHT_SHADOWS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLi\ +ghtShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosi\ +tion; + + } + #pragma unroll_loop_end + + #endif + + #if NUM_POINT_LIGHT_SHADOWS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightSha\ +dows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + + } + #pragma unroll_loop_end + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): update vAreaShadowCoord with area light info + + #endif + */ + +#endif + +// spot lights can be evaluated without active shadow mapping (when SpotLight.ma\ +p is used) + +#if NUM_SPOT_LIGHT_COORDS > 0 + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS\ + ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNo\ +rmalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + + } + #pragma unroll_loop_end + +#endif + + +`;var shadowmask_pars_fragment_glsl_default=` +float getShadowMask() { + + float shadow = 1.0; + + #ifdef USE_SHADOWMAP + + #if NUM_DIR_LIGHT_SHADOWS > 0 + + DirectionalLightShadow directionalLight; + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLig\ +ht.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vD\ +irectionalShadowCoord[ i ] ) : 1.0; + + } + #pragma unroll_loop_end + + #endif + + #if NUM_SPOT_LIGHT_SHADOWS > 0 + + SpotLightShadow spotLight; + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSi\ +ze, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + + } + #pragma unroll_loop_end + + #endif + + #if NUM_POINT_LIGHT_SHADOWS > 0 + + PointLightShadow pointLight; + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shad\ +owMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i \ +], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + + } + #pragma unroll_loop_end + + #endif + + /* + #if NUM_RECT_AREA_LIGHTS > 0 + + // TODO (abelnation): update shadow for Area light + + #endif + */ + + #endif + + return shadow; + +} +`;var skinbase_vertex_glsl_default=` +#ifdef USE_SKINNING + + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); + +#endif +`;var skinning_pars_vertex_glsl_default=` +#ifdef USE_SKINNING + + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + + uniform highp sampler2D boneTexture; + + mat4 getBoneMatrix( const in float i ) { + + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + + return mat4( v1, v2, v3, v4 ); + + } + +#endif +`;var skinning_vertex_glsl_default=` +#ifdef USE_SKINNING + + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + + transformed = ( bindMatrixInverse * skinned ).xyz; + +#endif +`;var skinnormal_vertex_glsl_default=` +#ifdef USE_SKINNING + + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + + #ifdef USE_TANGENT + + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + + #endif + +#endif +`;var specularmap_fragment_glsl_default=` +float specularStrength; + +#ifdef USE_SPECULARMAP + + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; + +#else + + specularStrength = 1.0; + +#endif +`;var specularmap_pars_fragment_glsl_default=` +#ifdef USE_SPECULARMAP + + uniform sampler2D specularMap; + +#endif +`;var tonemapping_fragment_glsl_default=` +#if defined( TONE_MAPPING ) + + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); + +#endif +`;var tonemapping_pars_fragment_glsl_default=` +#ifndef saturate +// may have defined saturate() already +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif + +uniform float toneMappingExposure; + +// exposure only +vec3 LinearToneMapping( vec3 color ) { + + return saturate( toneMappingExposure * color ); + +} + +// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf +vec3 ReinhardToneMapping( vec3 color ) { + + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); + +} + +// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/ +vec3 OptimizedCineonToneMapping( vec3 color ) { + + // optimized filmic operator by Jim Hejl and Richard Burgess-Dawson + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 )\ + + 0.06 ), vec3( 2.2 ) ); + +} + +// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/\ +ltc_blit.fs +vec3 RRTAndODTFit( vec3 v ) { + + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; + +} + +// this implementation of ACES is modified to accommodate a brighter viewing env\ +ironment. +// the scale factor of 1/0.6 is subjective. see discussion in #19621. + +vec3 ACESFilmicToneMapping( vec3 color ) { + + // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), // transposed from source + vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + + // ODT_SAT => XYZ => D60_2_D65 => sRGB + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), // transposed from source + vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + + color *= toneMappingExposure / 0.6; + + color = ACESInputMat * color; + + // Apply RRT and ODT + color = RRTAndODTFit( color ); + + color = ACESOutputMat * color; + + // Clamp to [0, 1] + return saturate( color ); + +} + +// Matrices for rec 2020 <> rec 709 color space conversion +// matrix provided in row-major order so it has been transposed +// https://www.itu.int/pub/R-REP-BT.2407-2017 +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); + +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); + +// https://iolite-engine.com/blog_posts/minimal_agx_implementation +// Mean error^2: 3.6705141e-06 +vec3 agxDefaultContrastApprox( vec3 x ) { + + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; + +} + +// Input and output encoded as Linear-sRGB. +vec3 AgXToneMapping( vec3 color ) { + + // AgX constants + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + + // explicit AgXOutsetMatrix generated from Filaments AgXOutsetMatrixInv + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + + const float AgxMinEv = - 12.47393; // log2(pow(2, LOG2_MIN) * MIDDLE_GRAY) + const float AgxMaxEv = 4.026069; // log2(pow(2, LOG2_MAX) * MIDDLE_GRAY) + + // AGX Tone Mapping implementation based on Filament, which is in turn based + // on Blender's implementation for rec 2020 colors: + // https://github.com/google/filament/pull/7236 + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color *= toneMappingExposure; + + color = AgXInsetMatrix * color; + + // Log2 encoding + color = max( color, 1e-10 ); // avoid 0 or negative numbers for log2 + color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + + color = clamp( color, 0.0, 1.0 ); + + // Apply sigmoid + color = agxDefaultContrastApprox( color ); + + // Apply AgX look + // v = agxLook(v, look); + + color = AgXOutsetMatrix * color; + + // Linearize + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + + return color; + +} + +vec3 CustomToneMapping( vec3 color ) { return color; } +`;var transmission_fragment_glsl_default=` +#ifdef USE_TRANSMISSION + + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + + #ifdef USE_TRANSMISSIONMAP + + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + + #endif + + #ifdef USE_THICKNESSMAP + + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + + #endif + + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, mater\ +ial.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickne\ +ss, + material.attenuationColor, material.attenuationDistance ); + + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, ma\ +terial.transmission ); + + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); + +#endif +`;var transmission_pars_fragment_glsl_default=` +#ifdef USE_TRANSMISSION + + // Transmission code is based on glTF-Sampler-Viewer + // https://github.com/KhronosGroup/glTF-Sample-Viewer + + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + + #ifdef USE_TRANSMISSIONMAP + + uniform sampler2D transmissionMap; + + #endif + + #ifdef USE_THICKNESSMAP + + uniform sampler2D thicknessMap; + + #endif + + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + + varying vec3 vWorldPosition; + + // Mipped Bicubic Texture Filtering by N8 + // https://www.shadertoy.com/view/Dl2SDW + + float w0( float a ) { + + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + + } + + float w1( float a ) { + + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + + } + + float w2( float a ){ + + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + + } + + float w3( float a ) { + + return ( 1.0 / 6.0 ) * ( a * a * a ); + + } + + // g0 and g1 are the two amplitude functions + float g0( float a ) { + + return w0( a ) + w1( a ); + + } + + float g1( float a ) { + + return w2( a ) + w3( a ); + + } + + // h0 and h1 are the two offset functions + float h0( float a ) { + + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + + } + + float h1( float a ) { + + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + + } + + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + + uv = uv * texelSize.zw + 0.5; + + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( te\ +x, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3,\ + lod ) ); + + } + + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod\ + ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod \ +) ); + return mix( fSample, cSample, fract( lod ) ); + + } + + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float\ + thickness, const in float ior, const in mat4 modelMatrix ) { + + // Direction of refracted light. + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + + // Compute rotation-independant scaling of the model matrix. + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + + // The thickness is specified in local space. + return normalize( refractionVector ) * thickness * modelScale; + + } + + float applyIorToRoughness( const in float roughness, const in float ior ) { + + // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet ref\ +raction and + // an IOR of 1.5 results in the default amount of microfacet refraction. + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + + } + + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, \ +const in float ior ) { + + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness\ +, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + + } + + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 atte\ +nuationColor, const in float attenuationDistance ) { + + if ( isinf( attenuationDistance ) ) { + + // Attenuation distance is +\u221E, i.e. the transmitted color is not attenuated a\ +t all. + return vec3( 1.0 ); + + } else { + + // Compute light attenuation using Beer's law. + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\ + + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); \ +// Beer's law + return transmittance; + + } + + } + + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float r\ +oughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 positio\ +n, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const \ +in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMa\ +trix ); + vec3 refractedRayExit = position + transmissionRay; + + // Project refracted vector on the framebuffer, while mapping to normalized de\ +vice coordinates. + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + // Sample framebuffer to get pixel the refracted ray hits. + vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, io\ +r ); + + vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay\ + ), attenuationColor, attenuationDistance ); + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + + // Get the specular component. + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + + // As less light is transmitted, the opacity should be increased. This simple \ +approximation does a decent job + // of modulating a CSS background, and has no effect when the buffer is opaque\ +, due to a solid object or clear color. + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittanc\ +e.b ) / 3.0; + + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a )\ + * transmittanceFactor ); + + } +#endif +`;var uv_pars_fragment_glsl_default=` +#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + + varying vec2 vUv; + +#endif +#ifdef USE_MAP + + varying vec2 vMapUv; + +#endif +#ifdef USE_ALPHAMAP + + varying vec2 vAlphaMapUv; + +#endif +#ifdef USE_LIGHTMAP + + varying vec2 vLightMapUv; + +#endif +#ifdef USE_AOMAP + + varying vec2 vAoMapUv; + +#endif +#ifdef USE_BUMPMAP + + varying vec2 vBumpMapUv; + +#endif +#ifdef USE_NORMALMAP + + varying vec2 vNormalMapUv; + +#endif +#ifdef USE_EMISSIVEMAP + + varying vec2 vEmissiveMapUv; + +#endif +#ifdef USE_METALNESSMAP + + varying vec2 vMetalnessMapUv; + +#endif +#ifdef USE_ROUGHNESSMAP + + varying vec2 vRoughnessMapUv; + +#endif +#ifdef USE_ANISOTROPYMAP + + varying vec2 vAnisotropyMapUv; + +#endif +#ifdef USE_CLEARCOATMAP + + varying vec2 vClearcoatMapUv; + +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + + varying vec2 vClearcoatNormalMapUv; + +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + + varying vec2 vClearcoatRoughnessMapUv; + +#endif +#ifdef USE_IRIDESCENCEMAP + + varying vec2 vIridescenceMapUv; + +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + + varying vec2 vIridescenceThicknessMapUv; + +#endif +#ifdef USE_SHEEN_COLORMAP + + varying vec2 vSheenColorMapUv; + +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + + varying vec2 vSheenRoughnessMapUv; + +#endif +#ifdef USE_SPECULARMAP + + varying vec2 vSpecularMapUv; + +#endif +#ifdef USE_SPECULAR_COLORMAP + + varying vec2 vSpecularColorMapUv; + +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + + varying vec2 vSpecularIntensityMapUv; + +#endif +#ifdef USE_TRANSMISSIONMAP + + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; + +#endif +#ifdef USE_THICKNESSMAP + + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; + +#endif +`;var uv_pars_vertex_glsl_default=` +#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + + varying vec2 vUv; + +#endif +#ifdef USE_MAP + + uniform mat3 mapTransform; + varying vec2 vMapUv; + +#endif +#ifdef USE_ALPHAMAP + + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; + +#endif +#ifdef USE_LIGHTMAP + + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; + +#endif +#ifdef USE_AOMAP + + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; + +#endif +#ifdef USE_BUMPMAP + + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; + +#endif +#ifdef USE_NORMALMAP + + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; + +#endif +#ifdef USE_DISPLACEMENTMAP + + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; + +#endif +#ifdef USE_EMISSIVEMAP + + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; + +#endif +#ifdef USE_METALNESSMAP + + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; + +#endif +#ifdef USE_ROUGHNESSMAP + + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; + +#endif +#ifdef USE_ANISOTROPYMAP + + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; + +#endif +#ifdef USE_CLEARCOATMAP + + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; + +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; + +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; + +#endif +#ifdef USE_SHEEN_COLORMAP + + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; + +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; + +#endif +#ifdef USE_IRIDESCENCEMAP + + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; + +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; + +#endif +#ifdef USE_SPECULARMAP + + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; + +#endif +#ifdef USE_SPECULAR_COLORMAP + + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; + +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; + +#endif +#ifdef USE_TRANSMISSIONMAP + + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; + +#endif +#ifdef USE_THICKNESSMAP + + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; + +#endif +`;var uv_vertex_glsl_default=` +#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + + vUv = vec3( uv, 1 ).xy; + +#endif +#ifdef USE_MAP + + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_ALPHAMAP + + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_LIGHTMAP + + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_AOMAP + + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_BUMPMAP + + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_NORMALMAP + + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_DISPLACEMENTMAP + + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 )\ + ).xy; + +#endif +#ifdef USE_EMISSIVEMAP + + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_METALNESSMAP + + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_ROUGHNESSMAP + + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_ANISOTROPYMAP + + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\ + + +#endif +#ifdef USE_CLEARCOATMAP + + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALM\ +AP_UV, 1 ) ).xy; + +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_R\ +OUGHNESSMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_IRIDESCENCEMAP + + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).\ +xy; + +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESC\ +ENCE_THICKNESSMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_SHEEN_COLORMAP + + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy\ +; + +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_\ +UV, 1 ) ).xy; + +#endif +#ifdef USE_SPECULARMAP + + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_SPECULAR_COLORMAP + + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV,\ + 1 ) ).xy; + +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTE\ +NSITYMAP_UV, 1 ) ).xy; + +#endif +#ifdef USE_TRANSMISSIONMAP + + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 )\ + ).xy; + +#endif +#ifdef USE_THICKNESSMAP + + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; + +#endif +`;var worldpos_vertex_glsl_default=` +#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) ||\ + defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + + vec4 worldPosition = vec4( transformed, 1.0 ); + + #ifdef USE_BATCHING + + worldPosition = batchingMatrix * worldPosition; + + #endif + + #ifdef USE_INSTANCING + + worldPosition = instanceMatrix * worldPosition; + + #endif + + worldPosition = modelMatrix * worldPosition; + +#endif +`;var vertex2=` +varying vec2 vUv; +uniform mat3 uvTransform; + +void main() { + + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + + gl_Position = vec4( position.xy, 1.0, 1.0 ); + +} +`,fragment2=` +uniform sampler2D t2D; +uniform float backgroundIntensity; + +varying vec2 vUv; + +void main() { + + vec4 texColor = texture2D( t2D, vUv ); + + #ifdef DECODE_VIDEO_TEXTURE + + // use inline sRGB decode until browsers properly support SRGB8_APLHA8 with vi\ +deo textures + + texColor = 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 ); + + #endif + + texColor.rgb *= backgroundIntensity; + + gl_FragColor = texColor; + + #include + #include + +} +`;var vertex3=` +varying vec3 vWorldDirection; + +#include + +void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + gl_Position.z = gl_Position.w; // set z to camera.far + +} +`,fragment3=` + +#ifdef ENVMAP_TYPE_CUBE + + uniform samplerCube envMap; + +#elif defined( ENVMAP_TYPE_CUBE_UV ) + + uniform sampler2D envMap; + +#endif + +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; + +varying vec3 vWorldDirection; + +#include + +void main() { + + #ifdef ENVMAP_TYPE_CUBE + + vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWo\ +rldDirection.yz ) ); + + #elif defined( ENVMAP_TYPE_CUBE_UV ) + + vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness )\ +; + + #else + + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + + #endif + + texColor.rgb *= backgroundIntensity; + + gl_FragColor = texColor; + + #include + #include + +} +`;var vertex4=` +varying vec3 vWorldDirection; + +#include + +void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + gl_Position.z = gl_Position.w; // set z to camera.far + +} +`,fragment4=` +uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; + +varying vec3 vWorldDirection; + +void main() { + + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDire\ +ction.yz ) ); + + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + + #include + #include + +} +`;var vertex5=` +#include +#include +#include +#include +#include +#include +#include +#include + +// This is used for computing an equivalent of gl_FragCoord.z that is as high pr\ +ecision as possible. +// Some platforms compute gl_FragCoord at a lower precision which makes the manu\ +ally computed value better for +// depth-based postprocessing effects. Reproduced on iPad with A10 processor / i\ +PadOS 13.3.1. +varying vec2 vHighPrecisionZW; + +void main() { + + #include + + #include + #include + + #ifdef USE_DISPLACEMENTMAP + + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + #include + + vHighPrecisionZW = gl_Position.zw; + +} +`,fragment5=` +#if DEPTH_PACKING == 3200 + + uniform float opacity; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +varying vec2 vHighPrecisionZW; + +void main() { + + #include + + vec4 diffuseColor = vec4( 1.0 ); + + #if DEPTH_PACKING == 3200 + + diffuseColor.a = opacity; + + #endif + + #include + #include + #include + #include + + #include + + // Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has b\ +een left to its default values. + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + + #if DEPTH_PACKING == 3200 + + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + + #elif DEPTH_PACKING == 3201 + + gl_FragColor = packDepthToRGBA( fragCoordZ ); + + #endif + +} +`;var vertex6=` +#define DISTANCE + +varying vec3 vWorldPosition; + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + #include + #include + + #ifdef USE_DISPLACEMENTMAP + + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + #include + + vWorldPosition = worldPosition.xyz; + +} +`,fragment6=` +#define DISTANCE + +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; + +#include +#include +#include +#include +#include +#include +#include +#include + +void main () { + + #include + + vec4 diffuseColor = vec4( 1.0 ); + + #include + #include + #include + #include + + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); // clamp to [ 0, 1 ] + + gl_FragColor = packDepthToRGBA( dist ); + +} +`;var vertex7=` +varying vec3 vWorldDirection; + +#include + +void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + +} +`,fragment7=` +uniform sampler2D tEquirect; + +varying vec3 vWorldDirection; + +#include + +void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + #include + #include + +} +`;var vertex8=` +uniform float scale; +attribute float lineDistance; + +varying float vLineDistance; + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + vLineDistance = scale * lineDistance; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + +} +`,fragment8=` +uniform vec3 diffuse; +uniform float opacity; + +uniform float dashSize; +uniform float totalSize; + +varying float vLineDistance; + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + if ( mod( vLineDistance, totalSize ) > dashSize ) { + + discard; + + } + + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + #include + + outgoingLight = diffuseColor.rgb; // simple shader + + #include + #include + #include + #include + #include + +} +`;var vertex9=` +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + + #include + #include + #include + #include + #include + + #endif + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + +} +`,fragment9=` +uniform vec3 diffuse; +uniform float opacity; + +#ifndef FLAT_SHADED + + varying vec3 vNormal; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + #include + #include + #include + #include + #include + + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + + // accumulation (baked indirect lighting only) + #ifdef USE_LIGHTMAP + + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECI\ +PROCAL_PI; + + #else + + reflectedLight.indirectDiffuse += vec3( 1.0 ); + + #endif + + // modulation + #include + + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + + vec3 outgoingLight = reflectedLight.indirectDiffuse; + + #include + + #include + #include + #include + #include + #include + #include + +} +`;var vertex10=` +#define LAMBERT + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + #include + +} +`,fragment10=` +#define LAMBERT + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiff\ +use + totalEmissiveRadiance; + + #include + #include + #include + #include + #include + #include + #include + +} +`;var vertex11=` +#define MATCAP + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +void main() { + + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + +} +`,fragment11=` +#define MATCAP + +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + #include + #include + #include + #include + #include + #include + + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to\ + remove artifacts caused by undersized matcap disks + + #ifdef USE_MATCAP + + vec4 matcapColor = texture2D( matcap, uv ); + + #else + + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if m\ +atcap is missing + + #endif + + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + + #include + #include + #include + #include + #include + #include + +} +`;var vertex12=` +#define NORMAL + +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_T\ +ANGENTSPACE ) + + varying vec3 vViewPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_T\ +ANGENTSPACE ) + + vViewPosition = - mvPosition.xyz; + +#endif + +} +`,fragment12=` +#define NORMAL + +uniform float opacity; + +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_T\ +ANGENTSPACE ) + + varying vec3 vViewPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + + gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); + + #ifdef OPAQUE + + gl_FragColor.a = 1.0; + + #endif + +} +`;var vertex13=` +#define PHONG + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + #include + +} +`,fragment13=` +#define PHONG + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiff\ +use + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmi\ +ssiveRadiance; + + #include + #include + #include + #include + #include + #include + #include + +} +`;var vertex14=` +#define STANDARD + +varying vec3 vViewPosition; + +#ifdef USE_TRANSMISSION + + varying vec3 vWorldPosition; + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + +#ifdef USE_TRANSMISSION + + vWorldPosition = worldPosition.xyz; + +#endif +} +`,fragment14=` +#define STANDARD + +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; + +#ifdef IOR + uniform float ior; +#endif + +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif + +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif + +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif + +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif + +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffu\ +se; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpe\ +cular; + + #include + + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + + #ifdef USE_SHEEN + + // Sheen energy compensation approximation calculation can be found at the end\ + of + // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=\ +sharing + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenS\ +pecularIndirect; + + #endif + + #ifdef USE_CLEARCOAT + + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearco\ +atSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + + #endif + + #include + #include + #include + #include + #include + #include + +} +`;var vertex15=` +#define TOON + +varying vec3 vViewPosition; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + +} +`,fragment15=` +#define TOON + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3(\ + 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + + // accumulation + #include + #include + #include + #include + + // modulation + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiff\ +use + totalEmissiveRadiance; + + #include + #include + #include + #include + #include + #include + +} +`;var vertex16=` +uniform float size; +uniform float scale; + +#include +#include +#include +#include +#include +#include + +#ifdef USE_POINTS_UV + + varying vec2 vUv; + uniform mat3 uvTransform; + +#endif + +void main() { + + #ifdef USE_POINTS_UV + + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + + #endif + + #include + #include + #include + #include + #include + + gl_PointSize = size; + + #ifdef USE_SIZEATTENUATION + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + + #endif + + #include + #include + #include + #include + +} +`,fragment16=` +uniform vec3 diffuse; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + #include + #include + #include + + outgoingLight = diffuseColor.rgb; + + #include + #include + #include + #include + #include + +} +`;var vertex17=` +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + + #include + #include + #include + +} +`,fragment17=` +uniform vec3 color; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + + #include + #include + #include + +} +`;var vertex18=` +uniform float rotation; +uniform vec2 center; + +#include +#include +#include +#include +#include + +void main() { + + #include + + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 \ +].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 \ +].z ) ); + + #ifndef USE_SIZEATTENUATION + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + + if ( isPerspective ) scale *= - mvPosition.z; + + #endif + + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * ali\ +gnedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * ali\ +gnedPosition.y; + + mvPosition.xy += rotatedPosition; + + gl_Position = projectionMatrix * mvPosition; + + #include + #include + #include + +} +`,fragment18=` +uniform vec3 diffuse; +uniform float opacity; + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + + #include + #include + #include + #include + #include + + outgoingLight = diffuseColor.rgb; + + #include + #include + #include + #include + +} +`;var ShaderChunk2={alphahash_fragment:alphahash_fragment_glsl_default,alphahash_pars_fragment:alphahash_pars_fragment_glsl_default, +alphamap_fragment:alphamap_fragment_glsl_default,alphamap_pars_fragment:alphamap_pars_fragment_glsl_default, +alphatest_fragment:alphatest_fragment_glsl_default,alphatest_pars_fragment:alphatest_pars_fragment_glsl_default, +aomap_fragment:aomap_fragment_glsl_default,aomap_pars_fragment:aomap_pars_fragment_glsl_default, +batching_pars_vertex:batching_pars_vertex_glsl_default,batching_vertex:batching_vertex_glsl_default, +begin_vertex:begin_vertex_glsl_default,beginnormal_vertex:beginnormal_vertex_glsl_default, +bsdfs:bsdfs_glsl_default,iridescence_fragment:iridescence_fragment_glsl_default, +bumpmap_pars_fragment:bumpmap_pars_fragment_glsl_default,clipping_planes_fragment:clipping_planes_fragment_glsl_default, +clipping_planes_pars_fragment:clipping_planes_pars_fragment_glsl_default,clipping_planes_pars_vertex:clipping_planes_pars_vertex_glsl_default, +clipping_planes_vertex:clipping_planes_vertex_glsl_default,color_fragment:color_fragment_glsl_default, +color_pars_fragment:color_pars_fragment_glsl_default,color_pars_vertex:color_pars_vertex_glsl_default, +color_vertex:color_vertex_glsl_default,common:common_glsl_default,cube_uv_reflection_fragment:cube_uv_reflection_fragment_glsl_default, +defaultnormal_vertex:defaultnormal_vertex_glsl_default,displacementmap_pars_vertex:displacementmap_pars_vertex_glsl_default, +displacementmap_vertex:displacementmap_vertex_glsl_default,emissivemap_fragment:emissivemap_fragment_glsl_default, +emissivemap_pars_fragment:emissivemap_pars_fragment_glsl_default,colorspace_fragment:colorspace_fragment_glsl_default, +colorspace_pars_fragment:colorspace_pars_fragment_glsl_default,envmap_fragment:envmap_fragment_glsl_default, +envmap_common_pars_fragment:envmap_common_pars_fragment_glsl_default,envmap_pars_fragment:envmap_pars_fragment_glsl_default, +envmap_pars_vertex:envmap_pars_vertex_glsl_default,envmap_physical_pars_fragment:envmap_physical_pars_fragment_glsl_default, +envmap_vertex:envmap_vertex_glsl_default,fog_vertex:fog_vertex_glsl_default,fog_pars_vertex:fog_pars_vertex_glsl_default, +fog_fragment:fog_fragment_glsl_default,fog_pars_fragment:fog_pars_fragment_glsl_default, +gradientmap_pars_fragment:gradientmap_pars_fragment_glsl_default,lightmap_fragment:lightmap_fragment_glsl_default, +lightmap_pars_fragment:lightmap_pars_fragment_glsl_default,lights_lambert_fragment:lights_lambert_fragment_glsl_default, +lights_lambert_pars_fragment:lights_lambert_pars_fragment_glsl_default,lights_pars_begin:lights_pars_begin_glsl_default, +lights_toon_fragment:lights_toon_fragment_glsl_default,lights_toon_pars_fragment:lights_toon_pars_fragment_glsl_default, +lights_phong_fragment:lights_phong_fragment_glsl_default,lights_phong_pars_fragment:lights_phong_pars_fragment_glsl_default, +lights_physical_fragment:lights_physical_fragment_glsl_default,lights_physical_pars_fragment:lights_physical_pars_fragment_glsl_default, +lights_fragment_begin:lights_fragment_begin_glsl_default,lights_fragment_maps:lights_fragment_maps_glsl_default, +lights_fragment_end:lights_fragment_end_glsl_default,logdepthbuf_fragment:logdepthbuf_fragment_glsl_default, +logdepthbuf_pars_fragment:logdepthbuf_pars_fragment_glsl_default,logdepthbuf_pars_vertex:logdepthbuf_pars_vertex_glsl_default, +logdepthbuf_vertex:logdepthbuf_vertex_glsl_default,map_fragment:map_fragment_glsl_default, +map_pars_fragment:map_pars_fragment_glsl_default,map_particle_fragment:map_particle_fragment_glsl_default, +map_particle_pars_fragment:map_particle_pars_fragment_glsl_default,metalnessmap_fragment:metalnessmap_fragment_glsl_default, +metalnessmap_pars_fragment:metalnessmap_pars_fragment_glsl_default,morphcolor_vertex:morphcolor_vertex_glsl_default, +morphnormal_vertex:morphnormal_vertex_glsl_default,morphtarget_pars_vertex:morphtarget_pars_vertex_glsl_default, +morphtarget_vertex:morphtarget_vertex_glsl_default,normal_fragment_begin:normal_fragment_begin_glsl_default, +normal_fragment_maps:normal_fragment_maps_glsl_default,normal_pars_fragment:normal_pars_fragment_glsl_default, +normal_pars_vertex:normal_pars_vertex_glsl_default,normal_vertex:normal_vertex_glsl_default, +normalmap_pars_fragment:normalmap_pars_fragment_glsl_default,clearcoat_normal_fragment_begin:clearcoat_normal_fragment_begin_glsl_default, +clearcoat_normal_fragment_maps:clearcoat_normal_fragment_maps_glsl_default,clearcoat_pars_fragment:clearcoat_pars_fragment_glsl_default, +iridescence_pars_fragment:iridescence_pars_fragment_glsl_default,opaque_fragment:opaque_fragment_glsl_default, +packing:packing_glsl_default,premultiplied_alpha_fragment:premultiplied_alpha_fragment_glsl_default, +project_vertex:project_vertex_glsl_default,dithering_fragment:dithering_fragment_glsl_default, +dithering_pars_fragment:dithering_pars_fragment_glsl_default,roughnessmap_fragment:roughnessmap_fragment_glsl_default, +roughnessmap_pars_fragment:roughnessmap_pars_fragment_glsl_default,shadowmap_pars_fragment:shadowmap_pars_fragment_glsl_default, +shadowmap_pars_vertex:shadowmap_pars_vertex_glsl_default,shadowmap_vertex:shadowmap_vertex_glsl_default, +shadowmask_pars_fragment:shadowmask_pars_fragment_glsl_default,skinbase_vertex:skinbase_vertex_glsl_default, +skinning_pars_vertex:skinning_pars_vertex_glsl_default,skinning_vertex:skinning_vertex_glsl_default, +skinnormal_vertex:skinnormal_vertex_glsl_default,specularmap_fragment:specularmap_fragment_glsl_default, +specularmap_pars_fragment:specularmap_pars_fragment_glsl_default,tonemapping_fragment:tonemapping_fragment_glsl_default, +tonemapping_pars_fragment:tonemapping_pars_fragment_glsl_default,transmission_fragment:transmission_fragment_glsl_default, +transmission_pars_fragment:transmission_pars_fragment_glsl_default,uv_pars_fragment:uv_pars_fragment_glsl_default, +uv_pars_vertex:uv_pars_vertex_glsl_default,uv_vertex:uv_vertex_glsl_default,worldpos_vertex:worldpos_vertex_glsl_default, +background_vert:vertex2,background_frag:fragment2,backgroundCube_vert:vertex3,backgroundCube_frag:fragment3, +cube_vert:vertex4,cube_frag:fragment4,depth_vert:vertex5,depth_frag:fragment5,distanceRGBA_vert:vertex6, +distanceRGBA_frag:fragment6,equirect_vert:vertex7,equirect_frag:fragment7,linedashed_vert:vertex8, +linedashed_frag:fragment8,meshbasic_vert:vertex9,meshbasic_frag:fragment9,meshlambert_vert:vertex10, +meshlambert_frag:fragment10,meshmatcap_vert:vertex11,meshmatcap_frag:fragment11, +meshnormal_vert:vertex12,meshnormal_frag:fragment12,meshphong_vert:vertex13,meshphong_frag:fragment13, +meshphysical_vert:vertex14,meshphysical_frag:fragment14,meshtoon_vert:vertex15,meshtoon_frag:fragment15, +points_vert:vertex16,points_frag:fragment16,shadow_vert:vertex17,shadow_frag:fragment17, +sprite_vert:vertex18,sprite_frag:fragment18};var UniformsLib2={common:{diffuse:{value:new Color(16777215)},opacity:{value:1}, +map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{ +value:new Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{ +value:new Matrix3}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{ +value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null}, +aoMapIntensity:{value:1},aoMapTransform:{value:new Matrix3}},lightmap:{lightMap:{ +value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Matrix3}},bumpmap:{ +bumpMap:{value:null},bumpMapTransform:{value:new Matrix3},bumpScale:{value:1}},normalmap:{ +normalMap:{value:null},normalMapTransform:{value:new Matrix3},normalScale:{value:new Vector2( +1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Matrix3}, +displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{ +value:null},emissiveMapTransform:{value:new Matrix3}},metalnessmap:{metalnessMap:{ +value:null},metalnessMapTransform:{value:new Matrix3}},roughnessmap:{roughnessMap:{ +value:null},roughnessMapTransform:{value:new Matrix3}},gradientmap:{gradientMap:{ +value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3}, +fogColor:{value:new Color(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{ +value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{ +value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}}, +directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[], +properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{}, +decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{}, +shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]}, +spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{}, +decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Color( +16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{ +value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0},uvTransform:{ +value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1}, +center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{ +value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{ +value:0}}};var ShaderLib2={basic:{uniforms:mergeUniforms2([UniformsLib2.common,UniformsLib2. +specularmap,UniformsLib2.envmap,UniformsLib2.aomap,UniformsLib2.lightmap,UniformsLib2. +fog]),vertexShader:ShaderChunk2.meshbasic_vert,fragmentShader:ShaderChunk2.meshbasic_frag}, +lambert:{uniforms:mergeUniforms2([UniformsLib2.common,UniformsLib2.specularmap,UniformsLib2. +envmap,UniformsLib2.aomap,UniformsLib2.lightmap,UniformsLib2.emissivemap,UniformsLib2. +bumpmap,UniformsLib2.normalmap,UniformsLib2.displacementmap,UniformsLib2.fog,UniformsLib2. +lights,{emissive:{value:new Color(0)}}]),vertexShader:ShaderChunk2.meshlambert_vert, +fragmentShader:ShaderChunk2.meshlambert_frag},phong:{uniforms:mergeUniforms2([UniformsLib2. +common,UniformsLib2.specularmap,UniformsLib2.envmap,UniformsLib2.aomap,UniformsLib2. +lightmap,UniformsLib2.emissivemap,UniformsLib2.bumpmap,UniformsLib2.normalmap,UniformsLib2. +displacementmap,UniformsLib2.fog,UniformsLib2.lights,{emissive:{value:new Color( +0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:ShaderChunk2. +meshphong_vert,fragmentShader:ShaderChunk2.meshphong_frag},standard:{uniforms:mergeUniforms2( +[UniformsLib2.common,UniformsLib2.envmap,UniformsLib2.aomap,UniformsLib2.lightmap, +UniformsLib2.emissivemap,UniformsLib2.bumpmap,UniformsLib2.normalmap,UniformsLib2. +displacementmap,UniformsLib2.roughnessmap,UniformsLib2.metalnessmap,UniformsLib2. +fog,UniformsLib2.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{ +value:0},envMapIntensity:{value:1}}]),vertexShader:ShaderChunk2.meshphysical_vert, +fragmentShader:ShaderChunk2.meshphysical_frag},toon:{uniforms:mergeUniforms2([UniformsLib2. +common,UniformsLib2.aomap,UniformsLib2.lightmap,UniformsLib2.emissivemap,UniformsLib2. +bumpmap,UniformsLib2.normalmap,UniformsLib2.displacementmap,UniformsLib2.gradientmap, +UniformsLib2.fog,UniformsLib2.lights,{emissive:{value:new Color(0)}}]),vertexShader:ShaderChunk2. +meshtoon_vert,fragmentShader:ShaderChunk2.meshtoon_frag},matcap:{uniforms:mergeUniforms2( +[UniformsLib2.common,UniformsLib2.bumpmap,UniformsLib2.normalmap,UniformsLib2.displacementmap, +UniformsLib2.fog,{matcap:{value:null}}]),vertexShader:ShaderChunk2.meshmatcap_vert, +fragmentShader:ShaderChunk2.meshmatcap_frag},points:{uniforms:mergeUniforms2([UniformsLib2. +points,UniformsLib2.fog]),vertexShader:ShaderChunk2.points_vert,fragmentShader:ShaderChunk2. +points_frag},dashed:{uniforms:mergeUniforms2([UniformsLib2.common,UniformsLib2.fog, +{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ShaderChunk2. +linedashed_vert,fragmentShader:ShaderChunk2.linedashed_frag},depth:{uniforms:mergeUniforms2( +[UniformsLib2.common,UniformsLib2.displacementmap]),vertexShader:ShaderChunk2.depth_vert, +fragmentShader:ShaderChunk2.depth_frag},normal:{uniforms:mergeUniforms2([UniformsLib2. +common,UniformsLib2.bumpmap,UniformsLib2.normalmap,UniformsLib2.displacementmap, +{opacity:{value:1}}]),vertexShader:ShaderChunk2.meshnormal_vert,fragmentShader:ShaderChunk2. +meshnormal_frag},sprite:{uniforms:mergeUniforms2([UniformsLib2.sprite,UniformsLib2. +fog]),vertexShader:ShaderChunk2.sprite_vert,fragmentShader:ShaderChunk2.sprite_frag}, +background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null},backgroundIntensity:{ +value:1}},vertexShader:ShaderChunk2.background_vert,fragmentShader:ShaderChunk2. +background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1}, +backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ShaderChunk2. +backgroundCube_vert,fragmentShader:ShaderChunk2.backgroundCube_frag},cube:{uniforms:{ +tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ShaderChunk2. +cube_vert,fragmentShader:ShaderChunk2.cube_frag},equirect:{uniforms:{tEquirect:{ +value:null}},vertexShader:ShaderChunk2.equirect_vert,fragmentShader:ShaderChunk2. +equirect_frag},distanceRGBA:{uniforms:mergeUniforms2([UniformsLib2.common,UniformsLib2. +displacementmap,{referencePosition:{value:new Vector3},nearDistance:{value:1},farDistance:{ +value:1e3}}]),vertexShader:ShaderChunk2.distanceRGBA_vert,fragmentShader:ShaderChunk2. +distanceRGBA_frag},shadow:{uniforms:mergeUniforms2([UniformsLib2.lights,UniformsLib2. +fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:ShaderChunk2.shadow_vert, +fragmentShader:ShaderChunk2.shadow_frag}};ShaderLib2.physical={uniforms:mergeUniforms2( +[ShaderLib2.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{ +value:new Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{ +value:new Matrix3},clearcoatNormalScale:{value:new Vector2(1,1)},clearcoatRoughness:{ +value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Matrix3}, +iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Matrix3}, +iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{ +value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{ +value:new Matrix3},sheen:{value:0},sheenColor:{value:new Color(0)},sheenColorMap:{ +value:null},sheenColorMapTransform:{value:new Matrix3},sheenRoughness:{value:1}, +sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Matrix3},transmission:{ +value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Matrix3}, +transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null}, +thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Matrix3}, +attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularColor:{ +value:new Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{ +value:new Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null}, +specularIntensityMapTransform:{value:new Matrix3},anisotropyVector:{value:new Vector2}, +anisotropyMap:{value:null},anisotropyMapTransform:{value:new Matrix3}}]),vertexShader:ShaderChunk2. +meshphysical_vert,fragmentShader:ShaderChunk2.meshphysical_frag};var _rgb2={r:0,b:0,g:0};function WebGLBackground2(renderer,cubemaps,cubeuvmaps,state,objects,alpha,premultipliedAlpha){ +let clearColor=new Color(0),clearAlpha=alpha===!0?0:1,planeMesh,boxMesh,currentBackground=null, +currentBackgroundVersion=0,currentTonemapping=null;function render2(renderList,scene2){ +let forceClear=!1,background=scene2.isScene===!0?scene2.background:null;background&& +background.isTexture&&(background=(scene2.backgroundBlurriness>0?cubeuvmaps:cubemaps). +get(background)),background===null?setClear(clearColor,clearAlpha):background&&background. +isColor&&(setClear(background,1),forceClear=!0);let environmentBlendMode=renderer. +xr.getEnvironmentBlendMode();environmentBlendMode==="additive"?state.buffers.color. +setClear(0,0,0,1,premultipliedAlpha):environmentBlendMode==="alpha-blend"&&state. +buffers.color.setClear(0,0,0,0,premultipliedAlpha),(renderer.autoClear||forceClear)&& +renderer.clear(renderer.autoClearColor,renderer.autoClearDepth,renderer.autoClearStencil), +background&&(background.isCubeTexture||background.mapping===CubeUVReflectionMapping)? +(boxMesh===void 0&&(boxMesh=new Mesh(new BoxGeometry(1,1,1),new ShaderMaterial2( +{name:"BackgroundCubeMaterial",uniforms:cloneUniforms2(ShaderLib2.backgroundCube. +uniforms),vertexShader:ShaderLib2.backgroundCube.vertexShader,fragmentShader:ShaderLib2. +backgroundCube.fragmentShader,side:BackSide,depthTest:!1,depthWrite:!1,fog:!1})), +boxMesh.geometry.deleteAttribute("normal"),boxMesh.geometry.deleteAttribute("uv"), +boxMesh.onBeforeRender=function(renderer2,scene3,camera){this.matrixWorld.copyPosition( +camera.matrixWorld)},Object.defineProperty(boxMesh.material,"envMap",{get:function(){ +return this.uniforms.envMap.value}}),objects.update(boxMesh)),boxMesh.material.uniforms. +envMap.value=background,boxMesh.material.uniforms.flipEnvMap.value=background.isCubeTexture&& +background.isRenderTargetTexture===!1?-1:1,boxMesh.material.uniforms.backgroundBlurriness. +value=scene2.backgroundBlurriness,boxMesh.material.uniforms.backgroundIntensity. +value=scene2.backgroundIntensity,boxMesh.material.toneMapped=ColorManagement.getTransfer( +background.colorSpace)!==SRGBTransfer,(currentBackground!==background||currentBackgroundVersion!== +background.version||currentTonemapping!==renderer.toneMapping)&&(boxMesh.material. +needsUpdate=!0,currentBackground=background,currentBackgroundVersion=background. +version,currentTonemapping=renderer.toneMapping),boxMesh.layers.enableAll(),renderList. +unshift(boxMesh,boxMesh.geometry,boxMesh.material,0,0,null)):background&&background. +isTexture&&(planeMesh===void 0&&(planeMesh=new Mesh(new PlaneGeometry(2,2),new ShaderMaterial2( +{name:"BackgroundMaterial",uniforms:cloneUniforms2(ShaderLib2.background.uniforms), +vertexShader:ShaderLib2.background.vertexShader,fragmentShader:ShaderLib2.background. +fragmentShader,side:FrontSide,depthTest:!1,depthWrite:!1,fog:!1})),planeMesh.geometry. +deleteAttribute("normal"),Object.defineProperty(planeMesh.material,"map",{get:function(){ +return this.uniforms.t2D.value}}),objects.update(planeMesh)),planeMesh.material. +uniforms.t2D.value=background,planeMesh.material.uniforms.backgroundIntensity.value= +scene2.backgroundIntensity,planeMesh.material.toneMapped=ColorManagement.getTransfer( +background.colorSpace)!==SRGBTransfer,background.matrixAutoUpdate===!0&&background. +updateMatrix(),planeMesh.material.uniforms.uvTransform.value.copy(background.matrix), +(currentBackground!==background||currentBackgroundVersion!==background.version|| +currentTonemapping!==renderer.toneMapping)&&(planeMesh.material.needsUpdate=!0,currentBackground= +background,currentBackgroundVersion=background.version,currentTonemapping=renderer. +toneMapping),planeMesh.layers.enableAll(),renderList.unshift(planeMesh,planeMesh. +geometry,planeMesh.material,0,0,null))}__name(render2,"render");function setClear(color,alpha2){ +color.getRGB(_rgb2,getUnlitUniformColorSpace2(renderer)),state.buffers.color.setClear( +_rgb2.r,_rgb2.g,_rgb2.b,alpha2,premultipliedAlpha)}return __name(setClear,"setCl\ +ear"),{getClearColor:function(){return clearColor},setClearColor:function(color,alpha2=1){ +clearColor.set(color),clearAlpha=alpha2,setClear(clearColor,clearAlpha)},getClearAlpha:function(){ +return clearAlpha},setClearAlpha:function(alpha2){clearAlpha=alpha2,setClear(clearColor, +clearAlpha)},render:render2}}__name(WebGLBackground2,"WebGLBackground");function WebGLBindingStates2(gl,extensions,attributes,capabilities){let maxVertexAttributes=gl. +getParameter(gl.MAX_VERTEX_ATTRIBS),extension=capabilities.isWebGL2?null:extensions. +get("OES_vertex_array_object"),vaoAvailable=capabilities.isWebGL2||extension!==null, +bindingStates={},defaultState=createBindingState(null),currentState=defaultState, +forceUpdate=!1;function setup(object,material,program,geometry,index){let updateBuffers=!1; +if(vaoAvailable){let state=getBindingState(geometry,program,material);currentState!== +state&&(currentState=state,bindVertexArrayObject(currentState.object)),updateBuffers= +needsUpdate(object,geometry,program,index),updateBuffers&&saveCache(object,geometry, +program,index)}else{let wireframe=material.wireframe===!0;(currentState.geometry!== +geometry.id||currentState.program!==program.id||currentState.wireframe!==wireframe)&& +(currentState.geometry=geometry.id,currentState.program=program.id,currentState. +wireframe=wireframe,updateBuffers=!0)}index!==null&&attributes.update(index,gl.ELEMENT_ARRAY_BUFFER), +(updateBuffers||forceUpdate)&&(forceUpdate=!1,setupVertexAttributes(object,material, +program,geometry),index!==null&&gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,attributes. +get(index).buffer))}__name(setup,"setup");function createVertexArrayObject(){return capabilities. +isWebGL2?gl.createVertexArray():extension.createVertexArrayOES()}__name(createVertexArrayObject, +"createVertexArrayObject");function bindVertexArrayObject(vao){return capabilities. +isWebGL2?gl.bindVertexArray(vao):extension.bindVertexArrayOES(vao)}__name(bindVertexArrayObject, +"bindVertexArrayObject");function deleteVertexArrayObject(vao){return capabilities. +isWebGL2?gl.deleteVertexArray(vao):extension.deleteVertexArrayOES(vao)}__name(deleteVertexArrayObject, +"deleteVertexArrayObject");function getBindingState(geometry,program,material){let wireframe=material. +wireframe===!0,programMap=bindingStates[geometry.id];programMap===void 0&&(programMap= +{},bindingStates[geometry.id]=programMap);let stateMap=programMap[program.id];stateMap=== +void 0&&(stateMap={},programMap[program.id]=stateMap);let state=stateMap[wireframe]; +return state===void 0&&(state=createBindingState(createVertexArrayObject()),stateMap[wireframe]= +state),state}__name(getBindingState,"getBindingState");function createBindingState(vao){ +let newAttributes=[],enabledAttributes=[],attributeDivisors=[];for(let i2=0;i2=0){let cachedAttribute=cachedAttributes[name2], +geometryAttribute=geometryAttributes[name2];if(geometryAttribute===void 0&&(name2=== +"instanceMatrix"&&object.instanceMatrix&&(geometryAttribute=object.instanceMatrix), +name2==="instanceColor"&&object.instanceColor&&(geometryAttribute=object.instanceColor)), +cachedAttribute===void 0||cachedAttribute.attribute!==geometryAttribute||geometryAttribute&& +cachedAttribute.data!==geometryAttribute.data)return!0;attributesNum++}return currentState. +attributesNum!==attributesNum||currentState.index!==index}__name(needsUpdate,"ne\ +edsUpdate");function saveCache(object,geometry,program,index){let cache2={},attributes2=geometry. +attributes,attributesNum=0,programAttributes=program.getAttributes();for(let name2 in programAttributes) +if(programAttributes[name2].location>=0){let attribute2=attributes2[name2];attribute2=== +void 0&&(name2==="instanceMatrix"&&object.instanceMatrix&&(attribute2=object.instanceMatrix), +name2==="instanceColor"&&object.instanceColor&&(attribute2=object.instanceColor)); +let data={};data.attribute=attribute2,attribute2&&attribute2.data&&(data.data=attribute2. +data),cache2[name2]=data,attributesNum++}currentState.attributes=cache2,currentState. +attributesNum=attributesNum,currentState.index=index}__name(saveCache,"saveCache"); +function initAttributes(){let newAttributes=currentState.newAttributes;for(let i2=0, +il=newAttributes.length;i2=0){let geometryAttribute=geometryAttributes[name2]; +if(geometryAttribute===void 0&&(name2==="instanceMatrix"&&object.instanceMatrix&& +(geometryAttribute=object.instanceMatrix),name2==="instanceColor"&&object.instanceColor&& +(geometryAttribute=object.instanceColor)),geometryAttribute!==void 0){let normalized=geometryAttribute. +normalized,size3=geometryAttribute.itemSize,attribute2=attributes.get(geometryAttribute); +if(attribute2===void 0)continue;let buffer=attribute2.buffer,type=attribute2.type, +bytesPerElement=attribute2.bytesPerElement,integer=capabilities.isWebGL2===!0&&(type=== +gl.INT||type===gl.UNSIGNED_INT||geometryAttribute.gpuType===IntType);if(geometryAttribute. +isInterleavedBufferAttribute){let data=geometryAttribute.data,stride=data.stride, +offset=geometryAttribute.offset;if(data.isInstancedInterleavedBuffer){for(let i2=0;i2< +programAttribute.locationSize;i2++)enableAttributeAndDivisor(programAttribute.location+ +i2,data.meshPerAttribute);object.isInstancedMesh!==!0&&geometry._maxInstanceCount=== +void 0&&(geometry._maxInstanceCount=data.meshPerAttribute*data.count)}else for(let i2=0;i2< +programAttribute.locationSize;i2++)enableAttribute(programAttribute.location+i2); +gl.bindBuffer(gl.ARRAY_BUFFER,buffer);for(let i2=0;i20&&gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, +gl.HIGH_FLOAT).precision>0)return"highp";precision2="mediump"}return precision2=== +"mediump"&&gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.MEDIUM_FLOAT).precision> +0&&gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.MEDIUM_FLOAT).precision>0?"\ +mediump":"lowp"}__name(getMaxPrecision,"getMaxPrecision");let isWebGL2=typeof WebGL2RenderingContext< +"u"&&gl.constructor.name==="WebGL2RenderingContext",precision=parameters.precision!== +void 0?parameters.precision:"highp",maxPrecision=getMaxPrecision(precision);maxPrecision!== +precision&&(console.warn("THREE.WebGLRenderer:",precision,"not supported, using", +maxPrecision,"instead."),precision=maxPrecision);let drawBuffers=isWebGL2||extensions. +has("WEBGL_draw_buffers"),logarithmicDepthBuffer=parameters.logarithmicDepthBuffer=== +!0,maxTextures=gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures=gl. +getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize=gl.getParameter(gl. +MAX_TEXTURE_SIZE),maxCubemapSize=gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes=gl. +getParameter(gl.MAX_VERTEX_ATTRIBS),maxVertexUniforms=gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS), +maxVaryings=gl.getParameter(gl.MAX_VARYING_VECTORS),maxFragmentUniforms=gl.getParameter( +gl.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures=maxVertexTextures>0,floatFragmentTextures=isWebGL2|| +extensions.has("OES_texture_float"),floatVertexTextures=vertexTextures&&floatFragmentTextures, +maxSamples=isWebGL2?gl.getParameter(gl.MAX_SAMPLES):0;return{isWebGL2,drawBuffers, +getMaxAnisotropy,getMaxPrecision,precision,logarithmicDepthBuffer,maxTextures,maxVertexTextures, +maxTextureSize,maxCubemapSize,maxAttributes,maxVertexUniforms,maxVaryings,maxFragmentUniforms, +vertexTextures,floatFragmentTextures,floatVertexTextures,maxSamples}}__name(WebGLCapabilities2, +"WebGLCapabilities");function WebGLClipping2(properties){let scope=this,globalState=null,numGlobalPlanes=0, +localClippingEnabled=!1,renderingShadows=!1,plane=new Plane,viewNormalMatrix=new Matrix3, +uniform={value:null,needsUpdate:!1};this.uniform=uniform,this.numPlanes=0,this.numIntersection= +0,this.init=function(planes,enableLocalClipping){let enabled=planes.length!==0|| +enableLocalClipping||numGlobalPlanes!==0||localClippingEnabled;return localClippingEnabled= +enableLocalClipping,numGlobalPlanes=planes.length,enabled},this.beginShadows=function(){ +renderingShadows=!0,projectPlanes(null)},this.endShadows=function(){renderingShadows= +!1},this.setGlobalState=function(planes,camera){globalState=projectPlanes(planes, +camera,0)},this.setState=function(material,camera,useCache){let planes=material. +clippingPlanes,clipIntersection=material.clipIntersection,clipShadows=material.clipShadows, +materialProperties=properties.get(material);if(!localClippingEnabled||planes===null|| +planes.length===0||renderingShadows&&!clipShadows)renderingShadows?projectPlanes( +null):resetGlobalState();else{let nGlobal=renderingShadows?0:numGlobalPlanes,lGlobal=nGlobal* +4,dstArray=materialProperties.clippingState||null;uniform.value=dstArray,dstArray= +projectPlanes(planes,camera,lGlobal,useCache);for(let i2=0;i2!==lGlobal;++i2)dstArray[i2]= +globalState[i2];materialProperties.clippingState=dstArray,this.numIntersection=clipIntersection? +this.numPlanes:0,this.numPlanes+=nGlobal}};function resetGlobalState(){uniform.value!== +globalState&&(uniform.value=globalState,uniform.needsUpdate=numGlobalPlanes>0),scope. +numPlanes=numGlobalPlanes,scope.numIntersection=0}__name(resetGlobalState,"reset\ +GlobalState");function projectPlanes(planes,camera,dstOffset,skipTransform){let nPlanes=planes!== +null?planes.length:0,dstArray=null;if(nPlanes!==0){if(dstArray=uniform.value,skipTransform!== +!0||dstArray===null){let flatSize=dstOffset+nPlanes*4,viewMatrix=camera.matrixWorldInverse; +viewNormalMatrix.getNormalMatrix(viewMatrix),(dstArray===null||dstArray.length + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},geometry=new BoxGeometry(5,5,5),material=new ShaderMaterial2({name:"Cubema\ +pFromEquirect",uniforms:cloneUniforms2(shader.uniforms),vertexShader:shader.vertexShader, +fragmentShader:shader.fragmentShader,side:BackSide,blending:NoBlending});material. +uniforms.tEquirect.value=texture;let mesh=new Mesh(geometry,material),currentMinFilter=texture. +minFilter;return texture.minFilter===LinearMipmapLinearFilter&&(texture.minFilter= +LinearFilter),new CubeCamera2(1,10,this).update(renderer,mesh),texture.minFilter= +currentMinFilter,mesh.geometry.dispose(),mesh.material.dispose(),this}clear(renderer,color,depth,stencil){ +let currentRenderTarget=renderer.getRenderTarget();for(let i2=0;i2<6;i2++)renderer. +setRenderTarget(this,i2),renderer.clear(color,depth,stencil);renderer.setRenderTarget( +currentRenderTarget)}};function WebGLCubeMaps2(renderer){let cubemaps=new WeakMap;function mapTextureMapping(texture,mapping){ +return mapping===EquirectangularReflectionMapping?texture.mapping=CubeReflectionMapping: +mapping===EquirectangularRefractionMapping&&(texture.mapping=CubeRefractionMapping), +texture}__name(mapTextureMapping,"mapTextureMapping");function get(texture){if(texture&& +texture.isTexture){let mapping=texture.mapping;if(mapping===EquirectangularReflectionMapping|| +mapping===EquirectangularRefractionMapping)if(cubemaps.has(texture)){let cubemap=cubemaps. +get(texture).texture;return mapTextureMapping(cubemap,texture.mapping)}else{let image=texture. +image;if(image&&image.height>0){let renderTarget=new WebGLCubeRenderTarget2(image. +height/2);return renderTarget.fromEquirectangularTexture(renderer,texture),cubemaps. +set(texture,renderTarget),texture.addEventListener("dispose",onTextureDispose),mapTextureMapping( +renderTarget.texture,texture.mapping)}else return null}}return texture}__name(get, +"get");function onTextureDispose(event){let texture=event.target;texture.removeEventListener( +"dispose",onTextureDispose);let cubemap=cubemaps.get(texture);cubemap!==void 0&& +(cubemaps.delete(texture),cubemap.dispose())}__name(onTextureDispose,"onTextureD\ +ispose");function dispose(){cubemaps=new WeakMap}return __name(dispose,"dispose"), +{get,dispose}}__name(WebGLCubeMaps2,"WebGLCubeMaps");var LOD_MIN2=4,EXTRA_LOD_SIGMA2=[.125,.215,.35,.446,.526,.582],MAX_SAMPLES2=20,_flatCamera2=new OrthographicCamera2, +_clearColor2=new Color,_oldTarget2=null,_oldActiveCubeFace2=0,_oldActiveMipmapLevel2=0, +PHI2=(1+Math.sqrt(5))/2,INV_PHI2=1/PHI2,_axisDirections2=[new Vector3(1,1,1),new Vector3( +-1,1,1),new Vector3(1,1,-1),new Vector3(-1,1,-1),new Vector3(0,PHI2,INV_PHI2),new Vector3( +0,PHI2,-INV_PHI2),new Vector3(INV_PHI2,0,PHI2),new Vector3(-INV_PHI2,0,PHI2),new Vector3( +PHI2,INV_PHI2,0),new Vector3(-PHI2,INV_PHI2,0)],PMREMGenerator2=class{static{__name( +this,"PMREMGenerator")}constructor(renderer){this._renderer=renderer,this._pingPongRenderTarget= +null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas= +[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null, +this._compileMaterial(this._blurMaterial)}fromScene(scene2,sigma=0,near=.1,far=100){ +_oldTarget2=this._renderer.getRenderTarget(),_oldActiveCubeFace2=this._renderer. +getActiveCubeFace(),_oldActiveMipmapLevel2=this._renderer.getActiveMipmapLevel(), +this._setSize(256);let cubeUVRenderTarget=this._allocateTargets();return cubeUVRenderTarget. +depthBuffer=!0,this._sceneToCubeUV(scene2,near,far,cubeUVRenderTarget),sigma>0&& +this._blur(cubeUVRenderTarget,0,0,sigma),this._applyPMREM(cubeUVRenderTarget),this. +_cleanup(cubeUVRenderTarget),cubeUVRenderTarget}fromEquirectangular(equirectangular,renderTarget=null){ +return this._fromTexture(equirectangular,renderTarget)}fromCubemap(cubemap,renderTarget=null){ +return this._fromTexture(cubemap,renderTarget)}compileCubemapShader(){this._cubemapMaterial=== +null&&(this._cubemapMaterial=_getCubemapMaterial2(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){ +this._equirectMaterial===null&&(this._equirectMaterial=_getEquirectMaterial2(),this. +_compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!== +null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial. +dispose()}_setSize(cubeSize){this._lodMax=Math.floor(Math.log2(cubeSize)),this._cubeSize= +Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial. +dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose(); +for(let i2=0;i22?size3:0, +size3,size3),renderer.setRenderTarget(cubeUVRenderTarget),useSolidColor&&renderer. +render(backgroundBox,cubeCamera),renderer.render(scene2,cubeCamera)}backgroundBox. +geometry.dispose(),backgroundBox.material.dispose(),renderer.toneMapping=toneMapping, +renderer.autoClear=originalAutoClear,scene2.background=background}_textureToCubeUV(texture,cubeUVRenderTarget){ +let renderer=this._renderer,isCubeTexture=texture.mapping===CubeReflectionMapping|| +texture.mapping===CubeRefractionMapping;isCubeTexture?(this._cubemapMaterial===null&& +(this._cubemapMaterial=_getCubemapMaterial2()),this._cubemapMaterial.uniforms.flipEnvMap. +value=texture.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this. +_equirectMaterial=_getEquirectMaterial2());let material=isCubeTexture?this._cubemapMaterial: +this._equirectMaterial,mesh=new Mesh(this._lodPlanes[0],material),uniforms=material. +uniforms;uniforms.envMap.value=texture;let size3=this._cubeSize;_setViewport2(cubeUVRenderTarget, +0,0,3*size3,2*size3),renderer.setRenderTarget(cubeUVRenderTarget),renderer.render( +mesh,_flatCamera2)}_applyPMREM(cubeUVRenderTarget){let renderer=this._renderer,autoClear=renderer. +autoClear;renderer.autoClear=!1;for(let i2=1;i2 +MAX_SAMPLES2&&console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will\ + clip, as it requested ${samples} samples when the maximum is set to ${MAX_SAMPLES2}`); +let weights=[],sum=0;for(let i2=0;i2_lodMax-LOD_MIN2?lodOut-_lodMax+LOD_MIN2:0),y2=4*(this._cubeSize- +outputSize);_setViewport2(targetOut,x2,y2,3*outputSize,2*outputSize),renderer.setRenderTarget( +targetOut),renderer.render(blurMesh,_flatCamera2)}};function _createPlanes2(lodMax){ +let lodPlanes=[],sizeLods=[],sigmas=[],lod=lodMax,totalLods=lodMax-LOD_MIN2+1+EXTRA_LOD_SIGMA2. +length;for(let i2=0;i2lodMax-LOD_MIN2?sigma=EXTRA_LOD_SIGMA2[i2-lodMax+ +LOD_MIN2-1]:i2===0&&(sigma=0),sigmas.push(sigma);let texelSize=1/(sizeLod-2),min=-texelSize, +max2=1+texelSize,uv1=[min,min,max2,min,max2,max2,min,min,max2,max2,min,max2],cubeFaces=6, +vertices=6,positionSize=3,uvSize=2,faceIndexSize=1,position2=new Float32Array(positionSize* +vertices*cubeFaces),uv=new Float32Array(uvSize*vertices*cubeFaces),faceIndex=new Float32Array( +faceIndexSize*vertices*cubeFaces);for(let face=0;face2?0:-1,coordinates=[x2,y2,0,x2+2/3,y2,0,x2+2/3,y2+1,0,x2,y2,0,x2+ +2/3,y2+1,0,x2,y2+1,0];position2.set(coordinates,positionSize*vertices*face),uv.set( +uv1,uvSize*vertices*face);let fill=[face,face,face,face,face,face];faceIndex.set( +fill,faceIndexSize*vertices*face)}let planes=new BufferGeometry;planes.setAttribute( +"position",new BufferAttribute(position2,positionSize)),planes.setAttribute("uv", +new BufferAttribute(uv,uvSize)),planes.setAttribute("faceIndex",new BufferAttribute( +faceIndex,faceIndexSize)),lodPlanes.push(planes),lod>LOD_MIN2&&lod--}return{lodPlanes, +sizeLods,sigmas}}__name(_createPlanes2,"_createPlanes");function _createRenderTarget2(width,height,params){ +let cubeUVRenderTarget=new WebGLRenderTarget2(width,height,params);return cubeUVRenderTarget. +texture.mapping=CubeUVReflectionMapping,cubeUVRenderTarget.texture.name="PMREM.c\ +ubeUv",cubeUVRenderTarget.scissorTest=!0,cubeUVRenderTarget}__name(_createRenderTarget2, +"_createRenderTarget");function _setViewport2(target,x2,y2,width,height){target. +viewport.set(x2,y2,width,height),target.scissor.set(x2,y2,width,height)}__name(_setViewport2, +"_setViewport");function _getBlurShader2(lodMax,width,height){let weights=new Float32Array( +MAX_SAMPLES2),poleAxis=new Vector3(0,1,0);return new ShaderMaterial2({name:"Sphe\ +ricalGaussianBlur",defines:{n:MAX_SAMPLES2,CUBEUV_TEXEL_WIDTH:1/width,CUBEUV_TEXEL_HEIGHT:1/ +height,CUBEUV_MAX_MIP:`${lodMax}.0`},uniforms:{envMap:{value:null},samples:{value:1}, +weights:{value:weights},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0}, +poleAxis:{value:poleAxis}},vertexShader:_getCommonVertexShader2(),fragmentShader:`\ + + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:NoBlending,depthTest:!1,depthWrite:!1})}__name(_getBlurShader2,"_ge\ +tBlurShader");function _getEquirectMaterial2(){return new ShaderMaterial2({name:"\ +EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader2(), +fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:NoBlending,depthTest:!1,depthWrite:!1})}__name(_getEquirectMaterial2, +"_getEquirectMaterial");function _getCubemapMaterial2(){return new ShaderMaterial2( +{name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader2(), +fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, v\ +OutputDirection.yz ) ); + + } + `,blending:NoBlending,depthTest:!1,depthWrite:!1})}__name(_getCubemapMaterial2, +"_getCubemapMaterial");function _getCommonVertexShader2(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}__name(_getCommonVertexShader2,"_getCommonVertexShader");function WebGLCubeUVMaps2(renderer){let cubeUVmaps=new WeakMap,pmremGenerator=null; +function get(texture){if(texture&&texture.isTexture){let mapping=texture.mapping, +isEquirectMap=mapping===EquirectangularReflectionMapping||mapping===EquirectangularRefractionMapping, +isCubeMap=mapping===CubeReflectionMapping||mapping===CubeRefractionMapping;if(isEquirectMap|| +isCubeMap)if(texture.isRenderTargetTexture&&texture.needsPMREMUpdate===!0){texture. +needsPMREMUpdate=!1;let renderTarget=cubeUVmaps.get(texture);return pmremGenerator=== +null&&(pmremGenerator=new PMREMGenerator2(renderer)),renderTarget=isEquirectMap? +pmremGenerator.fromEquirectangular(texture,renderTarget):pmremGenerator.fromCubemap( +texture,renderTarget),cubeUVmaps.set(texture,renderTarget),renderTarget.texture}else{ +if(cubeUVmaps.has(texture))return cubeUVmaps.get(texture).texture;{let image=texture. +image;if(isEquirectMap&&image&&image.height>0||isCubeMap&&image&&isCubeTextureComplete( +image)){pmremGenerator===null&&(pmremGenerator=new PMREMGenerator2(renderer));let renderTarget=isEquirectMap? +pmremGenerator.fromEquirectangular(texture):pmremGenerator.fromCubemap(texture); +return cubeUVmaps.set(texture,renderTarget),texture.addEventListener("dispose",onTextureDispose), +renderTarget.texture}else return null}}}return texture}__name(get,"get");function isCubeTextureComplete(image){ +let count=0,length=6;for(let i2=0;i2capabilities.maxTextureSize&&(height=Math.ceil( +width/capabilities.maxTextureSize),width=capabilities.maxTextureSize);let buffer=new Float32Array( +width*height*4*morphTargetsCount),texture=new DataArrayTexture2(buffer,width,height, +morphTargetsCount);texture.type=FloatType,texture.needsUpdate=!0;let vertexDataStride=vertexDataCount* +4;for(let i2=0;i20)return array;let n=nBlocks*blockSize, +r3=arrayCacheF322[n];if(r3===void 0&&(r3=new Float32Array(n),arrayCacheF322[n]=r3), +nBlocks!==0){firstElem.toArray(r3,0);for(let i2=1,offset=0;i2!==nBlocks;++i2)offset+= +blockSize,array[i2].toArray(r3,offset)}return r3}__name(flatten2,"flatten");function arraysEqual2(a,b){ +if(a.length!==b.length)return!1;for(let i2=0,l=a.length;i2":" "}\ + ${line}: ${lines[i2]}`)}return lines2.join(` +`)}__name(handleSource2,"handleSource");function getEncodingComponents2(colorSpace){ +let workingPrimaries=ColorManagement.getPrimaries(ColorManagement.workingColorSpace), +encodingPrimaries=ColorManagement.getPrimaries(colorSpace),gamutMapping;switch(workingPrimaries=== +encodingPrimaries?gamutMapping="":workingPrimaries===P3Primaries&&encodingPrimaries=== +Rec709Primaries?gamutMapping="LinearDisplayP3ToLinearSRGB":workingPrimaries===Rec709Primaries&& +encodingPrimaries===P3Primaries&&(gamutMapping="LinearSRGBToLinearDisplayP3"),colorSpace){case LinearSRGBColorSpace:case LinearDisplayP3ColorSpace: +return[gamutMapping,"LinearTransferOETF"];case SRGBColorSpace:case DisplayP3ColorSpace: +return[gamutMapping,"sRGBTransferOETF"];default:return console.warn("THREE.WebGL\ +Program: Unsupported color space:",colorSpace),[gamutMapping,"LinearTransferOETF"]}} +__name(getEncodingComponents2,"getEncodingComponents");function getShaderErrors2(gl,shader,type){ +let status=gl.getShaderParameter(shader,gl.COMPILE_STATUS),errors=gl.getShaderInfoLog( +shader).trim();if(status&&errors==="")return"";let errorMatches=/ERROR: 0:(\d+)/. +exec(errors);if(errorMatches){let errorLine=parseInt(errorMatches[1]);return type. +toUpperCase()+` + +`+errors+` + +`+handleSource2(gl.getShaderSource(shader),errorLine)}else return errors}__name( +getShaderErrors2,"getShaderErrors");function getTexelEncodingFunction2(functionName,colorSpace){ +let components=getEncodingComponents2(colorSpace);return`vec4 ${functionName}( v\ +ec4 value ) { return ${components[0]}( ${components[1]}( value ) ); }`}__name(getTexelEncodingFunction2, +"getTexelEncodingFunction");function getToneMappingFunction2(functionName,toneMapping){ +let toneMappingName;switch(toneMapping){case LinearToneMapping:toneMappingName="\ +Linear";break;case ReinhardToneMapping:toneMappingName="Reinhard";break;case CineonToneMapping: +toneMappingName="OptimizedCineon";break;case ACESFilmicToneMapping:toneMappingName= +"ACESFilmic";break;case AgXToneMapping:toneMappingName="AgX";break;case CustomToneMapping: +toneMappingName="Custom";break;default:console.warn("THREE.WebGLProgram: Unsuppo\ +rted toneMapping:",toneMapping),toneMappingName="Linear"}return"vec3 "+functionName+ +"( vec3 color ) { return "+toneMappingName+"ToneMapping( color ); }"}__name(getToneMappingFunction2, +"getToneMappingFunction");function generateExtensions2(parameters){return[parameters. +extensionDerivatives||parameters.envMapCubeUVHeight||parameters.bumpMap||parameters. +normalMapTangentSpace||parameters.clearcoatNormalMap||parameters.flatShading||parameters. +shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(parameters. +extensionFragDepth||parameters.logarithmicDepthBuffer)&¶meters.rendererExtensionFragDepth? +"#extension GL_EXT_frag_depth : enable":"",parameters.extensionDrawBuffers&¶meters. +rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(parameters. +extensionShaderTextureLOD||parameters.envMap||parameters.transmission)&¶meters. +rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable": +""].filter(filterEmptyLine2).join(` +`)}__name(generateExtensions2,"generateExtensions");function generateVertexExtensions2(parameters){ +return[parameters.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_dista\ +nce : require":""].filter(filterEmptyLine2).join(` +`)}__name(generateVertexExtensions2,"generateVertexExtensions");function generateDefines2(defines){ +let chunks=[];for(let name2 in defines){let value=defines[name2];value!==!1&&chunks. +push("#define "+name2+" "+value)}return chunks.join(` +`)}__name(generateDefines2,"generateDefines");function fetchAttributeLocations2(gl,program){ +let attributes={},n=gl.getProgramParameter(program,gl.ACTIVE_ATTRIBUTES);for(let i2=0;i2< +n;i2++){let info=gl.getActiveAttrib(program,i2),name2=info.name,locationSize=1;info. +type===gl.FLOAT_MAT2&&(locationSize=2),info.type===gl.FLOAT_MAT3&&(locationSize= +3),info.type===gl.FLOAT_MAT4&&(locationSize=4),attributes[name2]={type:info.type, +location:gl.getAttribLocation(program,name2),locationSize}}return attributes}__name( +fetchAttributeLocations2,"fetchAttributeLocations");function filterEmptyLine2(string){ +return string!==""}__name(filterEmptyLine2,"filterEmptyLine");function replaceLightNums2(string,parameters){ +let numSpotLightCoords=parameters.numSpotLightShadows+parameters.numSpotLightMaps- +parameters.numSpotLightShadowsWithMaps;return string.replace(/NUM_DIR_LIGHTS/g,parameters. +numDirLights).replace(/NUM_SPOT_LIGHTS/g,parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, +parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,numSpotLightCoords). +replace(/NUM_RECT_AREA_LIGHTS/g,parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, +parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g,parameters.numHemiLights). +replace(/NUM_DIR_LIGHT_SHADOWS/g,parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, +parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,parameters. +numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,parameters.numPointLightShadows)} +__name(replaceLightNums2,"replaceLightNums");function replaceClippingPlaneNums2(string,parameters){ +return string.replace(/NUM_CLIPPING_PLANES/g,parameters.numClippingPlanes).replace( +/UNION_CLIPPING_PLANES/g,parameters.numClippingPlanes-parameters.numClipIntersection)} +__name(replaceClippingPlaneNums2,"replaceClippingPlaneNums");var includePattern2=/^[ \t]*#include +<([\w\d./]+)>/gm; +function resolveIncludes2(string){return string.replace(includePattern2,includeReplacer2)} +__name(resolveIncludes2,"resolveIncludes");var shaderChunkMap2=new Map([["encodi\ +ngs_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars\ +_fragment"],["output_fragment","opaque_fragment"]]);function includeReplacer2(match,include){ +let string=ShaderChunk2[include];if(string===void 0){let newInclude=shaderChunkMap2. +get(include);if(newInclude!==void 0)string=ShaderChunk2[newInclude],console.warn( +'THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', +include,newInclude);else throw new Error("Can not resolve #include <"+include+">")} +return resolveIncludes2(string)}__name(includeReplacer2,"includeReplacer");var unrollLoopPattern2=/#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; +function unrollLoops2(string){return string.replace(unrollLoopPattern2,loopReplacer2)} +__name(unrollLoops2,"unrollLoops");function loopReplacer2(match,start,end,snippet){ +let string="";for(let i2=parseInt(start);i20&&(prefixVertex+=` +`),prefixFragment=[customExtensions,"#define SHADER_TYPE "+parameters.shaderType, +"#define SHADER_NAME "+parameters.shaderName,customDefines].filter(filterEmptyLine2). +join(` +`),prefixFragment.length>0&&(prefixFragment+=` +`)):(prefixVertex=[generatePrecision2(parameters),"#define SHADER_TYPE "+parameters. +shaderType,"#define SHADER_NAME "+parameters.shaderName,customDefines,parameters. +extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",parameters.batching?"#d\ +efine USE_BATCHING":"",parameters.instancing?"#define USE_INSTANCING":"",parameters. +instancingColor?"#define USE_INSTANCING_COLOR":"",parameters.useFog&¶meters. +fog?"#define USE_FOG":"",parameters.useFog&¶meters.fogExp2?"#define FOG_EXP2": +"",parameters.map?"#define USE_MAP":"",parameters.envMap?"#define USE_ENVMAP":"", +parameters.envMap?"#define "+envMapModeDefine:"",parameters.lightMap?"#define US\ +E_LIGHTMAP":"",parameters.aoMap?"#define USE_AOMAP":"",parameters.bumpMap?"#defi\ +ne USE_BUMPMAP":"",parameters.normalMap?"#define USE_NORMALMAP":"",parameters.normalMapObjectSpace? +"#define USE_NORMALMAP_OBJECTSPACE":"",parameters.normalMapTangentSpace?"#define\ + USE_NORMALMAP_TANGENTSPACE":"",parameters.displacementMap?"#define USE_DISPLACE\ +MENTMAP":"",parameters.emissiveMap?"#define USE_EMISSIVEMAP":"",parameters.anisotropy? +"#define USE_ANISOTROPY":"",parameters.anisotropyMap?"#define USE_ANISOTROPYMAP": +"",parameters.clearcoatMap?"#define USE_CLEARCOATMAP":"",parameters.clearcoatRoughnessMap? +"#define USE_CLEARCOAT_ROUGHNESSMAP":"",parameters.clearcoatNormalMap?"#define U\ +SE_CLEARCOAT_NORMALMAP":"",parameters.iridescenceMap?"#define USE_IRIDESCENCEMAP": +"",parameters.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"", +parameters.specularMap?"#define USE_SPECULARMAP":"",parameters.specularColorMap? +"#define USE_SPECULAR_COLORMAP":"",parameters.specularIntensityMap?"#define USE_\ +SPECULAR_INTENSITYMAP":"",parameters.roughnessMap?"#define USE_ROUGHNESSMAP":"", +parameters.metalnessMap?"#define USE_METALNESSMAP":"",parameters.alphaMap?"#defi\ +ne USE_ALPHAMAP":"",parameters.alphaHash?"#define USE_ALPHAHASH":"",parameters.transmission? +"#define USE_TRANSMISSION":"",parameters.transmissionMap?"#define USE_TRANSMISSI\ +ONMAP":"",parameters.thicknessMap?"#define USE_THICKNESSMAP":"",parameters.sheenColorMap? +"#define USE_SHEEN_COLORMAP":"",parameters.sheenRoughnessMap?"#define USE_SHEEN_\ +ROUGHNESSMAP":"",parameters.mapUv?"#define MAP_UV "+parameters.mapUv:"",parameters. +alphaMapUv?"#define ALPHAMAP_UV "+parameters.alphaMapUv:"",parameters.lightMapUv? +"#define LIGHTMAP_UV "+parameters.lightMapUv:"",parameters.aoMapUv?"#define AOMA\ +P_UV "+parameters.aoMapUv:"",parameters.emissiveMapUv?"#define EMISSIVEMAP_UV "+ +parameters.emissiveMapUv:"",parameters.bumpMapUv?"#define BUMPMAP_UV "+parameters. +bumpMapUv:"",parameters.normalMapUv?"#define NORMALMAP_UV "+parameters.normalMapUv: +"",parameters.displacementMapUv?"#define DISPLACEMENTMAP_UV "+parameters.displacementMapUv: +"",parameters.metalnessMapUv?"#define METALNESSMAP_UV "+parameters.metalnessMapUv: +"",parameters.roughnessMapUv?"#define ROUGHNESSMAP_UV "+parameters.roughnessMapUv: +"",parameters.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+parameters.anisotropyMapUv: +"",parameters.clearcoatMapUv?"#define CLEARCOATMAP_UV "+parameters.clearcoatMapUv: +"",parameters.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+parameters. +clearcoatNormalMapUv:"",parameters.clearcoatRoughnessMapUv?"#define CLEARCOAT_RO\ +UGHNESSMAP_UV "+parameters.clearcoatRoughnessMapUv:"",parameters.iridescenceMapUv? +"#define IRIDESCENCEMAP_UV "+parameters.iridescenceMapUv:"",parameters.iridescenceThicknessMapUv? +"#define IRIDESCENCE_THICKNESSMAP_UV "+parameters.iridescenceThicknessMapUv:"",parameters. +sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+parameters.sheenColorMapUv:"",parameters. +sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+parameters.sheenRoughnessMapUv: +"",parameters.specularMapUv?"#define SPECULARMAP_UV "+parameters.specularMapUv:"", +parameters.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+parameters.specularColorMapUv: +"",parameters.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+parameters. +specularIntensityMapUv:"",parameters.transmissionMapUv?"#define TRANSMISSIONMAP_\ +UV "+parameters.transmissionMapUv:"",parameters.thicknessMapUv?"#define THICKNES\ +SMAP_UV "+parameters.thicknessMapUv:"",parameters.vertexTangents&¶meters.flatShading=== +!1?"#define USE_TANGENT":"",parameters.vertexColors?"#define USE_COLOR":"",parameters. +vertexAlphas?"#define USE_COLOR_ALPHA":"",parameters.vertexUv1s?"#define USE_UV1": +"",parameters.vertexUv2s?"#define USE_UV2":"",parameters.vertexUv3s?"#define USE\ +_UV3":"",parameters.pointsUvs?"#define USE_POINTS_UV":"",parameters.flatShading? +"#define FLAT_SHADED":"",parameters.skinning?"#define USE_SKINNING":"",parameters. +morphTargets?"#define USE_MORPHTARGETS":"",parameters.morphNormals&¶meters.flatShading=== +!1?"#define USE_MORPHNORMALS":"",parameters.morphColors&¶meters.isWebGL2?"#d\ +efine USE_MORPHCOLORS":"",parameters.morphTargetsCount>0&¶meters.isWebGL2?"#\ +define MORPHTARGETS_TEXTURE":"",parameters.morphTargetsCount>0&¶meters.isWebGL2? +"#define MORPHTARGETS_TEXTURE_STRIDE "+parameters.morphTextureStride:"",parameters. +morphTargetsCount>0&¶meters.isWebGL2?"#define MORPHTARGETS_COUNT "+parameters. +morphTargetsCount:"",parameters.doubleSided?"#define DOUBLE_SIDED":"",parameters. +flipSided?"#define FLIP_SIDED":"",parameters.shadowMapEnabled?"#define USE_SHADO\ +WMAP":"",parameters.shadowMapEnabled?"#define "+shadowMapTypeDefine:"",parameters. +sizeAttenuation?"#define USE_SIZEATTENUATION":"",parameters.numLightProbes>0?"#d\ +efine USE_LIGHT_PROBES":"",parameters.useLegacyLights?"#define LEGACY_LIGHTS":"", +parameters.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",parameters.logarithmicDepthBuffer&& +parameters.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform \ +mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatri\ +x;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 camera\ +Position;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute ma\ +t4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 inst\ +anceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attrib\ +ute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2", +" attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif", +"#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR\ +_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3\ + color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_\ +TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," a\ +ttribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHN\ +ORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," att\ +ribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribut\ +e vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTa\ +rget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING", +" attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(filterEmptyLine2).join(` +`),prefixFragment=[customExtensions,generatePrecision2(parameters),"#define SHAD\ +ER_TYPE "+parameters.shaderType,"#define SHADER_NAME "+parameters.shaderName,customDefines, +parameters.useFog&¶meters.fog?"#define USE_FOG":"",parameters.useFog&¶meters. +fogExp2?"#define FOG_EXP2":"",parameters.map?"#define USE_MAP":"",parameters.matcap? +"#define USE_MATCAP":"",parameters.envMap?"#define USE_ENVMAP":"",parameters.envMap? +"#define "+envMapTypeDefine:"",parameters.envMap?"#define "+envMapModeDefine:"", +parameters.envMap?"#define "+envMapBlendingDefine:"",envMapCubeUVSize?"#define C\ +UBEUV_TEXEL_WIDTH "+envMapCubeUVSize.texelWidth:"",envMapCubeUVSize?"#define CUB\ +EUV_TEXEL_HEIGHT "+envMapCubeUVSize.texelHeight:"",envMapCubeUVSize?"#define CUB\ +EUV_MAX_MIP "+envMapCubeUVSize.maxMip+".0":"",parameters.lightMap?"#define USE_L\ +IGHTMAP":"",parameters.aoMap?"#define USE_AOMAP":"",parameters.bumpMap?"#define \ +USE_BUMPMAP":"",parameters.normalMap?"#define USE_NORMALMAP":"",parameters.normalMapObjectSpace? +"#define USE_NORMALMAP_OBJECTSPACE":"",parameters.normalMapTangentSpace?"#define\ + USE_NORMALMAP_TANGENTSPACE":"",parameters.emissiveMap?"#define USE_EMISSIVEMAP": +"",parameters.anisotropy?"#define USE_ANISOTROPY":"",parameters.anisotropyMap?"#\ +define USE_ANISOTROPYMAP":"",parameters.clearcoat?"#define USE_CLEARCOAT":"",parameters. +clearcoatMap?"#define USE_CLEARCOATMAP":"",parameters.clearcoatRoughnessMap?"#de\ +fine USE_CLEARCOAT_ROUGHNESSMAP":"",parameters.clearcoatNormalMap?"#define USE_C\ +LEARCOAT_NORMALMAP":"",parameters.iridescence?"#define USE_IRIDESCENCE":"",parameters. +iridescenceMap?"#define USE_IRIDESCENCEMAP":"",parameters.iridescenceThicknessMap? +"#define USE_IRIDESCENCE_THICKNESSMAP":"",parameters.specularMap?"#define USE_SP\ +ECULARMAP":"",parameters.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",parameters. +specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",parameters.roughnessMap? +"#define USE_ROUGHNESSMAP":"",parameters.metalnessMap?"#define USE_METALNESSMAP": +"",parameters.alphaMap?"#define USE_ALPHAMAP":"",parameters.alphaTest?"#define U\ +SE_ALPHATEST":"",parameters.alphaHash?"#define USE_ALPHAHASH":"",parameters.sheen? +"#define USE_SHEEN":"",parameters.sheenColorMap?"#define USE_SHEEN_COLORMAP":"", +parameters.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",parameters.transmission? +"#define USE_TRANSMISSION":"",parameters.transmissionMap?"#define USE_TRANSMISSI\ +ONMAP":"",parameters.thicknessMap?"#define USE_THICKNESSMAP":"",parameters.vertexTangents&& +parameters.flatShading===!1?"#define USE_TANGENT":"",parameters.vertexColors||parameters. +instancingColor?"#define USE_COLOR":"",parameters.vertexAlphas?"#define USE_COLO\ +R_ALPHA":"",parameters.vertexUv1s?"#define USE_UV1":"",parameters.vertexUv2s?"#d\ +efine USE_UV2":"",parameters.vertexUv3s?"#define USE_UV3":"",parameters.pointsUvs? +"#define USE_POINTS_UV":"",parameters.gradientMap?"#define USE_GRADIENTMAP":"",parameters. +flatShading?"#define FLAT_SHADED":"",parameters.doubleSided?"#define DOUBLE_SIDE\ +D":"",parameters.flipSided?"#define FLIP_SIDED":"",parameters.shadowMapEnabled?"\ +#define USE_SHADOWMAP":"",parameters.shadowMapEnabled?"#define "+shadowMapTypeDefine: +"",parameters.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",parameters.numLightProbes> +0?"#define USE_LIGHT_PROBES":"",parameters.useLegacyLights?"#define LEGACY_LIGHT\ +S":"",parameters.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",parameters. +logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",parameters.logarithmicDepthBuffer&& +parameters.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform \ +mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;", +parameters.toneMapping!==NoToneMapping?"#define TONE_MAPPING":"",parameters.toneMapping!== +NoToneMapping?ShaderChunk2.tonemapping_pars_fragment:"",parameters.toneMapping!== +NoToneMapping?getToneMappingFunction2("toneMapping",parameters.toneMapping):"",parameters. +dithering?"#define DITHERING":"",parameters.opaque?"#define OPAQUE":"",ShaderChunk2. +colorspace_pars_fragment,getTexelEncodingFunction2("linearToOutputTexel",parameters. +outputColorSpace),parameters.useDepthPacking?"#define DEPTH_PACKING "+parameters. +depthPacking:"",` +`].filter(filterEmptyLine2).join(` +`)),vertexShader=resolveIncludes2(vertexShader),vertexShader=replaceLightNums2(vertexShader, +parameters),vertexShader=replaceClippingPlaneNums2(vertexShader,parameters),fragmentShader= +resolveIncludes2(fragmentShader),fragmentShader=replaceLightNums2(fragmentShader, +parameters),fragmentShader=replaceClippingPlaneNums2(fragmentShader,parameters), +vertexShader=unrollLoops2(vertexShader),fragmentShader=unrollLoops2(fragmentShader), +parameters.isWebGL2&¶meters.isRawShaderMaterial!==!0&&(versionString=`#versi\ +on 300 es +`,prefixVertex=[customVertexExtensions,"precision mediump sampler2DArray;","#def\ +ine attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+prefixVertex,prefixFragment=["precision mediump sampler2DArray;","#define vary\ +ing in",parameters.glslVersion===GLSL3?"":"layout(location = 0) out highp vec4 p\ +c_fragColor;",parameters.glslVersion===GLSL3?"":"#define gl_FragColor pc_fragCol\ +or","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define \ +textureCube texture","#define texture2DProj textureProj","#define texture2DLodEX\ +T textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeL\ +odEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjG\ +radEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+prefixFragment);let vertexGlsl=versionString+prefixVertex+vertexShader,fragmentGlsl=versionString+ +prefixFragment+fragmentShader,glVertexShader=WebGLShader2(gl,gl.VERTEX_SHADER,vertexGlsl), +glFragmentShader=WebGLShader2(gl,gl.FRAGMENT_SHADER,fragmentGlsl);gl.attachShader( +program,glVertexShader),gl.attachShader(program,glFragmentShader),parameters.index0AttributeName!== +void 0?gl.bindAttribLocation(program,0,parameters.index0AttributeName):parameters. +morphTargets===!0&&gl.bindAttribLocation(program,0,"position"),gl.linkProgram(program); +function onFirstUse(self2){if(renderer.debug.checkShaderErrors){let programLog=gl. +getProgramInfoLog(program).trim(),vertexLog=gl.getShaderInfoLog(glVertexShader). +trim(),fragmentLog=gl.getShaderInfoLog(glFragmentShader).trim(),runnable=!0,haveDiagnostics=!0; +if(gl.getProgramParameter(program,gl.LINK_STATUS)===!1)if(runnable=!1,typeof renderer. +debug.onShaderError=="function")renderer.debug.onShaderError(gl,program,glVertexShader, +glFragmentShader);else{let vertexErrors=getShaderErrors2(gl,glVertexShader,"vert\ +ex"),fragmentErrors=getShaderErrors2(gl,glFragmentShader,"fragment");console.error( +"THREE.WebGLProgram: Shader Error "+gl.getError()+" - VALIDATE_STATUS "+gl.getProgramParameter( +program,gl.VALIDATE_STATUS)+` + +Program Info Log: `+programLog+` +`+vertexErrors+` +`+fragmentErrors)}else programLog!==""?console.warn("THREE.WebGLProgram: Program\ + Info Log:",programLog):(vertexLog===""||fragmentLog==="")&&(haveDiagnostics=!1); +haveDiagnostics&&(self2.diagnostics={runnable,programLog,vertexShader:{log:vertexLog, +prefix:prefixVertex},fragmentShader:{log:fragmentLog,prefix:prefixFragment}})}gl. +deleteShader(glVertexShader),gl.deleteShader(glFragmentShader),cachedUniforms=new WebGLUniforms2( +gl,program),cachedAttributes=fetchAttributeLocations2(gl,program)}__name(onFirstUse, +"onFirstUse");let cachedUniforms;this.getUniforms=function(){return cachedUniforms=== +void 0&&onFirstUse(this),cachedUniforms};let cachedAttributes;this.getAttributes= +function(){return cachedAttributes===void 0&&onFirstUse(this),cachedAttributes}; +let programReady=parameters.rendererExtensionParallelShaderCompile===!1;return this. +isReady=function(){return programReady===!1&&(programReady=gl.getProgramParameter( +program,COMPLETION_STATUS_KHR2)),programReady},this.destroy=function(){bindingStates. +releaseStatesOfProgram(this),gl.deleteProgram(program),this.program=void 0},this. +type=parameters.shaderType,this.name=parameters.shaderName,this.id=programIdCount2++, +this.cacheKey=cacheKey,this.usedTimes=1,this.program=program,this.vertexShader=glVertexShader, +this.fragmentShader=glFragmentShader,this}__name(WebGLProgram2,"WebGLProgram");var _id2=0,WebGLShaderCache2=class{static{__name(this,"WebGLShaderCache")}constructor(){ +this.shaderCache=new Map,this.materialCache=new Map}update(material){let vertexShader=material. +vertexShader,fragmentShader=material.fragmentShader,vertexShaderStage=this._getShaderStage( +vertexShader),fragmentShaderStage=this._getShaderStage(fragmentShader),materialShaders=this. +_getShaderCacheForMaterial(material);return materialShaders.has(vertexShaderStage)=== +!1&&(materialShaders.add(vertexShaderStage),vertexShaderStage.usedTimes++),materialShaders. +has(fragmentShaderStage)===!1&&(materialShaders.add(fragmentShaderStage),fragmentShaderStage. +usedTimes++),this}remove(material){let materialShaders=this.materialCache.get(material); +for(let shaderStage of materialShaders)shaderStage.usedTimes--,shaderStage.usedTimes=== +0&&this.shaderCache.delete(shaderStage.code);return this.materialCache.delete(material), +this}getVertexShaderID(material){return this._getShaderStage(material.vertexShader). +id}getFragmentShaderID(material){return this._getShaderStage(material.fragmentShader). +id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(material){ +let cache2=this.materialCache,set=cache2.get(material);return set===void 0&&(set= +new Set,cache2.set(material,set)),set}_getShaderStage(code){let cache2=this.shaderCache, +stage=cache2.get(code);return stage===void 0&&(stage=new WebGLShaderStage2(code), +cache2.set(code,stage)),stage}},WebGLShaderStage2=class{static{__name(this,"WebG\ +LShaderStage")}constructor(code){this.id=_id2++,this.code=code,this.usedTimes=0}};function WebGLPrograms2(renderer,cubemaps,cubeuvmaps,extensions,capabilities,bindingStates,clipping){ +let _programLayers=new Layers,_customShaders=new WebGLShaderCache2,programs=[],IS_WEBGL2=capabilities. +isWebGL2,logarithmicDepthBuffer=capabilities.logarithmicDepthBuffer,SUPPORTS_VERTEX_TEXTURES=capabilities. +vertexTextures,precision=capabilities.precision,shaderIDs={MeshDepthMaterial:"de\ +pth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"\ +basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"\ +toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"\ +matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"po\ +ints",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function getChannel(value){ +return value===0?"uv":`uv${value}`}__name(getChannel,"getChannel");function getParameters(material,lights,shadows,scene2,object){ +let fog=scene2.fog,geometry=object.geometry,environment=material.isMeshStandardMaterial? +scene2.environment:null,envMap=(material.isMeshStandardMaterial?cubeuvmaps:cubemaps). +get(material.envMap||environment),envMapCubeUVHeight=envMap&&envMap.mapping===CubeUVReflectionMapping? +envMap.image.height:null,shaderID=shaderIDs[material.type];material.precision!== +null&&(precision=capabilities.getMaxPrecision(material.precision),precision!==material. +precision&&console.warn("THREE.WebGLProgram.getParameters:",material.precision,"\ +not supported, using",precision,"instead."));let morphAttribute=geometry.morphAttributes. +position||geometry.morphAttributes.normal||geometry.morphAttributes.color,morphTargetsCount=morphAttribute!== +void 0?morphAttribute.length:0,morphTextureStride=0;geometry.morphAttributes.position!== +void 0&&(morphTextureStride=1),geometry.morphAttributes.normal!==void 0&&(morphTextureStride= +2),geometry.morphAttributes.color!==void 0&&(morphTextureStride=3);let vertexShader, +fragmentShader,customVertexShaderID,customFragmentShaderID;if(shaderID){let shader=ShaderLib2[shaderID]; +vertexShader=shader.vertexShader,fragmentShader=shader.fragmentShader}else vertexShader= +material.vertexShader,fragmentShader=material.fragmentShader,_customShaders.update( +material),customVertexShaderID=_customShaders.getVertexShaderID(material),customFragmentShaderID= +_customShaders.getFragmentShaderID(material);let currentRenderTarget=renderer.getRenderTarget(), +IS_INSTANCEDMESH=object.isInstancedMesh===!0,IS_BATCHEDMESH=object.isBatchedMesh=== +!0,HAS_MAP=!!material.map,HAS_MATCAP=!!material.matcap,HAS_ENVMAP=!!envMap,HAS_AOMAP=!!material. +aoMap,HAS_LIGHTMAP=!!material.lightMap,HAS_BUMPMAP=!!material.bumpMap,HAS_NORMALMAP=!!material. +normalMap,HAS_DISPLACEMENTMAP=!!material.displacementMap,HAS_EMISSIVEMAP=!!material. +emissiveMap,HAS_METALNESSMAP=!!material.metalnessMap,HAS_ROUGHNESSMAP=!!material. +roughnessMap,HAS_ANISOTROPY=material.anisotropy>0,HAS_CLEARCOAT=material.clearcoat> +0,HAS_IRIDESCENCE=material.iridescence>0,HAS_SHEEN=material.sheen>0,HAS_TRANSMISSION=material. +transmission>0,HAS_ANISOTROPYMAP=HAS_ANISOTROPY&&!!material.anisotropyMap,HAS_CLEARCOATMAP=HAS_CLEARCOAT&& +!!material.clearcoatMap,HAS_CLEARCOAT_NORMALMAP=HAS_CLEARCOAT&&!!material.clearcoatNormalMap, +HAS_CLEARCOAT_ROUGHNESSMAP=HAS_CLEARCOAT&&!!material.clearcoatRoughnessMap,HAS_IRIDESCENCEMAP=HAS_IRIDESCENCE&& +!!material.iridescenceMap,HAS_IRIDESCENCE_THICKNESSMAP=HAS_IRIDESCENCE&&!!material. +iridescenceThicknessMap,HAS_SHEEN_COLORMAP=HAS_SHEEN&&!!material.sheenColorMap,HAS_SHEEN_ROUGHNESSMAP=HAS_SHEEN&& +!!material.sheenRoughnessMap,HAS_SPECULARMAP=!!material.specularMap,HAS_SPECULAR_COLORMAP=!!material. +specularColorMap,HAS_SPECULAR_INTENSITYMAP=!!material.specularIntensityMap,HAS_TRANSMISSIONMAP=HAS_TRANSMISSION&& +!!material.transmissionMap,HAS_THICKNESSMAP=HAS_TRANSMISSION&&!!material.thicknessMap, +HAS_GRADIENTMAP=!!material.gradientMap,HAS_ALPHAMAP=!!material.alphaMap,HAS_ALPHATEST=material. +alphaTest>0,HAS_ALPHAHASH=!!material.alphaHash,HAS_EXTENSIONS=!!material.extensions, +HAS_ATTRIBUTE_UV1=!!geometry.attributes.uv1,HAS_ATTRIBUTE_UV2=!!geometry.attributes. +uv2,HAS_ATTRIBUTE_UV3=!!geometry.attributes.uv3,toneMapping=NoToneMapping;return material. +toneMapped&&(currentRenderTarget===null||currentRenderTarget.isXRRenderTarget=== +!0)&&(toneMapping=renderer.toneMapping),{isWebGL2:IS_WEBGL2,shaderID,shaderType:material. +type,shaderName:material.name,vertexShader,fragmentShader,defines:material.defines, +customVertexShaderID,customFragmentShaderID,isRawShaderMaterial:material.isRawShaderMaterial=== +!0,glslVersion:material.glslVersion,precision,batching:IS_BATCHEDMESH,instancing:IS_INSTANCEDMESH, +instancingColor:IS_INSTANCEDMESH&&object.instanceColor!==null,supportsVertexTextures:SUPPORTS_VERTEX_TEXTURES, +outputColorSpace:currentRenderTarget===null?renderer.outputColorSpace:currentRenderTarget. +isXRRenderTarget===!0?currentRenderTarget.texture.colorSpace:LinearSRGBColorSpace, +map:HAS_MAP,matcap:HAS_MATCAP,envMap:HAS_ENVMAP,envMapMode:HAS_ENVMAP&&envMap.mapping, +envMapCubeUVHeight,aoMap:HAS_AOMAP,lightMap:HAS_LIGHTMAP,bumpMap:HAS_BUMPMAP,normalMap:HAS_NORMALMAP, +displacementMap:SUPPORTS_VERTEX_TEXTURES&&HAS_DISPLACEMENTMAP,emissiveMap:HAS_EMISSIVEMAP, +normalMapObjectSpace:HAS_NORMALMAP&&material.normalMapType===ObjectSpaceNormalMap, +normalMapTangentSpace:HAS_NORMALMAP&&material.normalMapType===TangentSpaceNormalMap, +metalnessMap:HAS_METALNESSMAP,roughnessMap:HAS_ROUGHNESSMAP,anisotropy:HAS_ANISOTROPY, +anisotropyMap:HAS_ANISOTROPYMAP,clearcoat:HAS_CLEARCOAT,clearcoatMap:HAS_CLEARCOATMAP, +clearcoatNormalMap:HAS_CLEARCOAT_NORMALMAP,clearcoatRoughnessMap:HAS_CLEARCOAT_ROUGHNESSMAP, +iridescence:HAS_IRIDESCENCE,iridescenceMap:HAS_IRIDESCENCEMAP,iridescenceThicknessMap:HAS_IRIDESCENCE_THICKNESSMAP, +sheen:HAS_SHEEN,sheenColorMap:HAS_SHEEN_COLORMAP,sheenRoughnessMap:HAS_SHEEN_ROUGHNESSMAP, +specularMap:HAS_SPECULARMAP,specularColorMap:HAS_SPECULAR_COLORMAP,specularIntensityMap:HAS_SPECULAR_INTENSITYMAP, +transmission:HAS_TRANSMISSION,transmissionMap:HAS_TRANSMISSIONMAP,thicknessMap:HAS_THICKNESSMAP, +gradientMap:HAS_GRADIENTMAP,opaque:material.transparent===!1&&material.blending=== +NormalBlending,alphaMap:HAS_ALPHAMAP,alphaTest:HAS_ALPHATEST,alphaHash:HAS_ALPHAHASH, +combine:material.combine,mapUv:HAS_MAP&&getChannel(material.map.channel),aoMapUv:HAS_AOMAP&& +getChannel(material.aoMap.channel),lightMapUv:HAS_LIGHTMAP&&getChannel(material. +lightMap.channel),bumpMapUv:HAS_BUMPMAP&&getChannel(material.bumpMap.channel),normalMapUv:HAS_NORMALMAP&& +getChannel(material.normalMap.channel),displacementMapUv:HAS_DISPLACEMENTMAP&&getChannel( +material.displacementMap.channel),emissiveMapUv:HAS_EMISSIVEMAP&&getChannel(material. +emissiveMap.channel),metalnessMapUv:HAS_METALNESSMAP&&getChannel(material.metalnessMap. +channel),roughnessMapUv:HAS_ROUGHNESSMAP&&getChannel(material.roughnessMap.channel), +anisotropyMapUv:HAS_ANISOTROPYMAP&&getChannel(material.anisotropyMap.channel),clearcoatMapUv:HAS_CLEARCOATMAP&& +getChannel(material.clearcoatMap.channel),clearcoatNormalMapUv:HAS_CLEARCOAT_NORMALMAP&& +getChannel(material.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:HAS_CLEARCOAT_ROUGHNESSMAP&& +getChannel(material.clearcoatRoughnessMap.channel),iridescenceMapUv:HAS_IRIDESCENCEMAP&& +getChannel(material.iridescenceMap.channel),iridescenceThicknessMapUv:HAS_IRIDESCENCE_THICKNESSMAP&& +getChannel(material.iridescenceThicknessMap.channel),sheenColorMapUv:HAS_SHEEN_COLORMAP&& +getChannel(material.sheenColorMap.channel),sheenRoughnessMapUv:HAS_SHEEN_ROUGHNESSMAP&& +getChannel(material.sheenRoughnessMap.channel),specularMapUv:HAS_SPECULARMAP&&getChannel( +material.specularMap.channel),specularColorMapUv:HAS_SPECULAR_COLORMAP&&getChannel( +material.specularColorMap.channel),specularIntensityMapUv:HAS_SPECULAR_INTENSITYMAP&& +getChannel(material.specularIntensityMap.channel),transmissionMapUv:HAS_TRANSMISSIONMAP&& +getChannel(material.transmissionMap.channel),thicknessMapUv:HAS_THICKNESSMAP&&getChannel( +material.thicknessMap.channel),alphaMapUv:HAS_ALPHAMAP&&getChannel(material.alphaMap. +channel),vertexTangents:!!geometry.attributes.tangent&&(HAS_NORMALMAP||HAS_ANISOTROPY), +vertexColors:material.vertexColors,vertexAlphas:material.vertexColors===!0&&!!geometry. +attributes.color&&geometry.attributes.color.itemSize===4,vertexUv1s:HAS_ATTRIBUTE_UV1, +vertexUv2s:HAS_ATTRIBUTE_UV2,vertexUv3s:HAS_ATTRIBUTE_UV3,pointsUvs:object.isPoints=== +!0&&!!geometry.attributes.uv&&(HAS_MAP||HAS_ALPHAMAP),fog:!!fog,useFog:material. +fog===!0,fogExp2:fog&&fog.isFogExp2,flatShading:material.flatShading===!0,sizeAttenuation:material. +sizeAttenuation===!0,logarithmicDepthBuffer,skinning:object.isSkinnedMesh===!0,morphTargets:geometry. +morphAttributes.position!==void 0,morphNormals:geometry.morphAttributes.normal!== +void 0,morphColors:geometry.morphAttributes.color!==void 0,morphTargetsCount,morphTextureStride, +numDirLights:lights.directional.length,numPointLights:lights.point.length,numSpotLights:lights. +spot.length,numSpotLightMaps:lights.spotLightMap.length,numRectAreaLights:lights. +rectArea.length,numHemiLights:lights.hemi.length,numDirLightShadows:lights.directionalShadowMap. +length,numPointLightShadows:lights.pointShadowMap.length,numSpotLightShadows:lights. +spotShadowMap.length,numSpotLightShadowsWithMaps:lights.numSpotLightShadowsWithMaps, +numLightProbes:lights.numLightProbes,numClippingPlanes:clipping.numPlanes,numClipIntersection:clipping. +numIntersection,dithering:material.dithering,shadowMapEnabled:renderer.shadowMap. +enabled&&shadows.length>0,shadowMapType:renderer.shadowMap.type,toneMapping,useLegacyLights:renderer. +_useLegacyLights,decodeVideoTexture:HAS_MAP&&material.map.isVideoTexture===!0&&ColorManagement. +getTransfer(material.map.colorSpace)===SRGBTransfer,premultipliedAlpha:material. +premultipliedAlpha,doubleSided:material.side===DoubleSide,flipSided:material.side=== +BackSide,useDepthPacking:material.depthPacking>=0,depthPacking:material.depthPacking|| +0,index0AttributeName:material.index0AttributeName,extensionDerivatives:HAS_EXTENSIONS&& +material.extensions.derivatives===!0,extensionFragDepth:HAS_EXTENSIONS&&material. +extensions.fragDepth===!0,extensionDrawBuffers:HAS_EXTENSIONS&&material.extensions. +drawBuffers===!0,extensionShaderTextureLOD:HAS_EXTENSIONS&&material.extensions.shaderTextureLOD=== +!0,extensionClipCullDistance:HAS_EXTENSIONS&&material.extensions.clipCullDistance&& +extensions.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:IS_WEBGL2|| +extensions.has("EXT_frag_depth"),rendererExtensionDrawBuffers:IS_WEBGL2||extensions. +has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:IS_WEBGL2||extensions. +has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:extensions. +has("KHR_parallel_shader_compile"),customProgramCacheKey:material.customProgramCacheKey()}} +__name(getParameters,"getParameters");function getProgramCacheKey(parameters){let array=[]; +if(parameters.shaderID?array.push(parameters.shaderID):(array.push(parameters.customVertexShaderID), +array.push(parameters.customFragmentShaderID)),parameters.defines!==void 0)for(let name2 in parameters. +defines)array.push(name2),array.push(parameters.defines[name2]);return parameters. +isRawShaderMaterial===!1&&(getProgramCacheKeyParameters(array,parameters),getProgramCacheKeyBooleans( +array,parameters),array.push(renderer.outputColorSpace)),array.push(parameters.customProgramCacheKey), +array.join()}__name(getProgramCacheKey,"getProgramCacheKey");function getProgramCacheKeyParameters(array,parameters){ +array.push(parameters.precision),array.push(parameters.outputColorSpace),array.push( +parameters.envMapMode),array.push(parameters.envMapCubeUVHeight),array.push(parameters. +mapUv),array.push(parameters.alphaMapUv),array.push(parameters.lightMapUv),array. +push(parameters.aoMapUv),array.push(parameters.bumpMapUv),array.push(parameters. +normalMapUv),array.push(parameters.displacementMapUv),array.push(parameters.emissiveMapUv), +array.push(parameters.metalnessMapUv),array.push(parameters.roughnessMapUv),array. +push(parameters.anisotropyMapUv),array.push(parameters.clearcoatMapUv),array.push( +parameters.clearcoatNormalMapUv),array.push(parameters.clearcoatRoughnessMapUv), +array.push(parameters.iridescenceMapUv),array.push(parameters.iridescenceThicknessMapUv), +array.push(parameters.sheenColorMapUv),array.push(parameters.sheenRoughnessMapUv), +array.push(parameters.specularMapUv),array.push(parameters.specularColorMapUv),array. +push(parameters.specularIntensityMapUv),array.push(parameters.transmissionMapUv), +array.push(parameters.thicknessMapUv),array.push(parameters.combine),array.push( +parameters.fogExp2),array.push(parameters.sizeAttenuation),array.push(parameters. +morphTargetsCount),array.push(parameters.morphAttributeCount),array.push(parameters. +numDirLights),array.push(parameters.numPointLights),array.push(parameters.numSpotLights), +array.push(parameters.numSpotLightMaps),array.push(parameters.numHemiLights),array. +push(parameters.numRectAreaLights),array.push(parameters.numDirLightShadows),array. +push(parameters.numPointLightShadows),array.push(parameters.numSpotLightShadows), +array.push(parameters.numSpotLightShadowsWithMaps),array.push(parameters.numLightProbes), +array.push(parameters.shadowMapType),array.push(parameters.toneMapping),array.push( +parameters.numClippingPlanes),array.push(parameters.numClipIntersection),array.push( +parameters.depthPacking)}__name(getProgramCacheKeyParameters,"getProgramCacheKey\ +Parameters");function getProgramCacheKeyBooleans(array,parameters){_programLayers. +disableAll(),parameters.isWebGL2&&_programLayers.enable(0),parameters.supportsVertexTextures&& +_programLayers.enable(1),parameters.instancing&&_programLayers.enable(2),parameters. +instancingColor&&_programLayers.enable(3),parameters.matcap&&_programLayers.enable( +4),parameters.envMap&&_programLayers.enable(5),parameters.normalMapObjectSpace&& +_programLayers.enable(6),parameters.normalMapTangentSpace&&_programLayers.enable( +7),parameters.clearcoat&&_programLayers.enable(8),parameters.iridescence&&_programLayers. +enable(9),parameters.alphaTest&&_programLayers.enable(10),parameters.vertexColors&& +_programLayers.enable(11),parameters.vertexAlphas&&_programLayers.enable(12),parameters. +vertexUv1s&&_programLayers.enable(13),parameters.vertexUv2s&&_programLayers.enable( +14),parameters.vertexUv3s&&_programLayers.enable(15),parameters.vertexTangents&& +_programLayers.enable(16),parameters.anisotropy&&_programLayers.enable(17),parameters. +alphaHash&&_programLayers.enable(18),parameters.batching&&_programLayers.enable( +19),array.push(_programLayers.mask),_programLayers.disableAll(),parameters.fog&& +_programLayers.enable(0),parameters.useFog&&_programLayers.enable(1),parameters. +flatShading&&_programLayers.enable(2),parameters.logarithmicDepthBuffer&&_programLayers. +enable(3),parameters.skinning&&_programLayers.enable(4),parameters.morphTargets&& +_programLayers.enable(5),parameters.morphNormals&&_programLayers.enable(6),parameters. +morphColors&&_programLayers.enable(7),parameters.premultipliedAlpha&&_programLayers. +enable(8),parameters.shadowMapEnabled&&_programLayers.enable(9),parameters.useLegacyLights&& +_programLayers.enable(10),parameters.doubleSided&&_programLayers.enable(11),parameters. +flipSided&&_programLayers.enable(12),parameters.useDepthPacking&&_programLayers. +enable(13),parameters.dithering&&_programLayers.enable(14),parameters.transmission&& +_programLayers.enable(15),parameters.sheen&&_programLayers.enable(16),parameters. +opaque&&_programLayers.enable(17),parameters.pointsUvs&&_programLayers.enable(18), +parameters.decodeVideoTexture&&_programLayers.enable(19),array.push(_programLayers. +mask)}__name(getProgramCacheKeyBooleans,"getProgramCacheKeyBooleans");function getUniforms(material){ +let shaderID=shaderIDs[material.type],uniforms;if(shaderID){let shader=ShaderLib2[shaderID]; +uniforms=UniformsUtils2.clone(shader.uniforms)}else uniforms=material.uniforms;return uniforms} +__name(getUniforms,"getUniforms");function acquireProgram(parameters,cacheKey){let program; +for(let p2=0,pl=programs.length;p20?transmissive.push(renderItem):material.transparent===!0?transparent. +push(renderItem):opaque.push(renderItem)}__name(push,"push");function unshift(object,geometry,material,groupOrder,z2,group){ +let renderItem=getNextRenderItem(object,geometry,material,groupOrder,z2,group);material. +transmission>0?transmissive.unshift(renderItem):material.transparent===!0?transparent. +unshift(renderItem):opaque.unshift(renderItem)}__name(unshift,"unshift");function sort(customOpaqueSort,customTransparentSort){ +opaque.length>1&&opaque.sort(customOpaqueSort||painterSortStable2),transmissive. +length>1&&transmissive.sort(customTransparentSort||reversePainterSortStable2),transparent. +length>1&&transparent.sort(customTransparentSort||reversePainterSortStable2)}__name( +sort,"sort");function finish(){for(let i2=renderItemsIndex,il=renderItems.length;i2< +il;i2++){let renderItem=renderItems[i2];if(renderItem.id===null)break;renderItem. +id=null,renderItem.object=null,renderItem.geometry=null,renderItem.material=null, +renderItem.group=null}}return __name(finish,"finish"),{opaque,transmissive,transparent, +init,push,unshift,finish,sort}}__name(WebGLRenderList2,"WebGLRenderList");function WebGLRenderLists2(){ +let lists=new WeakMap;function get(scene2,renderCallDepth){let listArray=lists.get( +scene2),list;return listArray===void 0?(list=new WebGLRenderList2,lists.set(scene2, +[list])):renderCallDepth>=listArray.length?(list=new WebGLRenderList2,listArray. +push(list)):list=listArray[renderCallDepth],list}__name(get,"get");function dispose(){ +lists=new WeakMap}return __name(dispose,"dispose"),{get,dispose}}__name(WebGLRenderLists2, +"WebGLRenderLists");function UniformsCache2(){let lights={};return{get:function(light){if(lights[light. +id]!==void 0)return lights[light.id];let uniforms;switch(light.type){case"Direct\ +ionalLight":uniforms={direction:new Vector3,color:new Color};break;case"SpotLigh\ +t":uniforms={position:new Vector3,direction:new Vector3,color:new Color,distance:0, +coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":uniforms={position:new Vector3, +color:new Color,distance:0,decay:0};break;case"HemisphereLight":uniforms={direction:new Vector3, +skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":uniforms={color:new Color, +position:new Vector3,halfWidth:new Vector3,halfHeight:new Vector3};break}return lights[light. +id]=uniforms,uniforms}}}__name(UniformsCache2,"UniformsCache");function ShadowUniformsCache2(){ +let lights={};return{get:function(light){if(lights[light.id]!==void 0)return lights[light. +id];let uniforms;switch(light.type){case"DirectionalLight":uniforms={shadowBias:0, +shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"SpotLigh\ +t":uniforms={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2}; +break;case"PointLight":uniforms={shadowBias:0,shadowNormalBias:0,shadowRadius:1, +shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3};break}return lights[light. +id]=uniforms,uniforms}}}__name(ShadowUniformsCache2,"ShadowUniformsCache");var nextVersion2=0; +function shadowCastingAndTexturingLightsFirst2(lightA,lightB){return(lightB.castShadow? +2:0)-(lightA.castShadow?2:0)+(lightB.map?1:0)-(lightA.map?1:0)}__name(shadowCastingAndTexturingLightsFirst2, +"shadowCastingAndTexturingLightsFirst");function WebGLLights2(extensions,capabilities){ +let cache2=new UniformsCache2,shadowCache=ShadowUniformsCache2(),state={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 i2=0;i2<9;i2++)state.probe.push(new Vector3);let vector3=new Vector3,matrix4=new Matrix4, +matrix42=new Matrix4;function setup(lights,useLegacyLights){let r3=0,g=0,b=0;for(let i2=0;i2< +9;i2++)state.probe[i2].set(0,0,0);let directionalLength=0,pointLength=0,spotLength=0, +rectAreaLength=0,hemiLength=0,numDirectionalShadows=0,numPointShadows=0,numSpotShadows=0, +numSpotMaps=0,numSpotShadowsWithMaps=0,numLightProbes=0;lights.sort(shadowCastingAndTexturingLightsFirst2); +let scaleFactor=useLegacyLights===!0?Math.PI:1;for(let i2=0,l=lights.length;i20&&(capabilities.isWebGL2?extensions.has("OES_texture_float_linea\ +r")===!0?(state.rectAreaLTC1=UniformsLib2.LTC_FLOAT_1,state.rectAreaLTC2=UniformsLib2. +LTC_FLOAT_2):(state.rectAreaLTC1=UniformsLib2.LTC_HALF_1,state.rectAreaLTC2=UniformsLib2. +LTC_HALF_2):extensions.has("OES_texture_float_linear")===!0?(state.rectAreaLTC1= +UniformsLib2.LTC_FLOAT_1,state.rectAreaLTC2=UniformsLib2.LTC_FLOAT_2):extensions. +has("OES_texture_half_float_linear")===!0?(state.rectAreaLTC1=UniformsLib2.LTC_HALF_1, +state.rectAreaLTC2=UniformsLib2.LTC_HALF_2):console.error("THREE.WebGLRenderer: \ +Unable to use RectAreaLight. Missing WebGL extensions.")),state.ambient[0]=r3,state. +ambient[1]=g,state.ambient[2]=b;let hash=state.hash;(hash.directionalLength!==directionalLength|| +hash.pointLength!==pointLength||hash.spotLength!==spotLength||hash.rectAreaLength!== +rectAreaLength||hash.hemiLength!==hemiLength||hash.numDirectionalShadows!==numDirectionalShadows|| +hash.numPointShadows!==numPointShadows||hash.numSpotShadows!==numSpotShadows||hash. +numSpotMaps!==numSpotMaps||hash.numLightProbes!==numLightProbes)&&(state.directional. +length=directionalLength,state.spot.length=spotLength,state.rectArea.length=rectAreaLength, +state.point.length=pointLength,state.hemi.length=hemiLength,state.directionalShadow. +length=numDirectionalShadows,state.directionalShadowMap.length=numDirectionalShadows, +state.pointShadow.length=numPointShadows,state.pointShadowMap.length=numPointShadows, +state.spotShadow.length=numSpotShadows,state.spotShadowMap.length=numSpotShadows, +state.directionalShadowMatrix.length=numDirectionalShadows,state.pointShadowMatrix. +length=numPointShadows,state.spotLightMatrix.length=numSpotShadows+numSpotMaps-numSpotShadowsWithMaps, +state.spotLightMap.length=numSpotMaps,state.numSpotLightShadowsWithMaps=numSpotShadowsWithMaps, +state.numLightProbes=numLightProbes,hash.directionalLength=directionalLength,hash. +pointLength=pointLength,hash.spotLength=spotLength,hash.rectAreaLength=rectAreaLength, +hash.hemiLength=hemiLength,hash.numDirectionalShadows=numDirectionalShadows,hash. +numPointShadows=numPointShadows,hash.numSpotShadows=numSpotShadows,hash.numSpotMaps= +numSpotMaps,hash.numLightProbes=numLightProbes,state.version=nextVersion2++)}__name( +setup,"setup");function setupView(lights,camera){let directionalLength=0,pointLength=0, +spotLength=0,rectAreaLength=0,hemiLength=0,viewMatrix=camera.matrixWorldInverse; +for(let i2=0,l=lights.length;i2= +renderStateArray.length?(renderState=new WebGLRenderState2(extensions,capabilities), +renderStateArray.push(renderState)):renderState=renderStateArray[renderCallDepth], +renderState}__name(get,"get");function dispose(){renderStates=new WeakMap}return __name( +dispose,"dispose"),{get,dispose}}__name(WebGLRenderStates2,"WebGLRenderStates");var MeshDepthMaterial2=class extends Material{static{__name(this,"MeshDepthMater\ +ial")}constructor(parameters){super(),this.isMeshDepthMaterial=!0,this.type="Mes\ +hDepthMaterial",this.depthPacking=BasicDepthPacking,this.map=null,this.alphaMap= +null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0, +this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(parameters)}copy(source){ +return super.copy(source),this.depthPacking=source.depthPacking,this.map=source. +map,this.alphaMap=source.alphaMap,this.displacementMap=source.displacementMap,this. +displacementScale=source.displacementScale,this.displacementBias=source.displacementBias, +this.wireframe=source.wireframe,this.wireframeLinewidth=source.wireframeLinewidth, +this}};var MeshDistanceMaterial2=class extends Material{static{__name(this,"MeshDistanc\ +eMaterial")}constructor(parameters){super(),this.isMeshDistanceMaterial=!0,this. +type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap= +null,this.displacementScale=1,this.displacementBias=0,this.setValues(parameters)}copy(source){ +return super.copy(source),this.map=source.map,this.alphaMap=source.alphaMap,this. +displacementMap=source.displacementMap,this.displacementScale=source.displacementScale, +this.displacementBias=source.displacementBias,this}};var vertex19=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +} +`,fragment19=` +uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; + +#include + +void main() { + + const float samples = float( VSM_SAMPLES ); + + float mean = 0.0; + float squared_mean = 0.0; + + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + + float uvOffset = uvStart + i * uvStride; + + #ifdef HORIZONTAL_PASS + + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord\ +.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distributi\ +on.x; + + #else + + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + \ +vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + + #endif + + } + + mean = mean / samples; + squared_mean = squared_mean / samples; + + float std_dev = sqrt( squared_mean - mean * mean ); + + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); + +} +`;function WebGLShadowMap2(_renderer,_objects,_capabilities){let _frustum=new Frustum2, +_shadowMapSize=new Vector2,_viewportSize=new Vector2,_viewport=new Vector42,_depthMaterial=new MeshDepthMaterial2( +{depthPacking:RGBADepthPacking}),_distanceMaterial=new MeshDistanceMaterial2,_materialCache={}, +_maxTextureSize=_capabilities.maxTextureSize,shadowSide={[FrontSide]:BackSide,[BackSide]:FrontSide, +[DoubleSide]:DoubleSide},shadowMaterialVertical=new ShaderMaterial2({defines:{VSM_SAMPLES:8}, +uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}}, +vertexShader:vertex19,fragmentShader:fragment19}),shadowMaterialHorizontal=shadowMaterialVertical. +clone();shadowMaterialHorizontal.defines.HORIZONTAL_PASS=1;let fullScreenTri=new BufferGeometry; +fullScreenTri.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1, +.5,3,-1,.5,-1,3,.5]),3));let fullScreenMesh=new Mesh(fullScreenTri,shadowMaterialVertical), +scope=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=PCFShadowMap; +let _previousType=this.type;this.render=function(lights,scene2,camera){if(scope. +enabled===!1||scope.autoUpdate===!1&&scope.needsUpdate===!1||lights.length===0)return; +let currentRenderTarget=_renderer.getRenderTarget(),activeCubeFace=_renderer.getActiveCubeFace(), +activeMipmapLevel=_renderer.getActiveMipmapLevel(),_state=_renderer.state;_state. +setBlending(NoBlending),_state.buffers.color.setClear(1,1,1,1),_state.buffers.depth. +setTest(!0),_state.setScissorTest(!1);let toVSM=_previousType!==VSMShadowMap&&this. +type===VSMShadowMap,fromVSM=_previousType===VSMShadowMap&&this.type!==VSMShadowMap; +for(let i2=0,il=lights.length;i2_maxTextureSize||_shadowMapSize.y>_maxTextureSize)&&(_shadowMapSize.x>_maxTextureSize&& +(_viewportSize.x=Math.floor(_maxTextureSize/shadowFrameExtents.x),_shadowMapSize. +x=_viewportSize.x*shadowFrameExtents.x,shadow.mapSize.x=_viewportSize.x),_shadowMapSize. +y>_maxTextureSize&&(_viewportSize.y=Math.floor(_maxTextureSize/shadowFrameExtents. +y),_shadowMapSize.y=_viewportSize.y*shadowFrameExtents.y,shadow.mapSize.y=_viewportSize. +y)),shadow.map===null||toVSM===!0||fromVSM===!0){let pars=this.type!==VSMShadowMap? +{minFilter:NearestFilter,magFilter:NearestFilter}:{};shadow.map!==null&&shadow.map. +dispose(),shadow.map=new WebGLRenderTarget2(_shadowMapSize.x,_shadowMapSize.y,pars), +shadow.map.texture.name=light.name+".shadowMap",shadow.camera.updateProjectionMatrix()} +_renderer.setRenderTarget(shadow.map),_renderer.clear();let viewportCount=shadow. +getViewportCount();for(let vp=0;vp0||material.map&&material.alphaTest>0){let keyA=result.uuid,keyB=material. +uuid,materialsForVariant=_materialCache[keyA];materialsForVariant===void 0&&(materialsForVariant= +{},_materialCache[keyA]=materialsForVariant);let cachedMaterial=materialsForVariant[keyB]; +cachedMaterial===void 0&&(cachedMaterial=result.clone(),materialsForVariant[keyB]= +cachedMaterial,material.addEventListener("dispose",onMaterialDispose)),result=cachedMaterial} +if(result.visible=material.visible,result.wireframe=material.wireframe,type===VSMShadowMap? +result.side=material.shadowSide!==null?material.shadowSide:material.side:result. +side=material.shadowSide!==null?material.shadowSide:shadowSide[material.side],result. +alphaMap=material.alphaMap,result.alphaTest=material.alphaTest,result.map=material. +map,result.clipShadows=material.clipShadows,result.clippingPlanes=material.clippingPlanes, +result.clipIntersection=material.clipIntersection,result.displacementMap=material. +displacementMap,result.displacementScale=material.displacementScale,result.displacementBias= +material.displacementBias,result.wireframeLinewidth=material.wireframeLinewidth, +result.linewidth=material.linewidth,light.isPointLight===!0&&result.isMeshDistanceMaterial=== +!0){let materialProperties=_renderer.properties.get(result);materialProperties.light= +light}return result}__name(getDepthMaterial,"getDepthMaterial");function renderObject(object,camera,shadowCamera,light,type){ +if(object.visible===!1)return;if(object.layers.test(camera.layers)&&(object.isMesh|| +object.isLine||object.isPoints)&&(object.castShadow||object.receiveShadow&&type=== +VSMShadowMap)&&(!object.frustumCulled||_frustum.intersectsObject(object))){object. +modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse,object.matrixWorld); +let geometry=_objects.update(object),material=object.material;if(Array.isArray(material)){ +let groups=geometry.groups;for(let k=0,kl=groups.length;k= +1):glVersion.indexOf("OpenGL ES")!==-1&&(version3=parseFloat(/^OpenGL ES (\d)/.exec( +glVersion)[1]),lineWidthAvailable=version3>=2);let currentTextureSlot=null,currentBoundTextures={}, +scissorParam=gl.getParameter(gl.SCISSOR_BOX),viewportParam=gl.getParameter(gl.VIEWPORT), +currentScissor=new Vector42().fromArray(scissorParam),currentViewport=new Vector42(). +fromArray(viewportParam);function createTexture(type,target,count,dimensions){let data=new Uint8Array( +4),texture=gl.createTexture();gl.bindTexture(type,texture),gl.texParameteri(type, +gl.TEXTURE_MIN_FILTER,gl.NEAREST),gl.texParameteri(type,gl.TEXTURE_MAG_FILTER,gl. +NEAREST);for(let i2=0;i2"u"?!1:/OculusBrowser/g. +test(navigator.userAgent),_videoTextures=new WeakMap,_canvas3,_sources=new WeakMap, +useOffscreenCanvas=!1;try{useOffscreenCanvas=typeof OffscreenCanvas<"u"&&new OffscreenCanvas( +1,1).getContext("2d")!==null}catch{}function createCanvas(width,height){return useOffscreenCanvas? +new OffscreenCanvas(width,height):createElementNS("canvas")}__name(createCanvas, +"createCanvas");function resizeImage(image,needsPowerOfTwo,needsNewCanvas,maxSize){ +let scale2=1;if((image.width>maxSize||image.height>maxSize)&&(scale2=maxSize/Math. +max(image.width,image.height)),scale2<1||needsPowerOfTwo===!0)if(typeof HTMLImageElement< +"u"&&image instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&image instanceof +HTMLCanvasElement||typeof ImageBitmap<"u"&&image instanceof ImageBitmap){let floor=needsPowerOfTwo? +floorPowerOfTwo:Math.floor,width=floor(scale2*image.width),height=floor(scale2*image. +height);_canvas3===void 0&&(_canvas3=createCanvas(width,height));let canvas=needsNewCanvas? +createCanvas(width,height):_canvas3;return canvas.width=width,canvas.height=height, +canvas.getContext("2d").drawImage(image,0,0,width,height),console.warn("THREE.We\ +bGLRenderer: Texture has been resized from ("+image.width+"x"+image.height+") to\ + ("+width+"x"+height+")."),canvas}else return"data"in image&&console.warn("THREE\ +.WebGLRenderer: Image in DataTexture is too big ("+image.width+"x"+image.height+ +")."),image;return image}__name(resizeImage,"resizeImage");function isPowerOfTwo3(image){ +return isPowerOfTwo(image.width)&&isPowerOfTwo(image.height)}__name(isPowerOfTwo3, +"isPowerOfTwo");function textureNeedsPowerOfTwo(texture){return isWebGL2?!1:texture. +wrapS!==ClampToEdgeWrapping||texture.wrapT!==ClampToEdgeWrapping||texture.minFilter!== +NearestFilter&&texture.minFilter!==LinearFilter}__name(textureNeedsPowerOfTwo,"t\ +extureNeedsPowerOfTwo");function textureNeedsGenerateMipmaps(texture,supportsMips){ +return texture.generateMipmaps&&supportsMips&&texture.minFilter!==NearestFilter&& +texture.minFilter!==LinearFilter}__name(textureNeedsGenerateMipmaps,"textureNeed\ +sGenerateMipmaps");function generateMipmap(target){_gl.generateMipmap(target)}__name( +generateMipmap,"generateMipmap");function getInternalFormat(internalFormatName,glFormat,glType,colorSpace,forceLinearTransfer=!1){ +if(isWebGL2===!1)return glFormat;if(internalFormatName!==null){if(_gl[internalFormatName]!== +void 0)return _gl[internalFormatName];console.warn("THREE.WebGLRenderer: Attempt\ + to use non-existing WebGL internal format '"+internalFormatName+"'")}let internalFormat=glFormat; +if(glFormat===_gl.RED&&(glType===_gl.FLOAT&&(internalFormat=_gl.R32F),glType===_gl. +HALF_FLOAT&&(internalFormat=_gl.R16F),glType===_gl.UNSIGNED_BYTE&&(internalFormat= +_gl.R8)),glFormat===_gl.RED_INTEGER&&(glType===_gl.UNSIGNED_BYTE&&(internalFormat= +_gl.R8UI),glType===_gl.UNSIGNED_SHORT&&(internalFormat=_gl.R16UI),glType===_gl.UNSIGNED_INT&& +(internalFormat=_gl.R32UI),glType===_gl.BYTE&&(internalFormat=_gl.R8I),glType=== +_gl.SHORT&&(internalFormat=_gl.R16I),glType===_gl.INT&&(internalFormat=_gl.R32I)), +glFormat===_gl.RG&&(glType===_gl.FLOAT&&(internalFormat=_gl.RG32F),glType===_gl. +HALF_FLOAT&&(internalFormat=_gl.RG16F),glType===_gl.UNSIGNED_BYTE&&(internalFormat= +_gl.RG8)),glFormat===_gl.RGBA){let transfer=forceLinearTransfer?LinearTransfer:ColorManagement. +getTransfer(colorSpace);glType===_gl.FLOAT&&(internalFormat=_gl.RGBA32F),glType=== +_gl.HALF_FLOAT&&(internalFormat=_gl.RGBA16F),glType===_gl.UNSIGNED_BYTE&&(internalFormat= +transfer===SRGBTransfer?_gl.SRGB8_ALPHA8:_gl.RGBA8),glType===_gl.UNSIGNED_SHORT_4_4_4_4&& +(internalFormat=_gl.RGBA4),glType===_gl.UNSIGNED_SHORT_5_5_5_1&&(internalFormat= +_gl.RGB5_A1)}return(internalFormat===_gl.R16F||internalFormat===_gl.R32F||internalFormat=== +_gl.RG16F||internalFormat===_gl.RG32F||internalFormat===_gl.RGBA16F||internalFormat=== +_gl.RGBA32F)&&extensions.get("EXT_color_buffer_float"),internalFormat}__name(getInternalFormat, +"getInternalFormat");function getMipLevels(texture,image,supportsMips){return textureNeedsGenerateMipmaps( +texture,supportsMips)===!0||texture.isFramebufferTexture&&texture.minFilter!==NearestFilter&& +texture.minFilter!==LinearFilter?Math.log2(Math.max(image.width,image.height))+1: +texture.mipmaps!==void 0&&texture.mipmaps.length>0?texture.mipmaps.length:texture. +isCompressedTexture&&Array.isArray(texture.image)?image.mipmaps.length:1}__name( +getMipLevels,"getMipLevels");function filterFallback(f){return f===NearestFilter|| +f===NearestMipmapNearestFilter||f===NearestMipmapLinearFilter?_gl.NEAREST:_gl.LINEAR} +__name(filterFallback,"filterFallback");function onTextureDispose(event){let texture=event. +target;texture.removeEventListener("dispose",onTextureDispose),deallocateTexture( +texture),texture.isVideoTexture&&_videoTextures.delete(texture)}__name(onTextureDispose, +"onTextureDispose");function onRenderTargetDispose(event){let renderTarget=event. +target;renderTarget.removeEventListener("dispose",onRenderTargetDispose),deallocateRenderTarget( +renderTarget)}__name(onRenderTargetDispose,"onRenderTargetDispose");function deallocateTexture(texture){ +let textureProperties=properties.get(texture);if(textureProperties.__webglInit=== +void 0)return;let source=texture.source,webglTextures=_sources.get(source);if(webglTextures){ +let webglTexture=webglTextures[textureProperties.__cacheKey];webglTexture.usedTimes--, +webglTexture.usedTimes===0&&deleteTexture(texture),Object.keys(webglTextures).length=== +0&&_sources.delete(source)}properties.remove(texture)}__name(deallocateTexture,"\ +deallocateTexture");function deleteTexture(texture){let textureProperties=properties. +get(texture);_gl.deleteTexture(textureProperties.__webglTexture);let source=texture. +source,webglTextures=_sources.get(source);delete webglTextures[textureProperties. +__cacheKey],info.memory.textures--}__name(deleteTexture,"deleteTexture");function deallocateRenderTarget(renderTarget){ +let texture=renderTarget.texture,renderTargetProperties=properties.get(renderTarget), +textureProperties=properties.get(texture);if(textureProperties.__webglTexture!== +void 0&&(_gl.deleteTexture(textureProperties.__webglTexture),info.memory.textures--), +renderTarget.depthTexture&&renderTarget.depthTexture.dispose(),renderTarget.isWebGLCubeRenderTarget) +for(let i2=0;i2<6;i2++){if(Array.isArray(renderTargetProperties.__webglFramebuffer[i2])) +for(let level=0;level=capabilities.maxTextures&&console.warn("THREE.WebGLTextures:\ + Trying to use "+textureUnit+" texture units while this GPU supports only "+capabilities. +maxTextures),textureUnits+=1,textureUnit}__name(allocateTextureUnit,"allocateTex\ +tureUnit");function getTextureCacheKey(texture){let array=[];return array.push(texture. +wrapS),array.push(texture.wrapT),array.push(texture.wrapR||0),array.push(texture. +magFilter),array.push(texture.minFilter),array.push(texture.anisotropy),array.push( +texture.internalFormat),array.push(texture.format),array.push(texture.type),array. +push(texture.generateMipmaps),array.push(texture.premultiplyAlpha),array.push(texture. +flipY),array.push(texture.unpackAlignment),array.push(texture.colorSpace),array. +join()}__name(getTextureCacheKey,"getTextureCacheKey");function setTexture2D(texture,slot){ +let textureProperties=properties.get(texture);if(texture.isVideoTexture&&updateVideoTexture( +texture),texture.isRenderTargetTexture===!1&&texture.version>0&&textureProperties. +__version!==texture.version){let image=texture.image;if(image===null)console.warn( +"THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(image. +complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but i\ +mage is incomplete");else{uploadTexture(textureProperties,texture,slot);return}} +state.bindTexture(_gl.TEXTURE_2D,textureProperties.__webglTexture,_gl.TEXTURE0+slot)} +__name(setTexture2D,"setTexture2D");function setTexture2DArray(texture,slot){let textureProperties=properties. +get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){ +uploadTexture(textureProperties,texture,slot);return}state.bindTexture(_gl.TEXTURE_2D_ARRAY, +textureProperties.__webglTexture,_gl.TEXTURE0+slot)}__name(setTexture2DArray,"se\ +tTexture2DArray");function setTexture3D(texture,slot){let textureProperties=properties. +get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){ +uploadTexture(textureProperties,texture,slot);return}state.bindTexture(_gl.TEXTURE_3D, +textureProperties.__webglTexture,_gl.TEXTURE0+slot)}__name(setTexture3D,"setText\ +ure3D");function setTextureCube(texture,slot){let textureProperties=properties.get( +texture);if(texture.version>0&&textureProperties.__version!==texture.version){uploadCubeTexture( +textureProperties,texture,slot);return}state.bindTexture(_gl.TEXTURE_CUBE_MAP,textureProperties. +__webglTexture,_gl.TEXTURE0+slot)}__name(setTextureCube,"setTextureCube");let wrappingToGL={ +[RepeatWrapping]:_gl.REPEAT,[ClampToEdgeWrapping]:_gl.CLAMP_TO_EDGE,[MirroredRepeatWrapping]:_gl. +MIRRORED_REPEAT},filterToGL={[NearestFilter]:_gl.NEAREST,[NearestMipmapNearestFilter]:_gl. +NEAREST_MIPMAP_NEAREST,[NearestMipmapLinearFilter]:_gl.NEAREST_MIPMAP_LINEAR,[LinearFilter]:_gl. +LINEAR,[LinearMipmapNearestFilter]:_gl.LINEAR_MIPMAP_NEAREST,[LinearMipmapLinearFilter]:_gl. +LINEAR_MIPMAP_LINEAR},compareToGL={[NeverCompare]:_gl.NEVER,[AlwaysCompare]:_gl. +ALWAYS,[LessCompare]:_gl.LESS,[LessEqualCompare]:_gl.LEQUAL,[EqualCompare]:_gl.EQUAL, +[GreaterEqualCompare]:_gl.GEQUAL,[GreaterCompare]:_gl.GREATER,[NotEqualCompare]:_gl. +NOTEQUAL};function setTextureParameters(textureType,texture,supportsMips){if(supportsMips? +(_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_S,wrappingToGL[texture.wrapS]),_gl. +texParameteri(textureType,_gl.TEXTURE_WRAP_T,wrappingToGL[texture.wrapT]),(textureType=== +_gl.TEXTURE_3D||textureType===_gl.TEXTURE_2D_ARRAY)&&_gl.texParameteri(textureType, +_gl.TEXTURE_WRAP_R,wrappingToGL[texture.wrapR]),_gl.texParameteri(textureType,_gl. +TEXTURE_MAG_FILTER,filterToGL[texture.magFilter]),_gl.texParameteri(textureType, +_gl.TEXTURE_MIN_FILTER,filterToGL[texture.minFilter])):(_gl.texParameteri(textureType, +_gl.TEXTURE_WRAP_S,_gl.CLAMP_TO_EDGE),_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_T, +_gl.CLAMP_TO_EDGE),(textureType===_gl.TEXTURE_3D||textureType===_gl.TEXTURE_2D_ARRAY)&& +_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_R,_gl.CLAMP_TO_EDGE),(texture.wrapS!== +ClampToEdgeWrapping||texture.wrapT!==ClampToEdgeWrapping)&&console.warn("THREE.W\ +ebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT shoul\ +d be set to THREE.ClampToEdgeWrapping."),_gl.texParameteri(textureType,_gl.TEXTURE_MAG_FILTER, +filterFallback(texture.magFilter)),_gl.texParameteri(textureType,_gl.TEXTURE_MIN_FILTER, +filterFallback(texture.minFilter)),texture.minFilter!==NearestFilter&&texture.minFilter!== +LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Te\ +xture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),texture. +compareFunction&&(_gl.texParameteri(textureType,_gl.TEXTURE_COMPARE_MODE,_gl.COMPARE_REF_TO_TEXTURE), +_gl.texParameteri(textureType,_gl.TEXTURE_COMPARE_FUNC,compareToGL[texture.compareFunction])), +extensions.has("EXT_texture_filter_anisotropic")===!0){let extension=extensions. +get("EXT_texture_filter_anisotropic");if(texture.magFilter===NearestFilter||texture. +minFilter!==NearestMipmapLinearFilter&&texture.minFilter!==LinearMipmapLinearFilter|| +texture.type===FloatType&&extensions.has("OES_texture_float_linear")===!1||isWebGL2=== +!1&&texture.type===HalfFloatType&&extensions.has("OES_texture_half_float_linear")=== +!1)return;(texture.anisotropy>1||properties.get(texture).__currentAnisotropy)&&(_gl. +texParameterf(textureType,extension.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(texture. +anisotropy,capabilities.getMaxAnisotropy())),properties.get(texture).__currentAnisotropy= +texture.anisotropy)}}__name(setTextureParameters,"setTextureParameters");function initTexture(textureProperties,texture){ +let forceUpload=!1;textureProperties.__webglInit===void 0&&(textureProperties.__webglInit= +!0,texture.addEventListener("dispose",onTextureDispose));let source=texture.source, +webglTextures=_sources.get(source);webglTextures===void 0&&(webglTextures={},_sources. +set(source,webglTextures));let textureCacheKey=getTextureCacheKey(texture);if(textureCacheKey!== +textureProperties.__cacheKey){webglTextures[textureCacheKey]===void 0&&(webglTextures[textureCacheKey]= +{texture:_gl.createTexture(),usedTimes:0},info.memory.textures++,forceUpload=!0), +webglTextures[textureCacheKey].usedTimes++;let webglTexture=webglTextures[textureProperties. +__cacheKey];webglTexture!==void 0&&(webglTextures[textureProperties.__cacheKey]. +usedTimes--,webglTexture.usedTimes===0&&deleteTexture(texture)),textureProperties. +__cacheKey=textureCacheKey,textureProperties.__webglTexture=webglTextures[textureCacheKey]. +texture}return forceUpload}__name(initTexture,"initTexture");function uploadTexture(textureProperties,texture,slot){ +let textureType=_gl.TEXTURE_2D;(texture.isDataArrayTexture||texture.isCompressedArrayTexture)&& +(textureType=_gl.TEXTURE_2D_ARRAY),texture.isData3DTexture&&(textureType=_gl.TEXTURE_3D); +let forceUpload=initTexture(textureProperties,texture),source=texture.source;state. +bindTexture(textureType,textureProperties.__webglTexture,_gl.TEXTURE0+slot);let sourceProperties=properties. +get(source);if(source.version!==sourceProperties.__version||forceUpload===!0){state. +activeTexture(_gl.TEXTURE0+slot);let workingPrimaries=ColorManagement.getPrimaries( +ColorManagement.workingColorSpace),texturePrimaries=texture.colorSpace===NoColorSpace? +null:ColorManagement.getPrimaries(texture.colorSpace),unpackConversion=texture.colorSpace=== +NoColorSpace||workingPrimaries===texturePrimaries?_gl.NONE:_gl.BROWSER_DEFAULT_WEBGL; +_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,texture.flipY),_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, +texture.premultiplyAlpha),_gl.pixelStorei(_gl.UNPACK_ALIGNMENT,texture.unpackAlignment), +_gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,unpackConversion);let needsPowerOfTwo=textureNeedsPowerOfTwo( +texture)&&isPowerOfTwo3(texture.image)===!1,image=resizeImage(texture.image,needsPowerOfTwo, +!1,capabilities.maxTextureSize);image=verifyColorSpace(texture,image);let supportsMips=isPowerOfTwo3( +image)||isWebGL2,glFormat=utils.convert(texture.format,texture.colorSpace),glType=utils. +convert(texture.type),glInternalFormat=getInternalFormat(texture.internalFormat, +glFormat,glType,texture.colorSpace,texture.isVideoTexture);setTextureParameters( +textureType,texture,supportsMips);let mipmap,mipmaps=texture.mipmaps,useTexStorage=isWebGL2&& +texture.isVideoTexture!==!0&&glInternalFormat!==RGB_ETC1_Format,allocateMemory=sourceProperties. +__version===void 0||forceUpload===!0,levels=getMipLevels(texture,image,supportsMips); +if(texture.isDepthTexture)glInternalFormat=_gl.DEPTH_COMPONENT,isWebGL2?texture. +type===FloatType?glInternalFormat=_gl.DEPTH_COMPONENT32F:texture.type===UnsignedIntType? +glInternalFormat=_gl.DEPTH_COMPONENT24:texture.type===UnsignedInt248Type?glInternalFormat= +_gl.DEPTH24_STENCIL8:glInternalFormat=_gl.DEPTH_COMPONENT16:texture.type===FloatType&& +console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),texture. +format===DepthFormat&&glInternalFormat===_gl.DEPTH_COMPONENT&&texture.type!==UnsignedShortType&& +texture.type!==UnsignedIntType&&(console.warn("THREE.WebGLRenderer: Use Unsigned\ +ShortType or UnsignedIntType for DepthFormat DepthTexture."),texture.type=UnsignedIntType, +glType=utils.convert(texture.type)),texture.format===DepthStencilFormat&&glInternalFormat=== +_gl.DEPTH_COMPONENT&&(glInternalFormat=_gl.DEPTH_STENCIL,texture.type!==UnsignedInt248Type&& +(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilForma\ +t DepthTexture."),texture.type=UnsignedInt248Type,glType=utils.convert(texture.type))), +allocateMemory&&(useTexStorage?state.texStorage2D(_gl.TEXTURE_2D,1,glInternalFormat, +image.width,image.height):state.texImage2D(_gl.TEXTURE_2D,0,glInternalFormat,image. +width,image.height,0,glFormat,glType,null));else if(texture.isDataTexture)if(mipmaps. +length>0&&supportsMips){useTexStorage&&allocateMemory&&state.texStorage2D(_gl.TEXTURE_2D, +levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(let i2=0,il=mipmaps. +length;i2>=1,height>>=1}}else if(mipmaps. +length>0&&supportsMips){useTexStorage&&allocateMemory&&state.texStorage2D(_gl.TEXTURE_2D, +levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(let i2=0,il=mipmaps. +length;i20&&levels++, +state.texStorage2D(_gl.TEXTURE_CUBE_MAP,levels,glInternalFormat,cubeImage[0].width, +cubeImage[0].height));for(let i2=0;i2<6;i2++)if(isDataTexture){useTexStorage?state. +texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i2,0,0,0,cubeImage[i2].width,cubeImage[i2]. +height,glFormat,glType,cubeImage[i2].data):state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+ +i2,0,glInternalFormat,cubeImage[i2].width,cubeImage[i2].height,0,glFormat,glType, +cubeImage[i2].data);for(let j2=0;j2>level),height=Math.max(1,renderTarget.height>> +level);textureTarget===_gl.TEXTURE_3D||textureTarget===_gl.TEXTURE_2D_ARRAY?state. +texImage3D(textureTarget,level,glInternalFormat,width,height,renderTarget.depth, +0,glFormat,glType,null):state.texImage2D(textureTarget,level,glInternalFormat,width, +height,0,glFormat,glType,null)}state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer), +useMultisampledRTT(renderTarget)?multisampledRTTExt.framebufferTexture2DMultisampleEXT( +_gl.FRAMEBUFFER,attachment,textureTarget,properties.get(texture).__webglTexture, +0,getRenderTargetSamples(renderTarget)):(textureTarget===_gl.TEXTURE_2D||textureTarget>= +_gl.TEXTURE_CUBE_MAP_POSITIVE_X&&textureTarget<=_gl.TEXTURE_CUBE_MAP_NEGATIVE_Z)&& +_gl.framebufferTexture2D(_gl.FRAMEBUFFER,attachment,textureTarget,properties.get( +texture).__webglTexture,level),state.bindFramebuffer(_gl.FRAMEBUFFER,null)}__name( +setupFrameBufferTexture,"setupFrameBufferTexture");function setupRenderBufferStorage(renderbuffer,renderTarget,isMultisample){ +if(_gl.bindRenderbuffer(_gl.RENDERBUFFER,renderbuffer),renderTarget.depthBuffer&& +!renderTarget.stencilBuffer){let glInternalFormat=isWebGL2===!0?_gl.DEPTH_COMPONENT24: +_gl.DEPTH_COMPONENT16;if(isMultisample||useMultisampledRTT(renderTarget)){let depthTexture=renderTarget. +depthTexture;depthTexture&&depthTexture.isDepthTexture&&(depthTexture.type===FloatType? +glInternalFormat=_gl.DEPTH_COMPONENT32F:depthTexture.type===UnsignedIntType&&(glInternalFormat= +_gl.DEPTH_COMPONENT24));let samples=getRenderTargetSamples(renderTarget);useMultisampledRTT( +renderTarget)?multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, +samples,glInternalFormat,renderTarget.width,renderTarget.height):_gl.renderbufferStorageMultisample( +_gl.RENDERBUFFER,samples,glInternalFormat,renderTarget.width,renderTarget.height)}else +_gl.renderbufferStorage(_gl.RENDERBUFFER,glInternalFormat,renderTarget.width,renderTarget. +height);_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.DEPTH_ATTACHMENT,_gl.RENDERBUFFER, +renderbuffer)}else if(renderTarget.depthBuffer&&renderTarget.stencilBuffer){let samples=getRenderTargetSamples( +renderTarget);isMultisample&&useMultisampledRTT(renderTarget)===!1?_gl.renderbufferStorageMultisample( +_gl.RENDERBUFFER,samples,_gl.DEPTH24_STENCIL8,renderTarget.width,renderTarget.height): +useMultisampledRTT(renderTarget)?multisampledRTTExt.renderbufferStorageMultisampleEXT( +_gl.RENDERBUFFER,samples,_gl.DEPTH24_STENCIL8,renderTarget.width,renderTarget.height): +_gl.renderbufferStorage(_gl.RENDERBUFFER,_gl.DEPTH_STENCIL,renderTarget.width,renderTarget. +height),_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.DEPTH_STENCIL_ATTACHMENT, +_gl.RENDERBUFFER,renderbuffer)}else{let textures=renderTarget.isWebGLMultipleRenderTargets=== +!0?renderTarget.texture:[renderTarget.texture];for(let i2=0;i20){renderTargetProperties.__webglFramebuffer[i2]=[];for(let level=0;level< +texture.mipmaps.length;level++)renderTargetProperties.__webglFramebuffer[i2][level]= +_gl.createFramebuffer()}else renderTargetProperties.__webglFramebuffer[i2]=_gl.createFramebuffer()}else{ +if(isWebGL2&&texture.mipmaps&&texture.mipmaps.length>0){renderTargetProperties.__webglFramebuffer= +[];for(let level=0;level0&&useMultisampledRTT( +renderTarget)===!1){let textures=isMultipleRenderTargets?texture:[texture];renderTargetProperties. +__webglMultisampledFramebuffer=_gl.createFramebuffer(),renderTargetProperties.__webglColorRenderbuffer= +[],state.bindFramebuffer(_gl.FRAMEBUFFER,renderTargetProperties.__webglMultisampledFramebuffer); +for(let i2=0;i20)for(let level=0;level0)for(let level=0;level< +texture.mipmaps.length;level++)setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[level], +renderTarget,texture,_gl.COLOR_ATTACHMENT0,glTextureType,level);else setupFrameBufferTexture( +renderTargetProperties.__webglFramebuffer,renderTarget,texture,_gl.COLOR_ATTACHMENT0, +glTextureType,0);textureNeedsGenerateMipmaps(texture,supportsMips)&&generateMipmap( +glTextureType),state.unbindTexture()}renderTarget.depthBuffer&&setupDepthRenderbuffer( +renderTarget)}__name(setupRenderTarget,"setupRenderTarget");function updateRenderTargetMipmap(renderTarget){ +let supportsMips=isPowerOfTwo3(renderTarget)||isWebGL2,textures=renderTarget.isWebGLMultipleRenderTargets=== +!0?renderTarget.texture:[renderTarget.texture];for(let i2=0,il=textures.length;i2< +il;i2++){let texture=textures[i2];if(textureNeedsGenerateMipmaps(texture,supportsMips)){ +let target=renderTarget.isWebGLCubeRenderTarget?_gl.TEXTURE_CUBE_MAP:_gl.TEXTURE_2D, +webglTexture=properties.get(texture).__webglTexture;state.bindTexture(target,webglTexture), +generateMipmap(target),state.unbindTexture()}}}__name(updateRenderTargetMipmap,"\ +updateRenderTargetMipmap");function updateMultisampleRenderTarget(renderTarget){ +if(isWebGL2&&renderTarget.samples>0&&useMultisampledRTT(renderTarget)===!1){let textures=renderTarget. +isWebGLMultipleRenderTargets?renderTarget.texture:[renderTarget.texture],width=renderTarget. +width,height=renderTarget.height,mask=_gl.COLOR_BUFFER_BIT,invalidationArray=[], +depthStyle=renderTarget.stencilBuffer?_gl.DEPTH_STENCIL_ATTACHMENT:_gl.DEPTH_ATTACHMENT, +renderTargetProperties=properties.get(renderTarget),isMultipleRenderTargets=renderTarget. +isWebGLMultipleRenderTargets===!0;if(isMultipleRenderTargets)for(let i2=0;i20&&extensions.has("WEBGL\ +_multisampled_render_to_texture")===!0&&renderTargetProperties.__useRenderToTexture!== +!1}__name(useMultisampledRTT,"useMultisampledRTT");function updateVideoTexture(texture){ +let frame=info.render.frame;_videoTextures.get(texture)!==frame&&(_videoTextures. +set(texture,frame),texture.update())}__name(updateVideoTexture,"updateVideoTextu\ +re");function verifyColorSpace(texture,image){let colorSpace=texture.colorSpace, +format=texture.format,type=texture.type;return texture.isCompressedTexture===!0|| +texture.isVideoTexture===!0||texture.format===_SRGBAFormat||colorSpace!==LinearSRGBColorSpace&& +colorSpace!==NoColorSpace&&(ColorManagement.getTransfer(colorSpace)===SRGBTransfer? +isWebGL2===!1?extensions.has("EXT_sRGB")===!0&&format===RGBAFormat?(texture.format= +_SRGBAFormat,texture.minFilter=LinearFilter,texture.generateMipmaps=!1):image=ImageUtils2. +sRGBToLinear(image):(format!==RGBAFormat||type!==UnsignedByteType)&&console.warn( +"THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedB\ +yteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:", +colorSpace)),image}__name(verifyColorSpace,"verifyColorSpace"),this.allocateTextureUnit= +allocateTextureUnit,this.resetTextureUnits=resetTextureUnits,this.setTexture2D=setTexture2D, +this.setTexture2DArray=setTexture2DArray,this.setTexture3D=setTexture3D,this.setTextureCube= +setTextureCube,this.rebindTextures=rebindTextures,this.setupRenderTarget=setupRenderTarget, +this.updateRenderTargetMipmap=updateRenderTargetMipmap,this.updateMultisampleRenderTarget= +updateMultisampleRenderTarget,this.setupDepthRenderbuffer=setupDepthRenderbuffer, +this.setupFrameBufferTexture=setupFrameBufferTexture,this.useMultisampledRTT=useMultisampledRTT} +__name(WebGLTextures2,"WebGLTextures");function WebGLUtils2(gl,extensions,capabilities){let isWebGL2=capabilities.isWebGL2; +function convert(p2,colorSpace=NoColorSpace){let extension,transfer=ColorManagement. +getTransfer(colorSpace);if(p2===UnsignedByteType)return gl.UNSIGNED_BYTE;if(p2=== +UnsignedShort4444Type)return gl.UNSIGNED_SHORT_4_4_4_4;if(p2===UnsignedShort5551Type) +return gl.UNSIGNED_SHORT_5_5_5_1;if(p2===ByteType)return gl.BYTE;if(p2===ShortType) +return gl.SHORT;if(p2===UnsignedShortType)return gl.UNSIGNED_SHORT;if(p2===IntType) +return gl.INT;if(p2===UnsignedIntType)return gl.UNSIGNED_INT;if(p2===FloatType)return gl. +FLOAT;if(p2===HalfFloatType)return isWebGL2?gl.HALF_FLOAT:(extension=extensions. +get("OES_texture_half_float"),extension!==null?extension.HALF_FLOAT_OES:null);if(p2=== +AlphaFormat)return gl.ALPHA;if(p2===RGBAFormat)return gl.RGBA;if(p2===LuminanceFormat) +return gl.LUMINANCE;if(p2===LuminanceAlphaFormat)return gl.LUMINANCE_ALPHA;if(p2=== +DepthFormat)return gl.DEPTH_COMPONENT;if(p2===DepthStencilFormat)return gl.DEPTH_STENCIL; +if(p2===_SRGBAFormat)return extension=extensions.get("EXT_sRGB"),extension!==null? +extension.SRGB_ALPHA_EXT:null;if(p2===RedFormat)return gl.RED;if(p2===RedIntegerFormat) +return gl.RED_INTEGER;if(p2===RGFormat)return gl.RG;if(p2===RGIntegerFormat)return gl. +RG_INTEGER;if(p2===RGBAIntegerFormat)return gl.RGBA_INTEGER;if(p2===RGB_S3TC_DXT1_Format|| +p2===RGBA_S3TC_DXT1_Format||p2===RGBA_S3TC_DXT3_Format||p2===RGBA_S3TC_DXT5_Format) +if(transfer===SRGBTransfer)if(extension=extensions.get("WEBGL_compressed_texture\ +_s3tc_srgb"),extension!==null){if(p2===RGB_S3TC_DXT1_Format)return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT; +if(p2===RGBA_S3TC_DXT1_Format)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; +if(p2===RGBA_S3TC_DXT3_Format)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; +if(p2===RGBA_S3TC_DXT5_Format)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else +return null;else if(extension=extensions.get("WEBGL_compressed_texture_s3tc"),extension!== +null){if(p2===RGB_S3TC_DXT1_Format)return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; +if(p2===RGBA_S3TC_DXT1_Format)return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(p2=== +RGBA_S3TC_DXT3_Format)return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(p2===RGBA_S3TC_DXT5_Format) +return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(p2===RGB_PVRTC_4BPPV1_Format|| +p2===RGB_PVRTC_2BPPV1_Format||p2===RGBA_PVRTC_4BPPV1_Format||p2===RGBA_PVRTC_2BPPV1_Format) +if(extension=extensions.get("WEBGL_compressed_texture_pvrtc"),extension!==null){ +if(p2===RGB_PVRTC_4BPPV1_Format)return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; +if(p2===RGB_PVRTC_2BPPV1_Format)return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; +if(p2===RGBA_PVRTC_4BPPV1_Format)return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; +if(p2===RGBA_PVRTC_2BPPV1_Format)return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else +return null;if(p2===RGB_ETC1_Format)return extension=extensions.get("WEBGL_compr\ +essed_texture_etc1"),extension!==null?extension.COMPRESSED_RGB_ETC1_WEBGL:null;if(p2=== +RGB_ETC2_Format||p2===RGBA_ETC2_EAC_Format)if(extension=extensions.get("WEBGL_co\ +mpressed_texture_etc"),extension!==null){if(p2===RGB_ETC2_Format)return transfer=== +SRGBTransfer?extension.COMPRESSED_SRGB8_ETC2:extension.COMPRESSED_RGB8_ETC2;if(p2=== +RGBA_ETC2_EAC_Format)return transfer===SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: +extension.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(p2===RGBA_ASTC_4x4_Format|| +p2===RGBA_ASTC_5x4_Format||p2===RGBA_ASTC_5x5_Format||p2===RGBA_ASTC_6x5_Format|| +p2===RGBA_ASTC_6x6_Format||p2===RGBA_ASTC_8x5_Format||p2===RGBA_ASTC_8x6_Format|| +p2===RGBA_ASTC_8x8_Format||p2===RGBA_ASTC_10x5_Format||p2===RGBA_ASTC_10x6_Format|| +p2===RGBA_ASTC_10x8_Format||p2===RGBA_ASTC_10x10_Format||p2===RGBA_ASTC_12x10_Format|| +p2===RGBA_ASTC_12x12_Format)if(extension=extensions.get("WEBGL_compressed_textur\ +e_astc"),extension!==null){if(p2===RGBA_ASTC_4x4_Format)return transfer===SRGBTransfer? +extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:extension.COMPRESSED_RGBA_ASTC_4x4_KHR; +if(p2===RGBA_ASTC_5x4_Format)return transfer===SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: +extension.COMPRESSED_RGBA_ASTC_5x4_KHR;if(p2===RGBA_ASTC_5x5_Format)return transfer=== +SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:extension.COMPRESSED_RGBA_ASTC_5x5_KHR; +if(p2===RGBA_ASTC_6x5_Format)return transfer===SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: +extension.COMPRESSED_RGBA_ASTC_6x5_KHR;if(p2===RGBA_ASTC_6x6_Format)return transfer=== +SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:extension.COMPRESSED_RGBA_ASTC_6x6_KHR; +if(p2===RGBA_ASTC_8x5_Format)return transfer===SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: +extension.COMPRESSED_RGBA_ASTC_8x5_KHR;if(p2===RGBA_ASTC_8x6_Format)return transfer=== +SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:extension.COMPRESSED_RGBA_ASTC_8x6_KHR; +if(p2===RGBA_ASTC_8x8_Format)return transfer===SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: +extension.COMPRESSED_RGBA_ASTC_8x8_KHR;if(p2===RGBA_ASTC_10x5_Format)return transfer=== +SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:extension.COMPRESSED_RGBA_ASTC_10x5_KHR; +if(p2===RGBA_ASTC_10x6_Format)return transfer===SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: +extension.COMPRESSED_RGBA_ASTC_10x6_KHR;if(p2===RGBA_ASTC_10x8_Format)return transfer=== +SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:extension.COMPRESSED_RGBA_ASTC_10x8_KHR; +if(p2===RGBA_ASTC_10x10_Format)return transfer===SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: +extension.COMPRESSED_RGBA_ASTC_10x10_KHR;if(p2===RGBA_ASTC_12x10_Format)return transfer=== +SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:extension.COMPRESSED_RGBA_ASTC_12x10_KHR; +if(p2===RGBA_ASTC_12x12_Format)return transfer===SRGBTransfer?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: +extension.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(p2===RGBA_BPTC_Format|| +p2===RGB_BPTC_SIGNED_Format||p2===RGB_BPTC_UNSIGNED_Format)if(extension=extensions. +get("EXT_texture_compression_bptc"),extension!==null){if(p2===RGBA_BPTC_Format)return transfer=== +SRGBTransfer?extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:extension.COMPRESSED_RGBA_BPTC_UNORM_EXT; +if(p2===RGB_BPTC_SIGNED_Format)return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT; +if(p2===RGB_BPTC_UNSIGNED_Format)return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else +return null;if(p2===RED_RGTC1_Format||p2===SIGNED_RED_RGTC1_Format||p2===RED_GREEN_RGTC2_Format|| +p2===SIGNED_RED_GREEN_RGTC2_Format)if(extension=extensions.get("EXT_texture_comp\ +ression_rgtc"),extension!==null){if(p2===RGBA_BPTC_Format)return extension.COMPRESSED_RED_RGTC1_EXT; +if(p2===SIGNED_RED_RGTC1_Format)return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT; +if(p2===RED_GREEN_RGTC2_Format)return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;if(p2=== +SIGNED_RED_GREEN_RGTC2_Format)return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else +return null;return p2===UnsignedInt248Type?isWebGL2?gl.UNSIGNED_INT_24_8:(extension= +extensions.get("WEBGL_depth_texture"),extension!==null?extension.UNSIGNED_INT_24_8_WEBGL: +null):gl[p2]!==void 0?gl[p2]:null}return __name(convert,"convert"),{convert}}__name( +WebGLUtils2,"WebGLUtils");var ArrayCamera2=class extends PerspectiveCamera2{static{__name(this,"ArrayCamer\ +a")}constructor(array=[]){super(),this.isArrayCamera=!0,this.cameras=array}};var Group2=class extends Object3D{static{__name(this,"Group")}constructor(){super(), +this.isGroup=!0,this.type="Group"}};var _moveEvent2={type:"move"},WebXRController2=class{static{__name(this,"WebXRCo\ +ntroller")}constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){ +return this._hand===null&&(this._hand=new Group2,this._hand.matrixAutoUpdate=!1, +this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}), +this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Group2, +this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity= +!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity= +!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return this. +_grip===null&&(this._grip=new Group2,this._grip.matrixAutoUpdate=!1,this._grip.visible= +!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip. +hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3),this._grip}dispatchEvent(event){ +return this._targetRay!==null&&this._targetRay.dispatchEvent(event),this._grip!== +null&&this._grip.dispatchEvent(event),this._hand!==null&&this._hand.dispatchEvent( +event),this}connect(inputSource){if(inputSource&&inputSource.hand){let hand=this. +_hand;if(hand)for(let inputjoint of inputSource.hand.values())this._getHandJoint( +hand,inputjoint)}return this.dispatchEvent({type:"connected",data:inputSource}), +this}disconnect(inputSource){return this.dispatchEvent({type:"disconnected",data:inputSource}), +this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip. +visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(inputSource,frame,referenceSpace){ +let inputPose=null,gripPose=null,handPose=null,targetRay=this._targetRay,grip=this. +_grip,hand=this._hand;if(inputSource&&frame.session.visibilityState!=="visible-b\ +lurred"){if(hand&&inputSource.hand){handPose=!0;for(let inputjoint of inputSource. +hand.values()){let jointPose=frame.getJointPose(inputjoint,referenceSpace),joint=this. +_getHandJoint(hand,inputjoint);jointPose!==null&&(joint.matrix.fromArray(jointPose. +transform.matrix),joint.matrix.decompose(joint.position,joint.rotation,joint.scale), +joint.matrixWorldNeedsUpdate=!0,joint.jointRadius=jointPose.radius),joint.visible= +jointPose!==null}let indexTip=hand.joints["index-finger-tip"],thumbTip=hand.joints["\ +thumb-tip"],distance=indexTip.position.distanceTo(thumbTip.position),distanceToPinch=.02, +threshold=.005;hand.inputState.pinching&&distance>distanceToPinch+threshold?(hand. +inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:inputSource. +handedness,target:this})):!hand.inputState.pinching&&distance<=distanceToPinch-threshold&& +(hand.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:inputSource. +handedness,target:this}))}else grip!==null&&inputSource.gripSpace&&(gripPose=frame. +getPose(inputSource.gripSpace,referenceSpace),gripPose!==null&&(grip.matrix.fromArray( +gripPose.transform.matrix),grip.matrix.decompose(grip.position,grip.rotation,grip. +scale),grip.matrixWorldNeedsUpdate=!0,gripPose.linearVelocity?(grip.hasLinearVelocity= +!0,grip.linearVelocity.copy(gripPose.linearVelocity)):grip.hasLinearVelocity=!1, +gripPose.angularVelocity?(grip.hasAngularVelocity=!0,grip.angularVelocity.copy(gripPose. +angularVelocity)):grip.hasAngularVelocity=!1));targetRay!==null&&(inputPose=frame. +getPose(inputSource.targetRaySpace,referenceSpace),inputPose===null&&gripPose!== +null&&(inputPose=gripPose),inputPose!==null&&(targetRay.matrix.fromArray(inputPose. +transform.matrix),targetRay.matrix.decompose(targetRay.position,targetRay.rotation, +targetRay.scale),targetRay.matrixWorldNeedsUpdate=!0,inputPose.linearVelocity?(targetRay. +hasLinearVelocity=!0,targetRay.linearVelocity.copy(inputPose.linearVelocity)):targetRay. +hasLinearVelocity=!1,inputPose.angularVelocity?(targetRay.hasAngularVelocity=!0, +targetRay.angularVelocity.copy(inputPose.angularVelocity)):targetRay.hasAngularVelocity= +!1,this.dispatchEvent(_moveEvent2)))}return targetRay!==null&&(targetRay.visible= +inputPose!==null),grip!==null&&(grip.visible=gripPose!==null),hand!==null&&(hand. +visible=handPose!==null),this}_getHandJoint(hand,inputjoint){if(hand.joints[inputjoint. +jointName]===void 0){let joint=new Group2;joint.matrixAutoUpdate=!1,joint.visible= +!1,hand.joints[inputjoint.jointName]=joint,hand.add(joint)}return hand.joints[inputjoint. +jointName]}};var WebXRManager2=class extends EventDispatcher{static{__name(this,"WebXRManager")}constructor(renderer,gl){ +super();let scope=this,session=null,framebufferScaleFactor=1,referenceSpace=null, +referenceSpaceType="local-floor",foveation=1,customReferenceSpace=null,pose=null, +glBinding=null,glProjLayer=null,glBaseLayer=null,xrFrame=null,attributes=gl.getContextAttributes(), +initialRenderTarget=null,newRenderTarget=null,controllers=[],controllerInputSources=[], +currentSize=new Vector2,currentPixelRatio=null,cameraL=new PerspectiveCamera2;cameraL. +layers.enable(1),cameraL.viewport=new Vector42;let cameraR=new PerspectiveCamera2; +cameraR.layers.enable(2),cameraR.viewport=new Vector42;let cameras=[cameraL,cameraR], +cameraXR=new ArrayCamera2;cameraXR.layers.enable(1),cameraXR.layers.enable(2);let _currentDepthNear=null, +_currentDepthFar=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting= +!1,this.getController=function(index){let controller=controllers[index];return controller=== +void 0&&(controller=new WebXRController2,controllers[index]=controller),controller. +getTargetRaySpace()},this.getControllerGrip=function(index){let controller=controllers[index]; +return controller===void 0&&(controller=new WebXRController2,controllers[index]= +controller),controller.getGripSpace()},this.getHand=function(index){let controller=controllers[index]; +return controller===void 0&&(controller=new WebXRController2,controllers[index]= +controller),controller.getHandSpace()};function onSessionEvent(event){let controllerIndex=controllerInputSources. +indexOf(event.inputSource);if(controllerIndex===-1)return;let controller=controllers[controllerIndex]; +controller!==void 0&&(controller.update(event.inputSource,event.frame,customReferenceSpace|| +referenceSpace),controller.dispatchEvent({type:event.type,data:event.inputSource}))} +__name(onSessionEvent,"onSessionEvent");function onSessionEnd(){session.removeEventListener( +"select",onSessionEvent),session.removeEventListener("selectstart",onSessionEvent), +session.removeEventListener("selectend",onSessionEvent),session.removeEventListener( +"squeeze",onSessionEvent),session.removeEventListener("squeezestart",onSessionEvent), +session.removeEventListener("squeezeend",onSessionEvent),session.removeEventListener( +"end",onSessionEnd),session.removeEventListener("inputsourceschange",onInputSourcesChange); +for(let i2=0;i2=0&&(controllerInputSources[index]=null,controllers[index].disconnect(inputSource))} +for(let i2=0;i2=controllerInputSources.length){controllerInputSources.push(inputSource),controllerIndex= +i3;break}else if(controllerInputSources[i3]===null){controllerInputSources[i3]=inputSource, +controllerIndex=i3;break}if(controllerIndex===-1)break}let controller=controllers[controllerIndex]; +controller&&controller.connect(inputSource)}}__name(onInputSourcesChange,"onInpu\ +tSourcesChange");let cameraLPos=new Vector3,cameraRPos=new Vector3;function setProjectionFromUnion(camera,cameraL2,cameraR2){ +cameraLPos.setFromMatrixPosition(cameraL2.matrixWorld),cameraRPos.setFromMatrixPosition( +cameraR2.matrixWorld);let ipd=cameraLPos.distanceTo(cameraRPos),projL=cameraL2.projectionMatrix. +elements,projR=cameraR2.projectionMatrix.elements,near=projL[14]/(projL[10]-1),far=projL[14]/ +(projL[10]+1),topFov=(projL[9]+1)/projL[5],bottomFov=(projL[9]-1)/projL[5],leftFov=(projL[8]- +1)/projL[0],rightFov=(projR[8]+1)/projR[0],left=near*leftFov,right=near*rightFov, +zOffset=ipd/(-leftFov+rightFov),xOffset=zOffset*-leftFov;cameraL2.matrixWorld.decompose( +camera.position,camera.quaternion,camera.scale),camera.translateX(xOffset),camera. +translateZ(zOffset),camera.matrixWorld.compose(camera.position,camera.quaternion, +camera.scale),camera.matrixWorldInverse.copy(camera.matrixWorld).invert();let near2=near+ +zOffset,far2=far+zOffset,left2=left-xOffset,right2=right+(ipd-xOffset),top2=topFov* +far/far2*near2,bottom2=bottomFov*far/far2*near2;camera.projectionMatrix.makePerspective( +left2,right2,top2,bottom2,near2,far2),camera.projectionMatrixInverse.copy(camera. +projectionMatrix).invert()}__name(setProjectionFromUnion,"setProjectionFromUnion"); +function updateCamera(camera,parent){parent===null?camera.matrixWorld.copy(camera. +matrix):camera.matrixWorld.multiplyMatrices(parent.matrixWorld,camera.matrix),camera. +matrixWorldInverse.copy(camera.matrixWorld).invert()}__name(updateCamera,"update\ +Camera"),this.updateCamera=function(camera){if(session===null)return;cameraXR.near= +cameraR.near=cameraL.near=camera.near,cameraXR.far=cameraR.far=cameraL.far=camera. +far,(_currentDepthNear!==cameraXR.near||_currentDepthFar!==cameraXR.far)&&(session. +updateRenderState({depthNear:cameraXR.near,depthFar:cameraXR.far}),_currentDepthNear= +cameraXR.near,_currentDepthFar=cameraXR.far);let parent=camera.parent,cameras2=cameraXR. +cameras;updateCamera(cameraXR,parent);for(let i2=0;i20&&(uniforms.alphaTest.value= +material.alphaTest);let envMap=properties.get(material).envMap;if(envMap&&(uniforms. +envMap.value=envMap,uniforms.flipEnvMap.value=envMap.isCubeTexture&&envMap.isRenderTargetTexture=== +!1?-1:1,uniforms.reflectivity.value=material.reflectivity,uniforms.ior.value=material. +ior,uniforms.refractionRatio.value=material.refractionRatio),material.lightMap){ +uniforms.lightMap.value=material.lightMap;let scaleFactor=renderer._useLegacyLights=== +!0?Math.PI:1;uniforms.lightMapIntensity.value=material.lightMapIntensity*scaleFactor, +refreshTransformUniform(material.lightMap,uniforms.lightMapTransform)}material.aoMap&& +(uniforms.aoMap.value=material.aoMap,uniforms.aoMapIntensity.value=material.aoMapIntensity, +refreshTransformUniform(material.aoMap,uniforms.aoMapTransform))}__name(refreshUniformsCommon, +"refreshUniformsCommon");function refreshUniformsLine(uniforms,material){uniforms. +diffuse.value.copy(material.color),uniforms.opacity.value=material.opacity,material. +map&&(uniforms.map.value=material.map,refreshTransformUniform(material.map,uniforms. +mapTransform))}__name(refreshUniformsLine,"refreshUniformsLine");function refreshUniformsDash(uniforms,material){ +uniforms.dashSize.value=material.dashSize,uniforms.totalSize.value=material.dashSize+ +material.gapSize,uniforms.scale.value=material.scale}__name(refreshUniformsDash, +"refreshUniformsDash");function refreshUniformsPoints(uniforms,material,pixelRatio,height){ +uniforms.diffuse.value.copy(material.color),uniforms.opacity.value=material.opacity, +uniforms.size.value=material.size*pixelRatio,uniforms.scale.value=height*.5,material. +map&&(uniforms.map.value=material.map,refreshTransformUniform(material.map,uniforms. +uvTransform)),material.alphaMap&&(uniforms.alphaMap.value=material.alphaMap,refreshTransformUniform( +material.alphaMap,uniforms.alphaMapTransform)),material.alphaTest>0&&(uniforms.alphaTest. +value=material.alphaTest)}__name(refreshUniformsPoints,"refreshUniformsPoints"); +function refreshUniformsSprites(uniforms,material){uniforms.diffuse.value.copy(material. +color),uniforms.opacity.value=material.opacity,uniforms.rotation.value=material. +rotation,material.map&&(uniforms.map.value=material.map,refreshTransformUniform( +material.map,uniforms.mapTransform)),material.alphaMap&&(uniforms.alphaMap.value= +material.alphaMap,refreshTransformUniform(material.alphaMap,uniforms.alphaMapTransform)), +material.alphaTest>0&&(uniforms.alphaTest.value=material.alphaTest)}__name(refreshUniformsSprites, +"refreshUniformsSprites");function refreshUniformsPhong(uniforms,material){uniforms. +specular.value.copy(material.specular),uniforms.shininess.value=Math.max(material. +shininess,1e-4)}__name(refreshUniformsPhong,"refreshUniformsPhong");function refreshUniformsToon(uniforms,material){ +material.gradientMap&&(uniforms.gradientMap.value=material.gradientMap)}__name(refreshUniformsToon, +"refreshUniformsToon");function refreshUniformsStandard(uniforms,material){uniforms. +metalness.value=material.metalness,material.metalnessMap&&(uniforms.metalnessMap. +value=material.metalnessMap,refreshTransformUniform(material.metalnessMap,uniforms. +metalnessMapTransform)),uniforms.roughness.value=material.roughness,material.roughnessMap&& +(uniforms.roughnessMap.value=material.roughnessMap,refreshTransformUniform(material. +roughnessMap,uniforms.roughnessMapTransform)),properties.get(material).envMap&&(uniforms. +envMapIntensity.value=material.envMapIntensity)}__name(refreshUniformsStandard,"\ +refreshUniformsStandard");function refreshUniformsPhysical(uniforms,material,transmissionRenderTarget){ +uniforms.ior.value=material.ior,material.sheen>0&&(uniforms.sheenColor.value.copy( +material.sheenColor).multiplyScalar(material.sheen),uniforms.sheenRoughness.value= +material.sheenRoughness,material.sheenColorMap&&(uniforms.sheenColorMap.value=material. +sheenColorMap,refreshTransformUniform(material.sheenColorMap,uniforms.sheenColorMapTransform)), +material.sheenRoughnessMap&&(uniforms.sheenRoughnessMap.value=material.sheenRoughnessMap, +refreshTransformUniform(material.sheenRoughnessMap,uniforms.sheenRoughnessMapTransform))), +material.clearcoat>0&&(uniforms.clearcoat.value=material.clearcoat,uniforms.clearcoatRoughness. +value=material.clearcoatRoughness,material.clearcoatMap&&(uniforms.clearcoatMap. +value=material.clearcoatMap,refreshTransformUniform(material.clearcoatMap,uniforms. +clearcoatMapTransform)),material.clearcoatRoughnessMap&&(uniforms.clearcoatRoughnessMap. +value=material.clearcoatRoughnessMap,refreshTransformUniform(material.clearcoatRoughnessMap, +uniforms.clearcoatRoughnessMapTransform)),material.clearcoatNormalMap&&(uniforms. +clearcoatNormalMap.value=material.clearcoatNormalMap,refreshTransformUniform(material. +clearcoatNormalMap,uniforms.clearcoatNormalMapTransform),uniforms.clearcoatNormalScale. +value.copy(material.clearcoatNormalScale),material.side===BackSide&&uniforms.clearcoatNormalScale. +value.negate())),material.iridescence>0&&(uniforms.iridescence.value=material.iridescence, +uniforms.iridescenceIOR.value=material.iridescenceIOR,uniforms.iridescenceThicknessMinimum. +value=material.iridescenceThicknessRange[0],uniforms.iridescenceThicknessMaximum. +value=material.iridescenceThicknessRange[1],material.iridescenceMap&&(uniforms.iridescenceMap. +value=material.iridescenceMap,refreshTransformUniform(material.iridescenceMap,uniforms. +iridescenceMapTransform)),material.iridescenceThicknessMap&&(uniforms.iridescenceThicknessMap. +value=material.iridescenceThicknessMap,refreshTransformUniform(material.iridescenceThicknessMap, +uniforms.iridescenceThicknessMapTransform))),material.transmission>0&&(uniforms. +transmission.value=material.transmission,uniforms.transmissionSamplerMap.value=transmissionRenderTarget. +texture,uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, +transmissionRenderTarget.height),material.transmissionMap&&(uniforms.transmissionMap. +value=material.transmissionMap,refreshTransformUniform(material.transmissionMap, +uniforms.transmissionMapTransform)),uniforms.thickness.value=material.thickness, +material.thicknessMap&&(uniforms.thicknessMap.value=material.thicknessMap,refreshTransformUniform( +material.thicknessMap,uniforms.thicknessMapTransform)),uniforms.attenuationDistance. +value=material.attenuationDistance,uniforms.attenuationColor.value.copy(material. +attenuationColor)),material.anisotropy>0&&(uniforms.anisotropyVector.value.set(material. +anisotropy*Math.cos(material.anisotropyRotation),material.anisotropy*Math.sin(material. +anisotropyRotation)),material.anisotropyMap&&(uniforms.anisotropyMap.value=material. +anisotropyMap,refreshTransformUniform(material.anisotropyMap,uniforms.anisotropyMapTransform))), +uniforms.specularIntensity.value=material.specularIntensity,uniforms.specularColor. +value.copy(material.specularColor),material.specularColorMap&&(uniforms.specularColorMap. +value=material.specularColorMap,refreshTransformUniform(material.specularColorMap, +uniforms.specularColorMapTransform)),material.specularIntensityMap&&(uniforms.specularIntensityMap. +value=material.specularIntensityMap,refreshTransformUniform(material.specularIntensityMap, +uniforms.specularIntensityMapTransform))}__name(refreshUniformsPhysical,"refresh\ +UniformsPhysical");function refreshUniformsMatcap(uniforms,material){material.matcap&& +(uniforms.matcap.value=material.matcap)}__name(refreshUniformsMatcap,"refreshUni\ +formsMatcap");function refreshUniformsDistance(uniforms,material){let light=properties. +get(material).light;uniforms.referencePosition.value.setFromMatrixPosition(light. +matrixWorld),uniforms.nearDistance.value=light.shadow.camera.near,uniforms.farDistance. +value=light.shadow.camera.far}return __name(refreshUniformsDistance,"refreshUnif\ +ormsDistance"),{refreshFogUniforms,refreshMaterialUniforms}}__name(WebGLMaterials2, +"WebGLMaterials");function WebGLUniformsGroups2(gl,info,capabilities,state){let buffers={},updateList={}, +allocatedBindingPoints=[],maxBindingPoints=capabilities.isWebGL2?gl.getParameter( +gl.MAX_UNIFORM_BUFFER_BINDINGS):0;function bind(uniformsGroup,program){let webglProgram=program. +program;state.uniformBlockBinding(uniformsGroup,webglProgram)}__name(bind,"bind"); +function update(uniformsGroup,program){let buffer=buffers[uniformsGroup.id];buffer=== +void 0&&(prepareUniformsGroup(uniformsGroup),buffer=createBuffer(uniformsGroup), +buffers[uniformsGroup.id]=buffer,uniformsGroup.addEventListener("dispose",onUniformsGroupsDispose)); +let webglProgram=program.program;state.updateUBOMapping(uniformsGroup,webglProgram); +let frame=info.render.frame;updateList[uniformsGroup.id]!==frame&&(updateBufferData( +uniformsGroup),updateList[uniformsGroup.id]=frame)}__name(update,"update");function createBuffer(uniformsGroup){ +let bindingPointIndex=allocateBindingPointIndex();uniformsGroup.__bindingPointIndex= +bindingPointIndex;let buffer=gl.createBuffer(),size3=uniformsGroup.__size,usage=uniformsGroup. +usage;return gl.bindBuffer(gl.UNIFORM_BUFFER,buffer),gl.bufferData(gl.UNIFORM_BUFFER, +size3,usage),gl.bindBuffer(gl.UNIFORM_BUFFER,null),gl.bindBufferBase(gl.UNIFORM_BUFFER, +bindingPointIndex,buffer),buffer}__name(createBuffer,"createBuffer");function allocateBindingPointIndex(){ +for(let i2=0;i20&&(offset+=chunkSize-chunkOffset),uniformsGroup.__size= +offset,uniformsGroup.__cache={},this}__name(prepareUniformsGroup,"prepareUniform\ +sGroup");function getUniformSize(value){let info2={boundary:0,storage:0};return typeof value== +"number"||typeof value=="boolean"?(info2.boundary=4,info2.storage=4):value.isVector2? +(info2.boundary=8,info2.storage=8):value.isVector3||value.isColor?(info2.boundary= +16,info2.storage=12):value.isVector4?(info2.boundary=16,info2.storage=16):value. +isMatrix3?(info2.boundary=48,info2.storage=48):value.isMatrix4?(info2.boundary=64, +info2.storage=64):value.isTexture?console.warn("THREE.WebGLRenderer: Texture sam\ +plers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer:\ + Unsupported uniform value type.",value),info2}__name(getUniformSize,"getUniform\ +Size");function onUniformsGroupsDispose(event){let uniformsGroup=event.target;uniformsGroup. +removeEventListener("dispose",onUniformsGroupsDispose);let index=allocatedBindingPoints. +indexOf(uniformsGroup.__bindingPointIndex);allocatedBindingPoints.splice(index,1), +gl.deleteBuffer(buffers[uniformsGroup.id]),delete buffers[uniformsGroup.id],delete updateList[uniformsGroup. +id]}__name(onUniformsGroupsDispose,"onUniformsGroupsDispose");function dispose(){ +for(let id in buffers)gl.deleteBuffer(buffers[id]);allocatedBindingPoints=[],buffers= +{},updateList={}}return __name(dispose,"dispose"),{bind,update,dispose}}__name(WebGLUniformsGroups2, +"WebGLUniformsGroups");var WebGLRenderer2=class{static{__name(this,"WebGLRenderer")}constructor(parameters={}){ +let{canvas=createCanvasElement(),context=null,depth=!0,stencil=!0,alpha=!1,antialias=!1, +premultipliedAlpha=!0,preserveDrawingBuffer=!1,powerPreference="default",failIfMajorPerformanceCaveat=!1}=parameters; +this.isWebGLRenderer=!0;let _alpha;context!==null?_alpha=context.getContextAttributes(). +alpha:_alpha=alpha;let uintClearColor=new Uint32Array(4),intClearColor=new Int32Array( +4),currentRenderList=null,currentRenderState=null,renderListStack=[],renderStateStack=[]; +this.domElement=canvas,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. +_outputColorSpace=SRGBColorSpace,this._useLegacyLights=!1,this.toneMapping=NoToneMapping, +this.toneMappingExposure=1;let _this=this,_isContextLost=!1,_currentActiveCubeFace=0, +_currentActiveMipmapLevel=0,_currentRenderTarget=null,_currentMaterialId=-1,_currentCamera=null, +_currentViewport=new Vector42,_currentScissor=new Vector42,_currentScissorTest=null, +_currentClearColor=new Color(0),_currentClearAlpha=0,_width=canvas.width,_height=canvas. +height,_pixelRatio=1,_opaqueSort=null,_transparentSort=null,_viewport=new Vector42( +0,0,_width,_height),_scissor=new Vector42(0,0,_width,_height),_scissorTest=!1,_frustum=new Frustum2, +_clippingEnabled=!1,_localClippingEnabled=!1,_transmissionRenderTarget=null,_projScreenMatrix4=new Matrix4, +_vector25=new Vector2,_vector33=new Vector3,_emptyScene={background:null,fog:null, +environment:null,overrideMaterial:null,isScene:!0};function getTargetPixelRatio(){ +return _currentRenderTarget===null?_pixelRatio:1}__name(getTargetPixelRatio,"get\ +TargetPixelRatio");let _gl=context;function getContext(contextNames,contextAttributes){ +for(let i2=0;i2{function checkMaterialsReady(){ +if(materials2.forEach(function(material){properties.get(material).currentProgram. +isReady()&&materials2.delete(material)}),materials2.size===0){resolve(scene2);return} +setTimeout(checkMaterialsReady,10)}__name(checkMaterialsReady,"checkMaterialsRea\ +dy"),extensions.get("KHR_parallel_shader_compile")!==null?checkMaterialsReady(): +setTimeout(checkMaterialsReady,10)})};let onAnimationFrameCallback=null;function onAnimationFrame(time){ +onAnimationFrameCallback&&onAnimationFrameCallback(time)}__name(onAnimationFrame, +"onAnimationFrame");function onXRSessionStart(){animation.stop()}__name(onXRSessionStart, +"onXRSessionStart");function onXRSessionEnd(){animation.start()}__name(onXRSessionEnd, +"onXRSessionEnd");let animation=new WebGLAnimation2;animation.setAnimationLoop(onAnimationFrame), +typeof self<"u"&&animation.setContext(self),this.setAnimationLoop=function(callback){ +onAnimationFrameCallback=callback,xr2.setAnimationLoop(callback),callback===null? +animation.stop():animation.start()},xr2.addEventListener("sessionstart",onXRSessionStart), +xr2.addEventListener("sessionend",onXRSessionEnd),this.render=function(scene2,camera){ +if(camera!==void 0&&camera.isCamera!==!0){console.error("THREE.WebGLRenderer.ren\ +der: camera is not an instance of THREE.Camera.");return}if(_isContextLost===!0) +return;scene2.matrixWorldAutoUpdate===!0&&scene2.updateMatrixWorld(),camera.parent=== +null&&camera.matrixWorldAutoUpdate===!0&&camera.updateMatrixWorld(),xr2.enabled=== +!0&&xr2.isPresenting===!0&&(xr2.cameraAutoUpdate===!0&&xr2.updateCamera(camera), +camera=xr2.getCamera()),scene2.isScene===!0&&scene2.onBeforeRender(_this,scene2, +camera,_currentRenderTarget),currentRenderState=renderStates.get(scene2,renderStateStack. +length),currentRenderState.init(),renderStateStack.push(currentRenderState),_projScreenMatrix4. +multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse),_frustum.setFromProjectionMatrix( +_projScreenMatrix4),_localClippingEnabled=this.localClippingEnabled,_clippingEnabled= +clipping.init(this.clippingPlanes,_localClippingEnabled),currentRenderList=renderLists. +get(scene2,renderListStack.length),currentRenderList.init(),renderListStack.push( +currentRenderList),projectObject(scene2,camera,0,_this.sortObjects),currentRenderList. +finish(),_this.sortObjects===!0&¤tRenderList.sort(_opaqueSort,_transparentSort), +this.info.render.frame++,_clippingEnabled===!0&&clipping.beginShadows();let shadowsArray=currentRenderState. +state.shadowsArray;if(shadowMap.render(shadowsArray,scene2,camera),_clippingEnabled=== +!0&&clipping.endShadows(),this.info.autoReset===!0&&this.info.reset(),background. +render(currentRenderList,scene2),currentRenderState.setupLights(_this._useLegacyLights), +camera.isArrayCamera){let cameras=camera.cameras;for(let i2=0,l=cameras.length;i2< +l;i2++){let camera2=cameras[i2];renderScene(currentRenderList,scene2,camera2,camera2. +viewport)}}else renderScene(currentRenderList,scene2,camera);_currentRenderTarget!== +null&&(textures.updateMultisampleRenderTarget(_currentRenderTarget),textures.updateRenderTargetMipmap( +_currentRenderTarget)),scene2.isScene===!0&&scene2.onAfterRender(_this,scene2,camera), +bindingStates.resetDefaultState(),_currentMaterialId=-1,_currentCamera=null,renderStateStack. +pop(),renderStateStack.length>0?currentRenderState=renderStateStack[renderStateStack. +length-1]:currentRenderState=null,renderListStack.pop(),renderListStack.length>0? +currentRenderList=renderListStack[renderListStack.length-1]:currentRenderList=null}; +function projectObject(object,camera,groupOrder,sortObjects){if(object.visible=== +!1)return;if(object.layers.test(camera.layers)){if(object.isGroup)groupOrder=object. +renderOrder;else if(object.isLOD)object.autoUpdate===!0&&object.update(camera);else if(object. +isLight)currentRenderState.pushLight(object),object.castShadow&¤tRenderState. +pushShadow(object);else if(object.isSprite){if(!object.frustumCulled||_frustum.intersectsSprite( +object)){sortObjects&&_vector33.setFromMatrixPosition(object.matrixWorld).applyMatrix4( +_projScreenMatrix4);let geometry=objects.update(object),material=object.material; +material.visible&¤tRenderList.push(object,geometry,material,groupOrder,_vector33. +z,null)}}else if((object.isMesh||object.isLine||object.isPoints)&&(!object.frustumCulled|| +_frustum.intersectsObject(object))){let geometry=objects.update(object),material=object. +material;if(sortObjects&&(object.boundingSphere!==void 0?(object.boundingSphere=== +null&&object.computeBoundingSphere(),_vector33.copy(object.boundingSphere.center)): +(geometry.boundingSphere===null&&geometry.computeBoundingSphere(),_vector33.copy( +geometry.boundingSphere.center)),_vector33.applyMatrix4(object.matrixWorld).applyMatrix4( +_projScreenMatrix4)),Array.isArray(material)){let groups=geometry.groups;for(let i2=0, +l=groups.length;i20&&renderTransmissionPass(opaqueObjects,transmissiveObjects, +scene2,camera),viewport&&state.viewport(_currentViewport.copy(viewport)),opaqueObjects. +length>0&&renderObjects(opaqueObjects,scene2,camera),transmissiveObjects.length> +0&&renderObjects(transmissiveObjects,scene2,camera),transparentObjects.length>0&& +renderObjects(transparentObjects,scene2,camera),state.buffers.depth.setTest(!0), +state.buffers.depth.setMask(!0),state.buffers.color.setMask(!0),state.setPolygonOffset( +!1)}__name(renderScene,"renderScene");function renderTransmissionPass(opaqueObjects,transmissiveObjects,scene2,camera){ +if((scene2.isScene===!0?scene2.overrideMaterial:null)!==null)return;let isWebGL2=capabilities. +isWebGL2;_transmissionRenderTarget===null&&(_transmissionRenderTarget=new WebGLRenderTarget2( +1,1,{generateMipmaps:!0,type:extensions.has("EXT_color_buffer_half_float")?HalfFloatType: +UnsignedByteType,minFilter:LinearMipmapLinearFilter,samples:isWebGL2?4:0})),_this. +getDrawingBufferSize(_vector25),isWebGL2?_transmissionRenderTarget.setSize(_vector25. +x,_vector25.y):_transmissionRenderTarget.setSize(floorPowerOfTwo(_vector25.x),floorPowerOfTwo( +_vector25.y));let currentRenderTarget=_this.getRenderTarget();_this.setRenderTarget( +_transmissionRenderTarget),_this.getClearColor(_currentClearColor),_currentClearAlpha= +_this.getClearAlpha(),_currentClearAlpha<1&&_this.setClearColor(16777215,.5),_this. +clear();let currentToneMapping=_this.toneMapping;_this.toneMapping=NoToneMapping, +renderObjects(opaqueObjects,scene2,camera),textures.updateMultisampleRenderTarget( +_transmissionRenderTarget),textures.updateRenderTargetMipmap(_transmissionRenderTarget); +let renderTargetNeedsUpdate=!1;for(let i2=0,l=transmissiveObjects.length;i20),morphTargets=!!geometry. +morphAttributes.position,morphNormals=!!geometry.morphAttributes.normal,morphColors=!!geometry. +morphAttributes.color,toneMapping=NoToneMapping;material.toneMapped&&(_currentRenderTarget=== +null||_currentRenderTarget.isXRRenderTarget===!0)&&(toneMapping=_this.toneMapping); +let morphAttribute=geometry.morphAttributes.position||geometry.morphAttributes.normal|| +geometry.morphAttributes.color,morphTargetsCount=morphAttribute!==void 0?morphAttribute. +length:0,materialProperties=properties.get(material),lights=currentRenderState.state. +lights;if(_clippingEnabled===!0&&(_localClippingEnabled===!0||camera!==_currentCamera)){ +let useCache=camera===_currentCamera&&material.id===_currentMaterialId;clipping. +setState(material,camera,useCache)}let needsProgramChange=!1;material.version=== +materialProperties.__version?(materialProperties.needsLights&&materialProperties. +lightsStateVersion!==lights.state.version||materialProperties.outputColorSpace!== +colorSpace||object.isBatchedMesh&&materialProperties.batching===!1||!object.isBatchedMesh&& +materialProperties.batching===!0||object.isInstancedMesh&&materialProperties.instancing=== +!1||!object.isInstancedMesh&&materialProperties.instancing===!0||object.isSkinnedMesh&& +materialProperties.skinning===!1||!object.isSkinnedMesh&&materialProperties.skinning=== +!0||object.isInstancedMesh&&materialProperties.instancingColor===!0&&object.instanceColor=== +null||object.isInstancedMesh&&materialProperties.instancingColor===!1&&object.instanceColor!== +null||materialProperties.envMap!==envMap||material.fog===!0&&materialProperties. +fog!==fog||materialProperties.numClippingPlanes!==void 0&&(materialProperties.numClippingPlanes!== +clipping.numPlanes||materialProperties.numIntersection!==clipping.numIntersection)|| +materialProperties.vertexAlphas!==vertexAlphas||materialProperties.vertexTangents!== +vertexTangents||materialProperties.morphTargets!==morphTargets||materialProperties. +morphNormals!==morphNormals||materialProperties.morphColors!==morphColors||materialProperties. +toneMapping!==toneMapping||capabilities.isWebGL2===!0&&materialProperties.morphTargetsCount!== +morphTargetsCount)&&(needsProgramChange=!0):(needsProgramChange=!0,materialProperties. +__version=material.version);let program=materialProperties.currentProgram;needsProgramChange=== +!0&&(program=getProgram(material,scene2,object));let refreshProgram=!1,refreshMaterial=!1, +refreshLights=!1,p_uniforms=program.getUniforms(),m_uniforms=materialProperties. +uniforms;if(state.useProgram(program.program)&&(refreshProgram=!0,refreshMaterial= +!0,refreshLights=!0),material.id!==_currentMaterialId&&(_currentMaterialId=material. +id,refreshMaterial=!0),refreshProgram||_currentCamera!==camera){p_uniforms.setValue( +_gl,"projectionMatrix",camera.projectionMatrix),p_uniforms.setValue(_gl,"viewMat\ +rix",camera.matrixWorldInverse);let uCamPos=p_uniforms.map.cameraPosition;uCamPos!== +void 0&&uCamPos.setValue(_gl,_vector33.setFromMatrixPosition(camera.matrixWorld)), +capabilities.logarithmicDepthBuffer&&p_uniforms.setValue(_gl,"logDepthBufFC",2/(Math. +log(camera.far+1)/Math.LN2)),(material.isMeshPhongMaterial||material.isMeshToonMaterial|| +material.isMeshLambertMaterial||material.isMeshBasicMaterial||material.isMeshStandardMaterial|| +material.isShaderMaterial)&&p_uniforms.setValue(_gl,"isOrthographic",camera.isOrthographicCamera=== +!0),_currentCamera!==camera&&(_currentCamera=camera,refreshMaterial=!0,refreshLights= +!0)}if(object.isSkinnedMesh){p_uniforms.setOptional(_gl,object,"bindMatrix"),p_uniforms. +setOptional(_gl,object,"bindMatrixInverse");let skeleton=object.skeleton;skeleton&& +(capabilities.floatVertexTextures?(skeleton.boneTexture===null&&skeleton.computeBoneTexture(), +p_uniforms.setValue(_gl,"boneTexture",skeleton.boneTexture,textures)):console.warn( +"THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OE\ +S_texture_float and vertex textures support is required."))}object.isBatchedMesh&& +(p_uniforms.setOptional(_gl,object,"batchingTexture"),p_uniforms.setValue(_gl,"b\ +atchingTexture",object._matricesTexture,textures));let morphAttributes=geometry. +morphAttributes;if((morphAttributes.position!==void 0||morphAttributes.normal!== +void 0||morphAttributes.color!==void 0&&capabilities.isWebGL2===!0)&&morphtargets. +update(object,geometry,program),(refreshMaterial||materialProperties.receiveShadow!== +object.receiveShadow)&&(materialProperties.receiveShadow=object.receiveShadow,p_uniforms. +setValue(_gl,"receiveShadow",object.receiveShadow)),material.isMeshGouraudMaterial&& +material.envMap!==null&&(m_uniforms.envMap.value=envMap,m_uniforms.flipEnvMap.value= +envMap.isCubeTexture&&envMap.isRenderTargetTexture===!1?-1:1),refreshMaterial&&(p_uniforms. +setValue(_gl,"toneMappingExposure",_this.toneMappingExposure),materialProperties. +needsLights&&markUniformsLightsNeedsUpdate(m_uniforms,refreshLights),fog&&material. +fog===!0&&materials.refreshFogUniforms(m_uniforms,fog),materials.refreshMaterialUniforms( +m_uniforms,material,_pixelRatio,_height,_transmissionRenderTarget),WebGLUniforms2. +upload(_gl,getUniformList(materialProperties),m_uniforms,textures)),material.isShaderMaterial&& +material.uniformsNeedUpdate===!0&&(WebGLUniforms2.upload(_gl,getUniformList(materialProperties), +m_uniforms,textures),material.uniformsNeedUpdate=!1),material.isSpriteMaterial&& +p_uniforms.setValue(_gl,"center",object.center),p_uniforms.setValue(_gl,"modelVi\ +ewMatrix",object.modelViewMatrix),p_uniforms.setValue(_gl,"normalMatrix",object. +normalMatrix),p_uniforms.setValue(_gl,"modelMatrix",object.matrixWorld),material. +isShaderMaterial||material.isRawShaderMaterial){let groups=material.uniformsGroups; +for(let i2=0,l=groups.length;i20&&textures.useMultisampledRTT( +renderTarget)===!1?framebuffer=properties.get(renderTarget).__webglMultisampledFramebuffer: +Array.isArray(__webglFramebuffer)?framebuffer=__webglFramebuffer[activeMipmapLevel]: +framebuffer=__webglFramebuffer,_currentViewport.copy(renderTarget.viewport),_currentScissor. +copy(renderTarget.scissor),_currentScissorTest=renderTarget.scissorTest}else _currentViewport. +copy(_viewport).multiplyScalar(_pixelRatio).floor(),_currentScissor.copy(_scissor). +multiplyScalar(_pixelRatio).floor(),_currentScissorTest=_scissorTest;if(state.bindFramebuffer( +_gl.FRAMEBUFFER,framebuffer)&&capabilities.drawBuffers&&useDefaultFramebuffer&&state. +drawBuffers(renderTarget,framebuffer),state.viewport(_currentViewport),state.scissor( +_currentScissor),state.setScissorTest(_currentScissorTest),isCube){let textureProperties=properties. +get(renderTarget.texture);_gl.framebufferTexture2D(_gl.FRAMEBUFFER,_gl.COLOR_ATTACHMENT0, +_gl.TEXTURE_CUBE_MAP_POSITIVE_X+activeCubeFace,textureProperties.__webglTexture, +activeMipmapLevel)}else if(isRenderTarget3D){let textureProperties=properties.get( +renderTarget.texture),layer=activeCubeFace||0;_gl.framebufferTextureLayer(_gl.FRAMEBUFFER, +_gl.COLOR_ATTACHMENT0,textureProperties.__webglTexture,activeMipmapLevel||0,layer)} +_currentMaterialId=-1},this.readRenderTargetPixels=function(renderTarget,x2,y2,width,height,buffer,activeCubeFaceIndex){ +if(!(renderTarget&&renderTarget.isWebGLRenderTarget)){console.error("THREE.WebGL\ +Renderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); +return}let framebuffer=properties.get(renderTarget).__webglFramebuffer;if(renderTarget. +isWebGLCubeRenderTarget&&activeCubeFaceIndex!==void 0&&(framebuffer=framebuffer[activeCubeFaceIndex]), +framebuffer){state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);try{let texture=renderTarget. +texture,textureFormat=texture.format,textureType=texture.type;if(textureFormat!== +RGBAFormat&&utils.convert(textureFormat)!==_gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_FORMAT)){ +console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not i\ +n RGBA or implementation defined format.");return}let halfFloatSupportedByExt=textureType=== +HalfFloatType&&(extensions.has("EXT_color_buffer_half_float")||capabilities.isWebGL2&& +extensions.has("EXT_color_buffer_float"));if(textureType!==UnsignedByteType&&utils. +convert(textureType)!==_gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE)&&!(textureType=== +FloatType&&(capabilities.isWebGL2||extensions.has("OES_texture_float")||extensions. +has("WEBGL_color_buffer_float")))&&!halfFloatSupportedByExt){console.error("THRE\ +E.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType \ +or implementation defined type.");return}x2>=0&&x2<=renderTarget.width-width&&y2>= +0&&y2<=renderTarget.height-height&&_gl.readPixels(x2,y2,width,height,utils.convert( +textureFormat),utils.convert(textureType),buffer)}finally{let framebuffer2=_currentRenderTarget!== +null?properties.get(_currentRenderTarget).__webglFramebuffer:null;state.bindFramebuffer( +_gl.FRAMEBUFFER,framebuffer2)}}},this.copyFramebufferToTexture=function(position2,texture,level=0){ +let levelScale=Math.pow(2,-level),width=Math.floor(texture.image.width*levelScale), +height=Math.floor(texture.image.height*levelScale);textures.setTexture2D(texture, +0),_gl.copyTexSubImage2D(_gl.TEXTURE_2D,level,0,0,position2.x,position2.y,width, +height),state.unbindTexture()},this.copyTextureToTexture=function(position2,srcTexture,dstTexture,level=0){ +let width=srcTexture.image.width,height=srcTexture.image.height,glFormat=utils.convert( +dstTexture.format),glType=utils.convert(dstTexture.type);textures.setTexture2D(dstTexture, +0),_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,dstTexture.flipY),_gl.pixelStorei(_gl. +UNPACK_PREMULTIPLY_ALPHA_WEBGL,dstTexture.premultiplyAlpha),_gl.pixelStorei(_gl. +UNPACK_ALIGNMENT,dstTexture.unpackAlignment),srcTexture.isDataTexture?_gl.texSubImage2D( +_gl.TEXTURE_2D,level,position2.x,position2.y,width,height,glFormat,glType,srcTexture. +image.data):srcTexture.isCompressedTexture?_gl.compressedTexSubImage2D(_gl.TEXTURE_2D, +level,position2.x,position2.y,srcTexture.mipmaps[0].width,srcTexture.mipmaps[0]. +height,glFormat,srcTexture.mipmaps[0].data):_gl.texSubImage2D(_gl.TEXTURE_2D,level, +position2.x,position2.y,glFormat,glType,srcTexture.image),level===0&&dstTexture. +generateMipmaps&&_gl.generateMipmap(_gl.TEXTURE_2D),state.unbindTexture()},this. +copyTextureToTexture3D=function(sourceBox,position2,srcTexture,dstTexture,level=0){ +if(_this.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTextur\ +e3D: can only be used with WebGL2.");return}let width=sourceBox.max.x-sourceBox. +min.x+1,height=sourceBox.max.y-sourceBox.min.y+1,depth2=sourceBox.max.z-sourceBox. +min.z+1,glFormat=utils.convert(dstTexture.format),glType=utils.convert(dstTexture. +type),glTarget;if(dstTexture.isData3DTexture)textures.setTexture3D(dstTexture,0), +glTarget=_gl.TEXTURE_3D;else if(dstTexture.isDataArrayTexture||dstTexture.isCompressedArrayTexture) +textures.setTexture2DArray(dstTexture,0),glTarget=_gl.TEXTURE_2D_ARRAY;else{console. +warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTextur\ +e3D and THREE.DataTexture2DArray.");return}_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, +dstTexture.flipY),_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,dstTexture. +premultiplyAlpha),_gl.pixelStorei(_gl.UNPACK_ALIGNMENT,dstTexture.unpackAlignment); +let unpackRowLen=_gl.getParameter(_gl.UNPACK_ROW_LENGTH),unpackImageHeight=_gl.getParameter( +_gl.UNPACK_IMAGE_HEIGHT),unpackSkipPixels=_gl.getParameter(_gl.UNPACK_SKIP_PIXELS), +unpackSkipRows=_gl.getParameter(_gl.UNPACK_SKIP_ROWS),unpackSkipImages=_gl.getParameter( +_gl.UNPACK_SKIP_IMAGES),image=srcTexture.isCompressedTexture?srcTexture.mipmaps[level]: +srcTexture.image;_gl.pixelStorei(_gl.UNPACK_ROW_LENGTH,image.width),_gl.pixelStorei( +_gl.UNPACK_IMAGE_HEIGHT,image.height),_gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS,sourceBox. +min.x),_gl.pixelStorei(_gl.UNPACK_SKIP_ROWS,sourceBox.min.y),_gl.pixelStorei(_gl. +UNPACK_SKIP_IMAGES,sourceBox.min.z),srcTexture.isDataTexture||srcTexture.isData3DTexture? +_gl.texSubImage3D(glTarget,level,position2.x,position2.y,position2.z,width,height, +depth2,glFormat,glType,image.data):srcTexture.isCompressedArrayTexture?(console. +warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compresse\ +d srcTexture."),_gl.compressedTexSubImage3D(glTarget,level,position2.x,position2. +y,position2.z,width,height,depth2,glFormat,image.data)):_gl.texSubImage3D(glTarget, +level,position2.x,position2.y,position2.z,width,height,depth2,glFormat,glType,image), +_gl.pixelStorei(_gl.UNPACK_ROW_LENGTH,unpackRowLen),_gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, +unpackImageHeight),_gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS,unpackSkipPixels),_gl. +pixelStorei(_gl.UNPACK_SKIP_ROWS,unpackSkipRows),_gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, +unpackSkipImages),level===0&&dstTexture.generateMipmaps&&_gl.generateMipmap(glTarget), +state.unbindTexture()},this.initTexture=function(texture){texture.isCubeTexture? +textures.setTextureCube(texture,0):texture.isData3DTexture?textures.setTexture3D( +texture,0):texture.isDataArrayTexture||texture.isCompressedArrayTexture?textures. +setTexture2DArray(texture,0):textures.setTexture2D(texture,0),state.unbindTexture()}, +this.resetState=function(){_currentActiveCubeFace=0,_currentActiveMipmapLevel=0, +_currentRenderTarget=null,state.reset(),bindingStates.reset()},typeof __THREE_DEVTOOLS__< +"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){ +return WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(colorSpace){ +this._outputColorSpace=colorSpace;let gl=this.getContext();gl.drawingBufferColorSpace= +colorSpace===DisplayP3ColorSpace?"display-p3":"srgb",gl.unpackColorSpace=ColorManagement. +workingColorSpace===LinearDisplayP3ColorSpace?"display-p3":"srgb"}get outputEncoding(){ +return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been remo\ +ved. Use .outputColorSpace instead."),this.outputColorSpace===SRGBColorSpace?sRGBEncoding: +LinearEncoding}set outputEncoding(encoding){console.warn("THREE.WebGLRenderer: P\ +roperty .outputEncoding has been removed. Use .outputColorSpace instead."),this. +outputColorSpace=encoding===sRGBEncoding?SRGBColorSpace:LinearSRGBColorSpace}get useLegacyLights(){ +return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been\ + deprecated. Migrate your lighting according to the following guide: https://dis\ +course.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(value){ +console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprec\ +ated. Migrate your lighting according to the following guide: https://discourse.\ +threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights= +value}};var _start3=new Vector3,_end3=new Vector3,LineSegments2=class extends Line{static{ +__name(this,"LineSegments")}constructor(geometry,material){super(geometry,material), +this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let geometry=this. +geometry;if(geometry.index===null){let positionAttribute=geometry.attributes.position, +lineDistances=[];for(let i2=0,l=positionAttribute.count;i2 + + #define ITERATIONS 10.0 + + uniform sampler2D texture; + uniform vec2 delta; + + varying vec2 vUv; + + void main() { + + vec4 color = vec4( 0.0 ); + + float total = 0.0; + + // randomize the lookup values to hide the fixed number of samples + + float offset = rand( vUv ); + + for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) { + + float percent = ( t + offset - 0.5 ) / ITERATIONS; + float weight = 1.0 - abs( percent ); + + color += texture2D( texture, vUv + delta * percent ) * weight; + total += weight; + + } + + gl_FragColor = color / total; + + }`};function triangleBlurTexture(renderer,texture,blur=.1,passes=1,iterations=10){let width=texture. +image.width,height=texture.image.height,cameraRTT=new OrthographicCamera2(-1,1,1, +-1,0,1),sceneRTT=new Scene2,renderTarget1=new WebGLRenderTarget2(width,height),renderTarget2=new WebGLRenderTarget2( +width,height),shader=makeTriangleBlurShader(iterations),blurMaterial=new ShaderMaterial2( +{vertexShader:shader.vertexShader,fragmentShader:shader.fragmentShader,uniforms:UniformsUtils2. +clone(shader.uniforms)});blurMaterial.uniforms.delta.value=new Vector2(1,1);let planeGeometry=new PlaneGeometry( +2,2),fullScreenQuad=new Mesh(planeGeometry,blurMaterial);sceneRTT.add(fullScreenQuad); +let lastTexture=texture;for(;passes--;)blurMaterial.uniforms.blurTexture.value=lastTexture, +blurMaterial.uniforms.delta.value=new Vector2(blur,0),renderer.setRenderTarget(renderTarget1), +renderer.render(sceneRTT,cameraRTT),renderer.setRenderTarget(null),lastTexture=renderTarget1. +texture,blurMaterial.uniforms.blurTexture.value=lastTexture,blurMaterial.uniforms. +delta.value=new Vector2(0,blur),renderer.setRenderTarget(renderTarget2),renderer. +render(sceneRTT,cameraRTT),renderer.setRenderTarget(null),lastTexture=renderTarget2. +texture;return lastTexture}__name(triangleBlurTexture,"triangleBlurTexture");function makeTriangleBlurShader(iterations=10){ +let{texture,...uniforms}=TriangleBlurShader.uniforms,TriangleBlurShader2={...TriangleBlurShader, +name:"TriangleBlurShader2",uniforms:{...uniforms,blurTexture:{value:null}}};return TriangleBlurShader2. +fragmentShader=TriangleBlurShader2.fragmentShader.replace("uniform sampler2D tex\ +ture;","uniform sampler2D blurTexture;"),TriangleBlurShader2.fragmentShader=TriangleBlurShader2. +fragmentShader.replace("texture2D( texture","texture2D( blurTexture"),TriangleBlurShader2. +fragmentShader=TriangleBlurShader2.fragmentShader.replace("#define ITERATIONS 10\ +.0","#define ITERATIONS "+iterations+".0"),TriangleBlurShader2}__name(makeTriangleBlurShader, +"makeTriangleBlurShader");globalThis.navigator||(globalThis.navigator={});var VRButton=class _VRButton{static{__name(this,"VRButton")}static createButton(renderer){ +let button=document.createElement("button");function showEnterVR(){let currentSession=null; +async function onSessionStarted(session){session.addEventListener("end",onSessionEnded), +await renderer.xr.setSession(session),button.textContent="EXIT VR",currentSession= +session}__name(onSessionStarted,"onSessionStarted");function onSessionEnded(){currentSession. +removeEventListener("end",onSessionEnded),button.textContent="ENTER VR",currentSession= +null}__name(onSessionEnded,"onSessionEnded"),button.style.display="",button.style. +cursor="pointer",button.style.left="calc(50% - 50px)",button.style.width="100px", +button.textContent="ENTER VR";let sessionInit={optionalFeatures:["local-floor","\ +bounded-floor","hand-tracking","layers"]};button.onmouseenter=function(){button. +style.opacity="1.0"},button.onmouseleave=function(){button.style.opacity="0.5"}, +button.onclick=function(){currentSession===null?navigator.xr.requestSession("imm\ +ersive-vr",sessionInit).then(onSessionStarted):(currentSession.end(),navigator.xr. +offerSession!==void 0&&navigator.xr.offerSession("immersive-vr",sessionInit).then( +onSessionStarted))},navigator.xr.offerSession!==void 0&&navigator.xr.offerSession( +"immersive-vr",sessionInit).then(onSessionStarted)}__name(showEnterVR,"showEnter\ +VR");function disableButton(){button.style.display="",button.style.cursor="auto", +button.style.left="calc(50% - 75px)",button.style.width="150px",button.onmouseenter= +null,button.onmouseleave=null,button.onclick=null}__name(disableButton,"disableB\ +utton");function showWebXRNotFound(){disableButton(),button.textContent="VR NOT \ +SUPPORTED"}__name(showWebXRNotFound,"showWebXRNotFound");function showVRNotAllowed(exception){ +disableButton(),console.warn("Exception when trying to call xr.isSessionSupporte\ +d",exception),button.textContent="VR NOT ALLOWED"}__name(showVRNotAllowed,"showV\ +RNotAllowed");function stylizeElement(element2){element2.style.position="absolut\ +e",element2.style.bottom="20px",element2.style.padding="12px 6px",element2.style. +border="1px solid #fff",element2.style.borderRadius="4px",element2.style.background= +"rgba(0,0,0,0.1)",element2.style.color="#fff",element2.style.font="normal 13px s\ +ans-serif",element2.style.textAlign="center",element2.style.opacity="0.5",element2. +style.outline="none",element2.style.zIndex="999"}if(__name(stylizeElement,"styli\ +zeElement"),"xr"in navigator)return button.id="VRButton",button.style.display="n\ +one",stylizeElement(button),navigator.xr.isSessionSupported("immersive-vr").then( +function(supported){supported?showEnterVR():showWebXRNotFound(),supported&&_VRButton. +xrSessionIsGranted&&button.click()}).catch(showVRNotAllowed),button;{let message=document. +createElement("a");return window.isSecureContext===!1?(message.href=document.location. +href.replace(/^http:/,"https:"),message.innerHTML="WEBXR NEEDS HTTPS"):(message. +href="https://immersiveweb.dev/",message.innerHTML="WEBXR NOT AVAILABLE"),message. +style.left="calc(50% - 90px)",message.style.width="180px",message.style.textDecoration= +"none",stylizeElement(message),message}}static registerSessionGrantedListener(){ +if(typeof navigator<"u"&&"xr"in navigator){if(/WebXRViewer\//i.test(navigator.userAgent)) +return;navigator.xr.addEventListener("sessiongranted",()=>{_VRButton.xrSessionIsGranted= +!0})}}};VRButton.xrSessionIsGranted=!1;VRButton.registerSessionGrantedListener();var __runInitializers43=function(thisArg,initializers,value){for(var useValue=arguments. +length>2,i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},instance=null, +isCreatingSingleton=!1,WebglRendererThree=(()=>{let _classDecorators=[reactive], +_classDescriptor,_classExtraInitializers=[],_classThis,_instanceExtraInitializers=[], +_localClippingEnabled_decorators,_localClippingEnabled_initializers=[];var WebglRendererThree2=class{static{ +__name(this,"WebglRendererThree")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(null):void 0;_localClippingEnabled_decorators= +[signal],__esDecorate43(null,null,_localClippingEnabled_decorators,{kind:"field", +name:"localClippingEnabled",static:!1,private:!1,access:{has:obj=>"localClipping\ +Enabled"in obj,get:obj=>obj.localClippingEnabled,set:(obj,value)=>{obj.localClippingEnabled= +value}},metadata:_metadata},_localClippingEnabled_initializers,_instanceExtraInitializers), +__esDecorate43(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),WebglRendererThree2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers43( +_classThis,_classExtraInitializers)}static singleton(){if(instance)return instance; +try{return isCreatingSingleton=!0,instance=new WebglRendererThree2}catch(e){throw e}finally{ +isCreatingSingleton=!1}}constructor(){if(!isCreatingSingleton)throw new Error("c\ +lass is a singleton, use the static .singleton() method to get an instance")}sceneStates=(__runInitializers43( +this,_instanceExtraInitializers),new WeakMap);localClippingEnabled=__runInitializers43( +this,_localClippingEnabled_initializers,!1);initialized(scene2){return this.sceneStates. +has(scene2)}initialize(scene2){let sceneState=this.sceneStates.get(scene2);if(sceneState) +return;let renderer=new WebGLRenderer2({alpha:!0,premultipliedAlpha:!0,antialias:!0}), +effects=new Effects2;effects.createEffect(()=>{renderer.localClippingEnabled=this. +localClippingEnabled}),renderer.xr.enabled=!0,renderer.setPixelRatio(globalThis. +devicePixelRatio),renderer.shadowMap.enabled=!0,renderer.shadowMap.type=PCFSoftShadowMap, +this.sceneStates.set(scene2,sceneState={renderer,effects}),scene2._glLayer.appendChild( +renderer.domElement)}uninitialize(scene2){let sceneState=this.sceneStates.get(scene2); +sceneState&&(scene2._glLayer?.removeChild(sceneState.renderer.domElement),sceneState. +renderer.dispose(),sceneState.pmremgen?.dispose(),sceneState.effects.stopEffects(), +this.sceneStates.delete(scene2))}drawScene(scene2){let sceneState=this.sceneStates. +get(scene2);if(!sceneState)throw new ReferenceError("Can not draw scene. Scene s\ +tate should be initialized first.");let{renderer}=sceneState;renderer.render(scene2. +three,scene2.threeCamera)}updateResolution(scene2,x2,y2){Motor.once(()=>{if(!this. +initialized(scene2))return;this.sceneStates.get(scene2).renderer.setSize(x2,y2)}, +!1)}setClearColor(scene2,color,opacity2){let state=this.sceneStates.get(scene2); +if(!state)throw new ReferenceError("Unable to set clear color. Scene state shoul\ +d be initialized first.");state.renderer.setClearColor(color,opacity2)}setClearAlpha(scene2,opacity2){ +let state=this.sceneStates.get(scene2);if(!state)throw new ReferenceError("Unabl\ +e to set clear alpha. Scene state should be initialized first.");state.renderer. +setClearAlpha(opacity2)}setShadowMapType(scene2,type){let state=this.sceneStates. +get(scene2);if(!state)throw new ReferenceError("Unable to set clear alpha. Scene\ + state should be initialized first.");if(!type){state.renderer.shadowMap.type=PCFShadowMap; +return}type=type.toLowerCase(),type=="pcf"?state.renderer.shadowMap.type=PCFShadowMap: +type=="pcfsoft"?state.renderer.shadowMap.type=PCFSoftShadowMap:type=="basic"&&(state. +renderer.shadowMap.type=BasicShadowMap)}setPhysicallyCorrectLights(scene2,value){ +let state=this.sceneStates.get(scene2);if(!state)throw new ReferenceError("Unabl\ +e to set value. Scene state should be initialized first.");state.renderer.physicallyCorrectLights= +value,state.renderer.useLegacyLights=!value}#bgVersion=0;enableBackground(scene2,isEquirectangular,blurAmount,cb){ +let state=this.sceneStates.get(scene2);if(!state)throw new ReferenceError("Inter\ +nal error: Scene not registered with WebGLRendererThree.");this.#bgVersion+=1,state. +bgIsEquirectangular=isEquirectangular,isEquirectangular&&(state.pmremgen||(state. +pmremgen=new PMREMGenerator2(state.renderer),state.pmremgen.compileCubemapShader())), +state.hasBg=!0,this.#loadBackgroundTexture(scene2,blurAmount,cb)}disableBackground(scene2){ +let state=this.sceneStates.get(scene2);if(!state)throw new ReferenceError("Inter\ +nal error: Scene not registered with WebGLRendererThree.");this.#bgVersion+=1,!state. +hasBg&&!state.hasEnv&&(state.pmremgen?.dispose(),state.pmremgen=void 0),state.bgTexture?. +dispose(),state.hasBg=!1}#loadBackgroundTexture(scene2,blurAmount,cb){let state=this. +sceneStates.get(scene2);if(!state)throw new ReferenceError("Internal error: Scen\ +e not registered with WebGLRendererThree.");let version3=this.#bgVersion;new TextureLoader2(). +load(scene2.background??"",tex=>{version3===this.#bgVersion&&(blurAmount>0&&(state. +bgTexture=triangleBlurTexture(state.renderer,tex,blurAmount,2),tex.dispose(),tex= +state.bgTexture),state.bgIsEquirectangular?(state.bgTexture=state.pmremgen.fromEquirectangular( +tex).texture,tex.dispose()):state.bgTexture=tex,cb(state.bgTexture))})}#envVersion=0;enableEnvironment(scene2,cb){ +let state=this.sceneStates.get(scene2);if(!state)throw new ReferenceError("Inter\ +nal error: Scene not registered with WebGLRendererThree.");this.#envVersion+=1,state. +pmremgen||(state.pmremgen=new PMREMGenerator2(state.renderer),state.pmremgen.compileCubemapShader()), +state.hasEnv=!0,this.#loadEnvironmentTexture(scene2,cb)}disableEnvironment(scene2){ +let state=this.sceneStates.get(scene2);if(!state)throw new ReferenceError("Inter\ +nal error: Scene not registered with WebGLRendererThree.");this.#envVersion+=1,!state. +hasBg&&!state.hasEnv&&(state.pmremgen?.dispose(),state.pmremgen=void 0),state.envTexture?. +dispose(),state.hasEnv=!1}#loadEnvironmentTexture(scene2,cb){let state=this.sceneStates. +get(scene2);if(!state)throw new ReferenceError("Internal error: Scene not regist\ +ered with WebGLRendererThree.");let version3=this.#envVersion;new TextureLoader2(). +load(scene2.environment??"",tex=>{version3===this.#envVersion&&(state.envTexture= +state.pmremgen.fromEquirectangular(tex).texture,tex.dispose(),cb(state.envTexture))})}requestFrame(scene2,fn){ +let state=this.sceneStates.get(scene2);if(!state)throw new ReferenceError("Unabl\ +e to request frame. Scene state should be initialized first.");let{renderer}=state; +renderer.setAnimationLoop?renderer.setAnimationLoop(fn):renderer.animate&&renderer. +animate(fn)}enableVR(scene2,enable){let state=this.sceneStates.get(scene2);if(!state) +throw new ReferenceError("Unable to enable VR. Scene state should be initialized\ + first.");let{renderer}=state;renderer.xr.enabled=enable}createDefaultVRButton(scene2){ +let state=this.sceneStates.get(scene2);if(!state)throw new ReferenceError("Unabl\ +e to create VR button. Scene state should be initialized first.");let{renderer}=state; +return VRButton.createButton(renderer)}};return WebglRendererThree2=_classThis})();var instance2=null,isCreatingSingleton2=!1,Css3dRendererThree=class _Css3dRendererThree{static{ +__name(this,"Css3dRendererThree")}static singleton(){if(instance2)return instance2; +try{return isCreatingSingleton2=!0,instance2=new _Css3dRendererThree}catch(e){throw e}finally{ +isCreatingSingleton2=!1}}constructor(){if(!isCreatingSingleton2)throw new Error( +"class is a singleton, use the static .singleton() method to get an instance")}sceneStates=new WeakMap;initialized(scene2){ +return this.sceneStates.has(scene2)}initialize(scene2){let sceneState=this.sceneStates. +get(scene2);if(sceneState)return;this.sceneStates.set(scene2,sceneState={renderer:new CSS3DRendererNested}); +let{renderer}=sceneState;scene2._cssLayer.appendChild(renderer.domElement)}uninitialize(scene2){ +let sceneState=this.sceneStates.get(scene2);sceneState&&(scene2._cssLayer?.removeChild( +sceneState.renderer.domElement),this.sceneStates.delete(scene2))}drawScene(scene2){ +let sceneState=this.sceneStates.get(scene2);if(!sceneState)throw new ReferenceError( +"Can not draw scene. Scene state should be initialized first.");let{renderer}=sceneState; +renderer.render(scene2.threeCSS,scene2.threeCamera)}updateResolution(scene2,x2,y2){ +Motor.once(()=>{if(!this.initialized(scene2))return;this.sceneStates.get(scene2). +renderer.setSize(x2,y2)})}requestFrame(_scene,fn){requestAnimationFrame(fn)}};var __runInitializers44=function(thisArg,initializers,value){for(var useValue=arguments. +length>2,i2=0;i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},magic=__name( +()=>` LUME \u2728 v${version2} \u{1F449} https://github.com/lume/lume `,"magic"); +queueMicrotask(()=>console.info(magic()));var Scene3=(()=>{let _classDecorators=[ +element("lume-scene",autoDefineElements)],_classDescriptor,_classExtraInitializers=[], +_classThis,_classSuper=SharedAPI,_instanceExtraInitializers=[],_enableCss_decorators, +_enableCss_initializers=[],_webgl_decorators,_webgl_initializers=[],_swapLayers_decorators, +_swapLayers_initializers=[],_shadowMode_decorators,_shadowMode_initializers=[],_get_shadowmapType_decorators, +_vr_decorators,_vr_initializers=[],_backgroundColor_decorators,_backgroundColor_initializers=[], +_backgroundOpacity_decorators,_backgroundOpacity_initializers=[],_background_decorators, +_background_initializers=[],_backgroundIntensity_decorators,_backgroundIntensity_initializers=[], +_backgroundBlur_decorators,_backgroundBlur_initializers=[],_equirectangularBackground_decorators, +_equirectangularBackground_initializers=[],_environment_decorators,_environment_initializers=[], +_fogMode_decorators,_fogMode_initializers=[],_fogNear_decorators,_fogNear_initializers=[], +_fogFar_decorators,_fogFar_initializers=[],_fogColor_decorators,_fogColor_initializers=[], +_fogDensity_decorators,_fogDensity_initializers=[],_physicallyCorrectLights_decorators, +_physicallyCorrectLights_initializers=[],_cameraNear_decorators,_cameraNear_initializers=[], +_cameraFar_decorators,_cameraFar_initializers=[],_perspective_decorators,_perspective_initializers=[], +___defaultThreeCamera_decorators,___defaultThreeCamera_initializers=[],___camera_decorators, +___camera_initializers=[],___localClipping_decorators,___localClipping_initializers=[], +___elementParentSize_decorators,___elementParentSize_initializers=[];var Scene4=class extends _classSuper{static{ +__name(this,"Scene")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_enableCss_decorators=[booleanAttribute],_webgl_decorators=[booleanAttribute],_swapLayers_decorators= +[booleanAttribute],_shadowMode_decorators=[attribute],_get_shadowmapType_decorators= +[attribute,noSignal],_vr_decorators=[booleanAttribute],_backgroundColor_decorators= +[attribute],_backgroundOpacity_decorators=[numberAttribute],_background_decorators= +[attribute],_backgroundIntensity_decorators=[numberAttribute],_backgroundBlur_decorators= +[numberAttribute],_equirectangularBackground_decorators=[booleanAttribute],_environment_decorators= +[attribute],_fogMode_decorators=[stringAttribute],_fogNear_decorators=[numberAttribute], +_fogFar_decorators=[numberAttribute],_fogColor_decorators=[stringAttribute],_fogDensity_decorators= +[numberAttribute],_physicallyCorrectLights_decorators=[booleanAttribute],_cameraNear_decorators= +[numberAttribute],_cameraFar_decorators=[numberAttribute],_perspective_decorators= +[numberAttribute],___defaultThreeCamera_decorators=[signal],___camera_decorators= +[signal],___localClipping_decorators=[signal],___elementParentSize_decorators=[signal], +__esDecorate44(this,null,_get_shadowmapType_decorators,{kind:"getter",name:"shad\ +owmapType",static:!1,private:!1,access:{has:obj=>"shadowmapType"in obj,get:obj=>obj. +shadowmapType},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate44( +null,null,_enableCss_decorators,{kind:"field",name:"enableCss",static:!1,private:!1, +access:{has:obj=>"enableCss"in obj,get:obj=>obj.enableCss,set:(obj,value)=>{obj. +enableCss=value}},metadata:_metadata},_enableCss_initializers,_instanceExtraInitializers), +__esDecorate44(null,null,_webgl_decorators,{kind:"field",name:"webgl",static:!1, +private:!1,access:{has:obj=>"webgl"in obj,get:obj=>obj.webgl,set:(obj,value)=>{obj. +webgl=value}},metadata:_metadata},_webgl_initializers,_instanceExtraInitializers), +__esDecorate44(null,null,_swapLayers_decorators,{kind:"field",name:"swapLayers", +static:!1,private:!1,access:{has:obj=>"swapLayers"in obj,get:obj=>obj.swapLayers, +set:(obj,value)=>{obj.swapLayers=value}},metadata:_metadata},_swapLayers_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,_shadowMode_decorators,{kind:"\ +field",name:"shadowMode",static:!1,private:!1,access:{has:obj=>"shadowMode"in obj, +get:obj=>obj.shadowMode,set:(obj,value)=>{obj.shadowMode=value}},metadata:_metadata}, +_shadowMode_initializers,_instanceExtraInitializers),__esDecorate44(null,null,_vr_decorators, +{kind:"field",name:"vr",static:!1,private:!1,access:{has:obj=>"vr"in obj,get:obj=>obj. +vr,set:(obj,value)=>{obj.vr=value}},metadata:_metadata},_vr_initializers,_instanceExtraInitializers), +__esDecorate44(null,null,_backgroundColor_decorators,{kind:"field",name:"backgro\ +undColor",static:!1,private:!1,access:{has:obj=>"backgroundColor"in obj,get:obj=>obj. +backgroundColor,set:(obj,value)=>{obj.backgroundColor=value}},metadata:_metadata}, +_backgroundColor_initializers,_instanceExtraInitializers),__esDecorate44(null,null, +_backgroundOpacity_decorators,{kind:"field",name:"backgroundOpacity",static:!1,private:!1, +access:{has:obj=>"backgroundOpacity"in obj,get:obj=>obj.backgroundOpacity,set:(obj,value)=>{ +obj.backgroundOpacity=value}},metadata:_metadata},_backgroundOpacity_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,_background_decorators,{kind:"\ +field",name:"background",static:!1,private:!1,access:{has:obj=>"background"in obj, +get:obj=>obj.background,set:(obj,value)=>{obj.background=value}},metadata:_metadata}, +_background_initializers,_instanceExtraInitializers),__esDecorate44(null,null,_backgroundIntensity_decorators, +{kind:"field",name:"backgroundIntensity",static:!1,private:!1,access:{has:obj=>"\ +backgroundIntensity"in obj,get:obj=>obj.backgroundIntensity,set:(obj,value)=>{obj. +backgroundIntensity=value}},metadata:_metadata},_backgroundIntensity_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,_backgroundBlur_decorators, +{kind:"field",name:"backgroundBlur",static:!1,private:!1,access:{has:obj=>"backg\ +roundBlur"in obj,get:obj=>obj.backgroundBlur,set:(obj,value)=>{obj.backgroundBlur= +value}},metadata:_metadata},_backgroundBlur_initializers,_instanceExtraInitializers), +__esDecorate44(null,null,_equirectangularBackground_decorators,{kind:"field",name:"\ +equirectangularBackground",static:!1,private:!1,access:{has:obj=>"equirectangula\ +rBackground"in obj,get:obj=>obj.equirectangularBackground,set:(obj,value)=>{obj. +equirectangularBackground=value}},metadata:_metadata},_equirectangularBackground_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,_environment_decorators,{kind:"\ +field",name:"environment",static:!1,private:!1,access:{has:obj=>"environment"in obj, +get:obj=>obj.environment,set:(obj,value)=>{obj.environment=value}},metadata:_metadata}, +_environment_initializers,_instanceExtraInitializers),__esDecorate44(null,null,_fogMode_decorators, +{kind:"field",name:"fogMode",static:!1,private:!1,access:{has:obj=>"fogMode"in obj, +get:obj=>obj.fogMode,set:(obj,value)=>{obj.fogMode=value}},metadata:_metadata},_fogMode_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,_fogNear_decorators,{kind:"\ +field",name:"fogNear",static:!1,private:!1,access:{has:obj=>"fogNear"in obj,get:obj=>obj. +fogNear,set:(obj,value)=>{obj.fogNear=value}},metadata:_metadata},_fogNear_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,_fogFar_decorators,{kind:"f\ +ield",name:"fogFar",static:!1,private:!1,access:{has:obj=>"fogFar"in obj,get:obj=>obj. +fogFar,set:(obj,value)=>{obj.fogFar=value}},metadata:_metadata},_fogFar_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,_fogColor_decorators,{kind:"\ +field",name:"fogColor",static:!1,private:!1,access:{has:obj=>"fogColor"in obj,get:obj=>obj. +fogColor,set:(obj,value)=>{obj.fogColor=value}},metadata:_metadata},_fogColor_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,_fogDensity_decorators,{kind:"\ +field",name:"fogDensity",static:!1,private:!1,access:{has:obj=>"fogDensity"in obj, +get:obj=>obj.fogDensity,set:(obj,value)=>{obj.fogDensity=value}},metadata:_metadata}, +_fogDensity_initializers,_instanceExtraInitializers),__esDecorate44(null,null,_physicallyCorrectLights_decorators, +{kind:"field",name:"physicallyCorrectLights",static:!1,private:!1,access:{has:obj=>"\ +physicallyCorrectLights"in obj,get:obj=>obj.physicallyCorrectLights,set:(obj,value)=>{ +obj.physicallyCorrectLights=value}},metadata:_metadata},_physicallyCorrectLights_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,_cameraNear_decorators,{kind:"\ +field",name:"cameraNear",static:!1,private:!1,access:{has:obj=>"cameraNear"in obj, +get:obj=>obj.cameraNear,set:(obj,value)=>{obj.cameraNear=value}},metadata:_metadata}, +_cameraNear_initializers,_instanceExtraInitializers),__esDecorate44(null,null,_cameraFar_decorators, +{kind:"field",name:"cameraFar",static:!1,private:!1,access:{has:obj=>"cameraFar"in +obj,get:obj=>obj.cameraFar,set:(obj,value)=>{obj.cameraFar=value}},metadata:_metadata}, +_cameraFar_initializers,_instanceExtraInitializers),__esDecorate44(null,null,_perspective_decorators, +{kind:"field",name:"perspective",static:!1,private:!1,access:{has:obj=>"perspect\ +ive"in obj,get:obj=>obj.perspective,set:(obj,value)=>{obj.perspective=value}},metadata:_metadata}, +_perspective_initializers,_instanceExtraInitializers),__esDecorate44(null,null,___defaultThreeCamera_decorators, +{kind:"field",name:"__defaultThreeCamera",static:!1,private:!1,access:{has:obj=>"\ +__defaultThreeCamera"in obj,get:obj=>obj.__defaultThreeCamera,set:(obj,value)=>{ +obj.__defaultThreeCamera=value}},metadata:_metadata},___defaultThreeCamera_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,___camera_decorators,{kind:"\ +field",name:"__camera",static:!1,private:!1,access:{has:obj=>"__camera"in obj,get:obj=>obj. +__camera,set:(obj,value)=>{obj.__camera=value}},metadata:_metadata},___camera_initializers, +_instanceExtraInitializers),__esDecorate44(null,null,___localClipping_decorators, +{kind:"field",name:"__localClipping",static:!1,private:!1,access:{has:obj=>"__lo\ +calClipping"in obj,get:obj=>obj.__localClipping,set:(obj,value)=>{obj.__localClipping= +value}},metadata:_metadata},___localClipping_initializers,_instanceExtraInitializers), +__esDecorate44(null,null,___elementParentSize_decorators,{kind:"field",name:"__e\ +lementParentSize",static:!1,private:!1,access:{has:obj=>"__elementParentSize"in obj, +get:obj=>obj.__elementParentSize,set:(obj,value)=>{obj.__elementParentSize=value}}, +metadata:_metadata},___elementParentSize_initializers,_instanceExtraInitializers), +__esDecorate44(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Scene4= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}isScene=(__runInitializers44( +this,_instanceExtraInitializers),!0);skipShadowObservation=this.isScene;enableCss=__runInitializers44( +this,_enableCss_initializers,!0);webgl=__runInitializers44(this,_webgl_initializers, +!1);swapLayers=__runInitializers44(this,_swapLayers_initializers,!1);shadowMode=__runInitializers44( +this,_shadowMode_initializers,"basic");get shadowmapType(){return this.shadowMode}set shadowmapType(v){ +this.shadowMode=v}vr=__runInitializers44(this,_vr_initializers,!1);backgroundColor=__runInitializers44( +this,_backgroundColor_initializers,new Color("white"));backgroundOpacity=__runInitializers44( +this,_backgroundOpacity_initializers,0);background=__runInitializers44(this,_background_initializers, +null);backgroundIntensity=__runInitializers44(this,_backgroundIntensity_initializers, +1);backgroundBlur=__runInitializers44(this,_backgroundBlur_initializers,0);equirectangularBackground=__runInitializers44( +this,_equirectangularBackground_initializers,!1);environment=__runInitializers44( +this,_environment_initializers,null);fogMode=__runInitializers44(this,_fogMode_initializers, +"none");fogNear=__runInitializers44(this,_fogNear_initializers,0);fogFar=__runInitializers44( +this,_fogFar_initializers,1e3);fogColor=__runInitializers44(this,_fogColor_initializers, +"gray");fogDensity=__runInitializers44(this,_fogDensity_initializers,.0025);physicallyCorrectLights=__runInitializers44( +this,_physicallyCorrectLights_initializers,!1);cameraNear=__runInitializers44(this, +_cameraNear_initializers,.1);cameraFar=__runInitializers44(this,_cameraFar_initializers, +1e4);perspective=__runInitializers44(this,_perspective_initializers,800);__defaultThreeCamera=__runInitializers44( +this,___defaultThreeCamera_initializers,null);get threeCamera(){return this.__threeCamera}__threeCamera;get camera(){ +return this.__camera}#glRenderer=null;get glRenderer(){return this.#glRenderer?. +sceneStates.get(this)?.renderer}#cssRenderer=null;get cssRenderer(){return this.#cssRenderer?. +sceneStates.get(this)?.renderer}__camera=__runInitializers44(this,___camera_initializers, +null);__localClipping=__runInitializers44(this,___localClipping_initializers,!1);get scene(){ +return this}constructor(){super(),this.sizeMode.set("proportional","proportional", +"literal"),this.size.set(1,1,0),this._elementOperations.shouldRender=!0,this._createDefaultCamera(), +this._calcSize(),this.needsUpdate()}_glLayer=null;_cssLayer=null;_miscLayer=null;drawScene(){ +this.#glRenderer?.drawScene(this),this.#cssRenderer?.drawScene(this)}connectedCallback(){ +super.connectedCallback(),this.three.autoUpdate=!1,this.three.matrixWorldAutoUpdate= +!1,this.createEffect(this.glRendererEffect),this.createEffect(this.fogEffect),this. +createEffect(this.cameraNearFarEffect),this.createEffect(this.cameraEffect),this. +createEffect(this.cssRendererEffect),this.createEffect(this.parentSizeEffect),queueMicrotask( +()=>this.shadowRoot.prepend(new Comment(magic())))}glRendererEffect=()=>{this.webgl&& +(this.#glRenderer=WebglRendererThree.singleton(),this.#glRenderer.initialize(this), +onCleanup(()=>{this.#glRenderer.uninitialize(this),this.#glRenderer=null}),createEffect( +()=>{this.#glRenderer.localClippingEnabled=this.__localClipping,this.needsUpdate()}), +createEffect(()=>{this.#glRenderer.setClearColor(this,this.backgroundColor,this. +backgroundOpacity),this.needsUpdate()}),createEffect(()=>{this.#glRenderer.setClearAlpha( +this,this.backgroundOpacity),this.needsUpdate()}),createEffect(()=>{this.#glRenderer. +setShadowMapType(this,this.shadowMode),this.needsUpdate()}),createEffect(()=>{this.#glRenderer. +setPhysicallyCorrectLights(this,this.physicallyCorrectLights),this.needsUpdate()}), +createEffect(()=>{if(this.#glRenderer.enableVR(this,this.vr),this.vr){Motor.setFrameRequester( +fn=>(this.#glRenderer.requestFrame(this,fn),0));let button=this.#glRenderer.createDefaultVRButton( +this);button.classList.add("vrButton"),this._miscLayer.appendChild(button)}else this. +xr;this.needsUpdate()}),createEffect(()=>{!this.webgl||!this.background||(this.background. +match(/\.(jpg|jpeg|png)$/)?(this.#glRenderer.enableBackground(this,this.equirectangularBackground, +this.backgroundBlur,texture=>{this.three.background=texture||null,this.needsUpdate()}), +onCleanup(()=>{this.#glRenderer.disableBackground(this),this.needsUpdate()})):console. +warn(`<${this.tagName.toLowerCase()}> background attribute ignored, the given im\ +age type is not currently supported.`))}),createEffect(()=>{this.three.backgroundIntensity= +this.backgroundIntensity,this.needsUpdate()}),createEffect(()=>{!this.webgl||!this. +environment||(this.environment.match(/\.(jpg|jpeg|png)$/)?(this.#glRenderer.enableEnvironment( +this,texture=>{this.three.environment=texture,this.needsUpdate()}),onCleanup(()=>{ +this.#glRenderer.disableEnvironment(this),this.needsUpdate()})):console.warn(`<${this. +tagName.toLowerCase()}> environment attribute ignored, the given image type is n\ +ot currently supported.`))}),createEffect(()=>{let{x:x2,y:y2}=this.calculatedSize; +this.#glRenderer.updateResolution(this,x2,y2)}))};fogEffect=()=>{if(this.fogMode=== +"none")this.three.fog=null;else if(this.fogMode==="linear"){let fog=this.three.fog= +new Fog("deeppink");fog.near=this.fogNear,fog.far=this.fogFar,fog.color.set(this. +fogColor)}else if(this.fogMode==="expo2"){let fog=this.three.fog=new FogExp2(new Color( +"deeppink").getHex());fog.color.set(this.fogColor),fog.density=this.fogDensity}this. +needsUpdate()};cameraNearFarEffect=()=>{let{cameraNear,cameraFar}=this;this.__defaultThreeCamera instanceof +PerspectiveCamera2&&(this.__defaultThreeCamera.near=cameraNear,this.__defaultThreeCamera. +far=cameraFar,this.needsUpdate())};cameraEffect=()=>{this._updateCameraAspect(), +this._updateCameraPerspective(),this._updateCameraProjection(),this.needsUpdate()};parentSizeEffect=()=>{ +if(!this.webgl&&!this.enableCss)return;let{x:x2,y:y2}=this.sizeMode;(x2==="propo\ +rtional"||x2==="p"||y2==="proportional"||y2==="p")&&(this.#startParentSizeObservation(), +onCleanup(()=>{this.#stopParentSizeObservation()}))};cssRendererEffect=()=>{this. +enableCss&&(this.#cssRenderer=Css3dRendererThree.singleton(),this.#cssRenderer.initialize( +this),onCleanup(()=>{this.#cssRenderer.uninitialize(this),this.#cssRenderer=null}), +createEffect(()=>{let{x:x2,y:y2}=this.calculatedSize;this.#cssRenderer.updateResolution( +this,x2,y2)}))};static observedAttributes=[...Reflect.get(_classSuper,"observedA\ +ttributes",_classThis)||[],"slot"];attributeChangedCallback(name2,oldVal,newVal){ +super.attributeChangedCallback(name2,oldVal,newVal),name2==="slot"&&queueMicrotask( +()=>{throw new Error(`Assigning a to a slot (slot="${newVal}") is n\ +ot currently supported and may not work as expected. Instead, wrap the in another element like a
, then assign the wrapper to the slot.`)})}makeThreeObject3d(){ +return new Scene2}makeThreeCSSObject(){return new Scene2}traverseSceneGraph(visitor,waitForUpgrade=!1){ +if(!waitForUpgrade){for(let child of this.composedLumeChildren)child.traverseSceneGraph( +visitor,waitForUpgrade);return}let promise=Promise.resolve();for(let child of this. +composedLumeChildren)child.matches(":defined")?promise=promise.then(()=>child.traverseSceneGraph( +visitor,waitForUpgrade)):promise=promise.then(()=>customElements.whenDefined(child. +tagName.toLowerCase())).then(()=>child.traverseSceneGraph(visitor,waitForUpgrade)); +return promise}_createDefaultCamera(){untrack(()=>{let size3=this.calculatedSize; +this.__defaultThreeCamera=this.__threeCamera=new PerspectiveCamera2(this.__perspectiveFov, +size3.x/size3.y||1,.1,1e4),this.__threeCamera.name=`${this.tagName}${this.id?"#"+ +this.id:""} DEFAULT CAMERA (webgl, ${this.__threeCamera.type})`,this.perspective= +this.perspective})}get __perspectiveFov(){return 180*(2*Math.atan(this.calculatedSize. +y/2/this.perspective))/Math.PI}_updateCameraPerspective(){let perspective=this.perspective; +this.__defaultThreeCamera instanceof PerspectiveCamera2&&(this.__defaultThreeCamera. +fov=this.__perspectiveFov,this.__defaultThreeCamera.position.z=perspective)}_updateCameraAspect(){ +this.__defaultThreeCamera instanceof PerspectiveCamera2&&(this.__defaultThreeCamera. +aspect=this.calculatedSize.x/this.calculatedSize.y||1)}_updateCameraProjection(){ +this.__defaultThreeCamera instanceof PerspectiveCamera2&&this.__defaultThreeCamera. +updateProjectionMatrix()}__activeCameras;_addCamera(camera){this.__activeCameras|| +(this.__activeCameras=new Set),this.__activeCameras.add(camera),this.__setCamera( +camera)}_removeCamera(camera){this.__activeCameras&&(this.__activeCameras.delete( +camera),this.__activeCameras.size?(this.__activeCameras.forEach(c3=>camera=c3),this. +__setCamera(camera)):(this.__activeCameras=void 0,this.__setCamera()))}get parentSize(){ +return this.composedLumeParent?.calculatedSize??this.__elementParentSize}__setCamera(camera){ +camera?(this.__defaultThreeCamera=null,this.__threeCamera=camera.three,this.__camera= +camera,this._updateCameraAspect(),this._updateCameraProjection(),this.needsUpdate()): +(this._createDefaultCamera(),this.__camera=null)}__elementParentSize=__runInitializers44( +this,___elementParentSize_initializers,{x:0,y:0,z:0});#resizeObserver=null;#startParentSizeObservation(){ +let parent=this.composedParent;if(!parent)throw new Error("A Scene can only be c\ +hild of HTMLElement or ShadowRoot (f.e. not an SVGElement).");this.#resizeObserver= +new ResizeObserver(changes=>{for(let change of changes)if(change.contentBoxSize){ +let contentBoxSize=change.contentBoxSize[0]||change.contentBoxSize,{inlineSize,blockSize}=contentBoxSize; +getComputedStyle(parent).writingMode.includes("horizontal")?this.#checkElementParentSize( +inlineSize,blockSize):this.#checkElementParentSize(blockSize,inlineSize)}else{let{ +width,height}=change.contentRect;this.#checkElementParentSize(width,height)}}),this.#resizeObserver. +observe(parent)}#stopParentSizeObservation(){this.#resizeObserver?.disconnect(), +this.#resizeObserver=null}#checkElementParentSize(x2,y2){let parentSize=this.__elementParentSize; +(parentSize.x!=x2||parentSize.y!=y2)&&(parentSize.x=x2,parentSize.y=y2,this.__elementParentSize= +parentSize)}template=()=>html` +
+
this._cssLayer=el2} + class="CSS3DLayer" + style=${()=>this.swapLayers?"z-index: 1":""} + > + ${""} +
+ +
this._glLayer=el2} class="WebGLLayer"> + ${""} +
+ +
this._miscLayer=el2} class="MiscellaneousLayer"> + ${""} + +
+
+ `;static css=` + ${Reflect.get(_classSuper,"css",_classThis)} + + :host { + /* + * A Scene is strict: it does not leak content, its rendering is not + * affected by external layout, and its size is not affected by its + * content. It is an absolutely contained drawing area. + */ + contain: size layout paint; /*fallback, TODO remove once Safari is caught up*\ +/ + contain: strict; /*override*/ + overflow: hidden; + + /* Prevent default browser behaviors like drag-and-drop to avoid pointercance\ +l interfering with interaction features. */ + touch-action: none; + } + + /* The purpose of this is to contain the position:absolute layers so they don'\ +t break out of the Scene layout. */ + .container { + position: relative + } + + .container, + .CSS3DLayer, + .MiscellaneousLayer, + .WebGLLayer, + .WebGLLayer > canvas { + margin: 0; padding: 0; + width: 100%; height: 100%; + display: block; + } + + .CSS3DLayer, + .MiscellaneousLayer, + .WebGLLayer { + /* make sure all layers are stacked on top of each other */ + position: absolute; top: 0; left: 0; + } + + .CSS3DLayer { + transform-style: preserve-3d; + } + + .container { + pointer-events: none; + } + + .MiscellaneousLayer > * { + /* Allow children of the Misc layer to have pointer events. Needed for the We\ +bXR button, for example */ + pointer-events: auto; + } + + /* + * This trick is needed in Firefox to remove pointer events from the + * transparent cameraElement from interfering with pointer events on the + * scene objects. We do not wish to interact with this element anyway, as + * it serves only for positioning the view. + */ + .cameraElement > * { + pointer-events: auto; + } + + .vrButton { + color: black; + border-color: black; + } + `;static{__runInitializers44(_classThis,_classExtraInitializers)}};return Scene4= +_classThis})();Scene3.prototype.isScene=!0;var __esDecorate45=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers45=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("flickering-orb", +autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D, +_instanceExtraInitializers=[],_color_decorators,_color_initializers=[],_intensity_decorators, +_intensity_initializers=[],_shadowBias_decorators,_shadowBias_initializers=[],_flickerRange_decorators, +_flickerRange_initializers=[],_shadowMapWidth_decorators,_shadowMapWidth_initializers=[], +_shadowMapHeight_decorators,_shadowMapHeight_initializers=[];var FlickeringOrb2=class extends _classSuper{static{ +__name(this,"FlickeringOrb")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_color_decorators=[stringAttribute],_intensity_decorators=[numberAttribute],_shadowBias_decorators= +[numberAttribute],_flickerRange_decorators=[numberAttribute],_shadowMapWidth_decorators= +[numberAttribute],_shadowMapHeight_decorators=[numberAttribute],__esDecorate45(null, +null,_color_decorators,{kind:"field",name:"color",static:!1,private:!1,access:{has:obj=>"\ +color"in obj,get:obj=>obj.color,set:(obj,value)=>{obj.color=value}},metadata:_metadata}, +_color_initializers,_instanceExtraInitializers),__esDecorate45(null,null,_intensity_decorators, +{kind:"field",name:"intensity",static:!1,private:!1,access:{has:obj=>"intensity"in +obj,get:obj=>obj.intensity,set:(obj,value)=>{obj.intensity=value}},metadata:_metadata}, +_intensity_initializers,_instanceExtraInitializers),__esDecorate45(null,null,_shadowBias_decorators, +{kind:"field",name:"shadowBias",static:!1,private:!1,access:{has:obj=>"shadowBia\ +s"in obj,get:obj=>obj.shadowBias,set:(obj,value)=>{obj.shadowBias=value}},metadata:_metadata}, +_shadowBias_initializers,_instanceExtraInitializers),__esDecorate45(null,null,_flickerRange_decorators, +{kind:"field",name:"flickerRange",static:!1,private:!1,access:{has:obj=>"flicker\ +Range"in obj,get:obj=>obj.flickerRange,set:(obj,value)=>{obj.flickerRange=value}}, +metadata:_metadata},_flickerRange_initializers,_instanceExtraInitializers),__esDecorate45( +null,null,_shadowMapWidth_decorators,{kind:"field",name:"shadowMapWidth",static:!1, +private:!1,access:{has:obj=>"shadowMapWidth"in obj,get:obj=>obj.shadowMapWidth,set:(obj,value)=>{ +obj.shadowMapWidth=value}},metadata:_metadata},_shadowMapWidth_initializers,_instanceExtraInitializers), +__esDecorate45(null,null,_shadowMapHeight_decorators,{kind:"field",name:"shadowM\ +apHeight",static:!1,private:!1,access:{has:obj=>"shadowMapHeight"in obj,get:obj=>obj. +shadowMapHeight,set:(obj,value)=>{obj.shadowMapHeight=value}},metadata:_metadata}, +_shadowMapHeight_initializers,_instanceExtraInitializers),__esDecorate45(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),FlickeringOrb2=_classThis=_classDescriptor.value,_metadata&& +Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers45(_classThis,_classExtraInitializers)}color=(__runInitializers45( +this,_instanceExtraInitializers),__runInitializers45(this,_color_initializers,"r\ +oyalblue"));intensity=__runInitializers45(this,_intensity_initializers,1.3);shadowBias=__runInitializers45( +this,_shadowBias_initializers,0);flickerRange=__runInitializers45(this,_flickerRange_initializers, +.4);shadowMapWidth=__runInitializers45(this,_shadowMapWidth_initializers,512);shadowMapHeight=__runInitializers45( +this,_shadowMapHeight_initializers,512);light;sphere;template=()=>html` + this.light=l} + color=${()=>this.color} + intensity=${()=>this.intensity} + shadow-bias=${()=>this.shadowBias} + shadow-map-width=${()=>this.shadowMapWidth} + shadow-map-height=${()=>this.shadowMapHeight} + > + this.sphere=s} + has="basic-material" + color=${()=>this.color} + opacity="0.5" + mount-point="0.5 0.5 0.5" + size="10 10 10" + cast-shadow="false" + receive-shadow="false" + > + + `;connectedCallback(){super.connectedCallback();let initialIntensity=this.intensity, +initialOpacity=this.opacity,flickerFunction=__name(()=>{let flicker=Math.random()- +1;this.light.intensity=initialIntensity+flicker*this.flickerRange,this.sphere.opacity= +initialOpacity+flicker*.4,setTimeout(()=>Motor.once(flickerFunction),Math.random()* +100)},"flickerFunction");Motor.once(flickerFunction)}};return FlickeringOrb2=_classThis})();var __esDecorate46=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers46=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("flickering-orb\ +s",autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D, +_instanceExtraInitializers=[],_shadowBias_decorators,_shadowBias_initializers=[], +_intensity_decorators,_intensity_initializers=[],_flickerRange_decorators,_flickerRange_initializers=[], +_color_decorators,_color_initializers=[];var FlickeringOrbs2=class extends _classSuper{static{ +__name(this,"FlickeringOrbs")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_shadowBias_decorators=[numberAttribute],_intensity_decorators=[numberAttribute], +_flickerRange_decorators=[numberAttribute],_color_decorators=[attribute],__esDecorate46( +null,null,_shadowBias_decorators,{kind:"field",name:"shadowBias",static:!1,private:!1, +access:{has:obj=>"shadowBias"in obj,get:obj=>obj.shadowBias,set:(obj,value)=>{obj. +shadowBias=value}},metadata:_metadata},_shadowBias_initializers,_instanceExtraInitializers), +__esDecorate46(null,null,_intensity_decorators,{kind:"field",name:"intensity",static:!1, +private:!1,access:{has:obj=>"intensity"in obj,get:obj=>obj.intensity,set:(obj,value)=>{ +obj.intensity=value}},metadata:_metadata},_intensity_initializers,_instanceExtraInitializers), +__esDecorate46(null,null,_flickerRange_decorators,{kind:"field",name:"flickerRan\ +ge",static:!1,private:!1,access:{has:obj=>"flickerRange"in obj,get:obj=>obj.flickerRange, +set:(obj,value)=>{obj.flickerRange=value}},metadata:_metadata},_flickerRange_initializers, +_instanceExtraInitializers),__esDecorate46(null,null,_color_decorators,{kind:"fi\ +eld",name:"color",static:!1,private:!1,access:{has:obj=>"color"in obj,get:obj=>obj. +color,set:(obj,value)=>{obj.color=value}},metadata:_metadata},_color_initializers, +_instanceExtraInitializers),__esDecorate46(null,_classDescriptor={value:_classThis}, +_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers), +FlickeringOrbs2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty( +_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}), +__runInitializers46(_classThis,_classExtraInitializers)}shadowBias=(__runInitializers46( +this,_instanceExtraInitializers),__runInitializers46(this,_shadowBias_initializers, +0));intensity=__runInitializers46(this,_intensity_initializers,1.3);flickerRange=__runInitializers46( +this,_flickerRange_initializers,.4);color=__runInitializers46(this,_color_initializers, +null);template=()=>html` + this.flickerRange} intensity=${()=>this.intensity} shadow-bias=${()=>this. +shadowBias} color=${()=>this.color??"yellow"} position="500 0 0"> + this.flickerRange} intensity=${()=>this.intensity} shadow-bias=${()=>this. +shadowBias} color=${()=>this.color??"deeppink"} position="-500 0 0"> + this.flickerRange} intensity=${()=>this.intensity} shadow-bias=${()=>this. +shadowBias} color=${()=>this.color??"cyan"} position="0 0 500"> + this.flickerRange} intensity=${()=>this.intensity} shadow-bias=${()=>this. +shadowBias} color=${()=>this.color??"limegreen"} position="0 0 -500"> + this.flickerRange} intensity=${()=>this.intensity} shadow-bias=${()=>this. +shadowBias} color=${()=>this.color??"white"} position="0 -500 0"> + this.flickerRange} intensity=${()=>this.intensity} shadow-bias=${()=>this. +shadowBias} color=${()=>this.color??"white"} position="0 250 0"> + `};return FlickeringOrbs2=_classThis})();var LoadingIcon=class extends HTMLElement{static{__name(this,"LoadingIcon")}connectedCallback(){ +this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=` +
+
+
+
+ + + `}};customElements.define("loading-icon",LoadingIcon);var Attribute={CONST:"const",NOTANATTRIBUTE:"const",VARIABLE:"var",LEFT:"left",RIGHT:"\ +right",TOP:"top",BOTTOM:"bottom",WIDTH:"width",HEIGHT:"height",CENTERX:"centerX", +CENTERY:"centerY",ZINDEX:"zIndex"},Attribute_default=Attribute;var Relation={LEQ:"leq",EQU:"equ",GEQ:"geq"},Relation_default=Relation;var Priority={REQUIRED:1e3,DEFAULTHIGH:750,DEFAULTLOW:250},Priority_default=Priority;var parser_default=function(){function peg$subclass(child,parent){function ctor2(){ +this.constructor=child}__name(ctor2,"ctor"),ctor2.prototype=parent.prototype,child. +prototype=new ctor2}__name(peg$subclass,"peg$subclass");function SyntaxError2(message,expected,found,offset,line,column){ +this.message=message,this.expected=expected,this.found=found,this.offset=offset, +this.line=line,this.column=column,this.name="SyntaxError"}__name(SyntaxError2,"S\ +yntaxError"),peg$subclass(SyntaxError2,Error);function parse2(input){var options=arguments. +length>1?arguments[1]:{},peg$FAILED={},peg$startRuleFunctions={visualFormatString:peg$parsevisualFormatString}, +peg$startRuleFunction=peg$parsevisualFormatString,peg$c0=peg$FAILED,peg$c1=null, +peg$c2=":",peg$c3={type:"literal",value:":",description:'":"'},peg$c4=[],peg$c5=__name( +function(o,superto,view,views,tosuper){return{orientation:o?o[0]:"horizontal",cascade:(superto|| +[]).concat([view],[].concat.apply([],views),tosuper||[])}},"peg$c5"),peg$c6="H", +peg$c7={type:"literal",value:"H",description:'"H"'},peg$c8="V",peg$c9={type:"lit\ +eral",value:"V",description:'"V"'},peg$c10=__name(function(orient){return orient== +"H"?"horizontal":"vertical"},"peg$c10"),peg$c11="|",peg$c12={type:"literal",value:"\ +|",description:'"|"'},peg$c13=__name(function(){return{view:null}},"peg$c13"),peg$c14="\ +[",peg$c15={type:"literal",value:"[",description:'"["'},peg$c16="]",peg$c17={type:"\ +literal",value:"]",description:'"]"'},peg$c18=__name(function(view,predicates){return extend( +view,predicates?{constraints:predicates}:{})},"peg$c18"),peg$c19="-",peg$c20={type:"\ +literal",value:"-",description:'"-"'},peg$c21=__name(function(predicateList){return predicateList}, +"peg$c21"),peg$c22=__name(function(){return[{relation:"equ",constant:"default",$parserOffset:offset()}]}, +"peg$c22"),peg$c23="",peg$c24=__name(function(){return[{relation:"equ",constant:0, +$parserOffset:offset()}]},"peg$c24"),peg$c25=__name(function(n){return[{relation:"\ +equ",constant:n,$parserOffset:offset()}]},"peg$c25"),peg$c26="(",peg$c27={type:"\ +literal",value:"(",description:'"("'},peg$c28=",",peg$c29={type:"literal",value:"\ +,",description:'","'},peg$c30=")",peg$c31={type:"literal",value:")",description:'\ +")"'},peg$c32=__name(function(p2,ps){return[p2].concat(ps.map(function(p3){return p3[1]}))}, +"peg$c32"),peg$c33="@",peg$c34={type:"literal",value:"@",description:'"@"'},peg$c35=__name( +function(r3,o,p2){return extend({relation:"equ"},r3||{},o,p2?p2[1]:{})},"peg$c35"), +peg$c36="==",peg$c37={type:"literal",value:"==",description:'"=="'},peg$c38=__name( +function(){return{relation:"equ",$parserOffset:offset()}},"peg$c38"),peg$c39="<=", +peg$c40={type:"literal",value:"<=",description:'"<="'},peg$c41=__name(function(){ +return{relation:"leq",$parserOffset:offset()}},"peg$c41"),peg$c42=">=",peg$c43={ +type:"literal",value:">=",description:'">="'},peg$c44=__name(function(){return{relation:"\ +geq",$parserOffset:offset()}},"peg$c44"),peg$c45=/^[0-9]/,peg$c46={type:"class", +value:"[0-9]",description:"[0-9]"},peg$c47=__name(function(digits){return{priority:parseInt( +digits.join(""),10)}},"peg$c47"),peg$c48=__name(function(n){return{constant:n}}, +"peg$c48"),peg$c49=/^[a-zA-Z_]/,peg$c50={type:"class",value:"[a-zA-Z_]",description:"\ +[a-zA-Z_]"},peg$c51=/^[a-zA-Z0-9_]/,peg$c52={type:"class",value:"[a-zA-Z0-9_]",description:"\ +[a-zA-Z0-9_]"},peg$c53=__name(function(f,v){return{view:f+v}},"peg$c53"),peg$c54="\ +.",peg$c55={type:"literal",value:".",description:'"."'},peg$c56=__name(function(digits,decimals){ +return parseFloat(digits.concat(".").concat(decimals).join(""),10)},"peg$c56"),peg$c57=__name( +function(digits){return parseInt(digits.join(""),10)},"peg$c57"),peg$currPos=0,peg$reportedPos=0, +peg$cachedPos=0,peg$cachedPosDetails={line:1,column:1,seenCR:!1},peg$maxFailPos=0, +peg$maxFailExpected=[],peg$silentFails=0,peg$result;if("startRule"in options){if(!(options. +startRule in peg$startRuleFunctions))throw new Error(`Can't start parsing from r\ +ule "`+options.startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options. +startRule]}function text(){return input.substring(peg$reportedPos,peg$currPos)}__name( +text,"text");function offset(){return peg$reportedPos}__name(offset,"offset");function line(){ +return peg$computePosDetails(peg$reportedPos).line}__name(line,"line");function column(){ +return peg$computePosDetails(peg$reportedPos).column}__name(column,"column");function expected(description){ +throw peg$buildException(null,[{type:"other",description}],peg$reportedPos)}__name( +expected,"expected");function error(message){throw peg$buildException(message,null, +peg$reportedPos)}__name(error,"error");function peg$computePosDetails(pos){function advance(details,startPos,endPos){ +var p2,ch;for(p2=startPos;p2pos&&(peg$cachedPos=0,peg$cachedPosDetails={line:1,column:1, +seenCR:!1}),advance(peg$cachedPosDetails,peg$cachedPos,pos),peg$cachedPos=pos),peg$cachedPosDetails} +__name(peg$computePosDetails,"peg$computePosDetails");function peg$fail(expected2){ +peg$currPospeg$maxFailPos&&(peg$maxFailPos=peg$currPos, +peg$maxFailExpected=[]),peg$maxFailExpected.push(expected2))}__name(peg$fail,"pe\ +g$fail");function peg$buildException(message,expected2,pos){function cleanupExpected(expected3){ +var i2=1;for(expected3.sort(function(a,b){return a.descriptionb.description?1:0});i21?expectedDescs.slice( +0,-1).join(", ")+" or "+expectedDescs[expected3.length-1]:expectedDescs[0],foundDesc= +found2?'"'+stringEscape(found2)+'"':"end of input","Expected "+expectedDesc+" bu\ +t "+foundDesc+" found."}__name(buildMessage,"buildMessage");var posDetails=peg$computePosDetails( +pos),found=pos1?arguments[1]:{},peg$FAILED={},peg$startRuleFunctions={visualFormatStringExt:peg$parsevisualFormatStringExt}, +peg$startRuleFunction=peg$parsevisualFormatStringExt,peg$c0=peg$FAILED,peg$c1="C\ +:",peg$c2={type:"literal",value:"C:",description:'"C:"'},peg$c3=[],peg$c4=null,peg$c5=__name( +function(view,attribute2,attributes,comments){return{type:"attribute",view:view. +view,attributes:[attribute2].concat(attributes)}},"peg$c5"),peg$c6=__name(function(attr,predicates){ +return{attr,predicates}},"peg$c6"),peg$c7=":",peg$c8={type:"literal",value:":",description:'\ +":"'},peg$c9=__name(function(o,superto,view,views,tosuper,comments){return{type:"\ +vfl",orientation:o?o[0]:"horizontal",cascade:(superto||[]).concat(view,[].concat. +apply([],views),tosuper||[])}},"peg$c9"),peg$c10="HV",peg$c11={type:"literal",value:"\ +HV",description:'"HV"'},peg$c12=__name(function(){return"horzvert"},"peg$c12"),peg$c13="\ +H",peg$c14={type:"literal",value:"H",description:'"H"'},peg$c15=__name(function(){ +return"horizontal"},"peg$c15"),peg$c16="V",peg$c17={type:"literal",value:"V",description:'\ +"V"'},peg$c18=__name(function(){return"vertical"},"peg$c18"),peg$c19="Z",peg$c20={ +type:"literal",value:"Z",description:'"Z"'},peg$c21=__name(function(){return"zIn\ +dex"},"peg$c21"),peg$c22=" ",peg$c23={type:"literal",value:" ",description:'" "'}, +peg$c24="//",peg$c25={type:"literal",value:"//",description:'"//"'},peg$c26={type:"\ +any",description:"any character"},peg$c27="|",peg$c28={type:"literal",value:"|", +description:'"|"'},peg$c29=__name(function(){return{view:null}},"peg$c29"),peg$c30="\ +[",peg$c31={type:"literal",value:"[",description:'"["'},peg$c32=",",peg$c33={type:"\ +literal",value:",",description:'","'},peg$c34="]",peg$c35={type:"literal",value:"\ +]",description:'"]"'},peg$c36=__name(function(view,views){return views.length?[view]. +concat([].concat.apply([],views)):view},"peg$c36"),peg$c37=__name(function(view,predicates,cascadedViews){ +return extend(extend(view,predicates?{constraints:predicates}:{}),cascadedViews? +{cascade:cascadedViews}:{})},"peg$c37"),peg$c38=__name(function(views,connection){ +return[].concat([].concat.apply([],views),[connection])},"peg$c38"),peg$c39="->", +peg$c40={type:"literal",value:"->",description:'"->"'},peg$c41=__name(function(){ +return[{relation:"none"}]},"peg$c41"),peg$c42="-",peg$c43={type:"literal",value:"\ +-",description:'"-"'},peg$c44=__name(function(predicateList){return predicateList}, +"peg$c44"),peg$c45=__name(function(){return[{relation:"equ",constant:"default"}]}, +"peg$c45"),peg$c46="~",peg$c47={type:"literal",value:"~",description:'"~"'},peg$c48=__name( +function(){return[{relation:"equ",equalSpacing:!0}]},"peg$c48"),peg$c49="",peg$c50=__name( +function(){return[{relation:"equ",constant:0}]},"peg$c50"),peg$c51=__name(function(p2){ +return[{relation:"equ",multiplier:p2.multiplier}]},"peg$c51"),peg$c52=__name(function(n){ +return[{relation:"equ",constant:n}]},"peg$c52"),peg$c53="(",peg$c54={type:"liter\ +al",value:"(",description:'"("'},peg$c55=")",peg$c56={type:"literal",value:")",description:'\ +")"'},peg$c57=__name(function(p2,ps){return[p2].concat(ps.map(function(p3){return p3[1]}))}, +"peg$c57"),peg$c58="@",peg$c59={type:"literal",value:"@",description:'"@"'},peg$c60=__name( +function(r3,o,p2){return extend({relation:"equ"},r3||{},o,p2?p2[1]:{})},"peg$c60"), +peg$c61=__name(function(r3,o,p2){return extend({relation:"equ",equalSpacing:!0}, +r3||{},o,p2?p2[1]:{})},"peg$c61"),peg$c62="==",peg$c63={type:"literal",value:"==", +description:'"=="'},peg$c64=__name(function(){return{relation:"equ"}},"peg$c64"), +peg$c65="<=",peg$c66={type:"literal",value:"<=",description:'"<="'},peg$c67=__name( +function(){return{relation:"leq"}},"peg$c67"),peg$c68=">=",peg$c69={type:"litera\ +l",value:">=",description:'">="'},peg$c70=__name(function(){return{relation:"geq"}}, +"peg$c70"),peg$c71=/^[0-9]/,peg$c72={type:"class",value:"[0-9]",description:"[0-\ +9]"},peg$c73=__name(function(digits){return{priority:parseInt(digits.join(""),10)}}, +"peg$c73"),peg$c74=__name(function(n){return{constant:n}},"peg$c74"),peg$c75=__name( +function(n){return{constant:-n}},"peg$c75"),peg$c76="+",peg$c77={type:"literal", +value:"+",description:'"+"'},peg$c78="%",peg$c79={type:"literal",value:"%",description:'\ +"%"'},peg$c80=__name(function(n){return{view:null,multiplier:n/100}},"peg$c80"), +peg$c81=__name(function(n){return{view:null,multiplier:n/-100}},"peg$c81"),peg$c82=__name( +function(vn,a,m,c3){return{view:vn.view,attribute:a||void 0,multiplier:m||1,constant:c3|| +void 0}},"peg$c82"),peg$c83=".left",peg$c84={type:"literal",value:".left",description:'\ +".left"'},peg$c85=__name(function(){return"left"},"peg$c85"),peg$c86=".right",peg$c87={ +type:"literal",value:".right",description:'".right"'},peg$c88=__name(function(){ +return"right"},"peg$c88"),peg$c89=".top",peg$c90={type:"literal",value:".top",description:'\ +".top"'},peg$c91=__name(function(){return"top"},"peg$c91"),peg$c92=".bottom",peg$c93={ +type:"literal",value:".bottom",description:'".bottom"'},peg$c94=__name(function(){ +return"bottom"},"peg$c94"),peg$c95=".width",peg$c96={type:"literal",value:".widt\ +h",description:'".width"'},peg$c97=__name(function(){return"width"},"peg$c97"),peg$c98="\ +.height",peg$c99={type:"literal",value:".height",description:'".height"'},peg$c100=__name( +function(){return"height"},"peg$c100"),peg$c101=".centerX",peg$c102={type:"liter\ +al",value:".centerX",description:'".centerX"'},peg$c103=__name(function(){return"\ +centerX"},"peg$c103"),peg$c104=".centerY",peg$c105={type:"literal",value:".cente\ +rY",description:'".centerY"'},peg$c106=__name(function(){return"centerY"},"peg$c\ +106"),peg$c107="/",peg$c108={type:"literal",value:"/",description:'"/"'},peg$c109=__name( +function(n){return 1/n},"peg$c109"),peg$c110="/+",peg$c111={type:"literal",value:"\ +/+",description:'"/+"'},peg$c112="/-",peg$c113={type:"literal",value:"/-",description:'\ +"/-"'},peg$c114=__name(function(n){return-1/n},"peg$c114"),peg$c115="*",peg$c116={ +type:"literal",value:"*",description:'"*"'},peg$c117=__name(function(n){return n}, +"peg$c117"),peg$c118="*+",peg$c119={type:"literal",value:"*+",description:'"*+"'}, +peg$c120="*-",peg$c121={type:"literal",value:"*-",description:'"*-"'},peg$c122=__name( +function(n){return-n},"peg$c122"),peg$c123=/^[a-zA-Z_]/,peg$c124={type:"class",value:"\ +[a-zA-Z_]",description:"[a-zA-Z_]"},peg$c125=/^[a-zA-Z0-9_]/,peg$c126={type:"cla\ +ss",value:"[a-zA-Z0-9_]",description:"[a-zA-Z0-9_]"},peg$c127=__name(function(f,v,r3){ +return{view:f+v,range:r3,$parserOffset:offset()}},"peg$c127"),peg$c128=__name(function(f,v){ +return{view:f+v,$parserOffset:offset()}},"peg$c128"),peg$c129="..",peg$c130={type:"\ +literal",value:"..",description:'".."'},peg$c131=__name(function(d2){return parseInt( +d2)},"peg$c131"),peg$c132=".",peg$c133={type:"literal",value:".",description:'".\ +"'},peg$c134=__name(function(digits,decimals){return parseFloat(digits.concat("."). +concat(decimals).join(""),10)},"peg$c134"),peg$c135=__name(function(digits){return parseInt( +digits.join(""),10)},"peg$c135"),peg$currPos=0,peg$reportedPos=0,peg$cachedPos=0, +peg$cachedPosDetails={line:1,column:1,seenCR:!1},peg$maxFailPos=0,peg$maxFailExpected=[], +peg$silentFails=0,peg$result;if("startRule"in options){if(!(options.startRule in +peg$startRuleFunctions))throw new Error(`Can't start parsing from rule "`+options. +startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options.startRule]} +function text(){return input.substring(peg$reportedPos,peg$currPos)}__name(text, +"text");function offset(){return peg$reportedPos}__name(offset,"offset");function line(){ +return peg$computePosDetails(peg$reportedPos).line}__name(line,"line");function column(){ +return peg$computePosDetails(peg$reportedPos).column}__name(column,"column");function expected(description){ +throw peg$buildException(null,[{type:"other",description}],peg$reportedPos)}__name( +expected,"expected");function error(message){throw peg$buildException(message,null, +peg$reportedPos)}__name(error,"error");function peg$computePosDetails(pos){function advance(details,startPos,endPos){ +var p2,ch;for(p2=startPos;p2pos&&(peg$cachedPos=0,peg$cachedPosDetails={line:1,column:1, +seenCR:!1}),advance(peg$cachedPosDetails,peg$cachedPos,pos),peg$cachedPos=pos),peg$cachedPosDetails} +__name(peg$computePosDetails,"peg$computePosDetails");function peg$fail(expected2){ +peg$currPospeg$maxFailPos&&(peg$maxFailPos=peg$currPos, +peg$maxFailExpected=[]),peg$maxFailExpected.push(expected2))}__name(peg$fail,"pe\ +g$fail");function peg$buildException(message,expected2,pos){function cleanupExpected(expected3){ +var i2=1;for(expected3.sort(function(a,b){return a.descriptionb.description?1:0});i21?expectedDescs.slice( +0,-1).join(", ")+" or "+expectedDescs[expected3.length-1]:expectedDescs[0],foundDesc= +found2?'"'+stringEscape(found2)+'"':"end of input","Expected "+expectedDesc+" bu\ +t "+foundDesc+" found."}__name(buildMessage,"buildMessage");var posDetails=peg$computePosDetails( +pos),found=pospeg$currPos?(s4=input.charAt(peg$currPos),peg$currPos++):(s4=peg$FAILED, +peg$silentFails===0&&peg$fail(peg$c26));s4!==peg$FAILED;)s3.push(s4),input.length> +peg$currPos?(s4=input.charAt(peg$currPos),peg$currPos++):(s4=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c26));s3!==peg$FAILED?(s1=[s1,s2,s3],s0=s1):(peg$currPos=s0,s0=peg$c0)}else +peg$currPos=s0,s0=peg$c0;else peg$currPos=s0,s0=peg$c0;return s0}__name(peg$parsecomments, +"peg$parsecomments");function peg$parsesuperview(){var s0,s1;return s0=peg$currPos, +input.charCodeAt(peg$currPos)===124?(s1=peg$c27,peg$currPos++):(s1=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c28)),s1!==peg$FAILED&&(peg$reportedPos=s0,s1=peg$c29()),s0=s1,s0} +__name(peg$parsesuperview,"peg$parsesuperview");function peg$parseviewGroup(){var s0, +s1,s2,s3,s4,s5,s6;if(s0=peg$currPos,input.charCodeAt(peg$currPos)===91?(s1=peg$c30, +peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c31)),s1!==peg$FAILED) +if(s2=peg$parseview(),s2!==peg$FAILED){for(s3=[],s4=peg$currPos,input.charCodeAt( +peg$currPos)===44?(s5=peg$c32,peg$currPos++):(s5=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c33)),s5!==peg$FAILED?(s6=peg$parseview(),s6!==peg$FAILED?(s5=[s5,s6], +s4=s5):(peg$currPos=s4,s4=peg$c0)):(peg$currPos=s4,s4=peg$c0);s4!==peg$FAILED;)s3. +push(s4),s4=peg$currPos,input.charCodeAt(peg$currPos)===44?(s5=peg$c32,peg$currPos++): +(s5=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c33)),s5!==peg$FAILED?(s6=peg$parseview(), +s6!==peg$FAILED?(s5=[s5,s6],s4=s5):(peg$currPos=s4,s4=peg$c0)):(peg$currPos=s4,s4= +peg$c0);s3!==peg$FAILED?(input.charCodeAt(peg$currPos)===93?(s4=peg$c34,peg$currPos++): +(s4=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c35)),s4!==peg$FAILED?(peg$reportedPos= +s0,s1=peg$c36(s2,s3),s0=s1):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)}else +peg$currPos=s0,s0=peg$c0;else peg$currPos=s0,s0=peg$c0;return s0}__name(peg$parseviewGroup, +"peg$parseviewGroup");function peg$parseview(){var s0,s1,s2,s3;return s0=peg$currPos, +s1=peg$parseviewNameRange(),s1!==peg$FAILED?(s2=peg$parsepredicateListWithParens(), +s2===peg$FAILED&&(s2=peg$c4),s2!==peg$FAILED?(s3=peg$parsecascadedViews(),s3===peg$FAILED&& +(s3=peg$c4),s3!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c37(s1,s2,s3),s0=s1):(peg$currPos= +s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0),s0}__name( +peg$parseview,"peg$parseview");function peg$parsecascadedViews(){var s0,s1,s2,s3, +s4,s5;if(s0=peg$currPos,input.charCodeAt(peg$currPos)===58?(s1=peg$c7,peg$currPos++): +(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c8)),s1!==peg$FAILED){if(s2=[], +s3=peg$currPos,s4=peg$parseconnection(),s4!==peg$FAILED?(s5=peg$parseviewGroup(), +s5!==peg$FAILED?(s4=[s4,s5],s3=s4):(peg$currPos=s3,s3=peg$c0)):(peg$currPos=s3,s3= +peg$c0),s3!==peg$FAILED)for(;s3!==peg$FAILED;)s2.push(s3),s3=peg$currPos,s4=peg$parseconnection(), +s4!==peg$FAILED?(s5=peg$parseviewGroup(),s5!==peg$FAILED?(s4=[s4,s5],s3=s4):(peg$currPos= +s3,s3=peg$c0)):(peg$currPos=s3,s3=peg$c0);else s2=peg$c0;s2!==peg$FAILED?(s3=peg$parseconnection(), +s3!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c38(s2,s3),s0=s1):(peg$currPos=s0,s0= +peg$c0)):(peg$currPos=s0,s0=peg$c0)}else peg$currPos=s0,s0=peg$c0;return s0}__name( +peg$parsecascadedViews,"peg$parsecascadedViews");function peg$parseconnection(){ +var s0,s1,s2,s3;return s0=peg$currPos,input.substr(peg$currPos,2)===peg$c39?(s1= +peg$c39,peg$currPos+=2):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c40)),s1!== +peg$FAILED&&(peg$reportedPos=s0,s1=peg$c41()),s0=s1,s0===peg$FAILED&&(s0=peg$currPos, +input.charCodeAt(peg$currPos)===45?(s1=peg$c42,peg$currPos++):(s1=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c43)),s1!==peg$FAILED?(s2=peg$parsepredicateList(),s2!==peg$FAILED? +(input.charCodeAt(peg$currPos)===45?(s3=peg$c42,peg$currPos++):(s3=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c43)),s3!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c44(s2),s0=s1): +(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0), +s0===peg$FAILED&&(s0=peg$currPos,input.charCodeAt(peg$currPos)===45?(s1=peg$c42, +peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c43)),s1!==peg$FAILED&& +(peg$reportedPos=s0,s1=peg$c45()),s0=s1,s0===peg$FAILED&&(s0=peg$currPos,input.charCodeAt( +peg$currPos)===126?(s1=peg$c46,peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c47)),s1!==peg$FAILED?(s2=peg$parseequalSpacingPredicateList(),s2!== +peg$FAILED?(input.charCodeAt(peg$currPos)===126?(s3=peg$c46,peg$currPos++):(s3=peg$FAILED, +peg$silentFails===0&&peg$fail(peg$c47)),s3!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c44( +s2),s0=s1):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)):(peg$currPos= +s0,s0=peg$c0),s0===peg$FAILED&&(s0=peg$currPos,input.charCodeAt(peg$currPos)===126? +(s1=peg$c46,peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c47)), +s1!==peg$FAILED&&(peg$reportedPos=s0,s1=peg$c48()),s0=s1,s0===peg$FAILED&&(s0=peg$currPos, +s1=peg$c49,s1!==peg$FAILED&&(peg$reportedPos=s0,s1=peg$c50()),s0=s1))))),s0}__name( +peg$parseconnection,"peg$parseconnection");function peg$parsepredicateList(){var s0; +return s0=peg$parsesimplePredicate(),s0===peg$FAILED&&(s0=peg$parsepredicateListWithParens()), +s0}__name(peg$parsepredicateList,"peg$parsepredicateList");function peg$parsesimplePredicate(){ +var s0,s1;return s0=peg$currPos,s1=peg$parsepercentage(),s1!==peg$FAILED&&(peg$reportedPos= +s0,s1=peg$c51(s1)),s0=s1,s0===peg$FAILED&&(s0=peg$currPos,s1=peg$parsenumber(),s1!== +peg$FAILED&&(peg$reportedPos=s0,s1=peg$c52(s1)),s0=s1),s0}__name(peg$parsesimplePredicate, +"peg$parsesimplePredicate");function peg$parsepredicateListWithParens(){var s0,s1, +s2,s3,s4,s5,s6;if(s0=peg$currPos,input.charCodeAt(peg$currPos)===40?(s1=peg$c53, +peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c54)),s1!==peg$FAILED) +if(s2=peg$parsepredicate(),s2!==peg$FAILED){for(s3=[],s4=peg$currPos,input.charCodeAt( +peg$currPos)===44?(s5=peg$c32,peg$currPos++):(s5=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c33)),s5!==peg$FAILED?(s6=peg$parsepredicate(),s6!==peg$FAILED?(s5= +[s5,s6],s4=s5):(peg$currPos=s4,s4=peg$c0)):(peg$currPos=s4,s4=peg$c0);s4!==peg$FAILED;) +s3.push(s4),s4=peg$currPos,input.charCodeAt(peg$currPos)===44?(s5=peg$c32,peg$currPos++): +(s5=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c33)),s5!==peg$FAILED?(s6=peg$parsepredicate(), +s6!==peg$FAILED?(s5=[s5,s6],s4=s5):(peg$currPos=s4,s4=peg$c0)):(peg$currPos=s4,s4= +peg$c0);s3!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(s4=peg$c55,peg$currPos++): +(s4=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c56)),s4!==peg$FAILED?(peg$reportedPos= +s0,s1=peg$c57(s2,s3),s0=s1):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)}else +peg$currPos=s0,s0=peg$c0;else peg$currPos=s0,s0=peg$c0;return s0}__name(peg$parsepredicateListWithParens, +"peg$parsepredicateListWithParens");function peg$parsepredicate(){var s0,s1,s2,s3, +s4,s5;return s0=peg$currPos,s1=peg$parserelation(),s1===peg$FAILED&&(s1=peg$c4), +s1!==peg$FAILED?(s2=peg$parseobjectOfPredicate(),s2!==peg$FAILED?(s3=peg$currPos, +input.charCodeAt(peg$currPos)===64?(s4=peg$c58,peg$currPos++):(s4=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c59)),s4!==peg$FAILED?(s5=peg$parsepriority(),s5!==peg$FAILED?(s4= +[s4,s5],s3=s4):(peg$currPos=s3,s3=peg$c0)):(peg$currPos=s3,s3=peg$c0),s3===peg$FAILED&& +(s3=peg$c4),s3!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c60(s1,s2,s3),s0=s1):(peg$currPos= +s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0),s0}__name( +peg$parsepredicate,"peg$parsepredicate");function peg$parseequalSpacingPredicateList(){ +var s0,s1,s2,s3,s4,s5,s6;if(s0=peg$currPos,input.charCodeAt(peg$currPos)===40?(s1= +peg$c53,peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c54)),s1!== +peg$FAILED)if(s2=peg$parseequalSpacingPredicate(),s2!==peg$FAILED){for(s3=[],s4= +peg$currPos,input.charCodeAt(peg$currPos)===44?(s5=peg$c32,peg$currPos++):(s5=peg$FAILED, +peg$silentFails===0&&peg$fail(peg$c33)),s5!==peg$FAILED?(s6=peg$parseequalSpacingPredicate(), +s6!==peg$FAILED?(s5=[s5,s6],s4=s5):(peg$currPos=s4,s4=peg$c0)):(peg$currPos=s4,s4= +peg$c0);s4!==peg$FAILED;)s3.push(s4),s4=peg$currPos,input.charCodeAt(peg$currPos)=== +44?(s5=peg$c32,peg$currPos++):(s5=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c33)), +s5!==peg$FAILED?(s6=peg$parseequalSpacingPredicate(),s6!==peg$FAILED?(s5=[s5,s6], +s4=s5):(peg$currPos=s4,s4=peg$c0)):(peg$currPos=s4,s4=peg$c0);s3!==peg$FAILED?(input. +charCodeAt(peg$currPos)===41?(s4=peg$c55,peg$currPos++):(s4=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c56)),s4!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c57(s2,s3),s0=s1): +(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)}else peg$currPos=s0,s0=peg$c0;else +peg$currPos=s0,s0=peg$c0;return s0}__name(peg$parseequalSpacingPredicateList,"pe\ +g$parseequalSpacingPredicateList");function peg$parseequalSpacingPredicate(){var s0, +s1,s2,s3,s4,s5;return s0=peg$currPos,s1=peg$parserelation(),s1===peg$FAILED&&(s1= +peg$c4),s1!==peg$FAILED?(s2=peg$parseobjectOfPredicate(),s2!==peg$FAILED?(s3=peg$currPos, +input.charCodeAt(peg$currPos)===64?(s4=peg$c58,peg$currPos++):(s4=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c59)),s4!==peg$FAILED?(s5=peg$parsepriority(),s5!==peg$FAILED?(s4= +[s4,s5],s3=s4):(peg$currPos=s3,s3=peg$c0)):(peg$currPos=s3,s3=peg$c0),s3===peg$FAILED&& +(s3=peg$c4),s3!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c61(s1,s2,s3),s0=s1):(peg$currPos= +s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0),s0}__name( +peg$parseequalSpacingPredicate,"peg$parseequalSpacingPredicate");function peg$parserelation(){ +var s0,s1;return s0=peg$currPos,input.substr(peg$currPos,2)===peg$c62?(s1=peg$c62, +peg$currPos+=2):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c63)),s1!==peg$FAILED&& +(peg$reportedPos=s0,s1=peg$c64()),s0=s1,s0===peg$FAILED&&(s0=peg$currPos,input.substr( +peg$currPos,2)===peg$c65?(s1=peg$c65,peg$currPos+=2):(s1=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c66)),s1!==peg$FAILED&&(peg$reportedPos=s0,s1=peg$c67()),s0=s1,s0=== +peg$FAILED&&(s0=peg$currPos,input.substr(peg$currPos,2)===peg$c68?(s1=peg$c68,peg$currPos+= +2):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c69)),s1!==peg$FAILED&&(peg$reportedPos= +s0,s1=peg$c70()),s0=s1)),s0}__name(peg$parserelation,"peg$parserelation");function peg$parseobjectOfPredicate(){ +var s0;return s0=peg$parsepercentage(),s0===peg$FAILED&&(s0=peg$parseconstant(), +s0===peg$FAILED&&(s0=peg$parseviewPredicate())),s0}__name(peg$parseobjectOfPredicate, +"peg$parseobjectOfPredicate");function peg$parsepriority(){var s0,s1,s2;if(s0=peg$currPos, +s1=[],peg$c71.test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++): +(s2=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c72)),s2!==peg$FAILED)for(;s2!== +peg$FAILED;)s1.push(s2),peg$c71.test(input.charAt(peg$currPos))?(s2=input.charAt( +peg$currPos),peg$currPos++):(s2=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c72));else +s1=peg$c0;return s1!==peg$FAILED&&(peg$reportedPos=s0,s1=peg$c73(s1)),s0=s1,s0}__name( +peg$parsepriority,"peg$parsepriority");function peg$parseconstant(){var s0,s1,s2; +return s0=peg$currPos,s1=peg$parsenumber(),s1!==peg$FAILED&&(peg$reportedPos=s0, +s1=peg$c74(s1)),s0=s1,s0===peg$FAILED&&(s0=peg$currPos,input.charCodeAt(peg$currPos)=== +45?(s1=peg$c42,peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c43)), +s1!==peg$FAILED?(s2=peg$parsenumber(),s2!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c75( +s2),s0=s1):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0),s0===peg$FAILED&& +(s0=peg$currPos,input.charCodeAt(peg$currPos)===43?(s1=peg$c76,peg$currPos++):(s1= +peg$FAILED,peg$silentFails===0&&peg$fail(peg$c77)),s1!==peg$FAILED?(s2=peg$parsenumber(), +s2!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c74(s2),s0=s1):(peg$currPos=s0,s0=peg$c0)): +(peg$currPos=s0,s0=peg$c0))),s0}__name(peg$parseconstant,"peg$parseconstant");function peg$parsepercentage(){ +var s0,s1,s2,s3;return s0=peg$currPos,s1=peg$parsenumber(),s1!==peg$FAILED?(input. +charCodeAt(peg$currPos)===37?(s2=peg$c78,peg$currPos++):(s2=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c79)),s2!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c80(s1),s0=s1): +(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0),s0===peg$FAILED&&(s0=peg$currPos, +input.charCodeAt(peg$currPos)===45?(s1=peg$c42,peg$currPos++):(s1=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c43)),s1!==peg$FAILED?(s2=peg$parsenumber(),s2!==peg$FAILED?(input. +charCodeAt(peg$currPos)===37?(s3=peg$c78,peg$currPos++):(s3=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c79)),s3!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c81(s2),s0=s1): +(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0), +s0===peg$FAILED&&(s0=peg$currPos,input.charCodeAt(peg$currPos)===43?(s1=peg$c76, +peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c77)),s1!==peg$FAILED? +(s2=peg$parsenumber(),s2!==peg$FAILED?(input.charCodeAt(peg$currPos)===37?(s3=peg$c78, +peg$currPos++):(s3=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c79)),s3!==peg$FAILED? +(peg$reportedPos=s0,s1=peg$c80(s2),s0=s1):(peg$currPos=s0,s0=peg$c0)):(peg$currPos= +s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0))),s0}__name(peg$parsepercentage,"peg$p\ +arsepercentage");function peg$parseviewPredicate(){var s0,s1,s2,s3,s4;return s0= +peg$currPos,s1=peg$parseviewName(),s1!==peg$FAILED?(s2=peg$parseattribute(),s2=== +peg$FAILED&&(s2=peg$c4),s2!==peg$FAILED?(s3=peg$parsemultiplier(),s3===peg$FAILED&& +(s3=peg$c4),s3!==peg$FAILED?(s4=peg$parseconstantExpr(),s4===peg$FAILED&&(s4=peg$c4), +s4!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c82(s1,s2,s3,s4),s0=s1):(peg$currPos= +s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)):(peg$currPos= +s0,s0=peg$c0),s0}__name(peg$parseviewPredicate,"peg$parseviewPredicate");function peg$parseattribute(){ +var s0,s1;return s0=peg$currPos,input.substr(peg$currPos,5)===peg$c83?(s1=peg$c83, +peg$currPos+=5):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c84)),s1!==peg$FAILED&& +(peg$reportedPos=s0,s1=peg$c85()),s0=s1,s0===peg$FAILED&&(s0=peg$currPos,input.substr( +peg$currPos,6)===peg$c86?(s1=peg$c86,peg$currPos+=6):(s1=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c87)),s1!==peg$FAILED&&(peg$reportedPos=s0,s1=peg$c88()),s0=s1,s0=== +peg$FAILED&&(s0=peg$currPos,input.substr(peg$currPos,4)===peg$c89?(s1=peg$c89,peg$currPos+= +4):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c90)),s1!==peg$FAILED&&(peg$reportedPos= +s0,s1=peg$c91()),s0=s1,s0===peg$FAILED&&(s0=peg$currPos,input.substr(peg$currPos, +7)===peg$c92?(s1=peg$c92,peg$currPos+=7):(s1=peg$FAILED,peg$silentFails===0&&peg$fail( +peg$c93)),s1!==peg$FAILED&&(peg$reportedPos=s0,s1=peg$c94()),s0=s1,s0===peg$FAILED&& +(s0=peg$currPos,input.substr(peg$currPos,6)===peg$c95?(s1=peg$c95,peg$currPos+=6): +(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c96)),s1!==peg$FAILED&&(peg$reportedPos= +s0,s1=peg$c97()),s0=s1,s0===peg$FAILED&&(s0=peg$currPos,input.substr(peg$currPos, +7)===peg$c98?(s1=peg$c98,peg$currPos+=7):(s1=peg$FAILED,peg$silentFails===0&&peg$fail( +peg$c99)),s1!==peg$FAILED&&(peg$reportedPos=s0,s1=peg$c100()),s0=s1,s0===peg$FAILED&& +(s0=peg$currPos,input.substr(peg$currPos,8)===peg$c101?(s1=peg$c101,peg$currPos+= +8):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c102)),s1!==peg$FAILED&&(peg$reportedPos= +s0,s1=peg$c103()),s0=s1,s0===peg$FAILED&&(s0=peg$currPos,input.substr(peg$currPos, +8)===peg$c104?(s1=peg$c104,peg$currPos+=8):(s1=peg$FAILED,peg$silentFails===0&&peg$fail( +peg$c105)),s1!==peg$FAILED&&(peg$reportedPos=s0,s1=peg$c106()),s0=s1))))))),s0}__name( +peg$parseattribute,"peg$parseattribute");function peg$parsemultiplier(){var s0,s1, +s2;return s0=peg$currPos,input.charCodeAt(peg$currPos)===47?(s1=peg$c107,peg$currPos++): +(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c108)),s1!==peg$FAILED?(s2=peg$parsenumber(), +s2!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c109(s2),s0=s1):(peg$currPos=s0,s0=peg$c0)): +(peg$currPos=s0,s0=peg$c0),s0===peg$FAILED&&(s0=peg$currPos,input.substr(peg$currPos, +2)===peg$c110?(s1=peg$c110,peg$currPos+=2):(s1=peg$FAILED,peg$silentFails===0&&peg$fail( +peg$c111)),s1!==peg$FAILED?(s2=peg$parsenumber(),s2!==peg$FAILED?(peg$reportedPos= +s0,s1=peg$c109(s2),s0=s1):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0), +s0===peg$FAILED&&(s0=peg$currPos,input.substr(peg$currPos,2)===peg$c112?(s1=peg$c112, +peg$currPos+=2):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c113)),s1!==peg$FAILED? +(s2=peg$parsenumber(),s2!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c114(s2),s0=s1): +(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0),s0===peg$FAILED&&(s0=peg$currPos, +input.charCodeAt(peg$currPos)===42?(s1=peg$c115,peg$currPos++):(s1=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c116)),s1!==peg$FAILED?(s2=peg$parsenumber(),s2!==peg$FAILED?(peg$reportedPos= +s0,s1=peg$c117(s2),s0=s1):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0), +s0===peg$FAILED&&(s0=peg$currPos,input.substr(peg$currPos,2)===peg$c118?(s1=peg$c118, +peg$currPos+=2):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c119)),s1!==peg$FAILED? +(s2=peg$parsenumber(),s2!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c117(s2),s0=s1): +(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0),s0===peg$FAILED&&(s0=peg$currPos, +input.substr(peg$currPos,2)===peg$c120?(s1=peg$c120,peg$currPos+=2):(s1=peg$FAILED, +peg$silentFails===0&&peg$fail(peg$c121)),s1!==peg$FAILED?(s2=peg$parsenumber(),s2!== +peg$FAILED?(peg$reportedPos=s0,s1=peg$c122(s2),s0=s1):(peg$currPos=s0,s0=peg$c0)): +(peg$currPos=s0,s0=peg$c0)))))),s0}__name(peg$parsemultiplier,"peg$parsemultipli\ +er");function peg$parseconstantExpr(){var s0,s1,s2;return s0=peg$currPos,input.charCodeAt( +peg$currPos)===45?(s1=peg$c42,peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c43)),s1!==peg$FAILED?(s2=peg$parsenumber(),s2!==peg$FAILED?(peg$reportedPos= +s0,s1=peg$c122(s2),s0=s1):(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0), +s0===peg$FAILED&&(s0=peg$currPos,input.charCodeAt(peg$currPos)===43?(s1=peg$c76, +peg$currPos++):(s1=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c77)),s1!==peg$FAILED? +(s2=peg$parsenumber(),s2!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c117(s2),s0=s1): +(peg$currPos=s0,s0=peg$c0)):(peg$currPos=s0,s0=peg$c0)),s0}__name(peg$parseconstantExpr, +"peg$parseconstantExpr");function peg$parseviewNameRange(){var s0,s1,s2,s3,s4;if(s0= +peg$currPos,s1=peg$currPos,s2=[],peg$c123.test(input.charAt(peg$currPos))?(s3=input. +charAt(peg$currPos),peg$currPos++):(s3=peg$FAILED,peg$silentFails===0&&peg$fail( +peg$c124)),s3!==peg$FAILED)for(;s3!==peg$FAILED;)s2.push(s3),peg$c123.test(input. +charAt(peg$currPos))?(s3=input.charAt(peg$currPos),peg$currPos++):(s3=peg$FAILED, +peg$silentFails===0&&peg$fail(peg$c124));else s2=peg$c0;if(s2!==peg$FAILED&&(s2= +input.substring(s1,peg$currPos)),s1=s2,s1!==peg$FAILED){for(s2=peg$currPos,s3=[], +peg$c125.test(input.charAt(peg$currPos))?(s4=input.charAt(peg$currPos),peg$currPos++): +(s4=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c126));s4!==peg$FAILED;)s3.push( +s4),peg$c125.test(input.charAt(peg$currPos))?(s4=input.charAt(peg$currPos),peg$currPos++): +(s4=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c126));s3!==peg$FAILED&&(s3=input. +substring(s2,peg$currPos)),s2=s3,s2!==peg$FAILED?(s3=peg$parserange(),s3!==peg$FAILED? +(peg$reportedPos=s0,s1=peg$c127(s1,s2,s3),s0=s1):(peg$currPos=s0,s0=peg$c0)):(peg$currPos= +s0,s0=peg$c0)}else peg$currPos=s0,s0=peg$c0;if(s0===peg$FAILED){if(s0=peg$currPos, +s1=peg$currPos,s2=[],peg$c123.test(input.charAt(peg$currPos))?(s3=input.charAt(peg$currPos), +peg$currPos++):(s3=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c124)),s3!==peg$FAILED) +for(;s3!==peg$FAILED;)s2.push(s3),peg$c123.test(input.charAt(peg$currPos))?(s3=input. +charAt(peg$currPos),peg$currPos++):(s3=peg$FAILED,peg$silentFails===0&&peg$fail( +peg$c124));else s2=peg$c0;if(s2!==peg$FAILED&&(s2=input.substring(s1,peg$currPos)), +s1=s2,s1!==peg$FAILED){for(s2=peg$currPos,s3=[],peg$c125.test(input.charAt(peg$currPos))? +(s4=input.charAt(peg$currPos),peg$currPos++):(s4=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c126));s4!==peg$FAILED;)s3.push(s4),peg$c125.test(input.charAt(peg$currPos))? +(s4=input.charAt(peg$currPos),peg$currPos++):(s4=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c126));s3!==peg$FAILED&&(s3=input.substring(s2,peg$currPos)),s2=s3, +s2!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c128(s1,s2),s0=s1):(peg$currPos=s0,s0= +peg$c0)}else peg$currPos=s0,s0=peg$c0}return s0}__name(peg$parseviewNameRange,"p\ +eg$parseviewNameRange");function peg$parseviewName(){var s0,s1,s2,s3,s4;if(s0=peg$currPos, +s1=peg$currPos,s2=[],peg$c123.test(input.charAt(peg$currPos))?(s3=input.charAt(peg$currPos), +peg$currPos++):(s3=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c124)),s3!==peg$FAILED) +for(;s3!==peg$FAILED;)s2.push(s3),peg$c123.test(input.charAt(peg$currPos))?(s3=input. +charAt(peg$currPos),peg$currPos++):(s3=peg$FAILED,peg$silentFails===0&&peg$fail( +peg$c124));else s2=peg$c0;if(s2!==peg$FAILED&&(s2=input.substring(s1,peg$currPos)), +s1=s2,s1!==peg$FAILED){for(s2=peg$currPos,s3=[],peg$c125.test(input.charAt(peg$currPos))? +(s4=input.charAt(peg$currPos),peg$currPos++):(s4=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c126));s4!==peg$FAILED;)s3.push(s4),peg$c125.test(input.charAt(peg$currPos))? +(s4=input.charAt(peg$currPos),peg$currPos++):(s4=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c126));s3!==peg$FAILED&&(s3=input.substring(s2,peg$currPos)),s2=s3, +s2!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c128(s1,s2),s0=s1):(peg$currPos=s0,s0= +peg$c0)}else peg$currPos=s0,s0=peg$c0;return s0}__name(peg$parseviewName,"peg$pa\ +rseviewName");function peg$parserange(){var s0,s1,s2,s3;if(s0=peg$currPos,input. +substr(peg$currPos,2)===peg$c129?(s1=peg$c129,peg$currPos+=2):(s1=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c130)),s1!==peg$FAILED){if(s2=[],peg$c71.test(input.charAt(peg$currPos))? +(s3=input.charAt(peg$currPos),peg$currPos++):(s3=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c72)),s3!==peg$FAILED)for(;s3!==peg$FAILED;)s2.push(s3),peg$c71.test( +input.charAt(peg$currPos))?(s3=input.charAt(peg$currPos),peg$currPos++):(s3=peg$FAILED, +peg$silentFails===0&&peg$fail(peg$c72));else s2=peg$c0;s2!==peg$FAILED?(peg$reportedPos= +s0,s1=peg$c131(s2),s0=s1):(peg$currPos=s0,s0=peg$c0)}else peg$currPos=s0,s0=peg$c0; +return s0}__name(peg$parserange,"peg$parserange");function peg$parsenumber(){var s0, +s1,s2,s3,s4;if(s0=peg$currPos,s1=[],peg$c71.test(input.charAt(peg$currPos))?(s2= +input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,peg$silentFails===0&&peg$fail( +peg$c72)),s2!==peg$FAILED)for(;s2!==peg$FAILED;)s1.push(s2),peg$c71.test(input.charAt( +peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c72));else s1=peg$c0;if(s1!==peg$FAILED)if(input.charCodeAt(peg$currPos)=== +46?(s2=peg$c132,peg$currPos++):(s2=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c133)), +s2!==peg$FAILED){if(s3=[],peg$c71.test(input.charAt(peg$currPos))?(s4=input.charAt( +peg$currPos),peg$currPos++):(s4=peg$FAILED,peg$silentFails===0&&peg$fail(peg$c72)), +s4!==peg$FAILED)for(;s4!==peg$FAILED;)s3.push(s4),peg$c71.test(input.charAt(peg$currPos))? +(s4=input.charAt(peg$currPos),peg$currPos++):(s4=peg$FAILED,peg$silentFails===0&& +peg$fail(peg$c72));else s3=peg$c0;s3!==peg$FAILED?(peg$reportedPos=s0,s1=peg$c134( +s1,s3),s0=s1):(peg$currPos=s0,s0=peg$c0)}else peg$currPos=s0,s0=peg$c0;else peg$currPos= +s0,s0=peg$c0;if(s0===peg$FAILED){if(s0=peg$currPos,s1=[],peg$c71.test(input.charAt( +peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2=peg$FAILED,peg$silentFails=== +0&&peg$fail(peg$c72)),s2!==peg$FAILED)for(;s2!==peg$FAILED;)s1.push(s2),peg$c71. +test(input.charAt(peg$currPos))?(s2=input.charAt(peg$currPos),peg$currPos++):(s2= +peg$FAILED,peg$silentFails===0&&peg$fail(peg$c72));else s1=peg$c0;s1!==peg$FAILED&& +(peg$reportedPos=s0,s1=peg$c135(s1)),s0=s1}return s0}__name(peg$parsenumber,"peg\ +$parsenumber");function extend(dst){for(var i2=1;i21&&context.constraints. +push({view1:"_~"+context.lineIndex+":1~",attr1:context.horizontal?Attribute_default. +WIDTH:Attribute_default.HEIGHT,relation:context.relation.relation||Relation_default. +EQU,view2:name2,attr2:context.horizontal?Attribute_default.WIDTH:Attribute_default. +HEIGHT,priority:context.relation.priority}),context.equalSpacerIndex++,context.relation. +view||context.relation.multiplier&&context.relation.multiplier!==1?(context.constraints. +push({view1:name2,attr1:context.horizontal?Attribute_default.WIDTH:Attribute_default. +HEIGHT,relation:context.relation.relation||Relation_default.EQU,view2:context.relation. +view,attr2:context.horizontal?Attribute_default.WIDTH:Attribute_default.HEIGHT,priority:context. +relation.priority,multiplier:context.relation.multiplier}),context.relation.multiplier= +void 0):context.relation.constant&&(context.constraints.push({view1:name2,attr1:context. +horizontal?Attribute_default.WIDTH:Attribute_default.HEIGHT,relation:Relation_default. +EQU,view2:null,attr2:Attribute_default.CONST,priority:context.relation.priority, +constant:context.relation.constant}),context.relation.constant=void 0);for(var i2=0;i2< +context.prevViews.length;i2++){let prevView=context.prevViews[i2];switch(context. +orientation){case Orientation.HORIZONTAL:context.prevAttr=prevView!==stackView?Attribute_default. +RIGHT:Attribute_default.LEFT,context.curAttr=Attribute_default.LEFT;break;case Orientation. +VERTICAL:context.prevAttr=prevView!==stackView?Attribute_default.BOTTOM:Attribute_default. +TOP,context.curAttr=Attribute_default.TOP;break;case Orientation.ZINDEX:context. +prevAttr=Attribute_default.ZINDEX,context.curAttr=Attribute_default.ZINDEX,context. +relation.constant=prevView!==stackView?"default":0;break}context.constraints.push( +{view1:prevView,attr1:context.prevAttr,relation:context.relation.relation,view2:name2, +attr2:context.curAttr,priority:context.relation.priority})}context.prevViews=[name2]} +__name(_processEqualSpacer,"_processEqualSpacer");function _processProportionalSpacer(context,stackView){ +context.proportionalSpacerIndex=context.proportionalSpacerIndex||1;let name2="_-"+ +context.lineIndex+":"+context.proportionalSpacerIndex+"-";context.proportionalSpacerIndex++, +context.constraints.push({view1:name2,attr1:context.horizontal?Attribute_default. +WIDTH:Attribute_default.HEIGHT,relation:context.relation.relation||Relation_default. +EQU,view2:context.relation.view,attr2:context.horizontal?Attribute_default.WIDTH: +Attribute_default.HEIGHT,priority:context.relation.priority,multiplier:context.relation. +multiplier}),context.relation.multiplier=void 0;for(var i2=0;i21?item[1]:""}}else line.indexOf("//"+prefixedCategory+":")===0&&(metaInfo[category]= +line.substring(3+prefixedCategory.length))}}}if(metaInfo.viewport){let viewport=metaInfo. +viewport;var aspectRatio=viewport["aspect-ratio"];aspectRatio&&(aspectRatio=aspectRatio. +split("/"),viewport["aspect-ratio"]=parseInt(aspectRatio[0])/parseInt(aspectRatio[1])), +viewport.height!==void 0&&(viewport.height=viewport.height==="intrinsic"?!0:parseInt( +viewport.height)),viewport.width!==void 0&&(viewport.width=viewport.width==="int\ +rinsic"?!0:parseInt(viewport.width)),viewport["max-height"]!==void 0&&(viewport["\ +max-height"]=parseInt(viewport["max-height"])),viewport["max-width"]!==void 0&&(viewport["\ +max-width"]=parseInt(viewport["max-width"])),viewport["min-height"]!==void 0&&(viewport["\ +min-height"]=parseInt(viewport["min-height"])),viewport["min-width"]!==void 0&&(viewport["\ +min-width"]=parseInt(viewport["min-width"]))}if(metaInfo.widths)for(key2 in metaInfo. +widths){let width=metaInfo.widths[key2]==="intrinsic"?!0:parseInt(metaInfo.widths[key2]); +metaInfo.widths[key2]=width,(width===void 0||isNaN(width))&&delete metaInfo.widths[key2]} +if(metaInfo.heights)for(key2 in metaInfo.heights){let height=metaInfo.heights[key2]=== +"intrinsic"?!0:parseInt(metaInfo.heights[key2]);metaInfo.heights[key2]=height,(height=== +void 0||isNaN(height))&&delete metaInfo.heights[key2]}if(metaInfo.spacing){let value=JSON. +parse(metaInfo.spacing);if(metaInfo.spacing=value,Array.isArray(value)){for(var sIdx=0, +len=value.length;sIdx0,"factory"),terms=createMap();for(let i2=0,n=args. +length;i2=","="][this._operator]+" 0 ("+this._strength.toString()+")"}_expression;_operator;_strength;_id=CnId++}, +CnId=0;var Solver=class{static{__name(this,"Solver")}maxIterations=1e3;constructor(){}createConstraint(lhs,operator,rhs,strength=Strength. +required){let cn=new Constraint(lhs,operator,rhs,strength);return this.addConstraint( +cn),cn}addConstraint(constraint){if(this._cnMap.find(constraint)!==void 0)throw new Error( +"duplicate constraint");let data=this._createRow(constraint),row=data.row,tag=data. +tag,subject=this._chooseSubject(row,tag);if(subject.type()===SymbolType.Invalid&& +row.allDummies())if(nearZero(row.constant()))subject=tag.marker;else throw new Error( +"unsatisfiable constraint");if(subject.type()===SymbolType.Invalid){if(!this._addWithArtificialVariable( +row))throw new Error("unsatisfiable constraint")}else row.solveFor(subject),this. +_substitute(subject,row),this._rowMap.insert(subject,row);this._cnMap.insert(constraint, +tag),this._optimize(this._objective)}removeConstraint(constraint){let cnPair=this. +_cnMap.erase(constraint);if(cnPair===void 0)throw new Error("unknown constraint"); +this._removeConstraintEffects(constraint,cnPair.second);let marker2=cnPair.second. +marker,rowPair=this._rowMap.erase(marker2);if(rowPair===void 0){let leaving=this. +_getMarkerLeavingSymbol(marker2);if(leaving.type()===SymbolType.Invalid)throw new Error( +"failed to find leaving row");rowPair=this._rowMap.erase(leaving),rowPair.second. +solveForEx(leaving,marker2),this._substitute(marker2,rowPair.second)}this._optimize( +this._objective)}hasConstraint(constraint){return this._cnMap.contains(constraint)}addEditVariable(variable,strength){ +if(this._editMap.find(variable)!==void 0)throw new Error("duplicate edit variabl\ +e");if(strength=Strength.clip(strength),strength===Strength.required)throw new Error( +"bad required strength");let expr=new Expression(variable),cn=new Constraint(expr, +Operator.Eq,void 0,strength);this.addConstraint(cn);let info={tag:this._cnMap.find( +cn).second,constraint:cn,constant:0};this._editMap.insert(variable,info)}removeEditVariable(variable){ +let editPair=this._editMap.erase(variable);if(editPair===void 0)throw new Error( +"unknown edit variable");this.removeConstraint(editPair.second.constraint)}hasEditVariable(variable){ +return this._editMap.contains(variable)}suggestValue(variable,value){let editPair=this. +_editMap.find(variable);if(editPair===void 0)throw new Error("unknown edit varia\ +ble");let rows=this._rowMap,info=editPair.second,delta=value-info.constant;info. +constant=value;let marker2=info.tag.marker,rowPair=rows.find(marker2);if(rowPair!== +void 0){rowPair.second.add(-delta)<0&&this._infeasibleRows.push(marker2),this._dualOptimize(); +return}let other=info.tag.other;if(rowPair=rows.find(other),rowPair!==void 0){rowPair. +second.add(delta)<0&&this._infeasibleRows.push(other),this._dualOptimize();return} +for(let i2=0,n=rows.size();i2this._makeSymbol(SymbolType.External), +"factory");return this._varMap.setDefault(variable,factory).second}_createRow(constraint){ +let expr=constraint.expression(),row=new Row(expr.constant()),terms=expr.terms(); +for(let i2=0,n=terms.size();i20&&symbol. +type()!==SymbolType.Dummy){let r3=this._objective.coefficientFor(symbol)/c3;r30);nearZero(pair.second+=coefficient)&& +this._cellMap.erase(symbol)}insertRow(other,coefficient=1){this._constant+=other. +_constant*coefficient;let cells=other._cellMap;for(let i2=0,n=cells.size();i2=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers47=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-autolayout",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D,_instanceExtraInitializers=[], +_visualFormat_decorators,_visualFormat_initializers=[];var Autolayout2=class extends _classSuper{static{ +__name(this,"Autolayout")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_visualFormat_decorators=[attribute],__esDecorate47(null,null,_visualFormat_decorators, +{kind:"field",name:"visualFormat",static:!1,private:!1,access:{has:obj=>"visualF\ +ormat"in obj,get:obj=>obj.visualFormat,set:(obj,value)=>{obj.visualFormat=value}}, +metadata:_metadata},_visualFormat_initializers,_instanceExtraInitializers),__esDecorate47( +null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis. +name,metadata:_metadata},null,_classExtraInitializers),Autolayout2=_classThis=_classDescriptor. +value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0, +configurable:!0,writable:!0,value:_metadata})}static DEFAULT_PARSE_OPTIONS={extended:!0, +strict:!1};visualFormat=(__runInitializers47(this,_instanceExtraInitializers),__runInitializers47( +this,_visualFormat_initializers,""));constructor(options){super(),this.on("sizec\ +hange",this.#layout),this.on("reflow",this.#layout),options&&(options.visualFormat&& +this.setVisualFormat(options.visualFormat),options.layoutOptions&&this.setLayoutOptions( +options.layoutOptions))}connectedCallback(){super.connectedCallback(),this.createEffect( +()=>{this.setVisualFormat(this.visualFormat||"")})}#autoLayoutView;childConnectedCallback(child){ +if(!(child instanceof Element3D))throw new Error("Child elements of Autolayout m\ +ust be instances of LUME.Element3D.");super.childConnectedCallback(child),this.#autoLayoutView&& +this.#checkNodes()}childDisconnectedCallback(child){if(!(child instanceof Element3D)) +throw new Error("Child elements of Autolayout must be instances of LUME.Element3\ +D.");if(super.childDisconnectedCallback(child),!this.#autoLayoutView)return;let _idToNode=this.#idToNode; +for(let id in _idToNode)if(_idToNode[id]===child){delete _idToNode[id];break}this.#checkNodes()}reflowLayout(){ +return this.#reflowLayout||(this.#reflowLayout=!0,Motor.once(()=>this.emit("refl\ +ow"))),this}setVisualFormat(visualFormat,parseOptions){this._visualFormat=visualFormat; +var constraints=AutoLayout_default.VisualFormat.parse(visualFormat,parseOptions|| +Autolayout2.DEFAULT_PARSE_OPTIONS);return this.#metaInfo=AutoLayout_default.VisualFormat. +parseMetaInfo(visualFormat),this.#autoLayoutView=new AutoLayout_default.View({constraints}), +this.#checkNodes(),this.reflowLayout(),this}setLayoutOptions(options){return this.#layoutOptions= +options||{},this.reflowLayout(),this}addToLayout(child,id){return this.append(child), +id&&(this.#idToNode[id]=child),this.reflowLayout(),child}removeFromLayout(child,id){ +if(child&&id)this.removeChild(child),delete this.#idToNode[id];else if(child){for(id in this.#idToNode) +if(this.#idToNode[id]===child){delete this.#idToNode[id];break}this.removeChild( +child)}else id&&(this.removeChild(this.#idToNode[id]),delete this.#idToNode[id]); +this.reflowLayout()}#layoutOptions={};#idToNode={};#reflowLayout=!1;#metaInfo;#setIntrinsicWidths(widths){ +for(var key2 in widths){var subView=this.#autoLayoutView.subViews[key2],node=this.#idToNode[key2]; +subView&&node&&(subView.intrinsicWidth=node.calculatedSize.x)}}#setIntrinsicHeights(heights){ +for(var key2 in heights){var subView=this.#autoLayoutView.subViews[key2],node=this.#idToNode[key2]; +subView&&node&&(subView.intrinsicHeight=node.calculatedSize.y)}}#setViewPortSize(size3,vp){ +return size3=[vp.width!==void 0&&vp.width!==!0?vp.width:Math.max(Math.min(size3[0], +vp["max-width"]||size3[0]),vp["min-width"]||0),vp.height!==void 0&&vp.height!==!0? +vp.height:Math.max(Math.min(size3[1],vp["max-height"]||size3[1]),vp["min-height"]|| +0)],vp.width===!0&&vp.height===!0?(size3[0]=this.#autoLayoutView.fittingWidth,size3[1]= +this.#autoLayoutView.fittingHeight):vp.width===!0?(this.#autoLayoutView.setSize( +void 0,size3[1]),size3[0]=this.#autoLayoutView.fittingWidth):vp.height===!0?(this.#autoLayoutView. +setSize(size3[0],void 0),size3[1]=this.#autoLayoutView.fittingHeight):(size3=vp["\ +aspect-ratio"]?[Math.min(size3[0],size3[1]*vp["aspect-ratio"]),Math.min(size3[1], +size3[0]/vp["aspect-ratio"])]:size3,this.#autoLayoutView.setSize(size3[0],size3[1])), +size3}#layout=()=>{if(this.#autoLayoutView){var x2,y2,size3=this.size.toArray(); +(this.#layoutOptions.spacing||this.#metaInfo.spacing)&&this.#autoLayoutView.setSpacing( +this.#layoutOptions.spacing||this.#metaInfo.spacing);var widths=this.#layoutOptions. +widths||this.#metaInfo.widths;widths&&this.#setIntrinsicWidths(widths);var heights=this.#layoutOptions. +heights||this.#metaInfo.heights;if(heights&&this.#setIntrinsicHeights(heights),this.#layoutOptions. +viewport||this.#metaInfo.viewport){var restrainedSize=this.#setViewPortSize(size3, +this.#layoutOptions.viewport||this.#metaInfo.viewport);x2=(size3[0]-restrainedSize[0])/ +2,y2=(size3[1]-restrainedSize[1])/2}else this.#autoLayoutView.setSize(size3[0],size3[1]), +x2=0,y2=0;for(var key2 in this.#autoLayoutView.subViews){var subView=this.#autoLayoutView. +subViews[key2];if(key2.indexOf("_")!==0&&subView.type!=="stack"){var node=this.#idToNode[key2]; +node&&this.#updateNode(node,subView,x2,y2,widths,heights)}}this.#reflowLayout&&(this.#reflowLayout= +!1)}};#updateNode(node,subView,x2,y2,widths,heights){node.sizeMode=[widths&&widths[key]=== +!0?"proportional":"literal",heights&&heights[key]===!0?"proportional":"literal"], +node.size=[widths&&widths[key]===!0?1:subView.width,heights&&heights[key]===!0?1: +subView.height],node.position=[x2+subView.left,y2+subView.top,subView.zIndex*5]}#checkNodes(){ +let subViews=this.#autoLayoutView.subViews,subViewKeys=Object.keys(subViews),_idToNode=this.#idToNode; +for(var key2 of subViewKeys){var subView=subViews[key2];if(key2.indexOf("_")!==0&& +subView.type!=="stack"){var node=_idToNode[key2];node||(node=this.querySelector( +"."+key2),node&&node.parentElement===this&&(_idToNode[key2]=node))}}this.#showOrHideNodes()}#showOrHideNodes(){ +let subViews=this.#autoLayoutView.subViews,subViewKeys=Object.keys(subViews),_idToNode=this.#idToNode, +nodeIds=Object.keys(_idToNode);for(let id of nodeIds)subViewKeys.includes(id)?_idToNode[id]. +visible=!0:_idToNode[id].visible=!1}static{__runInitializers47(_classThis,_classExtraInitializers)}}; +return Autolayout2=_classThis})();var __esDecorate48=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers48=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-autolayou\ +t-node",autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=Autolayout;var AutoLayoutNode2=class extends _classSuper{static{__name( +this,"AutoLayoutNode")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate48(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),AutoLayoutNode2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers48( +_classThis,_classExtraInitializers)}};return AutoLayoutNode2=_classThis})();var __esDecorate49=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers49=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-cube-layout", +autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D; +var CubeLayout2=class extends _classSuper{static{__name(this,"CubeLayout")}static{ +_classThis=this}static{let _metadata=typeof Symbol=="function"&&Symbol.metadata? +Object.create(_classSuper[Symbol.metadata]??null):void 0;__esDecorate49(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),CubeLayout2=_classThis=_classDescriptor.value,_metadata&& +Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers49(_classThis,_classExtraInitializers)}#sides=[];hasShadow=!0;#created=!1;connectedCallback(){ +if(super.connectedCallback(),this.#created)return;for(let n=0;n<6;n+=1)this.#createCubeSide( +n);let defaultSlot=document.createElement("slot");this.root.appendChild(defaultSlot)}#createCubeSide(index){ +let rotator=new Element3D().set({alignPoint:new XYZNumberValues(.5,.5,.5)}),side=new Element3D(). +set({mountPoint:new XYZNumberValues(.5,.5),size:new XYZNonNegativeValues(this.size. +x,this.size.x)});this.#sides.push(side),rotator.append(side);let slot=document.createElement( +"slot");side.append(slot),slot.name=index===0?"front":index===1?"right":index=== +2?"back":index===3?"left":index===4?"top":"bottom",index<4?rotator.rotation.y=90* +index:rotator.rotation.x=90*(index%2?-1:1),side.position.z=this.size.x/2,this.root. +appendChild(rotator)}setContent(content){for(let index=0;index<6;index+=1)this.#sides[index]. +innerHTML="",this.#sides[index].append(content[index]);return this}};return CubeLayout2= +_classThis})();var __esDecorate50=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers50=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-push-pane\ +-layout",autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=Node4;var PushPaneLayout2=class extends _classSuper{static{__name(this, +"PushPaneLayout")}static{_classThis=this}static{let _metadata=typeof Symbol=="fu\ +nction"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate50(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),PushPaneLayout2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers50( +_classThis,_classExtraInitializers)}};return PushPaneLayout2=_classThis})();var __esDecorate51=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers51=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element],_classDescriptor,_classExtraInitializers=[], +_classThis,_classSuper=Element3D,_instanceExtraInitializers=[],_color_decorators, +_color_initializers=[],_intensity_decorators,_intensity_initializers=[];var Light4=class extends _classSuper{static{ +__name(this,"Light")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_color_decorators=[attribute],_intensity_decorators=[numberAttribute],__esDecorate51( +null,null,_color_decorators,{kind:"field",name:"color",static:!1,private:!1,access:{ +has:obj=>"color"in obj,get:obj=>obj.color,set:(obj,value)=>{obj.color=value}},metadata:_metadata}, +_color_initializers,_instanceExtraInitializers),__esDecorate51(null,null,_intensity_decorators, +{kind:"field",name:"intensity",static:!1,private:!1,access:{has:obj=>"intensity"in +obj,get:obj=>obj.intensity,set:(obj,value)=>{obj.intensity=value}},metadata:_metadata}, +_intensity_initializers,_instanceExtraInitializers),__esDecorate51(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),Light4=_classThis=_classDescriptor.value,_metadata&& +Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers51(_classThis,_classExtraInitializers)}color=(__runInitializers51( +this,_instanceExtraInitializers),__runInitializers51(this,_color_initializers,"w\ +hite"));intensity=__runInitializers51(this,_intensity_initializers,1);makeThreeObject3d(){ +return new Light2}connectedCallback(){super.connectedCallback(),this.createEffect( +()=>{typeof this.color=="object"&&(this.three.color=this.color),this.three.color= +new Color(this.color),this.needsUpdate()}),this.createEffect(()=>{this.three.intensity= +this.intensity,this.needsUpdate()})}};return Light4=_classThis})();var __esDecorate52=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers52=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-ambient-li\ +ght",autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=Light3,_instanceExtraInitializers=[],_intensity_decorators,_intensity_initializers=[]; +var AmbientLight4=class extends _classSuper{static{__name(this,"AmbientLight")}static{ +_classThis=this}static{let _metadata=typeof Symbol=="function"&&Symbol.metadata? +Object.create(_classSuper[Symbol.metadata]??null):void 0;_intensity_decorators=[ +numberAttribute],__esDecorate52(null,null,_intensity_decorators,{kind:"field",name:"\ +intensity",static:!1,private:!1,access:{has:obj=>"intensity"in obj,get:obj=>obj. +intensity,set:(obj,value)=>{obj.intensity=value}},metadata:_metadata},_intensity_initializers, +_instanceExtraInitializers),__esDecorate52(null,_classDescriptor={value:_classThis}, +_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers), +AmbientLight4=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty( +_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}), +__runInitializers52(_classThis,_classExtraInitializers)}intensity=(__runInitializers52( +this,_instanceExtraInitializers),__runInitializers52(this,_intensity_initializers, +1));makeThreeObject3d(){return new AmbientLight2}};return AmbientLight4=_classThis})();var __esDecorate53=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers53=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element],_classDescriptor, +_classExtraInitializers=[],_classThis,_classSuper=Light3,_instanceExtraInitializers=[], +_castShadow_decorators,_castShadow_initializers=[],_shadowMapWidth_decorators,_shadowMapWidth_initializers=[], +_shadowMapHeight_decorators,_shadowMapHeight_initializers=[],_shadowRadius_decorators, +_shadowRadius_initializers=[],_shadowBias_decorators,_shadowBias_initializers=[], +_shadowNormalBias_decorators,_shadowNormalBias_initializers=[],_shadowCameraNear_decorators, +_shadowCameraNear_initializers=[],_shadowCameraFar_decorators,_shadowCameraFar_initializers=[]; +var LightWithShadow2=class extends _classSuper{static{__name(this,"LightWithShad\ +ow")}static{_classThis=this}static{let _metadata=typeof Symbol=="function"&&Symbol. +metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;_castShadow_decorators= +[booleanAttribute],_shadowMapWidth_decorators=[numberAttribute],_shadowMapHeight_decorators= +[numberAttribute],_shadowRadius_decorators=[numberAttribute],_shadowBias_decorators= +[numberAttribute],_shadowNormalBias_decorators=[numberAttribute],_shadowCameraNear_decorators= +[numberAttribute],_shadowCameraFar_decorators=[numberAttribute],__esDecorate53(null, +null,_castShadow_decorators,{kind:"field",name:"castShadow",static:!1,private:!1, +access:{has:obj=>"castShadow"in obj,get:obj=>obj.castShadow,set:(obj,value)=>{obj. +castShadow=value}},metadata:_metadata},_castShadow_initializers,_instanceExtraInitializers), +__esDecorate53(null,null,_shadowMapWidth_decorators,{kind:"field",name:"shadowMa\ +pWidth",static:!1,private:!1,access:{has:obj=>"shadowMapWidth"in obj,get:obj=>obj. +shadowMapWidth,set:(obj,value)=>{obj.shadowMapWidth=value}},metadata:_metadata}, +_shadowMapWidth_initializers,_instanceExtraInitializers),__esDecorate53(null,null, +_shadowMapHeight_decorators,{kind:"field",name:"shadowMapHeight",static:!1,private:!1, +access:{has:obj=>"shadowMapHeight"in obj,get:obj=>obj.shadowMapHeight,set:(obj,value)=>{ +obj.shadowMapHeight=value}},metadata:_metadata},_shadowMapHeight_initializers,_instanceExtraInitializers), +__esDecorate53(null,null,_shadowRadius_decorators,{kind:"field",name:"shadowRadi\ +us",static:!1,private:!1,access:{has:obj=>"shadowRadius"in obj,get:obj=>obj.shadowRadius, +set:(obj,value)=>{obj.shadowRadius=value}},metadata:_metadata},_shadowRadius_initializers, +_instanceExtraInitializers),__esDecorate53(null,null,_shadowBias_decorators,{kind:"\ +field",name:"shadowBias",static:!1,private:!1,access:{has:obj=>"shadowBias"in obj, +get:obj=>obj.shadowBias,set:(obj,value)=>{obj.shadowBias=value}},metadata:_metadata}, +_shadowBias_initializers,_instanceExtraInitializers),__esDecorate53(null,null,_shadowNormalBias_decorators, +{kind:"field",name:"shadowNormalBias",static:!1,private:!1,access:{has:obj=>"sha\ +dowNormalBias"in obj,get:obj=>obj.shadowNormalBias,set:(obj,value)=>{obj.shadowNormalBias= +value}},metadata:_metadata},_shadowNormalBias_initializers,_instanceExtraInitializers), +__esDecorate53(null,null,_shadowCameraNear_decorators,{kind:"field",name:"shadow\ +CameraNear",static:!1,private:!1,access:{has:obj=>"shadowCameraNear"in obj,get:obj=>obj. +shadowCameraNear,set:(obj,value)=>{obj.shadowCameraNear=value}},metadata:_metadata}, +_shadowCameraNear_initializers,_instanceExtraInitializers),__esDecorate53(null,null, +_shadowCameraFar_decorators,{kind:"field",name:"shadowCameraFar",static:!1,private:!1, +access:{has:obj=>"shadowCameraFar"in obj,get:obj=>obj.shadowCameraFar,set:(obj,value)=>{ +obj.shadowCameraFar=value}},metadata:_metadata},_shadowCameraFar_initializers,_instanceExtraInitializers), +__esDecorate53(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),LightWithShadow2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers53( +_classThis,_classExtraInitializers)}castShadow=(__runInitializers53(this,_instanceExtraInitializers), +__runInitializers53(this,_castShadow_initializers,!0));shadowMapWidth=__runInitializers53( +this,_shadowMapWidth_initializers,512);shadowMapHeight=__runInitializers53(this, +_shadowMapHeight_initializers,512);shadowRadius=__runInitializers53(this,_shadowRadius_initializers, +3);shadowBias=__runInitializers53(this,_shadowBias_initializers,0);shadowNormalBias=__runInitializers53( +this,_shadowNormalBias_initializers,0);shadowCameraNear=__runInitializers53(this, +_shadowCameraNear_initializers,1);shadowCameraFar=__runInitializers53(this,_shadowCameraFar_initializers, +2e3);connectedCallback(){super.connectedCallback(),this.createEffect(()=>{let light=this. +three;light.castShadow=this.castShadow;let shadow=this.three.shadow;shadow.mapSize. +width=this.shadowMapWidth,shadow.mapSize.height=this.shadowMapHeight,shadow.radius= +this.shadowRadius,shadow.bias=this.shadowBias,shadow.normalBias=this.shadowNormalBias; +let camera=shadow.camera;camera.near=this.shadowCameraNear,camera.far=this.shadowCameraFar, +shadow.needsUpdate=!0,this.needsUpdate()})}};return LightWithShadow2=_classThis})();var __esDecorate54=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers54=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-direct\ +ional-light",autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=LightWithShadow,_instanceExtraInitializers=[],_intensity_decorators, +_intensity_initializers=[],_shadowCameraTop_decorators,_shadowCameraTop_initializers=[], +_shadowCameraRight_decorators,_shadowCameraRight_initializers=[],_shadowCameraBottom_decorators, +_shadowCameraBottom_initializers=[],_shadowCameraLeft_decorators,_shadowCameraLeft_initializers=[]; +var DirectionalLight4=class extends _classSuper{static{__name(this,"DirectionalL\ +ight")}static{_classThis=this}static{let _metadata=typeof Symbol=="function"&&Symbol. +metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;_intensity_decorators= +[numberAttribute],_shadowCameraTop_decorators=[numberAttribute],_shadowCameraRight_decorators= +[numberAttribute],_shadowCameraBottom_decorators=[numberAttribute],_shadowCameraLeft_decorators= +[numberAttribute],__esDecorate54(null,null,_intensity_decorators,{kind:"field",name:"\ +intensity",static:!1,private:!1,access:{has:obj=>"intensity"in obj,get:obj=>obj. +intensity,set:(obj,value)=>{obj.intensity=value}},metadata:_metadata},_intensity_initializers, +_instanceExtraInitializers),__esDecorate54(null,null,_shadowCameraTop_decorators, +{kind:"field",name:"shadowCameraTop",static:!1,private:!1,access:{has:obj=>"shad\ +owCameraTop"in obj,get:obj=>obj.shadowCameraTop,set:(obj,value)=>{obj.shadowCameraTop= +value}},metadata:_metadata},_shadowCameraTop_initializers,_instanceExtraInitializers), +__esDecorate54(null,null,_shadowCameraRight_decorators,{kind:"field",name:"shado\ +wCameraRight",static:!1,private:!1,access:{has:obj=>"shadowCameraRight"in obj,get:obj=>obj. +shadowCameraRight,set:(obj,value)=>{obj.shadowCameraRight=value}},metadata:_metadata}, +_shadowCameraRight_initializers,_instanceExtraInitializers),__esDecorate54(null, +null,_shadowCameraBottom_decorators,{kind:"field",name:"shadowCameraBottom",static:!1, +private:!1,access:{has:obj=>"shadowCameraBottom"in obj,get:obj=>obj.shadowCameraBottom, +set:(obj,value)=>{obj.shadowCameraBottom=value}},metadata:_metadata},_shadowCameraBottom_initializers, +_instanceExtraInitializers),__esDecorate54(null,null,_shadowCameraLeft_decorators, +{kind:"field",name:"shadowCameraLeft",static:!1,private:!1,access:{has:obj=>"sha\ +dowCameraLeft"in obj,get:obj=>obj.shadowCameraLeft,set:(obj,value)=>{obj.shadowCameraLeft= +value}},metadata:_metadata},_shadowCameraLeft_initializers,_instanceExtraInitializers), +__esDecorate54(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),DirectionalLight4= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers54( +_classThis,_classExtraInitializers)}intensity=(__runInitializers54(this,_instanceExtraInitializers), +__runInitializers54(this,_intensity_initializers,1));shadowCameraTop=__runInitializers54( +this,_shadowCameraTop_initializers,1e3);shadowCameraRight=__runInitializers54(this, +_shadowCameraRight_initializers,1e3);shadowCameraBottom=__runInitializers54(this, +_shadowCameraBottom_initializers,-1e3);shadowCameraLeft=__runInitializers54(this, +_shadowCameraLeft_initializers,-1e3);connectedCallback(){super.connectedCallback(), +this.three.castShadow=!0,this.createEffect(()=>{let shadow=this.three.shadow;shadow. +camera.top=this.shadowCameraTop,shadow.camera.right=this.shadowCameraRight,shadow. +camera.bottom=this.shadowCameraBottom,shadow.camera.left=this.shadowCameraLeft,shadow. +needsUpdate=!0,this.needsUpdate()}),this.createEffect(()=>{if(!this.debug||!this. +scene)return;let lightHelper=new DirectionalLightHelper(this.three,this.shadowCameraTop- +this.shadowCameraBottom);this.scene.three.add(lightHelper);let camHelper=new CameraHelper( +this.three.shadow.camera);this.scene.three.add(camHelper);let task=Motor.addRenderTask( +()=>{lightHelper.update(),camHelper.update(),this.scene.needsUpdate()});onCleanup( +()=>{Motor.removeRenderTask(task),lightHelper.dispose(),this.scene.three.remove( +lightHelper),camHelper.dispose(),this.scene.three.remove(camHelper)})})}makeThreeObject3d(){ +return new DirectionalLight2}};return DirectionalLight4=_classThis})();var __esDecorate55=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers55=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-point-light", +autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=LightWithShadow, +_instanceExtraInitializers=[],_intensity_decorators,_intensity_initializers=[],_shadowCameraFov_decorators, +_shadowCameraFov_initializers=[],_distance_decorators,_distance_initializers=[], +_decay_decorators,_decay_initializers=[],_get_power_decorators;var PointLight4=class extends _classSuper{static{ +__name(this,"PointLight")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +_intensity_decorators=[numberAttribute],_shadowCameraFov_decorators=[numberAttribute], +_distance_decorators=[numberAttribute],_decay_decorators=[numberAttribute],_get_power_decorators= +[numberAttribute],__esDecorate55(this,null,_get_power_decorators,{kind:"getter", +name:"power",static:!1,private:!1,access:{has:obj=>"power"in obj,get:obj=>obj.power}, +metadata:_metadata},null,_instanceExtraInitializers),__esDecorate55(null,null,_intensity_decorators, +{kind:"field",name:"intensity",static:!1,private:!1,access:{has:obj=>"intensity"in +obj,get:obj=>obj.intensity,set:(obj,value)=>{obj.intensity=value}},metadata:_metadata}, +_intensity_initializers,_instanceExtraInitializers),__esDecorate55(null,null,_shadowCameraFov_decorators, +{kind:"field",name:"shadowCameraFov",static:!1,private:!1,access:{has:obj=>"shad\ +owCameraFov"in obj,get:obj=>obj.shadowCameraFov,set:(obj,value)=>{obj.shadowCameraFov= +value}},metadata:_metadata},_shadowCameraFov_initializers,_instanceExtraInitializers), +__esDecorate55(null,null,_distance_decorators,{kind:"field",name:"distance",static:!1, +private:!1,access:{has:obj=>"distance"in obj,get:obj=>obj.distance,set:(obj,value)=>{ +obj.distance=value}},metadata:_metadata},_distance_initializers,_instanceExtraInitializers), +__esDecorate55(null,null,_decay_decorators,{kind:"field",name:"decay",static:!1, +private:!1,access:{has:obj=>"decay"in obj,get:obj=>obj.decay,set:(obj,value)=>{obj. +decay=value}},metadata:_metadata},_decay_initializers,_instanceExtraInitializers), +__esDecorate55(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),PointLight4= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers55( +_classThis,_classExtraInitializers)}intensity=(__runInitializers55(this,_instanceExtraInitializers), +__runInitializers55(this,_intensity_initializers,1));shadowCameraFov=__runInitializers55( +this,_shadowCameraFov_initializers,90);distance=__runInitializers55(this,_distance_initializers, +0);decay=__runInitializers55(this,_decay_initializers,1);get power(){return this. +intensity*4*Math.PI}set power(power){this.intensity=power/(4*Math.PI)}connectedCallback(){ +super.connectedCallback(),this.createEffect(()=>{let light=this.three;light.distance= +this.distance,light.decay=this.decay,this.needsUpdate()}),this.createEffect(()=>{ +if(!this.debug||!this.scene)return;let helper=new PointLightHelper(this.three,this. +calculatedSize.x||100);this.scene.three.add(helper);let task=Motor.addRenderTask( +()=>helper.update());onCleanup(()=>{helper.dispose(),this.scene.three.remove(helper), +Motor.removeRenderTask(task)})})}makeThreeObject3d(){return new PointLight2}};return PointLight4= +_classThis})();var __esDecorate56=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers56=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-spot-light",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=PointLight3,_instanceExtraInitializers=[], +_angle_decorators,_angle_initializers=[],_penumbra_decorators,_penumbra_initializers=[], +_get_target_decorators;var SpotLight4=class extends _classSuper{static{__name(this, +"SpotLight")}static{_classThis=this}static{let _metadata=typeof Symbol=="functio\ +n"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;_angle_decorators= +[numberAttribute],_penumbra_decorators=[numberAttribute],_get_target_decorators= +[stringAttribute],__esDecorate56(this,null,_get_target_decorators,{kind:"getter", +name:"target",static:!1,private:!1,access:{has:obj=>"target"in obj,get:obj=>obj. +target},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate56(null, +null,_angle_decorators,{kind:"field",name:"angle",static:!1,private:!1,access:{has:obj=>"\ +angle"in obj,get:obj=>obj.angle,set:(obj,value)=>{obj.angle=value}},metadata:_metadata}, +_angle_initializers,_instanceExtraInitializers),__esDecorate56(null,null,_penumbra_decorators, +{kind:"field",name:"penumbra",static:!1,private:!1,access:{has:obj=>"penumbra"in +obj,get:obj=>obj.penumbra,set:(obj,value)=>{obj.penumbra=value}},metadata:_metadata}, +_penumbra_initializers,_instanceExtraInitializers),__esDecorate56(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),SpotLight4=_classThis=_classDescriptor.value,_metadata&& +Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers56(_classThis,_classExtraInitializers)}angle=(__runInitializers56( +this,_instanceExtraInitializers),__runInitializers56(this,_angle_initializers,60));penumbra=__runInitializers56( +this,_penumbra_initializers,1);#target=[];#rawTarget="";#observer=null;get target(){ +return this.#target[0]??null}set target(value){this.#rawTarget=value;let array=[]; +if(typeof value=="string")array.push(value.trim());else if(Array.isArray(value)) +array=value;else if(typeof value=="object")value&&array.push(value);else throw new TypeError( +"Invalid value for target");this.#target=[];for(let v of array){if(typeof v!="st\ +ring"){v instanceof Element3D&&v.scene&&this.#target.push(v);continue}else if(!v) +continue;let root=this.getRootNode();for(;root;){let els=root.querySelectorAll(v); +for(let i2=0,l=els.length;i2{if(!(this.scene&&this.debug))return; +let scene2=this.scene;this.#helper=new SpotLightHelper(this.three),scene2.three. +add(this.#helper),this.#camHelper=new CameraHelper(this.three.shadow.camera),scene2. +three.add(this.#camHelper),this.needsUpdate(),onCleanup(()=>{this.#helper.dispose(), +scene2.three.remove(this.#helper),this.#helper=null,this.#camHelper.dispose(),scene2. +three.remove(this.#camHelper),this.#camHelper=null})}),this.createEffect(()=>{let light=this. +three;light.angle=toRadians(this.angle),light.penumbra=this.penumbra,this.#helper?. +update(),this.needsUpdate()}),this.createEffect(()=>{this.scene&&(this.target=this.#rawTarget, +this.#observer=new MutationObserver(()=>{this.target=this.#rawTarget}),this.#observer. +observe(this.getRootNode(),{childList:!0,subtree:!0}),createEffect(()=>{let target=this. +target;target?this.three.target=target.three:this.three.target=new Object3D,this. +needsUpdate()}),onCleanup(()=>{this.#observer?.disconnect(),this.#observer=null}))})}makeThreeObject3d(){ +return new SpotLight2}};return SpotLight4=_classThis})();var __esDecorate57=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers57=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-box",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Mesh2;var Box2=class extends _classSuper{static{ +__name(this,"Box")}static{_classThis=this}static{let _metadata=typeof Symbol=="f\ +unction"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate57(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Box2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers57( +_classThis,_classExtraInitializers)}initialBehaviors={geometry:"box",material:"p\ +hysical"}};return Box2=_classThis})();var __esDecorate58=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers58=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-mixed-plane", +autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Mesh2; +var MixedPlane2=class extends _classSuper{static{__name(this,"MixedPlane")}static{ +_classThis=this}static{let _metadata=typeof Symbol=="function"&&Symbol.metadata? +Object.create(_classSuper[Symbol.metadata]??null):void 0;__esDecorate58(null,_classDescriptor= +{value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata}, +null,_classExtraInitializers),MixedPlane2=_classThis=_classDescriptor.value,_metadata&& +Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0, +writable:!0,value:_metadata}),__runInitializers58(_classThis,_classExtraInitializers)}initialBehaviors={ +geometry:"mixedplane",material:"mixedplane"};get isMixedPlane(){return!0}};return MixedPlane2= +_classThis})();var __esDecorate59=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers59=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-plane",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Mesh2;var Plane4=class extends _classSuper{static{ +__name(this,"Plane")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate59(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Plane4= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers59( +_classThis,_classExtraInitializers)}initialBehaviors={geometry:"plane",material:"\ +physical"}};return Plane4=_classThis})();var __esDecorate60=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers60=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-rounded\ +-rectangle",autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=Mesh2;var RoundedRectangle2=class extends _classSuper{static{__name( +this,"RoundedRectangle")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate60(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),RoundedRectangle2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers60( +_classThis,_classExtraInitializers)}initialBehaviors={geometry:"rounded-rectangl\ +e",material:"physical"}};return RoundedRectangle2=_classThis})();var __esDecorate61=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers61=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-shape",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Mesh2;var Shape3=class extends _classSuper{static{ +__name(this,"Shape")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate61(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Shape3= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers61( +_classThis,_classExtraInitializers)}initialBehaviors={geometry:"shape",material:"\ +physical"}};return Shape3=_classThis})();var __esDecorate62=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers62=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-sphere",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Mesh2;var Sphere4=class extends _classSuper{static{ +__name(this,"Sphere")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate62(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Sphere4= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers62( +_classThis,_classExtraInitializers)}initialBehaviors={geometry:"sphere",material:"\ +physical"}};return Sphere4=_classThis})();var __esDecorate63=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers63=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-torus",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Mesh2;var Torus2=class extends _classSuper{static{ +__name(this,"Torus")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate63(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),Torus2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers63( +_classThis,_classExtraInitializers)}initialBehaviors={geometry:"torus",material:"\ +physical"}};return Torus2=_classThis})();var __esDecorate64=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers64=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-collada-mod\ +el",autoDefineElements)],_classDescriptor,_classExtraInitializers=[],_classThis, +_classSuper=Element3D;var ColladaModel2=class extends _classSuper{static{__name( +this,"ColladaModel")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate64(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),ColladaModel2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers64( +_classThis,_classExtraInitializers)}initialBehaviors={model:"collada"}};return ColladaModel2= +_classThis})();var __esDecorate65=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers65=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-fbx-model",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D;var FbxModel2=class extends _classSuper{static{ +__name(this,"FbxModel")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate65(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),FbxModel2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers65( +_classThis,_classExtraInitializers)}initialBehaviors={model:"fbx"}};return FbxModel2= +_classThis})();var __esDecorate66=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers66=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-gltf-model",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D;var GltfModel2=class extends _classSuper{static{ +__name(this,"GltfModel")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate66(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),GltfModel2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers66( +_classThis,_classExtraInitializers)}initialBehaviors={model:"gltf"}};return GltfModel2= +_classThis})();var __esDecorate67=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers67=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-obj-model",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D;var ObjModel2=class extends _classSuper{static{ +__name(this,"ObjModel")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate67(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),ObjModel2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers67( +_classThis,_classExtraInitializers)}initialBehaviors={model:"obj"}};return ObjModel2= +_classThis})();var __esDecorate68=function(ctor2,descriptorIn,decorators,contextIn,initializers,extraInitializers){ +function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Func\ +tion expected");return f}__name(accept,"accept");for(var kind=contextIn.kind,key2=kind=== +"getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor2?contextIn. +static?ctor2:ctor2.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor( +target,contextIn.name):{}),_3,done=!1,i2=decorators.length-1;i2>=0;i2--){var context={}; +for(var p2 in contextIn)context[p2]=p2==="access"?{}:contextIn[p2];for(var p2 in contextIn. +access)context.access[p2]=contextIn.access[p2];context.addInitializer=function(f){ +if(done)throw new TypeError("Cannot add initializers after decoration has comple\ +ted");extraInitializers.push(accept(f||null))};var result=(0,decorators[i2])(kind=== +"accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key2],context);if(kind=== +"accessor"){if(result===void 0)continue;if(result===null||typeof result!="object") +throw new TypeError("Object expected");(_3=accept(result.get))&&(descriptor.get= +_3),(_3=accept(result.set))&&(descriptor.set=_3),(_3=accept(result.init))&&initializers. +unshift(_3)}else(_3=accept(result))&&(kind==="field"?initializers.unshift(_3):descriptor[key2]= +_3)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers68=function(thisArg,initializers,value){ +for(var useValue=arguments.length>2,i2=0;i2{let _classDecorators=[element("lume-3ds-model",autoDefineElements)], +_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=Element3D;var TdsModel2=class extends _classSuper{static{ +__name(this,"TdsModel")}static{_classThis=this}static{let _metadata=typeof Symbol== +"function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0; +__esDecorate68(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"\ +class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),TdsModel2= +_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol. +metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata}),__runInitializers68( +_classThis,_classExtraInitializers)}initialBehaviors={model:"3ds"}};return TdsModel2= +_classThis})();var version2="0.3.0-alpha.39";function i(t){let n=new Date().getTime()+t,e=new Date().getTime();for(;e0?O(I,--p):0,L--,c===10&&(L=1,j--),c}__name(nr,"nr");function x(){return c= +p2||Z(c)>3?"":" "}__name(or,"or");function ir(r3,e){for(;--e&& +x()&&!(c<48||c>102||c>57&&c<65||c>70&&c<97););return W(r3,F()+(e<6&&w()==32&&x()== +32))}__name(ir,"ir");function q(r3){for(;x();)switch(c){case r3:return p;case 34:case 39: +r3!==34&&r3!==39&&q(c);break;case 40:r3===41&&q(r3);break;case 92:x();break}return p} +__name(q,"q");function sr(r3,e){for(;x()&&r3+c!==47+10&&!(r3+c===42+42&&w()===47);) +;return"/*"+W(e,p-1)+"*"+z(r3===47?r3:x())}__name(sr,"sr");function fr(r3){for(;!Z( +w());)x();return W(r3,p)}__name(fr,"fr");function xr(r3){return cr(G("",null,null, +null,[""],r3=ar(r3),0,[0],r3))}__name(xr,"xr");function G(r3,e,a,n,i2,l,M,v,b){for(var C=0, +E=0,s=M,S=0,k=0,T=0,f=1,U=1,m=1,o=0,d2="",A=i2,g=l,h=n,t=d2;U;)switch(T=o,o=x()){case 40: +if(T!=108&&O(t,s-1)==58){y(t+=P(B(o),"&","&\f"),"&\f")!=-1&&(m=-1);break}case 34:case 39:case 91: +t+=B(o);break;case 9:case 10:case 13:case 32:t+=or(T);break;case 92:t+=ir(F()-1, +7);continue;case 47:switch(w()){case 42:case 47:N(hr(sr(x(),F()),e,a,b),b);break;default: +t+="/"}break;case 123*f:v[C++]=u(t)*m;case 125*f:case 59:case 0:switch(o){case 0:case 125: +U=0;case 59+E:m==-1&&(t=P(t,/\f/g,"")),k>0&&u(t)-s&&N(k>32?pr(t+";",n,a,s-1,b):pr( +P(t," ","")+";",n,a,s-2,b),b);break;case 59:t+=";";default:if(N(h=ur(t,e,a,C,E,i2, +v,d2,A=[],g=[],s,l),l),o===123)if(E===0)G(t,e,h,h,A,l,s,v,g);else switch(S===99&& +O(t,3)===110?100:S){case 100:case 108:case 109:case 115:G(r3,h,h,n&&N(ur(r3,h,h, +0,0,i2,v,d2,i2,A=[],s,g),g),i2,g,s,v,n?A:g);break;default:G(t,h,h,h,[""],g,0,v,g)}} +C=E=k=0,f=m=1,d2=t="",s=M;break;case 58:s=1+u(t),k=T;default:if(f<1){if(o==123)--f;else if(o== +125&&f++==0&&nr()==125)continue}switch(t+=z(o),o*f){case 38:m=E>0?1:(t+="\f",-1); +break;case 44:v[C++]=(u(t)-1)*m,m=1;break;case 64:w()===45&&(t+=B(x())),S=w(),E= +s=u(d2=t+=fr(F())),o++;break;case 45:T===45&&u(t)==2&&(f=0)}}return l}__name(G,"\ +G");function ur(r3,e,a,n,i2,l,M,v,b,C,E,s){for(var S=i2-1,k=i2===0?l:[""],T=rr(k), +f=0,U=0,m=0;f0?k[o]+ +" "+d2:P(d2,/&\f/g,k[o])))&&(b[m++]=A);return V(r3,e,a,i2===0?Y:v,b,C,E,s)}__name( +ur,"ur");function hr(r3,e,a,n){return V(r3,e,a,D,z(tr()),R(r3,2,-2),0,n)}__name( +hr,"hr");function pr(r3,e,a,n,i2){return V(r3,e,a,_2,R(r3,0,n),R(r3,n+1,-1),n,i2)} +__name(pr,"pr");function H(r3,e){for(var a="",n=0;n[x2,y2+1,z2]; +/*! Bundled license information: + +three/build/three.module.js: + (** + * @license + * Copyright 2010-2023 Three.js Authors + * SPDX-License-Identifier: MIT + *) + +three/examples/jsm/libs/fflate.module.js: + (*! + fflate - fast JavaScript compression/decompression + + Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE + version 0.6.9 + *) + +lume/dist/layouts/Autolayout.js: + (** + * This Source Code is licensed under the MIT license. If a copy of the + * MIT-license was not distributed with this file, You can obtain one at: + * http://opensource.org/licenses/mit-license.html. + * + * @author: Hein Rutjes (IjzerenHein) and Joe Pea (trusktr) + * @license MIT + * @copyright Gloey Apps, 2015 + * @copyright Joe Pea, 2018 + *) + +lume/dist/layouts/AutoLayoutNode.js: + (** + * This Source Code is licensed under the MIT license. If a copy of the + * MIT-license was not distributed with this file, You can obtain one at: + * http://opensource.org/licenses/mit-license.html. + * + * @author: Hein Rutjes (IjzerenHein) and Joe Pea (trusktr) + * @license MIT + * @copyright Gloey Apps, 2015 + * @copyright Joe Pea, 2018 + *) +*/ +//# sourceMappingURL=index.js.map diff --git a/docs/guide/examples/index.js.map b/docs/guide/examples/index.js.map new file mode 100644 index 0000000..ac01458 --- /dev/null +++ b/docs/guide/examples/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../node_modules/lume/src/silence-solid.ts", "../../../node_modules/solid-js/dist/solid.js", "../../../node_modules/solid-js/web/dist/web.js", "../../../node_modules/solid-js/html/dist/html.js", "../../../node_modules/classy-solid/src/createStoppableEffect.ts", "../../../node_modules/classy-solid/src/Effectful.ts", "../../../node_modules/lowclass/src/utils.ts", "../../../node_modules/lowclass/src/Class.ts", "../../../node_modules/lowclass/src/multiple.ts", "../../../node_modules/lowclass/src/native.ts", "../../../node_modules/classy-solid/src/syncSignals.ts", "../../../node_modules/classy-solid/src/signalify.ts", "../../../node_modules/classy-solid/src/decorators/signal.ts", "../../../node_modules/classy-solid/src/decorators/reactive.ts", "../../../node_modules/@lume/element/src/LumeElement.ts", "../../../node_modules/@lume/element/src/metadata-shim.ts", "../../../node_modules/@lume/element/src/_utils.ts", "../../../node_modules/@lume/element/src/attribute.ts", "../../../node_modules/@lume/element/src/element.ts", "../../../node_modules/solid-js/store/dist/store.js", "../../../node_modules/element-behaviors/src/BehaviorMap.ts", "../../../node_modules/element-behaviors/src/BehaviorRegistry.ts", "../../../node_modules/@lume/custom-attributes/src/CustomAttributeRegistry.ts", "../../../node_modules/@lume/custom-attributes/src/index.ts", "../../../node_modules/element-behaviors/src/Privates.ts", "../../../node_modules/element-behaviors/src/CancelablePromise.ts", "../../../node_modules/element-behaviors/src/HasAttribute.ts", "../../../node_modules/james-bond/src/observe.ts", "../../../node_modules/lume/src/behaviors/PropReceiver.ts", "../../../node_modules/lume/src/behaviors/Behavior.ts", "../../../node_modules/three/src/math/MathUtils.js", "../../../node_modules/three/src/math/Quaternion.js", "../../../node_modules/three/src/math/Vector3.js", "../../../node_modules/three/src/constants.js", "../../../node_modules/three/src/math/Matrix4.js", "../../../node_modules/three/src/core/EventDispatcher.js", "../../../node_modules/three/src/math/Euler.js", "../../../node_modules/three/src/core/Layers.js", "../../../node_modules/three/src/math/Matrix3.js", "../../../node_modules/three/src/core/Object3D.js", "../../../node_modules/regexr/src/index.ts", "../../../node_modules/lume/src/xyz-values/utils.ts", "../../../node_modules/lume/src/xyz-values/XYZValues.ts", "../../../node_modules/lume/src/xyz-values/XYZNumberValues.ts", "../../../node_modules/@lume/eventful/src/Eventful.ts", "../../../node_modules/lume/src/core/TreeNode.ts", "../../../node_modules/lume/src/xyz-values/XYZStringValues.ts", "../../../node_modules/lume/src/xyz-values/XYZSizeModeValues.ts", "../../../node_modules/lume/src/xyz-values/XYZNonNegativeValues.ts", "../../../node_modules/lume/src/core/Motor.ts", "../../../node_modules/lume/src/core/utils/observeChildren.ts", "../../../node_modules/lume/src/core/utils/isThisOrThat.ts", "../../../node_modules/lume/src/core/CompositionTracker.ts", "../../../node_modules/lume/src/core/Sizeable.ts", "../../../node_modules/lume/src/core/Transformable.ts", "../../../node_modules/lume/src/core/ElementOperations.ts", "../../../node_modules/lume/src/core/Object3DWithPivot.ts", "../../../node_modules/three/src/math/ColorManagement.js", "../../../node_modules/three/src/math/Color.js", "../../../node_modules/three/src/materials/Material.js", "../../../node_modules/three/src/math/Vector2.js", "../../../node_modules/three/src/materials/MeshPhongMaterial.js", "../../../node_modules/lume/src/utils/three.ts", "../../../node_modules/lume/src/renderers/CSS3DRendererNested.ts", "../../../node_modules/lume/src/utils/Settable.ts", "../../../node_modules/lume/src/core/utils/index.ts", "../../../node_modules/lume/src/core/ChildTracker.ts", "../../../node_modules/lume/src/behaviors/InitialBehaviors.ts", "../../../node_modules/lume/src/core/SharedAPI.ts", "../../../node_modules/lume/src/LumeConfig.ts", "../../../node_modules/lume/src/core/Element3D.ts", "../../../node_modules/lume/src/behaviors/RenderableBehavior.ts", "../../../node_modules/three/src/math/Box3.js", "../../../node_modules/three/src/math/Sphere.js", "../../../node_modules/three/src/math/Ray.js", "../../../node_modules/three/src/math/Triangle.js", "../../../node_modules/three/src/materials/MeshBasicMaterial.js", "../../../node_modules/three/src/core/BufferAttribute.js", "../../../node_modules/three/src/utils.js", "../../../node_modules/three/src/core/BufferGeometry.js", "../../../node_modules/three/src/objects/Mesh.js", "../../../node_modules/lume/src/meshes/Mesh.ts", "../../../node_modules/three/src/materials/PointsMaterial.js", "../../../node_modules/three/src/objects/Points.js", "../../../node_modules/lume/src/meshes/Points.ts", "../../../node_modules/three/src/core/InstancedBufferAttribute.js", "../../../node_modules/three/src/objects/InstancedMesh.js", "../../../node_modules/three/src/geometries/BoxGeometry.js", "../../../node_modules/lume/src/meshes/utils.ts", "../../../node_modules/lume/src/utils/queueMicrotaskOnceOnly.ts", "../../../node_modules/lume/src/meshes/InstancedMesh.ts", "../../../node_modules/three/src/materials/LineBasicMaterial.js", "../../../node_modules/three/src/objects/Line.js", "../../../node_modules/lume/src/meshes/Line.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/MeshBehavior.ts", "../../../node_modules/three/src/math/Plane.js", "../../../node_modules/lume/src/core/ClipPlane.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/ClipPlanesBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/GeometryOrMaterialBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/GeometryBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/BoxGeometryBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/LineGeometryBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/MixedPlaneGeometryBehavior.ts", "../../../node_modules/three/src/geometries/PlaneGeometry.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/PlaneGeometryBehavior.ts", "../../../node_modules/three/build/three.module.js", "../../../node_modules/three/examples/jsm/loaders/PLYLoader.js", "../../../node_modules/lume/src/core/Events.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/PlyGeometryBehavior.ts", "../../../node_modules/three/src/extras/core/Curve.js", "../../../node_modules/three/src/extras/curves/Curves.js", "../../../node_modules/three/src/extras/curves/EllipseCurve.js", "../../../node_modules/three/src/extras/curves/ArcCurve.js", "../../../node_modules/three/src/extras/curves/CatmullRomCurve3.js", "../../../node_modules/three/src/extras/core/Interpolations.js", "../../../node_modules/three/src/extras/curves/CubicBezierCurve.js", "../../../node_modules/three/src/extras/curves/CubicBezierCurve3.js", "../../../node_modules/three/src/extras/curves/LineCurve.js", "../../../node_modules/three/src/extras/curves/LineCurve3.js", "../../../node_modules/three/src/extras/curves/QuadraticBezierCurve.js", "../../../node_modules/three/src/extras/curves/QuadraticBezierCurve3.js", "../../../node_modules/three/src/extras/curves/SplineCurve.js", "../../../node_modules/three/src/extras/core/CurvePath.js", "../../../node_modules/three/src/extras/core/Path.js", "../../../node_modules/three/src/extras/core/Shape.js", "../../../node_modules/three/src/extras/Earcut.js", "../../../node_modules/three/src/extras/ShapeUtils.js", "../../../node_modules/three/src/geometries/ExtrudeGeometry.js", "../../../node_modules/three/src/geometries/ShapeGeometry.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/RoundedRectangleGeometryBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/utils/handleInvertedGeometry.ts", "../../../node_modules/three/src/extras/core/ShapePath.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/utils/svg.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/ShapeGeometryBehavior.ts", "../../../node_modules/three/src/geometries/SphereGeometry.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/SphereGeometryBehavior.ts", "../../../node_modules/three/src/geometries/TorusGeometry.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/geometries/TorusGeometryBehavior.ts", "../../../node_modules/three/src/loaders/Cache.js", "../../../node_modules/three/src/loaders/LoadingManager.js", "../../../node_modules/three/src/loaders/Loader.js", "../../../node_modules/three/src/loaders/ImageLoader.js", "../../../node_modules/three/src/extras/ImageUtils.js", "../../../node_modules/three/src/textures/Source.js", "../../../node_modules/three/src/textures/Texture.js", "../../../node_modules/three/src/loaders/TextureLoader.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/MaterialBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/BasicMaterialBehavior.ts", "../../../node_modules/three/src/materials/MeshLambertMaterial.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/LambertMaterialBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/LineBasicMaterialBehavior.ts", "../../../node_modules/three/src/materials/MeshStandardMaterial.js", "../../../node_modules/three/src/materials/MeshPhysicalMaterial.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/StandardMaterialBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/PhysicalMaterialBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/MixedPlaneMaterialBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/PhongMaterialBehavior.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/PointsMaterialBehavior.ts", "../../../node_modules/three/src/cameras/Camera.js", "../../../node_modules/three/src/cameras/PerspectiveCamera.js", "../../../node_modules/@lume/three-projected-material/dist/three-utils.js", "../../../node_modules/@lume/three-projected-material/dist/version.js", "../../../node_modules/@lume/three-projected-material/dist/ProjectedMaterial.js", "../../../node_modules/three/src/cameras/OrthographicCamera.js", "../../../node_modules/lume/src/textures/TextureProjector.ts", "../../../node_modules/lume/src/utils/upwardRoots.ts", "../../../node_modules/lume/src/utils/querySelectorUpward.ts", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/ProjectedMaterialBehavior.ts", "../../../node_modules/three/src/renderers/shaders/UniformsUtils.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js", "../../../node_modules/three/src/materials/ShaderMaterial.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/materials/ShaderMaterialBehavior.ts", "../../../node_modules/three/examples/jsm/loaders/TGALoader.js", "../../../node_modules/three/examples/jsm/loaders/ColladaLoader.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/models/ColladaModelBehavior.ts", "../../../node_modules/three/examples/jsm/libs/fflate.module.js", "../../../node_modules/three/examples/jsm/curves/NURBSUtils.js", "../../../node_modules/three/examples/jsm/curves/NURBSCurve.js", "../../../node_modules/three/examples/jsm/loaders/FBXLoader.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/models/FbxModelBehavior.ts", "../../../node_modules/three/src/scenes/Scene.js", "../../../node_modules/three/examples/jsm/loaders/DRACOLoader.js", "../../../node_modules/three/examples/jsm/utils/BufferGeometryUtils.js", "../../../node_modules/three/examples/jsm/loaders/GLTFLoader.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/models/GltfModelBehavior.ts", "../../../node_modules/three/examples/jsm/loaders/OBJLoader.js", "../../../node_modules/three/examples/jsm/loaders/MTLLoader.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/models/ObjModelBehavior.ts", "../../../node_modules/three/examples/jsm/loaders/TDSLoader.js", "../../../node_modules/lume/src/behaviors/mesh-behaviors/models/TdsModelBehavior.ts", "../../../node_modules/lume/src/math/clamp.ts", "../../../node_modules/lume/src/interaction/FlingRotation.ts", "../../../node_modules/lume/src/interaction/ScrollFling.ts", "../../../node_modules/lume/src/interaction/PinchFling.ts", "../../../node_modules/lume/src/cameras/CameraRig.ts", "../../../node_modules/lume/src/cameras/Camera.ts", "../../../node_modules/lume/src/cameras/PerspectiveCamera.ts", "../../../node_modules/lume/src/core/Node.ts", "../../../node_modules/three/src/scenes/Fog.js", "../../../node_modules/three/src/scenes/FogExp2.js", "../../../node_modules/three/src/math/Frustum.js", "../../../node_modules/three/src/math/Vector4.js", "../../../node_modules/three/src/renderers/webgl/WebGLAnimation.js", "../../../node_modules/three/src/renderers/webgl/WebGLAttributes.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/common.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/packing.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/background.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/cube.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/depth.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/equirect.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/linedashed.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/meshbasic.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/meshlambert.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/meshnormal.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/meshphong.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/meshphysical.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/meshtoon.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/points.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/shadow.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/sprite.glsl.js", "../../../node_modules/three/src/renderers/shaders/ShaderChunk.js", "../../../node_modules/three/src/renderers/shaders/UniformsLib.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib.js", "../../../node_modules/three/src/renderers/webgl/WebGLBackground.js", "../../../node_modules/three/src/renderers/webgl/WebGLBindingStates.js", "../../../node_modules/three/src/renderers/webgl/WebGLBufferRenderer.js", "../../../node_modules/three/src/renderers/webgl/WebGLCapabilities.js", "../../../node_modules/three/src/renderers/webgl/WebGLClipping.js", "../../../node_modules/three/src/core/RenderTarget.js", "../../../node_modules/three/src/renderers/WebGLRenderTarget.js", "../../../node_modules/three/src/cameras/CubeCamera.js", "../../../node_modules/three/src/textures/CubeTexture.js", "../../../node_modules/three/src/renderers/WebGLCubeRenderTarget.js", "../../../node_modules/three/src/renderers/webgl/WebGLCubeMaps.js", "../../../node_modules/three/src/extras/PMREMGenerator.js", "../../../node_modules/three/src/renderers/webgl/WebGLCubeUVMaps.js", "../../../node_modules/three/src/renderers/webgl/WebGLExtensions.js", "../../../node_modules/three/src/renderers/webgl/WebGLGeometries.js", "../../../node_modules/three/src/renderers/webgl/WebGLIndexedBufferRenderer.js", "../../../node_modules/three/src/renderers/webgl/WebGLInfo.js", "../../../node_modules/three/src/textures/DataArrayTexture.js", "../../../node_modules/three/src/renderers/webgl/WebGLMorphtargets.js", "../../../node_modules/three/src/renderers/webgl/WebGLObjects.js", "../../../node_modules/three/src/textures/Data3DTexture.js", "../../../node_modules/three/src/textures/DepthTexture.js", "../../../node_modules/three/src/renderers/webgl/WebGLUniforms.js", "../../../node_modules/three/src/renderers/webgl/WebGLShader.js", "../../../node_modules/three/src/renderers/webgl/WebGLProgram.js", "../../../node_modules/three/src/renderers/webgl/WebGLShaderCache.js", "../../../node_modules/three/src/renderers/webgl/WebGLPrograms.js", "../../../node_modules/three/src/renderers/webgl/WebGLProperties.js", "../../../node_modules/three/src/renderers/webgl/WebGLRenderLists.js", "../../../node_modules/three/src/renderers/webgl/WebGLLights.js", "../../../node_modules/three/src/renderers/webgl/WebGLRenderStates.js", "../../../node_modules/three/src/materials/MeshDepthMaterial.js", "../../../node_modules/three/src/materials/MeshDistanceMaterial.js", "../../../node_modules/three/src/renderers/shaders/ShaderLib/vsm.glsl.js", "../../../node_modules/three/src/renderers/webgl/WebGLShadowMap.js", "../../../node_modules/three/src/renderers/webgl/WebGLState.js", "../../../node_modules/three/src/renderers/webgl/WebGLTextures.js", "../../../node_modules/three/src/renderers/webgl/WebGLUtils.js", "../../../node_modules/three/src/cameras/ArrayCamera.js", "../../../node_modules/three/src/objects/Group.js", "../../../node_modules/three/src/renderers/webxr/WebXRController.js", "../../../node_modules/three/src/renderers/webxr/WebXRManager.js", "../../../node_modules/three/src/renderers/webgl/WebGLMaterials.js", "../../../node_modules/three/src/renderers/webgl/WebGLUniformsGroups.js", "../../../node_modules/three/src/renderers/WebGLRenderer.js", "../../../node_modules/three/src/objects/LineSegments.js", "../../../node_modules/three/src/lights/Light.js", "../../../node_modules/three/src/lights/LightShadow.js", "../../../node_modules/three/src/lights/SpotLightShadow.js", "../../../node_modules/three/src/lights/SpotLight.js", "../../../node_modules/three/src/lights/PointLightShadow.js", "../../../node_modules/three/src/lights/PointLight.js", "../../../node_modules/three/src/lights/DirectionalLightShadow.js", "../../../node_modules/three/src/lights/DirectionalLight.js", "../../../node_modules/three/src/lights/AmbientLight.js", "../../../node_modules/three/src/helpers/SpotLightHelper.js", "../../../node_modules/three/src/helpers/PointLightHelper.js", "../../../node_modules/three/src/helpers/DirectionalLightHelper.js", "../../../node_modules/three/src/helpers/CameraHelper.js", "../../../node_modules/three/src/Three.js", "../../../node_modules/three/examples/jsm/shaders/TriangleBlurShader.js", "../../../node_modules/lume/src/utils/three/texture-blur.ts", "../../../node_modules/lume/src/renderers/handle-DOM-absence.js", "../../../node_modules/three/examples/jsm/webxr/VRButton.js", "../../../node_modules/lume/src/renderers/WebglRendererThree.ts", "../../../node_modules/lume/src/renderers/Css3dRendererThree.ts", "../../../node_modules/lume/src/core/Scene.ts", "../../../node_modules/lume/src/examples/FlickeringOrb.ts", "../../../node_modules/lume/src/examples/FlickeringOrbs.ts", "../../../node_modules/lume/src/examples/LoadingIcon.ts", "../../../node_modules/@lume/autolayout/dist/Attribute.js", "../../../node_modules/@lume/autolayout/dist/Relation.js", "../../../node_modules/@lume/autolayout/dist/Priority.js", "../../../node_modules/@lume/autolayout/dist/parser/parser.js", "../../../node_modules/@lume/autolayout/dist/parser/parserExt.js", "../../../node_modules/@lume/autolayout/dist/VisualFormat.js", "../../../node_modules/@lume/kiwi/dist/maptype.js", "../../../node_modules/@lume/kiwi/dist/variable.js", "../../../node_modules/@lume/kiwi/dist/expression.js", "../../../node_modules/@lume/kiwi/dist/strength.js", "../../../node_modules/@lume/kiwi/dist/constraint.js", "../../../node_modules/@lume/kiwi/dist/solver.js", "../../../node_modules/@lume/autolayout/dist/SubView.js", "../../../node_modules/@lume/autolayout/dist/View.js", "../../../node_modules/@lume/autolayout/dist/AutoLayout.js", "../../../node_modules/lume/src/layouts/Autolayout.ts", "../../../node_modules/lume/src/layouts/AutoLayoutNode.ts", "../../../node_modules/lume/src/layouts/CubeLayout.ts", "../../../node_modules/lume/src/layouts/PushPaneLayout.ts", "../../../node_modules/lume/src/lights/Light.ts", "../../../node_modules/lume/src/lights/AmbientLight.ts", "../../../node_modules/lume/src/lights/LightWithShadow.ts", "../../../node_modules/lume/src/lights/DirectionalLight.ts", "../../../node_modules/lume/src/lights/PointLight.ts", "../../../node_modules/lume/src/lights/SpotLight.ts", "../../../node_modules/lume/src/meshes/Box.ts", "../../../node_modules/lume/src/meshes/MixedPlane.ts", "../../../node_modules/lume/src/meshes/Plane.ts", "../../../node_modules/lume/src/meshes/RoundedRectangle.ts", "../../../node_modules/lume/src/meshes/Shape.ts", "../../../node_modules/lume/src/meshes/Sphere.ts", "../../../node_modules/lume/src/meshes/Torus.ts", "../../../node_modules/lume/src/models/ColladaModel.ts", "../../../node_modules/lume/src/models/FbxModel.ts", "../../../node_modules/lume/src/models/GltfModel.ts", "../../../node_modules/lume/src/models/ObjModel.ts", "../../../node_modules/lume/src/models/TdsModel.ts", "../../../node_modules/lume/src/index.ts", "../../../src/util.ts", "../../../node_modules/stylis/src/Enum.js", "../../../node_modules/stylis/src/Utility.js", "../../../node_modules/stylis/src/Tokenizer.js", "../../../node_modules/stylis/src/Parser.js", "../../../node_modules/stylis/src/Serializer.js", "../../../src/cssProcessor/stylis.bundle.ts", "../../../src/adapter.ts", "../../../docs-src/guide/examples/index.ts"], + "sourcesContent": ["// Disable the warnings from Solid.js regarding top-level effects. We know what we're doing. :)\n\nconst warn = console.warn.bind(console)\n\nconsole.warn = (...msgs: any[]) => {\n\tif (typeof msgs[0] === 'string' && msgs[0].includes('computations created outside')) return\n\twarn(...msgs)\n}\n", "let taskIdCounter = 1,\n isCallbackScheduled = false,\n isPerformingWork = false,\n taskQueue = [],\n currentTask = null,\n shouldYieldToHost = null,\n yieldInterval = 5,\n deadline = 0,\n maxYieldInterval = 300,\n scheduleCallback = null,\n scheduledCallback = null;\nconst maxSigned31BitInt = 1073741823;\nfunction setupScheduler() {\n const channel = new MessageChannel(),\n port = channel.port2;\n scheduleCallback = () => port.postMessage(null);\n channel.port1.onmessage = () => {\n if (scheduledCallback !== null) {\n const currentTime = performance.now();\n deadline = currentTime + yieldInterval;\n const hasTimeRemaining = true;\n try {\n const hasMoreWork = scheduledCallback(hasTimeRemaining, currentTime);\n if (!hasMoreWork) {\n scheduledCallback = null;\n } else port.postMessage(null);\n } catch (error) {\n port.postMessage(null);\n throw error;\n }\n }\n };\n if (navigator && navigator.scheduling && navigator.scheduling.isInputPending) {\n const scheduling = navigator.scheduling;\n shouldYieldToHost = () => {\n const currentTime = performance.now();\n if (currentTime >= deadline) {\n if (scheduling.isInputPending()) {\n return true;\n }\n return currentTime >= maxYieldInterval;\n } else {\n return false;\n }\n };\n } else {\n shouldYieldToHost = () => performance.now() >= deadline;\n }\n}\nfunction enqueue(taskQueue, task) {\n function findIndex() {\n let m = 0;\n let n = taskQueue.length - 1;\n while (m <= n) {\n const k = n + m >> 1;\n const cmp = task.expirationTime - taskQueue[k].expirationTime;\n if (cmp > 0) m = k + 1;else if (cmp < 0) n = k - 1;else return k;\n }\n return m;\n }\n taskQueue.splice(findIndex(), 0, task);\n}\nfunction requestCallback(fn, options) {\n if (!scheduleCallback) setupScheduler();\n let startTime = performance.now(),\n timeout = maxSigned31BitInt;\n if (options && options.timeout) timeout = options.timeout;\n const newTask = {\n id: taskIdCounter++,\n fn,\n startTime,\n expirationTime: startTime + timeout\n };\n enqueue(taskQueue, newTask);\n if (!isCallbackScheduled && !isPerformingWork) {\n isCallbackScheduled = true;\n scheduledCallback = flushWork;\n scheduleCallback();\n }\n return newTask;\n}\nfunction cancelCallback(task) {\n task.fn = null;\n}\nfunction flushWork(hasTimeRemaining, initialTime) {\n isCallbackScheduled = false;\n isPerformingWork = true;\n try {\n return workLoop(hasTimeRemaining, initialTime);\n } finally {\n currentTask = null;\n isPerformingWork = false;\n }\n}\nfunction workLoop(hasTimeRemaining, initialTime) {\n let currentTime = initialTime;\n currentTask = taskQueue[0] || null;\n while (currentTask !== null) {\n if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {\n break;\n }\n const callback = currentTask.fn;\n if (callback !== null) {\n currentTask.fn = null;\n const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;\n callback(didUserCallbackTimeout);\n currentTime = performance.now();\n if (currentTask === taskQueue[0]) {\n taskQueue.shift();\n }\n } else taskQueue.shift();\n currentTask = taskQueue[0] || null;\n }\n return currentTask !== null;\n}\n\nconst sharedConfig = {\n context: undefined,\n registry: undefined\n};\nfunction setHydrateContext(context) {\n sharedConfig.context = context;\n}\nfunction nextHydrateContext() {\n return {\n ...sharedConfig.context,\n id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,\n count: 0\n };\n}\n\nconst equalFn = (a, b) => a === b;\nconst $PROXY = Symbol(\"solid-proxy\");\nconst $TRACK = Symbol(\"solid-track\");\nconst $DEVCOMP = Symbol(\"solid-dev-component\");\nconst signalOptions = {\n equals: equalFn\n};\nlet ERROR = null;\nlet runEffects = runQueue;\nconst STALE = 1;\nconst PENDING = 2;\nconst UNOWNED = {\n owned: null,\n cleanups: null,\n context: null,\n owner: null\n};\nconst NO_INIT = {};\nvar Owner = null;\nlet Transition = null;\nlet Scheduler = null;\nlet ExternalSourceConfig = null;\nlet Listener = null;\nlet Updates = null;\nlet Effects = null;\nlet ExecCount = 0;\nfunction createRoot(fn, detachedOwner) {\n const listener = Listener,\n owner = Owner,\n unowned = fn.length === 0,\n current = detachedOwner === undefined ? owner : detachedOwner,\n root = unowned ? UNOWNED : {\n owned: null,\n cleanups: null,\n context: current ? current.context : null,\n owner: current\n },\n updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));\n Owner = root;\n Listener = null;\n try {\n return runUpdates(updateFn, true);\n } finally {\n Listener = listener;\n Owner = owner;\n }\n}\nfunction createSignal(value, options) {\n options = options ? Object.assign({}, signalOptions, options) : signalOptions;\n const s = {\n value,\n observers: null,\n observerSlots: null,\n comparator: options.equals || undefined\n };\n const setter = value => {\n if (typeof value === \"function\") {\n if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);\n }\n return writeSignal(s, value);\n };\n return [readSignal.bind(s), setter];\n}\nfunction createComputed(fn, value, options) {\n const c = createComputation(fn, value, true, STALE);\n if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);\n}\nfunction createRenderEffect(fn, value, options) {\n const c = createComputation(fn, value, false, STALE);\n if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);\n}\nfunction createEffect(fn, value, options) {\n runEffects = runUserEffects;\n const c = createComputation(fn, value, false, STALE),\n s = SuspenseContext && useContext(SuspenseContext);\n if (s) c.suspense = s;\n if (!options || !options.render) c.user = true;\n Effects ? Effects.push(c) : updateComputation(c);\n}\nfunction createReaction(onInvalidate, options) {\n let fn;\n const c = createComputation(() => {\n fn ? fn() : untrack(onInvalidate);\n fn = undefined;\n }, undefined, false, 0),\n s = SuspenseContext && useContext(SuspenseContext);\n if (s) c.suspense = s;\n c.user = true;\n return tracking => {\n fn = tracking;\n updateComputation(c);\n };\n}\nfunction createMemo(fn, value, options) {\n options = options ? Object.assign({}, signalOptions, options) : signalOptions;\n const c = createComputation(fn, value, true, 0);\n c.observers = null;\n c.observerSlots = null;\n c.comparator = options.equals || undefined;\n if (Scheduler && Transition && Transition.running) {\n c.tState = STALE;\n Updates.push(c);\n } else updateComputation(c);\n return readSignal.bind(c);\n}\nfunction isPromise(v) {\n return v && typeof v === \"object\" && \"then\" in v;\n}\nfunction createResource(pSource, pFetcher, pOptions) {\n let source;\n let fetcher;\n let options;\n if (arguments.length === 2 && typeof pFetcher === \"object\" || arguments.length === 1) {\n source = true;\n fetcher = pSource;\n options = pFetcher || {};\n } else {\n source = pSource;\n fetcher = pFetcher;\n options = pOptions || {};\n }\n let pr = null,\n initP = NO_INIT,\n id = null,\n loadedUnderTransition = false,\n scheduled = false,\n resolved = (\"initialValue\" in options),\n dynamic = typeof source === \"function\" && createMemo(source);\n const contexts = new Set(),\n [value, setValue] = (options.storage || createSignal)(options.initialValue),\n [error, setError] = createSignal(undefined),\n [track, trigger] = createSignal(undefined, {\n equals: false\n }),\n [state, setState] = createSignal(resolved ? \"ready\" : \"unresolved\");\n if (sharedConfig.context) {\n id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;\n let v;\n if (options.ssrLoadFrom === \"initial\") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;\n }\n function loadEnd(p, v, error, key) {\n if (pr === p) {\n pr = null;\n key !== undefined && (resolved = true);\n if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {\n value: v\n }));\n initP = NO_INIT;\n if (Transition && p && loadedUnderTransition) {\n Transition.promises.delete(p);\n loadedUnderTransition = false;\n runUpdates(() => {\n Transition.running = true;\n completeLoad(v, error);\n }, false);\n } else completeLoad(v, error);\n }\n return v;\n }\n function completeLoad(v, err) {\n runUpdates(() => {\n if (err === undefined) setValue(() => v);\n setState(err !== undefined ? \"errored\" : resolved ? \"ready\" : \"unresolved\");\n setError(err);\n for (const c of contexts.keys()) c.decrement();\n contexts.clear();\n }, false);\n }\n function read() {\n const c = SuspenseContext && useContext(SuspenseContext),\n v = value(),\n err = error();\n if (err !== undefined && !pr) throw err;\n if (Listener && !Listener.user && c) {\n createComputed(() => {\n track();\n if (pr) {\n if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {\n c.increment();\n contexts.add(c);\n }\n }\n });\n }\n return v;\n }\n function load(refetching = true) {\n if (refetching !== false && scheduled) return;\n scheduled = false;\n const lookup = dynamic ? dynamic() : source;\n loadedUnderTransition = Transition && Transition.running;\n if (lookup == null || lookup === false) {\n loadEnd(pr, untrack(value));\n return;\n }\n if (Transition && pr) Transition.promises.delete(pr);\n const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {\n value: value(),\n refetching\n }));\n if (!isPromise(p)) {\n loadEnd(pr, p, undefined, lookup);\n return p;\n }\n pr = p;\n if (\"value\" in p) {\n if (p.status === \"success\") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, undefined, lookup);\n return p;\n }\n scheduled = true;\n queueMicrotask(() => scheduled = false);\n runUpdates(() => {\n setState(resolved ? \"refreshing\" : \"pending\");\n trigger();\n }, false);\n return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));\n }\n Object.defineProperties(read, {\n state: {\n get: () => state()\n },\n error: {\n get: () => error()\n },\n loading: {\n get() {\n const s = state();\n return s === \"pending\" || s === \"refreshing\";\n }\n },\n latest: {\n get() {\n if (!resolved) return read();\n const err = error();\n if (err && !pr) throw err;\n return value();\n }\n }\n });\n if (dynamic) createComputed(() => load(false));else load(false);\n return [read, {\n refetch: load,\n mutate: setValue\n }];\n}\nfunction createDeferred(source, options) {\n let t,\n timeout = options ? options.timeoutMs : undefined;\n const node = createComputation(() => {\n if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {\n timeout\n } : undefined);\n return source();\n }, undefined, true);\n const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);\n updateComputation(node);\n setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);\n return deferred;\n}\nfunction createSelector(source, fn = equalFn, options) {\n const subs = new Map();\n const node = createComputation(p => {\n const v = source();\n for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {\n for (const c of val.values()) {\n c.state = STALE;\n if (c.pure) Updates.push(c);else Effects.push(c);\n }\n }\n return v;\n }, undefined, true, STALE);\n updateComputation(node);\n return key => {\n const listener = Listener;\n if (listener) {\n let l;\n if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));\n onCleanup(() => {\n l.delete(listener);\n !l.size && subs.delete(key);\n });\n }\n return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);\n };\n}\nfunction batch(fn) {\n return runUpdates(fn, false);\n}\nfunction untrack(fn) {\n if (!ExternalSourceConfig && Listener === null) return fn();\n const listener = Listener;\n Listener = null;\n try {\n if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);\n return fn();\n } finally {\n Listener = listener;\n }\n}\nfunction on(deps, fn, options) {\n const isArray = Array.isArray(deps);\n let prevInput;\n let defer = options && options.defer;\n return prevValue => {\n let input;\n if (isArray) {\n input = Array(deps.length);\n for (let i = 0; i < deps.length; i++) input[i] = deps[i]();\n } else input = deps();\n if (defer) {\n defer = false;\n return undefined;\n }\n const result = untrack(() => fn(input, prevInput, prevValue));\n prevInput = input;\n return result;\n };\n}\nfunction onMount(fn) {\n createEffect(() => untrack(fn));\n}\nfunction onCleanup(fn) {\n if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);\n return fn;\n}\nfunction catchError(fn, handler) {\n ERROR || (ERROR = Symbol(\"error\"));\n Owner = createComputation(undefined, undefined, true);\n Owner.context = {\n ...Owner.context,\n [ERROR]: [handler]\n };\n if (Transition && Transition.running) Transition.sources.add(Owner);\n try {\n return fn();\n } catch (err) {\n handleError(err);\n } finally {\n Owner = Owner.owner;\n }\n}\nfunction getListener() {\n return Listener;\n}\nfunction getOwner() {\n return Owner;\n}\nfunction runWithOwner(o, fn) {\n const prev = Owner;\n const prevListener = Listener;\n Owner = o;\n Listener = null;\n try {\n return runUpdates(fn, true);\n } catch (err) {\n handleError(err);\n } finally {\n Owner = prev;\n Listener = prevListener;\n }\n}\nfunction enableScheduling(scheduler = requestCallback) {\n Scheduler = scheduler;\n}\nfunction startTransition(fn) {\n if (Transition && Transition.running) {\n fn();\n return Transition.done;\n }\n const l = Listener;\n const o = Owner;\n return Promise.resolve().then(() => {\n Listener = l;\n Owner = o;\n let t;\n if (Scheduler || SuspenseContext) {\n t = Transition || (Transition = {\n sources: new Set(),\n effects: [],\n promises: new Set(),\n disposed: new Set(),\n queue: new Set(),\n running: true\n });\n t.done || (t.done = new Promise(res => t.resolve = res));\n t.running = true;\n }\n runUpdates(fn, false);\n Listener = Owner = null;\n return t ? t.done : undefined;\n });\n}\nconst [transPending, setTransPending] = /*@__PURE__*/createSignal(false);\nfunction useTransition() {\n return [transPending, startTransition];\n}\nfunction resumeEffects(e) {\n Effects.push.apply(Effects, e);\n e.length = 0;\n}\nfunction createContext(defaultValue, options) {\n const id = Symbol(\"context\");\n return {\n id,\n Provider: createProvider(id),\n defaultValue\n };\n}\nfunction useContext(context) {\n return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;\n}\nfunction children(fn) {\n const children = createMemo(fn);\n const memo = createMemo(() => resolveChildren(children()));\n memo.toArray = () => {\n const c = memo();\n return Array.isArray(c) ? c : c != null ? [c] : [];\n };\n return memo;\n}\nlet SuspenseContext;\nfunction getSuspenseContext() {\n return SuspenseContext || (SuspenseContext = createContext());\n}\nfunction enableExternalSource(factory, untrack = fn => fn()) {\n if (ExternalSourceConfig) {\n const {\n factory: oldFactory,\n untrack: oldUntrack\n } = ExternalSourceConfig;\n ExternalSourceConfig = {\n factory: (fn, trigger) => {\n const oldSource = oldFactory(fn, trigger);\n const source = factory(x => oldSource.track(x), trigger);\n return {\n track: x => source.track(x),\n dispose() {\n source.dispose();\n oldSource.dispose();\n }\n };\n },\n untrack: fn => oldUntrack(() => untrack(fn))\n };\n } else {\n ExternalSourceConfig = {\n factory,\n untrack\n };\n }\n}\nfunction readSignal() {\n const runningTransition = Transition && Transition.running;\n if (this.sources && (runningTransition ? this.tState : this.state)) {\n if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {\n const updates = Updates;\n Updates = null;\n runUpdates(() => lookUpstream(this), false);\n Updates = updates;\n }\n }\n if (Listener) {\n const sSlot = this.observers ? this.observers.length : 0;\n if (!Listener.sources) {\n Listener.sources = [this];\n Listener.sourceSlots = [sSlot];\n } else {\n Listener.sources.push(this);\n Listener.sourceSlots.push(sSlot);\n }\n if (!this.observers) {\n this.observers = [Listener];\n this.observerSlots = [Listener.sources.length - 1];\n } else {\n this.observers.push(Listener);\n this.observerSlots.push(Listener.sources.length - 1);\n }\n }\n if (runningTransition && Transition.sources.has(this)) return this.tValue;\n return this.value;\n}\nfunction writeSignal(node, value, isComp) {\n let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;\n if (!node.comparator || !node.comparator(current, value)) {\n if (Transition) {\n const TransitionRunning = Transition.running;\n if (TransitionRunning || !isComp && Transition.sources.has(node)) {\n Transition.sources.add(node);\n node.tValue = value;\n }\n if (!TransitionRunning) node.value = value;\n } else node.value = value;\n if (node.observers && node.observers.length) {\n runUpdates(() => {\n for (let i = 0; i < node.observers.length; i += 1) {\n const o = node.observers[i];\n const TransitionRunning = Transition && Transition.running;\n if (TransitionRunning && Transition.disposed.has(o)) continue;\n if (TransitionRunning ? !o.tState : !o.state) {\n if (o.pure) Updates.push(o);else Effects.push(o);\n if (o.observers) markDownstream(o);\n }\n if (!TransitionRunning) o.state = STALE;else o.tState = STALE;\n }\n if (Updates.length > 10e5) {\n Updates = [];\n if (false) ;\n throw new Error();\n }\n }, false);\n }\n }\n return value;\n}\nfunction updateComputation(node) {\n if (!node.fn) return;\n cleanNode(node);\n const time = ExecCount;\n runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);\n if (Transition && !Transition.running && Transition.sources.has(node)) {\n queueMicrotask(() => {\n runUpdates(() => {\n Transition && (Transition.running = true);\n Listener = Owner = node;\n runComputation(node, node.tValue, time);\n Listener = Owner = null;\n }, false);\n });\n }\n}\nfunction runComputation(node, value, time) {\n let nextValue;\n const owner = Owner,\n listener = Listener;\n Listener = Owner = node;\n try {\n nextValue = node.fn(value);\n } catch (err) {\n if (node.pure) {\n if (Transition && Transition.running) {\n node.tState = STALE;\n node.tOwned && node.tOwned.forEach(cleanNode);\n node.tOwned = undefined;\n } else {\n node.state = STALE;\n node.owned && node.owned.forEach(cleanNode);\n node.owned = null;\n }\n }\n node.updatedAt = time + 1;\n return handleError(err);\n } finally {\n Listener = listener;\n Owner = owner;\n }\n if (!node.updatedAt || node.updatedAt <= time) {\n if (node.updatedAt != null && \"observers\" in node) {\n writeSignal(node, nextValue, true);\n } else if (Transition && Transition.running && node.pure) {\n Transition.sources.add(node);\n node.tValue = nextValue;\n } else node.value = nextValue;\n node.updatedAt = time;\n }\n}\nfunction createComputation(fn, init, pure, state = STALE, options) {\n const c = {\n fn,\n state: state,\n updatedAt: null,\n owned: null,\n sources: null,\n sourceSlots: null,\n cleanups: null,\n value: init,\n owner: Owner,\n context: Owner ? Owner.context : null,\n pure\n };\n if (Transition && Transition.running) {\n c.state = 0;\n c.tState = state;\n }\n if (Owner === null) ;else if (Owner !== UNOWNED) {\n if (Transition && Transition.running && Owner.pure) {\n if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);\n } else {\n if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);\n }\n }\n if (ExternalSourceConfig && c.fn) {\n const [track, trigger] = createSignal(undefined, {\n equals: false\n });\n const ordinary = ExternalSourceConfig.factory(c.fn, trigger);\n onCleanup(() => ordinary.dispose());\n const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());\n const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);\n c.fn = x => {\n track();\n return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);\n };\n }\n return c;\n}\nfunction runTop(node) {\n const runningTransition = Transition && Transition.running;\n if ((runningTransition ? node.tState : node.state) === 0) return;\n if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);\n if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);\n const ancestors = [node];\n while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {\n if (runningTransition && Transition.disposed.has(node)) return;\n if (runningTransition ? node.tState : node.state) ancestors.push(node);\n }\n for (let i = ancestors.length - 1; i >= 0; i--) {\n node = ancestors[i];\n if (runningTransition) {\n let top = node,\n prev = ancestors[i + 1];\n while ((top = top.owner) && top !== prev) {\n if (Transition.disposed.has(top)) return;\n }\n }\n if ((runningTransition ? node.tState : node.state) === STALE) {\n updateComputation(node);\n } else if ((runningTransition ? node.tState : node.state) === PENDING) {\n const updates = Updates;\n Updates = null;\n runUpdates(() => lookUpstream(node, ancestors[0]), false);\n Updates = updates;\n }\n }\n}\nfunction runUpdates(fn, init) {\n if (Updates) return fn();\n let wait = false;\n if (!init) Updates = [];\n if (Effects) wait = true;else Effects = [];\n ExecCount++;\n try {\n const res = fn();\n completeUpdates(wait);\n return res;\n } catch (err) {\n if (!wait) Effects = null;\n Updates = null;\n handleError(err);\n }\n}\nfunction completeUpdates(wait) {\n if (Updates) {\n if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);\n Updates = null;\n }\n if (wait) return;\n let res;\n if (Transition) {\n if (!Transition.promises.size && !Transition.queue.size) {\n const sources = Transition.sources;\n const disposed = Transition.disposed;\n Effects.push.apply(Effects, Transition.effects);\n res = Transition.resolve;\n for (const e of Effects) {\n \"tState\" in e && (e.state = e.tState);\n delete e.tState;\n }\n Transition = null;\n runUpdates(() => {\n for (const d of disposed) cleanNode(d);\n for (const v of sources) {\n v.value = v.tValue;\n if (v.owned) {\n for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);\n }\n if (v.tOwned) v.owned = v.tOwned;\n delete v.tValue;\n delete v.tOwned;\n v.tState = 0;\n }\n setTransPending(false);\n }, false);\n } else if (Transition.running) {\n Transition.running = false;\n Transition.effects.push.apply(Transition.effects, Effects);\n Effects = null;\n setTransPending(true);\n return;\n }\n }\n const e = Effects;\n Effects = null;\n if (e.length) runUpdates(() => runEffects(e), false);\n if (res) res();\n}\nfunction runQueue(queue) {\n for (let i = 0; i < queue.length; i++) runTop(queue[i]);\n}\nfunction scheduleQueue(queue) {\n for (let i = 0; i < queue.length; i++) {\n const item = queue[i];\n const tasks = Transition.queue;\n if (!tasks.has(item)) {\n tasks.add(item);\n Scheduler(() => {\n tasks.delete(item);\n runUpdates(() => {\n Transition.running = true;\n runTop(item);\n }, false);\n Transition && (Transition.running = false);\n });\n }\n }\n}\nfunction runUserEffects(queue) {\n let i,\n userLength = 0;\n for (i = 0; i < queue.length; i++) {\n const e = queue[i];\n if (!e.user) runTop(e);else queue[userLength++] = e;\n }\n if (sharedConfig.context) {\n if (sharedConfig.count) {\n sharedConfig.effects || (sharedConfig.effects = []);\n sharedConfig.effects.push(...queue.slice(0, userLength));\n return;\n } else if (sharedConfig.effects) {\n queue = [...sharedConfig.effects, ...queue];\n userLength += sharedConfig.effects.length;\n delete sharedConfig.effects;\n }\n setHydrateContext();\n }\n for (i = 0; i < userLength; i++) runTop(queue[i]);\n}\nfunction lookUpstream(node, ignore) {\n const runningTransition = Transition && Transition.running;\n if (runningTransition) node.tState = 0;else node.state = 0;\n for (let i = 0; i < node.sources.length; i += 1) {\n const source = node.sources[i];\n if (source.sources) {\n const state = runningTransition ? source.tState : source.state;\n if (state === STALE) {\n if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);\n } else if (state === PENDING) lookUpstream(source, ignore);\n }\n }\n}\nfunction markDownstream(node) {\n const runningTransition = Transition && Transition.running;\n for (let i = 0; i < node.observers.length; i += 1) {\n const o = node.observers[i];\n if (runningTransition ? !o.tState : !o.state) {\n if (runningTransition) o.tState = PENDING;else o.state = PENDING;\n if (o.pure) Updates.push(o);else Effects.push(o);\n o.observers && markDownstream(o);\n }\n }\n}\nfunction cleanNode(node) {\n let i;\n if (node.sources) {\n while (node.sources.length) {\n const source = node.sources.pop(),\n index = node.sourceSlots.pop(),\n obs = source.observers;\n if (obs && obs.length) {\n const n = obs.pop(),\n s = source.observerSlots.pop();\n if (index < obs.length) {\n n.sourceSlots[s] = index;\n obs[index] = n;\n source.observerSlots[index] = s;\n }\n }\n }\n }\n if (Transition && Transition.running && node.pure) {\n if (node.tOwned) {\n for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);\n delete node.tOwned;\n }\n reset(node, true);\n } else if (node.owned) {\n for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);\n node.owned = null;\n }\n if (node.cleanups) {\n for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();\n node.cleanups = null;\n }\n if (Transition && Transition.running) node.tState = 0;else node.state = 0;\n}\nfunction reset(node, top) {\n if (!top) {\n node.tState = 0;\n Transition.disposed.add(node);\n }\n if (node.owned) {\n for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);\n }\n}\nfunction castError(err) {\n if (err instanceof Error) return err;\n return new Error(typeof err === \"string\" ? err : \"Unknown error\", {\n cause: err\n });\n}\nfunction runErrors(err, fns, owner) {\n try {\n for (const f of fns) f(err);\n } catch (e) {\n handleError(e, owner && owner.owner || null);\n }\n}\nfunction handleError(err, owner = Owner) {\n const fns = ERROR && owner && owner.context && owner.context[ERROR];\n const error = castError(err);\n if (!fns) throw error;\n if (Effects) Effects.push({\n fn() {\n runErrors(error, fns, owner);\n },\n state: STALE\n });else runErrors(error, fns, owner);\n}\nfunction resolveChildren(children) {\n if (typeof children === \"function\" && !children.length) return resolveChildren(children());\n if (Array.isArray(children)) {\n const results = [];\n for (let i = 0; i < children.length; i++) {\n const result = resolveChildren(children[i]);\n Array.isArray(result) ? results.push.apply(results, result) : results.push(result);\n }\n return results;\n }\n return children;\n}\nfunction createProvider(id, options) {\n return function provider(props) {\n let res;\n createRenderEffect(() => res = untrack(() => {\n Owner.context = {\n ...Owner.context,\n [id]: props.value\n };\n return children(() => props.children);\n }), undefined);\n return res;\n };\n}\nfunction onError(fn) {\n ERROR || (ERROR = Symbol(\"error\"));\n if (Owner === null) ;else if (Owner.context === null || !Owner.context[ERROR]) {\n Owner.context = {\n ...Owner.context,\n [ERROR]: [fn]\n };\n mutateContext(Owner, ERROR, [fn]);\n } else Owner.context[ERROR].push(fn);\n}\nfunction mutateContext(o, key, value) {\n if (o.owned) {\n for (let i = 0; i < o.owned.length; i++) {\n if (o.owned[i].context === o.context) mutateContext(o.owned[i], key, value);\n if (!o.owned[i].context) {\n o.owned[i].context = o.context;\n mutateContext(o.owned[i], key, value);\n } else if (!o.owned[i].context[key]) {\n o.owned[i].context[key] = value;\n mutateContext(o.owned[i], key, value);\n }\n }\n }\n}\n\nfunction observable(input) {\n return {\n subscribe(observer) {\n if (!(observer instanceof Object) || observer == null) {\n throw new TypeError(\"Expected the observer to be an object.\");\n }\n const handler = typeof observer === \"function\" ? observer : observer.next && observer.next.bind(observer);\n if (!handler) {\n return {\n unsubscribe() {}\n };\n }\n const dispose = createRoot(disposer => {\n createEffect(() => {\n const v = input();\n untrack(() => handler(v));\n });\n return disposer;\n });\n if (getOwner()) onCleanup(dispose);\n return {\n unsubscribe() {\n dispose();\n }\n };\n },\n [Symbol.observable || \"@@observable\"]() {\n return this;\n }\n };\n}\nfunction from(producer) {\n const [s, set] = createSignal(undefined, {\n equals: false\n });\n if (\"subscribe\" in producer) {\n const unsub = producer.subscribe(v => set(() => v));\n onCleanup(() => \"unsubscribe\" in unsub ? unsub.unsubscribe() : unsub());\n } else {\n const clean = producer(set);\n onCleanup(clean);\n }\n return s;\n}\n\nconst FALLBACK = Symbol(\"fallback\");\nfunction dispose(d) {\n for (let i = 0; i < d.length; i++) d[i]();\n}\nfunction mapArray(list, mapFn, options = {}) {\n let items = [],\n mapped = [],\n disposers = [],\n len = 0,\n indexes = mapFn.length > 1 ? [] : null;\n onCleanup(() => dispose(disposers));\n return () => {\n let newItems = list() || [],\n i,\n j;\n newItems[$TRACK];\n return untrack(() => {\n let newLen = newItems.length,\n newIndices,\n newIndicesNext,\n temp,\n tempdisposers,\n tempIndexes,\n start,\n end,\n newEnd,\n item;\n if (newLen === 0) {\n if (len !== 0) {\n dispose(disposers);\n disposers = [];\n items = [];\n mapped = [];\n len = 0;\n indexes && (indexes = []);\n }\n if (options.fallback) {\n items = [FALLBACK];\n mapped[0] = createRoot(disposer => {\n disposers[0] = disposer;\n return options.fallback();\n });\n len = 1;\n }\n }\n else if (len === 0) {\n mapped = new Array(newLen);\n for (j = 0; j < newLen; j++) {\n items[j] = newItems[j];\n mapped[j] = createRoot(mapper);\n }\n len = newLen;\n } else {\n temp = new Array(newLen);\n tempdisposers = new Array(newLen);\n indexes && (tempIndexes = new Array(newLen));\n for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);\n for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {\n temp[newEnd] = mapped[end];\n tempdisposers[newEnd] = disposers[end];\n indexes && (tempIndexes[newEnd] = indexes[end]);\n }\n newIndices = new Map();\n newIndicesNext = new Array(newEnd + 1);\n for (j = newEnd; j >= start; j--) {\n item = newItems[j];\n i = newIndices.get(item);\n newIndicesNext[j] = i === undefined ? -1 : i;\n newIndices.set(item, j);\n }\n for (i = start; i <= end; i++) {\n item = items[i];\n j = newIndices.get(item);\n if (j !== undefined && j !== -1) {\n temp[j] = mapped[i];\n tempdisposers[j] = disposers[i];\n indexes && (tempIndexes[j] = indexes[i]);\n j = newIndicesNext[j];\n newIndices.set(item, j);\n } else disposers[i]();\n }\n for (j = start; j < newLen; j++) {\n if (j in temp) {\n mapped[j] = temp[j];\n disposers[j] = tempdisposers[j];\n if (indexes) {\n indexes[j] = tempIndexes[j];\n indexes[j](j);\n }\n } else mapped[j] = createRoot(mapper);\n }\n mapped = mapped.slice(0, len = newLen);\n items = newItems.slice(0);\n }\n return mapped;\n });\n function mapper(disposer) {\n disposers[j] = disposer;\n if (indexes) {\n const [s, set] = createSignal(j);\n indexes[j] = set;\n return mapFn(newItems[j], s);\n }\n return mapFn(newItems[j]);\n }\n };\n}\nfunction indexArray(list, mapFn, options = {}) {\n let items = [],\n mapped = [],\n disposers = [],\n signals = [],\n len = 0,\n i;\n onCleanup(() => dispose(disposers));\n return () => {\n const newItems = list() || [];\n newItems[$TRACK];\n return untrack(() => {\n if (newItems.length === 0) {\n if (len !== 0) {\n dispose(disposers);\n disposers = [];\n items = [];\n mapped = [];\n len = 0;\n signals = [];\n }\n if (options.fallback) {\n items = [FALLBACK];\n mapped[0] = createRoot(disposer => {\n disposers[0] = disposer;\n return options.fallback();\n });\n len = 1;\n }\n return mapped;\n }\n if (items[0] === FALLBACK) {\n disposers[0]();\n disposers = [];\n items = [];\n mapped = [];\n len = 0;\n }\n for (i = 0; i < newItems.length; i++) {\n if (i < items.length && items[i] !== newItems[i]) {\n signals[i](() => newItems[i]);\n } else if (i >= items.length) {\n mapped[i] = createRoot(mapper);\n }\n }\n for (; i < items.length; i++) {\n disposers[i]();\n }\n len = signals.length = disposers.length = newItems.length;\n items = newItems.slice(0);\n return mapped = mapped.slice(0, len);\n });\n function mapper(disposer) {\n disposers[i] = disposer;\n const [s, set] = createSignal(newItems[i]);\n signals[i] = set;\n return mapFn(s, i);\n }\n };\n}\n\nlet hydrationEnabled = false;\nfunction enableHydration() {\n hydrationEnabled = true;\n}\nfunction createComponent(Comp, props) {\n if (hydrationEnabled) {\n if (sharedConfig.context) {\n const c = sharedConfig.context;\n setHydrateContext(nextHydrateContext());\n const r = untrack(() => Comp(props || {}));\n setHydrateContext(c);\n return r;\n }\n }\n return untrack(() => Comp(props || {}));\n}\nfunction trueFn() {\n return true;\n}\nconst propTraps = {\n get(_, property, receiver) {\n if (property === $PROXY) return receiver;\n return _.get(property);\n },\n has(_, property) {\n if (property === $PROXY) return true;\n return _.has(property);\n },\n set: trueFn,\n deleteProperty: trueFn,\n getOwnPropertyDescriptor(_, property) {\n return {\n configurable: true,\n enumerable: true,\n get() {\n return _.get(property);\n },\n set: trueFn,\n deleteProperty: trueFn\n };\n },\n ownKeys(_) {\n return _.keys();\n }\n};\nfunction resolveSource(s) {\n return !(s = typeof s === \"function\" ? s() : s) ? {} : s;\n}\nfunction resolveSources() {\n for (let i = 0, length = this.length; i < length; ++i) {\n const v = this[i]();\n if (v !== undefined) return v;\n }\n}\nfunction mergeProps(...sources) {\n let proxy = false;\n for (let i = 0; i < sources.length; i++) {\n const s = sources[i];\n proxy = proxy || !!s && $PROXY in s;\n sources[i] = typeof s === \"function\" ? (proxy = true, createMemo(s)) : s;\n }\n if (proxy) {\n return new Proxy({\n get(property) {\n for (let i = sources.length - 1; i >= 0; i--) {\n const v = resolveSource(sources[i])[property];\n if (v !== undefined) return v;\n }\n },\n has(property) {\n for (let i = sources.length - 1; i >= 0; i--) {\n if (property in resolveSource(sources[i])) return true;\n }\n return false;\n },\n keys() {\n const keys = [];\n for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));\n return [...new Set(keys)];\n }\n }, propTraps);\n }\n const target = {};\n const sourcesMap = {};\n const defined = new Set();\n for (let i = sources.length - 1; i >= 0; i--) {\n const source = sources[i];\n if (!source) continue;\n const sourceKeys = Object.getOwnPropertyNames(source);\n for (let i = 0, length = sourceKeys.length; i < length; i++) {\n const key = sourceKeys[i];\n if (key === \"__proto__\" || key === \"constructor\") continue;\n const desc = Object.getOwnPropertyDescriptor(source, key);\n if (!defined.has(key)) {\n if (desc.get) {\n defined.add(key);\n Object.defineProperty(target, key, {\n enumerable: true,\n configurable: true,\n get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])\n });\n } else {\n if (desc.value !== undefined) defined.add(key);\n target[key] = desc.value;\n }\n } else {\n const sources = sourcesMap[key];\n if (sources) {\n if (desc.get) {\n sources.push(desc.get.bind(source));\n } else if (desc.value !== undefined) {\n sources.push(() => desc.value);\n }\n } else if (target[key] === undefined) target[key] = desc.value;\n }\n }\n }\n return target;\n}\nfunction splitProps(props, ...keys) {\n if ($PROXY in props) {\n const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);\n const res = keys.map(k => {\n return new Proxy({\n get(property) {\n return k.includes(property) ? props[property] : undefined;\n },\n has(property) {\n return k.includes(property) && property in props;\n },\n keys() {\n return k.filter(property => property in props);\n }\n }, propTraps);\n });\n res.push(new Proxy({\n get(property) {\n return blocked.has(property) ? undefined : props[property];\n },\n has(property) {\n return blocked.has(property) ? false : property in props;\n },\n keys() {\n return Object.keys(props).filter(k => !blocked.has(k));\n }\n }, propTraps));\n return res;\n }\n const otherObject = {};\n const objects = keys.map(() => ({}));\n for (const propName of Object.getOwnPropertyNames(props)) {\n const desc = Object.getOwnPropertyDescriptor(props, propName);\n const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;\n let blocked = false;\n let objectIndex = 0;\n for (const k of keys) {\n if (k.includes(propName)) {\n blocked = true;\n isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);\n }\n ++objectIndex;\n }\n if (!blocked) {\n isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);\n }\n }\n return [...objects, otherObject];\n}\nfunction lazy(fn) {\n let comp;\n let p;\n const wrap = props => {\n const ctx = sharedConfig.context;\n if (ctx) {\n const [s, set] = createSignal();\n sharedConfig.count || (sharedConfig.count = 0);\n sharedConfig.count++;\n (p || (p = fn())).then(mod => {\n setHydrateContext(ctx);\n sharedConfig.count--;\n set(() => mod.default);\n setHydrateContext();\n });\n comp = s;\n } else if (!comp) {\n const [s] = createResource(() => (p || (p = fn())).then(mod => mod.default));\n comp = s;\n }\n let Comp;\n return createMemo(() => (Comp = comp()) && untrack(() => {\n if (false) ;\n if (!ctx) return Comp(props);\n const c = sharedConfig.context;\n setHydrateContext(ctx);\n const r = Comp(props);\n setHydrateContext(c);\n return r;\n }));\n };\n wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);\n return wrap;\n}\nlet counter = 0;\nfunction createUniqueId() {\n const ctx = sharedConfig.context;\n return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;\n}\n\nconst narrowedError = name => `Stale read from <${name}>.`;\nfunction For(props) {\n const fallback = \"fallback\" in props && {\n fallback: () => props.fallback\n };\n return createMemo(mapArray(() => props.each, props.children, fallback || undefined));\n}\nfunction Index(props) {\n const fallback = \"fallback\" in props && {\n fallback: () => props.fallback\n };\n return createMemo(indexArray(() => props.each, props.children, fallback || undefined));\n}\nfunction Show(props) {\n const keyed = props.keyed;\n const condition = createMemo(() => props.when, undefined, {\n equals: (a, b) => keyed ? a === b : !a === !b\n });\n return createMemo(() => {\n const c = condition();\n if (c) {\n const child = props.children;\n const fn = typeof child === \"function\" && child.length > 0;\n return fn ? untrack(() => child(keyed ? c : () => {\n if (!untrack(condition)) throw narrowedError(\"Show\");\n return props.when;\n })) : child;\n }\n return props.fallback;\n }, undefined, undefined);\n}\nfunction Switch(props) {\n let keyed = false;\n const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];\n const conditions = children(() => props.children),\n evalConditions = createMemo(() => {\n let conds = conditions();\n if (!Array.isArray(conds)) conds = [conds];\n for (let i = 0; i < conds.length; i++) {\n const c = conds[i].when;\n if (c) {\n keyed = !!conds[i].keyed;\n return [i, c, conds[i]];\n }\n }\n return [-1];\n }, undefined, {\n equals\n });\n return createMemo(() => {\n const [index, when, cond] = evalConditions();\n if (index < 0) return props.fallback;\n const c = cond.children;\n const fn = typeof c === \"function\" && c.length > 0;\n return fn ? untrack(() => c(keyed ? when : () => {\n if (untrack(evalConditions)[0] !== index) throw narrowedError(\"Match\");\n return cond.when;\n })) : c;\n }, undefined, undefined);\n}\nfunction Match(props) {\n return props;\n}\nlet Errors;\nfunction resetErrorBoundaries() {\n Errors && [...Errors].forEach(fn => fn());\n}\nfunction ErrorBoundary(props) {\n let err;\n if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);\n const [errored, setErrored] = createSignal(err, undefined);\n Errors || (Errors = new Set());\n Errors.add(setErrored);\n onCleanup(() => Errors.delete(setErrored));\n return createMemo(() => {\n let e;\n if (e = errored()) {\n const f = props.fallback;\n return typeof f === \"function\" && f.length ? untrack(() => f(e, () => setErrored())) : f;\n }\n return catchError(() => props.children, setErrored);\n }, undefined, undefined);\n}\n\nconst suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;\nconst SuspenseListContext = createContext();\nfunction SuspenseList(props) {\n let [wrapper, setWrapper] = createSignal(() => ({\n inFallback: false\n })),\n show;\n const listContext = useContext(SuspenseListContext);\n const [registry, setRegistry] = createSignal([]);\n if (listContext) {\n show = listContext.register(createMemo(() => wrapper()().inFallback));\n }\n const resolved = createMemo(prev => {\n const reveal = props.revealOrder,\n tail = props.tail,\n {\n showContent = true,\n showFallback = true\n } = show ? show() : {},\n reg = registry(),\n reverse = reveal === \"backwards\";\n if (reveal === \"together\") {\n const all = reg.every(inFallback => !inFallback());\n const res = reg.map(() => ({\n showContent: all && showContent,\n showFallback\n }));\n res.inFallback = !all;\n return res;\n }\n let stop = false;\n let inFallback = prev.inFallback;\n const res = [];\n for (let i = 0, len = reg.length; i < len; i++) {\n const n = reverse ? len - i - 1 : i,\n s = reg[n]();\n if (!stop && !s) {\n res[n] = {\n showContent,\n showFallback\n };\n } else {\n const next = !stop;\n if (next) inFallback = true;\n res[n] = {\n showContent: next,\n showFallback: !tail || next && tail === \"collapsed\" ? showFallback : false\n };\n stop = true;\n }\n }\n if (!stop) inFallback = false;\n res.inFallback = inFallback;\n return res;\n }, {\n inFallback: false\n });\n setWrapper(() => resolved);\n return createComponent(SuspenseListContext.Provider, {\n value: {\n register: inFallback => {\n let index;\n setRegistry(registry => {\n index = registry.length;\n return [...registry, inFallback];\n });\n return createMemo(() => resolved()[index], undefined, {\n equals: suspenseListEquals\n });\n }\n },\n get children() {\n return props.children;\n }\n });\n}\nfunction Suspense(props) {\n let counter = 0,\n show,\n ctx,\n p,\n flicker,\n error;\n const [inFallback, setFallback] = createSignal(false),\n SuspenseContext = getSuspenseContext(),\n store = {\n increment: () => {\n if (++counter === 1) setFallback(true);\n },\n decrement: () => {\n if (--counter === 0) setFallback(false);\n },\n inFallback,\n effects: [],\n resolved: false\n },\n owner = getOwner();\n if (sharedConfig.context && sharedConfig.load) {\n const key = sharedConfig.context.id + sharedConfig.context.count;\n let ref = sharedConfig.load(key);\n if (ref && (typeof ref !== \"object\" || ref.status !== \"success\")) p = ref;\n if (p && p !== \"$$f\") {\n const [s, set] = createSignal(undefined, {\n equals: false\n });\n flicker = s;\n p.then(() => {\n sharedConfig.gather(key);\n setHydrateContext(ctx);\n set();\n setHydrateContext();\n }).catch(err => {\n if (err || sharedConfig.done) {\n err && (error = err);\n return set();\n }\n });\n }\n }\n const listContext = useContext(SuspenseListContext);\n if (listContext) show = listContext.register(store.inFallback);\n let dispose;\n onCleanup(() => dispose && dispose());\n return createComponent(SuspenseContext.Provider, {\n value: store,\n get children() {\n return createMemo(() => {\n if (error) throw error;\n ctx = sharedConfig.context;\n if (flicker) {\n flicker();\n return flicker = undefined;\n }\n if (ctx && p === \"$$f\") setHydrateContext();\n const rendered = createMemo(() => props.children);\n return createMemo(prev => {\n const inFallback = store.inFallback(),\n {\n showContent = true,\n showFallback = true\n } = show ? show() : {};\n if ((!inFallback || p && p !== \"$$f\") && showContent) {\n store.resolved = true;\n dispose && dispose();\n dispose = ctx = p = undefined;\n resumeEffects(store.effects);\n return rendered();\n }\n if (!showFallback) return;\n if (dispose) return prev;\n return createRoot(disposer => {\n dispose = disposer;\n if (ctx) {\n setHydrateContext({\n id: ctx.id + \"f\",\n count: 0\n });\n ctx = undefined;\n }\n return props.fallback;\n }, owner);\n });\n });\n }\n });\n}\n\nconst DEV = undefined;\n\nexport { $DEVCOMP, $PROXY, $TRACK, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, catchError, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };\n", "import { createRoot, sharedConfig, createRenderEffect, untrack, enableHydration, getOwner, createEffect, runWithOwner, createMemo, createSignal, onCleanup, splitProps } from 'solid-js';\nexport { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, mergeProps, untrack } from 'solid-js';\n\nconst booleans = [\"allowfullscreen\", \"async\", \"autofocus\", \"autoplay\", \"checked\", \"controls\", \"default\", \"disabled\", \"formnovalidate\", \"hidden\", \"indeterminate\", \"inert\", \"ismap\", \"loop\", \"multiple\", \"muted\", \"nomodule\", \"novalidate\", \"open\", \"playsinline\", \"readonly\", \"required\", \"reversed\", \"seamless\", \"selected\"];\nconst Properties = /*#__PURE__*/new Set([\"className\", \"value\", \"readOnly\", \"formNoValidate\", \"isMap\", \"noModule\", \"playsInline\", ...booleans]);\nconst ChildProperties = /*#__PURE__*/new Set([\"innerHTML\", \"textContent\", \"innerText\", \"children\"]);\nconst Aliases = /*#__PURE__*/Object.assign(Object.create(null), {\n className: \"class\",\n htmlFor: \"for\"\n});\nconst PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {\n class: \"className\",\n formnovalidate: {\n $: \"formNoValidate\",\n BUTTON: 1,\n INPUT: 1\n },\n ismap: {\n $: \"isMap\",\n IMG: 1\n },\n nomodule: {\n $: \"noModule\",\n SCRIPT: 1\n },\n playsinline: {\n $: \"playsInline\",\n VIDEO: 1\n },\n readonly: {\n $: \"readOnly\",\n INPUT: 1,\n TEXTAREA: 1\n }\n});\nfunction getPropAlias(prop, tagName) {\n const a = PropAliases[prop];\n return typeof a === \"object\" ? a[tagName] ? a[\"$\"] : undefined : a;\n}\nconst DelegatedEvents = /*#__PURE__*/new Set([\"beforeinput\", \"click\", \"dblclick\", \"contextmenu\", \"focusin\", \"focusout\", \"input\", \"keydown\", \"keyup\", \"mousedown\", \"mousemove\", \"mouseout\", \"mouseover\", \"mouseup\", \"pointerdown\", \"pointermove\", \"pointerout\", \"pointerover\", \"pointerup\", \"touchend\", \"touchmove\", \"touchstart\"]);\nconst SVGElements = /*#__PURE__*/new Set([\n\"altGlyph\", \"altGlyphDef\", \"altGlyphItem\", \"animate\", \"animateColor\", \"animateMotion\", \"animateTransform\", \"circle\", \"clipPath\", \"color-profile\", \"cursor\", \"defs\", \"desc\", \"ellipse\", \"feBlend\", \"feColorMatrix\", \"feComponentTransfer\", \"feComposite\", \"feConvolveMatrix\", \"feDiffuseLighting\", \"feDisplacementMap\", \"feDistantLight\", \"feFlood\", \"feFuncA\", \"feFuncB\", \"feFuncG\", \"feFuncR\", \"feGaussianBlur\", \"feImage\", \"feMerge\", \"feMergeNode\", \"feMorphology\", \"feOffset\", \"fePointLight\", \"feSpecularLighting\", \"feSpotLight\", \"feTile\", \"feTurbulence\", \"filter\", \"font\", \"font-face\", \"font-face-format\", \"font-face-name\", \"font-face-src\", \"font-face-uri\", \"foreignObject\", \"g\", \"glyph\", \"glyphRef\", \"hkern\", \"image\", \"line\", \"linearGradient\", \"marker\", \"mask\", \"metadata\", \"missing-glyph\", \"mpath\", \"path\", \"pattern\", \"polygon\", \"polyline\", \"radialGradient\", \"rect\",\n\"set\", \"stop\",\n\"svg\", \"switch\", \"symbol\", \"text\", \"textPath\",\n\"tref\", \"tspan\", \"use\", \"view\", \"vkern\"]);\nconst SVGNamespace = {\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\"\n};\nconst DOMElements = /*#__PURE__*/new Set([\"html\", \"base\", \"head\", \"link\", \"meta\", \"style\", \"title\", \"body\", \"address\", \"article\", \"aside\", \"footer\", \"header\", \"main\", \"nav\", \"section\", \"body\", \"blockquote\", \"dd\", \"div\", \"dl\", \"dt\", \"figcaption\", \"figure\", \"hr\", \"li\", \"ol\", \"p\", \"pre\", \"ul\", \"a\", \"abbr\", \"b\", \"bdi\", \"bdo\", \"br\", \"cite\", \"code\", \"data\", \"dfn\", \"em\", \"i\", \"kbd\", \"mark\", \"q\", \"rp\", \"rt\", \"ruby\", \"s\", \"samp\", \"small\", \"span\", \"strong\", \"sub\", \"sup\", \"time\", \"u\", \"var\", \"wbr\", \"area\", \"audio\", \"img\", \"map\", \"track\", \"video\", \"embed\", \"iframe\", \"object\", \"param\", \"picture\", \"portal\", \"source\", \"svg\", \"math\", \"canvas\", \"noscript\", \"script\", \"del\", \"ins\", \"caption\", \"col\", \"colgroup\", \"table\", \"tbody\", \"td\", \"tfoot\", \"th\", \"thead\", \"tr\", \"button\", \"datalist\", \"fieldset\", \"form\", \"input\", \"label\", \"legend\", \"meter\", \"optgroup\", \"option\", \"output\", \"progress\", \"select\", \"textarea\", \"details\", \"dialog\", \"menu\", \"summary\", \"details\", \"slot\", \"template\", \"acronym\", \"applet\", \"basefont\", \"bgsound\", \"big\", \"blink\", \"center\", \"content\", \"dir\", \"font\", \"frame\", \"frameset\", \"hgroup\", \"image\", \"keygen\", \"marquee\", \"menuitem\", \"nobr\", \"noembed\", \"noframes\", \"plaintext\", \"rb\", \"rtc\", \"shadow\", \"spacer\", \"strike\", \"tt\", \"xmp\", \"a\", \"abbr\", \"acronym\", \"address\", \"applet\", \"area\", \"article\", \"aside\", \"audio\", \"b\", \"base\", \"basefont\", \"bdi\", \"bdo\", \"bgsound\", \"big\", \"blink\", \"blockquote\", \"body\", \"br\", \"button\", \"canvas\", \"caption\", \"center\", \"cite\", \"code\", \"col\", \"colgroup\", \"content\", \"data\", \"datalist\", \"dd\", \"del\", \"details\", \"dfn\", \"dialog\", \"dir\", \"div\", \"dl\", \"dt\", \"em\", \"embed\", \"fieldset\", \"figcaption\", \"figure\", \"font\", \"footer\", \"form\", \"frame\", \"frameset\", \"head\", \"header\", \"hgroup\", \"hr\", \"html\", \"i\", \"iframe\", \"image\", \"img\", \"input\", \"ins\", \"kbd\", \"keygen\", \"label\", \"legend\", \"li\", \"link\", \"main\", \"map\", \"mark\", \"marquee\", \"menu\", \"menuitem\", \"meta\", \"meter\", \"nav\", \"nobr\", \"noembed\", \"noframes\", \"noscript\", \"object\", \"ol\", \"optgroup\", \"option\", \"output\", \"p\", \"param\", \"picture\", \"plaintext\", \"portal\", \"pre\", \"progress\", \"q\", \"rb\", \"rp\", \"rt\", \"rtc\", \"ruby\", \"s\", \"samp\", \"script\", \"section\", \"select\", \"shadow\", \"slot\", \"small\", \"source\", \"spacer\", \"span\", \"strike\", \"strong\", \"style\", \"sub\", \"summary\", \"sup\", \"table\", \"tbody\", \"td\", \"template\", \"textarea\", \"tfoot\", \"th\", \"thead\", \"time\", \"title\", \"tr\", \"track\", \"tt\", \"u\", \"ul\", \"var\", \"video\", \"wbr\", \"xmp\", \"input\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]);\n\nfunction reconcileArrays(parentNode, a, b) {\n let bLength = b.length,\n aEnd = a.length,\n bEnd = bLength,\n aStart = 0,\n bStart = 0,\n after = a[aEnd - 1].nextSibling,\n map = null;\n while (aStart < aEnd || bStart < bEnd) {\n if (a[aStart] === b[bStart]) {\n aStart++;\n bStart++;\n continue;\n }\n while (a[aEnd - 1] === b[bEnd - 1]) {\n aEnd--;\n bEnd--;\n }\n if (aEnd === aStart) {\n const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;\n while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);\n } else if (bEnd === bStart) {\n while (aStart < aEnd) {\n if (!map || !map.has(a[aStart])) a[aStart].remove();\n aStart++;\n }\n } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {\n const node = a[--aEnd].nextSibling;\n parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);\n parentNode.insertBefore(b[--bEnd], node);\n a[aEnd] = b[bEnd];\n } else {\n if (!map) {\n map = new Map();\n let i = bStart;\n while (i < bEnd) map.set(b[i], i++);\n }\n const index = map.get(a[aStart]);\n if (index != null) {\n if (bStart < index && index < bEnd) {\n let i = aStart,\n sequence = 1,\n t;\n while (++i < aEnd && i < bEnd) {\n if ((t = map.get(a[i])) == null || t !== index + sequence) break;\n sequence++;\n }\n if (sequence > index - bStart) {\n const node = a[aStart];\n while (bStart < index) parentNode.insertBefore(b[bStart++], node);\n } else parentNode.replaceChild(b[bStart++], a[aStart++]);\n } else aStart++;\n } else a[aStart++].remove();\n }\n }\n}\n\nconst $$EVENTS = \"_$DX_DELEGATE\";\nfunction render(code, element, init, options = {}) {\n let disposer;\n createRoot(dispose => {\n disposer = dispose;\n element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);\n }, options.owner);\n return () => {\n disposer();\n element.textContent = \"\";\n };\n}\nfunction template(html, isCE, isSVG) {\n let node;\n const create = () => {\n const t = document.createElement(\"template\");\n t.innerHTML = html;\n return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;\n };\n const fn = isCE ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);\n fn.cloneNode = fn;\n return fn;\n}\nfunction delegateEvents(eventNames, document = window.document) {\n const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());\n for (let i = 0, l = eventNames.length; i < l; i++) {\n const name = eventNames[i];\n if (!e.has(name)) {\n e.add(name);\n document.addEventListener(name, eventHandler);\n }\n }\n}\nfunction clearDelegatedEvents(document = window.document) {\n if (document[$$EVENTS]) {\n for (let name of document[$$EVENTS].keys()) document.removeEventListener(name, eventHandler);\n delete document[$$EVENTS];\n }\n}\nfunction setProperty(node, name, value) {\n !sharedConfig.context && (node[name] = value);\n}\nfunction setAttribute(node, name, value) {\n if (sharedConfig.context) return;\n if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);\n}\nfunction setAttributeNS(node, namespace, name, value) {\n if (sharedConfig.context) return;\n if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);\n}\nfunction className(node, value) {\n if (sharedConfig.context) return;\n if (value == null) node.removeAttribute(\"class\");else node.className = value;\n}\nfunction addEventListener(node, name, handler, delegate) {\n if (delegate) {\n if (Array.isArray(handler)) {\n node[`$$${name}`] = handler[0];\n node[`$$${name}Data`] = handler[1];\n } else node[`$$${name}`] = handler;\n } else if (Array.isArray(handler)) {\n const handlerFn = handler[0];\n node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));\n } else node.addEventListener(name, handler);\n}\nfunction classList(node, value, prev = {}) {\n const classKeys = Object.keys(value || {}),\n prevKeys = Object.keys(prev);\n let i, len;\n for (i = 0, len = prevKeys.length; i < len; i++) {\n const key = prevKeys[i];\n if (!key || key === \"undefined\" || value[key]) continue;\n toggleClassKey(node, key, false);\n delete prev[key];\n }\n for (i = 0, len = classKeys.length; i < len; i++) {\n const key = classKeys[i],\n classValue = !!value[key];\n if (!key || key === \"undefined\" || prev[key] === classValue || !classValue) continue;\n toggleClassKey(node, key, true);\n prev[key] = classValue;\n }\n return prev;\n}\nfunction style(node, value, prev) {\n if (!value) return prev ? setAttribute(node, \"style\") : value;\n const nodeStyle = node.style;\n if (typeof value === \"string\") return nodeStyle.cssText = value;\n typeof prev === \"string\" && (nodeStyle.cssText = prev = undefined);\n prev || (prev = {});\n value || (value = {});\n let v, s;\n for (s in prev) {\n value[s] == null && nodeStyle.removeProperty(s);\n delete prev[s];\n }\n for (s in value) {\n v = value[s];\n if (v !== prev[s]) {\n nodeStyle.setProperty(s, v);\n prev[s] = v;\n }\n }\n return prev;\n}\nfunction spread(node, props = {}, isSVG, skipChildren) {\n const prevProps = {};\n if (!skipChildren) {\n createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));\n }\n createRenderEffect(() => props.ref && props.ref(node));\n createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));\n return prevProps;\n}\nfunction dynamicProperty(props, key) {\n const src = props[key];\n Object.defineProperty(props, key, {\n get() {\n return src();\n },\n enumerable: true\n });\n return props;\n}\nfunction use(fn, element, arg) {\n return untrack(() => fn(element, arg));\n}\nfunction insert(parent, accessor, marker, initial) {\n if (marker !== undefined && !initial) initial = [];\n if (typeof accessor !== \"function\") return insertExpression(parent, accessor, initial, marker);\n createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);\n}\nfunction assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {\n props || (props = {});\n for (const prop in prevProps) {\n if (!(prop in props)) {\n if (prop === \"children\") continue;\n prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);\n }\n }\n for (const prop in props) {\n if (prop === \"children\") {\n if (!skipChildren) insertExpression(node, props.children);\n continue;\n }\n const value = props[prop];\n prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);\n }\n}\nfunction hydrate$1(code, element, options = {}) {\n sharedConfig.completed = globalThis._$HY.completed;\n sharedConfig.events = globalThis._$HY.events;\n sharedConfig.load = id => globalThis._$HY.r[id];\n sharedConfig.has = id => id in globalThis._$HY.r;\n sharedConfig.gather = root => gatherHydratable(element, root);\n sharedConfig.registry = new Map();\n sharedConfig.context = {\n id: options.renderId || \"\",\n count: 0\n };\n gatherHydratable(element, options.renderId);\n const dispose = render(code, element, [...element.childNodes], options);\n sharedConfig.context = null;\n return dispose;\n}\nfunction getNextElement(template) {\n let node, key;\n if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {\n return template();\n }\n if (sharedConfig.completed) sharedConfig.completed.add(node);\n sharedConfig.registry.delete(key);\n return node;\n}\nfunction getNextMatch(el, nodeName) {\n while (el && el.localName !== nodeName) el = el.nextSibling;\n return el;\n}\nfunction getNextMarker(start) {\n let end = start,\n count = 0,\n current = [];\n if (sharedConfig.context) {\n while (end) {\n if (end.nodeType === 8) {\n const v = end.nodeValue;\n if (v === \"$\") count++;else if (v === \"/\") {\n if (count === 0) return [end, current];\n count--;\n }\n }\n current.push(end);\n end = end.nextSibling;\n }\n }\n return [end, current];\n}\nfunction runHydrationEvents() {\n if (sharedConfig.events && !sharedConfig.events.queued) {\n queueMicrotask(() => {\n const {\n completed,\n events\n } = sharedConfig;\n events.queued = false;\n while (events.length) {\n const [el, e] = events[0];\n if (!completed.has(el)) return;\n eventHandler(e);\n events.shift();\n }\n });\n sharedConfig.events.queued = true;\n }\n}\nfunction toPropertyName(name) {\n return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());\n}\nfunction toggleClassKey(node, key, value) {\n const classNames = key.trim().split(/\\s+/);\n for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);\n}\nfunction assignProp(node, prop, value, prev, isSVG, skipRef) {\n let isCE, isProp, isChildProp, propAlias, forceProp;\n if (prop === \"style\") return style(node, value, prev);\n if (prop === \"classList\") return classList(node, value, prev);\n if (value === prev) return prev;\n if (prop === \"ref\") {\n if (!skipRef) value(node);\n } else if (prop.slice(0, 3) === \"on:\") {\n const e = prop.slice(3);\n prev && node.removeEventListener(e, prev);\n value && node.addEventListener(e, value);\n } else if (prop.slice(0, 10) === \"oncapture:\") {\n const e = prop.slice(10);\n prev && node.removeEventListener(e, prev, true);\n value && node.addEventListener(e, value, true);\n } else if (prop.slice(0, 2) === \"on\") {\n const name = prop.slice(2).toLowerCase();\n const delegate = DelegatedEvents.has(name);\n if (!delegate && prev) {\n const h = Array.isArray(prev) ? prev[0] : prev;\n node.removeEventListener(name, h);\n }\n if (delegate || value) {\n addEventListener(node, name, value, delegate);\n delegate && delegateEvents([name]);\n }\n } else if (prop.slice(0, 5) === \"attr:\") {\n setAttribute(node, prop.slice(5), value);\n } else if ((forceProp = prop.slice(0, 5) === \"prop:\") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes(\"-\"))) {\n if (forceProp) {\n prop = prop.slice(5);\n isProp = true;\n } else if (sharedConfig.context) return value;\n if (prop === \"class\" || prop === \"className\") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;\n } else {\n const ns = isSVG && prop.indexOf(\":\") > -1 && SVGNamespace[prop.split(\":\")[0]];\n if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, Aliases[prop] || prop, value);\n }\n return value;\n}\nfunction eventHandler(e) {\n const key = `$$${e.type}`;\n let node = e.composedPath && e.composedPath()[0] || e.target;\n if (e.target !== node) {\n Object.defineProperty(e, \"target\", {\n configurable: true,\n value: node\n });\n }\n Object.defineProperty(e, \"currentTarget\", {\n configurable: true,\n get() {\n return node || document;\n }\n });\n if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;\n while (node) {\n const handler = node[key];\n if (handler && !node.disabled) {\n const data = node[`${key}Data`];\n data !== undefined ? handler.call(node, data, e) : handler.call(node, e);\n if (e.cancelBubble) return;\n }\n node = node._$host || node.parentNode || node.host;\n }\n}\nfunction insertExpression(parent, value, current, marker, unwrapArray) {\n if (sharedConfig.context) {\n !current && (current = [...parent.childNodes]);\n let cleaned = [];\n for (let i = 0; i < current.length; i++) {\n const node = current[i];\n if (node.nodeType === 8 && node.data.slice(0, 2) === \"!$\") node.remove();else cleaned.push(node);\n }\n current = cleaned;\n }\n while (typeof current === \"function\") current = current();\n if (value === current) return current;\n const t = typeof value,\n multi = marker !== undefined;\n parent = multi && current[0] && current[0].parentNode || parent;\n if (t === \"string\" || t === \"number\") {\n if (sharedConfig.context) return current;\n if (t === \"number\") value = value.toString();\n if (multi) {\n let node = current[0];\n if (node && node.nodeType === 3) {\n node.data = value;\n } else node = document.createTextNode(value);\n current = cleanChildren(parent, current, marker, node);\n } else {\n if (current !== \"\" && typeof current === \"string\") {\n current = parent.firstChild.data = value;\n } else current = parent.textContent = value;\n }\n } else if (value == null || t === \"boolean\") {\n if (sharedConfig.context) return current;\n current = cleanChildren(parent, current, marker);\n } else if (t === \"function\") {\n createRenderEffect(() => {\n let v = value();\n while (typeof v === \"function\") v = v();\n current = insertExpression(parent, v, current, marker);\n });\n return () => current;\n } else if (Array.isArray(value)) {\n const array = [];\n const currentArray = current && Array.isArray(current);\n if (normalizeIncomingArray(array, value, current, unwrapArray)) {\n createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));\n return () => current;\n }\n if (sharedConfig.context) {\n if (!array.length) return current;\n if (marker === undefined) return [...parent.childNodes];\n let node = array[0];\n let nodes = [node];\n while ((node = node.nextSibling) !== marker) nodes.push(node);\n return current = nodes;\n }\n if (array.length === 0) {\n current = cleanChildren(parent, current, marker);\n if (multi) return current;\n } else if (currentArray) {\n if (current.length === 0) {\n appendNodes(parent, array, marker);\n } else reconcileArrays(parent, current, array);\n } else {\n current && cleanChildren(parent);\n appendNodes(parent, array);\n }\n current = array;\n } else if (value.nodeType) {\n if (sharedConfig.context && value.parentNode) return current = multi ? [value] : value;\n if (Array.isArray(current)) {\n if (multi) return current = cleanChildren(parent, current, marker, value);\n cleanChildren(parent, current, null, value);\n } else if (current == null || current === \"\" || !parent.firstChild) {\n parent.appendChild(value);\n } else parent.replaceChild(value, parent.firstChild);\n current = value;\n } else ;\n return current;\n}\nfunction normalizeIncomingArray(normalized, array, current, unwrap) {\n let dynamic = false;\n for (let i = 0, len = array.length; i < len; i++) {\n let item = array[i],\n prev = current && current[i],\n t;\n if (item == null || item === true || item === false) ; else if ((t = typeof item) === \"object\" && item.nodeType) {\n normalized.push(item);\n } else if (Array.isArray(item)) {\n dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;\n } else if (t === \"function\") {\n if (unwrap) {\n while (typeof item === \"function\") item = item();\n dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;\n } else {\n normalized.push(item);\n dynamic = true;\n }\n } else {\n const value = String(item);\n if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);else normalized.push(document.createTextNode(value));\n }\n }\n return dynamic;\n}\nfunction appendNodes(parent, array, marker = null) {\n for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);\n}\nfunction cleanChildren(parent, current, marker, replacement) {\n if (marker === undefined) return parent.textContent = \"\";\n const node = replacement || document.createTextNode(\"\");\n if (current.length) {\n let inserted = false;\n for (let i = current.length - 1; i >= 0; i--) {\n const el = current[i];\n if (node !== el) {\n const isParent = el.parentNode === parent;\n if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();\n } else inserted = true;\n }\n } else parent.insertBefore(node, marker);\n return [node];\n}\nfunction gatherHydratable(element, root) {\n const templates = element.querySelectorAll(`*[data-hk]`);\n for (let i = 0; i < templates.length; i++) {\n const node = templates[i];\n const key = node.getAttribute(\"data-hk\");\n if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);\n }\n}\nfunction getHydrationKey() {\n const hydrate = sharedConfig.context;\n return `${hydrate.id}${hydrate.count++}`;\n}\nfunction NoHydration(props) {\n return sharedConfig.context ? undefined : props.children;\n}\nfunction Hydration(props) {\n return props.children;\n}\nfunction voidFn() {}\nconst RequestContext = Symbol();\nfunction innerHTML(parent, content) {\n !sharedConfig.context && (parent.innerHTML = content);\n}\n\nfunction throwInBrowser(func) {\n const err = new Error(`${func.name} is not supported in the browser, returning undefined`);\n console.error(err);\n}\nfunction renderToString(fn, options) {\n throwInBrowser(renderToString);\n}\nfunction renderToStringAsync(fn, options) {\n throwInBrowser(renderToStringAsync);\n}\nfunction renderToStream(fn, options) {\n throwInBrowser(renderToStream);\n}\nfunction ssr(template, ...nodes) {}\nfunction ssrElement(name, props, children, needsId) {}\nfunction ssrClassList(value) {}\nfunction ssrStyle(value) {}\nfunction ssrAttribute(key, value) {}\nfunction ssrHydrationKey() {}\nfunction resolveSSRNode(node) {}\nfunction escape(html) {}\nfunction ssrSpread(props, isSVG, skipChildren) {}\n\nconst isServer = false;\nconst isDev = false;\nconst SVG_NAMESPACE = \"http://www.w3.org/2000/svg\";\nfunction createElement(tagName, isSVG = false) {\n return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);\n}\nconst hydrate = (...args) => {\n enableHydration();\n return hydrate$1(...args);\n};\nfunction Portal(props) {\n const {\n useShadow\n } = props,\n marker = document.createTextNode(\"\"),\n mount = () => props.mount || document.body,\n owner = getOwner();\n let content;\n let hydrating = !!sharedConfig.context;\n createEffect(() => {\n if (hydrating) getOwner().user = hydrating = false;\n content || (content = runWithOwner(owner, () => createMemo(() => props.children)));\n const el = mount();\n if (el instanceof HTMLHeadElement) {\n const [clean, setClean] = createSignal(false);\n const cleanup = () => setClean(true);\n createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));\n onCleanup(cleanup);\n } else {\n const container = createElement(props.isSVG ? \"g\" : \"div\", props.isSVG),\n renderRoot = useShadow && container.attachShadow ? container.attachShadow({\n mode: \"open\"\n }) : container;\n Object.defineProperty(container, \"_$host\", {\n get() {\n return marker.parentNode;\n },\n configurable: true\n });\n insert(renderRoot, content);\n el.appendChild(container);\n props.ref && props.ref(container);\n onCleanup(() => el.removeChild(container));\n }\n }, undefined, {\n render: !hydrating\n });\n return marker;\n}\nfunction Dynamic(props) {\n const [p, others] = splitProps(props, [\"component\"]);\n const cached = createMemo(() => p.component);\n return createMemo(() => {\n const component = cached();\n switch (typeof component) {\n case \"function\":\n return untrack(() => component(others));\n case \"string\":\n const isSvg = SVGElements.has(component);\n const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);\n spread(el, others, isSvg);\n return el;\n }\n });\n}\n\nexport { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getPropAlias, voidFn as getRequestEvent, hydrate, innerHTML, insert, isDev, isServer, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };\n", "import { effect, style, insert, untrack, spread, createComponent, delegateEvents, classList, mergeProps, dynamicProperty, setAttribute, setAttributeNS, addEventListener, Aliases, getPropAlias, Properties, ChildProperties, DelegatedEvents, SVGElements, SVGNamespace } from 'solid-js/web';\n\nconst tagRE = /(?:|<(?:\"[^\"]*\"['\"]*|'[^']*'['\"]*|[^'\">])+>)/g;\nconst attrRE = /(?:\\s(?[^/\\s><=]+?)(?=[\\s/>]))|(?:(?\\S+?)(?:\\s*=\\s*(?:(['\"])(?[\\s\\S]*?)\\3|(?[^\\s>]+))))/g;\nconst lookup = {\n area: true,\n base: true,\n br: true,\n col: true,\n embed: true,\n hr: true,\n img: true,\n input: true,\n keygen: true,\n link: true,\n menuitem: true,\n meta: true,\n param: true,\n source: true,\n track: true,\n wbr: true\n};\nfunction parseTag( tag) {\n const res = {\n type: 'tag',\n name: '',\n voidElement: false,\n attrs: [],\n children: []\n };\n const tagMatch = tag.match(/<\\/?([^\\s]+?)[/\\s>]/);\n if (tagMatch) {\n res.name = tagMatch[1];\n if (lookup[tagMatch[1].toLowerCase()] || tag.charAt(tag.length - 2) === '/') {\n res.voidElement = true;\n }\n if (res.name.startsWith('!--')) {\n const endIndex = tag.indexOf('-->');\n return {\n type: 'comment',\n comment: endIndex !== -1 ? tag.slice(4, endIndex) : ''\n };\n }\n }\n const reg = new RegExp(attrRE);\n for (const match of tag.matchAll(reg)) {\n if ((match[1] || match[2]).startsWith('use:')) {\n res.attrs.push({\n type: 'directive',\n name: match[1] || match[2],\n value: match[4] || match[5] || ''\n });\n } else {\n res.attrs.push({\n type: 'attr',\n name: match[1] || match[2],\n value: match[4] || match[5] || ''\n });\n }\n }\n return res;\n}\nfunction pushTextNode(list, html, start) {\n const end = html.indexOf('<', start);\n const content = html.slice(start, end === -1 ? void 0 : end);\n if (!/^\\s*$/.test(content)) {\n list.push({\n type: 'text',\n content: content\n });\n }\n}\nfunction pushCommentNode(list, tag) {\n const content = tag.replace('', '');\n if (!/^\\s*$/.test(content)) {\n list.push({\n type: 'comment',\n content: content\n });\n }\n}\nfunction parse(html) {\n const result = [];\n let current = void 0;\n let level = -1;\n const arr = [];\n const byTag = {};\n html.replace(tagRE, (tag, index) => {\n const isOpen = tag.charAt(1) !== '/';\n const isComment = tag.slice(0, 4) === '';\n }\n}\nfunction stringify(doc) {\n return doc.reduce(function (token, rootEl) {\n return token + stringifier('', rootEl);\n }, '');\n}\nconst cache = new Map();\nconst VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;\nconst spaces = \" \\\\f\\\\n\\\\r\\\\t\";\nconst almostEverything = \"[^\" + spaces + \"\\\\/>\\\"'=]+\";\nconst attrName = \"[ \" + spaces + \"]+(?:use:|\" + almostEverything + ')';\nconst tagName = \"<([A-Za-z$#]+[A-Za-z0-9:_-]*)((?:\";\nconst attrPartials = \"(?:\\\\s*=\\\\s*(?:'[^']*?'|\\\"[^\\\"]*?\\\"|\\\\([^)]*?\\\\)|<[^>]*?>|\" + almostEverything + \"))?)\";\nconst attrSeeker = new RegExp(tagName + attrName + attrPartials + \"+)([ \" + spaces + \"]*/?>)\", \"g\");\nconst findAttributes = new RegExp(\"(\" + attrName + \"\\\\s*=\\\\s*)(|['\\\"(]([\\\\w\\\\s]*[\\\\w\\\\s]*)*['\\\")])\", \"gi\");\nconst selfClosing = new RegExp(tagName + attrName + attrPartials + \"*)([ \" + spaces + \"]*/>)\", \"g\");\nconst marker = \"\";\nconst reservedNameSpaces = new Set([\"class\", \"on\", \"oncapture\", \"style\", \"use\", \"prop\", \"attr\"]);\nfunction attrReplacer($0, $1, $2, $3) {\n return \"<\" + $1 + $2.replace(findAttributes, replaceAttributes) + $3;\n}\nfunction replaceAttributes($0, $1, $2) {\n return $1.replace(//g, \"###\") + ($2[0] === '\"' || $2[0] === \"'\" ? $2.replace(//g, \"###\") : '\"###\"');\n}\nfunction fullClosing($0, $1, $2) {\n return VOID_ELEMENTS.test($1) ? $0 : \"<\" + $1 + $2 + \">\";\n}\nfunction toPropertyName(name) {\n return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());\n}\nfunction parseDirective(name, value, tag, options) {\n if (name === 'use:###' && value === '###') {\n const count = options.counter++;\n options.exprs.push(`typeof exprs[${count}] === \"function\" ? r.use(exprs[${count}], ${tag}, exprs[${options.counter++}]) : (()=>{throw new Error(\"use:### must be a function\")})()`);\n } else {\n throw new Error(`Not support syntax ${name} must be use:{function}`);\n }\n}\nfunction createHTML(r, {\n delegateEvents = true,\n functionBuilder = (...args) => new Function(...args)\n} = {}) {\n let uuid = 1;\n r.wrapProps = props => {\n const d = Object.getOwnPropertyDescriptors(props);\n for (const k in d) {\n if (typeof d[k].value === \"function\" && !d[k].value.length) r.dynamicProperty(props, k);\n }\n return props;\n };\n function createTemplate(statics, opt) {\n let i = 0,\n markup = \"\";\n for (; i < statics.length - 1; i++) {\n markup = markup + statics[i] + \"\";\n }\n markup = markup + statics[i];\n const replaceList = [[selfClosing, fullClosing], [/<()/g, \"<###\"], [/\\.\\.\\.()/g, \"###\"], [attrSeeker, attrReplacer], [/>\\n+\\s*/g, \">\"], [/\\n+\\s*\\s+/g, \"> \"]];\n markup = replaceList.reduce((acc, x) => {\n return acc.replace(x[0], x[1]);\n }, markup);\n const pars = parse(markup);\n const [html, code] = parseTemplate(pars, opt.funcBuilder),\n templates = [];\n for (let i = 0; i < html.length; i++) {\n templates.push(document.createElement(\"template\"));\n templates[i].innerHTML = html[i];\n const nomarkers = templates[i].content.querySelectorAll(\"script,style\");\n for (let j = 0; j < nomarkers.length; j++) {\n const d = nomarkers[j].firstChild?.data || \"\";\n if (d.indexOf(marker) > -1) {\n const parts = d.split(marker).reduce((memo, p, i) => {\n i && memo.push(\"\");\n memo.push(p);\n return memo;\n }, []);\n nomarkers[i].firstChild.replaceWith(...parts);\n }\n }\n }\n templates[0].create = code;\n cache.set(statics, templates);\n return templates;\n }\n function parseKeyValue(node, tag, name, value, isSVG, isCE, options) {\n let expr = value === \"###\" ? `!doNotWrap ? exprs[${options.counter}]() : exprs[${options.counter++}]` : value.split(\"###\").map((v, i) => i ? ` + (typeof exprs[${options.counter}] === \"function\" ? exprs[${options.counter}]() : exprs[${options.counter++}]) + \"${v}\"` : `\"${v}\"`).join(\"\"),\n parts,\n namespace;\n if ((parts = name.split(\":\")) && parts[1] && reservedNameSpaces.has(parts[0])) {\n name = parts[1];\n namespace = parts[0];\n }\n const isChildProp = r.ChildProperties.has(name);\n const isProp = r.Properties.has(name);\n if (name === \"style\") {\n const prev = `_$v${uuid++}`;\n options.decl.push(`${prev}={}`);\n options.exprs.push(`r.style(${tag},${expr},${prev})`);\n } else if (name === \"classList\") {\n const prev = `_$v${uuid++}`;\n options.decl.push(`${prev}={}`);\n options.exprs.push(`r.classList(${tag},${expr},${prev})`);\n } else if (namespace !== \"attr\" && (isChildProp || !isSVG && (r.getPropAlias(name, node.name.toUpperCase()) || isProp) || isCE || namespace === \"prop\")) {\n if (isCE && !isChildProp && !isProp && namespace !== \"prop\") name = toPropertyName(name);\n options.exprs.push(`${tag}.${r.getPropAlias(name, node.name.toUpperCase()) || name} = ${expr}`);\n } else {\n const ns = isSVG && name.indexOf(\":\") > -1 && r.SVGNamespace[name.split(\":\")[0]];\n if (ns) options.exprs.push(`r.setAttributeNS(${tag},\"${ns}\",\"${name}\",${expr})`);else options.exprs.push(`r.setAttribute(${tag},\"${r.Aliases[name] || name}\",${expr})`);\n }\n }\n function parseAttribute(node, tag, name, value, isSVG, isCE, options) {\n if (name.slice(0, 2) === \"on\") {\n if (!name.includes(\":\")) {\n const lc = name.slice(2).toLowerCase();\n const delegate = delegateEvents && r.DelegatedEvents.has(lc);\n options.exprs.push(`r.addEventListener(${tag},\"${lc}\",exprs[${options.counter++}],${delegate})`);\n delegate && options.delegatedEvents.add(lc);\n } else {\n let capture = name.startsWith(\"oncapture:\");\n options.exprs.push(`${tag}.addEventListener(\"${name.slice(capture ? 10 : 3)}\",exprs[${options.counter++}]${capture ? \",true\" : \"\"})`);\n }\n } else if (name === \"ref\") {\n options.exprs.push(`exprs[${options.counter++}](${tag})`);\n } else {\n const childOptions = Object.assign({}, options, {\n exprs: []\n }),\n count = options.counter;\n parseKeyValue(node, tag, name, value, isSVG, isCE, childOptions);\n options.decl.push(`_fn${count} = (${value === \"###\" ? \"doNotWrap\" : \"\"}) => {\\n${childOptions.exprs.join(\";\\n\")};\\n}`);\n if (value === \"###\") {\n options.exprs.push(`typeof exprs[${count}] === \"function\" ? r.effect(_fn${count}) : _fn${count}(true)`);\n } else {\n let check = \"\";\n for (let i = count; i < childOptions.counter; i++) {\n i !== count && (check += \" || \");\n check += `typeof exprs[${i}] === \"function\"`;\n }\n options.exprs.push(check + ` ? r.effect(_fn${count}) : _fn${count}()`);\n }\n options.counter = childOptions.counter;\n options.wrap = false;\n }\n }\n function processChildren(node, options) {\n const childOptions = Object.assign({}, options, {\n first: true,\n multi: false,\n parent: options.path\n });\n if (node.children.length > 1) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n if (child.type === \"comment\" && child.content === \"#\" || child.type === \"tag\" && child.name === \"###\") {\n childOptions.multi = true;\n break;\n }\n }\n }\n let i = 0;\n while (i < node.children.length) {\n const child = node.children[i];\n if (child.name === \"###\") {\n if (childOptions.multi) {\n node.children[i] = {\n type: \"comment\",\n content: \"#\"\n };\n i++;\n } else node.children.splice(i, 1);\n processComponent(child, childOptions);\n continue;\n }\n parseNode(child, childOptions);\n if (!childOptions.multi && child.type === \"comment\" && child.content === \"#\") node.children.splice(i, 1);else i++;\n }\n options.counter = childOptions.counter;\n options.templateId = childOptions.templateId;\n options.hasCustomElement = options.hasCustomElement || childOptions.hasCustomElement;\n }\n function processComponentProps(propGroups) {\n let result = [];\n for (const props of propGroups) {\n if (Array.isArray(props)) {\n if (!props.length) continue;\n result.push(`r.wrapProps({${props.join(\",\") || \"\"}})`);\n } else result.push(props);\n }\n return result.length > 1 ? `r.mergeProps(${result.join(\",\")})` : result[0];\n }\n function processComponent(node, options) {\n let props = [];\n const keys = Object.keys(node.attrs),\n propGroups = [props],\n componentIdentifier = options.counter++;\n for (let i = 0; i < keys.length; i++) {\n const {\n type,\n name,\n value\n } = node.attrs[i];\n if (type === 'attr') {\n if (name === \"###\") {\n propGroups.push(`exprs[${options.counter++}]`);\n propGroups.push(props = []);\n } else if (value === \"###\") {\n props.push(`${name}: exprs[${options.counter++}]`);\n } else props.push(`${name}: \"${value}\"`);\n } else if (type === 'directive') {\n const tag = `_$el${uuid++}`;\n const topDecl = !options.decl.length;\n options.decl.push(topDecl ? \"\" : `${tag} = ${options.path}.${options.first ? \"firstChild\" : \"nextSibling\"}`);\n parseDirective(name, value, tag, options);\n }\n }\n if (node.children.length === 1 && node.children[0].type === \"comment\" && node.children[0].content === \"#\") {\n props.push(`children: () => exprs[${options.counter++}]`);\n } else if (node.children.length) {\n const children = {\n type: \"fragment\",\n children: node.children\n },\n childOptions = Object.assign({}, options, {\n first: true,\n decl: [],\n exprs: [],\n parent: false\n });\n parseNode(children, childOptions);\n props.push(`children: () => { ${childOptions.exprs.join(\";\\n\")}}`);\n options.templateId = childOptions.templateId;\n options.counter = childOptions.counter;\n }\n let tag;\n if (options.multi) {\n tag = `_$el${uuid++}`;\n options.decl.push(`${tag} = ${options.path}.${options.first ? \"firstChild\" : \"nextSibling\"}`);\n }\n if (options.parent) options.exprs.push(`r.insert(${options.parent}, r.createComponent(exprs[${componentIdentifier}],${processComponentProps(propGroups)})${tag ? `, ${tag}` : \"\"})`);else options.exprs.push(`${options.fragment ? \"\" : \"return \"}r.createComponent(exprs[${componentIdentifier}],${processComponentProps(propGroups)})`);\n options.path = tag;\n options.first = false;\n }\n function parseNode(node, options) {\n if (node.type === \"fragment\") {\n const parts = [];\n node.children.forEach(child => {\n if (child.type === \"tag\") {\n if (child.name === \"###\") {\n const childOptions = Object.assign({}, options, {\n first: true,\n fragment: true,\n decl: [],\n exprs: []\n });\n processComponent(child, childOptions);\n parts.push(childOptions.exprs[0]);\n options.counter = childOptions.counter;\n options.templateId = childOptions.templateId;\n return;\n }\n options.templateId++;\n const id = uuid;\n const childOptions = Object.assign({}, options, {\n first: true,\n decl: [],\n exprs: []\n });\n options.templateNodes.push([child]);\n parseNode(child, childOptions);\n parts.push(`function() { ${childOptions.decl.join(\",\\n\") + \";\\n\" + childOptions.exprs.join(\";\\n\") + `;\\nreturn _$el${id};\\n`}}()`);\n options.counter = childOptions.counter;\n options.templateId = childOptions.templateId;\n } else if (child.type === \"text\") {\n parts.push(`\"${child.content}\"`);\n } else if (child.type === \"comment\") {\n if (child.content === \"#\") parts.push(`exprs[${options.counter++}]`);else if (child.content) {\n for (let i = 0; i < child.content.split(\"###\").length - 1; i++) {\n parts.push(`exprs[${options.counter++}]`);\n }\n }\n }\n });\n options.exprs.push(`return [${parts.join(\", \\n\")}]`);\n } else if (node.type === \"tag\") {\n const tag = `_$el${uuid++}`;\n const topDecl = !options.decl.length;\n const templateId = options.templateId;\n options.decl.push(topDecl ? \"\" : `${tag} = ${options.path}.${options.first ? \"firstChild\" : \"nextSibling\"}`);\n const isSVG = r.SVGElements.has(node.name);\n const isCE = node.name.includes(\"-\");\n options.hasCustomElement = isCE;\n if (node.attrs.some(e => e.name === \"###\")) {\n const spreadArgs = [];\n let current = \"\";\n const newAttrs = [];\n for (let i = 0; i < node.attrs.length; i++) {\n const {\n type,\n name,\n value\n } = node.attrs[i];\n if (type === 'attr') {\n if (value.includes(\"###\")) {\n let count = options.counter++;\n current += `${name}: ${name !== \"ref\" ? `typeof exprs[${count}] === \"function\" ? exprs[${count}]() : ` : \"\"}exprs[${count}],`;\n } else if (name === \"###\") {\n if (current.length) {\n spreadArgs.push(`()=>({${current}})`);\n current = \"\";\n }\n spreadArgs.push(`exprs[${options.counter++}]`);\n } else {\n newAttrs.push(node.attrs[i]);\n }\n } else if (type === 'directive') {\n parseDirective(name, value, tag, options);\n }\n }\n node.attrs = newAttrs;\n if (current.length) {\n spreadArgs.push(`()=>({${current}})`);\n }\n options.exprs.push(`r.spread(${tag},${spreadArgs.length === 1 ? `typeof ${spreadArgs[0]} === \"function\" ? r.mergeProps(${spreadArgs[0]}) : ${spreadArgs[0]}` : `r.mergeProps(${spreadArgs.join(\",\")})`},${isSVG},${!!node.children.length})`);\n } else {\n for (let i = 0; i < node.attrs.length; i++) {\n const {\n type,\n name,\n value\n } = node.attrs[i];\n if (type === 'directive') {\n parseDirective(name, value, tag, options);\n node.attrs.splice(i, 1);\n i--;\n } else if (type === \"attr\") {\n if (value.includes(\"###\")) {\n node.attrs.splice(i, 1);\n i--;\n parseAttribute(node, tag, name, value, isSVG, isCE, options);\n }\n }\n }\n }\n options.path = tag;\n options.first = false;\n processChildren(node, options);\n if (topDecl) {\n options.decl[0] = options.hasCustomElement ? `const ${tag} = r.untrack(() => document.importNode(tmpls[${templateId}].content.firstChild, true))` : `const ${tag} = tmpls[${templateId}].content.firstChild.cloneNode(true)`;\n }\n } else if (node.type === \"text\") {\n const tag = `_$el${uuid++}`;\n options.decl.push(`${tag} = ${options.path}.${options.first ? \"firstChild\" : \"nextSibling\"}`);\n options.path = tag;\n options.first = false;\n } else if (node.type === \"comment\") {\n const tag = `_$el${uuid++}`;\n options.decl.push(`${tag} = ${options.path}.${options.first ? \"firstChild\" : \"nextSibling\"}`);\n if (node.content === \"#\") {\n if (options.multi) {\n options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}], ${tag})`);\n } else options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}])`);\n }\n options.path = tag;\n options.first = false;\n }\n }\n function parseTemplate(nodes, funcBuilder) {\n const options = {\n path: \"\",\n decl: [],\n exprs: [],\n delegatedEvents: new Set(),\n counter: 0,\n first: true,\n multi: false,\n templateId: 0,\n templateNodes: []\n },\n id = uuid,\n origNodes = nodes;\n let toplevel;\n if (nodes.length > 1) {\n nodes = [{\n type: \"fragment\",\n children: nodes\n }];\n }\n if (nodes[0].name === \"###\") {\n toplevel = true;\n processComponent(nodes[0], options);\n } else parseNode(nodes[0], options);\n r.delegateEvents(Array.from(options.delegatedEvents));\n const templateNodes = [origNodes].concat(options.templateNodes);\n return [templateNodes.map(t => stringify(t)), funcBuilder(\"tmpls\", \"exprs\", \"r\", options.decl.join(\",\\n\") + \";\\n\" + options.exprs.join(\";\\n\") + (toplevel ? \"\" : `;\\nreturn _$el${id};\\n`))];\n }\n function html(statics, ...args) {\n const templates = cache.get(statics) || createTemplate(statics, {\n funcBuilder: functionBuilder\n });\n return templates[0].create(templates, args, r);\n }\n return html;\n}\n\nconst html = createHTML({\n effect,\n style,\n insert,\n untrack,\n spread,\n createComponent,\n delegateEvents,\n classList,\n mergeProps,\n dynamicProperty,\n setAttribute,\n setAttributeNS,\n addEventListener,\n Aliases,\n getPropAlias,\n Properties,\n ChildProperties,\n DelegatedEvents,\n SVGElements,\n SVGNamespace\n});\n\nexport { html as default };\n", "import {createEffect, createSignal} from 'solid-js'\n\nexport type Effect = {stop: () => void; resume: () => void}\n\n/**\n * NOTE: Experimental\n *\n * Create a stoppable effect.\n *\n * ```js\n * const effect = createStoppableEffect(() => {...})\n *\n * // ...later, stop the effect from running again.\n * effect.stop()\n * ```\n *\n * Note, this is experimental because when inside of a parent reactive context\n * that is long-lived (f.e. for life time of the app), each new effect created\n * with this and subsequently stopped will stick around and not be GC'd until\n * the parent context is cleaned up (which could be never).\n *\n * Stopped effects will currently only be GC'd freely when they are created\n * outside of a reactive context.\n */\nexport function createStoppableEffect(fn: () => void): Effect {\n\tconst [running, setRunning] = createSignal(true)\n\tcreateEffect(() => running() && fn())\n\treturn {stop: () => setRunning(false), resume: () => setRunning(true)}\n}\n", "import {type Owner, createEffect, onCleanup, createRoot, getOwner, runWithOwner} from 'solid-js'\nimport type {AnyConstructor} from 'lowclass'\nimport {createStoppableEffect, type Effect} from './createStoppableEffect.js'\n\n/**\n * @class Effectful -\n *\n * `mixin`\n *\n * Create Solid.js effects using `this.createEffect(fn)` and easily stop them\n * all by calling `this.stopEffects()`.\n *\n * Example:\n *\n * ```js\n * import {reactive, signal} from 'classy-solid'\n * import {foo} from 'somewhere'\n * import {bar} from 'elsewhere'\n *\n * class MyClass extends Effectful(BaseClass) {\n * constructor() {\n * super()\n *\n * // Log `foo` and `bar` any time either of them change.\n * this.createEffect(() => {\n * console.log('foo, bar:', foo(), bar())\n * })\n *\n * // Log only `bar` any time it changes.\n * this.createEffect(() => {\n * console.log('bar:', bar())\n * })\n * }\n *\n * dispose() {\n * // Later, stop both of the effects.\n * this.stopEffects()\n * }\n * }\n * ```\n */\nexport function Effectful(Base: T) {\n\treturn class Effectful extends Base {\n\t\t#effects = new Set()\n\n\t\t/**\n\t\t * Create a Solid.js effect. The difference from regular\n\t\t * `createEffect()` is that `this` tracks the effects created, so that\n\t\t * they can all be stopped with `this.stopEffects()`.\n\t\t *\n\t\t * Effects can also be stopped or resumed individually:\n\t\t *\n\t\t * ```js\n\t\t * const effect1 = this.createEffect(() => {...})\n\t\t * const effect2 = this.createEffect(() => {...})\n\t\t *\n\t\t * // ...later\n\t\t * effect1.stop()\n\t\t *\n\t\t * // ...later\n\t\t * effect1.resume()\n\t\t * ```\n\t\t */\n\t\tcreateEffect(fn: () => void) {\n\t\t\tlet method = 4\n\t\t\tif (method === 1) this.#createEffect1(fn) // not working, bugs out when inside a Solid render() root, effects stop re-running. https://discord.com/channels/722131463138705510/751355413701591120/1188246668466991134\n\t\t\tif (method === 2) createRoot(() => this.#createEffect1(fn)) // works without nesting, but leaks stopped effects until the parent owner is cleaned up (will never clean up if the parent is running for lifetime of the app).\n\t\t\tif (method === 3) queueMicrotask(() => this.#createEffect1(fn)) // works without nesting, without leaks\n\t\t\tif (method === 4) this.#createEffect2(fn) // works with nesting, without leaks\n\t\t}\n\n\t\t/**\n\t\t * Stop all of the effects that were created.\n\t\t */\n\t\tstopEffects() {\n\t\t\tlet method = 2\n\t\t\tif (method === 1) this.#stopEffects1()\n\t\t\tif (method === 2) this.#stopEffects2()\n\t\t}\n\n\t\t// Method 1 //////////////////////////////////////////\n\t\t// Works fine when not in a parent context, or else currently leaks or has the above mentioned bug while a parent exists.\n\n\t\t#createEffect1(fn: () => void) {\n\t\t\tlet effect: Effect | null = null\n\n\t\t\teffect = createStoppableEffect(() => {\n\t\t\t\tif (effect) this.#effects.add(effect)\n\t\t\t\t// nest the user's effect so that if it re-runs a lot it is not deleting/adding from/to our #effects Set a lot.\n\t\t\t\tcreateEffect(fn)\n\t\t\t\tonCleanup(() => this.#effects.delete(effect!))\n\t\t\t})\n\n\t\t\tthis.#effects.add(effect)\n\t\t}\n\n\t\t#stopEffects1() {\n\t\t\tfor (const effect of this.#effects) effect.stop()\n\t\t}\n\n\t\t// Method 2 //////////////////////////////////////////\n\t\t// Works, with nesting, no leaks.\n\n\t\t#owner: Owner | null = null\n\t\t#dispose: (() => void) | null = null\n\n\t\t#createEffect2(fn: () => void) {\n\t\t\tif (!this.#owner) {\n\t\t\t\tcreateRoot(dispose => {\n\t\t\t\t\tthis.#owner = getOwner()\n\t\t\t\t\tthis.#dispose = dispose\n\t\t\t\t\tthis.#createEffect2(fn)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tlet owner = getOwner()\n\t\t\t\twhile (owner && owner !== this.#owner) owner = owner?.owner ?? null\n\n\t\t\t\t// this.#owner found in the parents of current owner therefore,\n\t\t\t\t// run with current nested owner like a regular solid\n\t\t\t\t// createEffect()\n\t\t\t\tif (owner === this.#owner) return createEffect(fn)\n\n\t\t\t\t// this.#owner wasn't found on the parent owners\n\t\t\t\t// run with this.#owner\n\t\t\t\trunWithOwner(this.#owner, () => createEffect(fn))\n\t\t\t}\n\t\t}\n\n\t\t#stopEffects2() {\n\t\t\tthis.#dispose?.()\n\t\t}\n\t}\n}\n\n/**\n * Shortcut for instantiating or extending directly instead of using the mixin.\n * F.e.\n *\n * ```js\n * class Car extends Effects {\n * start() {\n * this.createEffect(() => {...})\n * this.createEffect(() => {...})\n * }\n * stop() {\n * this.stopEffects()\n * }\n * }\n *\n * const specialEffects = new Effects()\n * specialEffects.createEffect(() => {})\n * // ...later\n * specialEffects.stopEffects()\n * ```\n */\nexport class Effects extends Effectful(Object) {}\n", "// TODO no any\n\nexport class WeakTwoWayMap {\n\tm = new WeakMap()\n\tset(a: Object, b: Object) {\n\t\tthis.m.set(a, b)\n\t\tthis.m.set(b, a)\n\t}\n\tget(item: Object) {\n\t\treturn this.m.get(item)\n\t}\n\thas(item: Object) {\n\t\treturn this.m.has(item)\n\t}\n}\n\n// assumes the function opening, body, and closing are on separate lines\nexport function getFunctionBody(fn: Function): string {\n\tconst code = fn.toString().split('\\n')\n\tcode.shift() // remove opening line (function() {)\n\tcode.pop() // remove closing line (})\n\treturn code.join('\\n')\n}\n\nconst descriptorDefaults = {\n\tenumerable: true,\n\tconfigurable: true,\n}\n\n// makes it easier and less verbose to work with descriptors\nexport function setDescriptor(\n\tobj: T,\n\tkey: keyof T,\n\tnewDescriptor: PropertyDescriptor,\n\tinherited = false,\n): void {\n\tlet currentDescriptor = inherited ? getInheritedDescriptor(obj, key) : Object.getOwnPropertyDescriptor(obj, key)\n\n\tnewDescriptor = overrideDescriptor(currentDescriptor, newDescriptor)\n\tObject.defineProperty(obj, key, newDescriptor)\n}\n\nexport function setDescriptors(obj: Object, newDescriptors: Record): void {\n\tlet newDescriptor\n\tlet currentDescriptor\n\tconst currentDescriptors = Object.getOwnPropertyDescriptors(obj)\n\n\tfor (const key in newDescriptors) {\n\t\tnewDescriptor = newDescriptors[key]\n\t\tcurrentDescriptor = currentDescriptors[key]\n\t\tnewDescriptors[key] = overrideDescriptor(currentDescriptor, newDescriptor)\n\t}\n\n\tObject.defineProperties(obj, newDescriptors)\n}\n\nfunction overrideDescriptor(\n\toldDescriptor: PropertyDescriptor | undefined,\n\tnewDescriptor: PropertyDescriptor,\n): PropertyDescriptor {\n\tif (\n\t\t('get' in newDescriptor || 'set' in newDescriptor) &&\n\t\t('value' in newDescriptor || 'writable' in newDescriptor)\n\t) {\n\t\tthrow new TypeError('cannot specify both accessors and a value or writable attribute')\n\t}\n\n\tif (oldDescriptor) {\n\t\tif ('get' in newDescriptor || 'set' in newDescriptor) {\n\t\t\tdelete oldDescriptor.value\n\t\t\tdelete oldDescriptor.writable\n\t\t} else if ('value' in newDescriptor || 'writable' in newDescriptor) {\n\t\t\tdelete oldDescriptor.get\n\t\t\tdelete oldDescriptor.set\n\t\t}\n\t}\n\n\treturn {...descriptorDefaults, ...oldDescriptor, ...newDescriptor}\n}\n\n// TODO use signature override\nexport function propertyIsAccessor(\n\tobj: T,\n\tkey?: keyof T,\n\tinherited = true,\n): boolean {\n\tlet result = false\n\tlet descriptor: PropertyDescriptor | undefined\n\n\tif (arguments.length === 1) {\n\t\tdescriptor = obj\n\t} else {\n\t\tdescriptor = inherited ? getInheritedDescriptor(obj, key!) : Object.getOwnPropertyDescriptor(obj, key!)\n\t}\n\n\tif (descriptor && (descriptor.get || descriptor.set)) result = true\n\n\treturn result\n}\n\ninterface DescriptorWithOwner extends PropertyDescriptor {\n\towner: object\n}\n\nexport function getInheritedDescriptor(obj: T, key: keyof T): DescriptorWithOwner | undefined {\n\tlet currentProto = obj\n\tlet descriptor\n\n\twhile (currentProto) {\n\t\tdescriptor = Object.getOwnPropertyDescriptor(currentProto, key)\n\n\t\tif (descriptor) {\n\t\t\t;(descriptor as DescriptorWithOwner).owner = currentProto\n\t\t\treturn descriptor as DescriptorWithOwner\n\t\t}\n\n\t\tcurrentProto = (currentProto as any).__proto__\n\t}\n\n\treturn void 0\n}\n\nexport function getInheritedPropertyNames(obj: T): (keyof T)[] {\n\tlet currentProto = obj\n\tlet keys: (keyof T)[] = []\n\n\twhile (currentProto) {\n\t\tkeys = keys.concat(Object.getOwnPropertyNames(currentProto) as (keyof T)[])\n\t\tcurrentProto = (currentProto as any).__proto__\n\t}\n\n\t// remove duplicates\n\tkeys = Array.from(new Set(keys))\n\n\treturn keys\n}\n\n/**\n * Without type args, this is an easy shortcut for \"any non-abstract constructor\n * that has any args and returns any type of object\".\n *\n * With type args, define a non-abstract constructor type that returns a certain\n * instance type (optional), accepts certain args (optional, defaults to any\n * args for simplicity in cases like class-factory mixins), and has certain\n * static members (optional).\n */\nexport type Constructor = (new (...a: A) => T) & Static\n\n/**\n * Cast any constructor type (abstract or not) into a specific Constructor type.\n * Useful for forcing type checks inside of mixins for example. This is unsafe:\n * you can incorrectly cast one constructor into an unrelated constructor type,\n * so use with care.\n */\nexport function Constructor(Ctor: AnyConstructor): Constructor & Static {\n\treturn Ctor as unknown as Constructor & Static\n}\n\n/**\n * Without type args, this is an easy shortcut for \"any abstract constructor\n * that has any args and returns any type of object\".\n *\n * With type args, define an abstract constructor type that returns a certain\n * instance type (optional), accepts certain args (optional, defaults to any\n * args for simplicity in cases like class-factory mixins), and has certain\n * static members (optional).\n */\nexport type AbstractConstructor = (abstract new (...a: A) => T) &\n\tStatic\n\n/**\n * Cast any constructor type (abstract or not) into a specific\n * AbstractConstructor type. Useful for forcing type checks inside of mixins\n * for example. This is unsafe: you can incorrectly cast one constructor into an\n * unrelated constructor type, so use with care.\n */\nexport function AbstractConstructor(\n\tCtor: AnyConstructor,\n): AbstractConstructor & Static {\n\treturn Ctor as unknown as AbstractConstructor & Static\n}\n\n/**\n * Combines Constructor and AbstractConstructor to support assigning any type of\n * constructor whether abstract or not.\n *\n * Without type args, this is an easy shortcut for \"any constructor, abstract or not,\n * that has any args and returns any type of object\".\n *\n * With type args, define a constructor type (abstract or not) that returns a\n * certain instance type (optional), accepts certain args (optional, defaults to\n * any args for simplicity in cases like class-factory mixins), and has certain\n * static members (optional).\n */\nexport type AnyConstructor =\n\t| Constructor\n\t| AbstractConstructor\n\n/**\n * Cast any constructor type (abstract or not) into a specific\n * AnyConstructor type. Useful for forcing type checks inside of mixins\n * for example. This is unsafe: you can incorrectly cast one constructor into an\n * unrelated constructor type, so use with care.\n */\nexport function AnyConstructor(Ctor: AnyConstructor): AnyConstructor & Static {\n\treturn Ctor as unknown as AnyConstructor & Static\n}\n\n// check if an object has the given prototype in its chain\nexport function hasPrototype(obj: any, proto: any) {\n\tlet currentProto = obj.__proto__\n\n\tdo {\n\t\tif (proto === currentProto) return true\n\t\tcurrentProto = currentProto.__proto__\n\t} while (currentProto)\n\n\treturn false\n}\n\n// copy all properties (as descriptors) from source to destination\nexport function copyDescriptors(source: Object, destination: Object, mod?: any) {\n\tconst props = Object.getOwnPropertyNames(source)\n\tlet i = props.length\n\twhile (i--) {\n\t\tconst prop = props[i]\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(source, prop)\n\t\tif (mod) mod(descriptor)\n\t\tObject.defineProperty(destination, prop, descriptor!)\n\t}\n}\n\nexport function setDefaultPrototypeDescriptors(\n\tprototype: Object,\n\t{defaultClassDescriptor: {writable, enumerable, configurable}}: any,\n) {\n\tconst descriptors = Object.getOwnPropertyDescriptors(prototype)\n\tlet descriptor\n\n\tfor (const key in descriptors) {\n\t\tdescriptor = descriptors[key]\n\n\t\t// regular value\n\t\tif ('value' in descriptor || 'writable' in descriptor) {\n\t\t\tdescriptor.writable = writable\n\t\t}\n\n\t\t// accessor or regular value\n\t\tdescriptor.enumerable = enumerable\n\t\tdescriptor.configurable = configurable\n\t}\n\n\tsetDescriptors(prototype, descriptors)\n}\n\nexport function setDefaultStaticDescriptors(\n\tCtor: any,\n\t{defaultClassDescriptor: {writable, enumerable, configurable}}: any,\n\tstaticBlacklist?: (string | symbol)[],\n) {\n\tconst descriptors = Object.getOwnPropertyDescriptors(Ctor)\n\tlet descriptor\n\n\tfor (const key in descriptors) {\n\t\tif (staticBlacklist && staticBlacklist.includes(key)) {\n\t\t\tdelete descriptors[key]\n\t\t\tcontinue\n\t\t}\n\n\t\tdescriptor = descriptors[key]\n\n\t\t// regular value\n\t\tif ('value' in descriptor || 'writable' in descriptor) {\n\t\t\tdescriptor.writable = writable\n\t\t}\n\n\t\t// accessor or regular value\n\t\tdescriptor.enumerable = enumerable\n\t\tdescriptor.configurable = configurable\n\t}\n\n\tsetDescriptors(Ctor, descriptors)\n}\n", "// TODO\n// [x] remove the now-unnecessary modes (leave just what was 'es5' mode)\n// [x] link helpers to each other, making it possible to destructure the arguments to definer functions\n// [x] let access helper prototype objects extend from Object, otherwise common tools are not available.\n// [x] accept a function as return value of function definer, to be treated as a class to derive the definition from, so that it can have access to Protected and Private helpers\n// [x] let the returned class define protected and private getters which return the protected and private definitions.\n// [ ] protected and private static members\n// [ ] no `any` types\n// [ ] other TODOs in the code\n\nimport {\n\tConstructor,\n\tcopyDescriptors,\n\tsetDefaultStaticDescriptors,\n\tsetDefaultPrototypeDescriptors,\n\thasPrototype,\n} from './utils.js'\n\nimport type {Id} from './types.js'\n\ntype ImplementationKeys = 'static' | 'private' | 'protected'\n\ntype FunctionToConstructor = T extends (...a: infer A) => void ? new (...a: A) => TReturn : never\n\n// Note, void also works the same in place of unknown\ntype ReplaceCtorReturn = T extends new (...a: infer A) => unknown ? new (...a: A) => TReturn : never\n\ntype ConstructorOrDefault = T extends {constructor: infer TCtor} ? TCtor : () => void\n\n// Although the SuperType type definiton already checks that T extends from\n// Constructor, the additional check in the generic paramters is useful so\n// that we don't get an error about \"never\" which is hard to track down. The\n// generic paramter will cause a more helpful and understandable error.\n// TODO ensure that T is InstanceType of TBase\n// prettier-ignore\ntype SuperType<_T, TSuper extends Constructor> = TSuper extends Constructor\n ? {constructor: (...a: A) => I} & InstanceType\n : never\n// type SuperType<\n// T extends InstanceType,\n// TSuper extends Constructor\n// > = TSuper extends Constructor\n// ? T extends InstanceType\n// ? {constructor: (...a: A) => I} & Id>\n// : never\n// : never\n\ntype SuperHelper = (self: T) => SuperType\ntype PrivateHelper = (self: T) => T extends {__: {private: infer TPrivate}} ? TPrivate : never\ntype PublicHelper = (self: T) => Omit // TODO validate instance is public?\ntype ProtectedHelper = (self: T) => T extends {__: {protected: infer TProtected}} ? TProtected : never\n// type ProtectedHelper = (self: T) => T extends {protected: infer TProtected} ? TProtected : never\ntype Statics = T extends {static: infer TStatic} ? TStatic : {}\ntype SaveInheritedProtected = T extends {protected: infer TProtected} ? TProtected : {}\n\n// there's a missing link here: if the super class of T is a native class\n// that extends from a lowclass class, then we don't inherit those protected\n// members. Any ideas?\ntype StaticsAndProtected = Id & {__: {protected: SaveInheritedProtected}}>\n\ntype ExtractInheritedProtected = T extends {__: infer TProtected} ? TProtected : {}\ntype PickImplementationKeys = Pick> // similar to Pick, but not quite\n\n// this moves the implementation keys off the constructor return type and\n// onto a fake __ property, so that we can reference the __ type within the\n// implementatin code, but so that the outside (public) doesn't see the fake\n// __ property.\ntype LowClassThis = Id & {__: PickImplementationKeys}>\n\ntype OmitImplementationKeys = Omit\n\nimport {\n\tgetFunctionBody,\n\tsetDescriptor,\n\tpropertyIsAccessor,\n\tgetInheritedDescriptor,\n\tgetInheritedPropertyNames,\n\tWeakTwoWayMap,\n} from './utils.js'\n\nexport const staticBlacklist = ['subclass', 'extends', ...Object.getOwnPropertyNames(new Function())]\n\nconst publicProtoToProtectedProto = new WeakMap()\nconst publicProtoToPrivateProto = new WeakMap()\n\n// A two-way map to associate public instances with protected instances.\n// There is one protected instance per public instance\nconst publicToProtected = new WeakTwoWayMap()\n\n// so we can get the class scope associated with a private instance\nconst privateInstanceToClassScope = new WeakMap()\n\nconst brandToPublicPrototypes = new WeakMap()\nconst brandToProtectedPrototypes = new WeakMap()\nconst brandToPrivatePrototypes = new WeakMap()\nconst brandToPublicsPrivates = new WeakMap()\n\nconst defaultOptions = {\n\t// es5 class inheritance is simple, nice, easy, and robust\n\t// There was another mode, but it has been removed\n\tmode: 'es5',\n\n\t// false is better for performance, but true will use Function (similar to\n\t// eval) to name your class functions in the most accurate way.\n\tnativeNaming: false,\n\n\t// similar to ES6 classes:\n\tprototypeWritable: false,\n\tdefaultClassDescriptor: {\n\t\twritable: true,\n\t\tenumerable: false,\n\t\tconfigurable: true,\n\t},\n\tsetClassDescriptors: true,\n}\n\nexport class InvalidSuperAccessError extends Error {}\nexport class InvalidAccessError extends Error {}\n\nexport const Class = createClassHelper()\n\nexport function createClassHelper(options?: any) {\n\toptions = options ? {...defaultOptions, ...options} : defaultOptions\n\n\toptions.defaultClassDescriptor = {\n\t\t...defaultOptions.defaultClassDescriptor,\n\t\t...options.defaultClassDescriptor,\n\t}\n\n\tconst {mode, prototypeWritable, setClassDescriptors, nativeNaming} = options\n\n\t/*\n\t * this is just the public interface adapter for createClass(). Depending\n\t * on how you call this interface, you can do various things like:\n\t *\n\t * - anonymous empty class\n\t *\n\t * Class()\n\t *\n\t * - named empty class\n\t *\n\t * Class('Foo')\n\t *\n\t * - base class named Foo\n\t *\n\t * Class('Foo', (Public, Protected, Private) => {\n\t * someMethod() { ... },\n\t * })\n\t *\n\t * - anonymous base class\n\t *\n\t * Class((Public, Protected, Private) => {\n\t * someMethod() { ... },\n\t * })\n\t *\n\t * Class('Foo').extends(OtherClass, (Public, Protected, Private) => ({\n\t * someMethod() { ... },\n\t * }))\n\t *\n\t * OtherClass.subclass = Class\n\t * const Bar = OtherClass.subclass((Public, Protected, Private) => {\n\t * ...\n\t * })\n\t *\n\t * - any class made with lowclass has a static subclass if you prefer using\n\t * that:\n\t *\n\t * Bar.subclass('Baz', (Public, Protected, Private) => {...})\n\t *\n\t * - but you could as well do\n\t *\n\t * Class('Baz').extends(Bar, (Public, Protected, Private) => {...})\n\t */\n\tfunction Class(): typeof Object\n\t// export function Class(\n\tfunction Class(name: string): {\n\t\textends(\n\t\t\tbase: TBase,\n\t\t\tmembers: (helpers: {\n\t\t\t\tSuper: SuperHelper\n\t\t\t\tPublic: PublicHelper\n\t\t\t\tProtected: ProtectedHelper\n\t\t\t\tPrivate: PrivateHelper\n\t\t\t}) => T &\n\t\t\t\tPartial> &\n\t\t\t\tThisType & ExtractInheritedProtected>>,\n\t\t\tbrand?: object,\n\t\t): T extends {constructor: infer _TCtor}\n\t\t\t? FunctionToConstructor, Id & OmitImplementationKeys>> &\n\t\t\t\t\tId & Pick>\n\t\t\t: ReplaceCtorReturn>> & Id & Pick>\n\t}\n\tfunction Class(\n\t\tname: string,\n\t\tmembers: (\n\t\t\thelpers: {\n\t\t\t\tPublic: PublicHelper\n\t\t\t\tProtected: ProtectedHelper\n\t\t\t\tPrivate: PrivateHelper\n\t\t\t\tSuper: never\n\t\t\t}, // TODO Super is actually Object\n\t\t) => T & ThisType>,\n\t\tbrand?: object,\n\t): FunctionToConstructor, Id>> & Id>\n\tfunction Class(\n\t\tname: string,\n\t\tmembers: T & ThisType>,\n\t\tbrand?: object,\n\t): FunctionToConstructor, Id>> & Id>\n\tfunction Class(this: any, ...args: any[]) {\n\t\tlet usingStaticSubclassMethod = false\n\n\t\t// if called as SomeConstructor.subclass, or bound to SomeConstructor\n\t\tif (typeof this === 'function') usingStaticSubclassMethod = true\n\n\t\t// f.e. `Class()`, `Class('Foo')`, `Class('Foo', {...})` , `Class('Foo',\n\t\t// {...}, Brand)`, similar to `class {}`, `class Foo {}`, class Foo\n\t\t// {...}, and class Foo {...} with branding (see comments on classBrand\n\t\t// below regarding positional privacy)\n\t\tif (args.length <= 3) {\n\t\t\tlet name = ''\n\t\t\tlet definer: any = null\n\t\t\tlet classBrand: any = null\n\n\t\t\t// f.e. `Class('Foo')`\n\t\t\tif (typeof args[0] === 'string') name = args[0]\n\t\t\t// f.e. `Class((pub, prot, priv) => ({ ... }))`\n\t\t\telse if (typeof args[0] === 'function' || typeof args[0] === 'object') {\n\t\t\t\tdefiner = args[0]\n\t\t\t\tclassBrand = args[1]\n\t\t\t}\n\n\t\t\t// f.e. `Class('Foo', (pub, prot, priv) => ({ ... }))`\n\t\t\tif (typeof args[1] === 'function' || typeof args[1] === 'object') {\n\t\t\t\tdefiner = args[1]\n\t\t\t\tclassBrand = args[2]\n\t\t\t}\n\n\t\t\t// Make a class in case we wanted to do just `Class()` or\n\t\t\t// `Class('Foo')`...\n\t\t\tconst Ctor = usingStaticSubclassMethod\n\t\t\t\t? createClass.call(this, name, definer, classBrand)\n\t\t\t\t: createClass(name, definer, classBrand)\n\n\t\t\t// ...but add the extends helper in case we wanted to do like:\n\t\t\t// Class().extends(OtherClass, (Public, Protected, Private) => ({\n\t\t\t// ...\n\t\t\t// }))\n\t\t\tCtor.extends = function (ParentClass: any, def: any, brand: any) {\n\t\t\t\tdef = def || definer\n\t\t\t\tbrand = brand || classBrand\n\t\t\t\treturn createClass.call(ParentClass, name, def, brand)\n\t\t\t}\n\n\t\t\treturn Ctor\n\t\t}\n\n\t\tthrow new TypeError('invalid args')\n\t}\n\n\treturn Class\n\n\t/**\n\t * @param {string} className The name that the class being defined should\n\t * have.\n\t * @param {Function} definer A function or object for defining the class.\n\t * If definer a function, it is passed the Public, Protected, Private, and\n\t * Super helpers. Methods and properties can be defined on the helpers\n\t * directly. An object containing methods and properties can also be\n\t * returned from the function. If definer is an object, the object should\n\t * be in the same format as the one returned if definer were a function.\n\t */\n\tfunction createClass(this: any, className: string, definer: (...args: any[]) => any, classBrand: object) {\n\t\t'use strict'\n\n\t\t// f.e. ParentClass.subclass((Public, Protected, Private) => {...})\n\t\tlet ParentClass = this\n\n\t\tif (typeof className !== 'string') {\n\t\t\tthrow new TypeError(`\n You must specify a string for the 'className' argument.\n `)\n\t\t}\n\n\t\tlet definition = null\n\n\t\t// f.e. Class('Foo', { ... })\n\t\tif (definer && typeof definer === 'object') {\n\t\t\tdefinition = definer\n\t\t}\n\n\t\t// Return early if there's no definition or parent class, just a simple\n\t\t// extension of Object. f.e. when doing just `Class()` or\n\t\t// `Class('Foo')`\n\t\telse if (!ParentClass && (!definer || (typeof definer !== 'function' && typeof definer !== 'object'))) {\n\t\t\tlet Ctor: CtorWithSubclass & Function\n\n\t\t\tif (nativeNaming && className) Ctor = new Function(`return function ${className}() {}`)()\n\t\t\telse {\n\t\t\t\t// force anonymous even in ES6+\n\t\t\t\tCtor = (() => function () {})() as unknown as CtorWithSubclass\n\n\t\t\t\tif (className) setDescriptor(Ctor, 'name', {value: className})\n\t\t\t}\n\n\t\t\tCtor.prototype = {__proto__: Object.prototype, constructor: Ctor}\n\n\t\t\t// no static inheritance here, just like with `class Foo {}`\n\n\t\t\tsetDescriptor(Ctor, 'subclass', {\n\t\t\t\tvalue: Class,\n\t\t\t\twritable: true, // TODO maybe let's make this non writable\n\t\t\t\tenumerable: false,\n\t\t\t\tconfigurable: false,\n\t\t\t})\n\n\t\t\treturn Ctor\n\t\t}\n\n\t\t// A two-way map to associate public instances with private instances.\n\t\t// Unlike publicToProtected, this is inside here because there is one\n\t\t// private instance per class scope per instance (or to say it another\n\t\t// way, each instance has as many private instances as the number of\n\t\t// classes that the given instance has in its inheritance chain, one\n\t\t// private instance per class)\n\t\tconst scopedPublicsToPrivates = classBrand ? void undefined : new WeakTwoWayMap()\n\n\t\tif (classBrand) {\n\t\t\tif (!brandToPublicsPrivates.get(classBrand)) brandToPublicsPrivates.set(classBrand, new WeakTwoWayMap())\n\t\t}\n\n\t\t// if no brand provided, then we use the most fine-grained lexical\n\t\t// privacy. Lexical privacy is described at\n\t\t// https://github.com/tc39/proposal-class-fields/issues/60\n\t\t//\n\t\t// TODO make prototypes non-configurable so that the clasds-brand system\n\t\t// can't be tricked. For now, it's good enough, most people aren't going\n\t\t// to go out of their way to mangle with the prototypes in order to\n\t\t// force invalid private access.\n\t\tclassBrand = classBrand || {brand: 'lexical'}\n\n\t\t// the class \"scope\" that we will bind to the helper functions\n\t\tconst scope = {\n\t\t\tclassName, // convenient for debugging\n\n\t\t\tget publicToPrivate() {\n\t\t\t\treturn scopedPublicsToPrivates ? scopedPublicsToPrivates : brandToPublicsPrivates.get(classBrand)\n\t\t\t},\n\n\t\t\tclassBrand,\n\n\t\t\t// we use these to memoize the Public/Protected/Private access\n\t\t\t// helper results, to make subsequent accessses faster.\n\t\t\tcachedPublicAccesses: new WeakMap(),\n\t\t\tcachedProtectedAccesses: new WeakMap(),\n\t\t\tcachedPrivateAccesses: new WeakMap(),\n\t\t} as any\n\n\t\t// create the super helper for this class scope\n\t\tconst supers = new WeakMap()\n\t\tconst Super = superHelper.bind(null, supers, scope)\n\n\t\t// bind this class' scope to the helper functions\n\t\tconst Public = getPublicMembers.bind(null, scope) as any\n\t\tconst Protected = getProtectedMembers.bind(null, scope) as any\n\t\tconst Private = getPrivateMembers.bind(null, scope) as any\n\n\t\tPublic.prototype = {}\n\t\tProtected.prototype = {}\n\t\tPrivate.prototype = {}\n\n\t\t// alows the user to destructure arguments to definer functions\n\t\tPublic.Public = Public\n\t\tPublic.Protected = Protected\n\t\tPublic.Private = Private\n\t\tPublic.Super = Super\n\t\tProtected.Public = Public\n\t\tProtected.Protected = Protected\n\t\tProtected.Private = Private\n\t\tProtected.Super = Super\n\t\t// Private and Super are never passed as first argument\n\n\t\t// pass the helper functions to the user's class definition function\n\t\tdefinition = definition || (definer && definer(Public, Protected, Private, Super))\n\n\t\t// the user has the option of returning an object that defines which\n\t\t// properties are public/protected/private.\n\t\tif (definition && typeof definition !== 'object' && typeof definition !== 'function') {\n\t\t\tthrow new TypeError(`\n The return value of a class definer function, if any, should be\n an object, or a class constructor.\n `)\n\t\t}\n\n\t\t// if a function was returned, we assume it is a class from which we\n\t\t// get the public definition from.\n\t\tlet customClass = null\n\t\tif (typeof definition === 'function') {\n\t\t\tcustomClass = definition\n\t\t\tdefinition = definition.prototype\n\t\t\tParentClass = customClass.prototype.__proto__.constructor\n\t\t}\n\n\t\tlet staticMembers\n\n\t\t// if functions were provided for the public/protected/private\n\t\t// properties of the definition object, execute them with their\n\t\t// respective access helpers, and use the objects returned from them.\n\t\tif (definition) {\n\t\t\tstaticMembers = definition.static\n\t\t\tdelete definition.static\n\n\t\t\tif (typeof definition.public === 'function') {\n\t\t\t\tdefinition.public = definition.public(Protected, Private)\n\t\t\t}\n\n\t\t\tif (typeof definition.protected === 'function') {\n\t\t\t\tdefinition.protected = definition.protected(Public, Private)\n\t\t\t}\n\n\t\t\tif (typeof definition.private === 'function') {\n\t\t\t\tdefinition.private = definition.private(Public, Protected)\n\t\t\t}\n\t\t}\n\n\t\tParentClass = ParentClass || Object\n\n\t\t// extend the parent class\n\t\tconst parentPublicPrototype = ParentClass.prototype\n\t\tconst publicPrototype = (definition && definition.public) || definition || Object.create(parentPublicPrototype)\n\t\tif (publicPrototype.__proto__ !== parentPublicPrototype) publicPrototype.__proto__ = parentPublicPrototype\n\n\t\t// extend the parent protected prototype\n\t\tconst parentProtectedPrototype = getParentProtectedPrototype(parentPublicPrototype)\n\t\tconst protectedPrototype = (definition && definition.protected) || Object.create(parentProtectedPrototype)\n\t\tif (protectedPrototype.__proto__ !== parentProtectedPrototype)\n\t\t\tprotectedPrototype.__proto__ = parentProtectedPrototype\n\t\tpublicProtoToProtectedProto.set(publicPrototype, protectedPrototype)\n\n\t\t// private prototype inherits from parent, but each private instance is\n\t\t// private only for the class of this scope\n\t\tconst parentPrivatePrototype = getParentPrivatePrototype(parentPublicPrototype)\n\t\tconst privatePrototype = (definition && definition.private) || Object.create(parentPrivatePrototype)\n\t\tif (privatePrototype.__proto__ !== parentPrivatePrototype) privatePrototype.__proto__ = parentPrivatePrototype\n\t\tpublicProtoToPrivateProto.set(publicPrototype, privatePrototype)\n\n\t\tif (!brandToPublicPrototypes.get(classBrand)) brandToPublicPrototypes.set(classBrand, new Set())\n\t\tif (!brandToProtectedPrototypes.get(classBrand)) brandToProtectedPrototypes.set(classBrand, new Set())\n\t\tif (!brandToPrivatePrototypes.get(classBrand)) brandToPrivatePrototypes.set(classBrand, new Set())\n\n\t\tbrandToPublicPrototypes.get(classBrand).add(publicPrototype)\n\t\tbrandToProtectedPrototypes.get(classBrand).add(protectedPrototype)\n\t\tbrandToPrivatePrototypes.get(classBrand).add(privatePrototype)\n\n\t\tscope.publicPrototype = publicPrototype\n\t\tscope.privatePrototype = privatePrototype\n\t\tscope.protectedPrototype = protectedPrototype\n\t\tscope.parentPublicPrototype = parentPublicPrototype\n\t\tscope.parentProtectedPrototype = parentProtectedPrototype\n\t\tscope.parentPrivatePrototype = parentPrivatePrototype\n\n\t\t// the user has the option of assigning methods and properties to the\n\t\t// helpers that we passed in, to let us know which methods and\n\t\t// properties are public/protected/private so we can assign them onto\n\t\t// the respective prototypes.\n\t\tcopyDescriptors(Public.prototype, publicPrototype)\n\t\tcopyDescriptors(Protected.prototype, protectedPrototype)\n\t\tcopyDescriptors(Private.prototype, privatePrototype)\n\n\t\tif (definition) {\n\t\t\t// delete these so we don't expose them on the class' public\n\t\t\t// prototype\n\t\t\tdelete definition.public\n\t\t\tdelete definition.protected\n\t\t\tdelete definition.private\n\n\t\t\t// if a `public` object was also supplied, we treat that as the public\n\t\t\t// prototype instead of the base definition object, so we copy the\n\t\t\t// definition's props to the `public` object\n\t\t\t//\n\t\t\t// TODO For now we copy from the definition object to the 'public'\n\t\t\t// object (publicPrototype), but this won't work with native `super`.\n\t\t\t// Maybe later, we can use a Proxy to read props from both the root\n\t\t\t// object and the public object, so that `super` works from both.\n\t\t\t// Another option is to not allow a `public` object, only protected\n\t\t\t// and private\n\t\t\tif (definition !== publicPrototype) {\n\t\t\t\t// copy whatever remains\n\t\t\t\tcopyDescriptors(definition, publicPrototype)\n\t\t\t}\n\t\t}\n\n\t\tif (customClass) {\n\t\t\tif (staticMembers) copyDescriptors(staticMembers, customClass)\n\t\t\treturn customClass\n\t\t}\n\n\t\tconst userConstructor = publicPrototype.hasOwnProperty('constructor') ? publicPrototype.constructor : null\n\n\t\tlet NewClass!: CtorWithSubclass & Function\n\t\tlet newPrototype = null\n\n\t\t// ES5 version (which seems to be so much better)\n\t\tif (mode === 'es5') {\n\t\t\tNewClass = (() =>\n\t\t\t\tfunction (this: any) {\n\t\t\t\t\tlet ret = null\n\n\t\t\t\t\tlet constructor = null\n\n\t\t\t\t\tif (userConstructor) constructor = userConstructor\n\t\t\t\t\telse constructor = ParentClass\n\n\t\t\t\t\t// Object is a special case because otherwise\n\t\t\t\t\t// `Object.apply(this)` returns a different object and we don't\n\t\t\t\t\t// want to deal with return value in that case\n\t\t\t\t\tif (constructor !== Object) ret = constructor.apply(this, arguments)\n\n\t\t\t\t\tif (ret && (typeof ret === 'object' || typeof ret === 'function')) {\n\t\t\t\t\t\t// XXX should we set ret.__proto__ = constructor.prototype\n\t\t\t\t\t\t// here? Or let the user deal with that?\n\t\t\t\t\t\treturn ret\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this\n\t\t\t\t})() as unknown as CtorWithSubclass\n\n\t\t\tnewPrototype = publicPrototype\n\t\t} else {\n\t\t\tthrow new TypeError(`\n The lowclass \"mode\" option can only be 'es5' for now.\n `)\n\t\t}\n\n\t\tif (className) {\n\t\t\tif (nativeNaming) {\n\t\t\t\tconst code = getFunctionBody(NewClass)\n\t\t\t\tconst proto = NewClass.prototype\n\n\t\t\t\tNewClass = new Function(\n\t\t\t\t\t` userConstructor, ParentClass `,\n\t\t\t\t\t`\n return function ${className}() { ${code} }\n `,\n\t\t\t\t)(userConstructor, ParentClass)\n\n\t\t\t\tNewClass.prototype = proto\n\t\t\t} else {\n\t\t\t\tsetDescriptor(NewClass, 'name', {value: className})\n\t\t\t}\n\t\t}\n\n\t\tif (userConstructor && userConstructor.length) {\n\t\t\t// length is not writable, only configurable, therefore the value\n\t\t\t// has to be set with a descriptor update\n\t\t\tsetDescriptor(NewClass, 'length', {\n\t\t\t\tvalue: userConstructor.length,\n\t\t\t})\n\t\t}\n\n\t\t// static stuff {\n\n\t\t// static inheritance\n\t\tNewClass.__proto__ = ParentClass\n\n\t\tif (staticMembers) copyDescriptors(staticMembers, NewClass)\n\n\t\t// allow users to make subclasses. When subclass is called on a\n\t\t// constructor, it defines `this` which is assigned to ParentClass\n\t\t// above.\n\t\tsetDescriptor(NewClass, 'subclass', {\n\t\t\tvalue: Class,\n\t\t\twritable: true,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false,\n\t\t})\n\n\t\t// }\n\n\t\t// prototype stuff {\n\n\t\tNewClass.prototype = newPrototype\n\n\t\tNewClass.prototype.constructor = NewClass\n\n\t\t// }\n\n\t\tif (setClassDescriptors) {\n\t\t\tsetDefaultStaticDescriptors(NewClass, options, staticBlacklist)\n\t\t\tsetDescriptor(NewClass, 'prototype', {writable: prototypeWritable})\n\t\t\tsetDefaultPrototypeDescriptors(NewClass.prototype, options)\n\t\t\tsetDefaultPrototypeDescriptors(protectedPrototype, options)\n\t\t\tsetDefaultPrototypeDescriptors(privatePrototype, options)\n\t\t}\n\n\t\tscope.constructor = NewClass // convenient for debugging\n\n\t\treturn NewClass\n\t}\n}\n\n// XXX PERFORMANCE: instead of doing multiple prototype traversals with\n// hasPrototype in the following access helpers, maybe we can do a single\n// traversal and check along the way?\n//\n// Worst case examples:\n//\n// currently:\n// If class hierarchy has 20 classes\n// If we detect which instance we have in order of public, protected, private\n// If the instance we're checking is the private instance of the middle class (f.e. class 10)\n// We'll traverse 20 public prototypes with 20 conditional checks\n// We'll traverse 20 protected prototypes with 20 conditional checks\n// And finally we'll traverse 10 private prototypes with 10 conditional checks\n// TOTAL: We traverse over 50 prototypes with 50 conditional checks\n//\n// proposed:\n// If class hierarchy has 20 classes\n// If we detect which instance we have in order of public, protected, private\n// If the instance we're checking is the private instance of the middle class (f.e. class 10)\n// We'll traverse 10 public prototypes with 3 conditional checks at each prototype\n// TOTAL: We traverse over 10 prototypes with 30 conditional checks\n// BUT: The conditional checking will involve reading WeakMaps instead of\n// checking just reference equality. If we can optimize how this part\n// works, it might be worth it.\n//\n// Can the tradeoff (less traversal and conditional checks) outweigh the\n// heavier conditional checks?\n//\n// XXX PERFORMANCE: We can also cache the access-helper results, which requires more memory,\n// but will make use of access helpers much faster, especially important for\n// animations.\n\nfunction getParentProtectedPrototype(parentPublicPrototype: any) {\n\t// look up the prototype chain until we find a parent protected prototype, if any.\n\n\tlet parentProtectedProto\n\tlet currentPublicProto = parentPublicPrototype\n\n\twhile (currentPublicProto && !parentProtectedProto) {\n\t\tparentProtectedProto = publicProtoToProtectedProto.get(currentPublicProto)\n\t\tcurrentPublicProto = currentPublicProto.__proto__\n\t}\n\n\t// TODO, now that we're finding the nearest parent protected proto,\n\t// we might not need to create an empty object for each class if we\n\t// don't find one, to avoid prototype lookup depth, as we'll connect\n\t// to the nearest one we find, if any.\n\treturn parentProtectedProto || {}\n}\n\nfunction getParentPrivatePrototype(parentPublicPrototype: any) {\n\t// look up the prototype chain until we find a parent protected prototype, if any.\n\n\tlet parentPrivateProto\n\tlet currentPublicProto = parentPublicPrototype\n\n\twhile (currentPublicProto && !parentPrivateProto) {\n\t\tparentPrivateProto = publicProtoToPrivateProto.get(currentPublicProto)\n\t\tcurrentPublicProto = currentPublicProto.__proto__\n\t}\n\n\t// TODO, now that we're finding the nearest parent protected proto,\n\t// we might not need to create an empty object for each class if we\n\t// don't find one, to avoid prototype lookup depth, as we'll connect\n\t// to the nearest one we find, if any.\n\treturn parentPrivateProto || {}\n}\n\nfunction getPublicMembers(scope: any, instance: any) {\n\tlet result = scope.cachedPublicAccesses.get(instance)\n\n\tif (result) return result\n\n\t// check only for the private instance of this class scope\n\tif (isPrivateInstance(scope, instance))\n\t\tscope.cachedPublicAccesses.set(instance, (result = getSubclassScope(instance).publicToPrivate.get(instance)))\n\t// check for an instance of the class (or its subclasses) of this scope\n\telse if (isProtectedInstance(scope, instance))\n\t\tscope.cachedPublicAccesses.set(instance, (result = publicToProtected.get(instance)))\n\t// otherwise just return whatever was passed in, it's public already!\n\telse scope.cachedPublicAccesses.set(instance, (result = instance))\n\n\treturn result\n}\n\nfunction getProtectedMembers(scope: any, instance: any) {\n\tlet result = scope.cachedProtectedAccesses.get(instance)\n\n\tif (result) return result\n\n\t// check for an instance of the class (or its subclasses) of this scope\n\t// This allows for example an instance of an Animal base class to access\n\t// protected members of an instance of a Dog child class.\n\tif (isPublicInstance(scope, instance))\n\t\tscope.cachedProtectedAccesses.set(\n\t\t\tinstance,\n\t\t\t(result = publicToProtected.get(instance) || createProtectedInstance(instance)),\n\t\t)\n\t// check for a private instance inheriting from this class scope\n\telse if (isPrivateInstance(scope, instance)) {\n\t\tconst publicInstance = getSubclassScope(instance).publicToPrivate.get(instance)\n\t\tscope.cachedProtectedAccesses.set(\n\t\t\tinstance,\n\t\t\t(result = publicToProtected.get(publicInstance) || createProtectedInstance(publicInstance)),\n\t\t)\n\t}\n\n\t// return the protected instance if it was passed in\n\telse if (isProtectedInstance(scope, instance)) scope.cachedProtectedAccesses.set(instance, (result = instance))\n\n\tif (!result) throw new InvalidAccessError('invalid access of protected member')\n\n\treturn result\n}\n\nfunction getSubclassScope(privateInstance: any) {\n\treturn privateInstanceToClassScope.get(privateInstance)\n}\n\nfunction createProtectedInstance(publicInstance: any) {\n\t// traverse instance proto chain, find first protected prototype\n\tconst protectedPrototype = findLeafmostProtectedPrototype(publicInstance)\n\n\t// make the protected instance from the found protected prototype\n\tconst protectedInstance = Object.create(protectedPrototype)\n\tpublicToProtected.set(publicInstance, protectedInstance)\n\treturn protectedInstance\n}\n\nfunction findLeafmostProtectedPrototype(publicInstance: any) {\n\tlet result = null\n\tlet currentProto = publicInstance.__proto__\n\n\twhile (currentProto) {\n\t\tresult = publicProtoToProtectedProto.get(currentProto)\n\t\tif (result) return result\n\t\tcurrentProto = currentProto.__proto__\n\t}\n\n\treturn result\n}\n\nfunction getPrivateMembers(scope: any, instance: any) {\n\tlet result = scope.cachedPrivateAccesses.get(instance)\n\n\tif (result) return result\n\n\t// check for a public instance that is or inherits from this class\n\tif (isPublicInstance(scope, instance))\n\t\tscope.cachedPrivateAccesses.set(\n\t\t\tinstance,\n\t\t\t(result = scope.publicToPrivate.get(instance) || createPrivateInstance(scope, instance)),\n\t\t)\n\t// check for a protected instance that is or inherits from this class'\n\t// protectedPrototype\n\telse if (isProtectedInstance(scope, instance)) {\n\t\tconst publicInstance = publicToProtected.get(instance)\n\t\tscope.cachedPrivateAccesses.set(\n\t\t\tinstance,\n\t\t\t(result = scope.publicToPrivate.get(publicInstance) || createPrivateInstance(scope, publicInstance)),\n\t\t)\n\t}\n\n\t// return the private instance if it was passed in\n\telse if (isPrivateInstance(scope, instance)) scope.cachedPrivateAccesses.set(instance, (result = instance))\n\n\tif (!result) throw new InvalidAccessError('invalid access of private member')\n\n\treturn result\n}\n\nfunction createPrivateInstance(scope: any, publicInstance: any) {\n\tconst privateInstance = Object.create(scope.privatePrototype)\n\tscope.publicToPrivate.set(publicInstance, privateInstance)\n\tprivateInstanceToClassScope.set(privateInstance, scope) // TODO use WeakTwoWayMap\n\treturn privateInstance\n}\n\nfunction isPublicInstance(scope: any, instance: any, brandedCheck = true) {\n\tif (!brandedCheck) return hasPrototype(instance, scope.publicPrototype)\n\n\tfor (const proto of Array.from(brandToPublicPrototypes.get(scope.classBrand))) {\n\t\tif (hasPrototype(instance, proto)) return true\n\t}\n\n\treturn false\n}\n\nfunction isProtectedInstance(scope: any, instance: any, brandedCheck = true) {\n\tif (!brandedCheck) return hasPrototype(instance, scope.protectedPrototype)\n\n\tfor (const proto of Array.from(brandToProtectedPrototypes.get(scope.classBrand))) {\n\t\tif (hasPrototype(instance, proto)) return true\n\t}\n\n\treturn false\n}\n\nfunction isPrivateInstance(scope: any, instance: any, brandedCheck = true) {\n\tif (!brandedCheck) return hasPrototype(instance, scope.privatePrototype)\n\n\tfor (const proto of Array.from(brandToPrivatePrototypes.get(scope.classBrand))) {\n\t\tif (hasPrototype(instance, proto)) return true\n\t}\n\n\treturn false\n}\n\nfunction superHelper(supers: any, scope: any, instance: any) {\n\tconst {parentPublicPrototype, parentProtectedPrototype, parentPrivatePrototype} = scope\n\n\tif (isPublicInstance(scope, instance, false)) return getSuperHelperObject(instance, parentPublicPrototype, supers)\n\n\tif (isProtectedInstance(scope, instance, false))\n\t\treturn getSuperHelperObject(instance, parentProtectedPrototype, supers)\n\n\tif (isPrivateInstance(scope, instance, false)) return getSuperHelperObject(instance, parentPrivatePrototype, supers)\n\n\tthrow new InvalidSuperAccessError('invalid super access')\n}\n\nfunction getSuperHelperObject(instance: any, parentPrototype: any, supers: any) {\n\tlet _super = supers.get(instance)\n\n\t// XXX PERFORMANCE: there's probably some ways to improve speed here using caching\n\tif (!_super) {\n\t\tsupers.set(instance, (_super = Object.create(parentPrototype)))\n\n\t\tconst keys = getInheritedPropertyNames(parentPrototype)\n\t\tlet i = keys.length\n\n\t\twhile (i--) {\n\t\t\tconst key = keys[i]\n\n\t\t\tsetDescriptor(\n\t\t\t\t_super,\n\t\t\t\tkey,\n\t\t\t\t{\n\t\t\t\t\tget: function () {\n\t\t\t\t\t\tlet value: any = void undefined\n\n\t\t\t\t\t\tconst descriptor = getInheritedDescriptor(parentPrototype, key)\n\n\t\t\t\t\t\tif (descriptor && propertyIsAccessor(descriptor)) {\n\t\t\t\t\t\t\tconst getter = descriptor.get\n\t\t\t\t\t\t\tif (getter) value = getter.call(instance)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvalue = parentPrototype[key]\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (value && value.call && typeof value === 'function') {\n\t\t\t\t\t\t\tvalue = value.bind(instance)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn value\n\t\t\t\t\t},\n\n\t\t\t\t\t// like native `super`, setting a super property does nothing.\n\t\t\t\t\tset: function (value) {\n\t\t\t\t\t\tconst descriptor = getInheritedDescriptor(parentPrototype, key)\n\n\t\t\t\t\t\tif (descriptor && propertyIsAccessor(descriptor)) {\n\t\t\t\t\t\t\tconst setter = descriptor.set\n\t\t\t\t\t\t\tif (setter) value = setter.call(instance, value)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// just like native `super`\n\t\t\t\t\t\t\tinstance[key] = value\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttrue,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn _super\n}\n\nexport default Class\n\ntype CtorWithSubclass = Constructor<\n\tobject,\n\tany[],\n\t{\n\t\tsubclass: Constructor\n\t\t__proto__: CtorWithSubclass\n\t}\n>\n", "import type {Constructor} from './utils.js'\n\n// --- TODO handle static inheritance. Nothing has been implemented with regards to\n// static inheritance yet.\n\n// --- TODO allow the subclass (f.e. the `Foo` in `class Foo extends multiple(One,\n// Two, Three) {}`) to call each super constructor (One, Two, and Three)\n// individually with specific arguments.\n\n// --- TODO Prevent duplicate classes in the \"prototype tree\". F.e. if someone calls\n// `multiple(One, Two, Three)`, and `Three` already includes `Two`, we can\n// discard the `Two` argument and perform the combination as if `multiple(One,\n// Three)` had been called.\n\n// --- TODO cache the results, so more than one call to `multiple(One, Two, Three)`\n// returns the same class reference as the first call.\n\n// --- TODO, allow the user to handle the diamond problem in some way other than\n// (\"property or method from the first class in the list wins\"). Perhaps require\n// the user to specify which method to call. For now, it simply calls the first\n// method in the order in which the classes were passed into multiple(). Look\n// here for ideas based on how different languages handle it:\n// https://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem\n\nenum ImplementationMethod {\n\tPROXIES_ON_INSTANCE_AND_PROTOTYPE = 'PROXIES_ON_INSTANCE_AND_PROTOTYPE',\n\tPROXIES_ON_PROTOTYPE = 'PROXIES_ON_PROTOTYPE',\n\n\t// TODO, This will be similar to PROXIES_ON_INSTANCE_AND_PROTOTYPE, but\n\t// instead of placing a proxy on the instance, place a Proxy as a direct\n\t// prototype of the instance. I think this should work with Custom Elements,\n\t// and unlike PROXIES_ON_PROTOTYPE, super calls won't access own properties\n\t// on the instance, but actually on the prototypes (test5 super access tests\n\t// fail with PROXIES_ON_PROTOTYPE method).\n\tPROXY_AFTER_INSTANCE_AND_PROTOTYPE = 'PROXY_AFTER_INSTANCE_AND_PROTOTYPE',\n}\n\ntype MultipleOptions = {\n\tmethod: ImplementationMethod\n}\n\nexport function makeMultipleHelper(options?: MultipleOptions) {\n\t/**\n\t * Mixes the given classes into a single class. This is useful for multiple\n\t * inheritance.\n\t *\n\t * @example\n\t * class Foo {}\n\t * class Bar {}\n\t * class Baz {}\n\t * class MyClass extends multiple(Foo, Bar, Baz) {}\n\t */\n\t// ------------ method 1, define the `multiple()` signature with overrides. The\n\t// upside is it is easy to understand, but the downside is that name collisions\n\t// in properties cause the collided property type to be `never`. This would make\n\t// it more difficult to provide solution for the diamond problem.\n\t// ----------------\n\t// function multiple(): typeof Object\n\t// function multiple(classes: T): T\n\t// function multiple(...classes: T): Constructor>\n\t// function multiple(...classes: any): any {\n\t//\n\t// ------------ method 2, define the signature of `multiple()` with a single\n\t// signature. The upside is this picks the type of the first property\n\t// encountered when property names collide amongst all the classes passed into\n\t// `multiple()`, but the downside is the inner implementation may require\n\t// casting, and this approach can also cause an infinite type recursion\n\t// depending on the types used inside the implementation.\n\t// ----------------\n\treturn function multiple(...classes: T): CombinedClasses {\n\t\tconst mode = (options && options.method) || ImplementationMethod.PROXIES_ON_INSTANCE_AND_PROTOTYPE\n\n\t\tswitch (mode) {\n\t\t\tcase ImplementationMethod.PROXIES_ON_INSTANCE_AND_PROTOTYPE: {\n\t\t\t\treturn (withProxiesOnThisAndPrototype as any)(...classes)\n\t\t\t}\n\t\t\tcase ImplementationMethod.PROXIES_ON_PROTOTYPE: {\n\t\t\t\treturn (withProxiesOnPrototype as any)(...classes)\n\t\t\t}\n\t\t\tcase ImplementationMethod.PROXY_AFTER_INSTANCE_AND_PROTOTYPE: {\n\t\t\t\tthrow new Error(' not implemented yet')\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Mixes the given classes into a single class. This is useful for multiple\n * inheritance.\n *\n * @example\n * class Foo {}\n * class Bar {}\n * class Baz {}\n * class MyClass extends multiple(Foo, Bar, Baz) {}\n */\nexport const multiple = makeMultipleHelper({method: ImplementationMethod.PROXIES_ON_INSTANCE_AND_PROTOTYPE})\n// export const multiple = makeMultipleHelper({method: ImplementationMethod.PROXIES_ON_PROTOTYPE})\n\nfunction withProxiesOnThisAndPrototype(...classes: T): CombinedClasses {\n\t// avoid performance costs in special cases\n\tif (classes.length === 0) return Object as any\n\tif (classes.length === 1) return classes[0] as any\n\n\tconst FirstClass = classes.shift()!\n\n\t// inherit the first class normally. This allows for required native\n\t// inheritance in certain special cases (like inheriting from HTMLElement\n\t// when making Custom Elements).\n\tclass MultiClass extends FirstClass {\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\n\t\t\tconst instances: Object[] = []\n\n\t\t\t// make instances of the other classes to get/set properties on.\n\t\t\tlet Ctor: Constructor\n\t\t\tfor (let i = 0, l = classes.length; i < l; i += 1) {\n\t\t\t\tCtor = classes[i]\n\t\t\t\tconst instance = Reflect.construct(Ctor, args)\n\t\t\t\tinstances.push(instance)\n\t\t\t}\n\n\t\t\treturn new Proxy(this, {\n\t\t\t\t// No `set()` trap is needed in this Proxy handler, at least for\n\t\t\t\t// the tests so far. Methods automatically have the correct\n\t\t\t\t// receiver when the are gotten with the `get()` trap, so if any\n\t\t\t\t// methods set a property, the set happens on the expected\n\t\t\t\t// instance, just like regular [[Set]].\n\n\t\t\t\tget(target, key: string | symbol, self: MultiClass): any {\n\t\t\t\t\tif (Reflect.ownKeys(target).includes(key)) return Reflect.get(target, key, self)\n\n\t\t\t\t\tlet instance: Object\n\n\t\t\t\t\tfor (let i = 0, l = instances.length; i < l; i += 1) {\n\t\t\t\t\t\tinstance = instances[i]\n\t\t\t\t\t\tif (Reflect.ownKeys(instance).includes(key)) return Reflect.get(instance, key, self)\n\t\t\t\t\t}\n\n\t\t\t\t\tconst proto = Object.getPrototypeOf(self)\n\t\t\t\t\tif (Reflect.has(proto, key)) return Reflect.get(proto, key, self)\n\n\t\t\t\t\treturn undefined\n\t\t\t\t},\n\n\t\t\t\townKeys(target) {\n\t\t\t\t\tlet keys = Reflect.ownKeys(target)\n\n\t\t\t\t\tlet instance: Object\n\t\t\t\t\tlet instanceKeys: (string | symbol)[]\n\n\t\t\t\t\tfor (let i = 0, l = instances.length; i < l; i += 1) {\n\t\t\t\t\t\tinstance = instances[i]\n\t\t\t\t\t\tinstanceKeys = Reflect.ownKeys(instance)\n\t\t\t\t\t\tfor (let j = 0, l = instanceKeys.length; j < l; j += 1) keys.push(instanceKeys[j])\n\t\t\t\t\t}\n\n\t\t\t\t\treturn keys\n\t\t\t\t},\n\n\t\t\t\t// This makes the `in` operator work, for example.\n\t\t\t\thas(target, key: string | symbol): boolean {\n\t\t\t\t\tif (Reflect.ownKeys(target).includes(key)) return true\n\n\t\t\t\t\tlet instance: Object\n\t\t\t\t\tfor (let i = 0, l = instances.length; i < l; i += 1) {\n\t\t\t\t\t\tinstance = instances[i]\n\t\t\t\t\t\tif (Reflect.ownKeys(instance).includes(key)) return true\n\t\t\t\t\t}\n\n\t\t\t\t\t// all instances share the same prototype, so just check it once\n\t\t\t\t\tconst proto = Object.getPrototypeOf(self)\n\t\t\t\t\tif (Reflect.has(proto, key)) return true\n\n\t\t\t\t\treturn false\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\n\tconst newMultiClassPrototype = new Proxy(Object.create(FirstClass.prototype), {\n\t\tget(target, key: string | symbol, self: MultiClass): any {\n\t\t\tif (Reflect.has(target, key)) return Reflect.get(target, key, self)\n\n\t\t\tlet Class: Constructor\n\t\t\tfor (let i = 0, l = classes.length; i < l; i += 1) {\n\t\t\t\tClass = classes[i]\n\t\t\t\tif (Reflect.has(Class.prototype, key)) return Reflect.get(Class.prototype, key, self)\n\t\t\t}\n\t\t},\n\n\t\thas(target, key): boolean {\n\t\t\tif (Reflect.has(target, key)) return true\n\n\t\t\tlet Class: Constructor\n\t\t\tfor (let i = 0, l = classes.length; i < l; i += 1) {\n\t\t\t\tClass = classes[i]\n\t\t\t\tif (Reflect.has(Class.prototype, key)) return true\n\t\t\t}\n\n\t\t\treturn false\n\t\t},\n\t})\n\n\t// This is so that `super` calls will work. We can't replace\n\t// MultiClass.prototype with a Proxy because MultiClass.prototype is\n\t// non-configurable, so it is impossible to wrap it with a Proxy. Instead,\n\t// we stick our own custom Proxy-wrapped prototype object between\n\t// MultiClass.prototype and FirstClass.prototype.\n\tObject.setPrototypeOf(MultiClass.prototype, newMultiClassPrototype)\n\n\treturn MultiClass as unknown as CombinedClasses\n}\n\nlet currentSelf: Object[] = []\n\nconst __instances__ = new WeakMap()\nconst getInstances = (inst: object): Object[] => {\n\tlet result = __instances__.get(inst)\n\tif (!result) __instances__.set(inst, (result = []))\n\treturn result\n}\n\n// function hasKey(instance: object, key: string | number | symbol, traverse: boolean = true): boolean {\n// \tif (Reflect.ownKeys(instance).includes(key)) return true\n\n// \tif (!traverse) return false\n\n// \tconst instances = __instances__.get(instance)\n// \tif (!instances) return false\n\n// \tfor (const instance of instances) if (hasKey(instance, key, true)) return true\n\n// \treturn false\n// }\n\ntype GetResult = {has: boolean; value: any}\n\nconst getResult: GetResult = {has: false, value: undefined}\n\nfunction getFromInstance(instance: object, key: string | symbol, result: GetResult): void {\n\tresult.has = false\n\tresult.value = undefined\n\n\tif (Reflect.ownKeys(instance).includes(key)) {\n\t\tresult.has = true\n\t\tresult.value = Reflect.get(instance, key)\n\t\treturn\n\t}\n\n\tconst instances = __instances__.get(instance)\n\tif (!instances) return\n\n\tfor (const instance of instances) {\n\t\t// if (hasKey(instance, key, true)) {\n\t\t// getFromInstance(instance, key, result)\n\t\t// return\n\t\t// }\n\n\t\tgetFromInstance(instance, key, result)\n\t\tif (result.has) return\n\t}\n}\n\nlet shouldGetFromPrototype = false\nlet topLevelMultiClassPrototype: object | null = null\n\nfunction withProxiesOnPrototype(...classes: T): CombinedClasses {\n\t// avoid performance costs in special cases\n\tif (classes.length === 0) return Object as any\n\tif (classes.length === 1) return classes[0] as any\n\n\tconst FirstClass = classes.shift()!\n\n\t// inherit the first class normally. This allows for required native\n\t// inheritance in certain special cases (like inheriting from HTMLElement\n\t// when making Custom Elements).\n\tclass MultiClass extends FirstClass {\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\n\t\t\t// This assumes no super constructor returns a different this from\n\t\t\t// their constructor. Otherwise the getInstances call won't work as\n\t\t\t// expected.\n\t\t\tconst instances = getInstances(this)\n\n\t\t\t// make instances of the other classes to get/set properties on.\n\t\t\tfor (const Ctor of classes) {\n\t\t\t\tconst instance = Reflect.construct(Ctor, args)\n\t\t\t\tinstances.push(instance)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst newMultiClassPrototype = new Proxy(Object.create(FirstClass.prototype), {\n\t\tget(target, key: string | symbol, self: MultiClass): any {\n\t\t\tif (!topLevelMultiClassPrototype) topLevelMultiClassPrototype = target\n\n\t\t\tif (!shouldGetFromPrototype) {\n\t\t\t\tgetFromInstance(self, key, getResult)\n\n\t\t\t\tif (getResult.has) {\n\t\t\t\t\ttopLevelMultiClassPrototype = null\n\t\t\t\t\treturn getResult.value\n\t\t\t\t}\n\n\t\t\t\t// only the top level MultiClass subclass prototype will check\n\t\t\t\t// instances for a property. The superclass MultiClass\n\t\t\t\t// prototypes will do a regular prototype get.\n\t\t\t\tshouldGetFromPrototype = true\n\t\t\t}\n\n\t\t\t// TODO, I think instead of passing `self` we should be passing the\n\t\t\t// instances created from the classes? We need to write more tests,\n\t\t\t// especially ones that create new properties later and not at\n\t\t\t// construction time.\n\t\t\tif (shouldGetFromPrototype) {\n\t\t\t\tlet result: any = undefined\n\n\t\t\t\tif (Reflect.has(target, key)) result = Reflect.get(target, key, self)\n\n\t\t\t\tlet Class: Constructor\n\t\t\t\tfor (let i = 0, l = classes.length; i < l; i += 1) {\n\t\t\t\t\tClass = classes[i]\n\t\t\t\t\tif (Reflect.has(Class.prototype, key)) result = Reflect.get(Class.prototype, key, self)\n\t\t\t\t}\n\n\t\t\t\tif (topLevelMultiClassPrototype === target) {\n\t\t\t\t\ttopLevelMultiClassPrototype = null\n\t\t\t\t\tshouldGetFromPrototype = false\n\t\t\t\t}\n\n\t\t\t\treturn result\n\t\t\t}\n\n\t\t\t// currentSelf.push(self)\n\n\t\t\t// if (Reflect.ownKeys(self).includes(key)) {\n\t\t\t// \tcurrentSelf.pop()\n\t\t\t// \treturn Reflect.get(target, key, self)\n\t\t\t// }\n\n\t\t\t// currentSelf.pop()\n\n\t\t\t// for (const instance of getInstances(self)) {\n\t\t\t// \tcurrentSelf.push(instance)\n\n\t\t\t// \tif (Reflect.ownKeys(instance).includes(key)) {\n\t\t\t// \t\tcurrentSelf.pop()\n\t\t\t// \t\treturn Reflect.get(instance, key, instance)\n\t\t\t// \t}\n\n\t\t\t// \tcurrentSelf.pop()\n\t\t\t// }\n\n\t\t\t// return undefined\n\t\t},\n\n\t\tset(target, key: string | symbol, value: any, self): boolean {\n\t\t\tcurrentSelf.push(self)\n\n\t\t\t// If the key is in the current prototype chain, continue like normal...\n\t\t\tif (Reflect.has(target, key)) {\n\t\t\t\tcurrentSelf.pop()\n\t\t\t\treturn Reflect.set(target, key, value, self)\n\t\t\t}\n\n\t\t\tcurrentSelf.pop()\n\n\t\t\t// ...Otherwise if the key isn't, set it on one of the instances of the classes.\n\t\t\tfor (const instance of getInstances(self)) {\n\t\t\t\tcurrentSelf.push(instance)\n\n\t\t\t\tif (Reflect.has(instance, key)) {\n\t\t\t\t\tcurrentSelf.pop()\n\t\t\t\t\treturn Reflect.set(instance, key, value, instance)\n\t\t\t\t\t// return Reflect.set(instance, key, value, self)\n\t\t\t\t}\n\n\t\t\t\tcurrentSelf.pop()\n\t\t\t}\n\n\t\t\t// If the key is not found, set it like normal.\n\t\t\treturn Reflect.set(target, key, value, self)\n\t\t},\n\n\t\thas(target, key): boolean {\n\t\t\t// if (currentSelf.length) {\n\t\t\t// \tlet current = currentSelf[currentSelf.length - 1]\n\n\t\t\t// \twhile (current) {\n\t\t\t// \t\tif (Reflect.ownKeys(current).includes(key)) return true\n\t\t\t// \t\tcurrent = Reflect.getPrototypeOf(current) as MultiClass\n\t\t\t// \t}\n\n\t\t\t// \tfor (const instance of getInstances(current as MultiClass))\n\t\t\t// \t\tif (Reflect.has(instance, key)) return true\n\t\t\t// } else {\n\t\t\tif (Reflect.has(target, key)) return true\n\n\t\t\tlet Class: Constructor\n\t\t\tfor (let i = 0, l = classes.length; i < l; i += 1) {\n\t\t\t\tClass = classes[i]\n\t\t\t\tif (Reflect.has(Class.prototype, key)) return true\n\t\t\t}\n\t\t\t// }\n\n\t\t\treturn false\n\t\t},\n\t})\n\n\t// This is so that `super` calls will work. We can't replace\n\t// MultiClass.prototype with a Proxy because MultiClass.prototype is\n\t// non-configurable, so it is impossible to wrap it with a Proxy. Instead,\n\t// we stick our own custom Proxy-wrapped prototype object between\n\t// MultiClass.prototype and FirstClass.prototype.\n\tObject.setPrototypeOf(MultiClass.prototype, newMultiClassPrototype)\n\n\treturn MultiClass as unknown as CombinedClasses\n}\n\n// type ConstructorUnionToInstanceTypeUnion = (U extends Constructor\n// ? (k: InstanceType) => void\n// : never) extends (k: infer I) => void\n// ? I\n// : never\n\ntype Shift = ((...args: T) => any) extends (_: any, ...args: infer R) => any ? R : never\ntype MixedArray[]> = _MixedArray\ntype _MixedArray[], U> = {\n\t0: new () => U\n\t1: _MixedArray<\n\t\tShift,\n\t\t{\n\t\t\t[K in keyof InstanceType | keyof U]: K extends keyof U ? U[K] : InstanceType[K]\n\t\t}\n\t>\n}[T['length'] extends 0 ? 0 : 1]\n\ntype CombinedClasses = T extends [] | [undefined]\n\t? typeof Object\n\t: T extends Constructor[]\n\t? MixedArray\n\t: typeof Object\n", "// borrowed from (and slightly modified) https://github.com/Mr0grog/newless\n// The newless license is BSD 3:\n\n// TODO no any types\n\n/*\n * Copyright (c) 2013-2016, Rob Brackett\n * Copyright (c) 2018, Joseph Orbegoso Pea\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n *\n * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport {getFunctionBody, setDescriptor, Constructor} from './utils.js'\n\nexport {newless as native}\n\nexport default newless\n\nvar supportsSpread = isSyntaxSupported('Object(...[{}])')\nvar supportsClass = isSyntaxSupported('class Test {}')\nvar supportsNewTarget = isSyntaxSupported('new.target')\n\n// Used to track the original wrapped constructor on a newless instance\nvar TRUE_CONSTRUCTOR = Symbol ? Symbol('trueConstructor') : '__newlessTrueConstructor__'\n\nvar setPrototype =\n\tObject.setPrototypeOf ||\n\tfunction setPrototypeOf(object, newPrototype) {\n\t\tobject.__proto__ = newPrototype\n\t}\n\n// Polyfill for Reflect.construct\nvar construct =\n\t(Reflect && Reflect.construct) ||\n\t(function () {\n\t\tif (supportsClass) {\n\t\t\treturn Function(\n\t\t\t\t'constructor, args, target',\n\t\t\t\t`\n 'use strict';\n\n if (arguments.length === 3 && typeof target !== 'function')\n throw new TypeError(target + ' is not a constructor');\n\n target = target || constructor;\n\n // extend target so the right prototype is constructed (or nearly the\n // right one; ideally we'd do instantiator.prototype = target.prototype,\n // but a class's prototype property is not writable)\n class instantiator extends target {};\n // but ensure the *logic* is 'constructor' for ES2015-compliant engines\n Object.setPrototypeOf(instantiator, constructor);\n // ...and for Safari 9\n instantiator.prototype.constructor = constructor;\n\n // The spread operator is *dramatically faster, so use it if we can:\n // http://jsperf.com/new-via-spread-vs-dynamic-function/4\n ${\n\t\t\t\t\tsupportsSpread\n\t\t\t\t\t\t? `\n\n var value = new instantiator(...([].slice.call(args)));\n\n `\n\t\t\t\t\t\t: `\n\n // otherwise, create a dynamic function in order to use 'new'\n // Note using 'function.bind' would be simpler, but is much slower:\n // http://jsperf.com/new-operator-with-dynamic-function-vs-bind\n var argList = '';\n for (var i = 0, len = args.length; i < len; i++) {\n if (i > 0) argList += ',';\n argList += 'args[' + i + ']';\n }\n var constructCall = Function('constructor, args',\n 'return new constructor( ' + argList + ' );'\n );\n var value = constructCall(constructor, args);\n\n args = Array.prototype.slice.call(args);\n args = [null].concat(args);\n var value = new constructor.bind.apply(constructor, args);\n\n `\n\t\t\t\t}\n\n // fix up the prototype so it matches the intended one, not one who's\n // prototype is the intended one :P\n Object.setPrototypeOf(value, target.prototype);\n return value;\n `,\n\t\t\t)\n\n\t\t\t//return Function(\"constructor, args, newTarget\", `\n\t\t\t// 'use strict';\n\n\t\t\t// if (arguments.length === 3 && typeof newTarget === undefined)\n\t\t\t// throw new TypeError('undefined is not a constructor');\n\n\t\t\t// newTarget = newTarget || constructor;\n\n\t\t\t// ${ supportsSpread ? `\n\n\t\t\t// var value = new constructor(...([].slice.call(args)));\n\n\t\t\t// `:`\n\n\t\t\t// args = Array.prototype.slice.call(args);\n\t\t\t// args = [null].concat(args);\n\t\t\t// var value = new constructor.bind.apply(constructor, args);\n\n\t\t\t// `}\n\n\t\t\t// Object.setPrototypeOf(value, newTarget.prototype);\n\t\t\t// return value;\n\t\t\t//`);\n\t\t} else {\n\t\t\tvar instantiator = function () {} as any\n\t\t\treturn function construct(constructor: any, args: any, target: any) {\n\t\t\t\tif (arguments.length === 3 && typeof target !== 'function')\n\t\t\t\t\tthrow new TypeError(target + ' is not a constructor')\n\t\t\t\tinstantiator.prototype = (target || constructor).prototype\n\t\t\t\tvar instance = new instantiator()\n\t\t\t\tvar value = constructor.apply(instance, args)\n\t\t\t\tif (typeof value === 'object' && value) {\n\t\t\t\t\t// we can do better if __proto__ is available (in some ES5 environments)\n\t\t\t\t\tvalue.__proto__ = (target || constructor).prototype\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t\treturn instance\n\t\t\t}\n\t\t}\n\t})()\n\n// ES2015 class methods are non-enumerable; we need a helper for copying them.\nvar SKIP_PROPERTIES: (string | symbol)[] = ['arguments', 'caller', 'length', 'name', 'prototype']\nfunction copyProperties(source: any, destination: any) {\n\tif (Object.getOwnPropertyNames && Object.defineProperty) {\n\t\tvar properties: (string | symbol)[] = Object.getOwnPropertyNames(source)\n\t\tif (Object.getOwnPropertySymbols) {\n\t\t\tproperties = properties.concat(Object.getOwnPropertySymbols(source))\n\t\t}\n\t\tfor (var i = properties.length - 1; i >= 0; i--) {\n\t\t\tif (SKIP_PROPERTIES.indexOf(properties[i]) === -1) {\n\t\t\t\tObject.defineProperty(\n\t\t\t\t\tdestination,\n\t\t\t\t\tproperties[i],\n\t\t\t\t\tObject.getOwnPropertyDescriptor(source, properties[i])!,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor (var property in source) {\n\t\t\tdestination[property] = source[property]\n\t\t}\n\t}\n}\n\ntype FuncLikeCtor = {\n\t(): T\n\tnew (): T\n} & S\n\nfunction newless(constructor: T): FuncLikeCtor, T> {\n\tvar name = constructor.name\n\n\t// V8 and newer versions of JSCore return the full class declaration from\n\t// `toString()`, which lets us be a little smarter and more performant\n\t// about what to do, since we know we are dealing with a \"class\". Note,\n\t// however, not all engines do this. This could be false and the constructor\n\t// might still use class syntax.\n\tvar usesClassSyntax = constructor.toString().substr(0, 5) === 'class'\n\n\tvar requiresNew = usesClassSyntax ? true : null\n\n\tvar newlessConstructor: CtorWithLength = (() =>\n\t\tfunction (this: any) {\n\t\t\t// If called with an already valid 'this', preserve that 'this' value\n\t\t\t// in the super-type's constructor whenever possible. With function\n\t\t\t// constructors (as opposed to class constructors), it's possible to\n\t\t\t// alter the instance before calling the super constructor--so it's\n\t\t\t// important to preserve that instance if at all possible.\n\t\t\tif (!requiresNew && this instanceof newlessConstructor) {\n\t\t\t\t// requiresNew = 'false' indicates we know the 'new' operator isn't\n\t\t\t\t// necessary for this constructor, but 'null' indicates uncertainty,\n\t\t\t\t// so the call needs to handle potential errors the first time in\n\t\t\t\t// order to determine whether 'new' is definitely required.\n\t\t\t\tif (requiresNew === false) {\n\t\t\t\t\tconst returnValue = constructor.apply(this, arguments as any)\n\t\t\t\t\treturn (typeof returnValue === 'object' && returnValue) || this\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\trequiresNew = false\n\t\t\t\t\tconst returnValue = constructor.apply(this, arguments as any)\n\t\t\t\t\treturn (typeof returnValue === 'object' && returnValue) || this\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// Do our best to only capture errors triggred by class syntax.\n\t\t\t\t\t// Unfortunately, there's no special error type for this and the\n\t\t\t\t\t// message is non-standard, so this is the best check we can do.\n\t\t\t\t\tif (\n\t\t\t\t\t\terror instanceof TypeError &&\n\t\t\t\t\t\t(/class constructor/i.test(error.message) || /use the 'new' operator/i.test(error.message)) // Custom Elements in Chrome\n\t\t\t\t\t\t// TODO: there might be other error messages we need to catch,\n\t\t\t\t\t\t// depending on engine and use case. We need to test in all browsers\n\t\t\t\t\t) {\n\t\t\t\t\t\t// mark this constructor as requiring 'new' for next time\n\t\t\t\t\t\trequiresNew = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\terror instanceof Error &&\n\t\t\t\t\t\t\t/Illegal constructor/i.test(error.message) &&\n\t\t\t\t\t\t\tObject.create(constructor.prototype) instanceof Node\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t\t`The following error can happen if a Custom Element is called\nwith 'new' before being defined. The constructor was ${constructor.name}: `,\n\t\t\t\t\t\t\t\tconstructor,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthrow error\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// make a reasonably good replacement for 'new.target' which is a\n\t\t\t// syntax error in older engines\n\t\t\tvar newTarget\n\t\t\tvar hasNewTarget = false\n\t\t\tif (supportsNewTarget) {\n\t\t\t\teval('newTarget = new.target')\n\t\t\t\tif (newTarget) hasNewTarget = true\n\t\t\t}\n\t\t\tif (!supportsNewTarget || !hasNewTarget) {\n\t\t\t\tnewTarget = this instanceof newlessConstructor ? this.constructor : constructor\n\t\t\t}\n\t\t\tconst returnValue = construct(constructor, arguments, newTarget)\n\t\t\t// best effort to make things easy for functions inheriting from classes\n\t\t\tif (this instanceof newlessConstructor) {\n\t\t\t\tsetPrototype(this, returnValue)\n\t\t\t}\n\t\t\treturn returnValue\n\t\t})() as unknown as CtorWithLength\n\n\tif (name) {\n\t\tconst code = getFunctionBody(newlessConstructor)\n\n\t\tnewlessConstructor = Function(\n\t\t\t'constructor, construct, setPrototype, requiresNew, supportsNewTarget',\n\t\t\t`\n var newlessConstructor = function ${name}() { ${code} };\n return newlessConstructor\n `,\n\t\t)(constructor, construct, setPrototype, requiresNew, supportsNewTarget)\n\t}\n\n\t// copy the `.length` value to the newless constructor\n\tif (constructor.length) {\n\t\t// length is not writable, only configurable, therefore the value\n\t\t// has to be set with a descriptor update\n\t\tsetDescriptor(newlessConstructor, 'length', {\n\t\t\tvalue: constructor.length,\n\t\t})\n\t}\n\n\tnewlessConstructor.prototype = Object.create(constructor.prototype)\n\tnewlessConstructor.prototype.constructor = newlessConstructor\n\n\t// NOTE: *usually* the below will already be true, but we ensure it here.\n\t// Safari 9 requires this for the 'super' keyword to work. Newer versions\n\t// of WebKit and other engines do not. Instead, they use the constructor's\n\t// prototype chain (which is correct by ES2015 spec) (see below).\n\tconstructor.prototype.constructor = constructor\n\n\t// for ES2015 classes, we need to make sure the constructor's prototype\n\t// is the super class's constructor. Further, optimize performance by\n\t// pointing at the actual constructor implementation instead of the\n\t// newless wrapper (in the case that it is wrapped by newless).\n\t;(newlessConstructor as any)[TRUE_CONSTRUCTOR] = constructor\n\n\tcopyProperties(constructor, newlessConstructor)\n\tsetPrototype(newlessConstructor, constructor)\n\n\treturn newlessConstructor as FuncLikeCtor, T>\n}\n\n// Test whether a given syntax is supported\nfunction isSyntaxSupported(example: string, useStrict = true): boolean {\n\ttry {\n\t\treturn !!Function('', (useStrict ? \"'use strict';\" : '') + example)\n\t} catch (error) {\n\t\treturn false\n\t}\n}\n\ntype CtorWithLength = Constructor<\n\tobject,\n\tany[],\n\t{\n\t\tlength: number\n\t}\n>\n", "import {createComputed} from 'solid-js'\n\n/**\n * Syncs two signals together so that setting one signal's value updates the\n * other, and vice versa, without an infinite loop.\n *\n * Example:\n *\n * ```js\n * const [foo, setFoo] = createSignal(0)\n * const [bar, setBar] = createSignal(0)\n *\n * syncSignals(foo, setFoo, bar, setBar)\n *\n * createEffect(() => console.log(foo(), bar()))\n *\n * setFoo(1) // logs \"1 1\"\n * setBar(2) // logs \"2 2\"\n * ```\n *\n * It returns the getters/setters, so it is possible to also create the signals\n * and sync them at once:\n *\n * ```js\n * const [[foo, setFoo], [bar, setBar]] = syncSignals(...createSignal(0), ...createSignal(0))\n *\n * createEffect(() => console.log(foo(), bar()))\n *\n * setFoo(1) // logs \"1 1\"\n * setBar(2) // logs \"2 2\"\n * ```\n */\nexport function syncSignals(\n\tgetterA: () => T,\n\tsetterA: (value: T) => void,\n\tgetterB: () => T,\n\tsetterB: (value: T) => void,\n) {\n\tlet settingB = false\n\tlet settingA = false\n\n\tcreateComputed(\n\t\t// @ts-ignore not all code paths return\n\t\t() => {\n\t\t\tconst _a = getterA()\n\t\t\tif (settingA) return (settingA = false)\n\t\t\tsettingB = true\n\t\t\tsetterB(_a)\n\t\t},\n\t)\n\n\tcreateComputed(\n\t\t// @ts-ignore not all code paths return\n\t\t() => {\n\t\t\tconst _b = getterB()\n\t\t\tif (settingB) return (settingB = false)\n\t\t\tsettingA = true\n\t\t\tsetterA(_b)\n\t\t},\n\t)\n\n\treturn [[getterA, setterA] as const, [getterB, setterB] as const] as const\n}\n", "import {getInheritedDescriptor} from 'lowclass'\nimport {createSignal, $PROXY, untrack} from 'solid-js'\nimport type {PropKey, PropSpec} from './decorators/types.js'\n\nconst signalifiedProps = new WeakMap>()\n\n/**\n * Convert properties on an object into Solid signal-backed properties.\n *\n * There are two ways to use this: either by defining which properties to\n * convert to signal-backed properties by providing an array as property names\n * in the second arg, which is useful on plain objects, or by passing in `this`\n * and `this.constructor` within the `constructor` of a class that has\n * properties decorated with `@signal`.\n *\n * Example with a class:\n *\n * ```js\n * import {signalify} from 'classy-solid'\n * import {createEffect} from 'solid-js'\n *\n * class Counter {\n * count = 0\n *\n * constructor() {\n * signalify(this, 'count')\n * setInterval(() => this.count++, 1000)\n * }\n * }\n *\n * const counter = new Counter\n *\n * createEffect(() => {\n * console.log('count:', counter.count)\n * })\n * ```\n *\n * Example with a plain object:\n *\n * ```js\n * import {signalify} from 'classy-solid'\n * import {createEffect} from 'solid-js'\n *\n * const counter = {\n * count: 0\n * }\n *\n * signalify(counter, 'count')\n * setInterval(() => counter.count++, 1000)\n *\n * createEffect(() => {\n * console.log('count:', counter.count)\n * })\n * ```\n */\nexport function signalify(obj: T, ...props: (keyof T)[]): T\nexport function signalify(obj: T): T\nexport function signalify(obj: Obj, ...props: [] | [Map] | PropertyKey[]) {\n\t// We cast from PropertyKey[] to PropKey[] because numbers can't actually be keys, only string | symbol.\n\tconst _props = props.length\n\t\t? (props as PropKey[])\n\t\t: (Object.keys(obj) as PropKey[]).concat(Object.getOwnPropertySymbols(obj))\n\n\tfor (const prop of _props) createSignalAccessor(obj, prop)\n\n\treturn obj\n}\n\nlet gotCreateSignalAccessor = false\n\n/**\n * This ensures that `createSignalAccessor` is kept internal to classy-solid only.\n */\nexport function getCreateSignalAccessor() {\n\tif (gotCreateSignalAccessor) throw new Error('Export \"createSignalAccessor\" is internal to classy-solid only.')\n\tgotCreateSignalAccessor = true\n\treturn createSignalAccessor\n}\n\n// propsSetAtLeastOnce is a Set that tracks which reactive properties have been\n// set at least once.\nconst propsSetAtLeastOnce = new WeakMap>()\n\n// @lume/element uses this to detect if a reactive prop has been set, and if so\n// will not overwrite the value with any pre-existing value from custom element\n// pre-upgrade.\nexport function __isPropSetAtLeastOnce(instance: object, prop: string | symbol) {\n\treturn !!propsSetAtLeastOnce.get(instance)?.has(prop)\n}\n\nfunction trackPropSetAtLeastOnce(instance: object, prop: string | symbol) {\n\tif (!propsSetAtLeastOnce.has(instance)) propsSetAtLeastOnce.set(instance, new Set())\n\tpropsSetAtLeastOnce.get(instance)!.add(prop)\n}\n\nconst isSignalGetter = new WeakSet()\n\nfunction createSignalAccessor(\n\tobj: T,\n\tprop: Exclude,\n\t// Untrack here to be extra safe this doesn't count as a dependency and\n\t// cause a reactivity loop.\n\tinitialVal: unknown = untrack(() => obj[prop]),\n\t// If an object already has a particular signalified property, override it\n\t// with a new one anyway (useful for maintaining consistency with class\n\t// inheritance where class fields always override fields from base classes\n\t// due to their [[Define]] semantics). False is a good default for signalify()\n\t// usage where someone is augmenting an existing object, but true is more\n\t// useful with usage of @signal on class fields.\n\t//\n\t// Note that if @signal were to specify this as false, it would cause\n\t// @signal-decorated subclass fields to override base class\n\t// @signal-decorated fields with a new value descriptor but without\n\t// signalifiying the field, effectively disabling reactivity, which is a bug\n\t// (a field decorated with @signal *must* be reactive). The test named\n\t// \"maintains reactivity in subclass overridden fields\" was added to ensure\n\t// that the subclass use case works.\n\toverride = false,\n): void {\n\tif (!override && signalifiedProps.get(obj)?.has(prop)) return\n\n\t// Special case for Solid proxies: if the object is already a solid proxy,\n\t// all properties are already reactive, no need to signalify.\n\t// @ts-expect-error special indexed access\n\tconst proxy = obj[$PROXY] as T\n\tif (proxy) return\n\n\tlet descriptor: PropertyDescriptor | undefined = getInheritedDescriptor(obj, prop)\n\n\tlet originalGet: (() => any) | undefined\n\tlet originalSet: ((v: any) => void) | undefined\n\n\tif (descriptor) {\n\t\toriginalGet = descriptor.get\n\t\toriginalSet = descriptor.set\n\n\t\t// Even if override is true, if we have a signal accessor, there's no\n\t\t// need to replace it with another signal accessor. We only need to\n\t\t// override when the current descriptor is not a signal accessor.\n\t\t// TODO this needs tests.\n\t\tif (originalGet && isSignalGetter.has(originalGet)) return\n\n\t\tif (originalGet || originalSet) {\n\t\t\t// reactivity requires both\n\t\t\tif (!originalGet || !originalSet) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`The \\`@signal\\` decorator was used on an accessor named \"${prop.toString()}\" which had a getter or a setter, but not both. Reactivity on accessors works only when accessors have both get and set. In this case the decorator does not do anything.`,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdelete descriptor.get\n\t\t\tdelete descriptor.set\n\t\t} else {\n\t\t\t// If there was a value descriptor, trust it as the source of truth\n\t\t\t// for initialVal. For example, if the user class modifies the value\n\t\t\t// after the initializer, it will have a different value than what\n\t\t\t// we tracked from the initializer.\n\t\t\tinitialVal = descriptor.value\n\n\t\t\t// if it isn't writable, we don't need to make a reactive variable because\n\t\t\t// the value won't change\n\t\t\tif (!descriptor.writable) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`The \\`@signal\\` decorator was used on a property named \"${prop.toString()}\" that is not writable. Reactivity is not enabled for non-writable properties.`,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdelete descriptor.value\n\t\t\tdelete descriptor.writable\n\t\t}\n\t}\n\n\tconst s = createSignal(initialVal, {equals: false})\n\n\tdescriptor = {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\t...descriptor,\n\t\tget: originalGet\n\t\t\t? function (this: T): unknown {\n\t\t\t\t\ts[0]() // read\n\t\t\t\t\treturn originalGet!.call(this)\n\t\t\t }\n\t\t\t: function (this: any): unknown {\n\t\t\t\t\treturn s[0]() // read\n\t\t\t },\n\t\tset: originalSet\n\t\t\t? function (this: any, newValue: unknown) {\n\t\t\t\t\toriginalSet!.call(this, newValue)\n\n\t\t\t\t\ttrackPropSetAtLeastOnce(this, prop)\n\n\t\t\t\t\t// write\n\t\t\t\t\tif (typeof newValue === 'function') s[1](() => newValue)\n\t\t\t\t\telse s[1](newValue)\n\t\t\t }\n\t\t\t: function (this: any, newValue: unknown) {\n\t\t\t\t\ttrackPropSetAtLeastOnce(this, prop)\n\n\t\t\t\t\t// write\n\t\t\t\t\tif (typeof newValue === 'function') s[1](() => newValue)\n\t\t\t\t\telse s[1](newValue)\n\t\t\t },\n\t}\n\n\tisSignalGetter.add(descriptor.get!)\n\n\tObject.defineProperty(obj, prop, descriptor)\n\n\tif (!signalifiedProps.has(obj)) signalifiedProps.set(obj, new Set())\n\tsignalifiedProps.get(obj)!.add(prop)\n}\n\ntype Obj = Record\n", "import type {PropKey, PropSpec} from './types.js'\n\nlet propsToSignalify = new Map()\nlet accessKey: symbol | null = null\n\n/**\n * Provides a key for accessing internal APIs. If any other module tries to get\n * this, an error will be thrown, and signal and reactive decorators will not\n * work.\n */\nexport function getKey() {\n\tif (accessKey) throw new Error('Attempted use of classy-solid internals.')\n\taccessKey = Symbol()\n\treturn accessKey\n}\n\n/**\n * This function provides propsToSignalify to only one external module\n * (reactive.ts). The purpose of this is to keep the API private for reactive.ts\n * only, otherwise an error will be thrown that breaks signal/reactive\n * functionality.\n */\nexport function getPropsToSignalify(key: symbol) {\n\tif (key !== accessKey) throw new Error('Attempted use of classy-solid internals.')\n\treturn propsToSignalify\n}\n\n/**\n * Only the module that first gets the key can call this function (it should be\n * reactive.ts)\n */\nexport function resetPropsToSignalify(key: symbol) {\n\tif (key !== accessKey) throw new Error('Attempted use of classy-solid internals.')\n\tpropsToSignalify = new Map()\n}\n\nfunction isMemberDecorator(context: DecoratorContext): context is ClassMemberDecoratorContext {\n\treturn !!('private' in context)\n}\n\n/**\n * @decorator\n * Decorate properties of a class with `@signal` to back them with Solid\n * signals, making them reactive. Don't forget that the class in which `@signal`\n * is used must be decorated with `@reactive`.\n *\n * Related: See the Solid.js `createSignal` API for creating signals.\n *\n * Example:\n *\n * ```js\n * import {reactive, signal} from 'classy-solid'\n * import {createEffect} from 'solid-js'\n *\n * ⁣@reactive\n * class Counter {\n * ⁣@signal count = 0\n *\n * constructor() {\n * setInterval(() => this.count++, 1000)\n * }\n * }\n *\n * const counter = new Counter\n *\n * createEffect(() => {\n * console.log('count:', counter.count)\n * })\n * ```\n */\nexport function signal(\n\t_: unknown,\n\tcontext: ClassFieldDecoratorContext | ClassGetterDecoratorContext | ClassSetterDecoratorContext,\n): any {\n\tconst {kind, name} = context\n\tconst props = propsToSignalify\n\n\tif (isMemberDecorator(context)) {\n\t\tif (context.private) throw new Error('@signal is not supported on private fields yet.')\n\t\tif (context.static) throw new Error('@signal is not supported on static fields yet.')\n\t}\n\n\tif (kind === 'field') {\n\t\tprops.set(name, {initialValue: undefined})\n\t\treturn function (this: object, initialValue: unknown) {\n\t\t\tprops.get(name)!.initialValue = initialValue\n\t\t\treturn initialValue\n\t\t}\n\t} else if (kind === 'getter' || kind === 'setter') {\n\t\tprops.set(name, {initialValue: undefined})\n\t} else {\n\t\tthrow new Error(\n\t\t\t'The @signal decorator is only for use on fields, getters, and setters. Auto accessor support is coming next if there is demand for it.',\n\t\t)\n\t}\n\n\t// @prod-prune\n\tqueueReactiveDecoratorChecker(props)\n}\n\nlet checkerQueued = false\n\n/**\n * This throws an error in some cases of an end dev forgetting to decorate a\n * class with `@reactive` if they used `@signal` on that class's fields.\n *\n * This doesn't work all the time, only when the very last class decorated is\n * missing @reactive, but something is better than nothing. There's another\n * similar check performed in the `@reactive` decorator.\n */\nfunction queueReactiveDecoratorChecker(props: Map) {\n\tif (checkerQueued) return\n\tcheckerQueued = true\n\n\tqueueMicrotask(() => {\n\t\tcheckerQueued = false\n\n\t\t// If the refs are still equal, it means @reactive did not run (forgot\n\t\t// to decorate a class that uses @signal with @reactive).\n\t\tif (props === propsToSignalify) {\n\t\t\tthrow new Error(\n\t\t\t\t// Array.from(map.keys()) instead of [...map.keys()] because it breaks in Oculus browser.\n\t\t\t\t`Stray @signal-decorated properties detected: ${Array.from(props.keys()).join(\n\t\t\t\t\t', ',\n\t\t\t\t)}. Did you forget to use the \\`@reactive\\` decorator on a class that has properties decorated with \\`@signal\\`?`,\n\t\t\t)\n\t\t}\n\t})\n}\n", "import type {AnyConstructor} from 'lowclass'\nimport {getListener, untrack} from 'solid-js'\nimport {getKey, getPropsToSignalify, resetPropsToSignalify} from './signal.js'\nimport {getCreateSignalAccessor} from '../signalify.js'\n\n/**\n * Access key for classy-solid private internal APIs.\n */\nconst accessKey = getKey()\n\nconst createSignalAccessor = getCreateSignalAccessor()\nconst hasOwnProperty = Object.prototype.hasOwnProperty\n\n/**\n * A decorator that makes a class reactive, allowing it have properties\n * decorated with `@signal` to make those properties reactive Solid signals.\n *\n * Example:\n *\n * ```js\n * import {reactive, signal} from 'classy-solid'\n * import {createEffect} from 'solid-js'\n *\n * ⁣@reactive\n * class Counter {\n * ⁣@signal count = 0\n *\n * constructor() {\n * setInterval(() => this.count++, 1000)\n * }\n * }\n *\n * const counter = new Counter\n *\n * createEffect(() => {\n * console.log('count:', counter.count)\n * })\n * ```\n */\nexport function reactive(value: AnyConstructor, context: ClassDecoratorContext | undefined): any {\n\t// context may be undefined when unsing reactive() without decorators\n\tif (typeof value !== 'function' || (context && context.kind !== 'class'))\n\t\tthrow new TypeError('The @reactive decorator is only for use on classes.')\n\n\tconst Class = value\n\tconst signalProps = getPropsToSignalify(accessKey)\n\n\t// For the current class decorated with @reactive, we reset the map, so that\n\t// for the next class decorated with @reactive we track only that next\n\t// class's properties that were decorated with @signal. We do this because\n\t// field decorators do not have access to the class or its prototype.\n\t//\n\t// In the future maybe we can use decorator metadata for this\n\t// (https://github.com/tc39/proposal-decorator-metadata)?\n\tresetPropsToSignalify(accessKey)\n\n\tclass ReactiveDecorator extends Class {\n\t\tconstructor(...args: any[]) {\n\t\t\tlet instance!: ReactiveDecorator\n\n\t\t\t// Ensure that if we're in an effect that `new`ing a class does not\n\t\t\t// track signal reads, otherwise we'll get into an infinite loop. If\n\t\t\t// someone want to trigger an effect based on properties of the\n\t\t\t// `new`ed instance, they can explicitly read the properties\n\t\t\t// themselves in the effect, making their intent clear.\n\t\t\tif (getListener()) untrack(() => (instance = Reflect.construct(Class, args, new.target))) // super()\n\t\t\telse super(...args), (instance = this)\n\n\t\t\tfor (const [prop, {initialValue}] of signalProps) {\n\t\t\t\t// @prod-prune\n\t\t\t\tif (!(hasOwnProperty.call(instance, prop) || hasOwnProperty.call(Class.prototype, prop))) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Property \"${prop.toString()}\" not found on instance of class decorated with \\`@reactive\\`. Did you forget to use the \\`@reactive\\` decorator on one of your classes that has a \"${prop.toString()}\" property decorated with \\`@signal\\`?`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\t// For now at least, we always override like class fields with\n\t\t\t\t// [[Define]] semantics. Perhaps when @signal is used on a\n\t\t\t\t// getter/setter, we should not override in that case, but patch\n\t\t\t\t// the prototype getter/setter (that'll be a bit of work to\n\t\t\t\t// implement though).\n\t\t\t\tconst override = true\n\n\t\t\t\tcreateSignalAccessor(instance, prop as Exclude, initialValue, override)\n\t\t\t}\n\n\t\t\treturn instance\n\t\t}\n\t}\n\n\treturn ReactiveDecorator\n}\n", "import {render} from 'solid-js/web'\n// __isPropSetAtLeastOnce was exposed by classy-solid specifically for\n// @lume/element to use. It tells us if a signal property has been set at\n// least once, and if so allows us to skip overwriting it with a custom\n// element preupgrade value.\nimport {__isPropSetAtLeastOnce} from 'classy-solid'\n\nimport type {AttributeHandler} from './attribute'\nimport type {DashCasedProps} from './_utils'\n\n// TODO `templateMode: 'append' | 'replace'`, which allows a subclass to specify\n// if template content replaces the content of `root`, or is appended to `root`.\n\nlet ctor: typeof LumeElement\n\nconst HTMLElement =\n\tglobalThis.HTMLElement ??\n\tclass HTMLElement {\n\t\tconstructor() {\n\t\t\tthrow new Error(\n\t\t\t\t\"@lume/element needs a DOM to operate with! If this code is running during server-side rendering, it means your app is trying to instantiate elements when it shouldn't be, and should be refactored to avoid doing that when no DOM is present.\",\n\t\t\t)\n\t\t}\n\t}\n\n// TODO Make LumeElement `abstract`\n\nclass LumeElement extends HTMLElement {\n\t/**\n\t * The default tag name of the elements this class instantiates. When using\n\t * the `@element` decorator, this property will be set to the value defined\n\t * by the decorator.\n\t */\n\tstatic elementName: string = ''\n\n\t/**\n\t * Define this class for the given element `name`, or using its default name\n\t * (`elementName`) if no `name` given. Defaults to using the global\n\t * `customElements` registry unless another registry is provided (for\n\t * example a ShadowRoot-scoped registry).\n\t *\n\t * If a `name` is given, then the class will be extended with an empty\n\t * subclass so that a new class is used for each new name, because otherwise\n\t * a CustomElementRegistry does not allow the same exact class to be used\n\t * more than once regardless of the name.\n\t *\n\t * @returns Returns the defined element class, which is only going to be a\n\t * different subclass of the class this is called on if passing in a custom\n\t * `name`, otherwise returns the same class this is called on.\n\t */\n\tstatic defineElement(name?: string, registry: CustomElementRegistry = customElements): typeof LumeElement {\n\t\tif (!name) {\n\t\t\tname = this.elementName\n\t\t\tif (registry.get(name)) {\n\t\t\t\tconsole.warn(`defineElement(): An element class was already defined for tag name ${name}.`)\n\t\t\t\treturn this\n\t\t\t}\n\t\t\tregistry.define(name, this)\n\t\t\treturn this\n\t\t} else {\n\t\t\tif (registry.get(name)) {\n\t\t\t\tconsole.warn(`defineElement(): An element class was already defined for tag name ${name}.`)\n\t\t\t\treturn this\n\t\t\t} else {\n\t\t\t\t// Allow the same element to be defined more than once using\n\t\t\t\t// alternative names.\n\t\t\t\tconst Class = class extends this {}\n\t\t\t\tClass.elementName = name\n\t\t\t\tregistry.define(name, Class)\n\t\t\t\treturn Class\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Non-decorator users can use this to specify attributes, which automatically map to reactive properties. */\n\tstatic observedAttributes?: string[] | Record\n\n\t// Note, this is used in the @attribute decorator, see attribute.ts.\n\tprivate declare __attributesToProps?: Record\n\n\tprotected declare _preUpgradeValues: Map\n\n\t// This property MUST be defined before any other non-static non-declared\n\t// class properties . Its initializer needs to run before any other\n\t// properties are defined, in order to detect and handle only instance\n\t// properties that already exist from custom element pre-upgrade time.\n\tprotected ___init___ = (() => {\n\t\tthis.__handleInitialPropertyValuesIfAny()\n\n\t\t// TODO Should we handle initial attributes too?\n\t})()\n\n\tprivate __handleInitialPropertyValuesIfAny() {\n\t\t// We need to delete initial value-descriptor properties (if they exist)\n\t\t// and store the initial values in the storage for our @signal property\n\t\t// accessors.\n\t\t//\n\t\t// If we don't do this, then DOM APIs like cloneNode will create our\n\t\t// node without first upgrading it, and then if someone sets a property\n\t\t// (while our reactive accessors are not yet present in the class\n\t\t// prototype) it means those values will be set as value descriptor\n\t\t// properties on the instance instead of interacting with our accessors\n\t\t// (i.e. the new properties will override our accessors that the\n\t\t// instance will gain on its prototype chain once the upgrade process\n\t\t// places our class prototype in the instance's prototype chain).\n\t\t//\n\t\t// This can also happen if we set properties on an element that isn't\n\t\t// upgraded into a custom element yet, and thus will not yet have our\n\t\t// accessors.\n\t\t//\n\t\t// Assumption: any enumerable own props must've been set on the\n\t\t// element before it was upgraded. Builtin DOM properties are\n\t\t// not enumerable.\n\n\t\tconst preUpgradeKeys = Object.keys(this) as (keyof this)[]\n\t\tthis._preUpgradeValues = new Map()\n\n\t\tfor (const propName of preUpgradeKeys) {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(this, propName)!\n\n\t\t\t// Handle only value descriptors.\n\t\t\tif ('value' in descriptor) {\n\t\t\t\t// Delete the pre-upgrade value descriptor (1/2)...\n\t\t\t\tdelete this[propName]\n\n\t\t\t\t// The @element decorator reads this, and the class finisher\n\t\t\t\t// will set pre-upgrade values.\n\t\t\t\tthis._preUpgradeValues.set(propName, descriptor.value)\n\n\t\t\t\t// NOTE, for classes not decorated with @element, deferring\n\t\t\t\t// allows preexisting preupgrade values to be handled *after*\n\t\t\t\t// class fields have been set during Custom Element upgrade\n\t\t\t\t// construction (otherwise those class fields would override the\n\t\t\t\t// preupgrade values we're trying to assign here).\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tconst propSetAtLeastOnce = __isPropSetAtLeastOnce(this, propName as string | symbol)\n\n\t\t\t\t\t// ... (2/2) and re-assign the value so that it goes through\n\t\t\t\t\t// a @signal accessor that got defined, or through an\n\t\t\t\t\t// inherited accessor that the preupgrade value shadowed.\n\t\t\t\t\t//\n\t\t\t\t\t// If the property has been set between the time LumeElement\n\t\t\t\t\t// constructor ran and the deferred microtask, then we don't\n\t\t\t\t\t// overwrite the property's value with the pre-upgrade value\n\t\t\t\t\t// because it has already been intentionally set to a\n\t\t\t\t\t// desired value post-construction.\n\t\t\t\t\t// (NOTE: Avoid setting properties in constructors because\n\t\t\t\t\t// that will set the signals at least once. Instead,\n\t\t\t\t\t// override with a new @attribute or @signal class field.)\n\t\t\t\t\t//\n\t\t\t\t\t// AND we handle inherited props or signal props only\n\t\t\t\t\t// (because that means there may be an accessor that needs\n\t\t\t\t\t// the value to be passed in). The @element decorator otherwise\n\t\t\t\t\t// handles non-inherited props before construction\n\t\t\t\t\t// finishes. {{\n\t\t\t\t\tif (propSetAtLeastOnce) return\n\n\t\t\t\t\tconst inheritsProperty = propName in (this as any).__proto__\n\t\t\t\t\tif (inheritsProperty) this[propName] = descriptor.value\n\t\t\t\t\t// }}\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\t// We assume a getter/setter descriptor is intentional and meant\n\t\t\t\t// to override or extend our getter/setter so we leave those\n\t\t\t\t// alone. The user is responsible for ensuring they either\n\t\t\t\t// override, or extend, our accessor with theirs.\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * If a subclass provides this, it should return DOM. It is called with\n\t * Solid.js `render()`, so it can also contain Solid.js reactivity (signals\n\t * and effects) and templating (DOM-returning reactive JSX or html template\n\t * literals).\n\t */\n\tprotected declare template?: Template\n\n\t/**\n\t * If provided, this style gets created once per ShadowRoot of each element\n\t * instantiated from this class. The expression can access `this` for string\n\t * interpolation.\n\t */\n\tprotected declare css?: string | (() => string)\n\n\t/**\n\t * If provided, this style gets created a single time for all elements\n\t * instantiated from this class, instead of once per element. If you do not\n\t * need to interpolate values into the string using `this`, then use this\n\t * static property for more performance compared to the instance property.\n\t */\n\tprotected declare static css?: string | (() => string)\n\n\t/**\n\t * When `true`, the custom element will have a `ShadowRoot`. Set to `false`\n\t * to not use a `ShadowRoot`. When `false`, styles will not be scoped via\n\t * the built-in `ShadowRoot` scoping mechanism, but by a much more simple\n\t * shared style sheet placed at the nearest root node, with `:host`\n\t * selectors converted to tag names.\n\t */\n\treadonly hasShadow: boolean = true\n\n\tprivate __root: Node | null = null\n\n\t/**\n\t * Subclasses can override this to provide an alternate Node to render into\n\t * (f.e. a subclass can `return this` to render into itself instead of\n\t * making a root) regardless of the value of `hasShadow`.\n\t */\n\tprotected get root(): Node {\n\t\tif (!this.hasShadow) return this\n\t\tif (this.__root) return this.__root\n\t\tif (this.shadowRoot) return (this.__root = this.shadowRoot)\n\t\t// TODO use `this.attachInternals()` (ElementInternals API) to get the root instead.\n\t\treturn (this.__root = this.attachShadow({mode: 'open'}))\n\t}\n\tprotected set root(v: Node) {\n\t\tif (!this.hasShadow) throw new Error('Can not set root, element.hasShadow is false.')\n\t\t// @prod-prune\n\t\tif (this.__root || this.shadowRoot) throw new Error('Element root can only be set once if there is no ShadowRoot.')\n\t\tthis.__root = v\n\t}\n\n\t/**\n\t * Define which `Node` to append style sheets to when `hasShadow` is `true`.\n\t * Defaults to the `this.root`, which in turn defaults to the element's\n\t * `ShadowRoot`. When `hasShadow` is `true`, an alternate `styleRoot` is\n\t * sometimes needed for styles to be appended elsewhere than the root. For\n\t * example, return some other `Node` within the root to append styles to.\n\t * This is ignored if `hasShadow` is `false`.\n\t *\n\t * This can be useful for fixing issues where the default append of a style\n\t * sheet into the `ShadowRoot` conflicts with how DOM is created in\n\t * `template` (f.e. if the user's DOM creation in `template` clears the\n\t * `ShadowRoot` content, or etc, then we want to place the stylesheet\n\t * somewhere else).\n\t */\n\tprotected get styleRoot(): Node {\n\t\treturn this.root\n\t}\n\n\tattachShadow(options: ShadowRootInit) {\n\t\tif (this.__root) console.warn('Element already has a root defined.')\n\t\treturn (this.__root = super.attachShadow(options))\n\t}\n\n\tprivate declare __dispose?: () => void\n\n\tconnectedCallback() {\n\t\tthis.__setStyle()\n\n\t\tconst template = this.template\n\n\t\t// TODO This needs testing to ensure it works with DOM or the result of JSX alike.\n\t\tif (template)\n\t\t\tthis.__dispose = render(typeof template === 'function' ? template.bind(this) : () => template, this.root)\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.__dispose && this.__dispose()\n\n\t\tthis.__cleanupStyle()\n\t}\n\n\tattributeChangedCallback?(name: string, oldVal: string | null, newVal: string | null): void\n\n\tprivate static __styleRootNodeRefCountPerTagName = new WeakMap>()\n\tprivate __styleRootNode: HTMLHeadElement | ShadowRoot | null = null\n\n\t#defaultHostStyle = (hostSelector: string) => /*css*/ `${hostSelector} {\n\t\tdisplay: block;\n\t}`\n\n\tprivate __setStyle() {\n\t\tctor = this.constructor as typeof LumeElement\n\t\tconst staticCSS = typeof ctor.css === 'function' ? (ctor.css = ctor.css()) : ctor.css || ''\n\t\tconst instanceCSS = typeof this.css === 'function' ? this.css() : this.css || ''\n\n\t\tif (this.hasShadow) {\n\t\t\tconst hostSelector = ':host'\n\t\t\tconst staticStyle = document.createElement('style')\n\n\t\t\tstaticStyle.innerHTML = `\n\t\t\t\t${this.#defaultHostStyle(hostSelector)}\n\t\t\t\t${staticCSS}\n\t\t\t\t${instanceCSS}\n\t\t\t`\n\n\t\t\t// If this element has a shadow root, put the style there. This is the\n\t\t\t// standard way to scope styles to a component.\n\n\t\t\tthis.styleRoot.appendChild(staticStyle)\n\n\t\t\t// TODO use adoptedStyleSheets when that is supported by FF and Safari\n\t\t} else {\n\t\t\t// When this element doesn't have a shadow root, then we want to append the\n\t\t\t// style only once to the rootNode where it lives (a ShadoowRoot or\n\t\t\t// Document). If there are multiple of this same element in the rootNode,\n\t\t\t// then the style will be added only once and will style all the elements\n\t\t\t// in the same rootNode.\n\n\t\t\t// Because we're connected, getRootNode will return either the\n\t\t\t// Document, or a ShadowRoot.\n\t\t\tconst rootNode = this.getRootNode()\n\n\t\t\tthis.__styleRootNode = rootNode === document ? document.head : (rootNode as ShadowRoot)\n\n\t\t\tlet refCountPerTagName = LumeElement.__styleRootNodeRefCountPerTagName.get(this.__styleRootNode)\n\t\t\tif (!refCountPerTagName)\n\t\t\t\tLumeElement.__styleRootNodeRefCountPerTagName.set(this.__styleRootNode, (refCountPerTagName = {}))\n\t\t\tconst refCount = refCountPerTagName[this.tagName] || 0\n\t\t\trefCountPerTagName[this.tagName] = refCount + 1\n\n\t\t\tif (refCount === 0) {\n\t\t\t\tconst hostSelector = this.tagName.toLowerCase()\n\t\t\t\tconst staticStyle = document.createElement('style')\n\n\t\t\t\tstaticStyle.innerHTML = `\n\t\t\t\t\t${this.#defaultHostStyle(hostSelector)}\n\t\t\t\t\t${staticCSS ? staticCSS.replaceAll(':host', hostSelector) : staticCSS}\n\t\t\t\t`\n\n\t\t\t\tstaticStyle.id = this.tagName.toLowerCase()\n\n\t\t\t\tthis.__styleRootNode.appendChild(staticStyle)\n\t\t\t}\n\n\t\t\tif (instanceCSS) {\n\t\t\t\t// For dynamic per-instance styles, make one style element per\n\t\t\t\t// element instance so it contains that element's unique styles,\n\t\t\t\t// associated to a unique attribute selector.\n\t\t\t\tconst id = this.tagName.toLowerCase() + '-' + this.__id\n\n\t\t\t\t// Add the unique attribute that the style selector will target.\n\t\t\t\tthis.setAttribute(id, '')\n\n\t\t\t\t// TODO Instead of creating one style element per custom\n\t\t\t\t// element, we can add the styles to a single style element. We\n\t\t\t\t// can use the CSS OM instead of innerHTML to make it faster\n\t\t\t\t// (but innerHTML is nice for dev mode because it shows the\n\t\t\t\t// content in the DOM when looking in element inspector, so\n\t\t\t\t// allow option for both).\n\t\t\t\tconst instanceStyle = (this.__dynamicStyle = document.createElement('style'))\n\n\t\t\t\tinstanceStyle.id = id\n\t\t\t\tinstanceStyle.innerHTML = instanceCSS.replaceAll(':host', `[${id}]`)\n\n\t\t\t\tconst rootNode = this.getRootNode()\n\n\t\t\t\tthis.__styleRootNode = rootNode === document ? document.head : (rootNode as ShadowRoot)\n\n\t\t\t\tthis.__styleRootNode.appendChild(instanceStyle)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static __elementId = 0\n\tprivate __id = LumeElement.__elementId++\n\tprivate __dynamicStyle: HTMLStyleElement | null = null\n\n\tprivate __cleanupStyle() {\n\t\tdo {\n\t\t\tif (this.hasShadow) break\n\n\t\t\tconst refCountPerTagName = LumeElement.__styleRootNodeRefCountPerTagName.get(this.__styleRootNode!)\n\n\t\t\tif (!refCountPerTagName) break\n\n\t\t\tlet refCount = refCountPerTagName[this.tagName]\n\n\t\t\tif (refCount === undefined) break\n\n\t\t\trefCountPerTagName[this.tagName] = --refCount\n\n\t\t\tif (refCount === 0) {\n\t\t\t\tdelete refCountPerTagName[this.tagName]\n\n\t\t\t\t// TODO PERF Improve performance by saving the style\n\t\t\t\t// instance on a static var, instead of querying for it.\n\t\t\t\tconst style = this.__styleRootNode!.querySelector('#' + this.tagName)\n\t\t\t\tstyle?.remove()\n\t\t\t}\n\t\t} while (false)\n\n\t\tif (this.__dynamicStyle) this.__dynamicStyle.remove()\n\t}\n\n\t// not used currently, but we'll leave this here so that child classes can\n\t// call super, and that way we can add an implementation later when needed.\n\tadoptedCallback() {}\n}\n\n// TODO rename the export to LumeElement in a breaking version bump.\nexport {LumeElement as Element}\n\n// This is TypeScript-specific. Eventually Hegel would like to have better\n// support for JSX. We'd need to figure how to supports types for both systems.\nimport type {JSX} from './jsx-runtime'\ntype JSXOrDOM = JSX.Element | globalThis.Element\ntype TemplateContent = JSXOrDOM | JSXOrDOM[]\ntype Template = TemplateContent | (() => TemplateContent)\n\n/**\n * A helper for defining the JSX types of an element's attributes.\n *\n * You give it your element class and a list of properties (a string\n * union type), and it outputs a type with those properties being\n * optional and dash-cased. The output object also contains all the\n * built-in HTML attributes. You can then augment the\n * JSX.IntrinsicElements definition with the attributes for your element.\n *\n * For example, you would do the following so that your element's attribute\n * are available and type checked in the JSX of any consumers:\n *\n * ```js\n * import {Element, attribute, numberAttribute, element, ElementAttributes} from '@lume/element'\n *\n * \u2063@element('cool-element')\n * class CoolElement extends Element {\n * \u2063@attribute foo: string | null = null\n * \u2063@attribute bar: string | null = 'bar'\n * \u2063@numberAttribute(123) loremIpsum = 123\n * }\n *\n * declare module 'solid-js' {\n * namespace JSX {\n * interface IntrinsicElements {\n * 'cool-element': ElementAttributes\n * }\n * }\n * }\n * ```\n *\n * The result is that TypeScript will properly type-check the following\n * JSX expression (notice lorem-ipsum is dash-case):\n *\n * ```jsx\n * let coolEl = \n * ```\n */\nexport type ElementAttributes<\n\tElementType,\n\tSelectedProperties extends keyof ElementType,\n\tAdditionalProperties extends object = {},\n> = WithStringValues>>> &\n\tAdditionalProperties &\n\tOmit, SelectedProperties | keyof AdditionalProperties>\n\ntype WithStringValues = {\n\t[Property in keyof Type]: Type[Property] extends string ? Type[Property] : Type[Property] | string\n}\n", "// Until decorators land natively, we need this shim so that we can use\n// decorator metadata. https://github.com/microsoft/TypeScript/issues/53461\n\nexport {} // we don't export anything, but this denotes the file as a module to TypeScript\n\ndeclare global {\n\tinterface SymbolConstructor {\n\t\treadonly metadata: unique symbol\n\t}\n}\n\n// @ts-expect-error readonly\nSymbol.metadata ??= Symbol.for('Symbol.metadata')\n", "/**\n * This is an identity \"template string tag function\", which when applied to a\n * template string returns the equivalent of not having used a template tag on\n * a template string to begin with.\n *\n * For example, The following two strings are equivalent:\n *\n * ```js\n * const number = 42\n * const string1 = `meaning of life: ${number}`\n * const string2 = identityTemplateTag`meaning of life: ${number}`\n * ```\n *\n * This can be useful when assigning it to variables like `css` or `html` in\n * order to trigger syntax checking and highlighting inside template strings\n * without actually doing anything to the string (a no-op).\n */\nexport function identityTemplateTag(stringsParts: TemplateStringsArray, ...values: any[]): string {\n\t// unfortunately, it does incur some unnecessary runtime overhead in order to\n\t// receive the string parts and the interpolated values and concatenate them\n\t// all together into the same string as if we hadn't used a template tag.\n\n\tlet str = ''\n\n\tfor (let i = 0; i < values.length; i++) str += stringsParts[i] + String(values[i])\n\n\treturn str + stringsParts[stringsParts.length - 1]\n}\n\nexport function camelCaseToDash(str: string): string {\n\treturn str.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase()\n}\n\nexport function dashCaseToCamelCase(str: string) {\n\treturn str.replace(/-([a-z])/g, g => g[1].toUpperCase())\n}\n\nexport function defineProp(obj: any, prop: string, value: any) {\n\tObject.defineProperty(obj, prop, {\n\t\tvalue,\n\t\twritable: true,\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t})\n}\n\n// TYPES\n\n// https://github.com/type-challenges/type-challenges/issues/9116\n// More solutions at https://github.com/type-challenges/type-challenges/tree/main/questions/00114-hard-camelcase\n//\n// bug, fooBar becomes foobar, https://github.com/type-challenges/type-challenges/issues/9116#issuecomment-1107928665\n// export type JoinToCamelCase<\n// \tS extends string,\n// \tSep extends string = '-',\n// \tR extends string = '',\n// > = S extends `${infer First}${Sep}${infer Rest}`\n// \t? R extends ''\n// \t\t? JoinToCamelCase, Sep, `${R}${Lowercase}`>\n// \t\t: JoinToCamelCase, Sep, `${R}${Capitalize}`>\n// \t: R extends ''\n// \t? Lowercase\n// \t: `${R}${Capitalize}`\n//\nexport type JoinToCamelCase<\n\tS extends string,\n\tSep extends string = '-',\n\tUPPER extends boolean = false,\n\tRes extends string = '',\n> = S extends `${infer L}${infer R}`\n\t? L extends Sep\n\t\t? JoinToCamelCase\n\t\t: UPPER extends true\n\t\t? JoinToCamelCase}`>\n\t\t: JoinToCamelCase}`>\n\t: Res\n\n// https://github.com/type-challenges/type-challenges/issues/9098\n// More solutions at https://github.com/type-challenges/type-challenges/blob/main/questions/00612-medium-kebabcase/README.md\n//\n// export type SplitCamelCase<\n// \tS extends string,\n// \tSep extends string = '-',\n// \tisFirstChar = true,\n// > = S extends `${infer s}${infer right}`\n// \t? s extends Lowercase\n// \t\t? `${s}${SplitCamelCase}`\n// \t\t: isFirstChar extends true\n// \t\t? `${Lowercase}${SplitCamelCase}`\n// \t\t: `${Sep}${Lowercase}${SplitCamelCase}`\n// \t: S\n//\n//\n//\n// type FirstLowcase = T extends `${infer F}${infer R}`\n// \t? F extends Lowercase\n// \t\t? T\n// \t\t: `${Lowercase}${R}`\n// \t: T\n// type SplitCamelCase = S extends `${infer F}${infer R}`\n// \t? R extends FirstLowcase\n// \t\t? `${FirstLowcase}${SplitCamelCase}`\n// \t\t: `${FirstLowcase}${Sep}${SplitCamelCase, Sep>}`\n// \t: S\n//\n//\n//\n// type SplitCamelCase = S extends `${infer First}${infer Rest}`\n// \t? Rest extends Uncapitalize\n// \t\t? `${Uncapitalize}${SplitCamelCase}`\n// \t\t: `${Uncapitalize}${Sep}${SplitCamelCase}`\n// \t: S\n//\n//\n//\n// prettier-ignore\ntype KebabMap = { A: \"a\", B: \"b\", C: \"c\", D: \"d\", E: \"e\", F: \"f\", G: \"g\", H: \"h\", I: \"i\", J: \"j\", K: \"k\", L: \"l\", M: \"m\", N: \"n\", O: \"o\", P: \"p\", Q: \"q\", R: \"r\", S: \"s\", T: \"t\", U: \"u\", V: \"v\", W: \"w\", X: \"x\", Y: \"y\", Z: \"z\", }\ntype SplitCamelCase<\n\tS extends string,\n\tSep extends string = '-',\n\tU extends string = '',\n> = S extends `${infer Target}${infer R}`\n\t? Target extends keyof KebabMap\n\t\t? U extends ''\n\t\t\t? SplitCamelCase\n\t\t\t: SplitCamelCase\n\t\t: SplitCamelCase\n\t: U\n\nexport type CamelCasedProps = {\n\t[K in keyof T as JoinToCamelCase, '-'>]: T[K]\n}\n\nexport type DashCasedProps = {\n\t[K in keyof T as SplitCamelCase, '-'>]: T[K]\n}\n\n// EXAMPLES\n// type foo0 = JoinToCamelCase<'fooBarBaz'> // Becomes \"foobabaz\"\n// type foo3 = JoinToCamelCase<'foo-bar-baz'> // Becomes \"fooBarBaz\"\n// type foo5 = JoinToCamelCase<'foo bar baz', ' '> // Becomes \"fooBarBaz\"\n// type foo6 = JoinToCamelCase<'foo_bar_baz', '_'> // Becomes \"fooBarBaz\"\n// type foo14 = JoinToCamelCase<'foo:bar:baz', ':'> // Becomes \"fooBarBaz\"\n// type foo4 = JoinToCamelCase<'foobarbaz'> // the same\n// type foo7 = SplitCamelCase<'fooBar'> // Becomes \"foo-bar\"\n// type foo12 = SplitCamelCase<'fooBar', '_'> // Becomes \"foo_bar\"\n// type foo13 = SplitCamelCase<'fooBar', ' '> // Becomes \"foo bar\"\n// type foo11 = SplitCamelCase<'foo-bar'> // the same\n// type foo8 = SplitCamelCase<'foo bar'> // the same\n// type foo9 = SplitCamelCase<'foo_bar'> // the same\n// type foo10 = SplitCamelCase<'foobar'> // the same\n// type t = Join<['foo', 'bar'], ':'> // Becomes \"foo:bar\"\n//\n// interface KebabCased {\n// \"foo-bar\": string;\n// foo: number;\n// }\n// type CamelCased = CamelCasedProps;\n// Becomes\n// {\n// fooBar: string;\n// foo: number;\n// }\n", "import './metadata-shim.js' // TODO remove this shim once decorators land natively.\nimport {signal} from 'classy-solid'\nimport {camelCaseToDash, defineProp} from './_utils.js'\nimport type {ElementCtor} from './element.js'\nimport type {PropKey} from 'classy-solid/dist/decorators/types.js'\n\nexport const __classFinishers: ((Class: ElementCtor) => void)[] = []\n\ntype AttributeDecoratorContext = ClassFieldDecoratorContext | ClassGetterDecoratorContext | ClassSetterDecoratorContext\n\n/**\n * A decorator that when used on a property or accessor causes an HTML attribute\n * with the same name (but dash-cased instead of camelCased) to be mapped to the\n * decorated property. For example, if the `@attribute` decorator is used on a\n * property called `firstName`, then an attribute called `first-name` will be\n * mapped to the property. Any time that the attribute value changes (f.e. with\n * `el.setAttribute`), the attribute value will propgate to the property a\n * trigger an update.\n *\n * The decorated property is backed by a Solid.js signal, thus useful in effects\n * or templates.\n *\n * Example:\n *\n * ```js\n * \u2063@element('my-el')\n * class MyEl extends Element {\n * \u2063@attribute name = 'Lazayah'\n *\n * template = () =>

Name: {this.name}

\n * }\n * ```\n */\nexport function attribute(handler?: AttributeHandler): (value: unknown, context: AttributeDecoratorContext) => any\nexport function attribute(value: unknown, context: AttributeDecoratorContext): any\nexport function attribute(handlerOrValue: AttributeHandler | unknown, context?: AttributeDecoratorContext) {\n\t// if used as a decorator directly with no options\n\tif (arguments.length === 2) return handleAttributeDecoration(handlerOrValue, context!, undefined)\n\n\t// otherwise used as a decorator factory, possibly being passed options, like `@attribute({...})`\n\tconst handler = handlerOrValue as AttributeHandler | undefined\n\treturn (value: unknown, context: AttributeDecoratorContext): any => handleAttributeDecoration(value, context, handler)\n\n\t// TODO throw an error for cases when @element is not used on a class with @attribute decorations, similar to classy-solid @signal/@reactive.\n}\n\n/**\n * Place this decorator before `@element` to avoid the property from being\n * backed by a Solid signal. I.e. the property will not be reactive, but will\n * still receive values from the HTML attribute.\n */\nexport const noSignal = (_value: unknown, context: AttributeDecoratorContext) => {\n\tif (!Object.hasOwn(context.metadata, 'noSignal')) context.metadata.noSignal = new Set()\n\t;(context.metadata.noSignal as Set).add(context.name)\n}\n\nfunction handleAttributeDecoration(\n\tvalue: unknown,\n\tcontext: AttributeDecoratorContext,\n\tattributeHandler: AttributeHandler = {},\n) {\n\tconst {kind, name, private: isPrivate, static: isStatic, metadata} = context\n\t// Check only own metadata.noSignal, we don't want to use the one inherited from a base class.\n\tconst noSignal = (Object.hasOwn(metadata, 'noSignal') && (metadata.noSignal as Set)) || undefined\n\tconst useSignal = !noSignal?.has(name)\n\n\tif (typeof name === 'symbol') throw new Error('@attribute is not supported on symbol fields yet.')\n\tif (isPrivate) throw new Error('@attribute is not supported on private fields yet.')\n\tif (isStatic) throw new Error('@attribute is not supported on static fields.')\n\n\t// TODO decorate on prototype? Or decorate on instance?\n\t__classFinishers.push((Class: ElementCtor) => __setUpAttribute(Class, name, attributeHandler))\n\n\tif (kind === 'field') {\n\t\tconst signalInitializer = useSignal ? signal(value, context) : (v: unknown) => v\n\n\t\treturn function (this: object, initialValue: unknown) {\n\t\t\tinitialValue = signalInitializer(initialValue)\n\n\t\t\t// Typically the first initializer to run for a class field (on\n\t\t\t// instantiation of the first instance of its class) will be our\n\t\t\t// source of truth for our default attribute value, but we check for\n\t\t\t// 'default' in attributeHandler just in case that a an attribute\n\t\t\t// decorator was passed an explicit default, f.e.\n\t\t\t// `@attribute({default: 123})`.\n\t\t\tif (!('default' in attributeHandler)) attributeHandler.default = initialValue\n\n\t\t\treturn initialValue\n\t\t}\n\t} else if (kind === 'getter' || kind === 'setter') {\n\t\tif (useSignal) signal(value, context)\n\t} else {\n\t\tthrow new Error(\n\t\t\t'@attribute is only for use on fields, getters, and setters. Auto accessor support is coming next if there is demand for it.',\n\t\t)\n\t}\n\n\treturn undefined // shush TS\n}\n\n// TODO Do similar as with the following attributeChangedCallback prototype\n// patch, but also with (dis)connected callbacks which can call an instance's\n// template method, so users don't have to extend from the LumeElement base class.\n// Extending from the LumeElement base class will be the method that non-decorator\n// users must use.\n\nexport function __setUpAttribute(ctor: ElementCtor, propName: string, attributeHandler: AttributeHandler): any {\n\tif (\n\t\t//\n\t\t!ctor.observedAttributes ||\n\t\t!ctor.hasOwnProperty('observedAttributes')\n\t) {\n\t\tconst inheritedAttrs = ctor.__proto__.observedAttributes\n\n\t\t// @prod-prune\n\t\tif (inheritedAttrs && !Array.isArray(inheritedAttrs)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'observedAttributes is in the wrong format. Did you forget to decorate your custom element class with the `@element` decorator?',\n\t\t\t)\n\t\t}\n\n\t\tdefineProp(ctor, 'observedAttributes', [...(inheritedAttrs || [])])\n\t}\n\n\t// @prod-prune\n\tif (!Array.isArray(ctor.observedAttributes)) {\n\t\tthrow new TypeError(\n\t\t\t'observedAttributes is in the wrong format. Maybe you forgot to decorate your custom element class with the `@element` decorator.',\n\t\t)\n\t}\n\n\tconst attrName = camelCaseToDash(propName)\n\n\tif (!ctor.observedAttributes!.includes(attrName)) ctor.observedAttributes!.push(attrName)\n\n\tmapAttributeToProp(ctor.prototype, attrName, propName, attributeHandler)\n}\n\n// TODO this stores attributes as an inheritance chain on the constructor. It'd\n// be more fool-proof (not publicly exposed) to store attribute-prop mappings in\n// WeakMaps, but then we'd need to implement our own inheritance\n// (prototype-like) lookup for the attributes.\nfunction mapAttributeToProp(prototype: any, attr: string, prop: string, attributeHandler: AttributeHandler): void {\n\t// Only define attributeChangedCallback once.\n\tif (!prototype.__hasAttributeChangedCallback) {\n\t\tprototype.__hasAttributeChangedCallback = true\n\n\t\tconst originalAttrChanged = prototype.attributeChangedCallback\n\n\t\tprototype.attributeChangedCallback = function (attr: string, oldVal: string | null, newVal: string | null) {\n\t\t\t// If the class already has an attributeChangedCallback, let is run,\n\t\t\t// and let it call or not call super.attributeChangedCallback.\n\t\t\tif (originalAttrChanged) {\n\t\t\t\toriginalAttrChanged.call(this, attr, oldVal, newVal)\n\t\t\t}\n\t\t\t// Otherwise, let's not intentionally break inheritance and be sure\n\t\t\t// we call the super method (if it exists).\n\t\t\telse {\n\t\t\t\t// This is equivalent to `super.attributeChangedCallback?()`\n\t\t\t\tprototype.__proto__?.attributeChangedCallback?.call(this, attr, oldVal, newVal)\n\t\t\t}\n\n\t\t\t// map from attribute to property\n\t\t\tconst prop = this.__attributesToProps && this.__attributesToProps[attr]\n\n\t\t\tif (prop) {\n\t\t\t\tconst handler = prop.attributeHandler\n\t\t\t\t// prettier-ignore\n\t\t\t\tthis[prop.name] = !handler\n\t\t\t\t\t? newVal\n\t\t\t\t\t: newVal === null // attribute removed\n\t\t\t\t\t\t? 'default' in handler\n\t\t\t\t\t\t\t? handler.default\n\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t: handler.from\n\t\t\t\t\t\t\t? handler.from(newVal)\n\t\t\t\t\t\t\t: newVal\n\t\t\t}\n\t\t}\n\t}\n\n\t// Extend the current prototype's __attributesToProps object from the super\n\t// prototype's __attributesToProps object.\n\t//\n\t// We use inheritance here or else all classes would pile their\n\t// attribute-prop definitions on a shared base class (they can clash,\n\t// override each other willy nilly and seemingly randomly).\n\tif (!prototype.hasOwnProperty('__attributesToProps')) {\n\t\t// using defineProperty so that it is non-writable, non-enumerable, non-configurable\n\t\tObject.defineProperty(prototype, '__attributesToProps', {\n\t\t\tvalue: {\n\t\t\t\t__proto__: prototype.__attributesToProps || Object.prototype,\n\t\t\t},\n\t\t})\n\t}\n\n\tprototype.__attributesToProps![attr] = {name: prop, attributeHandler}\n}\n\n/**\n * Defines how values are mapped from an attribute to a JS property on a custom\n * element class.\n */\nexport type AttributeHandler = {\n\t// TODO `to` handler currently does nothing. If it is present, then prop\n\t// changes should reflect back to the attribute. This will add a performance\n\t// hit.\n\tto?: (propValue: T) => string | null\n\n\t/**\n\t * Define how to deserialize an attribute string value on its way to the\n\t * respective JS property.\n\t *\n\t * If not defined, the attribute string value is passed to the JS property\n\t * untouched.\n\t */\n\tfrom?: (AttributeValue: string) => T\n\n\t/**\n\t * The default value that the respective JS property should have when the\n\t * attribute is removed.\n\t *\n\t * When defined, an attribute's respective JS property will be set to this\n\t * value when the attribute is removed. If not defined, then the JS property\n\t * will receive `null` when the attribute is removed, just like\n\t * `attributeChangedCallback` does.\n\t */\n\tdefault?: T\n}\n\ntype AttributeType = () => AttributeHandler\n\nconst toString = (str: string) => str\n\n/**\n * An attribute type for use in the object form of `static observedAttributes`\n * when not using decorators.\n *\n * Example usage without decorators:\n *\n * ```js\n * element('my-el')(\n * class MyEl extends LumeElement {\n * static observedAttributes = {\n * name: attribute.string()\n * }\n *\n * name = \"honeybun\" // default value when attribute removed\n * }\n * )\n * ```\n */\nattribute.string = (() => ({from: toString})) as AttributeType\n\n/**\n * This is essentially an alias for `@attribute`. You can just use `@attribute`\n * if you want a more concise definition.\n *\n * A decorator for mapping a string-valued attribute to a JS property. All\n * attribute values get passed as-is, except for `null` (i.e. when an attribute\n * is removed) which gets converted into an empty string or the default value of\n * the class field. The handling of `null` (on attribute removed) is the only\n * difference between this and plain `@attribute`, where `@attribute` will pass\n * along `null`.\n *\n * Example decorator usage:\n *\n * ```js\n * \u2063@element('my-el')\n * class MyEl extends LumeElement {\n * \u2063@stringAttribute color = \"skyblue\"\n * }\n * ```\n *\n * Example HTML attribute usage:\n *\n * ```html\n * \n * \n *\n * \n * \n *\n * \n * \n *\n * \n * \n *\n * \n * \n * ```\n */\nexport function stringAttribute(value: unknown, context: AttributeDecoratorContext) {\n\treturn attribute(attribute.string())(value, context)\n}\n\nconst toNumber = (str: string) => +str\n\n/**\n * An attribute type for use in the object form of `static observedAttributes`\n * when not using decorators.\n *\n * Example usage without decorators:\n *\n * ```js\n * element('my-el')(\n * class MyEl extends LumeElement {\n * static observedAttributes = {\n * money: attribute.number()\n * }\n *\n * money = 1000 // default value when attribute removed\n * }\n * )\n * ```\n */\nattribute.number = (() => ({from: toNumber})) as AttributeType\n\n/**\n * A decorator for mapping a number attribute to a JS property. The string value\n * of the attribute will be parsed into a number.\n *\n * Example decorator usage:\n *\n * ```js\n * \u2063@element('my-el')\n * class MyEl extends LumeElement {\n * \u2063@numberAttribute money = 123\n * }\n * ```\n *\n * Example HTML attribute usage:\n *\n * ```html\n * \n * \n *\n * \n * \n *\n * \n * \n *\n * \n * \n *\n * \n * \n *\n * \n * \n *\n * \n * \n * ```\n */\nexport function numberAttribute(value: unknown, context: AttributeDecoratorContext) {\n\treturn attribute(attribute.number())(value, context)\n}\n\nconst toBoolean = (str: string) => str !== 'false'\n\n/**\n * An attribute type for use in the object form of `static observedAttributes`\n * when not using decorators.\n *\n * Example usage without decorators:\n *\n * ```js\n * element('my-el')(\n * class MyEl extends LumeElement {\n * static observedAttributes = {\n * hasCash: attribute.boolean()\n * }\n *\n * hasCash = true // default value when attribute removed\n * }\n * )\n * ```\n */\nattribute.boolean = (() => ({from: toBoolean})) as AttributeType\n\n/**\n * A decorator for mapping a boolean attribute to a JS property. The string\n * value of the attribute will be converted into a boolean value on the JS\n * property. A string value of `\"false\"` and a value of `null` (attribute\n * removed) will be converted into a `false` value on the JS property. All other\n * attribute values (strings) will be converted into `true`.\n *\n * Example decorator usage:\n *\n * ```js\n * \u2063@element('my-el')\n * class MyEl extends LumeElement {\n * \u2063@booleanAttribute hasMoney = true\n * \u2063@booleanAttribute excited = false\n * }\n * ```\n *\n * Example HTML attribute usage:\n *\n * ```html\n * \n * \n *\n * \n * \n *\n * \n * \n *\n * \n * \n *\n * \n * \n *\n * \n * \n * ```\n */\nexport function booleanAttribute(value: unknown, context: AttributeDecoratorContext) {\n\treturn attribute(attribute.boolean())(value, context)\n}\n", "import './metadata-shim.js'\nimport {untrack} from 'solid-js'\nimport {reactive, signalify} from 'classy-solid'\nimport {Element} from './LumeElement.js'\nimport {__classFinishers, __setUpAttribute} from './attribute.js'\n\nimport type {AnyConstructor} from 'lowclass'\nimport type {DecoratedValue, PropKey} from 'classy-solid/dist/decorators/types.js'\nimport type {AttributeHandler} from './attribute.js'\n\ntype PossibleStatics = {\n\tobservedAttributes?: string[] | Record\n\telementName?: string\n\t__proto__: PossibleStatics // used in attribute.ts\n}\nexport type ElementCtor = typeof Element & PossibleStatics\n\n/**\n * A class decorator that defines the target class as a custom element with the\n * given `tagName`. The `tagName` must contain a hyphen, as per standard Custom\n * Element rules.\n *\n * If called with a name, it defines a custom element with that name automatically:\n *\n * ```js\n * \u2063@element('cool-element')\n * class CoolElement extends HTMLElement {\n * // ...\n * }\n *\n * document.body.append(document.createElement('cool-element'))\n * ```\n *\n * If called the second arg set to false, then the element definition should be manually triggered:\n *\n * ```js\n * \u2063@element('cool-element', false)\n * class CoolElement extends HTMLElement {\n * // ...\n * }\n *\n * // Using the class's default name:\n * CoolElement.defineElement()\n *\n * // Or using a different name:\n * CoolElement.defineElement('awesome-element')\n *\n * document.body.append(document.createElement('cool-element'))\n * ```\n *\n * Sometimes you may not want to define a name for the element,\n * however the decorator is still needed for key functionality. In\n * this case use the decorator without calling it first, then you can\n * manually define the element in another way as needed:\n *\n * ```js\n * \u2063@element\n * class CoolElement extends HTMLElement {\n * // ...\n * }\n *\n * // ...Manually define it at some point after making the class...\n * CoolElement.defineElement('cool-element')\n *\n * // Or:\n * customElements.define('cool-element', CoolElement)\n *\n * // But not the following (runtime error due to no name being defined):\n * CoolElement.defineElement()\n *\n * document.body.append(document.createElement('cool-element'))\n * ```\n *\n * If you call it with an empty string, it behaves the same as the previous example:\n *\n * ```js\n * \u2063@element('')\n * class CoolElement extends HTMLElement {...}\n *\n * // is the same as\n *\n * \u2063@element\n * class CoolElement extends HTMLElement {...}\n * ```\n */\nexport function element(\n\ttagName: string,\n\tautoDefine?: boolean,\n): >(Class: T, context?: ClassDecoratorContext) => T\nexport function element>(Class: T, context?: ClassDecoratorContext): T\nexport function element(\n\ttagNameOrClass: string | AnyConstructor,\n\tautoDefineOrContext?: boolean | ClassDecoratorContext,\n): any {\n\tlet tagName = ''\n\tlet autoDefine = !!(autoDefineOrContext ?? true)\n\n\t// when called as a decorator factory, f.e. `@element('foo-bar') class MyEl ...` or `element('my-el')(class MyEl ...)`\n\tif (typeof tagNameOrClass === 'string') {\n\t\ttagName = tagNameOrClass\n\t\treturn (Class: AnyConstructor, context: ClassDecoratorContext) => {\n\t\t\treturn applyElementDecoration(Class, context, tagName, autoDefine)\n\t\t}\n\t}\n\n\t// Otherwise `@element class MyEl ...` or `element(class MyEl ...)`\n\tautoDefine = false\n\tconst Class = tagNameOrClass\n\tconst context = autoDefineOrContext as DecoratorContext | undefined\n\treturn applyElementDecoration(Class, context, tagName, autoDefine)\n}\n\nfunction applyElementDecoration(\n\tClass: DecoratedValue,\n\tcontext: DecoratorContext | undefined,\n\ttagName: string,\n\tautoDefine: boolean,\n): any {\n\tif (typeof Class !== 'function' || (context && context.kind !== 'class'))\n\t\tthrow new Error('@element is only for use on classes.')\n\n\tconst {metadata = {}} = context ?? {} // context may be undefined with plain-JS element() usage.\n\t// Check only own metadata.noSignal, we don't want to use the one inherited from a base class.\n\tconst noSignal = (Object.hasOwn(metadata, 'noSignal') && (metadata.noSignal as Set)) || undefined\n\n\tlet Ctor = Class as ElementCtor\n\tconst attrs = Ctor.observedAttributes\n\n\tif (Ctor.hasOwnProperty('elementName')) tagName = Ctor.elementName || tagName\n\telse Ctor.elementName = tagName\n\n\tif (Array.isArray(attrs)) {\n\t\t// Nothing to do here: either the user provided a regular\n\t\t// observedAttributes array like with plain Custom Elements, or\n\t\t// they used our decorators which happen to create the array for\n\t\t// them.\n\t} else if (attrs && typeof attrs === 'object') {\n\t\t// When we're not using decorators, our users have the option to\n\t\t// provide an observedAttributes object (instead of the usual\n\t\t// array) to specify attribute types. In this case, we need to\n\t\t// track the types, and convert observedAttributes to an array so\n\t\t// the browser will understand it like usual.\n\n\t\t// Delete it, so that it will be re-created as an array by the\n\t\t// following _setUpAttribute calls.\n\t\tCtor.observedAttributes = undefined\n\n\t\tfor (const prop in attrs) __setUpAttribute(Ctor, prop, attrs[prop])\n\t}\n\n\t// We need to compose with @reactive so that it will signalify any @signal properties.\n\tCtor = reactive(Ctor, context)\n\n\tclass ElementDecorator extends Ctor {\n\t\tconstructor(...args: any[]) {\n\t\t\t// @ts-expect-error we don't know what the user's args will be, just pass them all.\n\t\t\tsuper(...args)\n\n\t\t\t// Untrack to be sure we don't cause dependencies during creation of\n\t\t\t// objects (super() is already untracked by the reactive decorator).\n\t\t\tuntrack(() => {\n\t\t\t\thandlePreUpgradeValues(this)\n\n\t\t\t\tconst propsToSignalify: (keyof this)[] = []\n\t\t\t\tconst attrsToProps =\n\t\t\t\t\t// @ts-expect-error private access\n\t\t\t\t\tElementDecorator.prototype.__attributesToProps ?? {}\n\n\t\t\t\tfor (const propSpec of Object.values(attrsToProps)) {\n\t\t\t\t\tconst prop = propSpec.name as keyof this\n\t\t\t\t\tconst useSignal = !noSignal?.has(prop as PropKey)\n\n\t\t\t\t\t// CONTINUE this is for non-deco usage, so decos should work without this (currently breaks if commented out because decos unintentionally rely on it, but decos should work only with the @signal composition)\n\t\t\t\t\tif (useSignal) propsToSignalify.push(prop)\n\n\t\t\t\t\tconst handler = propSpec.attributeHandler\n\n\t\t\t\t\t// Default values for fields are handled in their initializer,\n\t\t\t\t\t// and this catches default values for getters/setters.\n\t\t\t\t\tif (handler && !('default' in handler)) handler.default = this[prop]\n\t\t\t\t}\n\n\t\t\t\t// This is signalifying any attribute props that may have been\n\t\t\t\t// defined in `static observedAttribute` rather than with @attribute\n\t\t\t\t// decorator (which composes @signal), so that we also cover\n\t\t\t\t// non-decorator usage until native decorators are out.\n\t\t\t\t//\n\t\t\t\t// Note, `signalify()` returns early if a property was already\n\t\t\t\t// signalified by @attribute (@signal), so this isn't going to\n\t\t\t\t// double-signalify.\n\t\t\t\t//\n\t\t\t\t// TODO: Once native decorators are out, remove this, and remove\n\t\t\t\t// non-decorator usage because everyone will be able to use\n\t\t\t\t// decorators. We can also then delete `noSignal` from `metadata`\n\t\t\t\t// here in the class as it is no longer needed at class\n\t\t\t\t// instantiation time.\n\t\t\t\t//\n\t\t\t\t// Having to duplicate keys in observedAttributes as well as class\n\t\t\t\t// fields is more room for human error, so it'll be nice to remove\n\t\t\t\t// non-decorator usage.\n\t\t\t\tif (propsToSignalify.length) signalify(this, ...propsToSignalify)\n\t\t\t})\n\t\t}\n\t}\n\n\tconst classFinishers = [...__classFinishers]\n\t__classFinishers.length = 0\n\n\tfunction finishClass() {\n\t\tfor (const finisher of classFinishers) finisher(ElementDecorator)\n\n\t\tif (tagName && autoDefine) customElements.define(tagName, ElementDecorator)\n\t}\n\n\tif (context?.addInitializer) {\n\t\t// Use addInitializer to run logic after the class is fully defined\n\t\t// (after class static initializers have ran, otherwise the class\n\t\t// decorator runs before any static members are initialized)\n\t\tcontext.addInitializer(finishClass)\n\t} else {\n\t\t// For JS without decorator support fall back manually running the\n\t\t// initializer because `context` will be `undefined` in that scenario,\n\t\t// so there won't be a `context.addInitializer` function to call.\n\t\t// In this case all static members are already initialized too.\n\t\t//\n\t\t// TODO: Once decorators are out natively, deprecate and remove this\n\t\t// non-decorator support\n\t\tfinishClass()\n\t}\n\n\treturn ElementDecorator\n}\n\nfunction handlePreUpgradeValues(self: HTMLElement) {\n\tif (!(self instanceof Element)) return\n\n\t// @ts-expect-error, protected access is ok\n\tfor (const [key, value] of self._preUpgradeValues) {\n\t\t// If the key is missing, it has already been handled, continue.\n\t\tif (!(key in self)) continue\n\n\t\t// Untrack the pre-upgrade value so that a subclass\n\t\t// of this class won't re-run this same logic again.\n\t\t// TODO needs testing.\n\t\t// @ts-expect-error, protected access is ok\n\t\tself._preUpgradeValues.delete(key)\n\n\t\t// Unshadow any possible inherited accessor only if\n\t\t// there is not an accessor. If there is an accessor it\n\t\t// handles inheritance its own way.\n\t\tconst desc = Object.getOwnPropertyDescriptor(self, key)\n\t\tif (desc && 'value' in desc) {\n\t\t\t// @ts-expect-error dynamic decorator stuff, has no impact on user types.\n\t\t\tdelete self[key]\n\t\t}\n\n\t\t// Set the pre-upgrade value (allowing any inherited\n\t\t// accessor to operate on it).\n\t\t// @ts-expect-error dynamic decorator stuff, has no impact on user types.\n\t\tself[key] = value\n\t}\n}\n", "import { $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js';\n\nconst $RAW = Symbol(\"store-raw\"),\n $NODE = Symbol(\"store-node\"),\n $HAS = Symbol(\"store-has\"),\n $SELF = Symbol(\"store-self\");\nfunction wrap$1(value) {\n let p = value[$PROXY];\n if (!p) {\n Object.defineProperty(value, $PROXY, {\n value: p = new Proxy(value, proxyTraps$1)\n });\n if (!Array.isArray(value)) {\n const keys = Object.keys(value),\n desc = Object.getOwnPropertyDescriptors(value);\n for (let i = 0, l = keys.length; i < l; i++) {\n const prop = keys[i];\n if (desc[prop].get) {\n Object.defineProperty(value, prop, {\n enumerable: desc[prop].enumerable,\n get: desc[prop].get.bind(p)\n });\n }\n }\n }\n }\n return p;\n}\nfunction isWrappable(obj) {\n let proto;\n return obj != null && typeof obj === \"object\" && (obj[$PROXY] || !(proto = Object.getPrototypeOf(obj)) || proto === Object.prototype || Array.isArray(obj));\n}\nfunction unwrap(item, set = new Set()) {\n let result, unwrapped, v, prop;\n if (result = item != null && item[$RAW]) return result;\n if (!isWrappable(item) || set.has(item)) return item;\n if (Array.isArray(item)) {\n if (Object.isFrozen(item)) item = item.slice(0);else set.add(item);\n for (let i = 0, l = item.length; i < l; i++) {\n v = item[i];\n if ((unwrapped = unwrap(v, set)) !== v) item[i] = unwrapped;\n }\n } else {\n if (Object.isFrozen(item)) item = Object.assign({}, item);else set.add(item);\n const keys = Object.keys(item),\n desc = Object.getOwnPropertyDescriptors(item);\n for (let i = 0, l = keys.length; i < l; i++) {\n prop = keys[i];\n if (desc[prop].get) continue;\n v = item[prop];\n if ((unwrapped = unwrap(v, set)) !== v) item[prop] = unwrapped;\n }\n }\n return item;\n}\nfunction getNodes(target, symbol) {\n let nodes = target[symbol];\n if (!nodes) Object.defineProperty(target, symbol, {\n value: nodes = Object.create(null)\n });\n return nodes;\n}\nfunction getNode(nodes, property, value) {\n if (nodes[property]) return nodes[property];\n const [s, set] = createSignal(value, {\n equals: false,\n internal: true\n });\n s.$ = set;\n return nodes[property] = s;\n}\nfunction proxyDescriptor$1(target, property) {\n const desc = Reflect.getOwnPropertyDescriptor(target, property);\n if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc;\n delete desc.value;\n delete desc.writable;\n desc.get = () => target[$PROXY][property];\n return desc;\n}\nfunction trackSelf(target) {\n getListener() && getNode(getNodes(target, $NODE), $SELF)();\n}\nfunction ownKeys(target) {\n trackSelf(target);\n return Reflect.ownKeys(target);\n}\nconst proxyTraps$1 = {\n get(target, property, receiver) {\n if (property === $RAW) return target;\n if (property === $PROXY) return receiver;\n if (property === $TRACK) {\n trackSelf(target);\n return receiver;\n }\n const nodes = getNodes(target, $NODE);\n const tracked = nodes[property];\n let value = tracked ? tracked() : target[property];\n if (property === $NODE || property === $HAS || property === \"__proto__\") return value;\n if (!tracked) {\n const desc = Object.getOwnPropertyDescriptor(target, property);\n if (getListener() && (typeof value !== \"function\" || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getNode(nodes, property, value)();\n }\n return isWrappable(value) ? wrap$1(value) : value;\n },\n has(target, property) {\n if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === \"__proto__\") return true;\n getListener() && getNode(getNodes(target, $HAS), property)();\n return property in target;\n },\n set() {\n return true;\n },\n deleteProperty() {\n return true;\n },\n ownKeys: ownKeys,\n getOwnPropertyDescriptor: proxyDescriptor$1\n};\nfunction setProperty(state, property, value, deleting = false) {\n if (!deleting && state[property] === value) return;\n const prev = state[property],\n len = state.length;\n if (value === undefined) {\n delete state[property];\n if (state[$HAS] && state[$HAS][property] && prev !== undefined) state[$HAS][property].$();\n } else {\n state[property] = value;\n if (state[$HAS] && state[$HAS][property] && prev === undefined) state[$HAS][property].$();\n }\n let nodes = getNodes(state, $NODE),\n node;\n if (node = getNode(nodes, property, prev)) node.$(() => value);\n if (Array.isArray(state) && state.length !== len) {\n for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();\n (node = getNode(nodes, \"length\", len)) && node.$(state.length);\n }\n (node = nodes[$SELF]) && node.$();\n}\nfunction mergeStoreNode(state, value) {\n const keys = Object.keys(value);\n for (let i = 0; i < keys.length; i += 1) {\n const key = keys[i];\n setProperty(state, key, value[key]);\n }\n}\nfunction updateArray(current, next) {\n if (typeof next === \"function\") next = next(current);\n next = unwrap(next);\n if (Array.isArray(next)) {\n if (current === next) return;\n let i = 0,\n len = next.length;\n for (; i < len; i++) {\n const value = next[i];\n if (current[i] !== value) setProperty(current, i, value);\n }\n setProperty(current, \"length\", len);\n } else mergeStoreNode(current, next);\n}\nfunction updatePath(current, path, traversed = []) {\n let part,\n prev = current;\n if (path.length > 1) {\n part = path.shift();\n const partType = typeof part,\n isArray = Array.isArray(current);\n if (Array.isArray(part)) {\n for (let i = 0; i < part.length; i++) {\n updatePath(current, [part[i]].concat(path), traversed);\n }\n return;\n } else if (isArray && partType === \"function\") {\n for (let i = 0; i < current.length; i++) {\n if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);\n }\n return;\n } else if (isArray && partType === \"object\") {\n const {\n from = 0,\n to = current.length - 1,\n by = 1\n } = part;\n for (let i = from; i <= to; i += by) {\n updatePath(current, [i].concat(path), traversed);\n }\n return;\n } else if (path.length > 1) {\n updatePath(current[part], path, [part].concat(traversed));\n return;\n }\n prev = current[part];\n traversed = [part].concat(traversed);\n }\n let value = path[0];\n if (typeof value === \"function\") {\n value = value(prev, traversed);\n if (value === prev) return;\n }\n if (part === undefined && value == undefined) return;\n value = unwrap(value);\n if (part === undefined || isWrappable(prev) && isWrappable(value) && !Array.isArray(value)) {\n mergeStoreNode(prev, value);\n } else setProperty(current, part, value);\n}\nfunction createStore(...[store, options]) {\n const unwrappedStore = unwrap(store || {});\n const isArray = Array.isArray(unwrappedStore);\n const wrappedStore = wrap$1(unwrappedStore);\n function setStore(...args) {\n batch(() => {\n isArray && args.length === 1 ? updateArray(unwrappedStore, args[0]) : updatePath(unwrappedStore, args);\n });\n }\n return [wrappedStore, setStore];\n}\n\nfunction proxyDescriptor(target, property) {\n const desc = Reflect.getOwnPropertyDescriptor(target, property);\n if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE) return desc;\n delete desc.value;\n delete desc.writable;\n desc.get = () => target[$PROXY][property];\n desc.set = v => target[$PROXY][property] = v;\n return desc;\n}\nconst proxyTraps = {\n get(target, property, receiver) {\n if (property === $RAW) return target;\n if (property === $PROXY) return receiver;\n if (property === $TRACK) {\n trackSelf(target);\n return receiver;\n }\n const nodes = getNodes(target, $NODE);\n const tracked = nodes[property];\n let value = tracked ? tracked() : target[property];\n if (property === $NODE || property === $HAS || property === \"__proto__\") return value;\n if (!tracked) {\n const desc = Object.getOwnPropertyDescriptor(target, property);\n const isFunction = typeof value === \"function\";\n if (getListener() && (!isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {\n return (...args) => batch(() => Array.prototype[property].apply(receiver, args));\n }\n }\n return isWrappable(value) ? wrap(value) : value;\n },\n has(target, property) {\n if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === \"__proto__\") return true;\n getListener() && getNode(getNodes(target, $HAS), property)();\n return property in target;\n },\n set(target, property, value) {\n batch(() => setProperty(target, property, unwrap(value)));\n return true;\n },\n deleteProperty(target, property) {\n batch(() => setProperty(target, property, undefined, true));\n return true;\n },\n ownKeys: ownKeys,\n getOwnPropertyDescriptor: proxyDescriptor\n};\nfunction wrap(value) {\n let p = value[$PROXY];\n if (!p) {\n Object.defineProperty(value, $PROXY, {\n value: p = new Proxy(value, proxyTraps)\n });\n const keys = Object.keys(value),\n desc = Object.getOwnPropertyDescriptors(value);\n for (let i = 0, l = keys.length; i < l; i++) {\n const prop = keys[i];\n if (desc[prop].get) {\n const get = desc[prop].get.bind(p);\n Object.defineProperty(value, prop, {\n get\n });\n }\n if (desc[prop].set) {\n const og = desc[prop].set,\n set = v => batch(() => og.call(p, v));\n Object.defineProperty(value, prop, {\n set\n });\n }\n }\n }\n return p;\n}\nfunction createMutable(state, options) {\n const unwrappedStore = unwrap(state || {});\n const wrappedStore = wrap(unwrappedStore);\n return wrappedStore;\n}\nfunction modifyMutable(state, modifier) {\n batch(() => modifier(unwrap(state)));\n}\n\nconst $ROOT = Symbol(\"store-root\");\nfunction applyState(target, parent, property, merge, key) {\n const previous = parent[property];\n if (target === previous) return;\n const isArray = Array.isArray(target);\n if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || isArray && !Array.isArray(previous) || key && target[key] !== previous[key])) {\n setProperty(parent, property, target);\n return;\n }\n if (isArray) {\n if (target.length && previous.length && (!merge || key && target[0] && target[0][key] != null)) {\n let i, j, start, end, newEnd, item, newIndicesNext, keyVal;\n for (start = 0, end = Math.min(previous.length, target.length); start < end && (previous[start] === target[start] || key && previous[start] && target[start] && previous[start][key] === target[start][key]); start++) {\n applyState(target[start], previous, start, merge, key);\n }\n const temp = new Array(target.length),\n newIndices = new Map();\n for (end = previous.length - 1, newEnd = target.length - 1; end >= start && newEnd >= start && (previous[end] === target[newEnd] || key && previous[start] && target[start] && previous[end][key] === target[newEnd][key]); end--, newEnd--) {\n temp[newEnd] = previous[end];\n }\n if (start > newEnd || start > end) {\n for (j = start; j <= newEnd; j++) setProperty(previous, j, target[j]);\n for (; j < target.length; j++) {\n setProperty(previous, j, temp[j]);\n applyState(target[j], previous, j, merge, key);\n }\n if (previous.length > target.length) setProperty(previous, \"length\", target.length);\n return;\n }\n newIndicesNext = new Array(newEnd + 1);\n for (j = newEnd; j >= start; j--) {\n item = target[j];\n keyVal = key && item ? item[key] : item;\n i = newIndices.get(keyVal);\n newIndicesNext[j] = i === undefined ? -1 : i;\n newIndices.set(keyVal, j);\n }\n for (i = start; i <= end; i++) {\n item = previous[i];\n keyVal = key && item ? item[key] : item;\n j = newIndices.get(keyVal);\n if (j !== undefined && j !== -1) {\n temp[j] = previous[i];\n j = newIndicesNext[j];\n newIndices.set(keyVal, j);\n }\n }\n for (j = start; j < target.length; j++) {\n if (j in temp) {\n setProperty(previous, j, temp[j]);\n applyState(target[j], previous, j, merge, key);\n } else setProperty(previous, j, target[j]);\n }\n } else {\n for (let i = 0, len = target.length; i < len; i++) {\n applyState(target[i], previous, i, merge, key);\n }\n }\n if (previous.length > target.length) setProperty(previous, \"length\", target.length);\n return;\n }\n const targetKeys = Object.keys(target);\n for (let i = 0, len = targetKeys.length; i < len; i++) {\n applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);\n }\n const previousKeys = Object.keys(previous);\n for (let i = 0, len = previousKeys.length; i < len; i++) {\n if (target[previousKeys[i]] === undefined) setProperty(previous, previousKeys[i], undefined);\n }\n}\nfunction reconcile(value, options = {}) {\n const {\n merge,\n key = \"id\"\n } = options,\n v = unwrap(value);\n return state => {\n if (!isWrappable(state) || !isWrappable(v)) return v;\n const res = applyState(v, {\n [$ROOT]: state\n }, $ROOT, merge, key);\n return res === undefined ? state : res;\n };\n}\nconst producers = new WeakMap();\nconst setterTraps = {\n get(target, property) {\n if (property === $RAW) return target;\n const value = target[property];\n let proxy;\n return isWrappable(value) ? producers.get(value) || (producers.set(value, proxy = new Proxy(value, setterTraps)), proxy) : value;\n },\n set(target, property, value) {\n setProperty(target, property, unwrap(value));\n return true;\n },\n deleteProperty(target, property) {\n setProperty(target, property, undefined, true);\n return true;\n }\n};\nfunction produce(fn) {\n return state => {\n if (isWrappable(state)) {\n let proxy;\n if (!(proxy = producers.get(state))) {\n producers.set(state, proxy = new Proxy(state, setterTraps));\n }\n fn(proxy);\n }\n return state;\n };\n}\n\nconst DEV = undefined;\n\nexport { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap };\n", "import {$TRACK} from 'solid-js'\nimport {createMutable, modifyMutable, reconcile} from 'solid-js/store'\nimport type {PossibleBehaviorInstance} from './BehaviorRegistry.js'\n\n/**\n * A map of behavior names to their defined classes.\n *\n * Reactive in Solid.js.\n */\n\nexport class BehaviorMap extends Map {\n\t// We make things like element.behaviors.get('some-behavior') reactive (in\n\t// Solid.js), but a DOM-spec'd version of element-behaviors would not have\n\t// this, or it could have reactivity if it gets built into the JavaScript\n\t// language (people are talking about \"signals and effects\")\n\t#reactivityTriggerObject = createMutable>({})\n\n\tfind(predicate: (name: string, behavior: PossibleBehaviorInstance) => boolean) {\n\t\tlet result: PossibleBehaviorInstance | undefined = void undefined\n\n\t\tfor (const [name, behavior] of this) {\n\t\t\tif (!predicate(name, behavior)) continue\n\t\t\tresult = behavior\n\t\t\tbreak\n\t\t}\n\n\t\treturn result\n\t}\n\n\toverride get(key: string): PossibleBehaviorInstance | undefined {\n\t\t// read, causes tracking in Solid.js effects.\n\t\tthis.#reactivityTriggerObject[key]\n\n\t\treturn super.get(key)\n\t}\n\n\toverride set(key: string, value: PossibleBehaviorInstance): this {\n\t\tqueueMicrotask(() => {\n\t\t\t// write, triggers Solid.js effects\n\t\t\tthis.#reactivityTriggerObject[key] = value\n\t\t})\n\n\t\t// TODO Remove the set() method from end users, allow the user to add\n\t\t// behaviors in a fashion similar to classList.add().\n\t\tsuper.set(key, value)\n\t\treturn this\n\t}\n\n\toverride delete(key: string): boolean {\n\t\tqueueMicrotask(() => {\n\t\t\t// write, triggers Solid.js effects\n\t\t\tdelete this.#reactivityTriggerObject[key]\n\t\t})\n\n\t\treturn super.delete(key)\n\t}\n\n\toverride clear(): void {\n\t\tqueueMicrotask(() => {\n\t\t\t// delete all properties, trigger single Solid.js effect update\n\t\t\tmodifyMutable(this.#reactivityTriggerObject, reconcile({}))\n\t\t})\n\n\t\tsuper.clear()\n\t}\n\n\toverride has(key: string): boolean {\n\t\t// read, causes tracking in Solid.js effects.\n\t\t// (TODO `in` operator not reactive yet, https://github.com/solidjs/solid/issues/1107)\n\t\t// key in this.#reactivityTriggerObject\n\t\t// Workaround, read the property\n\t\tthis.#reactivityTriggerObject[key]\n\n\t\treturn super.has(key)\n\t}\n\n\toverride entries(): IterableIterator<[string, PossibleBehaviorInstance]> {\n\t\t// track all properties in a Solid effect\n\t\t// @ts-expect-error\n\t\tthis.#reactivityTriggerObject[$TRACK]\n\n\t\treturn super.entries()\n\t}\n\n\toverride [Symbol.iterator](): IterableIterator<[string, PossibleBehaviorInstance]> {\n\t\t// track all properties in a Solid effect\n\t\t// @ts-expect-error\n\t\tthis.#reactivityTriggerObject[$TRACK]\n\n\t\treturn super[Symbol.iterator]()\n\t}\n\n\toverride forEach(\n\t\tcallbackfn: (value: PossibleBehaviorInstance, key: string, map: Map) => void,\n\t\tthisArg?: any,\n\t): void {\n\t\t// track all properties in a Solid effect\n\t\t// @ts-expect-error\n\t\tthis.#reactivityTriggerObject[$TRACK]\n\n\t\tsuper.forEach(callbackfn, thisArg)\n\t}\n\n\toverride keys(): IterableIterator {\n\t\t// track all properties in a Solid effect\n\t\t// @ts-expect-error\n\t\tthis.#reactivityTriggerObject[$TRACK]\n\n\t\treturn super.keys()\n\t}\n\n\toverride get size(): number {\n\t\t// track all properties in a Solid effect\n\t\t// @ts-expect-error\n\t\tthis.#reactivityTriggerObject[$TRACK]\n\n\t\treturn super.size\n\t}\n\toverride set size(n: number) {\n\t\t// @ts-expect-error readonly property according to TS, but in JS it is\n\t\t// assignable though nothing happens. We need this so that the property\n\t\t// behaves the same after we override it.\n\t\tsuper.size = n\n\t}\n}\n", "import type {Constructor} from 'lowclass'\nimport type {BehaviorMap} from './BehaviorMap.js'\n\n/** A registry of behaviors. Similar to CustomElementRegistry. */\nexport class BehaviorRegistry {\n\t#definedBehaviors = new Map()\n\t#whenDefinedPromises: Map; resolve: () => void}> = new Map()\n\n\t/**\n\t * Associate a class `Behavior` to a given behavior `name`. Any time an\n\t * element has the named behavior, the given class will be instantiated and\n\t * the instance will be able to apply logic to its host element.\n\t */\n\tdefine(name: string, Behavior: T) {\n\t\tif (!this.#definedBehaviors.has(name)) {\n\t\t\tthis.#definedBehaviors.set(name, Behavior)\n\n\t\t\tif (this.#whenDefinedPromises.has(name)) {\n\t\t\t\tthis.#whenDefinedPromises.get(name)!.resolve()\n\t\t\t\tthis.#whenDefinedPromises.delete(name)\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(`Behavior ${name} is already defined.`)\n\t\t}\n\t}\n\n\t/** Get the behavior class associated with `name`. */\n\tget(name: string) {\n\t\treturn this.#definedBehaviors.get(name)\n\t}\n\n\t/** Returns `true` if there's a class defined for the given `name`, `false` otherwise. */\n\thas(name: string) {\n\t\treturn this.#definedBehaviors.has(name)\n\t}\n\n\t/**\n\t * Wait for the promise returned by this to run code after a behavior class\n\t * for the given `name` has been defined. If the behavior class is already\n\t * defined, resolves immediately.\n\t */\n\twhenDefined(name: string): Promise {\n\t\tif (this.#whenDefinedPromises.has(name)) return this.#whenDefinedPromises.get(name)!.promise\n\t\tif (this.has(name)) return Promise.resolve()\n\n\t\tlet resolve!: () => void\n\t\tconst promise = new Promise(r => (resolve = r))\n\n\t\tthis.#whenDefinedPromises.set(name, {promise, resolve})\n\n\t\treturn promise\n\t}\n}\n\nexport let elementBehaviors: BehaviorRegistry\n\n// Avoid errors trying to use DOM APIs in non-DOM environments (f.e. server-side rendering).\nif (globalThis.window?.document) {\n\telementBehaviors = globalThis.elementBehaviors = new BehaviorRegistry()\n}\n\ndeclare global {\n\t// const doesn't always work (TS bug). At time of writing this, it doesn't work in this TS playground example:\n\t// https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBAbzgXwFCoCbAMYBsCGUwcA5rhAEb66KpxzYQB2AzvAGYQQBccTArgFsKwKKjSoylagBUAFgEsWAOk4Q4Aeg1wAolCjQANHAXwYipgGsWcAAZrbJm0wjws7BU2AYgA\n\t// And discussions:\n\t// https://discord.com/channels/508357248330760243/508357248330760249/1019034094060978228\n\t// https://discord.com/channels/508357248330760243/1019017621397585961\n\tvar elementBehaviors: BehaviorRegistry\n\n\tinterface Window {\n\t\telementBehaviors: BehaviorRegistry\n\t}\n}\n\nexport type ElementBehaviors = {behaviors: BehaviorMap}\n\nexport type ElementWithBehaviors = Element & ElementBehaviors\n\nexport type PossibleBehaviorConstructor = Constructor<\n\tPossibleBehaviorInstance,\n\t[ElementWithBehaviors],\n\t{awaitElementDefined?: boolean; observedAttributes?: string[]}\n>\n\nexport type PossibleBehaviorInstance = {\n\tconnectedCallback?: (element: Element) => void\n\tdisconnectedCallback?: (element: Element) => void\n\tattributeChangedCallback?: (attr: string, oldValue: string | null, newValue: string | null, element: Element) => void\n\t[k: string]: any\n\t[k: number]: any\n}\n", "import type {Constructor} from 'lowclass'\n\nconst forEach = Array.prototype.forEach\n\nexport class CustomAttributeRegistry {\n\tprivate _attrMap = new Map()\n\tprivate _elementMap = new WeakMap>()\n\n\tprivate _observer: MutationObserver = new MutationObserver(mutations => {\n\t\tforEach.call(mutations, (m: MutationRecord) => {\n\t\t\tif (m.type === 'attributes') {\n\t\t\t\tconst attr = this._getConstructor(m.attributeName!)\n\t\t\t\tif (attr) this._handleChange(m.attributeName!, m.target as Element, m.oldValue)\n\t\t\t}\n\n\t\t\t// chlidList\n\t\t\telse {\n\t\t\t\tforEach.call(m.removedNodes, this._elementDisconnected)\n\t\t\t\tforEach.call(m.addedNodes, this._elementConnected)\n\t\t\t}\n\t\t})\n\t})\n\n\tconstructor(public ownerDocument: Document | ShadowRoot) {\n\t\tif (!ownerDocument) throw new Error('Must be given a document')\n\t}\n\n\tdefine(attrName: string, Class: Constructor) {\n\t\tthis._attrMap.set(attrName, Class)\n\t\tthis._upgradeAttr(attrName)\n\t\tthis._reobserve()\n\t}\n\n\tget(element: Element, attrName: string) {\n\t\tconst map = this._elementMap.get(element)\n\t\tif (!map) return\n\t\treturn map.get(attrName)\n\t}\n\n\tprivate _getConstructor(attrName: string) {\n\t\treturn this._attrMap.get(attrName)\n\t}\n\n\tprivate _observe() {\n\t\tthis._observer.observe(this.ownerDocument, {\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t\tattributes: true,\n\t\t\tattributeOldValue: true,\n\t\t\tattributeFilter: Array.from(this._attrMap.keys()),\n\t\t\t// attributeFilter: [...this._attrMap.keys()], // Broken in Oculus\n\t\t\t// attributeFilter: this._attrMap.keys(), // This works in Chrome, but TS complains, and not clear if it should work in all browsers yet: https://github.com/whatwg/dom/issues/1092\n\t\t})\n\t}\n\n\tprivate _unobserve() {\n\t\tthis._observer.disconnect()\n\t}\n\n\tprivate _reobserve() {\n\t\tthis._unobserve()\n\t\tthis._observe()\n\t}\n\n\tprivate _upgradeAttr(attrName: string, node: Element | Document | ShadowRoot = this.ownerDocument) {\n\t\tconst matches = node.querySelectorAll('[' + attrName + ']')\n\n\t\t// Possibly create custom attributes that may be in the given 'node' tree.\n\t\t// Use a forEach as Edge doesn't support for...of on a NodeList\n\t\tforEach.call(matches, (element: Element) => this._handleChange(attrName, element, null))\n\t}\n\n\tprivate _elementConnected = (element: Element) => {\n\t\tif (element.nodeType !== 1) return\n\n\t\t// For each of the connected element's attribute, possibly instantiate the custom attributes.\n\t\t// Use a forEach as Safari 10 doesn't support for...of on NamedNodeMap (attributes)\n\t\tforEach.call(element.attributes, (attr: Attr) => {\n\t\t\tif (this._getConstructor(attr.name)) this._handleChange(attr.name, element, null)\n\t\t})\n\n\t\t// Possibly instantiate custom attributes that may be in the subtree of the connected element.\n\t\tthis._attrMap.forEach((_constructor, attr) => this._upgradeAttr(attr, element))\n\t}\n\n\tprivate _elementDisconnected = (element: Element) => {\n\t\tconst map = this._elementMap.get(element)\n\t\tif (!map) return\n\n\t\tmap.forEach(inst => inst.disconnectedCallback?.(), this)\n\n\t\tthis._elementMap.delete(element)\n\t}\n\n\tprivate _handleChange(attrName: string, el: Element, oldVal: string | null) {\n\t\tlet map = this._elementMap.get(el)\n\t\tif (!map) this._elementMap.set(el, (map = new Map()))\n\n\t\tlet inst = map.get(attrName)\n\t\tconst newVal = el.getAttribute(attrName)\n\n\t\t// Attribute is being created\n\t\tif (!inst) {\n\t\t\tconst Constructor = this._getConstructor(attrName)!\n\t\t\tinst = new Constructor() as CustomAttribute\n\t\t\tmap.set(attrName, inst)\n\t\t\tinst.ownerElement = el\n\t\t\tinst.name = attrName\n\t\t\tif (newVal == null) throw new Error('Not possible!')\n\t\t\tinst.value = newVal\n\t\t\tinst.connectedCallback?.()\n\t\t\treturn\n\t\t}\n\n\t\t// Attribute was removed\n\t\tif (newVal == null) {\n\t\t\tinst.disconnectedCallback?.()\n\t\t\tmap.delete(attrName)\n\t\t}\n\n\t\t// Attribute changed\n\t\telse if (newVal !== inst.value) {\n\t\t\tinst.value = newVal\n\t\t\tif (oldVal == null) throw new Error('Not possible!')\n\t\t\tinst.changedCallback?.(oldVal, newVal)\n\t\t}\n\t}\n}\n\n// TODO Replace with a class that extends from `Attr` for alignment with the web platform?\nexport interface CustomAttribute {\n\townerElement: Element\n\tname: string\n\tvalue: string\n\tconnectedCallback?(): void\n\tdisconnectedCallback?(): void\n\tchangedCallback?(oldValue: string, newValue: string): void\n}\n\n// Avoid errors trying to use DOM APIs in non-DOM environments (f.e. server-side rendering).\nif (globalThis.window?.document) {\n\tconst _attachShadow = Element.prototype.attachShadow\n\n\tElement.prototype.attachShadow = function attachShadow(options) {\n\t\tconst root = _attachShadow.call(this, options)\n\n\t\tif (!root.customAttributes) root.customAttributes = new CustomAttributeRegistry(root)\n\n\t\treturn root\n\t}\n}\n", "// TODO We don't know when a ShadowRoot is no longer referenced, hence we cannot\n// unobserve them. Verify that MOs are cleaned up once ShadowRoots are no longer\n// referenced.\n\nimport {CustomAttributeRegistry} from './CustomAttributeRegistry.js'\n\nexport * from './CustomAttributeRegistry.js'\n\nexport let customAttributes: CustomAttributeRegistry\n\n// Avoid errors trying to use DOM APIs in non-DOM environments (f.e. server-side rendering).\nif (globalThis.window?.document) customAttributes = globalThis.customAttributes = new CustomAttributeRegistry(document)\n\ndeclare global {\n\t// const doesn't always work (TS bug). At time of writing this, it doesn't work in this TS playground example:\n\t// https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBAbzgXwFCoCbAMYBsCGUwcA5rhAEb66KpxzYQB2AzvAGYQQBccTArgFsKwKKjSoylagBUAFgEsWAOk4Q4Aeg1wAolCjQANHAXwYipgGsWcAAZrbJm0wjws7BU2AYgA\n\t// And discussions:\n\t// https://discord.com/channels/508357248330760243/508357248330760249/1019034094060978228\n\t// https://discord.com/channels/508357248330760243/1019017621397585961\n\tvar customAttributes: CustomAttributeRegistry\n\n\tinterface ShadowRoot {\n\t\tcustomAttributes: CustomAttributeRegistry\n\t}\n\n\tinterface Window {\n\t\tcustomAttributes: CustomAttributeRegistry\n\t}\n}\n\nexport const version = '0.2.3'\n", "// TODO safe types for privates\nexport function Privates() {\n\tconst storage = new WeakMap()\n\n\treturn (obj: object) => {\n\t\tlet privates = storage.get(obj)\n\t\tif (!privates) storage.set(obj, (privates = {}))\n\t\treturn privates\n\t}\n}\n", "import {Privates} from './Privates.js'\n\nexport const _ = Privates()\n\nexport interface CancelablePromiseOptions {\n\trejectOnCancel?: boolean\n}\n\nexport class PromiseCancellation extends Error {}\n\nexport class CancelablePromise extends Promise {\n\tcanceled: boolean\n\n\tconstructor(\n\t\texecutor: Promise | ((resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void),\n\t\toptions: CancelablePromiseOptions,\n\t) {\n\t\tconst rejectOnCancel = options ? options.rejectOnCancel : false\n\t\tlet originalReject\n\n\t\t// if the first arg is a promise-like\n\t\tif (executor instanceof Promise) {\n\t\t\tconst promise = executor\n\n\t\t\tsuper((resolve, reject) => {\n\t\t\t\toriginalReject = reject\n\n\t\t\t\tpromise\n\t\t\t\t\t.then(value => {\n\t\t\t\t\t\tif (this.canceled) return\n\t\t\t\t\t\tresolve(value)\n\t\t\t\t\t})\n\t\t\t\t\t.catch(error => {\n\t\t\t\t\t\tif (this.canceled) return\n\t\t\t\t\t\treject(error)\n\t\t\t\t\t})\n\t\t\t})\n\t\t} else {\n\t\t\tsuper((resolve, reject) => {\n\t\t\t\toriginalReject = reject\n\t\t\t\texecutor(\n\t\t\t\t\tvalue => {\n\t\t\t\t\t\tif (this.canceled) return\n\t\t\t\t\t\tresolve(value)\n\t\t\t\t\t},\n\t\t\t\t\terror => {\n\t\t\t\t\t\tif (this.canceled) return\n\t\t\t\t\t\treject(error)\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t})\n\t\t}\n\n\t\tthis.canceled = false\n\t\t_(this).originalReject = originalReject\n\t\t_(this).rejectOnCancel = rejectOnCancel\n\t}\n\n\tcancel() {\n\t\tthis.canceled = true\n\n\t\tif (_(this).rejectOnCancel) {\n\t\t\t_(this).originalReject(new PromiseCancellation('canceled'))\n\t\t}\n\t}\n}\n", "import '@lume/custom-attributes/dist/index.js' // polyfills global Custom Attributes API\nimport type {CustomAttribute} from '@lume/custom-attributes/dist/index.js'\nimport {CancelablePromise, PromiseCancellation} from './CancelablePromise.js'\nimport type {ElementWithBehaviors, PossibleBehaviorConstructor, PossibleBehaviorInstance} from './BehaviorRegistry.js'\nimport {BehaviorMap} from './BehaviorMap.js'\n\n/**\n * Defines the global `has=\"\"` attribute for assigning behaviors to an element.\n *\n * One instance of this class is instantiated per element with `has=\"\"` attribute.\n *\n * If you're using element-behaviors, then all elements now also have a\n * `behaviors` property that is a map of behavior names to behavior instances.\n */\nexport class HasAttribute implements CustomAttribute {\n\t// Properties defined by CustomAttribute\n\t// TODO Ensure these types from from CustomAttribute\n\tdeclare ownerElement: ElementWithBehaviors\n\tdeclare value: string\n\tdeclare name: string\n\n\tget behaviors() {\n\t\treturn this.ownerElement.behaviors\n\t}\n\n\tobservers = new Map()\n\telementDefinedPromises = new Map>()\n\n\tisConnected = false // TODO move to base class\n\n\t// TODO an improvement would be that behaviors are instantiated on element\n\t// construction, though that will add some complexity (probably patching of\n\t// many native APIs). Probably needs a change in custom-attributes first so it\n\t// handles attributes during element construction.\n\tconnectedCallback() {\n\t\tthis.isConnected = true\n\t\tthis.changedCallback('', this.value)\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.isConnected = false\n\t\tthis.#skipConnectedCheck = true\n\t\tthis.changedCallback(this.value, '')\n\t\tthis.#skipConnectedCheck = false\n\t}\n\n\t#skipConnectedCheck = false\n\n\tchangedCallback(oldVal: string, newVal: string) {\n\t\tif (!this.#skipConnectedCheck) {\n\t\t\tif (!this.isConnected) return\n\t\t}\n\n\t\tconst currentBehaviors = this.getBehaviorNames(newVal)\n\t\tconst previousBehaviors = this.getBehaviorNames(oldVal)\n\n\t\t// small optimization: if no previous or new behaviors, just quit\n\t\t// early. It would still function the same without this.\n\t\tif (currentBehaviors.length == 0 && previousBehaviors.length == 0) return\n\n\t\tconst {removed, added} = this.getDiff(previousBehaviors, currentBehaviors)\n\t\tthis.handleDiff(removed, added)\n\t}\n\n\tprivate getBehaviorNames(string: string) {\n\t\tif (string.trim() == '') return []\n\t\telse return string.split(/\\s+/)\n\t}\n\n\tprivate getDiff(previousBehaviors: string[], currentBehaviors: string[]) {\n\t\tconst diff = {\n\t\t\tremoved: [] as string[],\n\t\t\tadded: currentBehaviors,\n\t\t}\n\n\t\tfor (let i = 0, l = previousBehaviors.length; i < l; i += 1) {\n\t\t\tconst oldBehavior = previousBehaviors[i]\n\n\t\t\t// if it exists in the previousBehaviors but not the newBehaviors, then\n\t\t\t// the node was removed.\n\t\t\tif (!diff.added.includes(oldBehavior)) {\n\t\t\t\tdiff.removed.push(oldBehavior)\n\t\t\t}\n\n\t\t\t// otherwise the old value also exists in the set of new values, so\n\t\t\t// therefore it wasn't added or removed, so let's remove it so we\n\t\t\t// don't count it as added\n\t\t\telse {\n\t\t\t\tdiff.added.splice(diff.added.indexOf(oldBehavior), 1)\n\t\t\t}\n\t\t}\n\n\t\treturn diff\n\t}\n\n\tprivate handleDiff(removed: string[], added: string[]) {\n\t\tfor (const name of removed) this.disconnectBehavior(name)\n\t\tfor (const name of added) this.connectBehavior(name)\n\t}\n\n\tprivate async connectBehavior(name: string) {\n\t\tlet Behavior = elementBehaviors.get(name)\n\n\t\tif (!Behavior) {\n\t\t\tawait elementBehaviors.whenDefined(name)\n\t\t\tBehavior = elementBehaviors.get(name)!\n\t\t}\n\n\t\t// TODO Read observedAttributes during the define() call instead, like\n\t\t// custom elements.\n\t\tconst observedAttributes = Behavior.observedAttributes\n\n\t\tconst tagName = this.ownerElement.tagName\n\n\t\ttry {\n\t\t\t// if the element is a custom element and the behavior specifies to wait for it to be defined\n\t\t\tif (Behavior.awaitElementDefined && tagName.includes('-') && !customElements.get(tagName.toLowerCase())) {\n\t\t\t\tconst promiseId = name + '_' + tagName\n\t\t\t\tlet promise = this.elementDefinedPromises.get(promiseId)\n\n\t\t\t\tif (!promise) {\n\t\t\t\t\tpromise = new CancelablePromise(customElements.whenDefined(tagName.toLowerCase()), {\n\t\t\t\t\t\trejectOnCancel: true,\n\t\t\t\t\t})\n\t\t\t\t\tthis.elementDefinedPromises.set(promiseId, promise)\n\t\t\t\t}\n\n\t\t\t\tawait promise\n\t\t\t\tthis.elementDefinedPromises.delete(promiseId)\n\t\t\t}\n\n\t\t\tif (this.isConnected) {\n\t\t\t\tconst behavior = new Behavior(this.ownerElement)\n\t\t\t\tthis.behaviors.set(name, behavior)\n\t\t\t\tbehavior.connectedCallback?.(this.ownerElement)\n\n\t\t\t\tif (Array.isArray(observedAttributes) && observedAttributes.length) {\n\t\t\t\t\tthis.fireInitialAttributeChangedCallbacks(behavior, observedAttributes)\n\t\t\t\t\tthis.createAttributeObserver(behavior)\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!(e instanceof PromiseCancellation)) throw e\n\n\t\t\t// do nothing if promise canceled\n\t\t}\n\t}\n\n\tprivate disconnectBehavior(name: string) {\n\t\tconst promiseId = name + '_' + this.ownerElement.tagName\n\t\tconst promise = this.elementDefinedPromises.get(promiseId)\n\n\t\tif (promise) {\n\t\t\tpromise.cancel()\n\t\t\tthis.elementDefinedPromises.delete(promiseId)\n\t\t}\n\n\t\tconst behavior = this.behaviors.get(name)\n\n\t\t// There will only be a behavior if connectBehavior both created it and\n\t\t// ran its connectedCallback.\n\t\tif (!behavior) return\n\n\t\tbehavior.disconnectedCallback?.(this.ownerElement)\n\t\tthis.destroyAttributeObserver(behavior)\n\t\tthis.behaviors.delete(name)\n\t}\n\n\tdestroyAttributeObserver(behavior: PossibleBehaviorInstance) {\n\t\tconst observer = this.observers.get(behavior)\n\t\tif (!observer) return\n\t\tobserver.disconnect()\n\t\tthis.observers.delete(behavior)\n\t}\n\n\t// Behaviors observe attribute changes, implemented with MutationObserver\n\t//\n\t// We have to create one observer per behavior because otherwise\n\t// MutationObserver doesn't have an API for disconnecting from a single\n\t// element, only for disconnecting from all elements.\n\tcreateAttributeObserver(behavior: PossibleBehaviorInstance) {\n\t\tconst el = this.ownerElement\n\n\t\tconst observer = new MutationObserver(records => {\n\t\t\tif (!behavior.attributeChangedCallback) return\n\n\t\t\t// Because we get mutations in order, and we have all the attribute\n\t\t\t// values for a given attribute along the way while iterating on\n\t\t\t// mutation records, we keep track of previous and current attribute\n\t\t\t// values (per attribute name) with this variable and thus we can\n\t\t\t// fire behavior.attributeChangedCallback with each previous and\n\t\t\t// current value. For why we need to do this, see\n\t\t\t// https://stackoverflow.com/questions/60593551.\n\t\t\tlet lastAttributeValues: {[k: string]: string | null} = {}\n\n\t\t\tlet name = ''\n\n\t\t\tfor (const record of records) {\n\t\t\t\tif (record.type !== 'attributes') continue\n\n\t\t\t\tname = record.attributeName!\n\n\t\t\t\tif (lastAttributeValues[name] === undefined) {\n\t\t\t\t\tlastAttributeValues[name] = record.oldValue\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tbehavior.attributeChangedCallback(name, lastAttributeValues[name], record.oldValue, this.ownerElement)\n\n\t\t\t\tlastAttributeValues[name] = record.oldValue\n\t\t\t}\n\n\t\t\tlet attr: Attr | null\n\n\t\t\tfor (const name in lastAttributeValues) {\n\t\t\t\tattr = el.attributes.getNamedItem(name)\n\t\t\t\tbehavior.attributeChangedCallback(\n\t\t\t\t\tname,\n\t\t\t\t\tlastAttributeValues[name],\n\t\t\t\t\tattr === null ? null : attr.value,\n\t\t\t\t\tthis.ownerElement,\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\n\t\tobserver.observe(el, {\n\t\t\tattributes: true,\n\t\t\tattributeOldValue: true,\n\t\t\tattributeFilter: (behavior.constructor as PossibleBehaviorConstructor).observedAttributes,\n\t\t})\n\n\t\tthis.observers.set(behavior, observer)\n\t}\n\n\tfireInitialAttributeChangedCallbacks(behavior: PossibleBehaviorInstance, attributes: string[]) {\n\t\tif (!behavior.attributeChangedCallback) return\n\n\t\tfor (const name of attributes) {\n\t\t\tif (this.ownerElement.hasAttribute(name))\n\t\t\t\tbehavior.attributeChangedCallback(\n\t\t\t\t\tname,\n\t\t\t\t\tnull,\n\t\t\t\t\tthis.ownerElement.attributes.getNamedItem(name)!.value,\n\t\t\t\t\tthis.ownerElement,\n\t\t\t\t)\n\t\t}\n\t}\n}\n\n// Avoid errors trying to use DOM APIs in non-DOM environments (f.e. server-side rendering).\nif (globalThis.window?.document) {\n\t// stores the behaviors associated to each element.\n\tconst behaviorMaps = new WeakMap()\n\n\tObject.defineProperty(Element.prototype, 'behaviors', {\n\t\tget() {\n\t\t\tlet behaviorMap: BehaviorMap | null = null\n\n\t\t\tif (behaviorMaps.has(this)) {\n\t\t\t\tbehaviorMap = behaviorMaps.get(this)!\n\t\t\t} else {\n\t\t\t\tbehaviorMaps.set(this, (behaviorMap = new BehaviorMap()))\n\t\t\t}\n\n\t\t\treturn behaviorMap\n\t\t},\n\t})\n\n\tconst _attachShadow = Element.prototype.attachShadow\n\n\tElement.prototype.attachShadow = function (options) {\n\t\tconst root = _attachShadow.call(this, options)\n\n\t\troot.customAttributes.define('has', HasAttribute)\n\n\t\treturn root\n\t}\n\n\tglobalThis.customAttributes.define('has', HasAttribute)\n}\n", "import {getInheritedDescriptor} from 'lowclass'\n\ntype Options = {\n\tasync: boolean\n\tinherited: boolean\n}\n\ntype PropKey = string | symbol // Make our own PropKey because TypeScript's PropertyKey is incorrect.\n\ntype Callback = (propName: PropKey, value: any) => unknown\n\nconst propsAndCallbacks = new WeakMap>()\n\nexport function observe(\n\tobject: T,\n\tpropertyNames: (keyof T)[],\n\tcallback: Callback,\n\toptions: Partial = {},\n) {\n\t// TODO the options.async option will make callbacks fire on the next microtask instead of synchronously\n\toptions.async = options.async || false\n\toptions.inherited = options.inherited || false\n\n\tfor (const propName of propertyNames) {\n\t\tlet propCallbacks = propsAndCallbacks.get(object)\n\t\t!propCallbacks && propsAndCallbacks.set(object, (propCallbacks = new Map()))\n\n\t\tlet callbacks = propCallbacks.get(propName as PropKey)\n\n\t\tif (!callbacks) {\n\t\t\tpropCallbacks.set(propName as PropKey, (callbacks = []))\n\t\t\tdefineObservationGetterSetter(object, propName, options as Options)\n\t\t}\n\n\t\tif (!callbacks.includes(callback)) callbacks.push(callback)\n\t}\n}\n\n// NOTE, unobserve does not remove the observation accessors that observe\n// creates. It might be nice if it did, so that objects can return to their lean\n// shape. TODO can we do it?\nexport function unobserve(object: T, props: Callback | (keyof T)[], callback?: Callback) {\n\tconst propCallbacks = propsAndCallbacks.get(object)\n\n\tif (!propCallbacks) {\n\t\tconsole.warn('the object is not observed, no need to unobserve:', object)\n\t\treturn\n\t}\n\n\t// If called as unobserve(object, callback), unobserve all props for the callback.\n\tif (typeof props === 'function') {\n\t\tcallback = props\n\t\tprops = Array.from(propCallbacks.keys()) as (keyof T)[]\n\t}\n\n\t// Otherwise called as unobserve(object, props, callback), so unobserve the specific props for the callback.\n\n\tif (!callback) throw new TypeError('callback not supplied')\n\n\tfor (const prop of props) {\n\t\tconst callbacks = propCallbacks.get(prop as PropKey)!\n\n\t\tif (callbacks.includes(callback)) {\n\t\t\tcallbacks.splice(callbacks.indexOf(callback), 1)\n\t\t\tif (!callbacks.length) propCallbacks.delete(prop as PropKey)\n\t\t}\n\t}\n}\n\n// This is used to keep track if an object already has an observation accessor\n// in place for a given property. If so, then we don't need to add another layer\n// of property descriptor on top for each new call to observe on the object.\nconst objectsToObservableProps = new WeakMap>()\n\nfunction defineObservationGetterSetter(object: T, propName: keyof T, options: Options) {\n\tlet observableProps: Set | undefined\n\tconst inherited = options.inherited\n\n\tif (!inherited) {\n\t\tobservableProps = objectsToObservableProps.get(object) as Set | undefined\n\t\tif (!observableProps) objectsToObservableProps.set(object, (observableProps = new Set()))\n\t\telse if (observableProps.has(propName as PropKey)) return\n\t}\n\n\t// get the existing descriptor, or create a new one if the property doesn't exist.\n\tconst descriptor =\n\t\tgetInheritedDescriptor(object, propName) ||\n\t\t({\n\t\t\tvalue: undefined,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t} as ReturnType)!\n\n\tconst owner = options.inherited ? descriptor.owner || object : object\n\n\tif (inherited) {\n\t\t// TODO, this check probably actually needs to look up on the prototype\n\t\t// chain, because people can modify prototype chains and introduce new\n\t\t// descriptors anywhere in the chain. We want to check the whole chain\n\t\t// to see if we find an observation accessor defined by us.\n\t\tobservableProps = objectsToObservableProps.get(owner) as Set | undefined\n\t\tif (!observableProps) objectsToObservableProps.set(owner, (observableProps = new Set()))\n\t\telse if (observableProps.has(propName as PropKey)) return\n\t}\n\n\tlet getValue: (() => any) | undefined\n\tlet setValue: ((v: any) => void) | undefined\n\n\tif (descriptor.get || descriptor.set) {\n\t\t// we will use the existing getter/setter assuming they don't do\n\t\t// anyting crazy that we might not expect. (See? Another reason for\n\t\t// Object.observe)\n\t\tconst oldGet = descriptor.get\n\t\tconst oldSet = descriptor.set\n\n\t\tgetValue = oldGet ? () => oldGet.call(object) : undefined\n\t\tsetValue = oldSet ? value => oldSet.call(object, value) : undefined\n\t} else {\n\t\tlet _value = descriptor.value\n\n\t\tif (!descriptor.writable) {\n\t\t\tconsole.error(\n\t\t\t\t`Can not observe readonly property \"${String(propName)}\" with descriptor`,\n\t\t\t\tdescriptor,\n\t\t\t\t`of object:`,\n\t\t\t\tobject,\n\t\t\t)\n\n\t\t\tthrow new Error(`Can not observe readonly property \"${String(propName)}\" of object: ${object} (see above)`)\n\t\t}\n\n\t\tdelete descriptor.value\n\t\tdelete descriptor.writable\n\n\t\tgetValue = () => _value\n\t\tsetValue = value => (_value = value)\n\t}\n\n\tif (!setValue) throw new Error('Can not observe read-only property.')\n\tif (!getValue) throw new Error('Can not observe write-only property.')\n\n\tObject.defineProperty(owner, propName, {\n\t\t...descriptor,\n\t\tget: getValue,\n\t\tset(value) {\n\t\t\tsetValue!(value)\n\t\t\trunCallbacks(object, propName, getValue!())\n\t\t},\n\t})\n\n\tobservableProps!.add(propName as PropKey)\n}\n\nfunction runCallbacks(object: T, propName: keyof T, value: any) {\n\tconst callbacks = propsAndCallbacks.get(object)!.get(propName as PropKey)\n\n\tif (!callbacks) return\n\n\tfor (const callback of callbacks) {\n\t\tcallback(propName as PropKey, value)\n\t}\n}\n", "import {observe, unobserve} from 'james-bond'\n\nimport type {Constructor} from 'lowclass'\n\n// We use this to enforce that the @receiver decorator is used on PropReceiver\n// classes.\n//\n// We could've used a Symbol instead, which is simpler, but that causes the\n// infamous \"has or is using private name\" errors due to declaration emit\n// (https://github.com/microsoft/TypeScript/issues/35822)\nconst isPropReceiverClass: unique symbol = Symbol()\n\n/**\n * @class PropReceiver\n *\n * `mixin`\n *\n * Forwards properties of a specified `observedObject` onto properties of\n * `this` object. The properties to be received from `observedObject` are those\n * listed in the `static receivedProperties` array, or the ones decorated with\n * `@receiver`.\n *\n * In particular, LUME uses this to forward properties of a behavior's host\n * element onto the behavior.\n *\n * Example:\n *\n * ```js\n * class SomeBehavior extends PropReceiver(BaseClass) {\n * static receivedProperties = ['foo', 'bar']\n * get observedObject() {\n * return this.element\n * }\n * }\n *\n * const behavior = new SomeBehavior()\n * const el = document.querySelector('.some-element-with-some-behavior')\n * el.foo = 123\n * console.log(behavior.foo) // 123\n * ```\n */\nexport function PropReceiver>(Base: T = Object as any) {\n\t// TODO Maybe this class should not depend on DOM (i.e. don't use methods\n\t// from PossibleCustomElement), and we can have a separate mixin for that.\n\n\t// TODO Use abstract with TS 4.2\n\treturn class PropReceiver extends Base {\n\t\tstatic {\n\t\t\t// Make this unknown to the type system, otherwise we get errors with the mixin usage downstream. :(\n\t\t\t;(this as any)[isPropReceiverClass] = true\n\t\t}\n\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\t\t\tthis._propChangedCallback = this._propChangedCallback.bind(this)\n\t\t}\n\n\t\toverride connectedCallback() {\n\t\t\tsuper.connectedCallback?.()\n\t\t\tthis.#observeProps()\n\t\t}\n\n\t\toverride disconnectedCallback() {\n\t\t\tsuper.disconnectedCallback?.()\n\t\t\tthis.#unobserveProps()\n\t\t}\n\n\t\t/**\n\t\t * @abstract\n\t\t * @property {object} observedObject\n\t\t *\n\t\t * `abstract` `protected` `readonly`\n\t\t *\n\t\t * A subclass should specify the object to observe by defining a `get observedObject` getter.\n\t\t */\n\t\tget observedObject(): object {\n\t\t\tthrow new TypeError(`\n The subclass using PropReceiver must define\n 'observedObject' to specify the object from which props\n are received.\n `)\n\t\t}\n\n\t\t_propChangedCallback(propName: PropKey, value: any) {\n\t\t\t;(this as any)[propName] = value\n\t\t}\n\n\t\t#observeProps() {\n\t\t\tconst ctor = this.constructor as typeof PropReceiver\n\n\t\t\t// Make it unique, before we pass it to observe(), just in case.\n\t\t\tif (ctor.receivedProperties) ctor.receivedProperties = Array.from(new Set(ctor.receivedProperties))\n\n\t\t\tthis.__receiveInitialValues()\n\n\t\t\tobserve(this.observedObject, this.__getReceivedProps(), this._propChangedCallback, {\n\t\t\t\t// inherited: true, // XXX the 'inherited' option doesn't work in this case. Why?\n\t\t\t})\n\t\t}\n\n\t\t#unobserveProps() {\n\t\t\tunobserve(this.observedObject, this.__getReceivedProps(), this._propChangedCallback)\n\t\t}\n\n\t\t/**\n\t\t * @property {string[]} receivedProperties\n\t\t *\n\t\t * `static`\n\t\t *\n\t\t * An array of strings, the properties of observedObject to observe.\n\t\t */\n\t\tstatic receivedProperties?: PropKey[]\n\n\t\t__getReceivedProps() {\n\t\t\tconst ctor = this.constructor as typeof PropReceiver\n\t\t\tconst props = ctor.receivedProperties || []\n\t\t\t// @prod-prune\n\t\t\tif (!Array.isArray(props)) throw new TypeError('Expected static receivedProperties to be an array.')\n\t\t\treturn props as Array\n\t\t}\n\n\t\t__receiveInitialValues() {\n\t\t\tconst observed = this.observedObject\n\n\t\t\tfor (const prop of this.__getReceivedProps()) {\n\t\t\t\tif (prop in observed) {\n\t\t\t\t\tconst value = (observed as any)[prop]\n\t\t\t\t\t// @ts-expect-error indexed access of this\n\t\t\t\t\tthis._propChangedCallback(prop, value !== undefined ? value : this[prop])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport interface PossiblyCustomElement {\n\tconnectedCallback?(): void\n\tdisconnectedCallback?(): void\n\tadoptedCallback?(): void\n\tattributeChangedCallback?(name: string, oldVal: string | null, newVal: string | null): void\n}\n\nfunction checkIsObject(o: unknown): o is object {\n\tif (typeof o !== 'object') throw new Error('cannot use @receiver on class returning a non-object instance')\n\treturn true\n}\n\nexport function receiver(_: unknown, context: DecoratorContext): any {\n\tconst {kind, name} = context\n\n\tif (kind === 'field') {\n\t\treturn function (this: unknown, initialValue: unknown) {\n\t\t\tcheckIsObject(this)\n\t\t\ttrackReceiverProperty(this!, name)\n\t\t\treturn initialValue\n\t\t}\n\t} else if (kind === 'getter' || kind === 'setter' || kind === 'accessor') {\n\t\tcontext.addInitializer!(function (this: unknown) {\n\t\t\tcheckIsObject(this)\n\t\t\ttrackReceiverProperty(this!, name)\n\t\t})\n\t} else {\n\t\tthrow new TypeError(\n\t\t\t'@receiver is for use only on class fields, getters/setters, and auto accessors. Also make sure your class extends from PropReceiver.',\n\t\t)\n\t}\n}\n\nfunction trackReceiverProperty(obj: object, name: PropKey) {\n\tconst ctor = obj.constructor as ReturnType\n\n\tif (!(ctor as any)[isPropReceiverClass])\n\t\tthrow new TypeError('@receiver must be used on a property of a class that extends PropReceiver')\n\n\tif (!ctor.hasOwnProperty('receivedProperties')) ctor.receivedProperties = [...(ctor.receivedProperties || [])]\n\n\tctor.receivedProperties!.push(name)\n}\n\ntype PropKey = string | symbol\n", "import 'element-behaviors'\nimport {element} from '@lume/element'\nimport {PropReceiver} from './PropReceiver.js'\n\nimport type {Element as LumeElement} from '@lume/element'\nimport type {ElementWithBehaviors, PossibleBehaviorConstructor, PossibleBehaviorInstance} from 'element-behaviors'\nimport type {AnyConstructor} from 'lowclass/dist/utils.js'\n\ntype PropKey = string | symbol\n\n/**\n * Alias of the `@element` decorator used on custom elements for use on Behavior\n * classes. If a name is passed in, it defines an element behavior instead of a\n * custom element.\n *\n * Besides defining an element behavior instead of a custom element, it re-uses\n * the `@element` implementation: sets up `observedAttributes`,\n * `attributeChangedCallback`, and makes properties be Solid signals by\n * composing `@reactive` and `@signal` decorators).\n *\n * Example:\n *\n * ```js\n * \u2063@behavior('my-behavior')\n * class MyBehavior extends Behavior {\n * \u2063@numberAttribute foo = 123\n * }\n * ```\n */\nexport function behavior(\n\tname: string,\n): >(Class: T, context?: ClassDecoratorContext) => T\nexport function behavior>(\n\tClass: T,\n\tcontext?: ClassDecoratorContext,\n): T\nexport function behavior(\n\tnameOrClass?: string | AnyConstructor,\n\tcontext?: ClassDecoratorContext,\n) {\n\tif (typeof nameOrClass === 'string' && context == null) {\n\t\treturn (Class: AnyConstructor, context: ClassDecoratorContext) =>\n\t\t\telementBehaviors.define(\n\t\t\t\tnameOrClass,\n\t\t\t\telement(Class as AnyConstructor, context) as PossibleBehaviorConstructor,\n\t\t\t)\n\t} else if (context && context.kind === 'class') {\n\t\treturn element(nameOrClass as AnyConstructor, context)\n\t} else {\n\t\tthrow new TypeError(\n\t\t\t'Invalid decorator usage. Call with a string, or as a plain decorator with, only on a class meant to be used as an element behavior.',\n\t\t)\n\t}\n}\n/**\n * @class Behavior\n * Base class for all LUME behaviors.\n *\n * Features:\n * - Sets `static awaitElementDefined` to `true`, which causes `elementBehaviors` to wait until the behavior's host element is upgraded if it might be a custom element (i.e. when the host element has a hyphen in its name).\n * - Assigns the host element onto `this.element` for convenience.\n * - Calls a subclass's `requiredElementType` method which should return the type (constructor) of allowed elements that the behavior can be hosted on. If the element is not instanceof the `requiredElementType()`, then an error is shown in console. For TypeScript users, it enforces the type of `.element` in subclass code.\n * - Forwards the properties specified in `receivedProperties` from `observedObject` to `this` any time `receivedProperties` on `observedObject` change. Useful for forwarding JS properties from the host element to the behavior. This functionality comes from the [`PropReceiver`](./PropReceiver) class.\n *\n * @extends PropReceiver\n */\nexport abstract class Behavior extends PropReceiver() {\n\t// If true, elementBehaviors will wait for a custom element to be defined\n\t// before running \"connectedCallback\" or \"disconnectedCallback\" on the\n\t// behavior. This guarantees that the host element is already upgraded\n\t// before the life cycle hooks run.\n\tstatic awaitElementDefined = true\n\n\telement: Element\n\n\tconstructor(element: ElementWithBehaviors) {\n\t\tsuper()\n\n\t\t// Ensure this.element is the type specified by a subclass's requiredElementType.\n\t\t// @prod-prune\n\t\tthis.#checkElementIsLibraryElement(element)\n\n\t\tthis.element = element\n\t}\n\n\t/**\n\t * @method requiredElementType - A subclass can override this method in\n\t * order to enforce that the behavior can be applied only on certain types\n\t * of elements by returning an array of constructors. An error will be\n\t * thrown if `this.element` is not an instanceof one of the constructors.\n\t *\n\t * If the element's tag name has a hyphen in it, the logic will consider it\n\t * to possibly be a custom element and will wait for it to be upgraded\n\t * before performing the check; if the custom element is not upgraded within\n\t * a second, an error is thrown.\n\t *\n\t * @returns {[typeof Element]}\n\t */\n\trequiredElementType() {\n\t\treturn [Element]\n\t}\n\n\t// used by PropReceiver. See PropReceiver.ts\n\toverride get observedObject() {\n\t\treturn this.element\n\t}\n\n\t// a promise resolved when an element is upgraded\n\t#whenDefined: Promise = null! as Promise\n\t#elementDefined = false\n\n\toverride __receiveInitialValues() {\n\t\tsuper.__receiveInitialValues()\n\t\tthis.#fowardPreUpgradeValues()\n\t}\n\n\t#preUpgradeValuesHandled = false\n\n\t// TODO Write a test to ensure that pre-upgrade values are handled.\n\t#fowardPreUpgradeValues() {\n\t\tif (this.#preUpgradeValuesHandled) return\n\n\t\tconst el = this.observedObject\n\n\t\tif (!isLumeElement(el)) return\n\n\t\tthis.#preUpgradeValuesHandled = true\n\n\t\tfor (const prop of this.__getReceivedProps()) {\n\t\t\t// prettier-ignore\n\t\t\tconst value = el.\n\t\t\t\t// @ts-expect-error protected access is ok here\n\t\t\t\t_preUpgradeValues\n\t\t\t\t.get(prop)\n\n\t\t\tif (value !== undefined) this._propChangedCallback(prop as PropKey, value)\n\t\t}\n\t}\n\n\t// TODO add a test to make sure this check works\n\t// @prod-prune\n\tasync #checkElementIsLibraryElement(element: Element) {\n\t\tconst classes = this.requiredElementType()\n\n\t\tif (element.nodeName.includes('-')) {\n\t\t\tthis.#whenDefined = customElements.whenDefined(element.nodeName.toLowerCase())\n\n\t\t\tthis.#whenDefined.then(() => {\n\t\t\t\tthis.#elementDefined = classes.some(Class => element instanceof Class)\n\n\t\t\t\tthis.#fowardPreUpgradeValues()\n\t\t\t})\n\n\t\t\tawait Promise.race([this.#whenDefined, new Promise(r => setTimeout(r, 1000))])\n\n\t\t\tif (!this.#elementDefined) {\n\t\t\t\tconst errorMessage = `\n\t\t\t\t\tEither the element you're using the behavior on\n\t\t\t\t\t(<${element.tagName.toLowerCase()}>) is not an instance of one\n\t\t\t\t\tof the allowed classes, or there was a 1-second timeout waiting\n\t\t\t\t\tfor the element to be defined. Please make sure all elements\n\t\t\t\t\tyou intend to use are defined. The allowed classes are:\n\t\t\t\t`\n\t\t\t\tqueueMicrotask(() => console.error(errorMessage, classes))\n\t\t\t\tthrow new Error(`${errorMessage}\n\n\t\t\t\t\t${classes}\n\t\t\t\t`)\n\t\t\t}\n\t\t} else {\n\t\t\tconst errorMessage = `\n\t\t\t\tThe element you're using the mesh behavior on (<${element.tagName.toLowerCase()}>)\n\t\t\t\tis not an instance of one of the following classes:\n\t\t\t`\n\t\t\tqueueMicrotask(() => console.error(errorMessage, classes))\n\t\t\tthrow new Error(`${errorMessage}\n\n\t\t\t\t${classes}\n\t\t\t`)\n\t\t}\n\t}\n}\n\nfunction isLumeElement(el: Element): el is LumeElement {\n\treturn '_preUpgradeValues' in el\n}\n", "const _lut = [ '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' ];\n\nlet _seed = 1234567;\n\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction generateUUID() {\n\n\tconst d0 = Math.random() * 0xffffffff | 0;\n\tconst d1 = Math.random() * 0xffffffff | 0;\n\tconst d2 = Math.random() * 0xffffffff | 0;\n\tconst d3 = Math.random() * 0xffffffff | 0;\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t// .toLowerCase() here flattens concatenated strings to save heap memory space.\n\treturn uuid.toLowerCase();\n\n}\n\nfunction clamp( value, min, max ) {\n\n\treturn Math.max( min, Math.min( max, value ) );\n\n}\n\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction euclideanModulo( n, m ) {\n\n\treturn ( ( n % m ) + m ) % m;\n\n}\n\n// Linear mapping from range to range \nfunction mapLinear( x, a1, a2, b1, b2 ) {\n\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n}\n\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction inverseLerp( x, y, value ) {\n\n\tif ( x !== y ) {\n\n\t\treturn ( value - x ) / ( y - x );\n\n\t} else {\n\n\t\treturn 0;\n\n\t}\n\n}\n\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction lerp( x, y, t ) {\n\n\treturn ( 1 - t ) * x + t * y;\n\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction damp( x, y, lambda, dt ) {\n\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\n\n}\n\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction pingpong( x, length = 1 ) {\n\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\n\n}\n\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction smoothstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * ( 3 - 2 * x );\n\n}\n\nfunction smootherstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n}\n\n// Random integer from interval\nfunction randInt( low, high ) {\n\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n}\n\n// Random float from interval\nfunction randFloat( low, high ) {\n\n\treturn low + Math.random() * ( high - low );\n\n}\n\n// Random float from <-range/2, range/2> interval\nfunction randFloatSpread( range ) {\n\n\treturn range * ( 0.5 - Math.random() );\n\n}\n\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction seededRandom( s ) {\n\n\tif ( s !== undefined ) _seed = s;\n\n\t// Mulberry32 generator\n\n\tlet t = _seed += 0x6D2B79F5;\n\n\tt = Math.imul( t ^ t >>> 15, t | 1 );\n\n\tt ^= t + Math.imul( t ^ t >>> 7, t | 61 );\n\n\treturn ( ( t ^ t >>> 14 ) >>> 0 ) / 4294967296;\n\n}\n\nfunction degToRad( degrees ) {\n\n\treturn degrees * DEG2RAD;\n\n}\n\nfunction radToDeg( radians ) {\n\n\treturn radians * RAD2DEG;\n\n}\n\nfunction isPowerOfTwo( value ) {\n\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n}\n\nfunction ceilPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction floorPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\n\n\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n\t// rotations are applied to the axes in the order specified by 'order'\n\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n\t// angles are in radians\n\n\tconst cos = Math.cos;\n\tconst sin = Math.sin;\n\n\tconst c2 = cos( b / 2 );\n\tconst s2 = sin( b / 2 );\n\n\tconst c13 = cos( ( a + c ) / 2 );\n\tconst s13 = sin( ( a + c ) / 2 );\n\n\tconst c1_3 = cos( ( a - c ) / 2 );\n\tconst s1_3 = sin( ( a - c ) / 2 );\n\n\tconst c3_1 = cos( ( c - a ) / 2 );\n\tconst s3_1 = sin( ( c - a ) / 2 );\n\n\tswitch ( order ) {\n\n\t\tcase 'XYX':\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YZY':\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZXZ':\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'XZX':\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YXY':\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZYZ':\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\n\n\t}\n\n}\n\nfunction denormalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn value / 4294967295.0;\n\n\t\tcase Uint16Array:\n\n\t\t\treturn value / 65535.0;\n\n\t\tcase Uint8Array:\n\n\t\t\treturn value / 255.0;\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.max( value / 2147483647.0, - 1.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.max( value / 32767.0, - 1.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.max( value / 127.0, - 1.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nfunction normalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn Math.round( value * 4294967295.0 );\n\n\t\tcase Uint16Array:\n\n\t\t\treturn Math.round( value * 65535.0 );\n\n\t\tcase Uint8Array:\n\n\t\t\treturn Math.round( value * 255.0 );\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.round( value * 2147483647.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.round( value * 32767.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.round( value * 127.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nconst MathUtils = {\n\tDEG2RAD: DEG2RAD,\n\tRAD2DEG: RAD2DEG,\n\tgenerateUUID: generateUUID,\n\tclamp: clamp,\n\teuclideanModulo: euclideanModulo,\n\tmapLinear: mapLinear,\n\tinverseLerp: inverseLerp,\n\tlerp: lerp,\n\tdamp: damp,\n\tpingpong: pingpong,\n\tsmoothstep: smoothstep,\n\tsmootherstep: smootherstep,\n\trandInt: randInt,\n\trandFloat: randFloat,\n\trandFloatSpread: randFloatSpread,\n\tseededRandom: seededRandom,\n\tdegToRad: degToRad,\n\tradToDeg: radToDeg,\n\tisPowerOfTwo: isPowerOfTwo,\n\tceilPowerOfTwo: ceilPowerOfTwo,\n\tfloorPowerOfTwo: floorPowerOfTwo,\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler,\n\tnormalize: normalize,\n\tdenormalize: denormalize\n};\n\nexport {\n\tDEG2RAD,\n\tRAD2DEG,\n\tgenerateUUID,\n\tclamp,\n\teuclideanModulo,\n\tmapLinear,\n\tinverseLerp,\n\tlerp,\n\tdamp,\n\tpingpong,\n\tsmoothstep,\n\tsmootherstep,\n\trandInt,\n\trandFloat,\n\trandFloatSpread,\n\tseededRandom,\n\tdegToRad,\n\tradToDeg,\n\tisPowerOfTwo,\n\tceilPowerOfTwo,\n\tfloorPowerOfTwo,\n\tsetQuaternionFromProperEuler,\n\tnormalize,\n\tdenormalize,\n\tMathUtils\n};\n", "import * as MathUtils from './MathUtils.js';\n\nclass Quaternion {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tthis.isQuaternion = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t}\n\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\t// fuzz-free, array-based Quaternion SLERP operation\n\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( t === 0 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x0;\n\t\t\tdst[ dstOffset + 1 ] = y0;\n\t\t\tdst[ dstOffset + 2 ] = z0;\n\t\t\tdst[ dstOffset + 3 ] = w0;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( t === 1 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x1;\n\t\t\tdst[ dstOffset + 1 ] = y1;\n\t\t\tdst[ dstOffset + 2 ] = z1;\n\t\t\tdst[ dstOffset + 3 ] = w1;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tlet s = 1 - t;\n\t\t\tconst cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\n\t\t\t\tsqrSin = 1 - cos * cos;\n\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\n\t\t\tif ( sqrSin > Number.EPSILON ) {\n\n\t\t\t\tconst sin = Math.sqrt( sqrSin ),\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\n\n\t\t\t\ts = Math.sin( s * len ) / sin;\n\t\t\t\tt = Math.sin( t * len ) / sin;\n\n\t\t\t}\n\n\t\t\tconst tDir = t * dir;\n\n\t\t\tx0 = x0 * s + x1 * tDir;\n\t\t\ty0 = y0 * s + y1 * tDir;\n\t\t\tz0 = z0 * s + z1 * tDir;\n\t\t\tw0 = w0 * s + w1 * tDir;\n\n\t\t\t// Normalize in case we just did a lerp:\n\t\t\tif ( s === 1 - t ) {\n\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\n\n\t\tconst x0 = src0[ srcOffset0 ];\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 ];\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\n\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n\n\t\treturn dst;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget w() {\n\n\t\treturn this._w;\n\n\t}\n\n\tset w( value ) {\n\n\t\tthis._w = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t}\n\n\tcopy( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromEuler( euler, update = true ) {\n\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tconst cos = Math.cos;\n\t\tconst sin = Math.sin;\n\n\t\tconst c1 = cos( x / 2 );\n\t\tconst c2 = cos( y / 2 );\n\t\tconst c3 = cos( z / 2 );\n\n\t\tconst s1 = sin( x / 2 );\n\t\tconst s2 = sin( y / 2 );\n\t\tconst s3 = sin( z / 2 );\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAxisAngle( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\t// assumes axis is normalized\n\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromUnitVectors( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tlet r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < Number.EPSILON ) {\n\n\t\t\t// vFrom and vTo point in opposite directions\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t}\n\n\tangleTo( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( MathUtils.clamp( this.dot( q ), - 1, 1 ) ) );\n\n\t}\n\n\trotateTowards( q, step ) {\n\n\t\tconst angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tconst t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\treturn this.set( 0, 0, 0, 1 );\n\n\t}\n\n\tinvert() {\n\n\t\t// quaternion is assumed to have unit length\n\n\t\treturn this.conjugate();\n\n\t}\n\n\tconjugate() {\n\n\t\tthis._x *= - 1;\n\t\tthis._y *= - 1;\n\t\tthis._z *= - 1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t}\n\n\tnormalize() {\n\n\t\tlet l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t}\n\n\tpremultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t}\n\n\tmultiplyQuaternions( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerp( qb, t ) {\n\n\t\tif ( t === 0 ) return this;\n\t\tif ( t === 1 ) return this.copy( qb );\n\n\t\tconst x = this._x, y = this._y, z = this._z, w = this._w;\n\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n\t\tlet cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n\n\t\tif ( cosHalfTheta < 0 ) {\n\n\t\t\tthis._w = - qb._w;\n\t\t\tthis._x = - qb._x;\n\t\t\tthis._y = - qb._y;\n\t\t\tthis._z = - qb._z;\n\n\t\t\tcosHalfTheta = - cosHalfTheta;\n\n\t\t} else {\n\n\t\t\tthis.copy( qb );\n\n\t\t}\n\n\t\tif ( cosHalfTheta >= 1.0 ) {\n\n\t\t\tthis._w = w;\n\t\t\tthis._x = x;\n\t\t\tthis._y = y;\n\t\t\tthis._z = z;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\n\n\t\t\tconst s = 1 - t;\n\t\t\tthis._w = s * w + t * this._w;\n\t\t\tthis._x = s * x + t * this._x;\n\t\t\tthis._y = s * y + t * this._y;\n\t\t\tthis._z = s * z + t * this._z;\n\n\t\t\tthis.normalize(); // normalize calls _onChangeCallback()\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\n\t\tconst halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\n\t\tconst ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerpQuaternions( qa, qb, t ) {\n\n\t\treturn this.copy( qa ).slerp( qb, t );\n\n\t}\n\n\trandom() {\n\n\t\t// Derived from http://planning.cs.uiuc.edu/node198.html\n\t\t// Note, this source uses w, x, y, z ordering,\n\t\t// so we swap the order below.\n\n\t\tconst u1 = Math.random();\n\t\tconst sqrt1u1 = Math.sqrt( 1 - u1 );\n\t\tconst sqrtu1 = Math.sqrt( u1 );\n\n\t\tconst u2 = 2 * Math.PI * Math.random();\n\n\t\tconst u3 = 2 * Math.PI * Math.random();\n\n\t\treturn this.set(\n\t\t\tsqrt1u1 * Math.cos( u2 ),\n\t\t\tsqrtu1 * Math.sin( u3 ),\n\t\t\tsqrtu1 * Math.cos( u3 ),\n\t\t\tsqrt1u1 * Math.sin( u2 ),\n\t\t);\n\n\t}\n\n\tequals( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis._x = attribute.getX( index );\n\t\tthis._y = attribute.getY( index );\n\t\tthis._z = attribute.getZ( index );\n\t\tthis._w = attribute.getW( index );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.toArray();\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._w;\n\n\t}\n\n}\n\nexport { Quaternion };\n", "import * as MathUtils from './MathUtils.js';\nimport { Quaternion } from './Quaternion.js';\n\nclass Vector3 {\n\n\tconstructor( x = 0, y = 0, z = 0 ) {\n\n\t\tVector3.prototype.isVector3 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t}\n\n\tset( x, y, z ) {\n\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyVectors( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyEuler( euler ) {\n\n\t\treturn this.applyQuaternion( _quaternion.setFromEuler( euler ) );\n\n\t}\n\n\tapplyAxisAngle( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion.setFromAxisAngle( axis, angle ) );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t// quaternion q is assumed to have unit length\n\n\t\tconst vx = this.x, vy = this.y, vz = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// t = 2 * cross( q.xyz, v );\n\t\tconst tx = 2 * ( qy * vz - qz * vy );\n\t\tconst ty = 2 * ( qz * vx - qx * vz );\n\t\tconst tz = 2 * ( qx * vy - qy * vx );\n\n\t\t// v + q.w * t + cross( q.xyz, t );\n\t\tthis.x = vx + qw * tx + qy * tz - qz * ty;\n\t\tthis.y = vy + qw * ty + qz * tx - qx * tz;\n\t\tthis.z = vz + qw * tz + qx * ty - qy * tx;\n\n\t\treturn this;\n\n\t}\n\n\tproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t}\n\n\tunproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t}\n\n\t// TODO lengthSquared?\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.crossVectors( this, v );\n\n\t}\n\n\tcrossVectors( a, b ) {\n\n\t\tconst ax = a.x, ay = a.y, az = a.z;\n\t\tconst bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t}\n\n\tprojectOnVector( v ) {\n\n\t\tconst denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tconst scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t}\n\n\tprojectOnPlane( planeNormal ) {\n\n\t\t_vector.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector );\n\n\t}\n\n\treflect( normal ) {\n\n\t\t// reflect incident vector off plane orthogonal to normal\n\t\t// normal is assumed to have unit length\n\n\t\treturn this.sub( _vector.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( MathUtils.clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t}\n\n\tsetFromSpherical( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t}\n\n\tsetFromSphericalCoords( radius, phi, theta ) {\n\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCylindrical( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t}\n\n\tsetFromCylindricalCoords( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixScale( m ) {\n\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixColumn( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t}\n\n\tsetFromMatrix3Column( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t}\n\n\tsetFromEuler( e ) {\n\n\t\tthis.x = e._x;\n\t\tthis.y = e._y;\n\t\tthis.z = e._z;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromColor( c ) {\n\n\t\tthis.x = c.r;\n\t\tthis.y = c.g;\n\t\tthis.z = c.b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\trandomDirection() {\n\n\t\t// Derived from https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst u = ( Math.random() - 0.5 ) * 2;\n\t\tconst t = Math.random() * Math.PI * 2;\n\t\tconst f = Math.sqrt( 1 - u ** 2 );\n\n\t\tthis.x = f * Math.cos( t );\n\t\tthis.y = f * Math.sin( t );\n\t\tthis.z = u;\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\n\t}\n\n}\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\n\nexport { Vector3 };\n", "export const REVISION = '160';\n\nexport const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\nexport const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\nexport const CullFaceNone = 0;\nexport const CullFaceBack = 1;\nexport const CullFaceFront = 2;\nexport const CullFaceFrontBack = 3;\nexport const BasicShadowMap = 0;\nexport const PCFShadowMap = 1;\nexport const PCFSoftShadowMap = 2;\nexport const VSMShadowMap = 3;\nexport const FrontSide = 0;\nexport const BackSide = 1;\nexport const DoubleSide = 2;\nexport const TwoPassDoubleSide = 2; // r149\nexport const NoBlending = 0;\nexport const NormalBlending = 1;\nexport const AdditiveBlending = 2;\nexport const SubtractiveBlending = 3;\nexport const MultiplyBlending = 4;\nexport const CustomBlending = 5;\nexport const AddEquation = 100;\nexport const SubtractEquation = 101;\nexport const ReverseSubtractEquation = 102;\nexport const MinEquation = 103;\nexport const MaxEquation = 104;\nexport const ZeroFactor = 200;\nexport const OneFactor = 201;\nexport const SrcColorFactor = 202;\nexport const OneMinusSrcColorFactor = 203;\nexport const SrcAlphaFactor = 204;\nexport const OneMinusSrcAlphaFactor = 205;\nexport const DstAlphaFactor = 206;\nexport const OneMinusDstAlphaFactor = 207;\nexport const DstColorFactor = 208;\nexport const OneMinusDstColorFactor = 209;\nexport const SrcAlphaSaturateFactor = 210;\nexport const ConstantColorFactor = 211;\nexport const OneMinusConstantColorFactor = 212;\nexport const ConstantAlphaFactor = 213;\nexport const OneMinusConstantAlphaFactor = 214;\nexport const NeverDepth = 0;\nexport const AlwaysDepth = 1;\nexport const LessDepth = 2;\nexport const LessEqualDepth = 3;\nexport const EqualDepth = 4;\nexport const GreaterEqualDepth = 5;\nexport const GreaterDepth = 6;\nexport const NotEqualDepth = 7;\nexport const MultiplyOperation = 0;\nexport const MixOperation = 1;\nexport const AddOperation = 2;\nexport const NoToneMapping = 0;\nexport const LinearToneMapping = 1;\nexport const ReinhardToneMapping = 2;\nexport const CineonToneMapping = 3;\nexport const ACESFilmicToneMapping = 4;\nexport const CustomToneMapping = 5;\nexport const AgXToneMapping = 6;\nexport const AttachedBindMode = 'attached';\nexport const DetachedBindMode = 'detached';\n\nexport const UVMapping = 300;\nexport const CubeReflectionMapping = 301;\nexport const CubeRefractionMapping = 302;\nexport const EquirectangularReflectionMapping = 303;\nexport const EquirectangularRefractionMapping = 304;\nexport const CubeUVReflectionMapping = 306;\nexport const RepeatWrapping = 1000;\nexport const ClampToEdgeWrapping = 1001;\nexport const MirroredRepeatWrapping = 1002;\nexport const NearestFilter = 1003;\nexport const NearestMipmapNearestFilter = 1004;\nexport const NearestMipMapNearestFilter = 1004;\nexport const NearestMipmapLinearFilter = 1005;\nexport const NearestMipMapLinearFilter = 1005;\nexport const LinearFilter = 1006;\nexport const LinearMipmapNearestFilter = 1007;\nexport const LinearMipMapNearestFilter = 1007;\nexport const LinearMipmapLinearFilter = 1008;\nexport const LinearMipMapLinearFilter = 1008;\nexport const UnsignedByteType = 1009;\nexport const ByteType = 1010;\nexport const ShortType = 1011;\nexport const UnsignedShortType = 1012;\nexport const IntType = 1013;\nexport const UnsignedIntType = 1014;\nexport const FloatType = 1015;\nexport const HalfFloatType = 1016;\nexport const UnsignedShort4444Type = 1017;\nexport const UnsignedShort5551Type = 1018;\nexport const UnsignedInt248Type = 1020;\nexport const AlphaFormat = 1021;\nexport const RGBAFormat = 1023;\nexport const LuminanceFormat = 1024;\nexport const LuminanceAlphaFormat = 1025;\nexport const DepthFormat = 1026;\nexport const DepthStencilFormat = 1027;\nexport const RedFormat = 1028;\nexport const RedIntegerFormat = 1029;\nexport const RGFormat = 1030;\nexport const RGIntegerFormat = 1031;\nexport const RGBAIntegerFormat = 1033;\n\nexport const RGB_S3TC_DXT1_Format = 33776;\nexport const RGBA_S3TC_DXT1_Format = 33777;\nexport const RGBA_S3TC_DXT3_Format = 33778;\nexport const RGBA_S3TC_DXT5_Format = 33779;\nexport const RGB_PVRTC_4BPPV1_Format = 35840;\nexport const RGB_PVRTC_2BPPV1_Format = 35841;\nexport const RGBA_PVRTC_4BPPV1_Format = 35842;\nexport const RGBA_PVRTC_2BPPV1_Format = 35843;\nexport const RGB_ETC1_Format = 36196;\nexport const RGB_ETC2_Format = 37492;\nexport const RGBA_ETC2_EAC_Format = 37496;\nexport const RGBA_ASTC_4x4_Format = 37808;\nexport const RGBA_ASTC_5x4_Format = 37809;\nexport const RGBA_ASTC_5x5_Format = 37810;\nexport const RGBA_ASTC_6x5_Format = 37811;\nexport const RGBA_ASTC_6x6_Format = 37812;\nexport const RGBA_ASTC_8x5_Format = 37813;\nexport const RGBA_ASTC_8x6_Format = 37814;\nexport const RGBA_ASTC_8x8_Format = 37815;\nexport const RGBA_ASTC_10x5_Format = 37816;\nexport const RGBA_ASTC_10x6_Format = 37817;\nexport const RGBA_ASTC_10x8_Format = 37818;\nexport const RGBA_ASTC_10x10_Format = 37819;\nexport const RGBA_ASTC_12x10_Format = 37820;\nexport const RGBA_ASTC_12x12_Format = 37821;\nexport const RGBA_BPTC_Format = 36492;\nexport const RGB_BPTC_SIGNED_Format = 36494;\nexport const RGB_BPTC_UNSIGNED_Format = 36495;\nexport const RED_RGTC1_Format = 36283;\nexport const SIGNED_RED_RGTC1_Format = 36284;\nexport const RED_GREEN_RGTC2_Format = 36285;\nexport const SIGNED_RED_GREEN_RGTC2_Format = 36286;\nexport const LoopOnce = 2200;\nexport const LoopRepeat = 2201;\nexport const LoopPingPong = 2202;\nexport const InterpolateDiscrete = 2300;\nexport const InterpolateLinear = 2301;\nexport const InterpolateSmooth = 2302;\nexport const ZeroCurvatureEnding = 2400;\nexport const ZeroSlopeEnding = 2401;\nexport const WrapAroundEnding = 2402;\nexport const NormalAnimationBlendMode = 2500;\nexport const AdditiveAnimationBlendMode = 2501;\nexport const TrianglesDrawMode = 0;\nexport const TriangleStripDrawMode = 1;\nexport const TriangleFanDrawMode = 2;\n/** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */\nexport const LinearEncoding = 3000;\n/** @deprecated Use SRGBColorSpace in three.js r152+. */\nexport const sRGBEncoding = 3001;\nexport const BasicDepthPacking = 3200;\nexport const RGBADepthPacking = 3201;\nexport const TangentSpaceNormalMap = 0;\nexport const ObjectSpaceNormalMap = 1;\n\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nexport const NoColorSpace = '';\nexport const SRGBColorSpace = 'srgb';\nexport const LinearSRGBColorSpace = 'srgb-linear';\nexport const DisplayP3ColorSpace = 'display-p3';\nexport const LinearDisplayP3ColorSpace = 'display-p3-linear';\n\nexport const LinearTransfer = 'linear';\nexport const SRGBTransfer = 'srgb';\n\nexport const Rec709Primaries = 'rec709';\nexport const P3Primaries = 'p3';\n\nexport const ZeroStencilOp = 0;\nexport const KeepStencilOp = 7680;\nexport const ReplaceStencilOp = 7681;\nexport const IncrementStencilOp = 7682;\nexport const DecrementStencilOp = 7683;\nexport const IncrementWrapStencilOp = 34055;\nexport const DecrementWrapStencilOp = 34056;\nexport const InvertStencilOp = 5386;\n\nexport const NeverStencilFunc = 512;\nexport const LessStencilFunc = 513;\nexport const EqualStencilFunc = 514;\nexport const LessEqualStencilFunc = 515;\nexport const GreaterStencilFunc = 516;\nexport const NotEqualStencilFunc = 517;\nexport const GreaterEqualStencilFunc = 518;\nexport const AlwaysStencilFunc = 519;\n\nexport const NeverCompare = 512;\nexport const LessCompare = 513;\nexport const EqualCompare = 514;\nexport const LessEqualCompare = 515;\nexport const GreaterCompare = 516;\nexport const NotEqualCompare = 517;\nexport const GreaterEqualCompare = 518;\nexport const AlwaysCompare = 519;\n\nexport const StaticDrawUsage = 35044;\nexport const DynamicDrawUsage = 35048;\nexport const StreamDrawUsage = 35040;\nexport const StaticReadUsage = 35045;\nexport const DynamicReadUsage = 35049;\nexport const StreamReadUsage = 35041;\nexport const StaticCopyUsage = 35046;\nexport const DynamicCopyUsage = 35050;\nexport const StreamCopyUsage = 35042;\n\nexport const GLSL1 = '100';\nexport const GLSL3 = '300 es';\n\nexport const _SRGBAFormat = 1035; // fallback for WebGL 1\n\nexport const WebGLCoordinateSystem = 2000;\nexport const WebGPUCoordinateSystem = 2001;\n", "import { WebGLCoordinateSystem, WebGPUCoordinateSystem } from '../constants.js';\nimport { Vector3 } from './Vector3.js';\n\nclass Matrix4 {\n\n\tconstructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tMatrix4.prototype.isMatrix4 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\tcopyPosition( m ) {\n\n\t\tconst te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix3( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmakeBasis( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractRotation( m ) {\n\n\t\t// this method does not support reflection matrices\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tconst scaleX = 1 / _v1.setFromMatrixColumn( m, 0 ).length();\n\t\tconst scaleY = 1 / _v1.setFromMatrixColumn( m, 1 ).length();\n\t\tconst scaleZ = 1 / _v1.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromEuler( euler ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromQuaternion( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t}\n\n\tlookAt( eye, target, up ) {\n\n\t\tconst te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\t//TODO: make this more efficient\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n\t\treturn (\n\t\t\tn41 * (\n\t\t\t\t+ n14 * n23 * n32\n\t\t\t\t - n13 * n24 * n32\n\t\t\t\t - n14 * n22 * n33\n\t\t\t\t + n12 * n24 * n33\n\t\t\t\t + n13 * n22 * n34\n\t\t\t\t - n12 * n23 * n34\n\t\t\t) +\n\t\t\tn42 * (\n\t\t\t\t+ n11 * n23 * n34\n\t\t\t\t - n11 * n24 * n33\n\t\t\t\t + n14 * n21 * n33\n\t\t\t\t - n13 * n21 * n34\n\t\t\t\t + n13 * n24 * n31\n\t\t\t\t - n14 * n23 * n31\n\t\t\t) +\n\t\t\tn43 * (\n\t\t\t\t+ n11 * n24 * n32\n\t\t\t\t - n11 * n22 * n34\n\t\t\t\t - n14 * n21 * n32\n\t\t\t\t + n12 * n21 * n34\n\t\t\t\t + n14 * n22 * n31\n\t\t\t\t - n12 * n24 * n31\n\t\t\t) +\n\t\t\tn44 * (\n\t\t\t\t- n13 * n22 * n31\n\t\t\t\t - n11 * n23 * n32\n\t\t\t\t + n11 * n22 * n33\n\t\t\t\t + n13 * n21 * n32\n\t\t\t\t - n12 * n21 * n33\n\t\t\t\t + n12 * n23 * n31\n\t\t\t)\n\n\t\t);\n\n\t}\n\n\ttranspose() {\n\n\t\tconst te = this.elements;\n\t\tlet tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tsetPosition( x, y, z ) {\n\n\t\tconst te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tinvert() {\n\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\n\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n\n\t\tconst det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\n\n\t\tte[ 4 ] = t12 * detInv;\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\n\n\t\tte[ 8 ] = t13 * detInv;\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\n\n\t\tte[ 12 ] = t14 * detInv;\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\tscale( v ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxScaleOnAxis() {\n\n\t\tconst te = this.elements;\n\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t}\n\n\tmakeTranslation( x, y, z ) {\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x.x,\n\t\t\t\t0, 1, 0, x.y,\n\t\t\t\t0, 0, 1, x.z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x,\n\t\t\t\t0, 1, 0, y,\n\t\t\t\t0, 0, 1, z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationX( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationY( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationZ( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationAxis( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tconst c = Math.cos( angle );\n\t\tconst s = Math.sin( angle );\n\t\tconst t = 1 - c;\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\n\t\tconst tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\n\n\t\tthis.set(\n\n\t\t\t1, yx, zx, 0,\n\t\t\txy, 1, zy, 0,\n\t\t\txz, yz, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tdecompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tlet sx = _v1.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tconst sy = _v1.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tconst sz = _v1.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determine is negative, we need to invert one scale\n\t\tconst det = this.determinant();\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\t// scale the rotation part\n\t\t_m1.copy( this );\n\n\t\tconst invSX = 1 / sx;\n\t\tconst invSY = 1 / sy;\n\t\tconst invSZ = 1 / sz;\n\n\t\t_m1.elements[ 0 ] *= invSX;\n\t\t_m1.elements[ 1 ] *= invSX;\n\t\t_m1.elements[ 2 ] *= invSX;\n\n\t\t_m1.elements[ 4 ] *= invSY;\n\t\t_m1.elements[ 5 ] *= invSY;\n\t\t_m1.elements[ 6 ] *= invSY;\n\n\t\t_m1.elements[ 8 ] *= invSZ;\n\t\t_m1.elements[ 9 ] *= invSZ;\n\t\t_m1.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tmakePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = 2 * near / ( right - left );\n\t\tconst y = 2 * near / ( top - bottom );\n\n\t\tconst a = ( right + left ) / ( right - left );\n\t\tconst b = ( top + bottom ) / ( top - bottom );\n\n\t\tlet c, d;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tc = - ( far + near ) / ( far - near );\n\t\t\td = ( - 2 * far * near ) / ( far - near );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tc = - far / ( far - near );\n\t\t\td = ( - far * near ) / ( far - near );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a; \tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b; \tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c; \tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t}\n\n\tmakeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst w = 1.0 / ( right - left );\n\t\tconst h = 1.0 / ( top - bottom );\n\t\tconst p = 1.0 / ( far - near );\n\n\t\tconst x = ( right + left ) * w;\n\t\tconst y = ( top + bottom ) * h;\n\n\t\tlet z, zInv;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tz = ( far + near ) * p;\n\t\t\tzInv = - 2 * p;\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tz = near * p;\n\t\t\tzInv = - 1 * p;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = - x;\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0; \t\tte[ 13 ] = - y;\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = zInv;\tte[ 14 ] = - z;\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n}\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\nconst _x = /*@__PURE__*/ new Vector3();\nconst _y = /*@__PURE__*/ new Vector3();\nconst _z = /*@__PURE__*/ new Vector3();\n\nexport { Matrix4 };\n", "/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\n\nclass EventDispatcher {\n\n\taddEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t}\n\n\thasEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return false;\n\n\t\tconst listeners = this._listeners;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\n\n\t}\n\n\tremoveEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tconst index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\t// Make a copy, in case listeners are removed while iterating.\n\t\t\tconst array = listenerArray.slice( 0 );\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t\tevent.target = null;\n\n\t\t}\n\n\t}\n\n}\n\n\nexport { EventDispatcher };\n", "import { Quaternion } from './Quaternion.js';\nimport { Matrix4 } from './Matrix4.js';\nimport { clamp } from './MathUtils.js';\n\nconst _matrix = /*@__PURE__*/ new Matrix4();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\n\nclass Euler {\n\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER ) {\n\n\t\tthis.isEuler = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget order() {\n\n\t\treturn this._order;\n\n\t}\n\n\tset order( value ) {\n\n\t\tthis._order = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, order = this._order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t}\n\n\tcopy( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements;\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\n\t\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\n\t\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\n\t\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = 0;\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\n\t\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\n\t\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\n\t\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._y = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromQuaternion( q, order, update ) {\n\n\t\t_matrix.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix, order, update );\n\n\t}\n\n\tsetFromVector3( v, order = this._order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order );\n\n\t}\n\n\treorder( newOrder ) {\n\n\t\t// WARNING: this discards revolution information -bhouston\n\n\t\t_quaternion.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion, newOrder );\n\n\t}\n\n\tequals( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t}\n\n\tfromArray( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._order;\n\n\t}\n\n}\n\nEuler.DEFAULT_ORDER = 'XYZ';\n\nexport { Euler };\n", "class Layers {\n\n\tconstructor() {\n\n\t\tthis.mask = 1 | 0;\n\n\t}\n\n\tset( channel ) {\n\n\t\tthis.mask = ( 1 << channel | 0 ) >>> 0;\n\n\t}\n\n\tenable( channel ) {\n\n\t\tthis.mask |= 1 << channel | 0;\n\n\t}\n\n\tenableAll() {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t}\n\n\ttoggle( channel ) {\n\n\t\tthis.mask ^= 1 << channel | 0;\n\n\t}\n\n\tdisable( channel ) {\n\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\n\n\t}\n\n\tdisableAll() {\n\n\t\tthis.mask = 0;\n\n\t}\n\n\ttest( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n\tisEnabled( channel ) {\n\n\t\treturn ( this.mask & ( 1 << channel | 0 ) ) !== 0;\n\n\t}\n\n}\n\n\nexport { Layers };\n", "class Matrix3 {\n\n\tconstructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tMatrix3.prototype.isMatrix3 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrix3Column( this, 0 );\n\t\tyAxis.setFromMatrix3Column( this, 1 );\n\t\tzAxis.setFromMatrix3Column( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix4( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t}\n\n\tinvert() {\n\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\ttranspose() {\n\n\t\tlet tmp;\n\t\tconst m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tgetNormalMatrix( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\n\n\t}\n\n\ttransposeIntoArray( r ) {\n\n\t\tconst m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tconst c = Math.cos( rotation );\n\t\tconst s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tscale( sx, sy ) {\n\n\t\tthis.premultiply( _m3.makeScale( sx, sy ) );\n\n\t\treturn this;\n\n\t}\n\n\trotate( theta ) {\n\n\t\tthis.premultiply( _m3.makeRotation( - theta ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( tx, ty ) {\n\n\t\tthis.premultiply( _m3.makeTranslation( tx, ty ) );\n\n\t\treturn this;\n\n\t}\n\n\t// for 2D Transforms\n\n\tmakeTranslation( x, y ) {\n\n\t\tif ( x.isVector2 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x.x,\n\t\t\t\t0, 1, x.y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x,\n\t\t\t\t0, 1, y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotation( theta ) {\n\n\t\t// counterclockwise\n\n\t\tconst c = Math.cos( theta );\n\t\tconst s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0,\n\t\t\t0, y, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t}\n\n}\n\nconst _m3 = /*@__PURE__*/ new Matrix3();\n\nexport { Matrix3 };\n", "import { Quaternion } from '../math/Quaternion.js';\nimport { Vector3 } from '../math/Vector3.js';\nimport { Matrix4 } from '../math/Matrix4.js';\nimport { EventDispatcher } from './EventDispatcher.js';\nimport { Euler } from '../math/Euler.js';\nimport { Layers } from './Layers.js';\nimport { Matrix3 } from '../math/Matrix3.js';\nimport * as MathUtils from '../math/MathUtils.js';\n\nlet _object3DId = 0;\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _q1 = /*@__PURE__*/ new Quaternion();\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _target = /*@__PURE__*/ new Vector3();\n\nconst _position = /*@__PURE__*/ new Vector3();\nconst _scale = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\n\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\n\nconst _addedEvent = { type: 'added' };\nconst _removedEvent = { type: 'removed' };\n\nclass Object3D extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isObject3D = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\t\tthis.uuid = MathUtils.generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Object3D';\n\n\t\tthis.parent = null;\n\t\tthis.children = [];\n\n\t\tthis.up = Object3D.DEFAULT_UP.clone();\n\n\t\tconst position = new Vector3();\n\t\tconst rotation = new Euler();\n\t\tconst quaternion = new Quaternion();\n\t\tconst scale = new Vector3( 1, 1, 1 );\n\n\t\tfunction onRotationChange() {\n\n\t\t\tquaternion.setFromEuler( rotation, false );\n\n\t\t}\n\n\t\tfunction onQuaternionChange() {\n\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t\t}\n\n\t\trotation._onChange( onRotationChange );\n\t\tquaternion._onChange( onQuaternionChange );\n\n\t\tObject.defineProperties( this, {\n\t\t\tposition: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: position\n\t\t\t},\n\t\t\trotation: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: rotation\n\t\t\t},\n\t\t\tquaternion: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: quaternion\n\t\t\t},\n\t\t\tscale: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: scale\n\t\t\t},\n\t\t\tmodelViewMatrix: {\n\t\t\t\tvalue: new Matrix4()\n\t\t\t},\n\t\t\tnormalMatrix: {\n\t\t\t\tvalue: new Matrix3()\n\t\t\t}\n\t\t} );\n\n\t\tthis.matrix = new Matrix4();\n\t\tthis.matrixWorld = new Matrix4();\n\n\t\tthis.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\n\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\tthis.layers = new Layers();\n\t\tthis.visible = true;\n\n\t\tthis.castShadow = false;\n\t\tthis.receiveShadow = false;\n\n\t\tthis.frustumCulled = true;\n\t\tthis.renderOrder = 0;\n\n\t\tthis.animations = [];\n\n\t\tthis.userData = {};\n\n\t}\n\n\tonBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t}\n\n\tsetRotationFromAxisAngle( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t}\n\n\tsetRotationFromEuler( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t}\n\n\tsetRotationFromMatrix( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t}\n\n\tsetRotationFromQuaternion( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t}\n\n\trotateOnAxis( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateOnWorldAxis( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t}\n\n\trotateY( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t}\n\n\ttranslateOnAxis( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslateX( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t}\n\n\ttranslateY( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t}\n\n\ttranslateZ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t}\n\n\tlocalToWorld( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t}\n\n\tworldToLocal( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( _m1.copy( this.matrixWorld ).invert() );\n\n\t}\n\n\tlookAt( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tconst parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1.lookAt( _position, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1.lookAt( _target, _position, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1 );\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\n\n\t\t}\n\n\t}\n\n\tadd( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object can\\'t be added as a child of itself.', object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object && object.isObject3D ) {\n\n\t\t\tif ( object.parent !== null ) {\n\n\t\t\t\tobject.parent.remove( object );\n\n\t\t\t}\n\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst index = this.children.indexOf( object );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremoveFromParent() {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tparent.remove( this );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclear() {\n\n\t\treturn this.remove( ... this.children );\n\n\t}\n\n\tattach( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\t// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1.copy( this.matrixWorld ).invert();\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1 );\n\n\t\tthis.add( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\treturn this;\n\n\t}\n\n\tgetObjectById( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t}\n\n\tgetObjectByName( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t}\n\n\tgetObjectByProperty( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst child = this.children[ i ];\n\t\t\tconst object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tgetObjectsByProperty( name, value, result = [] ) {\n\n\t\tif ( this[ name ] === value ) result.push( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].getObjectsByProperty( name, value, result );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tgetWorldPosition( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t}\n\n\tgetWorldQuaternion( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position, target, _scale );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldScale( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion, target );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t}\n\n\traycast( /* raycaster, intersects */ ) {}\n\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseVisible( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseAncestors( callback ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// update children\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tconst child = children[ i ];\n\n\t\t\tif ( child.matrixWorldAutoUpdate === true || force === true ) {\n\n\t\t\t\tchild.updateMatrixWorld( force );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.parent === null ) {\n\n\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t} else {\n\n\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t}\n\n\t\t// update children\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tconst children = this.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tconst child = children[ i ];\n\n\t\t\t\tif ( child.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\t\tchild.updateWorldMatrix( false, true );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tconst output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {},\n\t\t\t\tskeletons: {},\n\t\t\t\tanimations: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tconst object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\t\tobject.up = this.up.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\n\n\t\t}\n\n\t\tif ( this.isBatchedMesh ) {\n\n\t\t\tobject.type = 'BatchedMesh';\n\t\t\tobject.perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\t\tobject.sortObjects = this.sortObjects;\n\n\t\t\tobject.drawRanges = this._drawRanges;\n\t\t\tobject.reservedRanges = this._reservedRanges;\n\n\t\t\tobject.visibility = this._visibility;\n\t\t\tobject.active = this._active;\n\t\t\tobject.bounds = this._bounds.map( bound => ( {\n\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\tboxMin: bound.box.min.toArray(),\n\t\t\t\tboxMax: bound.box.max.toArray(),\n\n\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\tsphereRadius: bound.sphere.radius,\n\t\t\t\tsphereCenter: bound.sphere.center.toArray()\n\t\t\t} ) );\n\n\t\t\tobject.maxGeometryCount = this._maxGeometryCount;\n\t\t\tobject.maxVertexCount = this._maxVertexCount;\n\t\t\tobject.maxIndexCount = this._maxIndexCount;\n\n\t\t\tobject.geometryInitialized = this._geometryInitialized;\n\t\t\tobject.geometryCount = this._geometryCount;\n\n\t\t\tobject.matricesTexture = this._matricesTexture.toJSON( meta );\n\n\t\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\t\tobject.boundingSphere = {\n\t\t\t\t\tcenter: object.boundingSphere.center.toArray(),\n\t\t\t\t\tradius: object.boundingSphere.radius\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\tif ( this.boundingBox !== null ) {\n\n\t\t\t\tobject.boundingBox = {\n\t\t\t\t\tmin: object.boundingBox.min.toArray(),\n\t\t\t\t\tmax: object.boundingBox.max.toArray()\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isScene ) {\n\n\t\t\tif ( this.background ) {\n\n\t\t\t\tif ( this.background.isColor ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON();\n\n\t\t\t\t} else if ( this.background.isTexture ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {\n\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\n\n\t\t\t}\n\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tconst parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tconst shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.isSkinnedMesh ) {\n\n\t\t\tobject.bindMode = this.bindMode;\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\n\n\t\t\tif ( this.skeleton !== undefined ) {\n\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\n\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tconst uuids = [];\n\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.animations.length > 0 ) {\n\n\t\t\tobject.animations = [];\n\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\n\n\t\t\t\tconst animation = this.animations[ i ];\n\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst geometries = extractFromCache( meta.geometries );\n\t\t\tconst materials = extractFromCache( meta.materials );\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst shapes = extractFromCache( meta.shapes );\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\n\t\t\tconst animations = extractFromCache( meta.animations );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\n\t\t\tif ( nodes.length > 0 ) output.nodes = nodes;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t}\n\n\tclone( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t}\n\n\tcopy( source, recursive = true ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.rotation.order = source.rotation.order;\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.animations = source.animations.slice();\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tconst child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nObject3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\n\nexport { Object3D };\n", "// TODO:\n// - NOT operation like with regex-not package.\n// - Caching like with the regex-cache package.\n\n/**\n * Template tag function to make composing regexes easier.\n *\n * @example\n *\n * import {r} from 'regexr'\n * const regex1 = r`/(this|that)*$/m`\n * const regex2 = r`/something|other_${regex1}/g`\n * console.log(regex2) // /something|other_(this|that)*$/g\n */\nexport function regexr(literals: T, ...substitutions: any[]) {\n\tlet result = ''\n\tlet flags = ''\n\n\t// We get the raw string that the user typed so that they don't have to\n\t// escape backslashes, etc, inside of the regex. Awesome!!\n\tconst rawLiterals = [...literals.raw]\n\tconst last = rawLiterals.length - 1\n\tconst flagsMatch = rawLiterals[last].match(/\\/[gimuy]*$/)\n\tlet flagMatchError = false\n\n\t// trim space before and after the regex.\n\tif (rawLiterals[0].match(/^\\//)) {\n\t\tif (!flagsMatch) flagMatchError = true\n\t\telse {\n\t\t\trawLiterals[0] = rawLiterals[0].replace('/', '')\n\t\t\tflags = flagsMatch[0].replace('/', '')\n\t\t\trawLiterals[last] = rawLiterals[last].replace(/\\/[gimuy]*$/, '')\n\t\t}\n\t} else {\n\t\tif (flagsMatch) flagMatchError = true\n\t}\n\n\t// run the loop only for the substitution count.\n\tfor (let i = 0, l = substitutions.length; i < l; i += 1) {\n\t\tconst sub = substitutions[i]\n\t\tresult += rawLiterals[i]\n\t\tresult += sub instanceof RegExp ? sub.source : String(sub)\n\t}\n\n\t// add the last literal\n\tresult += rawLiterals[last]\n\n\tif (flagMatchError) {\n\t\tthrow new TypeError(\n\t\t\t`regex has unmatched slashes, f.e. r\\`/foo\\` or r\\`foo/\\` instead of r\\`/foo/\\`. Input was: ${result}.`,\n\t\t)\n\t}\n\n\treturn new RegExp(result, flags)\n}\n\nexport const r = regexr\n\n/** helpers /////////////////////////////////////////////////////////////////////////////// */\n\n/**\n * Escapes a string literal.\n *\n * Adapted from https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex\n *\n * @param {string} A string to be literally matched (it does not represent a\n * RegExp). For example, \"foo$bar\" will be converted to \"foo\\$bar\" so that the\n * `$` is not treated as a RegExp special character.\n */\n// TODO replace certain characters with escape representations, f.e. line breaks\n// with \\n, tabs with \\t, etc\nexport const escape = (string: string) => string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&') // $& means the whole matched string\n\nexport const e = escape\n\nexport const version = '2.0.4'\n", "import {r, escape} from 'regexr'\n\n// XXX This grows but never shrinks. Can we make the cache collectable? Maybe we\n// need to use WeakRef containing the RegExps.\nconst stringArrayRegexCache: {[k: string]: RegExp} = {}\n\nexport function stringToArray(string: string, separator: string = ','): string[] {\n\tseparator = separator || ',' // prevent empty string\n\tlet re = stringArrayRegexCache[separator]\n\tif (!re) {\n\t\tre = r`/(?:\\s*${escape(separator)}\\s*)|(?:\\s+)/g`\n\t\tstringArrayRegexCache[separator] = re\n\t}\n\tconst values = string.trim().split(re)\n\treturn values\n}\n", "import {reactive, signal} from 'classy-solid'\nimport {getInheritedDescriptor} from 'lowclass'\nimport {stringToArray} from './utils.js'\nimport {batch} from 'solid-js'\n\nexport type XYZValuesArray = [T, T, T]\nexport type XYZPartialValuesArray = [T] | [T, T] | [T, T, T] // Is there a better way to make a tuplet from 1 to 3 items?\nexport type XYZValuesObject = {x: T; y: T; z: T}\nexport type XYZPartialValuesObject = Partial>\nexport type XYZValuesParameters = /*XYZValues | */ XYZPartialValuesArray | XYZPartialValuesObject | string | T\n\nconst defaultValues: XYZValuesObject = {x: undefined, y: undefined, z: undefined}\n\n/**\n * @class XYZValues\n *\n * Represents a set of values for the X, Y, and Z axes. For example, the\n * position of an object can be described using a set of 3 numbers, one for each\n * axis in 3D space: {x:10, y:10, z:10}.\n *\n * The values don't have to be numerical. For example,\n * {x:'foo', y:'bar', z:'baz'}\n */\nexport\n@reactive\nabstract class XYZValues extends Object {\n\t#x: T = undefined!\n\t#y: T = undefined!\n\t#z: T = undefined!\n\n\t/**\n\t * @property {any} x -\n\t *\n\t * *signal*\n\t *\n\t * Default: `undefined`\n\t *\n\t * The X value.\n\t */\n\t@signal\n\tset x(value: T) {\n\t\tif (typeof value === 'string') value = this.deserializeValue('x', value)\n\t\tif (!this.checkValue('x', value)) return\n\t\tthis.#x = value\n\t}\n\tget x(): T {\n\t\treturn this.#x\n\t}\n\n\t/**\n\t * @property {any} y -\n\t *\n\t * *signal*\n\t *\n\t * Default: `undefined`\n\t *\n\t * The Y value.\n\t */\n\t@signal\n\tset y(value: T) {\n\t\tif (typeof value === 'string') value = this.deserializeValue('y', value)\n\t\tif (!this.checkValue('y', value)) return\n\t\tthis.#y = value\n\t}\n\tget y(): T {\n\t\treturn this.#y\n\t}\n\n\t/**\n\t * @property {any} z -\n\t *\n\t * *signal*\n\t *\n\t * Default: `undefined`\n\t *\n\t * The Z value.\n\t */\n\t@signal\n\tset z(value: T) {\n\t\tif (typeof value === 'string') value = this.deserializeValue('z', value)\n\t\tif (!this.checkValue('z', value)) return\n\t\tthis.#z = value\n\t}\n\tget z(): T {\n\t\treturn this.#z\n\t}\n\n\t/**\n\t * @constructor - The constructor accepts the initial x, y, and z values for\n\t * the respective properties, as well as a string list of values, an array\n\t * of values, an object of values with matching x, y, and z properties, or\n\t * another XYZValues object. This class allows for any type of values, so if\n\t * anything other than the string, array, or objects are passed for the\n\t * first arg, then whatever that value is becomes the value of `x`.\n\t *\n\t * Examples:\n\t *\n\t * ```js\n\t * // default values for all axes\n\t * new XYZValues()\n\t *\n\t * // individual args\n\t * new XYZValues(foo)\n\t * new XYZValues(foo, bar)\n\t * new XYZValues(foo, bar, baz)\n\t *\n\t * // string of values\n\t * new XYZValues('')\n\t * new XYZValues('foo')\n\t * new XYZValues('foo, bar')\n\t * new XYZValues('foo, bar, baz')\n\t * // commas are optional, these are the same as the last two:\n\t * new XYZValues('foo bar')\n\t * new XYZValues('foo bar baz')\n\t *\n\t * // array of values\n\t * new XYZValues([])\n\t * new XYZValues([foo])\n\t * new XYZValues([foo, bar])\n\t * new XYZValues([foo, bar, baz])\n\t *\n\t * // array of values\n\t * new XYZValues({})\n\t * new XYZValues({x: foo})\n\t * new XYZValues({y: bar})\n\t * new XYZValues({z: baz})\n\t * new XYZValues({y: bar, z: baz})\n\t * new XYZValues({x: foo, z: baz})\n\t * new XYZValues({x: foo, y: bar})\n\t * new XYZValues({x: foo, y: bar, z: baz})\n\t *\n\t * // other XYZValues\n\t * let other = new XYZValues(...)\n\t * new XYZValues(other)\n\t * ```\n\t *\n\t * @param {string | [x?: any, y?: any, z?: any] | {x?: any, y?: any, z?: any} | XYZValues | any} x -The X value, or a string of values, an array of values, or object of values.\n\t * @param {any} y - The Y value.\n\t * @param {any} z - The Z value.\n\t */\n\tconstructor(x?: XYZValuesParameters, y?: T, z?: T) {\n\t\tsuper()\n\t\tthis.#from(x, y, z)\n\t}\n\n\t/**\n\t * @param {string | [x?: any, y?: any, z?: any] | {x?: any, y?: any, z?: any} | XYZValues | any} default -\n\t *\n\t * *readonly, *abstract*\n\t *\n\t * Subclasses can define a `default` getter to define what default values\n\t * should be for any new instance without constructor arguments.\n\t */\n\tabstract get default(): XYZValuesParameters\n\n\tget #default(): XYZValuesParameters {\n\t\treturn this.default || defaultValues\n\t}\n\n\t/**\n\t * @method fromDefault - Resets the `x`, `y`, and `z` values of the instance back\n\t * to their defaults, as defined by the `default` getter. If no `default`\n\t * getter is assigned, the default is ultimately `undefined` for `x`, `y`, and\n\t * `z`.\n\t *\n\t * ```js\n\t * values.fromDefault()\n\t * ```\n\t *\n\t * @returns {this} - Returns the instance for method chaining.\n\t */\n\t// TODO @return(s) jsdoc tag not working.\n\tfromDefault(): this {\n\t\tthis.from(this.#default)\n\t\treturn this\n\t}\n\n\t#from(x?: XYZValuesParameters | null, y?: T, z?: T): this {\n\t\tif (x == null && y === undefined && z === undefined) {\n\t\t\tthis.fromDefault()\n\t\t} else if (Array.isArray(x)) {\n\t\t\tthis.fromArray(x)\n\t\t} else if (typeof x === 'object' && x !== null) {\n\t\t\tif (x === this) return this\n\t\t\tthis.fromObject(x as XYZValuesObject)\n\t\t} else if (typeof x === 'string' && y === undefined && z === undefined) {\n\t\t\tthis.fromString(x)\n\t\t} else this.set(x as any, y as any, z as any)\n\n\t\treturn this\n\t}\n\n\t/**\n\t * @method from - Accepts multiple types of values to set the object's `x`, `y`, and `z` properties from. The args are the same as for the [`constructor()`](#constructor).\n\t *\n\t * ```js\n\t * // similar to the constructor:\n\t * values.from(foo, bar, baz)\n\t * values.from('foo, bar, baz')\n\t * values.from('foo bar baz')\n\t * values.from([foo, bar, baz])\n\t * values.from({x: foo, y: bar, z: baz})\n\t * ```\n\t *\n\t * @param {string | [x?: any, y?: any, z?: any] | {x?: any, y?: any, z?: any} | XYZValues | any} x -The X value, or a string of values, an array of values, or object of values.\n\t * @param {any} y - The Y value.\n\t * @param {any} z - The Z value.\n\t *\n\t * @returns {this} - Returns the instance for method chaining.\n\t */\n\tfrom(x: XYZValuesParameters, y?: T, z?: T): this {\n\t\treturn this.#from(x, y, z)\n\t}\n\n\t/**\n\t * @method set - Sets specific values for `x`, `y`, and `z`. Unlike\n\t * [`.from()`](#from), this does not accept different sorts of values, but\n\t * only specific values for each axis.\n\t *\n\t * ```js\n\t * values.set(foo, bar, baz)\n\t * ```\n\t *\n\t * @returns {this} - Returns the instance for method chaining.\n\t */\n\tset(x: T, y: T, z: T): this {\n\t\tbatch(() => {\n\t\t\tthis.x = x\n\t\t\tthis.y = y\n\t\t\tthis.z = z\n\t\t})\n\n\t\treturn this\n\t}\n\n\t/**\n\t * @method fromArray - Sets the object's `x`, `y`, and `z` values from an array of values.\n\t *\n\t * ```js\n\t * values.fromArray([foo, bar, baz])\n\t * ```\n\t *\n\t * @returns {this} - Returns the instance for method chaining.\n\t */\n\tfromArray(array: XYZPartialValuesArray): this {\n\t\tthis.set(array[0] as any, array[1] as any, array[2] as any)\n\t\treturn this\n\t}\n\n\t/**\n\t * @method toArray - Returns the `x`, `y`, and `z` values in array form.\n\t *\n\t * ```js\n\t * values.toArray() // [foo, bar, baz]\n\t * ```\n\t *\n\t * @returns {[any, any, any]} - The array of values.\n\t */\n\ttoArray(): XYZValuesArray {\n\t\treturn [this.x, this.y, this.z]\n\t}\n\n\t/**\n\t * @method fromObject - Sets the object's `x`, `y`, and `z` values from an\n\t * object with `x`, `y`, and `z` properties.\n\t *\n\t * ```js\n\t * values.fromObject({x: foo, y: bar, z: baz})\n\t * ```\n\t *\n\t * @returns {this} - Returns the instance for method chaining.\n\t */\n\tfromObject(object: XYZPartialValuesObject): this {\n\t\tthis.set(object.x as any, object.y as any, object.z as any)\n\t\treturn this\n\t}\n\n\t/**\n\t * @method toObject - Returns the `x`, `y`, and `z` values in object form.\n\t *\n\t * ```js\n\t * values.toObject() // {x: foo, y: bar, z: baz}\n\t * ```\n\t *\n\t * @returns {{x: any, y: any, z: any}} - The object of values.\n\t */\n\ttoObject(): XYZValuesObject {\n\t\treturn {x: this.x, y: this.y, z: this.z}\n\t}\n\n\t/**\n\t * @method fromString - Sets the object's `x`, `y`, and `z` values from a\n\t * string containing a list of values.\n\t *\n\t * ```js\n\t * values.fromString('foo, bar, baz')\n\t * values.fromString('foo bar baz')\n\t * ```\n\t *\n\t * @returns {this} - Returns the instance for method chaining.\n\t */\n\tfromString(string: string, separator: string = ','): this {\n\t\tthis.fromArray(this.#stringToArray(string, separator))\n\t\treturn this\n\t}\n\n\t/**\n\t * @method toString - Returns the `x`, `y`, and `z` values in string of values form, with an optional separator.\n\t *\n\t * `override`\n\t *\n\t * ```js\n\t * values.toString() // 'foo bar baz'\n\t * values.toString(',') // 'foo, bar, baz'\n\t * ```\n\t *\n\t * @param {string} separator - The separator to use, otherwise only spaces are used.\n\t *\n\t * @returns {string} - The string of values.\n\t */\n\toverride toString(separator: string = ''): string {\n\t\tif (separator) {\n\t\t\treturn `${this.x}${separator} ${this.y}${separator} ${this.z}`\n\t\t} else {\n\t\t\treturn `${this.x} ${this.y} ${this.z}`\n\t\t}\n\t}\n\n\t/**\n\t * @method deserializeValue - Defines how to deserialize an incoming string\n\t * being set onto one of the x, y, or z properties. Subclasses should\n\t * override this. This class does not perform any transformation of the\n\t * string values.\n\t *\n\t * @param {'x' | 'y' | 'z'} _prop The property name of the axis a value is being deserialized for, one of 'x', 'y', or 'z'.\n\t * @param {any} value The value to be deserialized.\n\t *\n\t * @returns {any} - The deserialized value.\n\t */\n\tdeserializeValue(_prop: 'x' | 'y' | 'z', value: string): T {\n\t\treturn value as unknown as T\n\t}\n\n\t#stringToArray(string: string, separator: string = ','): XYZPartialValuesArray {\n\t\tconst values = stringToArray(string, separator)\n\t\tconst result = [] as unknown as XYZPartialValuesArray\n\t\tconst length = values.length\n\t\tif (length > 0) result[0] = this.deserializeValue('x', values[0])\n\t\tif (length > 1) result[1] = this.deserializeValue('y', values[1])\n\t\tif (length > 2) result[2] = this.deserializeValue('z', values[2])\n\t\treturn result\n\t}\n\n\t/**\n\t * @method checkValue - Subclasses extend this to implement type checks.\n\t * Return `true` if the value should be assigned, or `false` to ignore the\n\t * value and not set anything. A subclass could also throw an error when\n\t * receiving an unexpected value.\n\t *\n\t * Returning `false`, for example, can allow 'undefined' values to be\n\t * ignored, which allows us to do things like `values.fromObject({z: 123})`\n\t * to set only `z` and ignore `x` and `y`.\n\t *\n\t * @param {'x' | 'y' | 'z'} _prop The property name of the axis a value is being assigned to, one of 'x', 'y', or 'z'.\n\t * @param {any} _value The value being assigned.\n\t */\n\tcheckValue(_prop: 'x' | 'y' | 'z', _value: T): boolean {\n\t\treturn true\n\t}\n\n\t/**\n\t * A method that when called in a effect makes all three x/y/z properties a\n\t * dependency of the effect.\n\t */\n\tasDependency = () => {\n\t\tthis.x\n\t\tthis.y\n\t\tthis.z\n\t\treturn this\n\t}\n}\n\n// TODO make this a decorator\nfunction enumerable(obj: T, prop: keyof T) {\n\tObject.defineProperty(obj, prop, {...getInheritedDescriptor(obj, prop), enumerable: true})\n}\n\nenumerable(XYZValues.prototype, 'x')\nenumerable(XYZValues.prototype, 'y')\nenumerable(XYZValues.prototype, 'z')\n", "import {XYZValues} from './XYZValues.js'\n\n/**\n * @class XYZNumberValues - Extends [`XYZValues`](./XYZValues) to enforce that\n * values are numbers. Additionally, values of `undefined` are ignored instead\n * of throwing errors, which allows us to handle values like `{y: 123}` when\n * setting element properties to set only one axis value.\n *\n * @extends XYZValues\n */\nexport class XYZNumberValues extends XYZValues {\n\t/**\n\t * @property {{x: 0, y: 0, z: 0}} default -\n\t *\n\t * *override*\n\t *\n\t * Defines the default XYZ values to be the numbers 0,0,0.\n\t */\n\toverride get default(): {x: 0; y: 0; z: 0} {\n\t\treturn {x: 0, y: 0, z: 0}\n\t}\n\n\t/**\n\t * @method deserializeValue -\n\t *\n\t * *override*\n\t *\n\t * Coerces a string value into a number.\n\t */\n\toverride deserializeValue(_prop: 'x' | 'y' | 'z', value: string): number {\n\t\treturn Number(value)\n\t}\n\n\t/**\n\t * @method checkValue -\n\t *\n\t * *override*\n\t *\n\t * Check that a value is a number.\n\t */\n\t// TODO XYZNumberValues also accepts numbers in the form of strings, but let's\n\t// remove this ability. All strings should be coerced and checked for type\n\t// safety.\n\toverride checkValue(prop: 'x' | 'y' | 'z', value: number) {\n\t\tif (!super.checkValue(prop, value)) return false\n\n\t\t// Skip setting undefined values...\n\t\tif (value === undefined) return false\n\n\t\t// ...but if a value is supplied, it needs to be a valid number (string number is ok).\n\t\tif (!(typeof value === 'number') || isNaN(value) || !isFinite(value))\n\t\t\tthrow new TypeError(`Expected ${prop} to be a finite number. Received: ${value}`)\n\n\t\treturn true\n\t}\n}\n", "import type {Constructor} from 'lowclass'\n\n// TODO, make strongly typed event args. Combine with stuff in Events.ts (or similar).\n\n// TODO, Make sure emit will not attempt to call event handlers removed\n// during emit (in place modification of listeners array during emit iteration\n// will try to access undefined after the end of the array). Possibly use\n// for..of with a Set instead, otherwise modify the iteration index manually.\n\n// TODO, an option to defer events, and batch them (so that 3 of the\n// same event and payload triggers only one event instead of three)\n\n/**\n * @mixin\n * @class Eventful - An instance of Eventful emits events that code can\n * subscribe to with callbacks. Events may optionally pass a payload to the\n * callbacks.\n *\n * Callbacks can be associated with contexts to be called with (called with\n * Function.prototype.call), which offers more performance than similar\n * patterns that don't allow contexts to be specified (in those cases the user\n * has to create new arrow functions or function clones with\n * Function.prototype.bind, which is heavier).\n *\n * For example, suppose some object `rectangle` emits events named \"resize\".\n * One can react to those events by subscribing to them with a callback:\n *\n * ```js\n * const onResize = size => {\n * // whenever `object` emits a \"resize\" event, the event passes a payload\n * // containing the new size of `object`:\n * console.log(size) // for example, {x: 123, y: 123}\n * }\n *\n * rectangle.on(\"resize\", onResize)\n * ```\n *\n * To stop reacting to the \"resize\" event later, we can unsubscribe the\n * callback from the \"resize\" events:\n *\n * ```js\n * rectangle.off(\"resize\", onResize)\n * ```\n */\nexport function Eventful(Base: T = Object as any) {\n\tclass Eventful extends Base {\n\t\t// @ts-ignore to avoid \"is using private name\" errors in consumer code.\n\t\t[isEventful as any] = isEventful as any\n\n\t\t/**\n\t\t * @method on - Register a `callback` to be executed any\n\t\t * time an event with name `eventName` is triggered by an instance of\n\t\t * Eventful. If a `context` is passed to `.on()`, the `callback` is\n\t\t * associated with both `eventName` and `context`. Make sure to also\n\t\t * call `.off()` with the same `context` or else the callabck\n\t\t * associated with that `context` will not be removed.\n\t\t *\n\t\t * @param {string} eventName - The name of the event to listen for.\n\t\t * @param {Function} callback - A callback that will be called anytime the event named `eventName` happens. The callback may receive certain arguments depending on the event that the callback is subscribed to.\n\t\t * @param {any} context - An optional context to call the callback with. Passing no context is the same as subscribing `callback` for a `context` of `undefined`.\n\t\t */\n\t\ton(eventName: string, callback: Function, context?: any) {\n\t\t\tlet eventMap = this.#eventMap\n\n\t\t\t// @prod-prune\n\t\t\tif (typeof callback !== 'function') throw new Error('Expected a function in callback argument of Eventful#on.')\n\n\t\t\tif (!eventMap) eventMap = this.#eventMap = new Map()\n\n\t\t\tlet callbacks = eventMap.get(eventName)\n\n\t\t\tif (!callbacks) eventMap.set(eventName, (callbacks = []))\n\n\t\t\tcallbacks.push([callback, context])\n\t\t}\n\n\t\t/**\n\t\t * @method off - Stop a `callback` from being fired for event named `eventName`. If\n\t\t * the callback was previously registered along with a `context` in\n\t\t * `.on()`, be sure to pass the `context` to `.off()` as well.\n\t\t *\n\t\t * @param {string} eventName - The name of the event to unsubscribe `callback` from.\n\t\t * @param {Function} callback - The callback that will be no longer be executed when the event happens.\n\t\t * @param {any} context - A context associated with `callback`. Not passing a `context` arg is equivalent to unsubscribing the `callback` for `context` of `undefined`.\n\t\t */\n\t\toff(eventName: string, callback?: Function, context?: any) {\n\t\t\tconst eventMap = this.#eventMap\n\n\t\t\tif (!eventMap) return\n\n\t\t\tconst callbacks = eventMap.get(eventName)\n\n\t\t\tif (!callbacks) return\n\n\t\t\tconst index = callbacks.findIndex(tuple => tuple[0] === callback && tuple[1] === context)\n\n\t\t\tif (index === -1) return\n\n\t\t\tcallbacks.splice(index, 1)\n\n\t\t\tif (callbacks.length === 0) eventMap.delete(eventName)\n\n\t\t\tif (eventMap.size === 0) this.#eventMap = null\n\t\t}\n\n\t\t/**\n\t\t * @method emit - Cause the event with name `eventName` to be emitted\n\t\t * (i.e. cause the event to happen). Any callbacks subscribed to the\n\t\t * event will be executed and passed the arguments that passed into the\n\t\t * emit call.\n\t\t *\n\t\t * For example, inside a Rectangle class we might see\n\t\t *\n\t\t * ```js\n\t\t * this.emit(\"resize\", {x, y})\n\t\t * ```\n\t\t *\n\t\t * @param {string} eventName - The name of the event to emit.\n\t\t * @param {data} any - The data that is passed to each callback subscribed to the event.\n\t\t */\n\t\temit(eventName: string, data?: any) {\n\t\t\tconst eventMap = this.#eventMap\n\n\t\t\tif (!eventMap) return\n\n\t\t\tconst callbacks = eventMap.get(eventName)\n\n\t\t\tif (!callbacks) return\n\n\t\t\tlet tuple: (typeof callbacks)[0]\n\t\t\tlet callback: (typeof callbacks)[0][0]\n\t\t\tlet context: (typeof callbacks)[0][1]\n\n\t\t\tfor (let i = 0, len = callbacks.length; i < len; i += 1) {\n\t\t\t\ttuple = callbacks[i]\n\t\t\t\tcallback = tuple[0]\n\t\t\t\tcontext = tuple[1]\n\t\t\t\tcallback.call(context, data)\n\t\t\t}\n\t\t}\n\n\t\t#eventMap: Map> | null = null\n\t}\n\n\tEventful.prototype[isEventful] = isEventful\n\n\treturn Eventful\n}\n\nconst isEventful = Symbol('isEventful')\n\nObject.defineProperty(Eventful, Symbol.hasInstance, {\n\tvalue(obj: any): boolean {\n\t\tif (!obj) return false\n\t\tif (obj[isEventful]) return true\n\t\treturn false\n\t},\n})\n\n/**\n * @decorator\n * @function emits - This is a decorator that when used on a property in a\n * class definition, causes setting of that property to emit the specified\n * event, with the event payload being the property value. This decorator must\n * be used in a class that extends from Eventful, otherwise an error is thrown.\n *\n * @example\n * class Foo {\n * @emits('propchange') foo = 123\n * }\n * const f = new Foo\n * f.on('propchange', value => console.log('value: ', value))\n * f.foo = 456 // logs \"value: 456\"\n */\nexport function emits(eventName: string): any {\n\treturn (prototype: any, propName: string, descriptor?: PropertyDescriptor) => {\n\t\treturn _emits(prototype, propName, descriptor ?? undefined, eventName)\n\t}\n}\n\nfunction _emits(prototype: any, propName: string, descriptor: PropertyDescriptor | undefined, eventName: string): any {\n\tif (!(prototype instanceof Eventful))\n\t\tthrow new TypeError('The @emits decorator is only for use on properties of classes that extend from Eventful.')\n\n\tconst vName = Symbol('@emits: ' + propName)\n\n\t// property decorators are not passed a descriptor (unlike decorators on accessors or methods)\n\tlet calledAsPropertyDecorator = false\n\n\tif (!descriptor) {\n\t\tcalledAsPropertyDecorator = true\n\t\tdescriptor = Object.getOwnPropertyDescriptor(prototype, propName)\n\t}\n\n\tlet hasOriginalAccessor = false\n\tlet originalGet: (() => any) | undefined\n\tlet originalSet: ((v: any) => void) | undefined\n\tlet initialValue: any\n\tlet writable: boolean | undefined\n\n\tif (descriptor) {\n\t\tif (descriptor.get || descriptor.set) {\n\t\t\thasOriginalAccessor = true\n\t\t\toriginalGet = descriptor.get\n\t\t\toriginalSet = descriptor.set\n\n\t\t\t// reactivity requires both\n\t\t\tif (!originalSet) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'The `@emits` decorator was used on an accessor named \"' +\n\t\t\t\t\t\tpropName +\n\t\t\t\t\t\t'\" which did not have a setter. This means an event will never be emitted because the value can not be set. In this case the decorator doesn\\'t do anything.',\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdelete descriptor.get\n\t\t\tdelete descriptor.set\n\t\t} else {\n\t\t\tinitialValue = descriptor.value\n\t\t\twritable = descriptor.writable\n\n\t\t\t// if it isn't writable, we don't need to make a reactive variable because\n\t\t\t// the value won't change\n\t\t\tif (!writable) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'The `@emits` decorator was used on a property named \"' +\n\t\t\t\t\t\tpropName +\n\t\t\t\t\t\t'\" that is not writable. An event can not be emitted because the property can not be modified. In this case the decorator does not do anything.',\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdelete descriptor.value\n\t\t\tdelete descriptor.writable\n\t\t}\n\t}\n\n\tlet initialValueIsSet = false\n\tfunction emitEvent(this: EventfulInstance) {\n\t\tthis.emit(eventName, propName)\n\t}\n\n\tdescriptor = {\n\t\t...descriptor,\n\t\tconfigurable: true,\n\t\t...(hasOriginalAccessor\n\t\t\t? originalGet\n\t\t\t\t? {\n\t\t\t\t\t\tget(): any {\n\t\t\t\t\t\t\treturn originalGet!.call(this)\n\t\t\t\t\t\t},\n\t\t\t\t }\n\t\t\t\t: {}\n\t\t\t: {\n\t\t\t\t\tget(): any {\n\t\t\t\t\t\tif (!initialValueIsSet) {\n\t\t\t\t\t\t\tinitialValueIsSet = true\n\t\t\t\t\t\t\treturn ((this as any)[vName] = initialValue)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (this as any)[vName]\n\t\t\t\t\t},\n\t\t\t }),\n\t\t...(hasOriginalAccessor\n\t\t\t? {\n\t\t\t\t\tset(newValue: any) {\n\t\t\t\t\t\toriginalSet!.call(this, newValue)\n\n\t\t\t\t\t\t// TODO should we defer the event, or not? Perhaps provide an option, and defer by default.\n\t\t\t\t\t\tPromise.resolve().then(emitEvent.bind(this as EventfulInstance))\n\t\t\t\t\t\t// emitEvent.call(this as Eventful)\n\t\t\t\t\t},\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tset(newValue: any) {\n\t\t\t\t\t\tif (!initialValueIsSet) initialValueIsSet = true\n\t\t\t\t\t\t;(this as any)[vName] = newValue\n\t\t\t\t\t\tPromise.resolve().then(emitEvent.bind(this as EventfulInstance))\n\t\t\t\t\t},\n\t\t\t }),\n\t}\n\n\t// If a decorator is called on a property, then returning a descriptor does\n\t// nothing, so we need to set the descriptor manually.\n\tif (calledAsPropertyDecorator) Object.defineProperty(prototype, propName, descriptor)\n\t// If a decorator is called on an accessor or method, then we must return a\n\t// descriptor in order to modify it, and doing it manually won't work.\n\telse return descriptor\n\t// Weird, huh?\n\t// This will all change with updates to the ES decorators proposal, https://github.com/tc39/proposal-decorators\n}\n\ntype EventfulInstance = InstanceType>\n", "import {Eventful} from '@lume/eventful'\nimport {Element as LumeElement} from '@lume/element'\nimport {Effectful} from 'classy-solid'\n\n/**\n * @class TreeNode - The `TreeNode` class represents objects that are connected\n * to each other in parent-child relationships in a tree structure. A parent\n * can have multiple children, and a child can have only one parent.\n * @extends Eventful\n * @extends LumeElement\n */\nexport class TreeNode extends Effectful(Eventful(LumeElement)) {\n\t/**\n\t * @property {TreeNode | null} parentLumeElement -\n\t *\n\t * *readonly*\n\t *\n\t * The LUME-specific parent of the current TreeNode. Each node in a tree can\n\t * have only one parent. This is `null` if there is no parent when not\n\t * connected into a tree, or if the parentElement while connected into a\n\t * tree is not as LUME 3D element.\n\t */\n\tget parentLumeElement(): TreeNode | null {\n\t\tif (this.parentElement instanceof TreeNode) return this.parentElement\n\t\treturn null\n\t}\n\n\t/**\n\t * @property {TreeNode[]} lumeChildren -\n\t *\n\t * *readonly*\n\t *\n\t * An array of this element's LUME-specific children. This returns a new\n\t * static array each time, so and modifying this array directly does not\n\t * effect the state of the TreeNode. Use [TreeNode.append(child)](#append)\n\t * and [TreeNode.removeChild(child)](#removechild) to modify a TreeNode's\n\t * actual children.\n\t */\n\tget lumeChildren(): TreeNode[] {\n\t\treturn Array.prototype.filter.call(this.children, c => c instanceof TreeNode) as TreeNode[]\n\t}\n\n\t/**\n\t * @property {number} lumeChildCount -\n\t *\n\t * *readonly*\n\t *\n\t * The number of children this TreeNode has.\n\t */\n\tget lumeChildCount(): number {\n\t\treturn this.lumeChildren.length\n\t}\n\n\toverride disconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.stopEffects()\n\t}\n}\n", "import {XYZValues} from './XYZValues.js'\n\nexport class XYZStringValues extends XYZValues {\n\tget default() {\n\t\treturn {x: '', y: '', z: ''}\n\t}\n\n\toverride checkValue(prop: 'x' | 'y' | 'z', value: string) {\n\t\tif (!super.checkValue(prop, value)) return false\n\n\t\t// this allows undefined values to be ignored. So we can for example do\n\t\t// things like v.fromObject({z: 123}) to set only z\n\t\tif (value === undefined) return false\n\n\t\tif (typeof value !== 'string') throw new TypeError(`Expected ${prop} to be a string. Received: ${value}`)\n\n\t\treturn true\n\t}\n}\n", "import {XYZStringValues} from './XYZStringValues.js'\n\nexport type SizeModeValue = 'literal' | 'l' | 'proportional' | 'p'\n\n/**\n * @class XYZSizeModeValues - Extends [`XYZValues`](./XYZValues) to enforce that\n * values are one of the strings `\"literal\"` or `\"proportional\"`.\n *\n * @extends XYZValues\n */\n// TODO it would be cool if we can have compiletime type errors when the values\n// aren't SizeModeValues. At the moment we'll get only runtime errors.\nexport class XYZSizeModeValues extends XYZStringValues {\n\toverride get default() {\n\t\treturn {x: 'literal', y: 'literal', z: 'literal'}\n\t}\n\n\tget allowedValues() {\n\t\treturn ['literal', 'l', 'proportional', 'p']\n\t}\n\n\toverride checkValue(prop: 'x' | 'y' | 'z', value: SizeModeValue) {\n\t\tif (!super.checkValue(prop, value)) return false\n\t\tif (!this.allowedValues.includes(value))\n\t\t\tthrow new TypeError(\n\t\t\t\t`Expected ${prop} to be one of 'literal' ('l' for short) or 'proportional' ('p' for short). Received: '${value}'`,\n\t\t\t)\n\t\treturn true\n\t}\n}\n", "import {XYZNumberValues} from './XYZNumberValues.js'\n\n/**\n * @class XYZNonNegativeValues - Extends [`XYZNumberValues`](./XYZNumberValues)\n * to enforce that values are positive numbers.\n *\n * @extends XYZNumberValues\n */\nexport class XYZNonNegativeValues extends XYZNumberValues {\n\toverride checkValue(prop: 'x' | 'y' | 'z', value: number) {\n\t\tif (!super.checkValue(prop, value)) return false\n\t\tif (value < 0) throw new TypeError(`Expected ${prop} not to be negative. Received: ${value}`)\n\t\treturn true\n\t}\n}\n", "// TODO import and use animation-loop\n\nimport type {SharedAPI} from './SharedAPI.js'\nimport type {Scene} from './Scene.js'\n\nexport type RenderTask = (timestamp: number, deltaTime: number) => false | void\n\nclass _Motor {\n\t/**\n\t * When a render tasks is added a new requestAnimationFrame loop will be\n\t * started if there isn't one currently.\n\t *\n\t * A render task is simply a function that will be called over and over\n\t * again, in the Motor's animation loop. That's all, nothing special.\n\t * However, if a Element3D setter is used inside of a render task, then the Element3D\n\t * will tell Motor that it needs to be re-rendered, which will happen at\n\t * the end of the current frame. If a Element3D setter is used outside of a\n\t * render task (i.e. outside of the Motor's animation loop), then the Element3D\n\t * tells Motor to re-render the Element3D on the next animation loop tick.\n\t * Basically, regardless of where the Element3D's setters are used (inside or\n\t * outside of the Motor's animation loop), rendering always happens inside\n\t * the loop.\n\t *\n\t * @param {Function} fn The render task to add.\n\t *\n\t * @return {Function} A reference to the render task. Useful for saving to\n\t * a variable so that it can later be passed to Motor.removeRenderTask().\n\t */\n\taddRenderTask(fn: RenderTask) {\n\t\tif (typeof fn != 'function') throw new Error('Render task must be a function.')\n\n\t\tif (this.#allRenderTasks.includes(fn)) return fn\n\n\t\tthis.#allRenderTasks.push(fn)\n\t\tthis.#numberOfTasks += 1\n\n\t\t// If the render loop isn't started, start it.\n\t\tif (!this.#loopStarted) this.#startAnimationLoop()\n\n\t\treturn fn\n\t}\n\n\tremoveRenderTask(fn: RenderTask) {\n\t\tconst taskIndex = this.#allRenderTasks.indexOf(fn)\n\n\t\tif (taskIndex == -1) return\n\n\t\tthis.#allRenderTasks.splice(taskIndex, 1)\n\t\tthis.#numberOfTasks -= 1\n\n\t\tif (taskIndex <= this.#taskIterationIndex) this.#taskIterationIndex -= 1\n\t}\n\n\t#onces = new Set()\n\n\t/**\n\t * Adds a render task that executes only once instead of repeatedly. Set\n\t * `allowDuplicates` to `false` to skip queueing a function if it is already\n\t * queued.\n\t */\n\tonce(fn: RenderTask, allowDuplicates = true) {\n\t\tif (!allowDuplicates && this.#onces.has(fn)) return\n\n\t\tthis.#onces.add(fn)\n\n\t\t// The `false` return value of the task tells Motor not to re-run it.\n\t\treturn this.addRenderTask((time, dt) => (fn(time, dt), false))\n\t}\n\n\t// An Element3D calls this any time its properties have been modified (f.e. by the end user).\n\tneedsUpdate(element: SharedAPI) {\n\t\t// delete so it goes to the end\n\t\tif (this.#elementsToUpdate.has(element)) this.#elementsToUpdate.delete(element)\n\n\t\tthis.#elementsToUpdate.add(element)\n\n\t\t// noop if the loop's already started\n\t\tthis.#startAnimationLoop()\n\t}\n\n\twillUpdate(element: SharedAPI) {\n\t\treturn this.#elementsToUpdate.has(element)\n\t}\n\n\t/**\n\t * Set the function that is used for requesting animation frames. The\n\t * default is `globalThis.requestAnimationFrame`. A Scene with WebXR enabled\n\t * will pass in the XRSession's requester that controls animation frames for\n\t * the XR headset.\n\t */\n\tsetFrameRequester(requester: (fn: FrameRequestCallback) => number) {\n\t\tthis.#requestFrame = requester\n\t}\n\n\t#loopStarted = false\n\t#taskIterationIndex = 0\n\t#numberOfTasks = 0\n\n\t// This is an array so that it is possible to add a task function more than once.\n\t#allRenderTasks = [] as RenderTask[]\n\n\t#elementsToUpdate = new Set()\n\t#modifiedScenes = new Set()\n\n\t// A set of elements that are the root elements of subtrees where all elements\n\t// in subtrees need their world matrices updated.\n\t#treesToUpdate = new Set()\n\n\t// default to requestAnimationFrame for regular non-VR/AR scenes.\n\t// Using ?. here in case of a non-DOM env.\n\t#requestFrame = globalThis.requestAnimationFrame?.bind(globalThis)\n\n\t/**\n\t * Starts a requestAnimationFrame loop and runs the render tasks in the __allRenderTasks stack.\n\t * As long as there are tasks in the stack, the loop continues. When the\n\t * stack becomes empty due to removal of tasks, the\n\t * requestAnimationFrame loop stops and the app sits there doing nothing\n\t * -- silence, crickets.\n\t */\n\tasync #startAnimationLoop() {\n\t\tif (document.readyState === 'loading') await new Promise(resolve => setTimeout(resolve))\n\n\t\tif (this.#loopStarted) return\n\n\t\tthis.#loopStarted = true\n\n\t\tlet lastTime: number = performance.now()\n\n\t\twhile (this.#loopStarted) {\n\t\t\tconst timestamp: number = await this.#animationFrame()\n\t\t\tconst deltaTime: number = timestamp - lastTime\n\n\t\t\tthis.#runRenderTasks(timestamp, deltaTime)\n\t\t\tthis.#onces.clear()\n\n\t\t\t// Wait one more microtask in case reactivity (f.e. not just lume\n\t\t\t// reactivity, but any reactivity outside of lume that may be\n\t\t\t// microtask deferred like Vue's, Svelte's, React's, etc) needs\n\t\t\t// another chance to run.\n\t\t\t//\n\t\t\t// TODO continue to queue element updates with a microtasks until tasks\n\t\t\t// settle, similar to ResizeObserver, with a loop limit, before running all\n\t\t\t// element updates.\n\t\t\tawait null\n\n\t\t\tthis.#updateElements(timestamp, deltaTime)\n\n\t\t\t// If no tasks are left, stop the animation loop.\n\t\t\tif (!this.#allRenderTasks.length) this.#loopStarted = false\n\n\t\t\tlastTime = timestamp\n\t\t}\n\t}\n\n\t#animationFrame(): Promise {\n\t\treturn new Promise(r => this.#requestFrame(r))\n\t}\n\n\t#runRenderTasks(timestamp: number, deltaTime: number) {\n\t\tfor (this.#taskIterationIndex = 0; this.#taskIterationIndex < this.#numberOfTasks; this.#taskIterationIndex += 1) {\n\t\t\tconst task = this.#allRenderTasks[this.#taskIterationIndex]\n\n\t\t\tif (task(timestamp, deltaTime) === false) this.removeRenderTask(task)\n\t\t}\n\t}\n\n\t#updateElements(timestamp: number, deltaTime: number) {\n\t\tif (this.#elementsToUpdate.size === 0) return\n\n\t\tfor (const el of this.#elementsToUpdate) {\n\t\t\tel.update(timestamp, deltaTime)\n\n\t\t\t// if there is no ancestor of the current element that should be\n\t\t\t// updated, then the current element is a root element of a subtree\n\t\t\t// that needs to be updated\n\t\t\tif (!hasAncestorThatWillUpdate(el)) this.#treesToUpdate.add(el)\n\n\t\t\t// keep track of which scenes are modified so we can render webgl\n\t\t\t// only for those scenes.\n\t\t\tif (el.scene) this.#modifiedScenes.add(el.scene)\n\t\t}\n\t\tthis.#elementsToUpdate.clear()\n\n\t\t// Update world matrices of the subtrees.\n\t\tfor (const el of this.#treesToUpdate) el.updateWorldMatrices()\n\t\tthis.#treesToUpdate.clear()\n\n\t\t// render webgl of modified scenes.\n\t\tfor (const scene of this.#modifiedScenes) scene.drawScene()\n\t\tthis.#modifiedScenes.clear()\n\t}\n}\n\n// export a singleton instance rather than the class directly.\nexport const Motor = new _Motor()\n\nfunction hasAncestorThatWillUpdate(el: SharedAPI): boolean {\n\tlet composedSceneGraphParent = el.composedSceneGraphParent\n\n\twhile (composedSceneGraphParent) {\n\t\tif (Motor.willUpdate(composedSceneGraphParent)) return true\n\t\tcomposedSceneGraphParent = composedSceneGraphParent.composedSceneGraphParent\n\t}\n\n\treturn false\n}\n", "// const addedTo = new Map()\n// const removedFrom = new Map()\n// let scheduled = false\n\n// TODO no any\nexport interface ObserveChildrenOptions {\n\t/** The target element to observe children on. */\n\ttarget: Element | ShadowRoot | Document\n\t/** Called when a child is added to `target`. */\n\tonConnect: (this: Element, child: Element) => void\n\t/** Called when a child is removed from `target`. */\n\tonDisconnect: (this: Element, child: Element) => void\n\t/**\n\t * By default onConnect and onDisconnect are called only for elements, not\n\t * text nodes or comment nodes. Set to `true` to include text nodes and\n\t * comment nodes.\n\t *\n\t * Default: `false`\n\t */\n\tincludeTextNodes?: boolean\n\t/**\n\t * If `true`, onConnect and onDisconnect will only be called based on the\n\t * child's final position, and any intermediate mutation records will be ignored. For\n\t * example, this means that if a child is disconnected and then immediately\n\t * (synchronously) connected back to the same parent, onDisconnect and\n\t * onConnect (respectively) will not be called because the final result is\n\t * that the element did not move and is still connected to the same parent, therefore there is nothing to do.\n\t *\n\t * Similarly, if a child was moved around to several parents synchronously\n\t * and ends up at a different parent than the original, onDisconnect and\n\t * onConnect will be called only once each, in that order, and they will not\n\t * be called for every intermediate parent because the end result is that\n\t * the child moved from one parent to another. This avoids doing extra unnecessary work.\n\t *\n\t * If `false`, then onConnect and onDisconnect are called for every mutation\n\t * record, for example if a child is disconnected and reconnected\n\t * synchronously to the same parent the onDisconnect and onConnect will fire\n\t * in that order, or if a child moved to several parents then onDisconnect\n\t * and onConnect will be called for each parent.\n\t *\n\t * Default: `false`\n\t */\n\tweighted?: boolean\n}\n\nexport function observeChildren({\n\ttarget,\n\tonConnect,\n\tonDisconnect,\n\tincludeTextNodes = false,\n\tweighted = false,\n}: ObserveChildrenOptions) {\n\tconst childObserver = createChildObserver(onConnect, onDisconnect, includeTextNodes, weighted)\n\tchildObserver.observe(target, {childList: true})\n\treturn () => childObserver.disconnect()\n}\n\n/**\n * NOTE: If a child is synchronously disconnected then connected to the same parent in the\n * same tick when weighted is true, then the onConnect and onDisconnect callbacks won't be called\n * because the DOM tree will be back in the exact state as before (this is\n * possible thanks to the logic associated with weightsPerTarget).\n */\nexport function createChildObserver(onConnect: any, onDisconnect: any, includeTextNodes = false, weighted = false) {\n\tconst observer = new MutationObserver(changes => {\n\t\tif (!weighted) {\n\t\t\tfor (const change of changes) {\n\t\t\t\tconst {target, removedNodes, addedNodes} = change\n\n\t\t\t\tfor (let i = 0, l = removedNodes.length; i < l; i += 1) onDisconnect.call(target, removedNodes[i])\n\t\t\t\tfor (let i = 0, l = addedNodes.length; i < l; i += 1) onConnect.call(target, addedNodes[i])\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tconst weightsPerTarget = new Map>()\n\n\t\t// We're just counting how many times each child node was added and\n\t\t// removed from the parent we're observing.\n\t\tfor (let i = 0, l = changes.length; i < l; i += 1) {\n\t\t\tconst change = changes[i]\n\n\t\t\tif (change.type != 'childList') continue\n\n\t\t\tlet weights = weightsPerTarget.get(change.target)\n\n\t\t\tif (!weights) weightsPerTarget.set(change.target, (weights = new Map()))\n\n\t\t\tconst {addedNodes} = change\n\t\t\tfor (let l = addedNodes.length, i = 0; i < l; i += 1) {\n\t\t\t\tconst child = addedNodes[i]\n\t\t\t\tweights.set(child, (weights.get(child) || 0) + 1)\n\t\t\t}\n\n\t\t\tconst {removedNodes} = change\n\t\t\tfor (let l = removedNodes.length, i = 0; i < l; i += 1) {\n\t\t\t\tconst child = removedNodes[i]\n\t\t\t\tweights.set(child, (weights.get(child) || 0) - 1)\n\t\t\t}\n\t\t}\n\n\t\t// The order of added and removed callbacks is wrong: it fires connected\n\t\t// before disconnected when a node was moved synchronously.\n\t\t// https://github.com/whatwg/dom/issues/1105\n\t\tfor (const [target, weights] of Array.from(weightsPerTarget)) {\n\t\t\tfor (const [child, weight] of Array.from(weights)) {\n\t\t\t\tif (!includeTextNodes && (child instanceof Text || child instanceof Comment)) continue\n\n\t\t\t\t// If the number of times a child was added is greater than the\n\t\t\t\t// number of times it was removed, then the net result is that\n\t\t\t\t// it was added, so we call onConnect just once.\n\t\t\t\tif (weight > 0 && typeof onConnect == 'function') {\n\t\t\t\t\tonConnect.call(target, child)\n\t\t\t\t\t// addedTo.set(child, target)\n\t\t\t\t}\n\n\t\t\t\t// If the number of times a child was added is less than the\n\t\t\t\t// number of times it was removed, then the net result is that\n\t\t\t\t// it was removed, so we call onDisconnect just once.\n\t\t\t\telse if (weight < 0 && typeof onDisconnect == 'function') {\n\t\t\t\t\tonDisconnect.call(target, child)\n\t\t\t\t\t// removedFrom.set(child, target)\n\t\t\t\t}\n\n\t\t\t\t// If the number of times a child was added is equal to the\n\t\t\t\t// number of times it was removed, then it was essentially left\n\t\t\t\t// in place, so we don't call anything.\n\t\t\t}\n\t\t}\n\t})\n\n\treturn observer\n}\n", "import type {Element3D} from '../Element3D'\nimport type {Scene} from '../Scene'\n\n// The following isScene and isElement3D functions are used in order to avoid\n// using instanceof, which would mean that we would need to import Element3D and\n// Scene as references, which would cause a circular depdency problem.\n// We can look into the \"internal module\" pattern to solve the issue if we wish\n// to switch back to using instanceof:\n// https://medium.com/visual-development/how-to-fix-nasty-circular-dependency-issues-once-and-for-all-in-javascript-typescript-a04c987cf0de\n\nexport const isScene = (el: Node & {isScene?: boolean}): el is Scene => !!el.isScene\n\nexport const isElement3D = (el: Node & {isElement3D?: boolean}): el is Element3D => !!el.isElement3D\n\n// Avoid errors trying to use DOM APIs in non-DOM environments (f.e. server-side rendering).\nexport const isDomEnvironment = () => !!globalThis.window?.document\n", "// TODO Remove isScene and isNode specifics out of here here\n\n// TODO Some logic in SharedAPI actually belongs in here, and relies on\n// childConnectedCallback. Untangle that from SharedAPI so CompositionTracker\n// can fully contain the composition tracking.\n\n// TODO After the above, move this class along with ChildTracker to\n// `@lume/element` or somewhere as generic custom element utilities. Sub-classes\n// should filter out specific undesired elements while CompositionTracker is generic.\n\n// TODO a more generic v2 implementation: a node shuold be able to observe when\n// it is composed into any element, no matter if the element is custom or not.\n// Currently, we rely on the composed parent and children both extending from\n// CompositionTracker for composition tracking to work, but if an element gets\n// composed into some other element like a regular `
`, composition is not\n// tracked.\n// What we need to approximately do is have a CompositionTracker instance detect\n// its regular parentElement in `connectedCallback` no matter what element it\n// is, observe if it has a `ShadowRoot` by patching global `attachShadow` (with\n// the limitation that the code has to be imported before any roots are\n// attached) so that we can react to the presence of a ShadowRoot now or in the\n// future, then we should enact similar logic as in this class in the\n// arbitrary parent element's ShadowRoot.\n\nimport {Constructor} from 'lowclass'\nimport {observeChildren} from './utils/observeChildren.js'\nimport type {PossibleCustomElement, PossibleCustomElementConstructor} from './PossibleCustomElement.js'\nimport {isDomEnvironment, isScene} from './utils/isThisOrThat.js'\n\nexport function CompositionTracker>(Base: T) {\n\treturn class CompositionTracker extends Constructor(\n\t\tBase,\n\t) {\n\t\t// from Scene\n\t\tisScene = false\n\n\t\t// from Element3D\n\t\tisElement3D = false\n\n\t\t// A subclass can set this to false to skip observation of its ShadowRoot.\n\t\tskipShadowObservation = false\n\n\t\t// COMPOSED TREE TRACKING:\n\t\t// Overriding HTMLElement.prototype.attachShadow here is part of our\n\t\t// implementation for tracking the composed tree and connecting THREE\n\t\t// objects in the same structure as the DOM composed tree so that it will\n\t\t// render as expected when end users compose elements with ShadowDOM and\n\t\t// slots.\n\t\toverride attachShadow(options: ShadowRootInit): ShadowRoot {\n\t\t\tconst root = super.attachShadow(options)\n\n\t\t\tif (this.skipShadowObservation) return root\n\n\t\t\tthis.__shadowRoot = root\n\n\t\t\tobserveChildren({\n\t\t\t\ttarget: root,\n\t\t\t\tonConnect: this.__shadowRootChildAdded.bind(this),\n\t\t\t\tonDisconnect: this.__shadowRootChildRemoved.bind(this),\n\t\t\t})\n\n\t\t\t// Arrray.from is needed for older Safari which can't iterate on HTMLCollection\n\t\t\tconst children = Array.from(this.children)\n\n\t\t\tfor (const child of children) {\n\t\t\t\tif (!(child instanceof CompositionTracker)) continue\n\n\t\t\t\tchild.__isPossiblyDistributedToShadowRoot = true\n\t\t\t\tthis.__triggerChildUncomposedCallback(child, 'actual')\n\t\t\t}\n\n\t\t\treturn root\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING:\n\t\tget _hasShadowRoot(): boolean {\n\t\t\treturn !!this.__shadowRoot\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING:\n\t\tget _isPossiblyDistributedToShadowRoot(): boolean {\n\t\t\treturn this.__isPossiblyDistributedToShadowRoot\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING:\n\t\tget _shadowRootParent(): CompositionTracker | null {\n\t\t\treturn this.__shadowRootParent\n\t\t}\n\n\t\tget _shadowRootChildren(): CompositionTracker[] {\n\t\t\tif (!this.__shadowRoot) return []\n\n\t\t\treturn Array.from(this.__shadowRoot.children).filter(\n\t\t\t\t(n): n is CompositionTracker => n instanceof CompositionTracker,\n\t\t\t)\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING: Elements that are distributed to a slot that is\n\t\t// child of a ShadowRoot of this element.\n\t\tget _distributedShadowRootChildren(): CompositionTracker[] {\n\t\t\tconst result: CompositionTracker[] = []\n\n\t\t\tfor (const child of Array.from(this.__shadowRoot?.children || [])) {\n\t\t\t\tif (child instanceof HTMLSlotElement && !child.assignedSlot) {\n\t\t\t\t\tfor (const distributed of child.assignedElements({flatten: true})) {\n\t\t\t\t\t\tif (distributed instanceof CompositionTracker) result.push(distributed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING:\n\t\tget _distributedParent(): CompositionTracker | null {\n\t\t\treturn this.__distributedParent\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING:\n\t\tget _distributedChildren(): CompositionTracker[] | null {\n\t\t\treturn this.__distributedChildren ? [...this.__distributedChildren] : null\n\t\t}\n\n\t\t__composedParent: Element | null = null\n\n\t\tget composedParent(): Element | null {\n\t\t\tlet result = this.__composedParent\n\n\t\t\tif (!result) {\n\t\t\t\tresult = this.__getComposedParent()\n\t\t\t}\n\n\t\t\treturn result\n\t\t}\n\n\t\t// Returns composed state calculated only during composition, which can\n\t\t// be incorrect in the edge case described in\n\t\t// __getSlottedChildDifference (faster).\n\t\tget __isComposed() {\n\t\t\treturn this.__composedParent\n\t\t}\n\n\t\t// Returns the correct composed state even if our tracking is incorrect,\n\t\t// by inspecting the DOM (slower).\n\t\tget isComposed() {\n\t\t\treturn this.composedParent\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING: The composed parent is the parent that this element renders relative\n\t\t// to in the flat tree (composed tree).\n\t\t__getComposedParent(): HTMLElement | null {\n\t\t\tlet parent: Node | null = this.parentElement\n\n\t\t\t// Special case only for Nodes that are children of a Scene.\n\t\t\t// TODO filtering should be done by subclasses\n\t\t\tif (parent && isScene(parent)) return parent\n\n\t\t\tparent = this.__distributedParent || this.__shadowRootParent\n\n\t\t\t// Shortcut in case we have already detected distributed or shadowRoot parent.\n\t\t\tif (parent) return parent as HTMLElement\n\n\t\t\treturn getComposedParent(this)\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING: Composed children are the children that render relative to this\n\t\t// element in the flat tree (composed tree), whether as children of a\n\t\t// shadow root, or distributed children (assigned nodes) of a \n\t\t// element.\n\t\tget _composedChildren(): CompositionTracker[] {\n\t\t\tif (this.__shadowRoot) {\n\t\t\t\treturn [...this._distributedShadowRootChildren, ...this._shadowRootChildren]\n\t\t\t} else {\n\t\t\t\treturn [\n\t\t\t\t\t...(this.__distributedChildren || []), // TODO perhaps use slot.assignedElements instead?\n\t\t\t\t\t// We only care about other nodes of the same type.\n\t\t\t\t\t...Array.from(this.children).filter((n): n is CompositionTracker => n instanceof CompositionTracker),\n\t\t\t\t]\n\t\t\t}\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING: This element's shadow root, if any. This always points to the shadow\n\t\t// root, even if it is a closed root, unlike the public shadowRoot\n\t\t// property.\n\t\t__shadowRoot?: ShadowRoot\n\n\t\t// COMPOSED TREE TRACKING: True when this element has a parent that has a shadow root.\n\t\t__isPossiblyDistributedToShadowRoot = false\n\n\t\t__prevAssignedNodes?: WeakMap\n\n\t\t// COMPOSED TREE TRACKING:\n\t\t// A map of the slot elements that are children of this element and\n\t\t// their last-known assigned elements. When a slotchange happens while\n\t\t// this element is in a shadow root and has a slot child, we can\n\t\t// detect what the difference is between the last known assigned elements and the new\n\t\t// ones.\n\t\tget __previousSlotAssignedNodes() {\n\t\t\tif (!this.__prevAssignedNodes) this.__prevAssignedNodes = new WeakMap()\n\t\t\treturn this.__prevAssignedNodes\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING:\n\t\t// If this element is distributed into a shadow tree, this will\n\t\t// reference the parent element of the element where this element is\n\t\t// distributed to. This element will render as a child of\n\t\t// that parent element in the flat tree (composed tree).\n\t\t__distributedParent: CompositionTracker | null = null\n\n\t\t// COMPOSED TREE TRACKING:\n\t\t// If this element is a top-level child of a shadow root, then this points\n\t\t// to the shadow root host. The shadow root host is the prent element that\n\t\t// this element renders relative to in the flat tree (composed tree).\n\t\t__shadowRootParent: CompositionTracker | null = null\n\n\t\t// COMPOSED TREE TRACKING:\n\t\t// If this element has a child element while in\n\t\t// a shadow root, then this will be a Set of the nodes distributed\n\t\t// into the , and those nodes render relatively\n\t\t// to this element in the flat tree. We instantiate this later, only\n\t\t// when/if needed.\n\t\t__distributedChildren?: Set\n\n\t\t// COMPOSED TREE TRACKING: Called when a child is added to the ShadowRoot of this element.\n\t\t// This does not run for Scene instances, which already have a root for their rendering implementation.\n\t\t__shadowRootChildAdded(child: Element) {\n\t\t\t// NOTE Logic here is similar to childConnectedCallback\n\n\t\t\tif (child instanceof CompositionTracker) {\n\t\t\t\tchild.__shadowRootParent = this\n\t\t\t\tthis.__triggerChildComposedCallback(child, 'root')\n\t\t\t} else if (child instanceof HTMLSlotElement) {\n\t\t\t\tchild.addEventListener('slotchange', this.__onChildSlotChange)\n\t\t\t\tthis.__handleSlottedChildren(child)\n\t\t\t}\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING: Called when a child is removed from the ShadowRoot of this element.\n\t\t// This does not run for Scene instances, which already have a root for their rendering implementation.\n\t\t__shadowRootChildRemoved(child: Element) {\n\t\t\t// NOTE Logic here is similar to childDisconnectedCallback\n\n\t\t\tif (child instanceof CompositionTracker) {\n\t\t\t\tchild.__shadowRootParent = null\n\t\t\t\tthis.__triggerChildUncomposedCallback(child, 'root')\n\t\t\t} else if (child instanceof HTMLSlotElement) {\n\t\t\t\tchild.removeEventListener('slotchange', this.__onChildSlotChange, {capture: true})\n\t\t\t\tthis.__handleSlottedChildren(child)\n\t\t\t\tthis.__previousSlotAssignedNodes.delete(child)\n\t\t\t}\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING: Called when a slot child of this element emits a slotchange event.\n\t\t// TODO we need an @lazy decorator instead of making this a getter manually.\n\t\tget __onChildSlotChange(): (event: Event) => void {\n\t\t\tif (this.__onChildSlotChange__) return this.__onChildSlotChange__\n\n\t\t\tthis.__onChildSlotChange__ = (event: Event) => {\n\t\t\t\t// event.currentTarget is the slot that this event handler is on,\n\t\t\t\t// while event.target is always the slot from the ancestor-most\n\t\t\t\t// tree if that slot is assigned to this slot or another slot that\n\t\t\t\t// ultimate distributes to this slot.\n\t\t\t\tconst slot = event.currentTarget as HTMLSlotElement\n\n\t\t\t\tthis.__handleSlottedChildren(slot)\n\t\t\t}\n\n\t\t\treturn this.__onChildSlotChange__\n\t\t}\n\n\t\t__onChildSlotChange__?: (event: Event) => void\n\n\t\t// COMPOSED TREE TRACKING: Life cycle methods for use by subclasses to run\n\t\t// logic when children are composed or uncomposed to them in the composed\n\t\t// tree.\n\t\tchildComposedCallback?(composedChild: Element, compositionType: CompositionType): void\n\t\tchildUncomposedCallback?(uncomposedChild: Element, compositionType: CompositionType): void\n\t\tcomposedCallback?(composedParent: Element, compositionType: CompositionType): void\n\t\tuncomposedCallback?(uncomposedParent: Element, compositionType: CompositionType): void\n\n\t\t#discrepancy = false\n\n\t\t__triggerChildComposedCallback(child: CompositionTracker, compositionType: CompositionType) {\n\t\t\tif (child.#discrepancy) return\n\n\t\t\tchild.__composedParent = this\n\n\t\t\tconst trigger = () => {\n\t\t\t\tthis.childComposedCallback?.(child, compositionType)\n\t\t\t\tchild.composedCallback?.(this, compositionType)\n\t\t\t}\n\n\t\t\tconst isUpgraded = child.matches(':defined')\n\n\t\t\tif (isUpgraded) trigger()\n\t\t\telse customElements.whenDefined(child.tagName.toLowerCase()).then(trigger)\n\t\t}\n\n\t\t__triggerChildUncomposedCallback(child: CompositionTracker, compositionType: CompositionType) {\n\t\t\t// If we detected the discrepancy, return, the slotchange handler will rerun this appropriately.\n\t\t\tif (child.#discrepancy) return\n\n\t\t\tchild.__composedParent = null\n\n\t\t\t// We don't need to defer here like we did in\n\t\t\t// __triggerChildComposedCallback because if an element is uncomposed,\n\t\t\t// it won't load anything even if its class gets defined later.\n\t\t\tthis.childUncomposedCallback?.(child, compositionType)\n\t\t\tchild.uncomposedCallback?.(this, compositionType)\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING: This is called in certain cases when distributed\n\t\t// children may have changed, f.e. when a slot was added to this element, or\n\t\t// when a child slot of this element has had assigned nodes changed\n\t\t// (slotchange).\n\t\t__handleSlottedChildren(slot: HTMLSlotElement) {\n\t\t\tconst diff = this.__getSlottedChildDifference(slot)\n\n\t\t\tconst {removed} = diff\n\t\t\tfor (let l = removed.length, i = 0; i < l; i += 1) {\n\t\t\t\tconst removedNode = removed[i]\n\n\t\t\t\tif (!(removedNode instanceof CompositionTracker)) continue\n\n\t\t\t\tremovedNode.__distributedParent = null\n\n\t\t\t\t// The node may have already been deleted, and\n\t\t\t\t// __distributedChildren set to undefined, in the `added`\n\t\t\t\t// for-loop of another slot.\n\t\t\t\tif (this.__distributedChildren) {\n\t\t\t\t\tthis.__distributedChildren.delete(removedNode)\n\t\t\t\t\tif (this.__distributedChildren.size) this.__distributedChildren = undefined\n\t\t\t\t}\n\n\t\t\t\tthis.__triggerChildUncomposedCallback(removedNode, 'slot')\n\t\t\t}\n\n\t\t\tconst {added} = diff\n\t\t\tfor (let l = added.length, i = 0; i < l; i += 1) {\n\t\t\t\tconst addedNode = added[i]\n\n\t\t\t\tif (!(addedNode instanceof CompositionTracker)) continue\n\n\t\t\t\t// Keep track of the final distribution of a node.\n\t\t\t\t//\n\t\t\t\t// If the given slot is assigned to another\n\t\t\t\t// slot, then this logic will run again for the next slot on\n\t\t\t\t// that next slot's slotchange, so we remove the distributed\n\t\t\t\t// node from the previous distributedParent and add it to the next\n\t\t\t\t// one. If we don't do this, then the distributed node will\n\t\t\t\t// exist in multiple distributedChildren lists when there is a\n\t\t\t\t// chain of assigned slots. For more info, see\n\t\t\t\t// https://github.com/w3c/webcomponents/issues/611\n\t\t\t\tconst distributedParent = addedNode.__distributedParent\n\t\t\t\tif (distributedParent) {\n\t\t\t\t\tconst distributedChildren = distributedParent.__distributedChildren\n\t\t\t\t\tif (distributedChildren) {\n\t\t\t\t\t\tdistributedChildren.delete(addedNode)\n\t\t\t\t\t\tif (!distributedChildren.size) distributedParent.__distributedChildren = undefined\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// The node is now distributed to `this` element.\n\t\t\t\taddedNode.__distributedParent = this\n\t\t\t\tif (!this.__distributedChildren) this.__distributedChildren = new Set()\n\t\t\t\tthis.__distributedChildren.add(addedNode)\n\n\t\t\t\t// This is true then the reaction order is incorrect due to the\n\t\t\t\t// order of slot change events.\n\t\t\t\t//\n\t\t\t\t// This discrepancy detection is only for slot composition\n\t\t\t\t// right now. We need to add more tests to see if this is a\n\t\t\t\t// problem with other composition types, and possbly\n\t\t\t\t// combinations of composition types (f.e. uncomposed from a\n\t\t\t\t// shadow root host, then composed to a slot parent, etc).\n\t\t\t\tif (addedNode.__composedParent) addedNode.#discrepancy = true\n\n\t\t\t\tthis.__triggerChildComposedCallback(addedNode, 'slot')\n\t\t\t}\n\n\t\t\t// If there is the detected discrepancy for any of the added nodes,\n\t\t\t// run uncomposed and composed reactions again, in that order. This\n\t\t\t// fixes the edge case with composition causing composed to run\n\t\t\t// before uncomposed when a node is moved to another slot (causing\n\t\t\t// the rendering to break) due to slotchange ordering issues as with\n\t\t\t// MutationObserver, described in\n\t\t\t// https://github.com/whatwg/dom/issues/1111. More info in\n\t\t\t// __getSlottedChildDifference.\n\t\t\t//\n\t\t\t// We will improve this by using Oxford Harrison's `realdom` library\n\t\t\t// at https://github.com/webqit/realdom, which allows us to react to\n\t\t\t// DOM mutations in a reliable way synchronously in the\n\t\t\t// always-correct order (by patching all the DOM-mutating APIs such\n\t\t\t// as appendChild, innerHTML, etc).\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tfor (let l = added.length, i = 0; i < l; i += 1) {\n\t\t\t\t\tconst addedNode = added[i]\n\t\t\t\t\tif (!(addedNode instanceof CompositionTracker)) continue\n\t\t\t\t\t// if (addedNode.isConnected && !addedNode.__isComposed && addedNode.isComposed) {\n\t\t\t\t\tif (addedNode.isConnected && addedNode.#discrepancy) {\n\t\t\t\t\t\t// addedNode.recompose()\n\t\t\t\t\t\taddedNode.#discrepancy = false\n\t\t\t\t\t\tthis.__triggerChildUncomposedCallback(addedNode, 'slot')\n\t\t\t\t\t\tthis.__triggerChildComposedCallback(addedNode, 'slot')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\t// COMPOSED TREE TRACKING: Get the difference between the last assigned\n\t\t// elements and current assigned elements of a child slot of this element.\n\t\t__getSlottedChildDifference(slot: HTMLSlotElement): SlotDiff {\n\t\t\tconst bruteForceMethod = true\n\n\t\t\tif (bruteForceMethod) {\n\t\t\t\t//////////////////////\n\t\t\t\t// This method behaves *more* correct (not fully) than the other\n\t\t\t\t// method, but does extra work because it runs unslotted\n\t\t\t\t// reactions for *all* previous nodes, and then slotted\n\t\t\t\t// reactions for *all* current nodes even if any of those nodes\n\t\t\t\t// were not removed and added, to be sure that we catch\n\t\t\t\t// synchronous changes where the same node was both removed and\n\t\t\t\t// added or similar. We are not able to see all the mutations\n\t\t\t\t// like we can with MutationObserver.\n\t\t\t\t//\n\t\t\t\t// This method might not catch cases when a node is added and\n\t\t\t\t// then removed in the same tick. It might also not run\n\t\t\t\t// reactions in a correct order across multiple slots (f.e.\n\t\t\t\t// given a node removed from one slot then added to another, the\n\t\t\t\t// slot that received the node may have its callback ran first\n\t\t\t\t// and added reactions will fire, then the slot that had the\n\t\t\t\t// node removed may have its *after*, causing the net effect on\n\t\t\t\t// the node to be removed), which is the same problems as with\n\t\t\t\t// MutationObserver callbacks described in\n\t\t\t\t// https://github.com/whatwg/dom/issues/1111.\n\t\t\t\t//\n\t\t\t\t// Discussion: https://github.com/WICG/webcomponents/issues/1042\n\t\t\t\t//////////////////////\n\n\t\t\t\tconst previousNodes = this.__previousSlotAssignedNodes.get(slot) ?? []\n\t\t\t\tconst newNodes = this.#getCurrentAssignedNodes(slot)\n\t\t\t\tthis.__previousSlotAssignedNodes.set(slot, [...newNodes])\n\t\t\t\treturn {removed: previousNodes, added: newNodes}\n\t\t\t} else {\n\t\t\t\t//////////////////////\n\t\t\t\t// This method is potentially more optimized because it does a\n\t\t\t\t// diff, and runs reactions only for nodes that were detected to\n\t\t\t\t// actually be added or removed, but it fails to detect nodes\n\t\t\t\t// that were both removed and added in the same tick because\n\t\t\t\t// `slotchange` is synchronous and we do not have a way to see\n\t\t\t\t// all mutation records, we can only see the current set of\n\t\t\t\t// slotted nodes with slot.assignedNodes.\n\t\t\t\t//////////////////////\n\n\t\t\t\tconst previousNodes = this.__previousSlotAssignedNodes.get(slot) ?? []\n\n\t\t\t\tconst newNodes = this.#getCurrentAssignedNodes(slot)\n\n\t\t\t\t// Save the newNodes to be used as the previousNodes for next time\n\t\t\t\t// (clone it so the following in-place modification doesn't ruin any\n\t\t\t\t// assumptions in the next round).\n\t\t\t\tthis.__previousSlotAssignedNodes.set(slot, [...newNodes])\n\n\t\t\t\tconst diff: SlotDiff = {added: newNodes, removed: []}\n\n\t\t\t\tfor (let i = 0, l = previousNodes.length; i < l; i += 1) {\n\t\t\t\t\tconst oldNode = previousNodes[i]\n\t\t\t\t\tconst newIndex = newNodes.indexOf(oldNode)\n\n\t\t\t\t\t// if it exists in the previousNodes but not the newNodes, then\n\t\t\t\t\t// the node was removed.\n\t\t\t\t\tif (!(newIndex >= 0)) diff.removed.push(oldNode)\n\t\t\t\t\t// otherwise the node wasn't added or removed.\n\t\t\t\t\telse newNodes.splice(i, 1)\n\t\t\t\t}\n\n\t\t\t\t// The remaining nodes in newNodes must have been added.\n\n\t\t\t\treturn diff\n\t\t\t}\n\t\t}\n\n\t\t#getCurrentAssignedNodes(slot: HTMLSlotElement) {\n\t\t\t// If this slot is assigned to another slot, then we don't consider any\n\t\t\t// of the slot's assigned nodes as being distributed to the current element,\n\t\t\t// because instead they are distributed to an element further down in the\n\t\t\t// composed tree where this slot is assigned to.\n\t\t\t//\n\t\t\t// Special case for Scenes: we don't care if slot children of a Scene\n\t\t\t// distribute to a deeper slot, because a Scene's ShadowRoot is for the rendering\n\t\t\t// implementation and not the user's distribution, so we only want to detect\n\t\t\t// elements slotted directly to the Scene in that case.\n\t\t\t// TODO filtering should be done by subclasses\n\t\t\t// TODO move filtering to parent\n\t\t\treturn !this.isScene && slot.assignedSlot ? [] : slot.assignedElements({flatten: true})\n\t\t}\n\n\t\ttraverseComposed(visitor: (el: CompositionTracker) => void, waitForUpgrade = false): Promise | void {\n\t\t\tvisitor(this)\n\n\t\t\tif (!waitForUpgrade) {\n\t\t\t\tfor (const child of this._composedChildren) child.traverseComposed(visitor, waitForUpgrade)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If waitForUpgrade is true, we make a promise chain so that traversal\n\t\t\t// order is still the same as when waitForUpgrade is false.\n\t\t\tlet promise: Promise = Promise.resolve()\n\n\t\t\tfor (const child of this._composedChildren) {\n\t\t\t\tconst isUpgraded = child.matches(':defined')\n\n\t\t\t\tif (isUpgraded) {\n\t\t\t\t\tpromise = promise!.then(() => child.traverseComposed(visitor, waitForUpgrade))\n\t\t\t\t} else {\n\t\t\t\t\tpromise = promise!\n\t\t\t\t\t\t.then(() => customElements.whenDefined(child.tagName.toLowerCase()))\n\t\t\t\t\t\t.then(() => child.traverseComposed(visitor, waitForUpgrade))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn promise\n\t\t}\n\t}\n}\n\nexport type CompositionType = 'root' | 'slot' | 'actual'\n\nconst shadowHosts: WeakSet = new WeakSet()\n\nif (isDomEnvironment()) {\n\tconst original = Element.prototype.attachShadow\n\n\tElement.prototype.attachShadow = function attachShadow(...args) {\n\t\tconst result = original.apply(this, args)\n\n\t\tshadowHosts.add(this)\n\n\t\treturn result\n\t}\n}\n\nexport function hasShadow(el: Element): boolean {\n\treturn shadowHosts.has(el)\n}\n\nexport function getComposedParent(el: HTMLElement): HTMLElement | null {\n\tconst parent = el.parentNode as ShadowRoot | Element | null\n\n\tif (parent instanceof HTMLSlotElement) {\n\t\tlet slot = parent\n\n\t\t// If el is a child of a element (i.e. el is a slot's default\n\t\t// content), then return null if the slot has anything slotted to it in\n\t\t// which case default content does not participate in the composed tree.\n\t\tif (slot.assignedElements({flatten: true}).length) return null\n\n\t\treturn getComposedParent(slot)\n\t} else {\n\t\tconst parent = el.parentNode as ShadowRoot | Element | null\n\n\t\tif (!parent) return null\n\n\t\tif (parent instanceof ShadowRoot) return parent.host as HTMLElement\n\n\t\tif (hasShadow(parent)) {\n\t\t\t// If the parent has a ShadowRoot, but el is does not have an\n\t\t\t// assigned node, it is not slotted therefore not in the composed\n\t\t\t// tree.\n\t\t\tif (!el.assignedSlot) return null\n\n\t\t\t// Otherwise, if el is assigned to a slot, that slot might be\n\t\t\t// further assigned to a deeper slot, and so on.\n\t\t\twhile (el.assignedSlot) el = el.assignedSlot\n\n\t\t\t// So finally get the slot's composition parent.\n\t\t\treturn getComposedParent(el)\n\t\t}\n\n\t\t// Regular parent is the composed parent.\n\t\treturn parent as HTMLElement\n\t}\n}\n\ntype SlotDiff = {added: Node[]; removed: Node[]}\n", "import {signal} from 'classy-solid'\nimport {attribute, element, noSignal} from '@lume/element'\nimport {TreeNode} from './TreeNode.js'\nimport {XYZSizeModeValues, type SizeModeValue} from '../xyz-values/XYZSizeModeValues.js'\nimport {XYZNonNegativeValues} from '../xyz-values/XYZNonNegativeValues.js'\nimport {Motor} from './Motor.js'\nimport {CompositionTracker} from './CompositionTracker.js'\n\nimport type {\n\tXYZValues,\n\tXYZValuesObject,\n\tXYZPartialValuesArray,\n\tXYZPartialValuesObject,\n} from '../xyz-values/XYZValues.js'\nimport type {RenderTask} from './Motor.js'\nimport type {XYZNumberValues} from '../xyz-values/XYZNumberValues.js'\n\nconst previousSize: Partial> = {}\n\nexport type SizeableAttributes = 'sizeMode' | 'size'\n\nconst sizeMode = new WeakMap()\nconst size = new WeakMap()\n\n/**\n * @class Sizeable - Provides features for defining the size volume of an object in 3D space.\n *\n * The properties of `Sizeable` all follow a common usage pattern,\n * described in the [`Common Attributes`](../../guide/common-attributes) doc.\n *\n * @extends TreeNode\n */\n// Sizeable and its subclass Transformable extend from TreeNode because they know\n// about their `parent` when calculating proportional sizes or world matrices\n// based on parent values.\nexport\n@element\nclass Sizeable extends CompositionTracker(TreeNode) {\n\t@signal __calculatedSize?: XYZValuesObject = {x: 0, y: 0, z: 0}\n\n\t/**\n\t * @property {string | [x?: string, y?: string, z?: string] | {x?: string, y?: string, z?: string} | XYZSizeModeValues | null} sizeMode -\n\t *\n\t * *attribute*\n\t *\n\t * Default: new [XYZSizeModeValues](../xyz-values/XYZSizeModeValues)('literal', 'literal', 'literal')\n\t *\n\t * Set the size mode for each axis. Possible values are `\"literal\"` (or `\"l\"` for short) and\n\t * `\"proportional\"` (or `\"p\"` for short). For example,\n\t *\n\t * ```html\n\t * \n\t * \n\t * ```\n\t *\n\t * The value of `.sizeMode` for a particular axis dictates how the respective\n\t * [`.size`](#size) value along the same axis will behave:\n\t *\n\t * - A value of `\"literal\"` for an axis means the `.size` value along that\n\t * axis will be literally as specified.\n\t * - A value of `\"proportional\"` for an axis means the `.size`\n\t * value along that axis will be a proportion of the object's parent's size\n\t * along that axis.\n\t */\n\t@attribute\n\t@noSignal\n\tset sizeMode(newValue: XYZSizeModeValuesProperty) {\n\t\tif (typeof newValue === 'function') throw new TypeError('property functions are not allowed for sizeMode')\n\t\tif (!sizeMode.has(this)) sizeMode.set(this, new XYZSizeModeValues('literal', 'literal', 'literal'))\n\t\tthis._setPropertyXYZ('sizeMode', sizeMode.get(this)!, newValue)\n\t}\n\tget sizeMode(): XYZSizeModeValues {\n\t\tif (!sizeMode.has(this)) sizeMode.set(this, new XYZSizeModeValues('literal', 'literal', 'literal'))\n\t\treturn sizeMode.get(this)!\n\t}\n\n\t// TODO: A \"differential\" size would be cool. Good for padding,\n\t// borders, etc. Inspired from Famous' differential sizing.\n\t//\n\t// TODO: A \"target\" size where sizing can be relative to another node.\n\t// This would be tricky though, because there could be circular size\n\t// dependencies. Maybe we'd throw an error in that case, because there'd be no original size to base off of.\n\n\t/**\n\t * @property {string | [x?: number, y?: number, z?: number] | {x?: number, y?: number, z?: number} | XYZNonNegativeValues | null} size -\n\t *\n\t * *attribute*\n\t *\n\t * Default: new [XYZNonNegativeValues](../xyz-values/XYZNonNegativeValues)(0, 0, 0)\n\t *\n\t * Set the size of the object along each axis. The meaning of a size value for a particular axis depends on the\n\t * [`.sizeMode`](#sizemode) value for the same axis.\n\t *\n\t * All size values must be positive numbers or an error is thrown.\n\t *\n\t * Literal sizes can be any positive value (the literal size that you want).\n\t * Proportional size along an axis represents a proportion of the parent\n\t * size on the same axis. `0` means 0% of the parent size, and `1.0` means\n\t * 100% of the parent size.\n\t *\n\t * For example, if `.sizeMode` is set to `el.sizeMode = ['literal',\n\t * 'proportional', 'literal']`, then setting `el.size = [20, 0.5, 30]` means\n\t * the X size is a literal value of `20`, the Y size is 50% of the parent Y\n\t * size, and the Z size is a literal value of `30`. It is easy this way to\n\t * mix literal and proportional sizes for the different axes.\n\t */\n\t@attribute\n\t@noSignal\n\tset size(newValue: XYZNonNegativeNumberValuesProperty | XYZNonNegativeNumberValuesPropertyFunction) {\n\t\tif (!size.has(this)) size.set(this, new XYZNonNegativeValues(0, 0, 0))\n\t\tthis._setPropertyXYZ('size', size.get(this)!, newValue)\n\t}\n\tget size(): XYZNonNegativeValues {\n\t\tif (!size.has(this)) size.set(this, new XYZNonNegativeValues(0, 0, 0))\n\t\treturn size.get(this)!\n\t}\n\n\t/**\n\t * @property {{x: number, y: number, z: number}} calculatedSize -\n\t *\n\t * *readonly*, *signal*\n\t *\n\t * Get the actual size of an element as an object with `x`, `y`, and `z`\n\t * properties, each property containing the computed size along its\n\t * respective axis.\n\t *\n\t * This can be useful when size is proportional, as the actual size of the\n\t * an element will depend on the size of its parent, and otherwise looking\n\t * at the `.size` value won't tell us the actual size.\n\t */\n\tget calculatedSize() {\n\t\t// TODO we can re-calculate the actual size lazily, this way it can\n\t\t// normally be deferred to a Motor render task, unless a user\n\t\t// explicitly needs it and reads the value.\n\t\t// if (this.__sizeDirty) this._calcSize\n\n\t\t// TODO make it a readonly reactive object instead of cloning.\n\t\treturn {...(this.__calculatedSize ?? {x: 0, y: 0, z: 0})}\n\t}\n\n\tget composedLumeParent(): Sizeable | null {\n\t\tconst result = this.composedParent\n\t\tif (!(result instanceof Sizeable)) return null\n\t\treturn result\n\t}\n\n\tget composedLumeChildren(): Sizeable[] {\n\t\treturn super._composedChildren as Sizeable[]\n\t}\n\n\t/**\n\t * @property {{x: number, y: number, z: number}} parentSize\n\t *\n\t * *signal* *readonly*\n\t *\n\t * Returns an object with `x`, `y`, and `z` properties containing the size\n\t * dimensions of the composed LUME parent. If there is no composed LUME\n\t * parent, the size is 0,0,0.\n\t */\n\tget parentSize() {\n\t\treturn this.composedLumeParent?.calculatedSize ?? {x: 0, y: 0, z: 0}\n\t}\n\n\t_calcSize() {\n\t\tconst calculatedSize = this.__calculatedSize ?? {x: 0, y: 0, z: 0}\n\n\t\tObject.assign(previousSize, calculatedSize)\n\n\t\tconst size = this.size\n\t\tconst sizeMode = this.sizeMode\n\t\tconst {x: modeX, y: modeY, z: modeZ} = sizeMode\n\t\tconst parentSize = this.parentSize\n\n\t\tif (modeX === 'literal' || modeX === 'l') {\n\t\t\tcalculatedSize.x = size.x\n\t\t} else if (modeX === 'proportional' || modeX === 'p') {\n\t\t\tcalculatedSize.x = parentSize.x * size.x\n\t\t}\n\n\t\tif (modeY === 'literal' || modeY === 'l') {\n\t\t\tcalculatedSize.y = size.y\n\t\t} else if (modeY === 'proportional' || modeY === 'p') {\n\t\t\tcalculatedSize.y = parentSize.y * size.y\n\t\t}\n\n\t\tif (modeZ === 'literal' || modeZ === 'l') {\n\t\t\tcalculatedSize.z = size.z\n\t\t} else if (modeZ === 'proportional' || modeZ === 'p') {\n\t\t\tcalculatedSize.z = parentSize.z * size.z\n\t\t}\n\n\t\t// We set it to the same value to trigger reactivity.\n\t\tthis.__calculatedSize = calculatedSize\n\n\t\tif (\n\t\t\tpreviousSize.x !== calculatedSize.x ||\n\t\t\tpreviousSize.y !== calculatedSize.y ||\n\t\t\tpreviousSize.z !== calculatedSize.z\n\t\t) {\n\t\t\t// TODO replace events with reactivity\n\t\t\tthis.emit('sizechange', {...calculatedSize})\n\t\t}\n\t}\n\n\t#isSettingProperty = false\n\n\tget _isSettingProperty() {\n\t\treturn this.#isSettingProperty\n\t}\n\n\t_setPropertyXYZ(name: K, xyz: XYZValues, newValue: V) {\n\t\t// @ts-ignore\n\t\tif (newValue === xyz) return\n\n\t\tthis.#isSettingProperty = true\n\n\t\tif (isXYZPropertyFunction(newValue)) {\n\t\t\tthis.#handleXYZPropertyFunction(newValue, name, xyz)\n\t\t} else {\n\t\t\tif (!this.#settingValueFromPropFunction) this.#removePropertyFunction(name)\n\t\t\telse this.#settingValueFromPropFunction = false\n\n\t\t\txyz.from(newValue)\n\t\t}\n\n\t\tthis.#isSettingProperty = false\n\t}\n\n\t_setPropertySingle(name: K, setter: (newValue: this[K]) => void, newValue: V) {\n\t\tthis.#isSettingProperty = true\n\n\t\tif (isSinglePropertyFunction(newValue)) {\n\t\t\tthis.#handleSinglePropertyFunction(newValue, name)\n\t\t} else {\n\t\t\tif (!this.#settingValueFromPropFunction) this.#removePropertyFunction(name)\n\t\t\telse this.#settingValueFromPropFunction = false\n\n\t\t\tsetter(newValue as any) // FIXME no any\n\t\t}\n\n\t\tthis.#isSettingProperty = false\n\t}\n\n\t#propertyFunctions: Map | null = null\n\t#settingValueFromPropFunction = false\n\n\t#handleXYZPropertyFunction(fn: XYZNumberValuesPropertyFunction, name: keyof this, xyz: XYZValues) {\n\t\tif (!this.#propertyFunctions) this.#propertyFunctions = new Map()\n\n\t\tconst propFunction = this.#propertyFunctions.get(name as string)\n\n\t\tif (propFunction) Motor.removeRenderTask(propFunction)\n\n\t\tthis.#propertyFunctions.set(\n\t\t\tname as string,\n\t\t\tMotor.addRenderTask((time, deltaTime) => {\n\t\t\t\tconst result = fn(xyz.x, xyz.y, xyz.z, time, deltaTime)\n\n\t\t\t\tif (result === false) {\n\t\t\t\t\tthis.#propertyFunctions!.delete(name as string)\n\t\t\t\t\treturn false\n\t\t\t\t}\n\n\t\t\t\tthis.#settingValueFromPropFunction = true\n\t\t\t\txyz.from(result)\n\n\t\t\t\treturn\n\t\t\t}),\n\t\t)\n\t}\n\n\t#handleSinglePropertyFunction(fn: SinglePropertyFunction, name: keyof this) {\n\t\tif (!this.#propertyFunctions) this.#propertyFunctions = new Map()\n\n\t\tconst propFunction = this.#propertyFunctions.get(name as string)\n\n\t\tif (propFunction) Motor.removeRenderTask(propFunction)\n\n\t\tthis.#propertyFunctions.set(\n\t\t\tname as string,\n\t\t\tMotor.addRenderTask(time => {\n\t\t\t\tconst result = fn((this as any)[name], time)\n\n\t\t\t\tif (result === false) {\n\t\t\t\t\tthis.#propertyFunctions!.delete(name as string)\n\t\t\t\t\treturn false\n\t\t\t\t}\n\n\t\t\t\tthis.#settingValueFromPropFunction = true\n\t\t\t\t;(this as any)[name] = result\n\n\t\t\t\t// TODO The RenderTask return type is `false | void`, so why\n\t\t\t\t// does the noImplicitReturns TS option require a return\n\t\t\t\t// here? Open bug on TypeScript.\n\t\t\t\treturn\n\t\t\t}),\n\t\t)\n\t}\n\n\t// remove property function (render task) if any.\n\t#removePropertyFunction(name: keyof this) {\n\t\tif (!this.#propertyFunctions) return\n\n\t\tconst propFunction = this.#propertyFunctions.get(name as string)\n\n\t\tif (propFunction) {\n\t\t\tMotor.removeRenderTask(propFunction)\n\t\t\tthis.#propertyFunctions.delete(name as string)\n\t\t\tif (!this.#propertyFunctions.size) this.#propertyFunctions = null\n\t\t}\n\t}\n}\n\n// the following type guards are used above just to satisfy the type system,\n// though the actual runtime check does not guarantee that the functions are of\n// the expected shape.\n\nfunction isXYZPropertyFunction(f: any): f is XYZNumberValuesPropertyFunction {\n\treturn typeof f === 'function'\n}\n\nfunction isSinglePropertyFunction(f: any): f is SinglePropertyFunction {\n\treturn typeof f === 'function'\n}\n\n// This type represents the types of values that can be set via attributes or\n// properties (attributes pass strings to properties and properties all handle\n// string values for example, hence why it includes `| string`)\nexport type XYZValuesProperty =\n\t| XYZValuesType\n\t| XYZPartialValuesArray\n\t| XYZPartialValuesObject\n\t| string\n\nexport type XYZNumberValuesProperty = XYZValuesProperty\nexport type XYZNonNegativeNumberValuesProperty = XYZValuesProperty\nexport type XYZSizeModeValuesProperty = XYZValuesProperty\n\n// Property functions are used for animating properties of type XYZNumberValues\nexport type XYZValuesPropertyFunction = (\n\tx: DataType,\n\ty: DataType,\n\tz: DataType,\n\ttime: number,\n\tdeltaTime: number,\n) => XYZValuesPropertyType | false\n\nexport type XYZNumberValuesPropertyFunction = XYZValuesPropertyFunction\nexport type XYZNonNegativeNumberValuesPropertyFunction = XYZValuesPropertyFunction<\n\tXYZNonNegativeNumberValuesProperty,\n\tnumber\n>\n\nexport type SinglePropertyFunction = (value: number, time: number) => number | false\n", "import {attribute, element, noSignal} from '@lume/element'\nimport {XYZNumberValues} from '../xyz-values/XYZNumberValues.js'\nimport {Sizeable, type XYZNumberValuesProperty, type XYZNumberValuesPropertyFunction} from './Sizeable.js'\n\nimport type {SizeableAttributes} from './Sizeable.js'\n\nexport type TransformableAttributes =\n\t| SizeableAttributes\n\t| 'position'\n\t| 'rotation'\n\t| 'scale'\n\t| 'origin'\n\t| 'alignPoint'\n\t| 'mountPoint'\n\nconst position = new WeakMap()\nconst rotation = new WeakMap()\nconst scale = new WeakMap()\nconst origin = new WeakMap()\nconst alignPoint = new WeakMap()\nconst mountPoint = new WeakMap()\n\n/**\n * @class Transformable - A class containing transform-related features for all\n * `Element3D` and `Scene` elements: rotation, position, scale, mount-point,\n * align-point, and origin. Note that Transforms have no effect on Scene\n * elements, but Scenes still use the features from Sizeable (the base class of\n * Transformable) for sizing.\n *\n * The properties of `Transformable` all follow a common usage pattern,\n * described in the [`Common Attributes`](../../guide/common-attributes) doc.\n *\n * @extends Sizeable\n */\nexport\n@element\nclass Transformable extends Sizeable {\n\t// TODO readem's JSDoc parser can not handle the following type if it is\n\t// split onto multiple lines.\n\n\t/**\n\t * @property {string | [x?: number, y?: number, z?: number] | {x?: number, y?: number, z?: number} | XYZNumberValues | null} position -\n\t *\n\t * *attribute*\n\t *\n\t * Default: new [XYZNumberValues](../xyz-values/XYZNumberValues)(0, 0, 0)\n\t *\n\t * Set the position of the object in 3D space, relative to its\n\t * parent, by specifying X, Y, and Z coordinates.\n\t */\n\t// TODO evalute being able to set reactive arrays or objects and\n\t// re-rendering based on updates to those arrays.\n\t@attribute\n\t@noSignal\n\tset position(newValue: XYZNumberValuesProperty | XYZNumberValuesPropertyFunction) {\n\t\tif (!position.has(this)) position.set(this, new XYZNumberValues(0, 0, 0))\n\t\tthis._setPropertyXYZ('position', position.get(this)!, newValue)\n\t}\n\tget position(): XYZNumberValues {\n\t\tif (!position.has(this)) position.set(this, new XYZNumberValues(0, 0, 0))\n\t\treturn position.get(this)!\n\t}\n\n\t/**\n\t * @property {string | [x?: number, y?: number, z?: number] | {x?: number, y?: number, z?: number} | XYZNumberValues | null} rotation -\n\t *\n\t * *attribute*\n\t *\n\t * Default: new [XYZNumberValues](../xyz-values/XYZNumberValues)(0, 0, 0)\n\t *\n\t * Set the orientation of the object in 3D space, relative to its\n\t * parent, by specifying rotation in degrees around the X, Y, and Z axes.\n\t * Rotation direction is left-handed, meaning that if you point your thumb\n\t * along the positive direction of an axis, your other four fingers wrap\n\t * around that axis in the direction of positive rotation. A value of `[0,\n\t * 30, 0]` will rotate the object 30 degrees around the Y axis. The rotation\n\t * order is X, Y, Z, meaning that an X rotation rotates the object's Y and Z\n\t * axes, and a Y rotation rotates the object's Z axis.\n\t */\n\t@attribute\n\t@noSignal\n\tset rotation(newValue: XYZNumberValuesProperty | XYZNumberValuesPropertyFunction) {\n\t\tif (!rotation.has(this)) rotation.set(this, new XYZNumberValues(0, 0, 0))\n\t\tthis._setPropertyXYZ('rotation', rotation.get(this)!, newValue)\n\t}\n\tget rotation(): XYZNumberValues {\n\t\tif (!rotation.has(this)) rotation.set(this, new XYZNumberValues(0, 0, 0))\n\t\treturn rotation.get(this)!\n\t}\n\n\t/**\n\t * @property {string | [x?: number, y?: number, z?: number] | {x?: number, y?: number, z?: number} | XYZNumberValues | null} scale -\n\t *\n\t * *attribute*\n\t *\n\t * Default: new [XYZNumberValues](../xyz-values/XYZNumberValues)(1, 1, 1)\n\t *\n\t * Set the scale of the object in 3D space, relative to its parent,\n\t * by specifying scale along the X, Y, and Z axes.\n\t */\n\t@attribute\n\t@noSignal\n\tset scale(newValue: XYZNumberValuesProperty | XYZNumberValuesPropertyFunction) {\n\t\tif (!scale.has(this)) scale.set(this, new XYZNumberValues(1, 1, 1))\n\t\tthis._setPropertyXYZ('scale', scale.get(this)!, newValue)\n\t}\n\tget scale(): XYZNumberValues {\n\t\tif (!scale.has(this)) scale.set(this, new XYZNumberValues(1, 1, 1))\n\t\treturn scale.get(this)!\n\t}\n\n\t/**\n\t * @property {string | [x?: number, y?: number, z?: number] | {x?: number, y?: number, z?: number} | XYZNumberValues | null} origin -\n\t *\n\t * *attribute*\n\t *\n\t * Default: new [XYZNumberValues](../xyz-values/XYZNumberValues)(0.5, 0.5, 0.5)\n\t *\n\t * Set the rotational origin of the object in 3D space, relative to\n\t * itself, by specifying origin along the X, Y, and Z axes.\n\t *\n\t * The origin is the point within the object's [`size`](./Sizeable#size)\n\t * space about which it rotates when a [`rotation`](#rotation) is specified.\n\t * No matter what rotation the object has, this point does not move.\n\t *\n\t * The value for each axis is a portion of the object's size on the same\n\t * axis. For example, a value of `0 0 0` places the origin at top/left/rear\n\t * corner of the object's size space, a value of `0.5 0.5 0.5` places the\n\t * origin in the center of the object's size space, and a value of `1 1 1`\n\t * places the origin at the bottom/right/front of the object's size space.\n\t *\n\t * This example shows different values of origin. The pink dots are placed\n\t * at each origin point on each cube. All cubes are initially oriented the\n\t * same, but as you move the sliders, each cube rotates around their\n\t * specific origin.\n\t *\n\t * \n\t */\n\t@attribute\n\t@noSignal\n\tset origin(newValue: XYZNumberValuesProperty | XYZNumberValuesPropertyFunction) {\n\t\tif (!origin.has(this)) origin.set(this, new XYZNumberValues(0.5, 0.5, 0.5))\n\t\tthis._setPropertyXYZ('origin', origin.get(this)!, newValue)\n\t}\n\tget origin(): XYZNumberValues {\n\t\tif (!origin.has(this)) origin.set(this, new XYZNumberValues(0.5, 0.5, 0.5))\n\t\treturn origin.get(this)!\n\t}\n\n\t/**\n\t * @property {string | [x?: number, y?: number, z?: number] | {x?: number, y?: number, z?: number} | XYZNumberValues | null} alignPoint -\n\t *\n\t * *attribute*\n\t *\n\t * Default: new [XYZNumberValues](../xyz-values/XYZNumberValues)(0, 0, 0)\n\t *\n\t * Set the align point of the object in 3D space, relative to its\n\t * parent, by specifying values along the X, Y, and Z axes.\n\t *\n\t * The align point is the point within the object's parent's\n\t * [`size`](./Sizeable#size) space at which the object's position is 0,0,0.\n\t *\n\t * The value for each axis is a portion of the object's parent size on the\n\t * same axis. For example, a value of `0 0 0` places the align point at\n\t * top/left/rear corner of the object's parent's size space, a value of `0.5\n\t * 0.5 0.5` places the align point in the center of the parent's size space,\n\t * and a value of `1 1 1` places the origin at the bottom/right/front of the\n\t * parent's size space.\n\t */\n\t@attribute\n\t@noSignal\n\tset alignPoint(newValue: XYZNumberValuesProperty | XYZNumberValuesPropertyFunction) {\n\t\tif (!alignPoint.has(this)) alignPoint.set(this, new XYZNumberValues(0, 0, 0))\n\t\tthis._setPropertyXYZ('alignPoint', alignPoint.get(this)!, newValue)\n\t}\n\tget alignPoint(): XYZNumberValues {\n\t\tif (!alignPoint.has(this)) alignPoint.set(this, new XYZNumberValues(0, 0, 0))\n\t\treturn alignPoint.get(this)!\n\t}\n\n\t/**\n\t * @property {string | [x?: number, y?: number, z?: number] | {x?: number, y?: number, z?: number} | XYZNumberValues | null} mountPoint -\n\t *\n\t * *attribute*\n\t *\n\t * Default: new [XYZNumberValues](../xyz-values/XYZNumberValues)(0, 0, 0)\n\t *\n\t * Set the mount point of the object in 3D space, relative to itself,\n\t * by specifying values along the X, Y, and Z axes.\n\t *\n\t * The mount point is the point within the object's\n\t * [`size`](./Sizeable#size) space that is placed at the location specified\n\t * by [`position`](#position).\n\t *\n\t * The value for each axis is a portion of the object's size on the\n\t * same axis. For example, a value of `0 0 0` places the align point at\n\t * top/left/rear corner of the object's size space, a value of `0.5\n\t * 0.5 0.5` places the align point in the center of the object's size space,\n\t * and a value of `1 1 1` places the origin at the bottom/right/front of the\n\t * object's size space.\n\t */\n\t@attribute\n\t@noSignal\n\tset mountPoint(newValue: XYZNumberValuesProperty | XYZNumberValuesPropertyFunction) {\n\t\tif (!mountPoint.has(this)) mountPoint.set(this, new XYZNumberValues(0, 0, 0))\n\t\tthis._setPropertyXYZ('mountPoint', mountPoint.get(this)!, newValue)\n\t}\n\tget mountPoint(): XYZNumberValues {\n\t\tif (!mountPoint.has(this)) mountPoint.set(this, new XYZNumberValues(0, 0, 0))\n\t\treturn mountPoint.get(this)!\n\t}\n}\n", "import type {SharedAPI} from './SharedAPI'\n\n/**\n * @private\n */\nexport class ElementOperations {\n\t#element: SharedAPI\n\n\tconstructor(element: SharedAPI) {\n\t\tthis.#element = element\n\t}\n\n\t#shouldRender = false\n\n\tapplyProperties() {\n\t\tif (!this.#shouldRender) return\n\n\t\tthis.#applyOpacity()\n\t\tthis.#applySize()\n\t}\n\n\tset shouldRender(shouldRender: boolean) {\n\t\tthis.#shouldRender = shouldRender\n\n\t\t// TODO replace this with Motor.once() (might cause a circular dependency)\n\t\trequestAnimationFrame(() => {\n\t\t\tthis.#applyStyle('display', shouldRender ? 'block' : 'none')\n\t\t})\n\t}\n\tget shouldRender(): boolean {\n\t\treturn this.#shouldRender\n\t}\n\n\t#applySize() {\n\t\tconst {x, y} = this.#element.calculatedSize\n\n\t\tthis.#applyStyle('width', `${x}px`)\n\t\tthis.#applyStyle('height', `${y}px`)\n\n\t\t// NOTE: we ignore the Z axis on elements, since they are flat.\n\t}\n\n\t#applyOpacity() {\n\t\tthis.#applyStyle('opacity', this.#element.opacity.toString())\n\t}\n\n\t#applyStyle(property: string, value: string) {\n\t\tthis.#element.style.setProperty(property, value)\n\t}\n}\n", "import {Vector3} from 'three/src/math/Vector3.js'\nimport {Object3D} from 'three/src/core/Object3D.js'\n\n// Augment the Object3D class definition with a new pivot property.\n//\n// XXX In order for this augmentation to work, Object3D must be imported from\n// the file it originates from, not from the 'three' index module (i.e. `from\n// 'three/src/core/Object3D'` instead of `from 'three'`). Otherwise we get this\n// bug: https://github.com/microsoft/TypeScript/issues/18877. See also the\n// report on Three.js: https://github.com/mrdoob/three.js/issues/19468.\ndeclare module 'three/src/core/Object3D.js' {\n\tinterface Object3D {\n\t\tpivot: Vector3\n\t}\n}\n\nexport class Object3DWithPivot extends Object3D {\n\toverride type = 'Object3DWithPivot'\n\n\t__pivot?: Vector3\n\n\toverride get pivot(): Vector3 {\n\t\tif (!this.__pivot) this.__pivot = new Vector3()\n\t\treturn this.__pivot\n\t}\n\toverride set pivot(v: Vector3) {\n\t\tthis.__pivot = v\n\t}\n\n\t// This overrides Object3D to have a `.pivot` property of type\n\t// THREE.Vector3 that allows the origin (pivot) of rotation and scale to be\n\t// specified in local coordinate space. For more info:\n\t// https://github.com/mrdoob/three.js/issues/15965\n\toverride updateMatrix() {\n\t\tthis.matrix.compose(this.position, this.quaternion, this.scale)\n\n\t\tconst pivot = this.pivot\n\n\t\tif (pivot.x !== 0 || pivot.y !== 0 || pivot.z !== 0) {\n\t\t\tconst px = pivot.x,\n\t\t\t\tpy = pivot.y,\n\t\t\t\tpz = pivot.z\n\t\t\tconst te = this.matrix.elements\n\n\t\t\tte[12] += px - te[0] * px - te[4] * py - te[8] * pz\n\t\t\tte[13] += py - te[1] * px - te[5] * py - te[9] * pz\n\t\t\tte[14] += pz - te[2] * px - te[6] * py - te[10] * pz\n\t\t}\n\n\t\tthis.matrixWorldNeedsUpdate = true\n\t}\n}\n\n// Override updateMatrix for all Three.js Object3D derivatives.\nObject3D.prototype.updateMatrix = Object3DWithPivot.prototype.updateMatrix\n// Give all Three.js Object3D derivatives the pivot property.\nObject.defineProperty(\n\tObject3D.prototype,\n\t'pivot',\n\tObject.getOwnPropertyDescriptor(Object3DWithPivot.prototype, 'pivot')!,\n)\n", "import { SRGBColorSpace, LinearSRGBColorSpace, DisplayP3ColorSpace, LinearDisplayP3ColorSpace, Rec709Primaries, P3Primaries, SRGBTransfer, LinearTransfer, NoColorSpace, } from '../constants.js';\nimport { Matrix3 } from './Matrix3.js';\n\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */\n\nconst LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(\n\t0.8224621, 0.177538, 0.0,\n\t0.0331941, 0.9668058, 0.0,\n\t0.0170827, 0.0723974, 0.9105199,\n);\n\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(\n\t1.2249401, - 0.2249404, 0.0,\n\t- 0.0420569, 1.0420571, 0.0,\n\t- 0.0196376, - 0.0786361, 1.0982735\n);\n\n/**\n * Defines supported color spaces by transfer function and primaries,\n * and provides conversions to/from the Linear-sRGB reference space.\n */\nconst COLOR_SPACES = {\n\t[ LinearSRGBColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color,\n\t\tfromReference: ( color ) => color,\n\t},\n\t[ SRGBColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear(),\n\t\tfromReference: ( color ) => color.convertLinearToSRGB(),\n\t},\n\t[ LinearDisplayP3ColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),\n\t},\n\t[ DisplayP3ColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),\n\t},\n};\n\nconst SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );\n\nexport const ColorManagement = {\n\n\tenabled: true,\n\n\t_workingColorSpace: LinearSRGBColorSpace,\n\n\tget workingColorSpace() {\n\n\t\treturn this._workingColorSpace;\n\n\t},\n\n\tset workingColorSpace( colorSpace ) {\n\n\t\tif ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {\n\n\t\t\tthrow new Error( `Unsupported working color space, \"${ colorSpace }\".` );\n\n\t\t}\n\n\t\tthis._workingColorSpace = colorSpace;\n\n\t},\n\n\tconvert: function ( color, sourceColorSpace, targetColorSpace ) {\n\n\t\tif ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {\n\n\t\t\treturn color;\n\n\t\t}\n\n\t\tconst sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;\n\t\tconst targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;\n\n\t\treturn targetFromReference( sourceToReference( color ) );\n\n\t},\n\n\tfromWorkingColorSpace: function ( color, targetColorSpace ) {\n\n\t\treturn this.convert( color, this._workingColorSpace, targetColorSpace );\n\n\t},\n\n\ttoWorkingColorSpace: function ( color, sourceColorSpace ) {\n\n\t\treturn this.convert( color, sourceColorSpace, this._workingColorSpace );\n\n\t},\n\n\tgetPrimaries: function ( colorSpace ) {\n\n\t\treturn COLOR_SPACES[ colorSpace ].primaries;\n\n\t},\n\n\tgetTransfer: function ( colorSpace ) {\n\n\t\tif ( colorSpace === NoColorSpace ) return LinearTransfer;\n\n\t\treturn COLOR_SPACES[ colorSpace ].transfer;\n\n\t},\n\n};\n\n\nexport function SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nexport function LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n", "import { clamp, euclideanModulo, lerp } from './MathUtils.js';\nimport { ColorManagement, SRGBToLinear, LinearToSRGB } from './ColorManagement.js';\nimport { SRGBColorSpace } from '../constants.js';\n\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nconst _hslA = { h: 0, s: 0, l: 0 };\nconst _hslB = { h: 0, s: 0, l: 0 };\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\nclass Color {\n\n\tconstructor( r, g, b ) {\n\n\t\tthis.isColor = true;\n\n\t\tthis.r = 1;\n\t\tthis.g = 1;\n\t\tthis.b = 1;\n\n\t\treturn this.set( r, g, b );\n\n\t}\n\n\tset( r, g, b ) {\n\n\t\tif ( g === undefined && b === undefined ) {\n\n\t\t\t// r is THREE.Color, hex or string\n\n\t\t\tconst value = r;\n\n\t\t\tif ( value && value.isColor ) {\n\n\t\t\t\tthis.copy( value );\n\n\t\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\t\tthis.setHex( value );\n\n\t\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\t\tthis.setStyle( value );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.setRGB( r, g, b );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetHex( hex, colorSpace = SRGBColorSpace ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = euclideanModulo( h, 1 );\n\t\ts = clamp( s, 0, 1 );\n\t\tl = clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tconst q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetStyle( style, colorSpace = SRGBColorSpace ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tlet m;\n\n\t\tif ( m = /^(\\w+)\\(([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tlet color;\n\t\t\tconst name = m[ 1 ];\n\t\t\tconst components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setHSL(\n\t\t\t\t\t\t\tparseFloat( color[ 1 ] ) / 360,\n\t\t\t\t\t\t\tparseFloat( color[ 2 ] ) / 100,\n\t\t\t\t\t\t\tparseFloat( color[ 3 ] ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tconsole.warn( 'THREE.Color: Unknown color model ' + style );\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tconst hex = m[ 1 ];\n\t\t\tconst size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\treturn this.setRGB(\n\t\t\t\t\tparseInt( hex.charAt( 0 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 1 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 2 ), 16 ) / 15,\n\t\t\t\t\tcolorSpace\n\t\t\t\t);\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\treturn this.setHex( parseInt( hex, 16 ), colorSpace );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Invalid hex color ' + style );\n\n\t\t\t}\n\n\t\t} else if ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style, colorSpace );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetColorName( style, colorSpace = SRGBColorSpace ) {\n\n\t\t// color keywords\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex, colorSpace );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t}\n\n\tcopy( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t}\n\n\tcopySRGBToLinear( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tcopyLinearToSRGB( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tconvertSRGBToLinear() {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t}\n\n\tconvertLinearToSRGB() {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t}\n\n\tgetHex( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\treturn Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );\n\n\t}\n\n\tgetHexString( colorSpace = SRGBColorSpace ) {\n\n\t\treturn ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );\n\n\t}\n\n\tgetHSL( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tconst max = Math.max( r, g, b );\n\t\tconst min = Math.min( r, g, b );\n\n\t\tlet hue, saturation;\n\t\tconst lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tconst delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t}\n\n\tgetRGB( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\ttarget.r = _color.r;\n\t\ttarget.g = _color.g;\n\t\ttarget.b = _color.b;\n\n\t\treturn target;\n\n\t}\n\n\tgetStyle( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tif ( colorSpace !== SRGBColorSpace ) {\n\n\t\t\t// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n\t\t\treturn `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;\n\n\t\t}\n\n\t\treturn `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;\n\n\t}\n\n\toffsetHSL( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\treturn this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );\n\n\t}\n\n\tadd( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t}\n\n\taddColors( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t}\n\n\tlerp( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpColors( color1, color2, alpha ) {\n\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpHSL( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\tthis.r = v.x;\n\t\tthis.g = v.y;\n\t\tthis.b = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst r = this.r, g = this.g, b = this.b;\n\t\tconst e = m.elements;\n\n\t\tthis.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;\n\t\tthis.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;\n\t\tthis.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.r = attribute.getX( index );\n\t\tthis.g = attribute.getY( index );\n\t\tthis.b = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.getHex();\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.r;\n\t\tyield this.g;\n\t\tyield this.b;\n\n\t}\n\n}\n\nconst _color = /*@__PURE__*/ new Color();\n\nColor.NAMES = _colorKeywords;\n\nexport { Color };\n", "import { Color } from '../math/Color.js';\nimport { EventDispatcher } from '../core/EventDispatcher.js';\nimport { FrontSide, NormalBlending, LessEqualDepth, AddEquation, OneMinusSrcAlphaFactor, SrcAlphaFactor, AlwaysStencilFunc, KeepStencilOp } from '../constants.js';\nimport * as MathUtils from '../math/MathUtils.js';\n\nlet _materialId = 0;\n\nclass Material extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isMaterial = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _materialId ++ } );\n\n\t\tthis.uuid = MathUtils.generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Material';\n\n\t\tthis.blending = NormalBlending;\n\t\tthis.side = FrontSide;\n\t\tthis.vertexColors = false;\n\n\t\tthis.opacity = 1;\n\t\tthis.transparent = false;\n\t\tthis.alphaHash = false;\n\n\t\tthis.blendSrc = SrcAlphaFactor;\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\n\t\tthis.blendEquation = AddEquation;\n\t\tthis.blendSrcAlpha = null;\n\t\tthis.blendDstAlpha = null;\n\t\tthis.blendEquationAlpha = null;\n\t\tthis.blendColor = new Color( 0, 0, 0 );\n\t\tthis.blendAlpha = 0;\n\n\t\tthis.depthFunc = LessEqualDepth;\n\t\tthis.depthTest = true;\n\t\tthis.depthWrite = true;\n\n\t\tthis.stencilWriteMask = 0xff;\n\t\tthis.stencilFunc = AlwaysStencilFunc;\n\t\tthis.stencilRef = 0;\n\t\tthis.stencilFuncMask = 0xff;\n\t\tthis.stencilFail = KeepStencilOp;\n\t\tthis.stencilZFail = KeepStencilOp;\n\t\tthis.stencilZPass = KeepStencilOp;\n\t\tthis.stencilWrite = false;\n\n\t\tthis.clippingPlanes = null;\n\t\tthis.clipIntersection = false;\n\t\tthis.clipShadows = false;\n\n\t\tthis.shadowSide = null;\n\n\t\tthis.colorWrite = true;\n\n\t\tthis.precision = null; // override the renderer's default precision for this material\n\n\t\tthis.polygonOffset = false;\n\t\tthis.polygonOffsetFactor = 0;\n\t\tthis.polygonOffsetUnits = 0;\n\n\t\tthis.dithering = false;\n\n\t\tthis.alphaToCoverage = false;\n\t\tthis.premultipliedAlpha = false;\n\t\tthis.forceSinglePass = false;\n\n\t\tthis.visible = true;\n\n\t\tthis.toneMapped = true;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\n\t\tthis._alphaTest = 0;\n\n\t}\n\n\tget alphaTest() {\n\n\t\treturn this._alphaTest;\n\n\t}\n\n\tset alphaTest( value ) {\n\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._alphaTest = value;\n\n\t}\n\n\tonBuild( /* shaderobject, renderer */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\n\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\n\n\tcustomProgramCacheKey() {\n\n\t\treturn this.onBeforeCompile.toString();\n\n\t}\n\n\tsetValues( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRootObject ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\n\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\n\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.iridescence !== undefined ) data.iridescence = this.iridescence;\n\t\tif ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;\n\t\tif ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n\n\t\tif ( this.iridescenceMap && this.iridescenceMap.isTexture ) {\n\n\t\t\tdata.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {\n\n\t\t\tdata.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;\n\t\tif ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;\n\n\t\tif ( this.anisotropyMap && this.anisotropyMap.isTexture ) {\n\n\t\t\tdata.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\n\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\n\t\t}\n\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\n\t\tif ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors === true ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = true;\n\n\t\tif ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;\n\t\tif ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;\n\t\tif ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;\n\t\tif ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;\n\t\tif ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;\n\t\tif ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;\n\t\tif ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();\n\t\tif ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;\n\n\t\tif ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;\n\t\tif ( this.depthTest === false ) data.depthTest = this.depthTest;\n\t\tif ( this.depthWrite === false ) data.depthWrite = this.depthWrite;\n\t\tif ( this.colorWrite === false ) data.colorWrite = this.colorWrite;\n\n\t\tif ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;\n\t\tif ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;\n\t\tif ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;\n\t\tif ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;\n\t\tif ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;\n\t\tif ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;\n\t\tif ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;\n\t\tif ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.alphaHash === true ) data.alphaHash = true;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = true;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = true;\n\n\t\tif ( this.wireframe === true ) data.wireframe = true;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.flatShading === true ) data.flatShading = true;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( this.fog === false ) data.fog = false;\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\t\tthis.blendColor.copy( source.blendColor );\n\t\tthis.blendAlpha = source.blendAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tconst srcPlanes = source.clippingPlanes;\n\t\tlet dstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tconst n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.alphaHash = source.alphaHash;\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\t\tthis.forceSinglePass = source.forceSinglePass;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\nexport { Material };\n", "import * as MathUtils from './MathUtils.js';\n\nclass Vector2 {\n\n\tconstructor( x = 0, y = 0 ) {\n\n\t\tVector2.prototype.isVector2 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.x;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.x = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.y;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.y = value;\n\n\t}\n\n\tset( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tangle() {\n\n\t\t// computes the angle in radians with respect to the positive x-axis\n\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\n\n\t\treturn angle;\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( MathUtils.clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t}\n\n\trotateAround( center, angle ) {\n\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tconst x = this.x - center.x;\n\t\tconst y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\n\t}\n\n}\n\nexport { Vector2 };\n", "import { MultiplyOperation, TangentSpaceNormalMap } from '../constants.js';\nimport { Material } from './Material.js';\nimport { Vector2 } from '../math/Vector2.js';\nimport { Color } from '../math/Color.js';\n\nclass MeshPhongMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhongMaterial = true;\n\n\t\tthis.type = 'MeshPhongMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.specular = new Color( 0x111111 );\n\t\tthis.shininess = 30;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.specular.copy( source.specular );\n\t\tthis.shininess = source.shininess;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { MeshPhongMaterial };\n", "// TODO move into utils/three/ folder\n\nimport {MeshPhongMaterial} from 'three/src/materials/MeshPhongMaterial.js'\nimport {Color} from 'three/src/math/Color.js'\n\nimport type {Object3D} from 'three/src/core/Object3D.js'\nimport type {Material} from 'three/src/materials/Material.js'\nimport type {RenderItem} from 'three/src/renderers/webgl/WebGLRenderLists.js'\nimport type {Quaternion} from 'three/src/math/Quaternion.js'\nimport type {Camera} from 'three/src/cameras/Camera.js'\nimport type {OrthographicCamera} from 'three/src/cameras/OrthographicCamera.js'\nimport type {PerspectiveCamera} from 'three/src/cameras/PerspectiveCamera.js'\n\nexport type TColor = Color | string | number\n\nexport function isRenderItem(obj: any): obj is RenderItem {\n\treturn 'geometry' in obj && 'material' in obj\n}\n\nexport function disposeMaterial(obj: Object3D) {\n\tif (!isRenderItem(obj)) return\n\n\t// because obj.material can be a material or array of materials\n\tconst materials: Material[] = ([] as Material[]).concat(obj.material)\n\n\tfor (const material of materials) {\n\t\tmaterial.dispose()\n\t}\n}\n\nexport function disposeObject(obj: Object3D, removeFromParent = true, destroyGeometry = true, destroyMaterial = true) {\n\tif (!obj) return\n\n\tif (isRenderItem(obj)) {\n\t\tif (obj.geometry && destroyGeometry) obj.geometry.dispose()\n\t\tif (destroyMaterial) disposeMaterial(obj)\n\t}\n\n\tremoveFromParent &&\n\t\tqueueMicrotask(() => {\n\t\t\t// if we remove children in the same tick then we can't continue traversing,\n\t\t\t// so we defer to the next microtask\n\t\t\tobj.parent && obj.parent.remove(obj)\n\t\t})\n}\n\ntype DisposeOptions = Partial<{\n\tremoveFromParent: boolean\n\tdestroyGeometry: boolean\n\tdestroyMaterial: boolean\n}>\n\nexport function disposeObjectTree(obj: Object3D, disposeOptions: DisposeOptions = {}) {\n\tobj.traverse(node => {\n\t\tdisposeObject(node, disposeOptions.removeFromParent, disposeOptions.destroyGeometry, disposeOptions.destroyMaterial)\n\t})\n}\n\nexport function quaternionApproximateEquals(a: Quaternion, b: Quaternion, epsilon: number) {\n\treturn (\n\t\tMath.abs(a.x - b.x) < epsilon &&\n\t\tMath.abs(a.y - b.y) < epsilon &&\n\t\tMath.abs(a.z - b.z) < epsilon &&\n\t\tMath.abs(a.w - b.w) < epsilon\n\t)\n}\n\nexport function applyMaterial(obj: Object3D, material: Material, dispose = true) {\n\tif (!isRenderItem(obj)) return\n\tif (dispose && obj.material) disposeMaterial(obj)\n\tobj.material = material\n}\n\nexport function setRandomColorPhongMaterial(obj: Object3D, dispose?: boolean, traverse?: boolean) {\n\tconst randomColor = (0xffffff / 3) * Math.random() + 0xffffff / 3\n\tsetColorPhongMaterial(obj, randomColor, dispose, traverse)\n}\n\nexport function setColorPhongMaterial(obj: Object3D, color: TColor, dispose?: boolean, traverse = true) {\n\tconst material = new MeshPhongMaterial()\n\tmaterial.color = new Color(color)\n\n\tif (traverse) obj.traverse(node => applyMaterial(node, material, dispose))\n\telse applyMaterial(obj, material, dispose)\n}\n\nexport function isPerspectiveCamera(camera: Camera): camera is PerspectiveCamera {\n\treturn !!(camera as any).isPerspectiveCamera\n}\n\nexport function isOrthographicCamera(camera: Camera): camera is OrthographicCamera {\n\treturn !!(camera as any).isOrthographicCamera\n}\n\nexport interface Disposable {\n\tdispose: () => void\n}\n\nexport function isDisposable(o: any): o is Disposable {\n\treturn !!(typeof o === 'object' && o && 'dispose' in o)\n}\n", "// based on THREE.CSS3DRenderer from https://github.com/mrdoob/three.js/blob/51ac0084709d4d3795ccb7119ee24e6a808618df/examples/js/renderers/CSS3DRenderer.js\n\nimport {Matrix4} from 'three/src/math/Matrix4.js'\nimport {Object3DWithPivot} from '../core/Object3DWithPivot.js'\nimport {isPerspectiveCamera, isOrthographicCamera} from '../utils/three.js'\n\nimport type {Object3D} from 'three/src/core/Object3D.js'\nimport type {Scene} from 'three/src/scenes/Scene.js'\nimport type {Camera} from 'three/src/cameras/Camera.js'\n\nexport class CSS3DObjectNested extends Object3DWithPivot {\n\toverride type = 'CSS3DObjectNested'\n\n\t#initialFrame = requestAnimationFrame(() => {\n\t\t// delay to the next frame because attributes are not allowed be set\n\t\t// inside Custom Element (i.e. Web Component) constructors, otherwise\n\t\t// this can throw an error if called inside a Custom Element\n\t\t// constructor.\n\n\t\tthis.element.style.position = 'absolute'\n\t})\n\n\tconstructor(public element: HTMLElement) {\n\t\tsuper()\n\t}\n\n\tdispose() {\n\t\tcancelAnimationFrame(this.#initialFrame)\n\t}\n}\n\n// TODO Sprite is still untested in this new nested renderer\nexport class CSS3DNestedSprite extends CSS3DObjectNested {}\n\n//\n\nexport class CSS3DRendererNested {\n\tdomElement: HTMLDivElement\n\t#matrix = new Matrix4()\n\n\t#cache = {\n\t\tcamera: {fov: 0, style: ''},\n\t\tobjects: new WeakMap(),\n\t}\n\n\t#width = 0\n\t#height = 0\n\t#widthHalf = 0\n\t#heightHalf = 0\n\t#cameraElement: HTMLDivElement\n\n\tconstructor() {\n\t\tconst domElement = document.createElement('div')\n\t\tdomElement.classList.add('CSS3DRendererNested')\n\t\tdomElement.style.overflow = 'hidden'\n\n\t\tthis.domElement = domElement\n\n\t\tconst cameraElement = document.createElement('div')\n\t\tcameraElement.classList.add('cameraElement')\n\t\tcameraElement.appendChild(document.createElement('slot'))\n\n\t\tcameraElement.style.transformStyle = 'preserve-3d'\n\n\t\tdomElement.appendChild(cameraElement)\n\n\t\tthis.#cameraElement = cameraElement\n\t}\n\n\tgetSize() {\n\t\treturn {\n\t\t\twidth: this.#width,\n\t\t\theight: this.#height,\n\t\t}\n\t}\n\n\tsetSize(width: number, height: number) {\n\t\tthis.#width = width\n\t\tthis.#height = height\n\t\tthis.#widthHalf = width / 2\n\t\tthis.#heightHalf = height / 2\n\n\t\tthis.domElement.style.width = width + 'px'\n\t\tthis.domElement.style.height = height + 'px'\n\n\t\tthis.#cameraElement.style.width = width + 'px'\n\t\tthis.#cameraElement.style.height = height + 'px'\n\t}\n\n\t#renderObject(object: Object3D, camera: Camera) {\n\t\tif (object instanceof CSS3DObjectNested) {\n\t\t\tlet style: string = ''\n\n\t\t\tif (object instanceof CSS3DNestedSprite) {\n\t\t\t\t// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\n\t\t\t\tthis.#matrix.copy(camera.matrixWorldInverse)\n\t\t\t\tthis.#matrix.transpose()\n\t\t\t\tthis.#matrix.copyPosition(object.matrixWorld)\n\t\t\t\tthis.#matrix.scale(object.scale)\n\n\t\t\t\tthis.#matrix.elements[3] = 0\n\t\t\t\tthis.#matrix.elements[7] = 0\n\t\t\t\tthis.#matrix.elements[11] = 0\n\t\t\t\tthis.#matrix.elements[15] = 1\n\n\t\t\t\tstyle = getObjectCSSMatrix(object, this.#matrix)\n\t\t\t} else {\n\t\t\t\tstyle = getObjectCSSMatrix(object, object.matrix)\n\t\t\t}\n\n\t\t\tconst element = object.element\n\t\t\tconst cachedStyle = this.#cache.objects.get(object)\n\n\t\t\t// if ( cachedStyle === undefined || cachedStyle !== style ) { // BUG, https://github.com/mrdoob/three.js/pull/15470\n\t\t\tif (cachedStyle === undefined || cachedStyle.style !== style) {\n\t\t\t\telement.style.transform = style\n\n\t\t\t\tconst objectData = {style: style}\n\n\t\t\t\tthis.#cache.objects.set(object, objectData)\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0, l = object.children.length; i < l; i++) {\n\t\t\tthis.#renderObject(object.children[i], camera)\n\t\t}\n\t}\n\n\trender(scene: Scene, camera: Camera) {\n\t\tconst fov = camera.projectionMatrix.elements[5] * this.#heightHalf\n\n\t\tif (this.#cache.camera.fov !== fov) {\n\t\t\tif (isPerspectiveCamera(camera)) {\n\t\t\t\tthis.domElement.style.perspective = fov + 'px'\n\t\t\t}\n\n\t\t\tthis.#cache.camera.fov = fov\n\t\t}\n\n\t\tscene.updateMatrixWorld()\n\n\t\tif (camera.parent === null) camera.updateMatrixWorld((void 0)!)\n\n\t\tlet tx = 0\n\t\tlet ty = 0\n\t\tif (isOrthographicCamera(camera)) {\n\t\t\ttx = -(camera.right + camera.left) / 2\n\t\t\tty = (camera.top + camera.bottom) / 2\n\t\t}\n\n\t\t// prettier-ignore\n\t\tconst cameraCSSMatrix = isOrthographicCamera(camera)\n ? 'scale(' + fov + ')' + 'translate(' + epsilon(tx) + 'px,' + epsilon(ty) + 'px)' + getCameraCSSMatrix(camera.matrixWorldInverse)\n : 'translateZ(' + fov + 'px)' + getCameraCSSMatrix(camera.matrixWorldInverse)\n\n\t\tconst style = cameraCSSMatrix + 'translate(' + this.#widthHalf + 'px,' + this.#heightHalf + 'px)'\n\n\t\tif (this.#cache.camera.style !== style) {\n\t\t\tthis.#cameraElement.style.transform = style\n\n\t\t\tthis.#cache.camera.style = style\n\t\t}\n\n\t\tthis.#renderObject(scene, camera)\n\t}\n}\n\nfunction getCameraCSSMatrix(matrix: Matrix4) {\n\tconst elements = matrix.elements\n\n\treturn (\n\t\t'matrix3d(' +\n\t\tepsilon(elements[0]) +\n\t\t',' +\n\t\tepsilon(-elements[1]) +\n\t\t',' +\n\t\tepsilon(elements[2]) +\n\t\t',' +\n\t\tepsilon(elements[3]) +\n\t\t',' +\n\t\tepsilon(elements[4]) +\n\t\t',' +\n\t\tepsilon(-elements[5]) +\n\t\t',' +\n\t\tepsilon(elements[6]) +\n\t\t',' +\n\t\tepsilon(elements[7]) +\n\t\t',' +\n\t\tepsilon(elements[8]) +\n\t\t',' +\n\t\tepsilon(-elements[9]) +\n\t\t',' +\n\t\tepsilon(elements[10]) +\n\t\t',' +\n\t\tepsilon(elements[11]) +\n\t\t',' +\n\t\tepsilon(elements[12]) +\n\t\t',' +\n\t\tepsilon(-elements[13]) +\n\t\t',' +\n\t\tepsilon(elements[14]) +\n\t\t',' +\n\t\tepsilon(elements[15]) +\n\t\t')'\n\t)\n}\n\nfunction getObjectCSSMatrix(object: Object3D, matrix: Matrix4) {\n\tconst parent = object.parent\n\tconst childOfScene = parent && parent.type === 'Scene'\n\n\t// TODO I don't remember why we negate values based on childOfScene below.\n\t// It's been a while and I forgot. This should be documented.\n\n\tconst elements = matrix.elements\n\tconst matrix3d =\n\t\t'matrix3d(' +\n\t\tepsilon(elements[0]) +\n\t\t',' +\n\t\tepsilon(elements[1]) +\n\t\t',' +\n\t\tepsilon(elements[2]) +\n\t\t',' +\n\t\tepsilon(elements[3]) +\n\t\t',' +\n\t\tepsilon((childOfScene ? -1 : 1) * elements[4]) +\n\t\t',' +\n\t\tepsilon((childOfScene ? -1 : 1) * elements[5]) +\n\t\t',' +\n\t\tepsilon((childOfScene ? -1 : 1) * elements[6]) +\n\t\t',' +\n\t\tepsilon((childOfScene ? -1 : 1) * elements[7]) +\n\t\t',' +\n\t\tepsilon(elements[8]) +\n\t\t',' +\n\t\tepsilon(elements[9]) +\n\t\t',' +\n\t\tepsilon(elements[10]) +\n\t\t',' +\n\t\tepsilon(elements[11]) +\n\t\t',' +\n\t\tepsilon(elements[12]) +\n\t\t',' /* X position */ +\n\t\tepsilon((childOfScene ? 1 : -1) * elements[13]) +\n\t\t',' /* Y position */ +\n\t\tepsilon(elements[14]) +\n\t\t',' /* Z position */ +\n\t\tepsilon(elements[15]) +\n\t\t')'\n\n\t// similar to mountPoint\n\treturn `${childOfScene ? 'translate(-50%, -50%)' : ''} ${matrix3d}`\n}\n\nfunction epsilon(value: number) {\n\treturn Math.abs(value) < 1e-10 ? 0 : value\n}\n", "import type {Constructor} from 'lowclass'\n\nconst isInstance = Symbol()\n\n/**\n * @mixin - TODO make this @mixin tag do something in the docs.\n * @class Settable - This class provides a simple `set()` method that can be used\n * to set multiple properties of an instance at once. See `set()` method\n * description.\n *\n * This class is a mixin. Use it like so:\n *\n * ```js\n * class MyClass extends Settable() {\n * // ...\n * }\n * ```\n *\n * or\n *\n * ```js\n * class MyClass extends Settable(SomeBaseClass) {\n * // ...\n * }\n * ```\n */\nexport function Settable(Base: T = Object as any) {\n\tclass Settable extends Base {\n\t\t// @ts-ignore, prevent downstream \"has or is using private name\" errors.\n\t\t[isInstance as any] = true\n\n\t\t/**\n\t\t * @method set - Convenience method for setting all (or some)\n\t\t * properties of a Settable at once. For example:\n\t\t *\n\t\t * ```js\n\t\t * class Foo extends Settable {\n\t\t * a = 1\n\t\t * b = 2\n\t\t * }\n\t\t *\n\t\t * const obj = new Foo().set({\n\t\t * a: 3,\n\t\t * b: 4\n\t\t * })\n\t\t * ```\n\t\t *\n\t\t * @param {this} props - An object containing all properties to set. For example:\n\t\t */\n\t\t// prettier-ignore\n\t\t// set(props: Partial) { // This doesn't work\n\t\tset(props: Partial>) { // but this does?\n\t\t\tObject.assign(this, props)\n\t\t\treturn this\n\t\t}\n\t}\n\n\tSettable.prototype[isInstance] = true\n\n\treturn Settable\n}\n\nObject.defineProperty(Settable, Symbol.hasInstance, {\n\tvalue(obj: any): boolean {\n\t\tif (!obj) return false\n\t\tif (obj[isInstance]) return true\n\t\treturn false\n\t},\n})\n\nexport type SettableInstance = InstanceType>\n", "export * from './observeChildren.js'\n\nexport function epsilon(value: any) {\n\treturn Math.abs(value) < 0.000001 ? 0 : value\n}\n\nexport function toRadians(degrees: number): number {\n\treturn (degrees / 180) * Math.PI\n}\n\nexport function toDegrees(radians: number): number {\n\treturn (radians / Math.PI) * 180\n}\n", "import {Constructor} from 'lowclass'\nimport {observeChildren} from './utils/observeChildren.js'\nimport type {PossibleCustomElement, PossibleCustomElementConstructor} from './PossibleCustomElement.js'\n\n// TODO add childAttributeChangedCallback, similar to attributeChangedCallback?\n\n/**\n * @class ChildTracker - A mixin for use with custom elements, for tracking\n * children of a custom element. In a similar pattern as with custom element\n * `connectedCallback` and `disconnectedCallback`, when a child is connected\n * `childConnectedCallback(child)` will be called and when a child is\n * disconnected `childDisconnectedCallback(child)` will be called.\n */\nexport function ChildTracker>(Base: T) {\n\treturn class ChildTracker extends Constructor(Base) {\n\t\t/**\n\t\t * @property {boolean} awaitChildrenDefined When `true`,\n\t\t * `childConnectedCallback`s will not fire until those children are\n\t\t * upgraded (if they are possibly custom elements, having a hyphen in\n\t\t * their name). If a child is disconnected before it has been upgraded,\n\t\t * then `childDisconnectedCallback` will not be called and any pending\n\t\t * `childConnectedCallback` will be canceled.\n\t\t */\n\t\tawaitChildrenDefined = true\n\n\t\t/**\n\t\t * @property {boolean} syncChildCallbacks When `true`,\n\t\t * `childConnectedCallback`s will be fired for existing children when\n\t\t * this element is connected into the DOM, and\n\t\t * `childDisconnectedCallback`s will be fired when `this` is\n\t\t * disconnected from the DOM.\n\t\t *\n\t\t * This can be useful for instantiation and cleanup logic that depends\n\t\t * on children, not just when children are (dis)connected, but any time\n\t\t * this element is (dis)connected. Sometimes children are not custom\n\t\t * elements, and don't have their own (dis)connectedCallbacks, hence the\n\t\t * need in such cases for a parent to manage setup/cleanup logic based on\n\t\t * the connection of non-custom elements.\n\t\t */\n\t\tsyncChildCallbacks = true\n\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\t\t\tthis.#createObserver()\n\t\t}\n\n\t\toverride connectedCallback() {\n\t\t\tsuper.connectedCallback?.()\n\t\t\tif (this.syncChildCallbacks) this.#runChildConnectedCallbacks()\n\t\t\tthis.#createObserver()\n\t\t}\n\n\t\toverride disconnectedCallback() {\n\t\t\tsuper.disconnectedCallback?.()\n\t\t\tif (this.syncChildCallbacks) this.#runChildDisconnectedCallbacks()\n\t\t\tthis.#destroyObserver()\n\t\t}\n\n\t\t/**\n\t\t * @method childConnectedCallback If defined, this is called any time a child is\n\t\t * connected, with the connected child passed as an argument.\n\t\t */\n\t\tchildConnectedCallback?(_child: Element): void\n\n\t\t/**\n\t\t * @method childDisconnectedCallback If defined, this is called any time a child\n\t\t * is disconnected, with the disconnected child passed as an argument.\n\t\t */\n\t\tchildDisconnectedCallback?(_child: Element): void\n\n\t\t#awaitedChildren = new Set()\n\n\t\t#runChildConnectedCallbacks() {\n\t\t\tfor (let el = this.firstElementChild; el; el = el.nextElementSibling) this.#runChildConnect(el)\n\t\t}\n\n\t\t#runChildConnect(child: Element) {\n\t\t\tconst elementIsUpgraded = child.matches(':defined')\n\n\t\t\tif (elementIsUpgraded || !this.awaitChildrenDefined) {\n\t\t\t\tthis.childConnectedCallback?.(child)\n\t\t\t} else {\n\t\t\t\tif (!this.#awaitedChildren.has(child)) {\n\t\t\t\t\tthis.#awaitedChildren.add(child)\n\n\t\t\t\t\tcustomElements.whenDefined(child.tagName.toLowerCase()).then(() => {\n\t\t\t\t\t\tthis.#awaitedChildren.delete(child)\n\t\t\t\t\t\tif (!this.isConnected) return\n\t\t\t\t\t\tthis.childConnectedCallback?.(child)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t#runChildDisconnectedCallbacks() {\n\t\t\tfor (let el = this.firstElementChild; el; el = el.nextElementSibling) this.#runChildDisconnect(el)\n\t\t}\n\n\t\t#runChildDisconnect(child: Element) {\n\t\t\tif (this.#awaitedChildren.has(child)) return\n\n\t\t\tthis.childDisconnectedCallback?.(child)\n\t\t}\n\n\t\t#unobserveChildren: (() => void) | null = null\n\n\t\t#createObserver() {\n\t\t\tif (this.#unobserveChildren) return\n\n\t\t\t// observeChildren returns a MutationObserver observing childList\n\t\t\tthis.#unobserveChildren = observeChildren({\n\t\t\t\ttarget: this,\n\t\t\t\tonConnect: (child: Element) => {\n\t\t\t\t\tif (!this.isConnected) return\n\t\t\t\t\tthis.childConnectedCallback && this.childConnectedCallback(child)\n\t\t\t\t},\n\t\t\t\tonDisconnect: (child: Element) => {\n\t\t\t\t\tif (!this.isConnected) return\n\t\t\t\t\tthis.childDisconnectedCallback && this.childDisconnectedCallback(child)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\t#destroyObserver() {\n\t\t\tif (!this.#unobserveChildren) return\n\t\t\tthis.#unobserveChildren()\n\t\t\tthis.#unobserveChildren = null\n\t\t}\n\t}\n}\n", "import {Constructor} from 'lowclass'\nimport type {PossibleCustomElement, PossibleCustomElementConstructor} from '../core/PossibleCustomElement.js'\nimport {r} from 'regexr'\n\n// TODO Move this to element-behaviors package?\nexport function InitialBehaviors>(Base: T) {\n\treturn class InitialBehaviors extends Constructor(Base) {\n\t\tinitialBehaviors?: Record\n\n\t\tconstructor(...args: any[]) {\n\t\t\tsuper(...args)\n\t\t\tqueueMicrotask(() => this.#setBehaviors())\n\t\t}\n\n\t\t#setBehaviors() {\n\t\t\tif (!this.initialBehaviors) return\n\t\t\tsetBehaviors(this, this.initialBehaviors, false) // false -> don't replace if it already exists (the user set it)\n\t\t}\n\t}\n}\n\nfunction _setBehaviors(el: Element, behaviors: Record, replace: boolean) {\n\tlet has = el.getAttribute('has') ?? ''\n\tconst parts = has.split(' ')\n\n\tfor (const [category, type] of Object.entries(behaviors)) {\n\t\tif (replace) el.setAttribute('has', (has = has.replace(r`/[a-z-]*-${category}/`, '') + ` ${type}-${category}`))\n\t\telse if (!parts.some(b => b.endsWith('-' + category))) el.setAttribute('has', (has = has + ` ${type}-${category}`))\n\t}\n}\n\nexport function setBehaviors(el: Element, behaviors: Record, replace = true) {\n\t_setBehaviors(el, behaviors, replace)\n}\n", "import {untrack} from 'solid-js'\nimport {signal} from 'classy-solid'\nimport {Object3D} from 'three/src/core/Object3D.js'\nimport {element, attribute, booleanAttribute} from '@lume/element'\nimport {Transformable} from './Transformable.js'\nimport {ElementOperations} from './ElementOperations.js'\nimport {Motor} from './Motor.js'\nimport {CSS3DObjectNested} from '../renderers/CSS3DRendererNested.js'\nimport {disposeObject} from '../utils/three.js'\nimport {Settable} from '../utils/Settable.js'\nimport {toRadians} from './utils/index.js'\nimport {ChildTracker} from './ChildTracker.js'\nimport {InitialBehaviors} from '../behaviors/InitialBehaviors.js'\nimport {isDomEnvironment, isElement3D} from './utils/isThisOrThat.js'\n\nimport type {Element3D} from './Element3D.js'\nimport type {Scene} from './Scene.js'\nimport type {CompositionType} from './CompositionTracker'\nimport type {TransformableAttributes} from './Transformable.js'\nimport type {SinglePropertyFunction} from './Sizeable.js'\n\n// Exposes the `has=\"\"` attribute type definition for all elements in TypeScript JSX templates.\nimport type {} from 'element-behaviors/src/attribute-types'\n\nconst threeJsPostAdjustment = [0, 0, 0]\nconst alignAdjustment = [0, 0, 0]\nconst mountPointAdjustment = [0, 0, 0]\nconst appliedPosition = [0, 0, 0]\n\nconst elOps = new WeakMap()\n\nconst ourThreeObjects = new WeakSet()\nconst isManagedByUs = (obj: Object3D) => ourThreeObjects.has(obj)\n\nconst opacity = new WeakMap()\n\nexport type BaseAttributes = TransformableAttributes | 'opacity'\n\n// TODO @abstract jsdoc tag\n/**\n * @abstract\n * @class SharedAPI - This is an abstract base class that provides common\n * properties and methods for the non-abstract [`Element3D`](./Element3D) and\n * [`Scene`](./Scene) custom element classes.\n *\n * This class is not intended for extension by end users. You'll want to extend\n * from [`Scene`](./Scene) or [`Element3D`](./Element3D) (or their\n * subclasses) instead of this class.\n *\n * For purposes of documentation it is still useful to know what properties and\n * methods subclasses inherit from here.\n *\n * @extends Settable\n * @extends Transformable\n */\nexport\n@element\nclass SharedAPI extends InitialBehaviors(ChildTracker(Settable(Transformable))) {\n\t/** @deprecated use `.defineElement()` instead */\n\tstatic define(name?: string) {\n\t\tthis.defineElement(name)\n\t}\n\n\t// TODO re-organize variables like isScene and isElement3D, so they come from a\n\t// proper place. f.e. they are currently also used in CompositionTracker\n\t// where they don't belong (see TODO there).\n\n\t/** @property {boolean} isScene - True if a subclass of this class is a Scene. */\n\toverride isScene = false\n\n\t/**\n\t * @property {boolean} isElement3D - True if a subclass of this class is an `Element3D`.\n\t */\n\toverride isElement3D = false\n\n\t/**\n\t * @property {string | number | null} opacity -\n\t *\n\t * *attribute*\n\t *\n\t * Default: `1`\n\t *\n\t * Set the object's opacity.\n\t *\n\t * The value should be a number from `0` to `1`. `0` is fully transparent, and `1` is fully opaque.\n\t */\n\t// TODO convert opacity to multiplicative down the tree for gl materials.\n\t@attribute\n\tset opacity(newValue: number | SinglePropertyFunction) {\n\t\tif (!opacity.has(this)) opacity.set(this, 1)\n\t\tthis._setPropertySingle('opacity', v => opacity.set(this, v), newValue)\n\t}\n\tget opacity(): number {\n\t\tif (!opacity.has(this)) opacity.set(this, 1)\n\t\treturn opacity.get(this)!\n\t}\n\n\t/**\n\t * @property {boolean} debug -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `false`\n\t *\n\t * When `true`, show debug visuals for the object. Not all objects implement\n\t * debug visuals yet.\n\t */\n\t@booleanAttribute debug = false\n\n\t/**\n\t * @deprecated\n\t * @property {boolean} glLoaded\n\t *\n\t * DEPRECATED Now always true. For logic depending on this in an effect (f.e. returning early when false), instead init things when an element is connected, and uninit when an element is disconnected.\n\t *\n\t * *readonly*\n\t */\n\tget glLoaded() {\n\t\treturn true\n\t}\n\n\t/**\n\t * @deprecated\n\t * @property {boolean} cssLoaded\n\t *\n\t * DEPRECATED Now always true. For logic depending on this in an effect (f.e. returning early when false), instead init things when an element is connected, and uninit when an element is disconnected.\n\t *\n\t * *readonly*\n\t */\n\tget cssLoaded() {\n\t\treturn true\n\t}\n\n\t// stores a ref to this element's root Scene when/if this element is\n\t// in a scene.\n\t@signal _scene: Scene | null = null\n\n\t/**\n\t * @property {THREE.Scene} scene -\n\t *\n\t * *signal*, *readonly*\n\t *\n\t * The `` that the element is a child or grandchild of, `null`\n\t * if the element is not a descendant of a Scene, `null` if the child is a\n\t * descendant of a Scene that is not connected into the DOM, or `null` if\n\t * the element is a descendant of a connected Scene but the element is not\n\t * participating in the composed tree (i.e. the element is not distributed\n\t * to a `` element of a ShadowRoot of the element's parent).\n\t */\n\tget scene(): Scene | null {\n\t\treturn this._scene\n\t}\n\n\t// We use F-Bounded Polymorphism in the following `three` and `threeCSS`\n\t// properties by referring to `this` in their type definitions to make\n\t// it possible for subclasses to define the types of the three and\n\t// threeCSS properties based on the return type of their\n\t// `makeThreeObject3d` and `makeThreeCSSObject` methods. A simple\n\t// example of the pattern is demonstrated here:\n\t// https://www.typescriptlang.org/play?#code/MYGwhgzhAECCB2BLAtmE0DeAoa0BmA9gdALzQCMATAMxYC+WWokMAwmAC7QCmAHh93gATGAhRpMOaACMwAJ1LQOcgK7d6jZlGgAFcPC7ZcsgF6KqtBk3DaAKnO7ce-QSN37DUkAQfJzNDSwwaQhlMGAuLRhbAAtEeABzABkCADduBSNoYNC5cK5UAGtuWPiEgAoASgAuaBV4QvgCAHd4RlwABzlEVM4nAH1+jjjEgH5agCVuDhU5eFsATw7uAB5hxAgAbQByIpKRhO2AXQA+dugAegvoACFIJyjoLrTEIW4YMGhwEwXoBzAhAR4CBfglpgI5AAaaAQFTSKLvGExAgqEBCaBNLjwRzojjEBwAWjeeHiTnWEAAdFIrtBSjANtB4gJhNx0YQFK46hAMjByssCB0QE5MdAimUYXCERBoSBEMVoAAJWwAWSSFwAIgB5ZWisBIDqozg+CCVKm4MFcdaJKqTaazeZLVbknZ7UqJY4nSS4XCIPDQcoAQnJFMGVoSlSUcUpoYOimDroOVWyMCmMzmi2WayjLrAxTdh1O51wNIppeggJhBGQTi6PT6MJmeD9zUQw0jGxD-T14nQMQyTlLVKkuAcafg7ejQwOUgYVhyYQi0EeYlQIBS6Q5LmE0QO64yXsu1zpjPpBlcrPwPgl8JsHxUw2NSmIaQy3TeZt1ecTNTgSFXB5HO05gxbhml-HsZ0CR52A4PdN2ZNwVzQOCDxpWEbxYJc9WgF85DfJw9iQ9A8SeOQXjebJrw4R0cL9IiPwTMokyyQCxxAsCYMgucQgXSJb3cPVYNw5wEJ3MoUKyGljwZJlzzZK90MeMB72ROQYBI3D8IY3N9iYn89EEgC-iA8dsTAgyDC4xhrEw9UCGSYS+FE8DVwk6lrgAUQmCZNQmf0EiIIRoWkbhgGU7lP24IjRRUUJjLY7Douo5ZKikRjrQjFj4vtdjaQcdRcFnTR+PsRwUKc1wYAsoSN1Q64ADliFfK9ygCgggpkULwoInTotHe0PiomiCD9arUtwdKKky4dsuAsy8scKymCBOLgEUeaYLg5b4DirgyHm0ruC2rAOApMNDwW9RgDO2MaRgoA\n\t// A limitation is that we can not make the `makeThreeObject3d` or\n\t// `makeThreeCSSObject` methods protected, because TypeScript does not allow\n\t// that with F-Bounded Types. To achieve pseudo-protectedness, we\n\t// could use Symbol for that as in this example:\n\t// https://www.typescriptlang.org/play?#code/MYGwhgzhAECCB2BLAtmE0DeAoa0BmA9gdALzQCMATAMxYC+WWokMAwmAC7QCmAHh93gATGAhRpMOaACMwAJ1LQOcgK7d6jYAXgQuqANbcxqdGQDKAT2TSCIABQBKTeChwkJgDIEAbtwXYpAAc5RG9ObmgAfUiwdzQAfgAuaAAlbg4VOXgAFQtA7gAeDgALRAgAbQ487gI8aAMjOJAAXQA+RlwAek7oACFICOZXYJ9EIW4YMGhwAC8LaDluMCFtEHmAc3SBOQAaaAgVaSGICf3ighUQIWh4Ai54bm5rjmJFgFpxvEQHpVKIADopN1oNk-tAyuD4AJhE98AQFIJrioTnIYHZ8gRAiAIrc9GB9N91vtDscJnsQIhDNAABLZACyHk6ABEAPJ0+qxRCBS6ceEQByA3CbLickyOZJpDJZXL5Ip-SrVWocwzGNBtSS4XCIOp2ACEJTK-2iorQDl+huNTUUBoqDVVLUc0EgqXSmRy1TlZQVGLqdqabQ6muBTOIEAIyAiwVC4RkA2gx32GTwdQA7ogSuaAZbxCBA7hFlL4JmjTEmlIGECeqCITWoYjYYQFAcji5JioSnzoHY8P9uP9oBisRFPt9CTduCmlNUYEraQzmWyeNiI1D+VJyn6c81xW4cxrNQW3ePJ-by4HdJxEMBlY0c8kqj6b-bFJuTBomK3oOwOF5fAj+IiohNL+fj7sCzYJsAsTQJiHCINoaBrDBf4hOMmZ7C80ArAO8hwcAPIKAa8DrDAaYZiUETfBe8DAH2672iBcj-K+ao7t++75q6WTHl+nBnhWWg6Fw15kA8k7foxmjaLoTqKMA-wmiAQA\n\t// Original documentation on F-Bounded Polymorphism in TypeScript:\n\t// https://www.typescriptlang.org/docs/handbook/advanced-types.html#polymorphic-this-types\n\n\t// TODO make this reactive, so that if we replace the three object outside\n\t// code will know to clean up anything relying on the old object and adapt\n\t// to the new object?\n\t// @signal\n\t__three?: ReturnType\n\n\t/**\n\t * @property {Object3D} three -\n\t *\n\t * *readonly*\n\t *\n\t * The WebGL rendering content of this element. Useful if you know Three.js\n\t * APIs. See\n\t * [`Object3D`](https://threejs.org/docs/index.html#api/en/core/Object3D).\n\t */\n\tget three(): ReturnType {\n\t\tif (!this.__three) this.__three = this.__makeThreeObject3d()\n\n\t\treturn this.__three\n\t}\n\n\t__makeThreeObject3d(): ReturnType {\n\t\tconst o = this.makeThreeObject3d() as ReturnType\n\t\t// Helpful for debugging when looking in devtools.\n\t\t// @prod-prune\n\t\to.name = `${this.tagName}${this.id ? '#' + this.id : ''} (webgl, ${o.type})`\n\t\tourThreeObjects.add(o)\n\t\t// we don't let Three update local matrices automatically, we do\n\t\t// it ourselves in _calculateMatrix and _calculateWorldMatricesInSubtree\n\t\to.matrixAutoUpdate = false\n\t\treturn o\n\t}\n\n\t__disposeThree() {\n\t\tif (!this.__three) return\n\t\tdisposeObject(this.__three)\n\t\tourThreeObjects.delete(this.__three)\n\t\tthis.__three = undefined\n\t}\n\n\t/**\n\t * @method recreateThree - Replaces the current three object with a new\n\t * one, reconnecting it to the same parent and children. This can be useful\n\t * in scenarios where a property of a three object needs to be updated but the property\n\t * can only be updated via the constructor, requiring us to make a new object.\n\t */\n\trecreateThree() {\n\t\tconst children = this.__three?.children\n\n\t\tthis.__disposeThree()\n\t\t// The three getter is used here, which makes a new instance\n\t\tthis.__reconnectThree()\n\n\t\t// Three.js crashes on arrays of length 0.\n\t\tif (children && children.length) this.three.add(...children)\n\t}\n\n\t__threeCSS?: ReturnType\n\n\t/**\n\t * @property {Object3D} threeCSS -\n\t *\n\t * *readonly*\n\t *\n\t * The CSS rendering content of this element. Useful if you know Three.js\n\t * APIs. See\n\t * [`THREE.Object3D`](https://threejs.org/docs/index.html#api/en/core/Object3D).\n\t */\n\tget threeCSS(): ReturnType {\n\t\tif (!this.__threeCSS) this.__threeCSS = this.__makeThreeCSSObject()\n\n\t\treturn this.__threeCSS\n\t}\n\n\t__makeThreeCSSObject() {\n\t\tconst o = this.makeThreeCSSObject() as ReturnType\n\t\t// @prod-prune\n\t\to.name = `${this.tagName}${this.id ? '#' + this.id : ''} (css3d, ${o.type})`\n\t\tourThreeObjects.add(o)\n\t\t// we don't let Three update local matrices automatically, we do\n\t\t// it ourselves in _calculateMatrix and _calculateWorldMatricesInSubtree\n\t\to.matrixAutoUpdate = false\n\t\treturn o\n\t}\n\n\t__disposeThreeCSS() {\n\t\tif (!this.__threeCSS) return\n\t\tdisposeObject(this.__threeCSS)\n\t\tourThreeObjects.delete(this.__threeCSS)\n\t\tthis.__threeCSS = undefined\n\t}\n\n\t/**\n\t * @method recreateThreeCSS - Replaces the current threeCSS object with a new\n\t * one, reconnecting it to the same parent and children. This can be useful\n\t * in scenarios where a property of a threeCSS object needs to be updated but the property\n\t * can only be updated via the constructor, requiring us to make a new object.\n\t */\n\trecreateThreeCSS() {\n\t\tconst children = this.__threeCSS?.children\n\t\tthis.__disposeThreeCSS()\n\t\t// The threeCSS getter is used here, which makes a new instance\n\t\tthis.__reconnectThreeCSS()\n\n\t\t// Three.js crashes on arrays of length 0.\n\t\tif (children && children.length) this.threeCSS.add(...children)\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.scene\n\t\t\tthis.sizeMode.asDependency()\n\t\t\tthis.size.asDependency()\n\n\t\t\tuntrack(() => {\n\t\t\t\t// TODO: Size calculation should happen in a render task\n\t\t\t\t// just like _calculateMatrix, instead of on each property\n\t\t\t\t// change, unless the calculatedSize prop is acessed by the\n\t\t\t\t// user in which case it should trigger a calculation (sort\n\t\t\t\t// of like DOM properties that cause re-layout). We should\n\t\t\t\t// document to prefer not to force calculation, and instead\n\t\t\t\t// observe the property changes (f.e. with createEffect()).\n\t\t\t\tthis._calcSize()\n\t\t\t\tthis.needsUpdate()\n\t\t\t})\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\t// If the parent size changes,\n\t\t\tthis.parentSize\n\n\t\t\tuntrack(() => {\n\t\t\t\tconst {x, y, z} = this.sizeMode\n\n\t\t\t\tif (\n\t\t\t\t\t// then we only need to update if any size dimension is proportional,\n\t\t\t\t\tx === 'proportional' ||\n\t\t\t\t\tx === 'p' ||\n\t\t\t\t\ty === 'proportional' ||\n\t\t\t\t\ty === 'p' ||\n\t\t\t\t\tz === 'proportional' ||\n\t\t\t\t\tz === 'p'\n\t\t\t\t) {\n\t\t\t\t\t// TODO #66 defer _calcSize to an animation frame (via needsUpdate),\n\t\t\t\t\t// unless explicitly requested by a user (f.e. they read a prop so\n\t\t\t\t\t// the size must be calculated). https://github.com/lume/lume/issues/66\n\t\t\t\t\tthis._calcSize()\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// update regardless if we calculated size, in order to update\n\t\t\t// matrices (align-point depends on parent size).\n\t\t\tthis.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.position.asDependency()\n\t\t\tthis.rotation.asDependency()\n\t\t\tthis.scale.asDependency()\n\t\t\tthis.origin.asDependency()\n\t\t\tthis.alignPoint.asDependency()\n\t\t\tthis.mountPoint.asDependency()\n\t\t\tthis.opacity\n\n\t\t\tthis.needsUpdate()\n\t\t})\n\t}\n\n\toverride disconnectedCallback(): void {\n\t\tsuper.disconnectedCallback()\n\n\t\tthis.stopEffects()\n\n\t\t// TODO Keep the .three object around (dispose it, but no need to delete\n\t\t// it and recreate it, it will be GC'd with the element if the element\n\t\t// is unref'd)\n\t\tthis.__disposeThree()\n\t\tthis.__disposeThreeCSS()\n\n\t\tthis._scene = null\n\t}\n\n\toverride composedCallback(composedParent: Element, compositionType: CompositionType) {\n\t\tsuper.composedCallback?.(composedParent, compositionType)\n\n\t\tif (this.isScene) {\n\t\t\tconsole.warn(\n\t\t\t\t'Composing `` elements directly into other `` elements is not currently supported. To nest a scene inside a scene, wrap it with a `
` inside of a ``.',\n\t\t\t)\n\t\t}\n\n\t\tthis.composedSceneGraphParent!.three.add(this.three)\n\t\tthis.composedSceneGraphParent!.threeCSS.add(this.threeCSS)\n\t\tthis._scene = this.composedSceneGraphParent!.scene\n\t\tif (this._scene) this.#giveSceneToChildren()\n\t}\n\n\toverride uncomposedCallback(uncomposedParent: Element, compositionType: CompositionType) {\n\t\tsuper.uncomposedCallback?.(uncomposedParent, compositionType)\n\n\t\tthis.three.parent?.remove(this.three)\n\t\tthis.threeCSS.parent?.remove(this.threeCSS)\n\t\tthis._scene = null\n\t\tthis.#giveSceneToChildren() // remove from children\n\t}\n\n\t#giveSceneToChildren() {\n\t\tthis.traverseSceneGraph(el => {\n\t\t\tif (el === this) return\n\t\t\tif (el._scene === this._scene) return\n\t\t\tel._scene = this._scene\n\t\t})\n\t}\n\n\t/**\n\t * Called whenever a child element is composed to this element.\n\t * This is called with a `compositionType` argument that tells us how the element is\n\t * composed relative to the [\"composed tree\"](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM).\n\t *\n\t * @param {\"root\" | \"slot\" | \"actual\"} compositionType - If the value is\n\t * `\"root\"`, then the child was composed as a child of a shadow root of the\n\t * current element. If the value is `\"slot\"`, then the child was composed (i.e. distributed, or assigned) to\n\t * the current element via a [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) element.\n\t * If the value is `\"actual\"`, then the child was composed to the current\n\t * element as a regular child (`childComposedCallback` with `\"actual\"` passed\n\t * in is essentially the same as [`ChildTracker`](./ChildTracker)'s [`childConnectedCallback`](./ChildTracker#childconnectedcallback)).\n\t */\n\t// TODO update MDN docs on \"composed trees\", https://github.com/mdn/content/pull/20703\n\toverride childComposedCallback(child: Element, _compositionType: CompositionType): void {\n\t\tif (!(child instanceof SharedAPI)) return\n\n\t\tthis.needsUpdate() // Maybe not needed but its a no-op if called extra times.\n\t}\n\n\toverride childUncomposedCallback(child: Element, _compositionType: CompositionType): void {\n\t\tif (!(child instanceof SharedAPI)) return\n\n\t\t// Update the parent because the child is gone, but the scene needs a\n\t\t// redraw, and we can't update the child because it is already gone.\n\t\tthis.needsUpdate()\n\t}\n\n\t/** @abstract */\n\ttraverseSceneGraph(_visitor: (el: SharedAPI) => void, _waitForUpgrade = false): Promise | void {\n\t\tthrow 'Element3D and Scene implement this'\n\t}\n\n\t/**\n\t * Overrides [`TreeNode.parentLumeElement`](./TreeNode?id=parentLumeElement) to assert\n\t * that parents are `SharedAPI` (`Element3D` or `Scene`) instances.\n\t */\n\t// This override serves to change the type of `parentLumeElement` for\n\t// subclasses of SharedAPI.\n\t// Element3D instances (f.e. Mesh, Sphere, etc) and Scenes should always have parents\n\t// that are Element3Ds or Scenes (at least for now).\n\t// @prod-prune\n\toverride get parentLumeElement(): SharedAPI | null {\n\t\tconst parent = super.parentLumeElement\n\n\t\t// @prod-prune\n\t\tif (parent && !(parent instanceof SharedAPI)) throw new TypeError('Parent must be type SharedAPI.')\n\n\t\treturn parent\n\t}\n\n\t/**\n\t * @method needsUpdate - Schedules a rendering update for the element.\n\t * Usually you don't need to call this when using the outer APIs, as setting\n\t * attributes or properties will queue an update.\n\t *\n\t * But if you're doing something special to an Element3D or a Scene, f.e.\n\t * modifying the [`.three`](#three) or [`.threeCSS`](#threeCSS) properties\n\t * whose updates are not tracked (are not reactive), you should call this so\n\t * that LUME will know to re-render the visuals for the element.\n\t *\n\t * Example:\n\t *\n\t * ```js\n\t * const mesh = document.querySelector('lume-mesh')\n\t *\n\t * // Custom modification of underlying Three.js objects:\n\t * mesh.three.material.transparent = true\n\t * mesh.three.material.opacity = 0.4\n\t * mesh.three.add(new THREE.Mesh(...))\n\t *\n\t * // Tell LUME the elements needs to be re-rendered.\n\t * mesh.needsUpdate()\n\t * ```\n\t */\n\tneedsUpdate(): void {\n\t\tMotor.needsUpdate(this)\n\t}\n\n\tget _elementOperations(): ElementOperations {\n\t\tif (!elOps.has(this)) elOps.set(this, new ElementOperations(this))\n\t\treturn elOps.get(this)!\n\t}\n\n\t// Overrides to filter out any non-Element3Ds (f.e. Scenes).\n\toverride get composedLumeChildren(): Element3D[] {\n\t\tconst result: Element3D[] = []\n\t\tfor (const child of super.composedLumeChildren) if (isElement3D(child)) result.push(child)\n\t\treturn result\n\t}\n\n\t/**\n\t * @method makeThreeObject3d -\n\t *\n\t * *protected*\n\t *\n\t * Creates a LUME element's Three.js object for\n\t * WebGL rendering. `` elements override this to create and return\n\t * [THREE.Mesh](https://threejs.org/docs/index.html?q=mesh#api/en/objects/Mesh) instances,\n\t * for example.\n\t */\n\t// TODO @protected jsdoc tag\n\tmakeThreeObject3d(): Object3D {\n\t\treturn new Object3D()\n\t}\n\n\t/**\n\t * @method makeThreeCSSObject -\n\t *\n\t * *protected*\n\t *\n\t * Creates a LUME element's Three.js object\n\t * for CSS rendering. At the moment this is not overriden by any\n\t * subclasses, and always creates `CSS3DObjectNested` instances for CSS\n\t * rendering, which is a modified version of\n\t * [THREE.CSS3DObject](https://github.com/mrdoob/three.js/blob/b13eccc8bf1b6aeecf6e5652ba18d2425f6ec22f/examples/js/renderers/CSS3DRenderer.js#L7).\n\t */\n\tmakeThreeCSSObject(): Object3D {\n\t\t// @prod-prune, this will be only allowed in a DOM environment with CSS\n\t\t// rendering. WebGL APIs will eventually work outside a DOM\n\t\t// environment.\n\t\tif (!(this instanceof HTMLElement)) throw 'API available only in DOM environment.'\n\n\t\treturn new CSS3DObjectNested(this)\n\t}\n\n\t__reconnectThree(): void {\n\t\tthis.composedSceneGraphParent?.three.add(this.three)\n\n\t\tfor (const child of this.composedLumeChildren) {\n\t\t\tthis.three.add(child.three)\n\t\t}\n\n\t\tthis.needsUpdate()\n\t}\n\n\t__reconnectThreeCSS(): void {\n\t\tthis.composedSceneGraphParent?.threeCSS.add(this.threeCSS)\n\n\t\tfor (const child of this.composedLumeChildren) {\n\t\t\tthis.threeCSS.add(child.threeCSS)\n\t\t}\n\n\t\tthis.needsUpdate()\n\t}\n\n\toverride get composedLumeParent(): SharedAPI | null {\n\t\tconst result = super.composedLumeParent\n\t\tif (!(result instanceof SharedAPI)) return null\n\t\treturn result\n\t}\n\n\tget composedSceneGraphParent(): SharedAPI | null {\n\t\t// read first, to track the dependency\n\t\tconst composedLumeParent = this.composedLumeParent\n\n\t\t// check if parentLumeElement is a Scene because Scenes always have shadow\n\t\t// roots as part of their implementation (users will not be adding\n\t\t// shadow roots to them), and we treat distribution into a Scene shadow\n\t\t// root different than with all other Element3Ds (users can add shadow roots\n\t\t// to those). Otherwise _distributedParent for a lume-element3d that is\n\t\t// child of a lume-scene will be a non-LUME element that is inside of\n\t\t// the lume-scene's ShadowRoot, and things will not work in that case\n\t\t// because the top-level Element3D elements will not be composed to\n\t\t// the Scene element itself. TODO: perhaps the Scene can make the\n\t\t// connection by observing the children in its ShadowRoot.\n\n\t\tif (this.parentLumeElement?.isScene) return this.parentLumeElement\n\t\treturn composedLumeParent\n\t}\n\n\t/**\n\t * Takes all the current component values (position, rotation, etc) and\n\t * calculates a transformation matrix from them (currently a THREE.Matrix4,\n\t * but it used to be a DOMMatrix).\n\t *\n\t * TODO #66: make sure this is called after size calculations when we\n\t * move _calcSize to a render task.\n\t */\n\t_calculateMatrix(): void {\n\t\tconst align = this.alignPoint\n\t\tconst mountPoint = this.mountPoint\n\t\tconst position = this.position\n\t\tconst origin = this.origin\n\n\t\tconst size = this.calculatedSize\n\n\t\t// THREE-COORDS-TO-DOM-COORDS\n\t\t// translate the \"mount point\" back to the top/left/back of the object\n\t\t// (in Three.js it is in the center of the object).\n\t\tthreeJsPostAdjustment[0] = size.x / 2\n\t\tthreeJsPostAdjustment[1] = size.y / 2\n\t\tthreeJsPostAdjustment[2] = size.z / 2\n\n\t\tconst parentSize = this.parentSize\n\n\t\t// THREE-COORDS-TO-DOM-COORDS\n\t\t// translate the \"align\" back to the top/left/back of the parent element.\n\t\t// We offset this in ElementOperations#applyTransform. The Y\n\t\t// value is inverted because we invert it below.\n\t\tthreeJsPostAdjustment[0] += -parentSize.x / 2\n\t\tthreeJsPostAdjustment[1] += -parentSize.y / 2\n\t\tthreeJsPostAdjustment[2] += -parentSize.z / 2\n\n\t\talignAdjustment[0] = parentSize.x * align.x\n\t\talignAdjustment[1] = parentSize.y * align.y\n\t\talignAdjustment[2] = parentSize.z * align.z\n\n\t\tmountPointAdjustment[0] = size.x * mountPoint.x\n\t\tmountPointAdjustment[1] = size.y * mountPoint.y\n\t\tmountPointAdjustment[2] = size.z * mountPoint.z\n\n\t\tappliedPosition[0] = position.x + alignAdjustment[0] - mountPointAdjustment[0]\n\t\tappliedPosition[1] = position.y + alignAdjustment[1] - mountPointAdjustment[1]\n\t\tappliedPosition[2] = position.z + alignAdjustment[2] - mountPointAdjustment[2]\n\n\t\t// NOTE We negate Y translation in several places below so that Y\n\t\t// goes downward like in DOM's CSS transforms.\n\n\t\tthis.three.position.set(\n\t\t\tappliedPosition[0] + threeJsPostAdjustment[0],\n\t\t\t// THREE-COORDS-TO-DOM-COORDS negate the Y value so that\n\t\t\t// Three.js' positive Y is downward like DOM.\n\t\t\t-(appliedPosition[1] + threeJsPostAdjustment[1]),\n\t\t\tappliedPosition[2] + threeJsPostAdjustment[2],\n\t\t)\n\n\t\tconst childOfScene = this.composedSceneGraphParent?.isScene\n\n\t\t// FIXME we shouldn't need this conditional check. See the next XXX.\n\t\tif (childOfScene) {\n\t\t\tthis.threeCSS.position.set(\n\t\t\t\tappliedPosition[0] + threeJsPostAdjustment[0],\n\t\t\t\t// THREE-COORDS-TO-DOM-COORDS negate the Y value so that\n\t\t\t\t// Three.js' positive Y is downward like DOM.\n\t\t\t\t-(appliedPosition[1] + threeJsPostAdjustment[1]),\n\t\t\t\tappliedPosition[2] + threeJsPostAdjustment[2],\n\t\t\t)\n\t\t} else {\n\t\t\t// XXX CSS objects that aren't direct child of a scene are\n\t\t\t// already centered on X and Y (not sure why, but maybe\n\t\t\t// CSS3DObjectNested has clues, which is based on\n\t\t\t// THREE.CSS3DObject)\n\t\t\tthis.threeCSS.position.set(\n\t\t\t\tappliedPosition[0],\n\t\t\t\t-appliedPosition[1],\n\t\t\t\tappliedPosition[2] + threeJsPostAdjustment[2], // only apply Z offset\n\t\t\t)\n\t\t}\n\n\t\tif (origin.x !== 0.5 || origin.y !== 0.5 || origin.z !== 0.5) {\n\t\t\t// Here we multiply by size to convert from a ratio to a range\n\t\t\t// of units, then subtract half because Three.js origin is\n\t\t\t// centered around (0,0,0) meaning Three.js origin goes from\n\t\t\t// -0.5 to 0.5 instead of from 0 to 1.\n\n\t\t\tthis.three.pivot.set(\n\t\t\t\torigin.x * size.x - size.x / 2,\n\t\t\t\t// THREE-COORDS-TO-DOM-COORDS negate the Y value so that\n\t\t\t\t// positive Y means down instead of up (because Three,js Y\n\t\t\t\t// values go up).\n\t\t\t\t-(origin.y * size.y - size.y / 2),\n\t\t\t\torigin.z * size.z - size.z / 2,\n\t\t\t)\n\t\t\tthis.threeCSS.pivot.set(\n\t\t\t\torigin.x * size.x - size.x / 2,\n\t\t\t\t// THREE-COORDS-TO-DOM-COORDS negate the Y value so that\n\t\t\t\t// positive Y means down instead of up (because Three,js Y\n\t\t\t\t// values go up).\n\t\t\t\t-(origin.y * size.y - size.y / 2),\n\t\t\t\torigin.z * size.z - size.z / 2,\n\t\t\t)\n\t\t}\n\t\t// otherwise, use default Three.js origin of (0,0,0) which is\n\t\t// equivalent to our (0.5,0.5,0.5), by removing the pivot value.\n\t\telse {\n\t\t\tthis.three.pivot.set(0, 0, 0)\n\t\t\tthis.threeCSS.pivot.set(0, 0, 0)\n\t\t}\n\n\t\tthis.three.updateMatrix()\n\t\tthis.threeCSS.updateMatrix()\n\t}\n\n\t_updateRotation(): void {\n\t\tconst {x, y, z} = this.rotation\n\n\t\t// Currently rotation is left-handed as far as values inputted into\n\t\t// the LUME APIs. This method converts them to Three's right-handed\n\t\t// system.\n\n\t\t// TODO Make an option to use left-handed or right-handed rotation,\n\t\t// where right-handed will match with Three.js transforms, while\n\t\t// left-handed matches with CSS transforms (but in the latter case\n\t\t// using Three.js APIs will not match the same paradigm because the\n\t\t// option changes only the LUME API).\n\n\t\t// TODO Make the rotation unit configurable (f.e. use degrees or\n\t\t// radians)\n\n\t\t// TODO Make the handedness configurable (f.e. left handed or right\n\t\t// handed rotation)\n\n\t\t// We don't negate Y rotation here, but we negate Y translation\n\t\t// in _calculateMatrix so that it has the same effect.\n\t\tthis.three.rotation.set(-toRadians(x), toRadians(y), -toRadians(z))\n\n\t\t// @ts-ignore duck typing with use of isScene\n\t\tconst childOfScene = this.composedSceneGraphParent?.isScene\n\n\t\t// TODO write a comment as to why we needed the childOfScne check to\n\t\t// alternate rotation directions here. It's been a while, I forgot\n\t\t// why. I should've left a comment when I wrote this!\n\t\tthis.threeCSS.rotation.set(\n\t\t\t(childOfScene ? -1 : 1) * toRadians(x),\n\t\t\ttoRadians(y),\n\t\t\t(childOfScene ? -1 : 1) * toRadians(z),\n\t\t)\n\t}\n\n\t_updateScale(): void {\n\t\tconst {x, y, z} = this.scale\n\t\tthis.three.scale.set(x, y, z)\n\t\tthis.threeCSS.scale.set(x, y, z)\n\t}\n\n\t/**\n\t * @property {number} version -\n\t *\n\t * `signal`\n\t *\n\t * Default: `0`\n\t *\n\t * Incremented any time the element has been updated for rendering in an\n\t * animation frame. Any time this changes, it means the underlying Three.js\n\t * world matrices for this element and its sub tree have been calculated.\n\t */\n\t@signal version = 0\n\n\tupdateWorldMatrices(traverse = true): void {\n\t\tthis.three.updateWorldMatrix(false, false)\n\t\tfor (const child of this.three.children) if (!isManagedByUs(child)) child.updateMatrixWorld(true)\n\n\t\tthis.threeCSS.updateWorldMatrix(false, false)\n\t\tfor (const child of this.threeCSS.children) if (!isManagedByUs(child)) child.updateMatrixWorld(true)\n\n\t\tif (traverse) this.traverseSceneGraph(n => n !== this && n.updateWorldMatrices(false), false)\n\n\t\tuntrack(() => this.version++)\n\t}\n\n\t/**\n\t * This is called by Motor on each update before the GL or CSS renderers\n\t * will re-render. This does not fire repeatedly endlessly, it only fires\n\t * (in the next animation frame) as a response to modifying any of an\n\t * Element3D's properties/attributes (modifying a property enqueues a render\n\t * task that calls update).\n\t */\n\tupdate(_timestamp: number, _deltaTime: number): void {\n\t\tthis._updateRotation()\n\t\tthis._updateScale()\n\n\t\t// TODO: only run this when necessary (f.e. not if only opacity\n\t\t// changed, only if position/align/mountPoint changed, etc)\n\t\tthis._calculateMatrix()\n\n\t\tthis._elementOperations.applyProperties()\n\t}\n\n\t/** @deprecated Use `addEventListener()` instead. */\n\toverride on(eventName: string, callback: Function, context?: any) {\n\t\tsuper.on(eventName, callback, context)\n\t}\n\n\t/** @deprecated Use `dispatchEvent()` instead. */\n\toverride emit(eventName: string, data?: any) {\n\t\tsuper.emit(eventName, data)\n\t}\n\n\t// TODO this needs to be moved into CompositionTracker so that triggering\n\t// childComposedCallback is generic, and filtering of element types needs\n\t// to be done by subclasses.\n\toverride childConnectedCallback(child: Element) {\n\t\t// This code handles two cases: the element has a ShadowRoot\n\t\t// (\"composed children\" are children of the ShadowRoot), or it has a\n\t\t// child (\"composed children\" are elements that may be\n\t\t// distributed to the ).\n\t\tif (isElement3D(child)) {\n\t\t\t// We skip Scene here because we know it already has a\n\t\t\t// ShadowRoot that serves a different purpose than for Element3Ds. A\n\t\t\t// Scene child's three objects will always be connected to the\n\t\t\t// scene's three object regardless of its ShadowRoot.\n\t\t\tif (!this.isScene && this.__shadowRoot) {\n\t\t\t\tchild.__isPossiblyDistributedToShadowRoot = true\n\n\t\t\t\t// We don't call childComposedCallback here because that\n\t\t\t\t// will be called indirectly due to a slotchange event on a\n\t\t\t\t// element if the added child will be distributed to\n\t\t\t\t// a slot.\n\t\t\t} else {\n\t\t\t\t// If there's no shadow root, call the childComposedCallback\n\t\t\t\t// with connection type \"actual\". This is effectively a\n\t\t\t\t// regular parent-child composition (no distribution, no\n\t\t\t\t// children of a ShadowRoot).\n\n\t\t\t\tthis.__triggerChildComposedCallback(child, 'actual')\n\t\t\t}\n\t\t} else if (child instanceof HTMLSlotElement) {\n\t\t\t// COMPOSED TREE TRACKING: Detecting slots here is part of composed\n\t\t\t// tree tracking (detecting when a child is distributed to an element).\n\n\t\t\tchild.addEventListener('slotchange', this.__onChildSlotChange)\n\n\t\t\t// XXX Do we need __handleSlottedChildren for initial slotted\n\t\t\t// elements? The answer seems to be \"yes, sometimes\". When slots are\n\t\t\t// appended, their slotchange events will fire. However, this\n\t\t\t// `childConnectedCallback` is fired later from when a child is\n\t\t\t// actually connected, in a MutationObserver task. Because of this,\n\t\t\t// an appended slot's slotchange event *may* have already fired,\n\t\t\t// and we will not have had the chance to add a slotchange event\n\t\t\t// handler yet, therefore we need to fire\n\t\t\t// __handleSlottedChildren here to handle that missed\n\t\t\t// opportunity.\n\t\t\t//\n\t\t\t// Also we need to defer() here because otherwise, this\n\t\t\t// childConnectedCallback will fire once for when a child is\n\t\t\t// connected into the light DOM and run the logic in the `if\n\t\t\t// (isElement3D(child))` branch *after* childConnectedCallback is fired\n\t\t\t// and executes this __handleSlottedChildren call for a shadow\n\t\t\t// DOM slot, and in that case the distribution will not be detected\n\t\t\t// (why is that?). By deferring, this __handleSlottedChildren\n\t\t\t// call correctly happens *after* the above `if (isElement3D(child))`\n\t\t\t// branch and then things will work as expected. This is all due to\n\t\t\t// using MutationObserver, which fires event in a later task than\n\t\t\t// when child connections actually happen.\n\t\t\t//\n\t\t\t// TODO ^, Can we make WithChildren call this callback right when\n\t\t\t// children are added, synchronously? If so then we could rely on\n\t\t\t// a slot's slotchange event upon it being connected without having\n\t\t\t// to call __handleSlottedChildren here (which means also not\n\t\t\t// having to use defer for anything).\n\t\t\tqueueMicrotask(() => this.__handleSlottedChildren(child))\n\t\t}\n\t}\n\n\toverride childDisconnectedCallback(child: Element) {\n\t\tif (isElement3D(child)) {\n\t\t\tif (!this.isScene && this.__shadowRoot) {\n\t\t\t\tchild.__isPossiblyDistributedToShadowRoot = false\n\t\t\t} else {\n\t\t\t\t// If there's no shadow root, call the\n\t\t\t\t// childUncomposedCallback with connection type \"actual\".\n\t\t\t\t// This is effectively similar to childDisconnectedCallback.\n\t\t\t\tthis.__triggerChildUncomposedCallback(child, 'actual')\n\t\t\t}\n\t\t} else if (child instanceof HTMLSlotElement) {\n\t\t\t// COMPOSED TREE TRACKING:\n\t\t\tchild.removeEventListener('slotchange', this.__onChildSlotChange, {capture: true})\n\n\t\t\tthis.__handleSlottedChildren(child)\n\t\t\tthis.__previousSlotAssignedNodes.delete(child)\n\t\t}\n\t}\n\n\t// TODO: make setAttribute accept non-string values.\n\toverride setAttribute(attr: string, value: any) {\n\t\tsuper.setAttribute(attr, value)\n\t}\n\n\t// FIXME This object/array spreading and cloning is sloooooooow, and becomes\n\t// apparent the more ShadowRoots a tree has.\n\toverride get _composedChildren(): SharedAPI[] {\n\t\tif (!this.isScene && this.__shadowRoot) {\n\t\t\t// FIXME why is TypeScript requiring a cast here when I've clearly filtered the elements for the correct type?\n\t\t\treturn [\n\t\t\t\t...(this._distributedShadowRootChildren.filter(n => n instanceof SharedAPI) as SharedAPI[]),\n\t\t\t\t...(this._shadowRootChildren.filter(n => n instanceof SharedAPI) as SharedAPI[]),\n\t\t\t]\n\t\t} else {\n\t\t\t// FIXME why is TypeScript requiring a cast here when I've clearly filtered the elements for the correct type?\n\t\t\treturn [\n\t\t\t\t// TODO perhaps use slot.assignedElements instead?\n\t\t\t\t...([...(this.__distributedChildren || [])].filter(n => n instanceof SharedAPI) as SharedAPI[]),\n\n\t\t\t\t// We only care about other elements of the same type.\n\t\t\t\t...Array.from(this.children).filter((n): n is SharedAPI => n instanceof SharedAPI),\n\t\t\t]\n\t\t}\n\t}\n\n\tstatic override css = /*css*/ `\n\t\t:host {\n\t\t\t/*\n\t\t\t * All items of the scene graph are hidden until they are mounted in\n\t\t\t * a scene (this changes to display:block). This gets toggled\n\t\t\t * between \"none\" and \"block\" by SharedAPI depending on if CSS\n\t\t\t * rendering is enabled.\n\t\t\t */\n\t\t\tdisplay: none;\n\n\t\t\t/*\n\t\t\tLayout of a node's CSS rectangle is never affected by anything\n\t\t\toutside of it. We don't contain paint because CSS content can\n\t\t\toverflow if desired, or size because eventually we'll add natural\n\t\t\tsizing to let the node be sized by its content.\n\t\t\t*/\n\t\t\tcontain: layout;\n\n\t\t\t/* TODO see how content-visibility affects CSS performance with nodes that are off-screen. */\n\t\t\t/* content-visibility: auto; implies contain:strict */\n\n\t\t\tbox-sizing: border-box;\n\n\t\t\t/*\n\t\t\t * Defaults to [0.5,0.5,0.5] (the Z axis doesn't apply for DOM\n\t\t\t * elements, but does for 3D objects in WebGL that have any size\n\t\t\t * along Z.)\n\t\t\t */\n\t\t\ttransform-origin: 50% 50% 0; /* default */\n\n\t\t\ttransform-style: preserve-3d;\n\n\t\t\t/*\n\t\t\t * Force anti-aliasing of 3D element edges using an invisible shadow.\n\t\t\t * https://stackoverflow.com/questions/6492027\n\t\t\t * TODO allow to be configured with an antialiased attribute or similar.\n\t\t\t */\n\t\t\t/*box-shadow: 0 0 1px rgba(255, 255, 255, 0); currently is very very slow, https://crbug.com/1405629*/\n\t\t}\n\t`\n}\n\nif (isDomEnvironment()) {\n\tglobalThis.addEventListener('error', event => {\n\t\tconst error = event.error\n\n\t\t// sometimes it can be `null` (f.e. for ScriptErrors).\n\t\tif (!error) return\n\n\t\tif (/Illegal constructor/i.test(error.message)) {\n\t\t\tconsole.error(`\n\t\t\t\tOne of the reasons the following error can happen is if a Custom\n\t\t\t\tElement is called with 'new' before being defined. Did you set\n\t\t\t\twindow.$lume.autoDefineElements to false and then forget to call\n\t\t\t\t'LUME.defineElements()' or to call '.defineElement()' on\n\t\t\t\tindividual Lume classes? For other reasons, see:\n\t\t\t\thttps://www.google.com/search?q=chrome%20illegal%20constructor\n\t\t\t`)\n\t\t}\n\t})\n}\n", "type LumeConfig = {\n\tautoDefineElements?: boolean\n}\n\ndeclare global {\n\tinterface Window {\n\t\t$lume?: LumeConfig\n\t}\n\n\tvar $lume: LumeConfig | undefined\n}\n\nlet UserConfig: LumeConfig\n\n// Doing it with the try-catch this way is the most robust: if we rely on\n// `globalThis.$lume`, then if someone defines global `$lume` using `let` or\n// `const`, it will be global but not added ass a property on `globalThis`. But\n// if we read `$lume` and not `globalThis.$lume` and it is not defined, standard\n// behavior for undefined variables is to through, hence we have to try-catch.\n// (using `?.` property access on the possibly undefined variable also does not\n// help, it will still throw).\ntry {\n\tUserConfig = $lume ?? {}\n} catch {\n\tUserConfig = {}\n}\n\nexport const autoDefineElements = UserConfig.autoDefineElements ?? true\n", "import {booleanAttribute, element, type ElementAttributes} from '@lume/element'\nimport {SharedAPI} from './SharedAPI.js'\nimport {autoDefineElements} from '../LumeConfig.js'\nimport type {BaseAttributes} from './SharedAPI.js'\n\n// TODO Make a way to link to examples that are in separate source files so as\n// not to clutter the inline-documentation when viewing source files.\n\nexport type Element3DAttributes = BaseAttributes | 'visible'\n\n/**\n * @class Element3D -\n *\n * Element: ``\n *\n * `Element3D` is the backing class for `` elements, the most\n * primitive of the LUME 3D elements.\n *\n * `Element3D` contains the basics that all elements in a 3D scene need, such as a\n * transform (position, rotation, scale, align-point, mount-point, origin),\n * size, and mechanisms of reactivity.\n *\n * All elements in a 3D scene are an instance of `Element3D`, including more advanced\n * elements that render different types of visuals. For example, ``\n * is an element that renders a sphere on the screen and is backed by the\n * [`Sphere`](./Sphere) class which extends from `Element3D`.\n *\n * All Nodes must be a child of a [`Scene`](/api/core/Scene) node (``\n * elements) or another `Element3D` (or anything that extends from `Element3D`).\n * If a `` element is a child of anything else, it will not do\n * anything currently.\n *\n * The `Element3D` class (backing `` elements) is useful for the following:\n *\n * - Transform a parent node in 3D space, and it will transform all its\n * children and grandchildren along with it. For example, if you scale a\n * parent `Element3D`, then all its children are scaled along too.\n * - Transform child Nodes relative to their parent.\n * - Render traditional HTML content by placing any regular HTML elements as\n * children of a `` element. See the next example.\n * - Extend the `Element3D` class to make new types of 3D elements relying on the basic\n * features that `Element3D` provides. Other classes that extend from `Element3D` may, for\n * example, create [layouts](/examples/autolayout-declarative), or render\n * [WebGL content](/examples/hello-world/).\n *\n * ## Example\n *\n * The following example shows traditional HTML content inside a 3D scene, as\n * well as the concept of a hierarchy of nodes called a \"scene graph\".\n *\n * Regular HTML content is places in each `` element. CSS is applied\n * to the nodes to give them rounded borders. Standard\n * [`` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img)\n * are used display the sun images.\n *\n * We create a hierarchy of nodes. We give each node further down in the\n * hiearchy a smaller size. We use `align` and `mount-point` attributes to\n * align Nodes to one corner of their parent. `align` controls where a node is\n * mounted relative to their parent, and `mount-point` specifies the point in\n * the child that is aligned in the parent. See the [alignment guide](TODO)\n * for how that works.\n *\n * Each node has the same amount of rotation directly applied to it. Due to the\n * hiearchy, the rotations add up. The parent most node has the least\n * amount of rotation, and the child-most nodes have the most rotation and also\n * are more displaced due to rotation of their parents. See the [scene graph\n * guide](TODO) for details on how the hierarchy works.\n *\n * Finally, we listen to mouse or finger movement events in order to apply a\n * rotation to the root node based on the current mouse or finger position.\n * See the [events guide](TODO) for how the event system works.\n *\n * \n *\n * @extends SharedAPI\n */\nexport {Element3D}\n@element('lume-element3d', autoDefineElements)\nclass Element3D extends SharedAPI {\n\toverride readonly hasShadow: boolean = false\n\n\t/**\n\t * @property {true} isElement3D -\n\t *\n\t * *readonly*\n\t *\n\t * Always `true` for things that are or inherit from `Element3D`.\n\t */\n\toverride readonly isElement3D = true\n\n\t/**\n\t * @property {boolean} visible -\n\t *\n\t * *attribute*\n\t *\n\t * Default: `true`\n\t *\n\t * Whether or not the node will be\n\t * visible (if it renders anything). For `` elements, this\n\t * only applies if the element has CSS styling or traditional HTML\n\t * content inside of it (children), otherwise ``\n\t * element's don't have any visual output by default. Other nodes that\n\t * have default visual output like `` or `` will\n\t * not be visible if this is false, and their rendering mechanics will\n\t * be skipped.\n\t *\n\t * If an `Element3D` is not visible, its children are also not visible.\n\t */\n\t@booleanAttribute visible = true\n\n\t/**\n\t * *reactive*\n\t */\n\toverride get parentSize() {\n\t\tconst composedLumeParent = this.composedLumeParent\n\t\tif (this.scene && this.scene === this.parentElement) return this.scene.calculatedSize\n\t\treturn composedLumeParent?.calculatedSize ?? {x: 0, y: 0, z: 0}\n\t}\n\n\t/**\n\t * @constructor - Create a `Element3D` instance.\n\t *\n\t * The following examples calls `.set()` to set initial properties. Any\n\t * properties passed into `.set()` are applied to the instance. For\n\t * example, writing\n\t *\n\t * ```js\n\t * var node = new Element3D().set({\n\t * size: {x:100, y:100, z:100},\n\t * rotation: {x:30, y:20, z:25}\n\t * })\n\t * ```\n\t *\n\t * is the same as writing\n\t *\n\t * ```js\n\t * var node = new Element3D()\n\t * node.size = {x:100, y:100, z:100}\n\t * node.rotation = {x:30, y:20, z:25}\n\t * ```\n\t *\n\t * @example TODO\n\t */\n\t// TODO @example jsdoc tag\n\tconstructor() {\n\t\tsuper()\n\n\t\t// The `parent` property can already be set if this instance is\n\t\t// already in the DOM and wwhile being upgraded into a custom\n\t\t// element.\n\t\t// TODO Remove this after we make _calcSize lazy and deferred to a\n\t\t// render task.\n\t\tif (this.composedLumeParent) {\n\t\t\tthis._calcSize()\n\n\t\t\t// No harm deferring, plus we need to because this may end up\n\t\t\t// calling a super method of a super class that relies on a private\n\t\t\t// field that is not initialized yet, causing an error. Welcome to\n\t\t\t// TC39's vision of inheritance for JavaScript.\n\t\t\tqueueMicrotask(() => this.needsUpdate())\n\t\t}\n\t}\n\n\t/**\n\t * @method traverseSceneGraph - This traverses the composed tree of\n\t * LUME 3D elements (the scene graph) including this element, in pre-order. It skips non-LUME elements.\n\t *\n\t * This is similar to\n\t * [`Scene#traverseSceneGraph`](./Scene.md#traversescenegraph) but traversal\n\t * includes the `Element3D` that this is called on.\n\t *\n\t * Example:\n\t *\n\t * ```js\n\t * node.traverseSceneGraph(n => {\n\t * console.log(node === n) // true for the first call only\n\t * console.log(n instanceof LUME.Element3D) // true\n\t * })\n\t * ```\n\t *\n\t * @param {(node: Element3D) => void} visitor - A function called for each\n\t * LUME node in the scene graph (the composed tree).\n\t * @param {boolean} waitForUpgrade - Defaults to `false`. If `true`,\n\t * the traversal will wait for custom elements to be defined (with\n\t * customElements.whenDefined) before traversing to them.\n\t * @returns {void | Promise} - If `waitForUpgrade` is `false`,\n\t * the traversal will complete synchronously, and the return value will be\n\t * `undefined`. If `waitForUpgrade` is `true`, then traversal completes\n\t * asynchronously as soon as all custom elements are defined, and a Promise is\n\t * returned so that it is possible to wait for the traversal to complete.\n\t */\n\toverride traverseSceneGraph(visitor: (node: Element3D) => void, waitForUpgrade = false): Promise | void {\n\t\tvisitor(this)\n\n\t\tif (!waitForUpgrade) {\n\t\t\tfor (const child of this.composedLumeChildren) child.traverseSceneGraph(visitor, waitForUpgrade)\n\t\t\treturn\n\t\t}\n\n\t\t// if waitForUpgrade is true, we make a promise chain so that\n\t\t// traversal order is still the same as when waitForUpgrade is false.\n\t\tlet promise: Promise = Promise.resolve()\n\n\t\tfor (const child of this.composedLumeChildren) {\n\t\t\tconst isUpgraded = child.matches(':defined')\n\n\t\t\tif (isUpgraded) {\n\t\t\t\tpromise = promise!.then(() => child.traverseSceneGraph(visitor, waitForUpgrade))\n\t\t\t} else {\n\t\t\t\tpromise = promise!\n\t\t\t\t\t.then(() => customElements.whenDefined(child.tagName.toLowerCase()))\n\t\t\t\t\t.then(() => child.traverseSceneGraph(visitor, waitForUpgrade))\n\t\t\t}\n\t\t}\n\n\t\treturn promise\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\tthis._elementOperations.shouldRender = this.visible\n\t\t\tthis.three.visible = this.visible\n\t\t\tthis.needsUpdate()\n\t\t})\n\t}\n\n\tstatic override css = /*css*/ `\n\t\t${super.css}\n\n\t\t:host {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t}\n\t`\n}\n\n// Put initial value on the prototype to make it available during construction\n// in a super() call.\n// @ts-expect-error readonly\nElement3D.prototype.isElement3D = true\n\ndeclare module 'solid-js' {\n\tnamespace JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t'lume-element3d': ElementAttributes\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'lume-element3d': Element3D\n\t}\n}\n", "import {Effectful} from 'classy-solid'\nimport {Behavior} from './Behavior.js'\nimport {Element3D} from '../core/Element3D.js'\n\n/**\n * @class RenderableBehavior\n * Base class for element behaviors that provide rendering features (f.e. geometries, materials, etc).\n *\n * @extends Behavior\n */\n// @Xts-expect-error broken type checking in latest TypeScript (https://github.com/microsoft/TypeScript/issues/56330)\nexport abstract class RenderableBehavior extends Effectful(Behavior) {\n\tdeclare element: Element3D\n\n\toverride requiredElementType() {\n\t\treturn [Element3D]\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.element.needsUpdate()\n\t}\n\n\toverride disconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\n\t\tthis.element.needsUpdate()\n\t}\n}\n", "import { Vector3 } from './Vector3.js';\n\nclass Box3 {\n\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox3 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromArray( array ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = array.length; i < il; i += 3 ) {\n\n\t\t\tthis.expandByPoint( _vector.fromArray( array, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromBufferAttribute( attribute ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = attribute.count; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( _vector.fromBufferAttribute( attribute, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromObject( object, precise = false ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object, precise );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\texpandByObject( object, precise = false ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tconst geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\t\t// precise AABB computation based on vertex data requires at least a position attribute.\n\t\t\t// instancing isn't supported so far and uses the normal (conservative) code path.\n\n\t\t\tif ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {\n\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\tif ( object.isMesh === true ) {\n\n\t\t\t\t\t\tobject.getVertexPosition( i, _vector );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_vector.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_vector.applyMatrix4( object.matrixWorld );\n\t\t\t\t\tthis.expandByPoint( _vector );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\t\t\t// object-level bounding box\n\n\t\t\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box.copy( object.boundingBox );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// geometry-level bounding box\n\n\t\t\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box.copy( geometry.boundingBox );\n\n\t\t\t\t}\n\n\t\t\t\t_box.applyMatrix4( object.matrixWorld );\n\n\t\t\t\tthis.union( _box );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ], precise );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ||\n\t\t\tpoint.z < this.min.z || point.z > this.max.z ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ||\n\t\t\tbox.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tlet min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t}\n\n\tintersectsTriangle( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0.subVectors( triangle.a, _center );\n\t\t_v1.subVectors( triangle.b, _center );\n\t\t_v2.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1, _v0 );\n\t\t_f1.subVectors( _v2, _v1 );\n\t\t_f2.subVectors( _v0, _v2 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tlet axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0, _v1, _v2, _extents );\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector ).distanceTo( point );\n\n\t}\n\n\tgetBoundingSphere( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\ttarget.makeEmpty();\n\n\t\t} else {\n\n\t\t\tthis.getCenter( target.center );\n\n\t\t\ttarget.radius = this.getSize( _vector ).length() * 0.5;\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _points = [\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3()\n];\n\nconst _vector = /*@__PURE__*/ new Vector3();\n\nconst _box = /*@__PURE__*/ new Box3();\n\n// triangle centered vertices\n\nconst _v0 = /*@__PURE__*/ new Vector3();\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\n\n// triangle edge vectors\n\nconst _f0 = /*@__PURE__*/ new Vector3();\nconst _f1 = /*@__PURE__*/ new Vector3();\nconst _f2 = /*@__PURE__*/ new Vector3();\n\nconst _center = /*@__PURE__*/ new Vector3();\nconst _extents = /*@__PURE__*/ new Vector3();\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\nconst _testAxis = /*@__PURE__*/ new Vector3();\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the separating axis\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the separating axis\n\t\tconst p0 = v0.dot( _testAxis );\n\t\tconst p1 = v1.dot( _testAxis );\n\t\tconst p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is separating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\nexport { Box3 };\n", "import { Box3 } from './Box3.js';\nimport { Vector3 } from './Vector3.js';\n\nconst _box = /*@__PURE__*/ new Box3();\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\n\nclass Sphere {\n\n\tconstructor( center = new Vector3(), radius = - 1 ) {\n\n\t\tthis.isSphere = true;\n\n\t\tthis.center = center;\n\t\tthis.radius = radius;\n\n\t}\n\n\tset( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points, optionalCenter ) {\n\n\t\tconst center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tlet maxRadiusSq = 0;\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\treturn ( this.radius < 0 );\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.center.set( 0, 0, 0 );\n\t\tthis.radius = - 1;\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\t// Empty sphere produces empty bounding box\n\t\t\ttarget.makeEmpty();\n\t\t\treturn target;\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.center.copy( point );\n\n\t\t\tthis.radius = 0;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t_v1.subVectors( point, this.center );\n\n\t\tconst lengthSq = _v1.lengthSq();\n\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\t// calculate the minimal sphere\n\n\t\t\tconst length = Math.sqrt( lengthSq );\n\n\t\t\tconst delta = ( length - this.radius ) * 0.5;\n\n\t\t\tthis.center.addScaledVector( _v1, delta / length );\n\n\t\t\tthis.radius += delta;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tunion( sphere ) {\n\n\t\tif ( sphere.isEmpty() ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.copy( sphere );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.center.equals( sphere.center ) === true ) {\n\n\t\t\t this.radius = Math.max( this.radius, sphere.radius );\n\n\t\t} else {\n\n\t\t\t_v2.subVectors( sphere.center, this.center ).setLength( sphere.radius );\n\n\t\t\tthis.expandByPoint( _v1.copy( sphere.center ).add( _v2 ) );\n\n\t\t\tthis.expandByPoint( _v1.copy( sphere.center ).sub( _v2 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nexport { Sphere };\n", "import { Vector3 } from './Vector3.js';\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _segCenter = /*@__PURE__*/ new Vector3();\nconst _segDir = /*@__PURE__*/ new Vector3();\nconst _diff = /*@__PURE__*/ new Vector3();\n\nconst _edge1 = /*@__PURE__*/ new Vector3();\nconst _edge2 = /*@__PURE__*/ new Vector3();\nconst _normal = /*@__PURE__*/ new Vector3();\n\nclass Ray {\n\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {\n\n\t\tthis.origin = origin;\n\t\tthis.direction = direction;\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, t );\n\n\t}\n\n\tlookAt( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\trecast( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector ) );\n\n\t\treturn this;\n\n\t}\n\n\tclosestPointToPoint( point, target ) {\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tconst directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t}\n\n\tdistanceSqToPoint( point ) {\n\n\t\tconst directionDistance = _vector.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector.distanceToSquared( point );\n\n\t}\n\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tconst a01 = - this.direction.dot( _segDir );\n\t\tconst b0 = _diff.dot( this.direction );\n\t\tconst b1 = - _diff.dot( _segDir );\n\t\tconst c = _diff.lengthSq();\n\t\tconst det = Math.abs( 1 - a01 * a01 );\n\t\tlet s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tconst invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.origin ).addScaledVector( this.direction, s0 );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segCenter ).addScaledVector( _segDir, s1 );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t}\n\n\tintersectSphere( sphere, target ) {\n\n\t\t_vector.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector.dot( this.direction );\n\t\tconst d2 = _vector.dot( _vector ) - tca * tca;\n\t\tconst radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tconst thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tconst t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tconst t1 = tca + thc;\n\n\t\t// test to see if t1 is behind the ray - if so, return null\n\t\tif ( t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tdistanceToPlane( plane ) {\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t}\n\n\tintersectPlane( plane, target ) {\n\n\t\tconst t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t}\n\n\tintersectBox( box, target ) {\n\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tconst invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tconst origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\tif ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;\n\n\t\tif ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn this.intersectBox( box, _vector ) !== null;\n\n\t}\n\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tlet DdN = this.direction.dot( _normal );\n\t\tlet sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = - 1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tconst QdN = - sign * _diff.dot( _normal );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t}\n\n\tapplyMatrix4( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t}\n\n\tequals( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nexport { Ray };\n", "import { Vector3 } from './Vector3.js';\n\nconst _v0 = /*@__PURE__*/ new Vector3();\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\nconst _v3 = /*@__PURE__*/ new Vector3();\n\nconst _vab = /*@__PURE__*/ new Vector3();\nconst _vac = /*@__PURE__*/ new Vector3();\nconst _vbc = /*@__PURE__*/ new Vector3();\nconst _vap = /*@__PURE__*/ new Vector3();\nconst _vbp = /*@__PURE__*/ new Vector3();\nconst _vcp = /*@__PURE__*/ new Vector3();\n\nlet warnedGetUV = false;\n\nclass Triangle {\n\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\n\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\n\t}\n\n\tstatic getNormal( a, b, c, target ) {\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0.subVectors( a, b );\n\t\ttarget.cross( _v0 );\n\n\t\tconst targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t}\n\n\t// static/instance method to calculate barycentric coordinates\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\tstatic getBarycoord( point, a, b, c, target ) {\n\n\t\t_v0.subVectors( c, a );\n\t\t_v1.subVectors( b, a );\n\t\t_v2.subVectors( point, a );\n\n\t\tconst dot00 = _v0.dot( _v0 );\n\t\tconst dot01 = _v0.dot( _v1 );\n\t\tconst dot02 = _v0.dot( _v2 );\n\t\tconst dot11 = _v1.dot( _v1 );\n\t\tconst dot12 = _v1.dot( _v2 );\n\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\ttarget.set( 0, 0, 0 );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst invDenom = 1 / denom;\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t}\n\n\tstatic containsPoint( point, a, b, c ) {\n\n\t\t// if the triangle is degenerate then we can't contain a point\n\t\tif ( this.getBarycoord( point, a, b, c, _v3 ) === null ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn ( _v3.x >= 0 ) && ( _v3.y >= 0 ) && ( ( _v3.x + _v3.y ) <= 1 );\n\n\t}\n\n\tstatic getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );\n\n\t}\n\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tif ( this.getBarycoord( point, p1, p2, p3, _v3 ) === null ) {\n\n\t\t\ttarget.x = 0;\n\t\t\ttarget.y = 0;\n\t\t\tif ( 'z' in target ) target.z = 0;\n\t\t\tif ( 'w' in target ) target.w = 0;\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3.x );\n\t\ttarget.addScaledVector( v2, _v3.y );\n\t\ttarget.addScaledVector( v3, _v3.z );\n\n\t\treturn target;\n\n\t}\n\n\tstatic isFrontFacing( a, b, c, direction ) {\n\n\t\t_v0.subVectors( c, b );\n\t\t_v1.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn ( _v0.cross( _v1 ).dot( direction ) < 0 ) ? true : false;\n\n\t}\n\n\tset( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\n\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t}\n\n\tgetArea() {\n\n\t\t_v0.subVectors( this.c, this.b );\n\t\t_v1.subVectors( this.a, this.b );\n\n\t\treturn _v0.cross( _v1 ).length() * 0.5;\n\n\t}\n\n\tgetMidpoint( target ) {\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t}\n\n\tgetNormal( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t}\n\n\tgetPlane( target ) {\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t}\n\n\tgetBarycoord( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t}\n\n\tgetUV( point, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );\n\n\t}\n\n\tgetInterpolation( point, v1, v2, v3, target ) {\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t}\n\n\tisFrontFacing( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t}\n\n\tclosestPointToPoint( p, target ) {\n\n\t\tconst a = this.a, b = this.b, c = this.c;\n\t\tlet v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tconst d1 = _vab.dot( _vap );\n\t\tconst d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tconst d3 = _vab.dot( _vbp );\n\t\tconst d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tconst vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tconst d5 = _vab.dot( _vcp );\n\t\tconst d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tconst vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tconst va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tconst denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t}\n\n\tequals( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n}\n\nexport { Triangle };\n", "import { Material } from './Material.js';\nimport { MultiplyOperation } from '../constants.js';\nimport { Color } from '../math/Color.js';\n\nclass MeshBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshBasicMaterial = true;\n\n\t\tthis.type = 'MeshBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // emissive\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { MeshBasicMaterial };\n", "import { Vector3 } from '../math/Vector3.js';\nimport { Vector2 } from '../math/Vector2.js';\nimport { denormalize, normalize } from '../math/MathUtils.js';\nimport { StaticDrawUsage, FloatType } from '../constants.js';\nimport { fromHalfFloat, toHalfFloat } from '../extras/DataUtils.js';\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector2();\n\nclass BufferAttribute {\n\n\tconstructor( array, itemSize, normalized = false ) {\n\n\t\tif ( Array.isArray( array ) ) {\n\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t\t}\n\n\t\tthis.isBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.array = array;\n\t\tthis.itemSize = itemSize;\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\t\tthis.normalized = normalized;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis._updateRange = { offset: 0, count: - 1 };\n\t\tthis.updateRanges = [];\n\t\tthis.gpuType = FloatType;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tget updateRange() {\n\n\t\tconsole.warn( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\t\tthis.gpuType = source.gpuType;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyArray( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tif ( this.itemSize === 2 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector2.fromBufferAttribute( this, i );\n\t\t\t\t_vector2.applyMatrix3( m );\n\n\t\t\t\tthis.setXY( i, _vector2.x, _vector2.y );\n\n\t\t\t}\n\n\t\t} else if ( this.itemSize === 3 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector.fromBufferAttribute( this, i );\n\t\t\t\t_vector.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector.x, _vector.y, _vector.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector.fromBufferAttribute( this, i );\n\n\t\t\t_vector.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector.fromBufferAttribute( this, i );\n\n\t\t\t_vector.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector.fromBufferAttribute( this, i );\n\n\t\t\t_vector.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\t// Matching BufferAttribute constructor, do not normalize the array.\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.itemSize + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.array[ index * this.itemSize + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.array[ index * this.itemSize ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.array[ index * this.itemSize + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.array[ index * this.itemSize + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.array[ index * this.itemSize + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.from( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\n\n\t\treturn data;\n\n\t}\n\n}\n\n//\n\nclass Int8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t\tthis.isFloat16BufferAttribute = true;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = fromHalfFloat( this.array[ index * this.itemSize ] );\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = toHalfFloat( x );\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = fromHalfFloat( this.array[ index * this.itemSize + 1 ] );\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = fromHalfFloat( this.array[ index * this.itemSize + 2 ] );\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = fromHalfFloat( this.array[ index * this.itemSize + 3 ] );\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\t\tthis.array[ index + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nclass Float32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float64BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float64Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\n//\n\nexport {\n\tFloat64BufferAttribute,\n\tFloat32BufferAttribute,\n\tFloat16BufferAttribute,\n\tUint32BufferAttribute,\n\tInt32BufferAttribute,\n\tUint16BufferAttribute,\n\tInt16BufferAttribute,\n\tUint8ClampedBufferAttribute,\n\tUint8BufferAttribute,\n\tInt8BufferAttribute,\n\tBufferAttribute\n};\n", "function arrayMin( array ) {\n\n\tif ( array.length === 0 ) return Infinity;\n\n\tlet min = array[ 0 ];\n\n\tfor ( let i = 1, l = array.length; i < l; ++ i ) {\n\n\t\tif ( array[ i ] < min ) min = array[ i ];\n\n\t}\n\n\treturn min;\n\n}\n\nfunction arrayMax( array ) {\n\n\tif ( array.length === 0 ) return - Infinity;\n\n\tlet max = array[ 0 ];\n\n\tfor ( let i = 1, l = array.length; i < l; ++ i ) {\n\n\t\tif ( array[ i ] > max ) max = array[ i ];\n\n\t}\n\n\treturn max;\n\n}\n\nfunction arrayNeedsUint32( array ) {\n\n\t// assumes larger values usually on last\n\n\tfor ( let i = array.length - 1; i >= 0; -- i ) {\n\n\t\tif ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n\n\t}\n\n\treturn false;\n\n}\n\nconst TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\tUint8ClampedArray: Uint8ClampedArray,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\nfunction getTypedArray( type, buffer ) {\n\n\treturn new TYPED_ARRAYS[ type ]( buffer );\n\n}\n\nfunction createElementNS( name ) {\n\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\n\n}\n\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\n\n}\n\nconst _cache = {};\n\nfunction warnOnce( message ) {\n\n\tif ( message in _cache ) return;\n\n\t_cache[ message ] = true;\n\n\tconsole.warn( message );\n\n}\n\nexport { arrayMin, arrayMax, arrayNeedsUint32, getTypedArray, createElementNS, createCanvasElement, warnOnce };\n", "import { Vector3 } from '../math/Vector3.js';\nimport { Vector2 } from '../math/Vector2.js';\nimport { Box3 } from '../math/Box3.js';\nimport { EventDispatcher } from './EventDispatcher.js';\nimport { BufferAttribute, Float32BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute } from './BufferAttribute.js';\nimport { Sphere } from '../math/Sphere.js';\nimport { Object3D } from './Object3D.js';\nimport { Matrix4 } from '../math/Matrix4.js';\nimport { Matrix3 } from '../math/Matrix3.js';\nimport * as MathUtils from '../math/MathUtils.js';\nimport { arrayNeedsUint32 } from '../utils.js';\n\nlet _id = 0;\n\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector = /*@__PURE__*/ new Vector3();\n\nclass BufferGeometry extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBufferGeometry = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id ++ } );\n\n\t\tthis.uuid = MathUtils.generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'BufferGeometry';\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\n\t\tthis.morphAttributes = {};\n\t\tthis.morphTargetsRelative = false;\n\n\t\tthis.groups = [];\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tthis.drawRange = { start: 0, count: Infinity };\n\n\t\tthis.userData = {};\n\n\t}\n\n\tgetIndex() {\n\n\t\treturn this.index;\n\n\t}\n\n\tsetIndex( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetAttribute( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t}\n\n\tsetAttribute( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t}\n\n\tdeleteAttribute( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t}\n\n\thasAttribute( name ) {\n\n\t\treturn this.attributes[ name ] !== undefined;\n\n\t}\n\n\taddGroup( start, count, materialIndex = 0 ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex\n\n\t\t} );\n\n\t}\n\n\tclearGroups() {\n\n\t\tthis.groups = [];\n\n\t}\n\n\tsetDrawRange( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tconst normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tconst tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t_m1.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateY( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tscale( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tlookAt( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t}\n\n\tcenter() {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tconst position = [];\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst point = points[ i ];\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t}\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingBox.set(\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\n\t\t\t);\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector.addVectors( this.boundingBox.min, _box.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector );\n\n\t\t\t\t\t\t_vector.addVectors( this.boundingBox.max, _box.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\t_box.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector.addVectors( _box.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box.expandByPoint( _vector );\n\n\t\t\t\t\t\t_vector.addVectors( _box.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box.expandByPoint( _vector );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeTangents() {\n\n\t\tconst index = this.index;\n\t\tconst attributes = this.attributes;\n\n\t\t// based on http://www.terathon.com/code/tangent.html\n\t\t// (per vertex tangents)\n\n\t\tif ( index === null ||\n\t\t\t attributes.position === undefined ||\n\t\t\t attributes.normal === undefined ||\n\t\t\t attributes.uv === undefined ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst indices = index.array;\n\t\tconst positions = attributes.position.array;\n\t\tconst normals = attributes.normal.array;\n\t\tconst uvs = attributes.uv.array;\n\n\t\tconst nVertices = positions.length / 3;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );\n\n\t\t}\n\n\t\tconst tangents = this.getAttribute( 'tangent' ).array;\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < nVertices; i ++ ) {\n\n\t\t\ttan1[ i ] = new Vector3();\n\t\t\ttan2[ i ] = new Vector3();\n\n\t\t}\n\n\t\tconst vA = new Vector3(),\n\t\t\tvB = new Vector3(),\n\t\t\tvC = new Vector3(),\n\n\t\t\tuvA = new Vector2(),\n\t\t\tuvB = new Vector2(),\n\t\t\tuvC = new Vector2(),\n\n\t\t\tsdir = new Vector3(),\n\t\t\ttdir = new Vector3();\n\n\t\tfunction handleTriangle( a, b, c ) {\n\n\t\t\tvA.fromArray( positions, a * 3 );\n\t\t\tvB.fromArray( positions, b * 3 );\n\t\t\tvC.fromArray( positions, c * 3 );\n\n\t\t\tuvA.fromArray( uvs, a * 2 );\n\t\t\tuvB.fromArray( uvs, b * 2 );\n\t\t\tuvC.fromArray( uvs, c * 2 );\n\n\t\t\tvB.sub( vA );\n\t\t\tvC.sub( vA );\n\n\t\t\tuvB.sub( uvA );\n\t\t\tuvC.sub( uvA );\n\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\n\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\n\n\t\t\tif ( ! isFinite( r ) ) return;\n\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\n\n\t\t\ttan1[ a ].add( sdir );\n\t\t\ttan1[ b ].add( sdir );\n\t\t\ttan1[ c ].add( sdir );\n\n\t\t\ttan2[ a ].add( tdir );\n\t\t\ttan2[ b ].add( tdir );\n\t\t\ttan2[ c ].add( tdir );\n\n\t\t}\n\n\t\tlet groups = this.groups;\n\n\t\tif ( groups.length === 0 ) {\n\n\t\t\tgroups = [ {\n\t\t\t\tstart: 0,\n\t\t\t\tcount: indices.length\n\t\t\t} ];\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleTriangle(\n\t\t\t\t\tindices[ j + 0 ],\n\t\t\t\t\tindices[ j + 1 ],\n\t\t\t\t\tindices[ j + 2 ]\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\n\t\tconst n = new Vector3(), n2 = new Vector3();\n\n\t\tfunction handleVertex( v ) {\n\n\t\t\tn.fromArray( normals, v * 3 );\n\t\t\tn2.copy( n );\n\n\t\t\tconst t = tan1[ v ];\n\n\t\t\t// Gram-Schmidt orthogonalize\n\n\t\t\ttmp.copy( t );\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\n\n\t\t\t// Calculate handedness\n\n\t\t\ttmp2.crossVectors( n2, t );\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\n\t\t\tconst w = ( test < 0.0 ) ? - 1.0 : 1.0;\n\n\t\t\ttangents[ v * 4 ] = tmp.x;\n\t\t\ttangents[ v * 4 + 1 ] = tmp.y;\n\t\t\ttangents[ v * 4 + 2 ] = tmp.z;\n\t\t\ttangents[ v * 4 + 3 ] = w;\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleVertex( indices[ j + 0 ] );\n\t\t\t\thandleVertex( indices[ j + 1 ] );\n\t\t\t\thandleVertex( indices[ j + 2 ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeVertexNormals() {\n\n\t\tconst index = this.index;\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute !== undefined ) {\n\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\n\n\t\t\tif ( normalAttribute === undefined ) {\n\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\n\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tconst vA = index.getX( i + 0 );\n\t\t\t\t\tconst vB = index.getX( i + 1 );\n\t\t\t\t\tconst vC = index.getX( i + 2 );\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\n\n\t\t\t\t\tnA.add( cb );\n\t\t\t\t\tnB.add( cb );\n\t\t\t\t\tnC.add( cb );\n\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tnormalAttribute.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tnormalizeNormals() {\n\n\t\tconst normals = this.attributes.normal;\n\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector.fromBufferAttribute( normals, i );\n\n\t\t\t_vector.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t}\n\n\ttoNonIndexed() {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tconst array = attribute.array;\n\t\t\tconst itemSize = attribute.itemSize;\n\t\t\tconst normalized = attribute.normalized;\n\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tlet index = 0, index2 = 0;\n\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst geometry2 = new BufferGeometry();\n\n\t\tconst indices = this.index.array;\n\t\tconst attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = this.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst morphArray = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = morphAttribute[ i ];\n\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = this.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tconst parameters = this.parameters;\n\n\t\t\tfor ( const key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n\t\tdata.data = { attributes: {} };\n\n\t\tconst index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\n\n\t\t}\n\n\t\tconst morphAttributes = {};\n\t\tlet hasMorphAttributes = false;\n\n\t\tfor ( const key in this.morphAttributes ) {\n\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = attributeArray[ i ];\n\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tconst groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = {\n\t\t\t\tcenter: boundingSphere.center.toArray(),\n\t\t\t\tradius: boundingSphere.radius\n\t\t\t};\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// used for storing cloned, shared data\n\n\t\tconst data = {};\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tconst index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone( data ) );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tconst attributes = source.attributes;\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = source.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = source.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tconst boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tconst boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nexport { BufferGeometry };\n", "import { Vector3 } from '../math/Vector3.js';\nimport { Vector2 } from '../math/Vector2.js';\nimport { Sphere } from '../math/Sphere.js';\nimport { Ray } from '../math/Ray.js';\nimport { Matrix4 } from '../math/Matrix4.js';\nimport { Object3D } from '../core/Object3D.js';\nimport { Triangle } from '../math/Triangle.js';\nimport { BackSide, FrontSide } from '../constants.js';\nimport { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js';\nimport { BufferGeometry } from '../core/BufferGeometry.js';\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _sphereHitAt = /*@__PURE__*/ new Vector3();\n\nconst _vA = /*@__PURE__*/ new Vector3();\nconst _vB = /*@__PURE__*/ new Vector3();\nconst _vC = /*@__PURE__*/ new Vector3();\n\nconst _tempA = /*@__PURE__*/ new Vector3();\nconst _morphA = /*@__PURE__*/ new Vector3();\n\nconst _uvA = /*@__PURE__*/ new Vector2();\nconst _uvB = /*@__PURE__*/ new Vector2();\nconst _uvC = /*@__PURE__*/ new Vector2();\n\nconst _normalA = /*@__PURE__*/ new Vector3();\nconst _normalB = /*@__PURE__*/ new Vector3();\nconst _normalC = /*@__PURE__*/ new Vector3();\n\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\n\nclass Mesh extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isMesh = true;\n\n\t\tthis.type = 'Mesh';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.attributes.position;\n\t\tconst morphPosition = geometry.morphAttributes.position;\n\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\n\t\ttarget.fromBufferAttribute( position, index );\n\n\t\tconst morphInfluences = this.morphTargetInfluences;\n\n\t\tif ( morphPosition && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morphAttribute = morphPosition[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morphAttribute, index );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( target ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttarget.add( _morphA );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\n\t\t// check distance from ray origin to bounding sphere\n\n\t\t_ray.copy( raycaster.ray ).recast( raycaster.near );\n\n\t\tif ( _sphere.containsPoint( _ray.origin ) === false ) {\n\n\t\t\tif ( _ray.intersectSphere( _sphere, _sphereHitAt ) === null ) return;\n\n\t\t\tif ( _ray.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;\n\n\t\t}\n\n\t\t// convert ray to local space of mesh\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray );\n\n\t}\n\n\t_computeIntersections( raycaster, intersects, rayLocalSpace ) {\n\n\t\tlet intersection;\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\tconst index = geometry.index;\n\t\tconst position = geometry.attributes.position;\n\t\tconst uv = geometry.attributes.uv;\n\t\tconst uv1 = geometry.attributes.uv1;\n\t\tconst normal = geometry.attributes.normal;\n\t\tconst groups = geometry.groups;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\tif ( index !== null ) {\n\n\t\t\t// indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = index.getX( j );\n\t\t\t\t\t\tconst b = index.getX( j + 1 );\n\t\t\t\t\t\tconst c = index.getX( j + 2 );\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\tconst b = index.getX( i + 1 );\n\t\t\t\t\tconst c = index.getX( i + 2 );\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( position !== undefined ) {\n\n\t\t\t// non-indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = j;\n\t\t\t\t\t\tconst b = j + 1;\n\t\t\t\t\t\tconst c = j + 2;\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = i;\n\t\t\t\t\tconst b = i + 1;\n\t\t\t\t\tconst c = i + 2;\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tlet intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {\n\n\tobject.getVertexPosition( a, _vA );\n\tobject.getVertexPosition( b, _vB );\n\tobject.getVertexPosition( c, _vC );\n\n\tconst intersection = checkIntersection( object, material, raycaster, ray, _vA, _vB, _vC, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA.fromBufferAttribute( uv, a );\n\t\t\t_uvB.fromBufferAttribute( uv, b );\n\t\t\t_uvC.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\t_uvA.fromBufferAttribute( uv1, a );\n\t\t\t_uvB.fromBufferAttribute( uv1, b );\n\t\t\t_uvC.fromBufferAttribute( uv1, c );\n\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );\n\t\t\tintersection.uv2 = intersection.uv1; // @deprecated, r152\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\t_normalA.fromBufferAttribute( normal, a );\n\t\t\t_normalB.fromBufferAttribute( normal, b );\n\t\t\t_normalC.fromBufferAttribute( normal, c );\n\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _normalA, _normalB, _normalC, new Vector3() );\n\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA, _vB, _vC, face.normal );\n\n\t\tintersection.face = face;\n\n\t}\n\n\treturn intersection;\n\n}\n\nexport { Mesh };\n", "import {Mesh as ThreeMesh} from 'three/src/objects/Mesh.js'\nimport {booleanAttribute, element, type ElementAttributes} from '@lume/element'\nimport {Element3D} from '../core/Element3D.js'\nimport {autoDefineElements} from '../LumeConfig.js'\nimport type {Material} from 'three/src/materials/Material.js'\nimport type {Element3DAttributes} from '../core/Element3D.js'\nimport type {ElementWithBehaviors} from '../behaviors/ElementWithBehaviors.js'\nimport type {\n\tPhongMaterialBehavior,\n\tPhongMaterialBehaviorAttributes,\n\tLambertMaterialBehavior,\n\tLambertMaterialBehaviorAttributes,\n\tClipPlanesBehavior,\n\tClipPlanesBehaviorAttributes,\n\tPhysicalMaterialBehavior,\n\tPhysicalMaterialBehaviorAttributes,\n\tStandardMaterialBehavior,\n\tStandardMaterialBehaviorAttributes,\n} from '../behaviors/index.js'\n\nexport type MeshAttributes = Element3DAttributes | BehaviorAttributes | 'castShadow' | 'receiveShadow'\n\n/**\n * @class Mesh -\n *\n * Element: ``\n *\n * An element that renders a particular 3D shape (geometry) along with a\n * particular style (material). This is a generic element with no particular\n * shape. Elements like `` extend from `Mesh` in order to define\n * behaviors they ship with by default. For example a `` element\n * (backed by the [`Box`](./Box) class) extends from this `Mesh` class and\n * applies two default behaviors:\n * [`box-geometry`](../behaviors/mesh-behaviors/geometries/BoxGeometryBehavior)\n * and\n * [`phong-material`](../behaviors/mesh-behaviors/materials/PhongMaterialBehavior).\n *\n * A `` does not have any behaviors by default, a geometry behavior\n * and material behavior need to be added for it to render something, using the\n * `has=\"\"` attribute, for example `has=\"box-geometry phong-material\"`.\n *\n * ## Example\n *\n * \n * \n *\n * @extends Element3D\n * @element lume-mesh TODO @element jsdoc tag\n *\n */\nexport\n@element('lume-mesh', autoDefineElements)\nclass Mesh extends Element3D {\n\t/**\n\t * @property {boolean} castShadow\n\t *\n\t * `boolean` `attribute`\n\t *\n\t * Default: `true`\n\t *\n\t * When `true`, the mesh casts shadows onto other objects when under the\n\t * presence of a light such as a\n\t * [``](../lights/PointLight).\n\t */\n\t@booleanAttribute castShadow = true\n\n\t/**\n\t * @property {boolean} receiveShadow\n\t *\n\t * `boolean` `attribute`\n\t *\n\t * Default: `true`\n\t *\n\t * When `true`, the mesh receives shadows from other objects when under the\n\t * presence of a light such as a\n\t * [``](../lights/PointLight).\n\t */\n\t@booleanAttribute receiveShadow = true\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.three.castShadow = this.castShadow\n\t\t\tthis.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.three.receiveShadow = this.receiveShadow\n\t\t\t// TODO handle material arrays\n\t\t\t;(this.three.material as Material).needsUpdate = true\n\t\t\tthis.needsUpdate()\n\t\t})\n\t}\n\n\toverride makeThreeObject3d() {\n\t\treturn new ThreeMesh()\n\t}\n}\n\nexport interface Mesh extends ElementWithBehaviors {}\n\ntype BehaviorInstanceTypes = PhongMaterialBehavior &\n\tLambertMaterialBehavior &\n\tStandardMaterialBehavior &\n\tPhysicalMaterialBehavior &\n\tClipPlanesBehavior\n\ntype BehaviorAttributes =\n\t| PhongMaterialBehaviorAttributes\n\t| LambertMaterialBehaviorAttributes\n\t| StandardMaterialBehaviorAttributes\n\t| PhysicalMaterialBehaviorAttributes\n\t| ClipPlanesBehaviorAttributes\n\ndeclare module 'solid-js' {\n\tnamespace JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t'lume-mesh': ElementAttributes\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'lume-mesh': Mesh\n\t}\n}\n", "import { Material } from './Material.js';\nimport { Color } from '../math/Color.js';\n\nclass PointsMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isPointsMaterial = true;\n\n\t\tthis.type = 'PointsMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.size = 1;\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.size = source.size;\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { PointsMaterial };\n", "import { Sphere } from '../math/Sphere.js';\nimport { Ray } from '../math/Ray.js';\nimport { Matrix4 } from '../math/Matrix4.js';\nimport { Object3D } from '../core/Object3D.js';\nimport { Vector3 } from '../math/Vector3.js';\nimport { PointsMaterial } from '../materials/PointsMaterial.js';\nimport { BufferGeometry } from '../core/BufferGeometry.js';\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _position = /*@__PURE__*/ new Vector3();\n\nclass Points extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isPoints = true;\n\n\t\tthis.type = 'Points';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Points.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\n\n\t\t\t\tconst a = index.getX( i );\n\n\t\t\t\t_position.fromBufferAttribute( positionAttribute, a );\n\n\t\t\t\ttestPoint( _position, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\n\n\t\t\t\t_position.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\ttestPoint( _position, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tconst intersectPoint = new Vector3();\n\n\t\t_ray.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\nexport { Points };\n", "import {element, type ElementAttributes} from '@lume/element'\nimport {Points as ThreePoints} from 'three/src/objects/Points.js'\nimport {Element3D} from '../core/Element3D.js'\nimport {autoDefineElements} from '../LumeConfig.js'\nimport type {Element3DAttributes} from '../core/Element3D.js'\nimport type {ElementWithBehaviors} from '../behaviors/ElementWithBehaviors.js'\nimport type {\n\tClipPlanesBehavior,\n\tClipPlanesBehaviorAttributes,\n\tLambertMaterialBehavior,\n\tLambertMaterialBehaviorAttributes,\n\tPhongMaterialBehavior,\n\tPhongMaterialBehaviorAttributes,\n\tPointsMaterialBehavior,\n\tPointsMaterialBehaviorAttributes,\n} from '../behaviors/index.js'\n\nexport type PointsAttributes = Element3DAttributes\n\n/**\n * @class Points -\n *\n * Element: ``\n *\n * Applies default behaviors of\n * [`box-geometry`](../behaviors/mesh-behaviors/geometries/BoxGeometryBehavior)\n * and\n * [`points-material`](../behaviors/mesh-behaviors/materials/PhongMaterialBehavior).\n *\n * A `` element is similar to a `` element, except that\n * the `points-material` is used by default, which renders any geometry's\n * verticies as points instead of filled triangles.\n *\n * It can be useful to have\n * [`ply-geometry`](../behaviors/mesh-behaviors/geometries/PlyGeometryBehavior)\n * behavior on this element to load a set of points from a file for example.\n *\n * @extends Element3D\n */\nexport\n@element('lume-points', autoDefineElements)\nclass Points extends Element3D {\n\toverride initialBehaviors = {geometry: 'box', material: 'points'}\n\n\toverride makeThreeObject3d() {\n\t\treturn new ThreePoints()\n\t}\n}\n\nexport interface Points extends ElementWithBehaviors {}\n\ntype BehaviorInstanceTypes = PointsMaterialBehavior &\n\tPhongMaterialBehavior &\n\tLambertMaterialBehavior &\n\tClipPlanesBehavior\n\ntype BehaviorAttributes =\n\t| PointsMaterialBehaviorAttributes\n\t| PhongMaterialBehaviorAttributes\n\t| LambertMaterialBehaviorAttributes\n\t| ClipPlanesBehaviorAttributes\n\ndeclare module 'solid-js' {\n\tnamespace JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t'lume-points': ElementAttributes\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'lume-points': Points\n\t}\n}\n", "import { BufferAttribute } from './BufferAttribute.js';\n\nclass InstancedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, itemSize, normalized );\n\n\t\tthis.isInstancedBufferAttribute = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nexport { InstancedBufferAttribute };\n", "import { InstancedBufferAttribute } from '../core/InstancedBufferAttribute.js';\nimport { Mesh } from './Mesh.js';\nimport { Box3 } from '../math/Box3.js';\nimport { Matrix4 } from '../math/Matrix4.js';\nimport { Sphere } from '../math/Sphere.js';\n\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _instanceIntersects = [];\n\nconst _box3 = /*@__PURE__*/ new Box3();\nconst _identity = /*@__PURE__*/ new Matrix4();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _sphere = /*@__PURE__*/ new Sphere();\n\nclass InstancedMesh extends Mesh {\n\n\tconstructor( geometry, material, count ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isInstancedMesh = true;\n\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\n\t\tthis.instanceColor = null;\n\n\t\tthis.count = count;\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.setMatrixAt( i, _identity );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingBox.union( _box3 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_sphere.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\n\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\n\n\t\tthis.count = source.count;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( index, color ) {\n\n\t\tcolor.fromArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tgetMatrixAt( index, matrix ) {\n\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst raycastTimes = this.count;\n\n\t\t_mesh.geometry = this.geometry;\n\t\t_mesh.material = this.material;\n\n\t\tif ( _mesh.material === undefined ) return;\n\n\t\t// test with bounding sphere first\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere.copy( this.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t// now test each instance\n\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\n\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\n\t\t\t\tintersect.instanceId = instanceId;\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_instanceIntersects.length = 0;\n\n\t\t}\n\n\t}\n\n\tsetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );\n\n\t\t}\n\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tsetMatrixAt( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nexport { InstancedMesh };\n", "import { BufferGeometry } from '../core/BufferGeometry.js';\nimport { Float32BufferAttribute } from '../core/BufferAttribute.js';\nimport { Vector3 } from '../math/Vector3.js';\n\nclass BoxGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tconst scope = this;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\t\tdepthSegments = Math.floor( depthSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet numberOfVertices = 0;\n\t\tlet groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tconst segmentWidth = width / gridX;\n\t\t\tconst segmentHeight = height / gridY;\n\n\t\t\tconst widthHalf = width / 2;\n\t\t\tconst heightHalf = height / 2;\n\t\t\tconst depthHalf = depth / 2;\n\n\t\t\tconst gridX1 = gridX + 1;\n\t\t\tconst gridY1 = gridY + 1;\n\n\t\t\tlet vertexCounter = 0;\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\n\n\t}\n\n}\n\nexport { BoxGeometry };\n", "import {stringToArray} from '../xyz-values/utils.js'\n\nexport function stringToNumberArray(v: number[] | string, prop: string): number[] {\n\tif (typeof v === 'string') {\n\t\t// Deserialize an attribute string like \"12 23 34, 23 34 45, 56 34 12\"\n\t\tv = stringToArray(v).map(str => parseFloat(str))\n\t}\n\n\t// @prod-prune\n\tfor (let i = 0, l = v.length; i < l; i += 1) {\n\t\tif (isNaN(v[i])) throw new TypeError(`Array for property \"${prop}\" should have numbers only.`)\n\t}\n\n\treturn v\n}\n", "const tasks = new Set<() => void>()\nlet microtask = false\n\n/**\n * Like queueMicrotask, except it will not allow the same function to be queued\n * more than once.\n *\n * Example:\n *\n * ```js\n * const logFoo = () => console.log('foo')\n *\n * // \"foo\" will be logged one time in the next microtask.\n * queueMicrotaskOnceOnly(logFoo)\n * queueMicrotaskOnceOnly(logFoo)\n * queueMicrotaskOnceOnly(logFoo)\n * queueMicrotaskOnceOnly(logFoo)\n * ```\n */\nexport function queueMicrotaskOnceOnly(task: () => void) {\n\ttasks.add(task)\n\tif (microtask) return\n\tmicrotask = true\n\n\tqueueMicrotask(() => {\n\t\tmicrotask = false\n\n\t\t// Grab the items, then clear the set before running tasks, so that we\n\t\t// allow tasks to queue again for the next microtask.\n\t\tconst _tasks = [...tasks]\n\t\ttasks.clear()\n\n\t\tfor (const task of _tasks) task()\n\t})\n}\n", "import {batch, untrack} from 'solid-js'\nimport {element, numberAttribute, stringAttribute, type ElementAttributes} from '@lume/element'\nimport {InstancedMesh as ThreeInstancedMesh} from 'three/src/objects/InstancedMesh.js'\nimport {BoxGeometry} from 'three/src/geometries/BoxGeometry.js'\nimport {MeshPhongMaterial} from 'three/src/materials/MeshPhongMaterial.js'\nimport {DynamicDrawUsage} from 'three/src/constants.js'\nimport {Quaternion} from 'three/src/math/Quaternion.js'\nimport {Vector3} from 'three/src/math/Vector3.js'\nimport {Color} from 'three/src/math/Color.js'\nimport {Matrix4} from 'three/src/math/Matrix4.js'\nimport {Euler} from 'three/src/math/Euler.js'\nimport {Mesh, type MeshAttributes} from './Mesh.js'\nimport {autoDefineElements} from '../LumeConfig.js'\nimport {stringToNumberArray} from './utils.js'\nimport {queueMicrotaskOnceOnly} from '../utils/queueMicrotaskOnceOnly.js'\n\nimport type {GeometryBehavior, MaterialBehavior} from '../behaviors/index.js'\n\nexport type InstancedMeshAttributes = MeshAttributes | 'count' | 'rotations' | 'positions' | 'scales' | 'colors'\n\nconst _quat = new Quaternion()\nconst _pos = new Vector3()\nconst _scale = new Vector3()\nconst _pivot = new Vector3()\nconst _mat = new Matrix4()\nconst _rot = new Euler()\nconst _color = new Color()\n\n// const threeJsPostAdjustment = [0, 0, 0]\n// const alignAdjustment = [0, 0, 0]\n// const mountPointAdjustment = [0, 0, 0]\nconst appliedPosition = [0, 0, 0]\n\n/**\n * @element lume-instanced-mesh\n * @class InstancedMesh - This is similar to Mesh, but renders multiple\n * \"instances\" of a geometry (insead of only one) with a single draw call to\n * the GPU, as if all the instances were a single geometry. This is more\n * efficient in cases where multiple objects to be rendered are similar\n * (share the same geometry and material). Rendering multiple similar objects\n * as separate Mesh instances would otherwise incur one draw call to the GPU\n * per mesh which will be slower.\n *\n * For sake of simplicity, `` has a box-geometry and\n * phong-material by default.\n *\n * ## Example\n *\n * \n * \n *\n * @extends Mesh\n *\n */\nexport\n@element('lume-instanced-mesh', autoDefineElements)\nclass InstancedMesh extends Mesh {\n\t/**\n\t * @property {number} count - The number of instances to render.\n\t */\n\t@numberAttribute count = 10\n\n\t#biggestCount = this.count\n\n\t/**\n\t * @property {number[]} rotations - The rotations for each instance.\n\t * Generally the array should have a length of `this.count * 3` because\n\t * each rotation consists of three numbers for X, Y, and Z axes. Every three\n\t * numbers is one X,Y,Z triplet. If the array has less rotations than\n\t * `this.count`, the missing rotations will be considered to have\n\t * values of zero. If it has more than `this.count` rotations, those\n\t * rotations are ignored.\n\t */\n\t@stringAttribute\n\tget rotations(): number[] {\n\t\treturn this.#rotations\n\t}\n\tset rotations(v: number[] | string) {\n\t\tthis.#rotations = stringToNumberArray(v, 'rotations')\n\t}\n\n\t#rotations: number[] = []\n\n\t/**\n\t * @property {number[]} positions - The positions for each instance.\n\t * Generally the array should have a length of `this.count * 3` because\n\t * each rotation consists of three numbers for X, Y, and Z axes. Every three\n\t * numbers is one X,Y,Z triplet. If the array has less positions than\n\t * `this.count`, the missing positions will be considered to have\n\t * values of zero. If it has more than `this.count` positions, those\n\t * positions are ignored.\n\t */\n\t@stringAttribute\n\tget positions() {\n\t\treturn this.#positions\n\t}\n\tset positions(v: number[]) {\n\t\tthis.#positions = stringToNumberArray(v, 'positions')\n\t}\n\n\t#positions: number[] = []\n\n\t/**\n\t * @property {number[]} scales - The scales for each instance.\n\t * Generally the array should have a length of `this.count * 3` because\n\t * each rotation consists of three numbers for X, Y, and Z axes. Every three\n\t * numbers is one X,Y,Z triplet. If the array has less scales than\n\t * `this.count`, the missing scales will be considered to have\n\t * values of zero. If it has more than `this.count` scales, those\n\t * scales are ignored.\n\t */\n\t@stringAttribute\n\tget scales() {\n\t\treturn this.#scales\n\t}\n\tset scales(v: number[]) {\n\t\tthis.#scales = stringToNumberArray(v, 'scales')\n\t}\n\n\t#scales: number[] = []\n\n\t/**\n\t * @property {number[]} colors - The colors for each instance.\n\t * Generally the array should have a length of `this.count * 3` because\n\t * each rotation consists of three numbers for R, G, and B color components. Every three\n\t * numbers is one R,G,B triplet. If the array has less colors than\n\t * `this.count`, the missing colors will be considered to have\n\t * values of zero (black). If it has more than `this.count` colors, those\n\t * colors are ignored.\n\t */\n\t@stringAttribute\n\tget colors() {\n\t\treturn this.#colors\n\t}\n\tset colors(v: number[]) {\n\t\tthis.#colors = stringToNumberArray(v, 'colors')\n\t}\n\n\t#colors: number[] = []\n\n\toverride initialBehaviors = {geometry: 'box', material: 'physical'}\n\n\t// This class will have a THREE.InstancedMesh for its .three property.\n\toverride makeThreeObject3d() {\n\t\tlet geometryBehavior: GeometryBehavior | null = null\n\t\tlet materialBehavior: MaterialBehavior | null = null\n\n\t\tfor (const [name, behavior] of this.behaviors) {\n\t\t\tif (name.endsWith('-geometry')) geometryBehavior = behavior as GeometryBehavior\n\t\t\telse if (name.endsWith('-material')) materialBehavior = behavior as MaterialBehavior\n\t\t}\n\n\t\t// Use the existing geometry and material from the behaviors in case we are in the recreateThree process.\n\t\tconst mesh = new ThreeInstancedMesh(\n\t\t\tgeometryBehavior?.meshComponent || new BoxGeometry(),\n\t\t\tmaterialBehavior?.meshComponent || new MeshPhongMaterial(),\n\t\t\tthis.#biggestCount,\n\t\t)\n\n\t\t// TODO make this configurable. Most people probably won't care about this.\n\t\tmesh.instanceMatrix.setUsage(DynamicDrawUsage)\n\n\t\tconst original = mesh.setColorAt\n\t\tmesh.setColorAt = function (index, color) {\n\t\t\t// This creates the instanceColor buffer if it doesn't exist.\n\t\t\toriginal.call(mesh, index, color)\n\n\t\t\t// TODO make this configurable. Most people probably won't care about this.\n\t\t\tmesh.instanceColor!.setUsage(DynamicDrawUsage)\n\t\t}\n\n\t\treturn mesh\n\t}\n\n\t#allMatricesNeedUpdate = false\n\t#allColorsNeedUpdate = false\n\t#updateSingleInstanceOnly = false\n\n\tsetInstancePosition(index: number, x: number, y: number, z: number) {\n\t\tconst arrIndex = index * 3\n\n\t\t// Untrack because the purpose of the method is to update this, not read it.\n\t\tuntrack(() => {\n\t\t\tthis.positions[arrIndex] = x\n\t\t\tthis.positions[arrIndex + 1] = y\n\t\t\tthis.positions[arrIndex + 2] = z\n\n\t\t\tthis.#setMatrix(arrIndex)\n\t\t\tthis.three.instanceMatrix.needsUpdate = true\n\t\t})\n\n\t\tqueueMicrotaskOnceOnly(this.#triggerPositions)\n\t}\n\n\t#triggerPositions = () => {\n\t\tthis.#updateSingleInstanceOnly = true\n\t\tthis.positions = this.positions // trigger reactivity\n\t}\n\n\tsetInstanceScale(index: number, x: number, y: number, z: number) {\n\t\tconst arrIndex = index * 3\n\n\t\t// Untrack because the purpose of the method is to update this, not read it.\n\t\tuntrack(() => {\n\t\t\tthis.scales[arrIndex] = x\n\t\t\tthis.scales[arrIndex + 1] = y\n\t\t\tthis.scales[arrIndex + 2] = z\n\n\t\t\tthis.#setMatrix(arrIndex)\n\t\t\tthis.three.instanceMatrix.needsUpdate = true\n\t\t})\n\n\t\tqueueMicrotaskOnceOnly(this.#triggerScales)\n\t}\n\n\t#triggerScales = () => {\n\t\tthis.#updateSingleInstanceOnly = true\n\t\tthis.scales = this.scales // trigger reactivity\n\t}\n\n\tsetInstanceRotation(index: number, x: number, y: number, z: number) {\n\t\tconst arrIndex = index * 3\n\n\t\t// Untrack because the purpose of the method is to update this, not read it.\n\t\tuntrack(() => {\n\t\t\tthis.rotations[arrIndex] = x\n\t\t\tthis.rotations[arrIndex + 1] = y\n\t\t\tthis.rotations[arrIndex + 2] = z\n\n\t\t\tthis.#setMatrix(arrIndex)\n\t\t\tthis.three.instanceMatrix.needsUpdate = true\n\t\t})\n\n\t\tqueueMicrotaskOnceOnly(this.#triggerRotations)\n\t}\n\n\t#triggerRotations = () => {\n\t\tthis.#updateSingleInstanceOnly = true\n\t\tthis.rotations = this.rotations // trigger reactivity\n\t}\n\n\tsetInstanceColor(index: number, r: number, g: number, b: number) {\n\t\tconst arrIndex = index * 3\n\n\t\t// Untrack because the purpose of the method is to update this, not read it.\n\t\tuntrack(() => {\n\t\t\tthis.colors[arrIndex] = r\n\t\t\tthis.colors[arrIndex + 1] = g\n\t\t\tthis.colors[arrIndex + 2] = b\n\t\t})\n\n\t\tthis.#setColor(index, r, g, b)\n\t\tthis.three.instanceColor!.needsUpdate = true\n\n\t\tqueueMicrotaskOnceOnly(this.#triggerColors)\n\t}\n\n\t#triggerColors = () => {\n\t\tthis.#updateSingleInstanceOnly = true\n\t\tthis.colors = this.colors // trigger reactivity\n\t}\n\n\t// TODO Might just be able to set individual components of the matrix\n\t// without recalculating other components (f.e. if only an instance position\n\t// changed but not rotation)\n\t#setMatrix(index: number) {\n\t\t_rot.set(this.rotations[index + 0] ?? 0, this.rotations[index + 1] ?? 0, this.rotations[index + 2] ?? 0)\n\t\t_quat.setFromEuler(_rot)\n\t\t_pos.set(this.positions[index + 0] ?? 0, this.positions[index + 1] ?? 0, this.positions[index + 2] ?? 0)\n\t\t_scale.set(this.scales[index + 0] ?? 1, this.scales[index + 1] ?? 1, this.scales[index + 2] ?? 1)\n\n\t\t// Modifies _mat in place.\n\t\tthis._calculateInstanceMatrix(_pos, _quat, _scale, _pivot, _mat)\n\n\t\tthis.three.setMatrixAt(index / 3, _mat)\n\t}\n\n\t// TODO a colorMode variable can specify whether colors are RGB triplets, or CSS string/hex values.\n\t// TODO Set an update range so that if we're updating only one instance, we're not uploading the whole array each time.\n\t#setColor(index: number, r: number, g: number, b: number) {\n\t\t_color.setRGB(r, g, b)\n\t\tthis.three.setColorAt(index, _color)\n\t}\n\n\tupdateAllMatrices() {\n\t\tfor (let i = 0, l = this.count; i < l; i += 1) this.#setMatrix(i * 3)\n\t\tthis.three.instanceMatrix.needsUpdate = true\n\t}\n\n\tupdateAllColors() {\n\t\tfor (let i = 0, l = this.count; i < l; i += 1) {\n\t\t\tconst j = i * 3\n\t\t\tconst r = this.colors[j + 0] ?? 1\n\t\t\tconst g = this.colors[j + 1] ?? 1\n\t\t\tconst b = this.colors[j + 2] ?? 1\n\n\t\t\tthis.#setColor(i, r, g, b)\n\t\t}\n\n\t\tthis.three.instanceColor!.needsUpdate = true\n\t}\n\n\t/**\n\t * This is very similar to SharedAPI._calculateMatrix, without the threeCSS parts.\n\t */\n\t_calculateInstanceMatrix(pos: Vector3, quat: Quaternion, scale: Vector3, pivot: Vector3, result: Matrix4): void {\n\t\t// const align = new Vector3(0, 0, 0) // TODO\n\t\t// const mountPoint = new Vector3(0, 0, 0) // TODO\n\t\tconst position = pos\n\t\tconst origin = new Vector3(0.5, 0.5, 0.5) // TODO\n\n\t\tconst size = this.calculatedSize\n\n\t\t// In the following commented code, we ignore the\n\t\t// threeJsPostAdjustment, alignAdjustment, and mountPointAdjustment\n\t\t// because the align point and mount point of the instances are\n\t\t// inherited from the IntancedMesh element's positioning. In other\n\t\t// words, the instances are positioned relative to the element's\n\t\t// position, which already has alignPoint and mountPoint factored into\n\t\t// it.\n\t\t// TODO Should we provide the same alignment and mount point API for\n\t\t// instances, and would align point be relative to the InstancedMesh\n\t\t// element (as if instances are sub nodes of the InstancedMesh\n\t\t// element), or to the InstancedMesh element's parent (as if instances\n\t\t// are sub nodes of the parent, just like a single mesh would be)?\n\n\t\t// THREE-COORDS-TO-DOM-COORDS\n\t\t// translate the \"mount point\" back to the top/left/back of the object\n\t\t// (in Three.js it is in the center of the object).\n\t\t// threeJsPostAdjustment[0] = size.x / 2\n\t\t// threeJsPostAdjustment[1] = size.y / 2\n\t\t// threeJsPostAdjustment[2] = size.z / 2\n\n\t\t// const parentSize = this._getParentSize()\n\n\t\t// THREE-COORDS-TO-DOM-COORDS\n\t\t// translate the \"align\" back to the top/left/back of the parent element.\n\t\t// We offset this in ElementOperations#applyTransform. The Y\n\t\t// value is inverted because we invert it below.\n\t\t// threeJsPostAdjustment[0] += -parentSize.x / 2\n\t\t// threeJsPostAdjustment[1] += -parentSize.y / 2\n\t\t// threeJsPostAdjustment[2] += -parentSize.z / 2\n\n\t\t// alignAdjustment[0] = parentSize.x * align.x\n\t\t// alignAdjustment[1] = parentSize.y * align.y\n\t\t// alignAdjustment[2] = parentSize.z * align.z\n\n\t\t// mountPointAdjustment[0] = size.x * mountPoint.x\n\t\t// mountPointAdjustment[1] = size.y * mountPoint.y\n\t\t// mountPointAdjustment[2] = size.z * mountPoint.z\n\n\t\tappliedPosition[0] = position.x /*+ alignAdjustment[0] - mountPointAdjustment[0]*/\n\t\tappliedPosition[1] = position.y /*+ alignAdjustment[1] - mountPointAdjustment[1]*/\n\t\tappliedPosition[2] = position.z /*+ alignAdjustment[2] - mountPointAdjustment[2]*/\n\n\t\t// NOTE We negate Y translation in several places below so that Y\n\t\t// goes downward like in DOM's CSS transforms.\n\n\t\tposition.set(\n\t\t\tappliedPosition[0] /*+ threeJsPostAdjustment[0]*/,\n\t\t\t// THREE-COORDS-TO-DOM-COORDS negate the Y value so that\n\t\t\t// Three.js' positive Y is downward like DOM.\n\t\t\t-(appliedPosition[1] /*+ threeJsPostAdjustment[1]*/),\n\t\t\tappliedPosition[2] /*+ threeJsPostAdjustment[2]*/,\n\t\t)\n\n\t\tif (origin.x !== 0.5 || origin.y !== 0.5 || origin.z !== 0.5) {\n\t\t\t// Here we multiply by size to convert from a ratio to a range\n\t\t\t// of units, then subtract half because Three.js origin is\n\t\t\t// centered around (0,0,0) meaning Three.js origin goes from\n\t\t\t// -0.5 to 0.5 instead of from 0 to 1.\n\n\t\t\tpivot.set(\n\t\t\t\torigin.x * size.x - size.x / 2,\n\t\t\t\t// THREE-COORDS-TO-DOM-COORDS negate the Y value so that\n\t\t\t\t// positive Y means down instead of up (because Three,js Y\n\t\t\t\t// values go up).\n\t\t\t\t-(origin.y * size.y - size.y / 2),\n\t\t\t\torigin.z * size.z - size.z / 2,\n\t\t\t)\n\t\t}\n\t\t// otherwise, use default Three.js origin of (0,0,0) which is\n\t\t// equivalent to our (0.5,0.5,0.5), by removing the pivot value.\n\t\telse {\n\t\t\tpivot.set(0, 0, 0)\n\t\t}\n\n\t\t// effectively the same as Object3DWithPivot.updateMatrix() {\n\n\t\tresult.compose(position, quat, scale)\n\n\t\tif (pivot.x !== 0 || pivot.y !== 0 || pivot.z !== 0) {\n\t\t\tconst px = pivot.x,\n\t\t\t\tpy = pivot.y,\n\t\t\t\tpz = pivot.z\n\t\t\tconst te = result.elements\n\n\t\t\tte[12] += px - te[0] * px - te[4] * py - te[8] * pz\n\t\t\tte[13] += py - te[1] * px - te[5] * py - te[9] * pz\n\t\t\tte[14] += pz - te[2] * px - te[6] * py - te[10] * pz\n\t\t}\n\n\t\t// }\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\t// Increase the InstancedMesh size (by making a new one) as needed.\n\t\t\tif (this.count > this.#biggestCount) {\n\t\t\t\tthis.#biggestCount = this.count\n\n\t\t\t\tthis.recreateThree()\n\n\t\t\t\t// Be sure to trigger all the instance components so that the new\n\t\t\t\t// InstancedMesh will be up-to-date.\n\t\t\t\tuntrack(() => {\n\t\t\t\t\tbatch(() => {\n\t\t\t\t\t\tthis.rotations = this.rotations\n\t\t\t\t\t\tthis.positions = this.positions\n\t\t\t\t\t\tthis.scales = this.scales\n\t\t\t\t\t\tthis.colors = this.colors\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tuntrack(() => (this.three.count = this.count))\n\n\t\t\tthis.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.rotations\n\t\t\tif (!this.#updateSingleInstanceOnly) this.#allMatricesNeedUpdate = true\n\t\t\tthis.#updateSingleInstanceOnly = false\n\t\t\tthis.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.positions\n\t\t\tif (!this.#updateSingleInstanceOnly) this.#allMatricesNeedUpdate = true\n\t\t\tthis.#updateSingleInstanceOnly = false\n\t\t\tthis.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.scales\n\t\t\tif (!this.#updateSingleInstanceOnly) this.#allMatricesNeedUpdate = true\n\t\t\tthis.#updateSingleInstanceOnly = false\n\t\t\tthis.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.colors\n\t\t\tif (!this.#updateSingleInstanceOnly) this.#allColorsNeedUpdate = true\n\t\t\tthis.#updateSingleInstanceOnly = false\n\t\t\tthis.needsUpdate()\n\t\t})\n\t}\n\n\toverride update(t: number, dt: number) {\n\t\tsuper.update(t, dt)\n\n\t\tif (this.#allMatricesNeedUpdate) {\n\t\t\tthis.#allMatricesNeedUpdate = false\n\t\t\tthis.updateAllMatrices()\n\t\t}\n\t\tif (this.#allColorsNeedUpdate) {\n\t\t\tthis.#allColorsNeedUpdate = false\n\t\t\tthis.updateAllColors()\n\t\t}\n\t}\n}\n\ndeclare module 'solid-js' {\n\tnamespace JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t'lume-instanced-mesh': ElementAttributes\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'lume-instanced-mesh': InstancedMesh\n\t}\n}\n", "import { Material } from './Material.js';\nimport { Color } from '../math/Color.js';\n\nclass LineBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineBasicMaterial = true;\n\n\t\tthis.type = 'LineBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.linewidth = 1;\n\t\tthis.linecap = 'round';\n\t\tthis.linejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.linewidth = source.linewidth;\n\t\tthis.linecap = source.linecap;\n\t\tthis.linejoin = source.linejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { LineBasicMaterial };\n", "import { Sphere } from '../math/Sphere.js';\nimport { Ray } from '../math/Ray.js';\nimport { Matrix4 } from '../math/Matrix4.js';\nimport { Object3D } from '../core/Object3D.js';\nimport { Vector3 } from '../math/Vector3.js';\nimport { LineBasicMaterial } from '../materials/LineBasicMaterial.js';\nimport { BufferGeometry } from '../core/BufferGeometry.js';\nimport { Float32BufferAttribute } from '../core/BufferAttribute.js';\n\nconst _start = /*@__PURE__*/ new Vector3();\nconst _end = /*@__PURE__*/ new Vector3();\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\n\nclass Line extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isLine = true;\n\n\t\tthis.type = 'Line';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [ 0 ];\n\n\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t_start.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_end.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _start.distanceTo( _end );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Line.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst vStart = new Vector3();\n\t\tconst vEnd = new Vector3();\n\t\tconst interSegment = new Vector3();\n\t\tconst interRay = new Vector3();\n\t\tconst step = this.isLineSegments ? 2 : 1;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst a = index.getX( i );\n\t\t\t\tconst b = index.getX( i + 1 );\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, a );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, b );\n\n\t\t\t\tconst distSq = _ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, i );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tconst distSq = _ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nexport { Line };\n", "import {element, type ElementAttributes} from '@lume/element'\nimport {Line as ThreeLine} from 'three/src/objects/Line.js'\nimport {Element3D} from '../core/Element3D.js'\nimport {autoDefineElements} from '../LumeConfig.js'\nimport type {Element3DAttributes} from '../core/Element3D.js'\nimport type {ElementWithBehaviors} from '../behaviors/ElementWithBehaviors.js'\nimport type {\n\tClipPlanesBehavior,\n\tClipPlanesBehaviorAttributes,\n\tLineBasicMaterialBehavior,\n\tLineBasicMaterialBehaviorAttributes,\n\tLineGeometryBehavior,\n\tLineGeometryBehaviorAttributes,\n} from '../behaviors/index.js'\n\nexport type LineAttributes = Element3DAttributes | BehaviorAttributes\n\n/**\n * @class Line - Renders a line based on a sequence of points.\n *\n * Element: ``\n *\n * Default behaviors:\n *\n * - [`line-geometry`](../behaviors/mesh-behaviors/geometries/LineGeometryBehavior.md)\n * - [`line-material`](../behaviors/mesh-behaviors/materials/LineBasicMaterialBehavior.md)\n *\n * It can be useful to have\n * [`ply-geometry`](../behaviors/mesh-behaviors/geometries/PlyGeometryBehavior)\n * behavior on this element to load a set of points from a file.\n *\n * \n * \n *\n * @extends Element3D\n */\n@element('lume-line', autoDefineElements)\nexport class Line extends Element3D {\n\toverride initialBehaviors = {geometry: 'line', material: 'line'}\n\n\toverride makeThreeObject3d() {\n\t\treturn new ThreeLine()\n\t}\n}\n\nexport interface Line extends ElementWithBehaviors {}\n\ntype BehaviorInstanceTypes = LineBasicMaterialBehavior & LineGeometryBehavior & ClipPlanesBehavior\n\ntype BehaviorAttributes =\n\t| LineBasicMaterialBehaviorAttributes\n\t| LineGeometryBehaviorAttributes\n\t| ClipPlanesBehaviorAttributes\n\ndeclare module 'solid-js' {\n\tnamespace JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t'lume-line': ElementAttributes\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'lume-line': Line\n\t}\n}\n", "import {signal} from 'classy-solid'\nimport {behavior} from '../Behavior.js'\nimport {RenderableBehavior} from '../RenderableBehavior.js'\nimport {Mesh} from '../../meshes/Mesh.js'\nimport {Points} from '../../meshes/Points.js'\nimport {InstancedMesh} from '../../meshes/InstancedMesh.js'\nimport {Line} from '../../meshes/Line.js'\n\nimport type {BufferGeometry, Material} from 'three'\n\nexport type MeshComponentType = 'geometry' | 'material'\n\n/**\n * @class MeshBehavior\n *\n * @extends RenderableBehavior\n */\nexport\n@behavior\nabstract class MeshBehavior extends RenderableBehavior {\n\tdeclare element: Mesh | Points | InstancedMesh | Line\n\n\toverride requiredElementType(): (typeof Mesh | typeof Points | typeof InstancedMesh | typeof Line)[] {\n\t\t// At the moment, a \"mesh\" behavior can be used on Mesh, Points, or anything that has a geometry and a material.\n\t\t// XXX An alternative to using arrays with multiple types is we could branch the class\n\t\t// hierarchy to avoid arrays/unions.\n\t\treturn [Mesh, Points, InstancedMesh, Line]\n\t}\n\n\t/**\n\t * @protected\n\t * @method _createComponent -\n\t * Subclasses override this to create either a Material or a BufferGeometry.\n\t * It is reactive, any reactive dependencies used in here will cause\n\t * re-creation of the instance. Use `untrack` for cases where a dependency\n\t * should not re-create the instance (in that case an additional effect may\n\t * update the instance instead, while in other cases constructing a new\n\t * object is the only (or easier) way).\n\t *\n\t * @returns {BufferGeometry | Material}\n\t */\n\t_createComponent(): BufferGeometry | Material {\n\t\tthrow new Error('`_createComponent()` is not implemented by subclass.')\n\t}\n\n\t/**\n\t * The component that this behavior manages, either a Material, or a\n\t * BufferGeometry.\n\t */\n\t@signal meshComponent: ReturnType | null = null\n}\n", "import { Matrix3 } from './Matrix3.js';\nimport { Vector3 } from './Vector3.js';\n\nconst _vector1 = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector3();\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\n\nclass Plane {\n\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\n\n\t\tthis.isPlane = true;\n\n\t\t// normal is assumed to be normalized\n\n\t\tthis.normal = normal;\n\t\tthis.constant = constant;\n\n\t}\n\n\tset( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponents( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCoplanarPoints( a, b, c ) {\n\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t}\n\n\tnormalize() {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.constant *= - 1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t}\n\n\tdistanceToSphere( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t}\n\n\tprojectPoint( point, target ) {\n\n\t\treturn target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );\n\n\t}\n\n\tintersectLine( line, target ) {\n\n\t\tconst direction = line.delta( _vector1 );\n\n\t\tconst denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( t < 0 || t > 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn target.copy( line.start ).addScaledVector( direction, t );\n\n\t}\n\n\tintersectsLine( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tconst startSign = this.distanceToPoint( line.start );\n\t\tconst endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t}\n\n\tcoplanarPoint( target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t}\n\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\n\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tequals( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nexport { Plane };\n", "// Useful info on THREE.Plane not covered in Three.js docs:\n// https://www.columbia.edu/~njn2118/journal/2019/2/18.html\n\nimport {element, type ElementAttributes} from '@lume/element'\nimport {Plane} from 'three/src/math/Plane.js'\nimport {Vector3} from 'three/src/math/Vector3.js'\nimport {Element3D, type Element3DAttributes} from './Element3D.js'\nimport {autoDefineElements} from '../LumeConfig.js'\n\n// Make the clip plane clip anything in front of it (towards the default\n// camera). Three.js clips anything along -Z, so we negate Z to clip along +Z\n// towards the camera by default.\nconst clipNormal: [number, number, number] = [0, 0, -1]\n\nexport type ClipPlaneAttributes = Element3DAttributes\n\n/**\n * @class ClipPlane\n *\n * Element: `lume-clip-plane`\n *\n * An non-rendered plane that can be placed anywhere in 3D space to clip an\n * element on one side of the plane. The plane is infinite.\n *\n * To visualize a portion of the plane, we can place a `` as a\n * child of a ``, as in the below example.\n *\n * To clip an element, add a\n * [`clip-planes`](../behaviors/mesh-behaviors/ClipPlanesBehavior) behavior to the\n * element with the `has=\"\"` attribute, then assign any number of connected\n * `` elements to the element's `clipPlanes` property.\n *\n * \n * \n *\n * @extends Element3D\n */\nexport\n@element('lume-clip-plane', autoDefineElements)\nclass ClipPlane extends Element3D {\n\t// The __clip and __inverseClip properties are used by `ClipPlanesBehavior`\n\n\t/**\n\t * *reactive* *readonly*\n\t *\n\t * Returns the underlying `THREE.Plane` if applicable: when WebGL rendering is enabled\n\t * for the scene and the element participates in rendering.\n\t */\n\t__clip: Plane = new Plane(new Vector3(...clipNormal))\n\n\t/**\n\t * *reactive* *readonly*\n\t *\n\t * Returns the inverse underlying `THREE.Plane` if applicable: when WebGL rendering is enabled\n\t * for the scene and the element participates in rendering.\n\t */\n\t__inverseClip: Plane = new Plane(new Vector3(...clipNormal).negate())\n\n\toverride updateWorldMatrices() {\n\t\tsuper.updateWorldMatrices()\n\n\t\tconst plane = this.__clip\n\t\tconst inverse = this.__inverseClip\n\n\t\t// These only exist if WebGL mode is enabled.\n\t\tif (!plane || !inverse) return\n\n\t\tplane.normal.set(...clipNormal)\n\t\tplane.constant = 0\n\t\tinverse.normal.set(...clipNormal).negate()\n\t\tinverse.constant = 0\n\n\t\t// Clip planes are world-positioned.\n\t\tplane.applyMatrix4(this.three.matrixWorld)\n\t\tinverse.applyMatrix4(this.three.matrixWorld)\n\t}\n}\n\ndeclare module 'solid-js' {\n\tnamespace JSX {\n\t\tinterface IntrinsicElements {\n\t\t\t'lume-clip-plane': ElementAttributes\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'lume-clip-plane': ClipPlane\n\t}\n}\n", "import {createEffect, onCleanup} from 'solid-js'\n// import {stringAttribute, booleanAttribute} from '../attribute.js'\nimport {stringAttribute, booleanAttribute} from '@lume/element'\nimport {behavior} from '../Behavior.js'\nimport {receiver} from '../PropReceiver.js'\nimport {ClipPlane} from '../../core/ClipPlane.js'\nimport {MeshBehavior} from './MeshBehavior.js'\nimport type {MaterialBehavior} from './index.js'\nimport type {Scene} from '../../core/Scene.js'\n\nexport type ClipPlanesBehaviorAttributes =\n\t| 'clipPlanes'\n\t| 'clipIntersection'\n\t| 'clipShadows'\n\t| 'flipClip'\n\t| 'clipDisabled'\n\nlet refCount = 0\n\n/**\n * @class ClipPlanesBehavior\n *\n * When applied to an element with GL content, allows specifying one or more\n * [``](../../core/ClipPlane) elements to clip the content with.\n *\n * This class extends from `MeshBehavior`, enforcing that the behavior can be used\n * only on elements that have a geometry and material.\n *\n * \n * \n *\n * @extends MeshBehavior\n */\nexport\n@behavior\nclass ClipPlanesBehavior extends MeshBehavior {\n\t/**\n\t * @property {boolean} clipIntersection\n\t *\n\t * `attribute`\n\t *\n\t * Default: 'false'\n\t *\n\t * Changes the behavior of clipping planes so that only their intersection\n\t * is clipped, rather than their union.\n\t */\n\t@booleanAttribute @receiver clipIntersection = false\n\n\t/**\n\t * @property {boolean} clipShadows\n\t *\n\t * `attribute`\n\t *\n\t * Default: `false`\n\t *\n\t * Defines whether to clip shadows\n\t * according to the clipping planes specified on this material. Default is\n\t * false.\n\t */\n\t@booleanAttribute @receiver clipShadows = true\n\n\t// TODO reactive array?\n\t#clipPlanes: Array = []\n\t#rawClipPlanes: string | Array = []\n\n\t/**\n\t * @property {string | Array} clipPlanes\n\t *\n\t * *attribute*\n\t *\n\t * Default: `[]`\n\t *\n\t * The `clip-planes` attribute accepts one or more selectors, comma\n\t * separated, that define which [``](../../core/ClipPlane)\n\t * elements are to be used as clip planes. If a selector matches an element\n\t * that is not a ``, it is ignored. If a selector matches\n\t * more than one element, all of them that are clip planes are used.\n\t *\n\t * ```html\n\t * \n\t * ```\n\t *\n\t * The property can also be set with a string (comma separated selectors),\n\t * or a mixed array of strings (selectors) or `` element\n\t * instances.\n\t *\n\t * ```js\n\t * el.clipPlanes = \".some-plane\"\n\t * // or\n\t * const plane = document.querySelector('.some-clip-plane')\n\t * el.clipPlanes = [plane, \"#someOtherPlane\"]\n\t * ```\n\t *\n\t * The property getter returns the currently applicable collection of\n\t * `` instances, not the original string or array of values\n\t * passed into the attribute or setter. Applicable planes are those that are\n\t * connected into the document, and that participate in rendering (composed,\n\t * either in the top level document, in a ShadowRoot, or distributed to a\n\t * slot in a ShadowRoot).\n\t */\n\t// TODO #279, move setter logic into an effect like we did with ProjectedMaterialBehavior.\n\t@stringAttribute\n\t@receiver\n\tget clipPlanes(): Array {\n\t\treturn this.#clipPlanes\n\t}\n\tset clipPlanes(value: string | Array) {\n\t\tthis.#rawClipPlanes = value\n\n\t\tlet array: Array = []\n\n\t\tif (typeof value === 'string') {\n\t\t\tarray = [value.trim()]\n\t\t} else if (Array.isArray(value)) {\n\t\t\tarray = value\n\t\t} else {\n\t\t\tthrow new TypeError('Invalid value for clipPlanes')\n\t\t}\n\n\t\tthis.#clipPlanes = []\n\n\t\tfor (const v of array) {\n\t\t\tif (typeof v !== 'string') {\n\t\t\t\t// TODO #279: This setter is non-reactive to v.scene, so it will\n\t\t\t\t// not update if the element becomes composed into a Lume scene.\n\t\t\t\tif (v instanceof ClipPlane && v.scene) this.#clipPlanes.push(v)\n\t\t\t\tcontinue\n\t\t\t} else if (!v) {\n\t\t\t\t// skip empty strings, they cause an error with querySelectorAll\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlet root = this.element.getRootNode() as Document | ShadowRoot | null\n\n\t\t\t// TODO Should we not search up the composed tree, and stay only\n\t\t\t// in the current ShadowRoot?\n\n\t\t\twhile (root) {\n\t\t\t\tconst els = root.querySelectorAll(v)\n\n\t\t\t\tfor (let i = 0, l = els.length; i < l; i += 1) {\n\t\t\t\t\tconst el = els.item(i) as Element | null\n\n\t\t\t\t\tif (!el) continue\n\n\t\t\t\t\t// Find only planes participating in rendering (i.e. in the\n\t\t\t\t\t// composed tree, noting that .scene is null when not\n\t\t\t\t\t// composed)\n\t\t\t\t\t// TODO #279: This setter is non-reactive to el.scene, so it will\n\t\t\t\t\t// not update if the element becomes composed into a Lume scene.\n\t\t\t\t\tif (el instanceof ClipPlane && el.scene) this.#clipPlanes.push(el)\n\n\t\t\t\t\t// TODO check the target is in the same scene\n\t\t\t\t\t// TODO We aren't observing el.scene, so if the element\n\t\t\t\t\t// becomes a particpant in the scene later nothing will\n\t\t\t\t\t// happen.\n\t\t\t\t\t// TODO If an element was not yet upgraded, it will not\n\t\t\t\t\t// be found here. We need to wait for upgrade.\n\t\t\t\t\t// TODO We need to also react to added/removed elements.\n\t\t\t\t}\n\n\t\t\t\troot = root instanceof ShadowRoot ? (root.host.getRootNode() as Document | ShadowRoot) : null\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @property {boolean} flipClip\n\t *\n\t * *attribute*\n\t *\n\t * Default: `false`\n\t *\n\t * By default, the side of a plane that is clipped is in its positive Z\n\t * direction. Setting this to `true` will reverse clipping to the other\n\t * side.\n\t */\n\t@booleanAttribute @receiver flipClip = false\n\n\t/**\n\t * @property {boolean} clipDisabled\n\t *\n\t * *attribute*\n\t *\n\t * Default: `false`\n\t *\n\t * If `true`, clipping is not applied.\n\t */\n\t@booleanAttribute @receiver clipDisabled = false\n\n\t/**\n\t * `reactive`\n\t */\n\tget material() {\n\t\tconst mat = this.element.behaviors.find(name => name.endsWith('-material')) as MaterialBehavior | null\n\t\treturn mat?.meshComponent ?? null\n\t}\n\n\t#observer: MutationObserver | null = null\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tlet lastScene: Scene | null = null\n\n\t\tthis.createEffect(() => {\n\t\t\tif (!this.element.scene) return\n\n\t\t\tlastScene = this.element.scene\n\n\t\t\t// Trigger the setter again in case it returned early if there was\n\t\t\t// no scene. Depending on code load order, el.scene inside of set\n\t\t\t// clipPlanes might be null despite that it is a valid Lume element.\n\t\t\t// TODO #279: Instead of this hack, move away\n\t\t\t// from getters/setters, make all logic fully reactive to avoid\n\t\t\t// worrying about code execution order. https://github.com/lume/lume/issues/279\n\t\t\tthis.clipPlanes = this.#rawClipPlanes\n\n\t\t\tif (!refCount) this.element.scene.__localClipping = true\n\t\t\trefCount++\n\n\t\t\t// TODO we need to observe all the way up the composed tree, or we\n\t\t\t// should make the querying scoped only to the nearest root, for\n\t\t\t// consistency. This covers most cases, for now.\n\t\t\tthis.#observer = new MutationObserver(() => {\n\t\t\t\t// TODO this could be more efficient if we check the added nodes directly, but for now we re-run the query logic.\n\t\t\t\t// This triggers the setter logic.\n\t\t\t\tthis.clipPlanes = this.#rawClipPlanes\n\t\t\t})\n\n\t\t\tthis.#observer.observe(this.element.getRootNode(), {childList: true, subtree: true})\n\n\t\t\tcreateEffect(() => {\n\t\t\t\tconst {clipPlanes, clipIntersection, clipShadows, flipClip} = this\n\n\t\t\t\tconst mat = this.material\n\t\t\t\tif (!mat) return\n\n\t\t\t\tthis.element.needsUpdate()\n\n\t\t\t\tif (!clipPlanes.length || this.clipDisabled) {\n\t\t\t\t\tmat.clippingPlanes = null\n\n\t\t\t\t\t// FIXME upstream: don't forget this or Three.js has a bug that\n\t\t\t\t\t// still attempts to perform clipping even if clippingPlanes is\n\t\t\t\t\t// null. https://github.com/munrocket/three.js/pull/5\n\t\t\t\t\tmat.clipShadows = false\n\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif (!mat.clippingPlanes) mat.clippingPlanes = []\n\n\t\t\t\tmat.clippingPlanes.length = 0\n\t\t\t\tmat.clipIntersection = clipIntersection\n\t\t\t\tmat.clipShadows = clipShadows\n\n\t\t\t\tfor (const plane of clipPlanes) {\n\t\t\t\t\tmat.clippingPlanes.push(flipClip ? plane.__inverseClip : plane.__clip)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tonCleanup(() => {\n\t\t\t\tthis.#observer?.disconnect()\n\t\t\t\tthis.#observer = null\n\n\t\t\t\trefCount--\n\t\t\t\tif (!refCount) lastScene!.__localClipping = false\n\t\t\t\tlastScene = null\n\t\t\t})\n\t\t})\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('clip-planes'))\n\telementBehaviors.define('clip-planes', ClipPlanesBehavior)\n", "import {untrack, onCleanup} from 'solid-js'\nimport {MeshBehavior, type MeshComponentType} from './MeshBehavior.js'\n\nimport type {Material} from 'three/src/materials/Material.js'\nimport type {BufferGeometry} from 'three/src/core/BufferGeometry.js'\n\n/**\n * @class GeometryOrMaterialBehavior\n * Abstract base class for Geometry and Material behaviors, not intended for direct use.\n *\n * Subclasses should implement:\n * _createComponent() - return a BufferGeometry or Material instance.\n *\n * @extends MeshBehavior\n */\nexport abstract class GeometryOrMaterialBehavior extends MeshBehavior {\n\tabstract type: MeshComponentType\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => this.resetMeshComponent())\n\t}\n\n\tresetMeshComponent(): void {\n\t\tthis.#setMeshComponent()\n\t\tthis.element.needsUpdate()\n\n\t\tonCleanup(this.#disposeMeshComponent)\n\t}\n\n\toverride _createComponent(): BufferGeometry | Material {\n\t\tthrow new Error('`_createComponent()` is not implemented by subclass.')\n\t}\n\n\t// records the initial size of the geometry, so that we have a\n\t// reference for how much scale to apply when accepting new sizes from\n\t// the user.\n\t// TODO\n\t// #initialSize: null,\n\n\t#disposeMeshComponent = () => {\n\t\t// TODO handle material arrays\n\t\tthis.meshComponent?.dispose()\n\t\tthis.meshComponent = null\n\t}\n\n\t#setMeshComponent() {\n\t\tconst newComponent = this._createComponent()\n\n\t\t// untrack in case we make .three reactive later\n\t\tuntrack(() => {\n\t\t\t// @ts-expect-error FIXME\n\t\t\tthis.element.three[this.type] = newComponent\n\t\t})\n\n\t\t// @ts-expect-error\n\t\tthis.meshComponent = newComponent\n\t}\n}\n", "import {BufferGeometry} from 'three/src/core/BufferGeometry.js'\nimport {GeometryOrMaterialBehavior} from '../GeometryOrMaterialBehavior.js'\n\nimport type {MeshComponentType} from '../MeshBehavior.js'\n\n/**\n * @class GeometryBehavior -\n * An abstract base class for geometry behaviors.\n *\n * This implements `GeometryOrMaterialBehavior._createComponent` to return a\n * `THREE.BufferGeometry` by default.\n *\n * @extends GeometryOrMaterialBehavior\n */\nexport abstract class GeometryBehavior extends GeometryOrMaterialBehavior {\n\ttype: MeshComponentType = 'geometry'\n\n\tget size() {\n\t\treturn this.element.size\n\t}\n\tset size(val) {\n\t\tthis.element.size = val\n\t}\n\n\tget sizeMode() {\n\t\treturn this.element.sizeMode\n\t}\n\tset sizeMode(val) {\n\t\tthis.element.sizeMode = val\n\t}\n\n\tget geometry() {\n\t\treturn this.meshComponent\n\t}\n\n\toverride _createComponent(): BufferGeometry {\n\t\treturn new BufferGeometry()\n\t}\n}\n", "import 'element-behaviors'\nimport {BoxGeometry} from 'three/src/geometries/BoxGeometry.js'\nimport {GeometryBehavior} from './GeometryBehavior.js'\n\nexport class BoxGeometryBehavior extends GeometryBehavior {\n\toverride _createComponent() {\n\t\treturn new BoxGeometry(this.element.calculatedSize.x, this.element.calculatedSize.y, this.element.calculatedSize.z)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('box-geometry'))\n\telementBehaviors.define('box-geometry', BoxGeometryBehavior)\n", "import {attribute, booleanAttribute, stringAttribute} from '@lume/element'\nimport 'element-behaviors'\nimport {BufferGeometry} from 'three/src/core/BufferGeometry.js'\nimport {Float32BufferAttribute} from 'three/src/core/BufferAttribute.js'\nimport {GeometryBehavior} from './GeometryBehavior.js'\nimport {stringToNumberArray} from '../../../meshes/utils.js'\n// import {handleInvertedGeometry} from './utils/handleInvertedGeometry.js'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\n\nexport type LineGeometryBehaviorAttributes = 'points' | 'centerGeometry' | 'fitment'\n\n/**\n * @class LineGeometryBehavior -\n *\n * Behavior: `line-geometry`\n *\n * Provides a line geometry (series of points) for mesh elements. The\n * [``](../../../meshes/Line.md) element has this behavior on it by\n * default. This is typically paired with\n * [`LineBasicMaterialBehavior`](../materials/LineBasicMaterialBehavior.md).\n *\n * \n * \n *\n * @extends GeometryBehavior\n */\n@behavior\nexport class LineGeometryBehavior extends GeometryBehavior {\n\t#points: number[] = []\n\n\t// TODO see about using shapes, not just points, similar to lume-shape, using Shape.getPoints().\n\n\t/**\n\t * @property {string | number[] | null} points - a set of points for the line. Every three numbers is a point (X, Y, Z).\n\t *\n\t * The getter (i.e. reading the property) always returns an underlying Array\n\t * of numbers.\n\t *\n\t * Setting the property accepts `string`, `number[]`, or `null` values. All\n\t * values are mapped to a single `Array` property (the one returned\n\t * by the getter).\n\t *\n\t * While setting the property triggers reactivity, modifying the\n\t * `Array` returned by the getter does not. In such a case, we can\n\t * execute `el.position = el.position` to trigger reactivity.\n\t * \n\t *\n\t * A string value should be a list of numbers separated by any amount of space\n\t * (commas are optional, for organizational use), every three numbers forming\n\t * one point in the line. Similar to the rest of Lume's coordinate\n\t * system, +X goes rightward, and +Y goes downward.\n\t *\n\t * An number array value is similar to the string value: every three numbers\n\t * form a point in the line.\n\t * \n\t *\n\t * If the string or number array have no points, no line is rendered.\n\t *\n\t * An `Array` value will have its data copied to the underlying\n\t * `Array` returned by the getter, and does not replace the underlying\n\t * `Array`.\n\t * \n\t *\n\t * A value of `null` (or when the attribute is removed) causes no line to be\n\t * rendered.\n\t */\n\t@attribute\n\t@receiver\n\tget points(): number[] {\n\t\treturn this.#points\n\t}\n\tset points(points: string | number[] | null) {\n\t\tif (!points) {\n\t\t\tthis.#points.length = 0\n\t\t} else if (typeof points === 'string' || Array.isArray(points)) {\n\t\t\tconst _points: number[] = typeof points === 'string' ? stringToNumberArray(points, 'points') : points\n\n\t\t\tif (!_points.length) {\n\t\t\t\tthis.#points.length = 0\n\t\t\t} else {\n\t\t\t\tif (_points.length % 3 !== 0) throw new Error('The points array needs to have 3 numbers per point.')\n\n\t\t\t\tif (this.#points.length !== _points.length) this.#points.length = _points.length\n\t\t\t\tfor (let i = 0, l = _points.length; i < l; i += 1) this.#points[i] = _points[i]\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @property {boolean} centerGeometry - When true, centers the line geometry\n\t * around the local origin of the element.\n\t * @default false\n\t */\n\t@booleanAttribute @receiver centerGeometry = false\n\n\t/* TODO\n\t * @property {string} fitment - Determines how to fit the line within the\n\t * size area. This takes the same values as the object-fit CSS property,\n\t * except global values. See\n\t * https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit#values for\n\t * details.\n\t */\n\t@stringAttribute @receiver fitment: 'none' | 'contain' | 'cover' | 'fill' | 'scale-down' = 'none'\n\n\toverride _createComponent() {\n\t\tconst geometry = new BufferGeometry()\n\t\tconst positions = new Float32BufferAttribute(this.points, 3)\n\t\tpositions.needsUpdate = true\n\t\tgeometry.attributes['position'] = positions\n\n\t\tif (this.centerGeometry) geometry.center()\n\n\t\t// Make the line's Y coordinates go downward to match with LUME's coordinate system.\n\t\t// Negative scale throws a lot of things off, causing lighting not to work due to normals going the wrong direction.\n\t\tgeometry.scale(1, -1, 1)\n\t\t// So we have to do the following to reverse the effects geometries with triangle faces:\n\t\t// handleInvertedGeometry(geometry) // But we don't have to do this with lines because they have no faces.\n\n\t\tif (this.fitment === 'none') return geometry\n\n\t\t// TODO de-dupe the following with ShapeGeometryBehavior, perhaps apply generically to all geometries.\n\t\t// TODO Needs to account for Z for any geometry, not just X/Y as with 2D shapes.\n\n\t\t// let minX = Number.MAX_VALUE\n\t\t// let maxX = -Number.MAX_VALUE\n\t\t// let minY = Number.MAX_VALUE\n\t\t// let maxY = -Number.MAX_VALUE\n\n\t\t// const verts = geometry.attributes.position.array\n\t\t// const stride = 3\n\n\t\t// for (let i = 0, l = verts.length / stride; i < l; i++) {\n\t\t// \tconst x = verts[i * stride + 0]\n\t\t// \tconst y = verts[i * stride + 1]\n\t\t// \tif (x < minX) minX = x\n\t\t// \tif (x > maxX) maxX = x\n\t\t// \tif (y < minY) minY = y\n\t\t// \tif (y > maxY) maxY = y\n\t\t// }\n\n\t\t// const shapeSizeX = maxX - minX\n\t\t// const shapeSizeY = maxY - minY\n\n\t\t// const scaleX = shapeSizeX / this.element.calculatedSize.x\n\t\t// const scaleY = shapeSizeY / this.element.calculatedSize.y\n\n\t\t// if (this.fitment === 'fill') return geometry.scale(1 / scaleX, 1 / scaleY, 1)\n\n\t\t// const shapeAspect = shapeSizeX / shapeSizeY\n\t\t// const sizeAspect = this.element.calculatedSize.x / this.element.calculatedSize.y\n\n\t\t// if (this.fitment === 'contain') {\n\t\t// \t// tall\n\t\t// \tif (shapeAspect < sizeAspect) geometry.scale(1 / scaleY, 1 / scaleY, 1)\n\t\t// \t// wide (or equal)\n\t\t// \telse geometry.scale(1 / scaleX, 1 / scaleX, 1)\n\t\t// } else if (this.fitment === 'cover') {\n\t\t// \t// tall\n\t\t// \tif (shapeAspect < sizeAspect) geometry.scale(1 / scaleX, 1 / scaleX, 1)\n\t\t// \t// wide (or equal)\n\t\t// \telse geometry.scale(1 / scaleY, 1 / scaleY, 1)\n\t\t// } else if (this.fitment === 'scale-down') {\n\t\t// \tif (!(shapeSizeX <= this.element.calculatedSize.x && shapeSizeY <= this.element.calculatedSize.y)) {\n\t\t// \t\t// tall\n\t\t// \t\tif (shapeAspect < sizeAspect) geometry.scale(1 / scaleY, 1 / scaleY, 1)\n\t\t// \t\t// wide (or equal)\n\t\t// \t\telse geometry.scale(1 / scaleX, 1 / scaleX, 1)\n\t\t// \t}\n\t\t// }\n\n\t\treturn geometry\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('line-geometry'))\n\telementBehaviors.define('line-geometry', LineGeometryBehavior)\n", "import 'element-behaviors'\nimport {BoxGeometry} from 'three/src/geometries/BoxGeometry.js'\nimport {GeometryBehavior} from './GeometryBehavior.js'\n\n/**\n * @class MixedPlaneGeometryBehavior -\n *\n * Used as the geometry for [``](../../../meshes/MixedPlane)\n * elements. The planes are thin boxes instead of actually planes, otherwise\n * Three.js cannot currently cast shadows from plane geometries.\n *\n * \n *\n * @extends GeometryBehavior\n */\nexport class MixedPlaneGeometryBehavior extends GeometryBehavior {\n\toverride _createComponent() {\n\t\t// We have to use a BoxGeometry instead of a\n\t\t// PlaneGeometry because Three.js is not capable of\n\t\t// casting shadows from Planes, at least until we find\n\t\t// another way. Unfortunately, this increases polygon\n\t\t// count by a factor of 6. See issue\n\t\t// https://github.com/mrdoob/three.js/issues/9315\n\t\treturn new BoxGeometry(this.element.calculatedSize.x, this.element.calculatedSize.y, 1)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('mixedplane-geometry'))\n\telementBehaviors.define('mixedplane-geometry', MixedPlaneGeometryBehavior)\n", "import { BufferGeometry } from '../core/BufferGeometry.js';\nimport { Float32BufferAttribute } from '../core/BufferAttribute.js';\n\nclass PlaneGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PlaneGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments\n\t\t};\n\n\t\tconst width_half = width / 2;\n\t\tconst height_half = height / 2;\n\n\t\tconst gridX = Math.floor( widthSegments );\n\t\tconst gridY = Math.floor( heightSegments );\n\n\t\tconst gridX1 = gridX + 1;\n\t\tconst gridY1 = gridY + 1;\n\n\t\tconst segment_width = width / gridX;\n\t\tconst segment_height = height / gridY;\n\n\t\t//\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\tconst y = iy * segment_height - height_half;\n\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\tconst x = ix * segment_width - width_half;\n\n\t\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\tconst a = ix + gridX1 * iy;\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\n\n\t}\n\n}\n\nexport { PlaneGeometry };\n", "import 'element-behaviors'\nimport {PlaneGeometry} from 'three/src/geometries/PlaneGeometry.js'\nimport {numberAttribute} from '@lume/element'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {GeometryBehavior} from './GeometryBehavior.js'\n\n/**\n * @class PlaneGeometryBehavior -\n *\n * Behavior: `plane-geometry`\n *\n * Makes a flat rectangle-shaped geometry on a [``](../../../meshes/Mesh)\n * element. This is the default geometry behavior on\n * [``](../../../meshes/Plane) elements.\n *\n * The size of the sphere is determined by the `x` and `y`\n * [`size`](../../../core/Sizeable#size) of the element.\n *\n * @extends GeometryBehavior\n * @behavior plane-geometry TODO @behavior jsdoc tag\n */\nexport\n@behavior\nclass PlaneGeometryBehavior extends GeometryBehavior {\n\t/**\n\t * @property {number} widthSegments -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `1`\n\t *\n\t * The number of divisions across the width of the plane. A plane with 10\n\t * width segments and 10 height segments is essentially made up of 100 cells\n\t * (or 10 rows and 10 columns of smaller planes)\n\t */\n\t@numberAttribute @receiver widthSegments = 1\n\n\t/**\n\t * @property {number} heightSegments -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `1`\n\t *\n\t * The number of divisions across the height of the plane. A plane with 10\n\t * width segments and 10 height segments is essentially made up of 100 cells\n\t * (or 10 rows and 10 columns of smaller planes)\n\t */\n\t@numberAttribute @receiver heightSegments = 1\n\n\toverride _createComponent() {\n\t\treturn new PlaneGeometry(\n\t\t\tthis.element.calculatedSize.x,\n\t\t\tthis.element.calculatedSize.y,\n\t\t\tthis.widthSegments,\n\t\t\tthis.heightSegments,\n\t\t)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('plane-geometry'))\n\telementBehaviors.define('plane-geometry', PlaneGeometryBehavior)\n", "/**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '160';\n\nconst MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\nconst TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\nconst CullFaceNone = 0;\nconst CullFaceBack = 1;\nconst CullFaceFront = 2;\nconst CullFaceFrontBack = 3;\nconst BasicShadowMap = 0;\nconst PCFShadowMap = 1;\nconst PCFSoftShadowMap = 2;\nconst VSMShadowMap = 3;\nconst FrontSide = 0;\nconst BackSide = 1;\nconst DoubleSide = 2;\nconst TwoPassDoubleSide = 2; // r149\nconst NoBlending = 0;\nconst NormalBlending = 1;\nconst AdditiveBlending = 2;\nconst SubtractiveBlending = 3;\nconst MultiplyBlending = 4;\nconst CustomBlending = 5;\nconst AddEquation = 100;\nconst SubtractEquation = 101;\nconst ReverseSubtractEquation = 102;\nconst MinEquation = 103;\nconst MaxEquation = 104;\nconst ZeroFactor = 200;\nconst OneFactor = 201;\nconst SrcColorFactor = 202;\nconst OneMinusSrcColorFactor = 203;\nconst SrcAlphaFactor = 204;\nconst OneMinusSrcAlphaFactor = 205;\nconst DstAlphaFactor = 206;\nconst OneMinusDstAlphaFactor = 207;\nconst DstColorFactor = 208;\nconst OneMinusDstColorFactor = 209;\nconst SrcAlphaSaturateFactor = 210;\nconst ConstantColorFactor = 211;\nconst OneMinusConstantColorFactor = 212;\nconst ConstantAlphaFactor = 213;\nconst OneMinusConstantAlphaFactor = 214;\nconst NeverDepth = 0;\nconst AlwaysDepth = 1;\nconst LessDepth = 2;\nconst LessEqualDepth = 3;\nconst EqualDepth = 4;\nconst GreaterEqualDepth = 5;\nconst GreaterDepth = 6;\nconst NotEqualDepth = 7;\nconst MultiplyOperation = 0;\nconst MixOperation = 1;\nconst AddOperation = 2;\nconst NoToneMapping = 0;\nconst LinearToneMapping = 1;\nconst ReinhardToneMapping = 2;\nconst CineonToneMapping = 3;\nconst ACESFilmicToneMapping = 4;\nconst CustomToneMapping = 5;\nconst AgXToneMapping = 6;\nconst AttachedBindMode = 'attached';\nconst DetachedBindMode = 'detached';\n\nconst UVMapping = 300;\nconst CubeReflectionMapping = 301;\nconst CubeRefractionMapping = 302;\nconst EquirectangularReflectionMapping = 303;\nconst EquirectangularRefractionMapping = 304;\nconst CubeUVReflectionMapping = 306;\nconst RepeatWrapping = 1000;\nconst ClampToEdgeWrapping = 1001;\nconst MirroredRepeatWrapping = 1002;\nconst NearestFilter = 1003;\nconst NearestMipmapNearestFilter = 1004;\nconst NearestMipMapNearestFilter = 1004;\nconst NearestMipmapLinearFilter = 1005;\nconst NearestMipMapLinearFilter = 1005;\nconst LinearFilter = 1006;\nconst LinearMipmapNearestFilter = 1007;\nconst LinearMipMapNearestFilter = 1007;\nconst LinearMipmapLinearFilter = 1008;\nconst LinearMipMapLinearFilter = 1008;\nconst UnsignedByteType = 1009;\nconst ByteType = 1010;\nconst ShortType = 1011;\nconst UnsignedShortType = 1012;\nconst IntType = 1013;\nconst UnsignedIntType = 1014;\nconst FloatType = 1015;\nconst HalfFloatType = 1016;\nconst UnsignedShort4444Type = 1017;\nconst UnsignedShort5551Type = 1018;\nconst UnsignedInt248Type = 1020;\nconst AlphaFormat = 1021;\nconst RGBAFormat = 1023;\nconst LuminanceFormat = 1024;\nconst LuminanceAlphaFormat = 1025;\nconst DepthFormat = 1026;\nconst DepthStencilFormat = 1027;\nconst RedFormat = 1028;\nconst RedIntegerFormat = 1029;\nconst RGFormat = 1030;\nconst RGIntegerFormat = 1031;\nconst RGBAIntegerFormat = 1033;\n\nconst RGB_S3TC_DXT1_Format = 33776;\nconst RGBA_S3TC_DXT1_Format = 33777;\nconst RGBA_S3TC_DXT3_Format = 33778;\nconst RGBA_S3TC_DXT5_Format = 33779;\nconst RGB_PVRTC_4BPPV1_Format = 35840;\nconst RGB_PVRTC_2BPPV1_Format = 35841;\nconst RGBA_PVRTC_4BPPV1_Format = 35842;\nconst RGBA_PVRTC_2BPPV1_Format = 35843;\nconst RGB_ETC1_Format = 36196;\nconst RGB_ETC2_Format = 37492;\nconst RGBA_ETC2_EAC_Format = 37496;\nconst RGBA_ASTC_4x4_Format = 37808;\nconst RGBA_ASTC_5x4_Format = 37809;\nconst RGBA_ASTC_5x5_Format = 37810;\nconst RGBA_ASTC_6x5_Format = 37811;\nconst RGBA_ASTC_6x6_Format = 37812;\nconst RGBA_ASTC_8x5_Format = 37813;\nconst RGBA_ASTC_8x6_Format = 37814;\nconst RGBA_ASTC_8x8_Format = 37815;\nconst RGBA_ASTC_10x5_Format = 37816;\nconst RGBA_ASTC_10x6_Format = 37817;\nconst RGBA_ASTC_10x8_Format = 37818;\nconst RGBA_ASTC_10x10_Format = 37819;\nconst RGBA_ASTC_12x10_Format = 37820;\nconst RGBA_ASTC_12x12_Format = 37821;\nconst RGBA_BPTC_Format = 36492;\nconst RGB_BPTC_SIGNED_Format = 36494;\nconst RGB_BPTC_UNSIGNED_Format = 36495;\nconst RED_RGTC1_Format = 36283;\nconst SIGNED_RED_RGTC1_Format = 36284;\nconst RED_GREEN_RGTC2_Format = 36285;\nconst SIGNED_RED_GREEN_RGTC2_Format = 36286;\nconst LoopOnce = 2200;\nconst LoopRepeat = 2201;\nconst LoopPingPong = 2202;\nconst InterpolateDiscrete = 2300;\nconst InterpolateLinear = 2301;\nconst InterpolateSmooth = 2302;\nconst ZeroCurvatureEnding = 2400;\nconst ZeroSlopeEnding = 2401;\nconst WrapAroundEnding = 2402;\nconst NormalAnimationBlendMode = 2500;\nconst AdditiveAnimationBlendMode = 2501;\nconst TrianglesDrawMode = 0;\nconst TriangleStripDrawMode = 1;\nconst TriangleFanDrawMode = 2;\n/** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */\nconst LinearEncoding = 3000;\n/** @deprecated Use SRGBColorSpace in three.js r152+. */\nconst sRGBEncoding = 3001;\nconst BasicDepthPacking = 3200;\nconst RGBADepthPacking = 3201;\nconst TangentSpaceNormalMap = 0;\nconst ObjectSpaceNormalMap = 1;\n\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nconst NoColorSpace = '';\nconst SRGBColorSpace = 'srgb';\nconst LinearSRGBColorSpace = 'srgb-linear';\nconst DisplayP3ColorSpace = 'display-p3';\nconst LinearDisplayP3ColorSpace = 'display-p3-linear';\n\nconst LinearTransfer = 'linear';\nconst SRGBTransfer = 'srgb';\n\nconst Rec709Primaries = 'rec709';\nconst P3Primaries = 'p3';\n\nconst ZeroStencilOp = 0;\nconst KeepStencilOp = 7680;\nconst ReplaceStencilOp = 7681;\nconst IncrementStencilOp = 7682;\nconst DecrementStencilOp = 7683;\nconst IncrementWrapStencilOp = 34055;\nconst DecrementWrapStencilOp = 34056;\nconst InvertStencilOp = 5386;\n\nconst NeverStencilFunc = 512;\nconst LessStencilFunc = 513;\nconst EqualStencilFunc = 514;\nconst LessEqualStencilFunc = 515;\nconst GreaterStencilFunc = 516;\nconst NotEqualStencilFunc = 517;\nconst GreaterEqualStencilFunc = 518;\nconst AlwaysStencilFunc = 519;\n\nconst NeverCompare = 512;\nconst LessCompare = 513;\nconst EqualCompare = 514;\nconst LessEqualCompare = 515;\nconst GreaterCompare = 516;\nconst NotEqualCompare = 517;\nconst GreaterEqualCompare = 518;\nconst AlwaysCompare = 519;\n\nconst StaticDrawUsage = 35044;\nconst DynamicDrawUsage = 35048;\nconst StreamDrawUsage = 35040;\nconst StaticReadUsage = 35045;\nconst DynamicReadUsage = 35049;\nconst StreamReadUsage = 35041;\nconst StaticCopyUsage = 35046;\nconst DynamicCopyUsage = 35050;\nconst StreamCopyUsage = 35042;\n\nconst GLSL1 = '100';\nconst GLSL3 = '300 es';\n\nconst _SRGBAFormat = 1035; // fallback for WebGL 1\n\nconst WebGLCoordinateSystem = 2000;\nconst WebGPUCoordinateSystem = 2001;\n\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\n\nclass EventDispatcher {\n\n\taddEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t}\n\n\thasEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return false;\n\n\t\tconst listeners = this._listeners;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\n\n\t}\n\n\tremoveEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tconst index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\t// Make a copy, in case listeners are removed while iterating.\n\t\t\tconst array = listenerArray.slice( 0 );\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t\tevent.target = null;\n\n\t\t}\n\n\t}\n\n}\n\nconst _lut = [ '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' ];\n\nlet _seed = 1234567;\n\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction generateUUID() {\n\n\tconst d0 = Math.random() * 0xffffffff | 0;\n\tconst d1 = Math.random() * 0xffffffff | 0;\n\tconst d2 = Math.random() * 0xffffffff | 0;\n\tconst d3 = Math.random() * 0xffffffff | 0;\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t// .toLowerCase() here flattens concatenated strings to save heap memory space.\n\treturn uuid.toLowerCase();\n\n}\n\nfunction clamp( value, min, max ) {\n\n\treturn Math.max( min, Math.min( max, value ) );\n\n}\n\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction euclideanModulo( n, m ) {\n\n\treturn ( ( n % m ) + m ) % m;\n\n}\n\n// Linear mapping from range to range \nfunction mapLinear( x, a1, a2, b1, b2 ) {\n\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n}\n\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction inverseLerp( x, y, value ) {\n\n\tif ( x !== y ) {\n\n\t\treturn ( value - x ) / ( y - x );\n\n\t} else {\n\n\t\treturn 0;\n\n\t}\n\n}\n\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction lerp( x, y, t ) {\n\n\treturn ( 1 - t ) * x + t * y;\n\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction damp( x, y, lambda, dt ) {\n\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\n\n}\n\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction pingpong( x, length = 1 ) {\n\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\n\n}\n\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction smoothstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * ( 3 - 2 * x );\n\n}\n\nfunction smootherstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n}\n\n// Random integer from interval\nfunction randInt( low, high ) {\n\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n}\n\n// Random float from interval\nfunction randFloat( low, high ) {\n\n\treturn low + Math.random() * ( high - low );\n\n}\n\n// Random float from <-range/2, range/2> interval\nfunction randFloatSpread( range ) {\n\n\treturn range * ( 0.5 - Math.random() );\n\n}\n\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction seededRandom( s ) {\n\n\tif ( s !== undefined ) _seed = s;\n\n\t// Mulberry32 generator\n\n\tlet t = _seed += 0x6D2B79F5;\n\n\tt = Math.imul( t ^ t >>> 15, t | 1 );\n\n\tt ^= t + Math.imul( t ^ t >>> 7, t | 61 );\n\n\treturn ( ( t ^ t >>> 14 ) >>> 0 ) / 4294967296;\n\n}\n\nfunction degToRad( degrees ) {\n\n\treturn degrees * DEG2RAD;\n\n}\n\nfunction radToDeg( radians ) {\n\n\treturn radians * RAD2DEG;\n\n}\n\nfunction isPowerOfTwo( value ) {\n\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n}\n\nfunction ceilPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction floorPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\n\n\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n\t// rotations are applied to the axes in the order specified by 'order'\n\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n\t// angles are in radians\n\n\tconst cos = Math.cos;\n\tconst sin = Math.sin;\n\n\tconst c2 = cos( b / 2 );\n\tconst s2 = sin( b / 2 );\n\n\tconst c13 = cos( ( a + c ) / 2 );\n\tconst s13 = sin( ( a + c ) / 2 );\n\n\tconst c1_3 = cos( ( a - c ) / 2 );\n\tconst s1_3 = sin( ( a - c ) / 2 );\n\n\tconst c3_1 = cos( ( c - a ) / 2 );\n\tconst s3_1 = sin( ( c - a ) / 2 );\n\n\tswitch ( order ) {\n\n\t\tcase 'XYX':\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YZY':\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZXZ':\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'XZX':\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YXY':\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZYZ':\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\n\n\t}\n\n}\n\nfunction denormalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn value / 4294967295.0;\n\n\t\tcase Uint16Array:\n\n\t\t\treturn value / 65535.0;\n\n\t\tcase Uint8Array:\n\n\t\t\treturn value / 255.0;\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.max( value / 2147483647.0, - 1.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.max( value / 32767.0, - 1.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.max( value / 127.0, - 1.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nfunction normalize( value, array ) {\n\n\tswitch ( array.constructor ) {\n\n\t\tcase Float32Array:\n\n\t\t\treturn value;\n\n\t\tcase Uint32Array:\n\n\t\t\treturn Math.round( value * 4294967295.0 );\n\n\t\tcase Uint16Array:\n\n\t\t\treturn Math.round( value * 65535.0 );\n\n\t\tcase Uint8Array:\n\n\t\t\treturn Math.round( value * 255.0 );\n\n\t\tcase Int32Array:\n\n\t\t\treturn Math.round( value * 2147483647.0 );\n\n\t\tcase Int16Array:\n\n\t\t\treturn Math.round( value * 32767.0 );\n\n\t\tcase Int8Array:\n\n\t\t\treturn Math.round( value * 127.0 );\n\n\t\tdefault:\n\n\t\t\tthrow new Error( 'Invalid component type.' );\n\n\t}\n\n}\n\nconst MathUtils = {\n\tDEG2RAD: DEG2RAD,\n\tRAD2DEG: RAD2DEG,\n\tgenerateUUID: generateUUID,\n\tclamp: clamp,\n\teuclideanModulo: euclideanModulo,\n\tmapLinear: mapLinear,\n\tinverseLerp: inverseLerp,\n\tlerp: lerp,\n\tdamp: damp,\n\tpingpong: pingpong,\n\tsmoothstep: smoothstep,\n\tsmootherstep: smootherstep,\n\trandInt: randInt,\n\trandFloat: randFloat,\n\trandFloatSpread: randFloatSpread,\n\tseededRandom: seededRandom,\n\tdegToRad: degToRad,\n\tradToDeg: radToDeg,\n\tisPowerOfTwo: isPowerOfTwo,\n\tceilPowerOfTwo: ceilPowerOfTwo,\n\tfloorPowerOfTwo: floorPowerOfTwo,\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler,\n\tnormalize: normalize,\n\tdenormalize: denormalize\n};\n\nclass Vector2 {\n\n\tconstructor( x = 0, y = 0 ) {\n\n\t\tVector2.prototype.isVector2 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.x;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.x = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.y;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.y = value;\n\n\t}\n\n\tset( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tangle() {\n\n\t\t// computes the angle in radians with respect to the positive x-axis\n\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\n\n\t\treturn angle;\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t}\n\n\trotateAround( center, angle ) {\n\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tconst x = this.x - center.x;\n\t\tconst y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\n\t}\n\n}\n\nclass Matrix3 {\n\n\tconstructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tMatrix3.prototype.isMatrix3 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrix3Column( this, 0 );\n\t\tyAxis.setFromMatrix3Column( this, 1 );\n\t\tzAxis.setFromMatrix3Column( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix4( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t}\n\n\tinvert() {\n\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\ttranspose() {\n\n\t\tlet tmp;\n\t\tconst m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tgetNormalMatrix( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\n\n\t}\n\n\ttransposeIntoArray( r ) {\n\n\t\tconst m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tconst c = Math.cos( rotation );\n\t\tconst s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tscale( sx, sy ) {\n\n\t\tthis.premultiply( _m3.makeScale( sx, sy ) );\n\n\t\treturn this;\n\n\t}\n\n\trotate( theta ) {\n\n\t\tthis.premultiply( _m3.makeRotation( - theta ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( tx, ty ) {\n\n\t\tthis.premultiply( _m3.makeTranslation( tx, ty ) );\n\n\t\treturn this;\n\n\t}\n\n\t// for 2D Transforms\n\n\tmakeTranslation( x, y ) {\n\n\t\tif ( x.isVector2 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x.x,\n\t\t\t\t0, 1, x.y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, x,\n\t\t\t\t0, 1, y,\n\t\t\t\t0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotation( theta ) {\n\n\t\t// counterclockwise\n\n\t\tconst c = Math.cos( theta );\n\t\tconst s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0,\n\t\t\ts, c, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0,\n\t\t\t0, y, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\t//\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t}\n\n}\n\nconst _m3 = /*@__PURE__*/ new Matrix3();\n\nfunction arrayNeedsUint32( array ) {\n\n\t// assumes larger values usually on last\n\n\tfor ( let i = array.length - 1; i >= 0; -- i ) {\n\n\t\tif ( array[ i ] >= 65535 ) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n\n\t}\n\n\treturn false;\n\n}\n\nconst TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\tUint8ClampedArray: Uint8ClampedArray,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\nfunction getTypedArray( type, buffer ) {\n\n\treturn new TYPED_ARRAYS[ type ]( buffer );\n\n}\n\nfunction createElementNS( name ) {\n\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\n\n}\n\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\n\n}\n\nconst _cache = {};\n\nfunction warnOnce( message ) {\n\n\tif ( message in _cache ) return;\n\n\t_cache[ message ] = true;\n\n\tconsole.warn( message );\n\n}\n\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */\n\nconst LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(\n\t0.8224621, 0.177538, 0.0,\n\t0.0331941, 0.9668058, 0.0,\n\t0.0170827, 0.0723974, 0.9105199,\n);\n\nconst LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(\n\t1.2249401, - 0.2249404, 0.0,\n\t- 0.0420569, 1.0420571, 0.0,\n\t- 0.0196376, - 0.0786361, 1.0982735\n);\n\n/**\n * Defines supported color spaces by transfer function and primaries,\n * and provides conversions to/from the Linear-sRGB reference space.\n */\nconst COLOR_SPACES = {\n\t[ LinearSRGBColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color,\n\t\tfromReference: ( color ) => color,\n\t},\n\t[ SRGBColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: Rec709Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear(),\n\t\tfromReference: ( color ) => color.convertLinearToSRGB(),\n\t},\n\t[ LinearDisplayP3ColorSpace ]: {\n\t\ttransfer: LinearTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),\n\t},\n\t[ DisplayP3ColorSpace ]: {\n\t\ttransfer: SRGBTransfer,\n\t\tprimaries: P3Primaries,\n\t\ttoReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),\n\t\tfromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),\n\t},\n};\n\nconst SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );\n\nconst ColorManagement = {\n\n\tenabled: true,\n\n\t_workingColorSpace: LinearSRGBColorSpace,\n\n\tget workingColorSpace() {\n\n\t\treturn this._workingColorSpace;\n\n\t},\n\n\tset workingColorSpace( colorSpace ) {\n\n\t\tif ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {\n\n\t\t\tthrow new Error( `Unsupported working color space, \"${ colorSpace }\".` );\n\n\t\t}\n\n\t\tthis._workingColorSpace = colorSpace;\n\n\t},\n\n\tconvert: function ( color, sourceColorSpace, targetColorSpace ) {\n\n\t\tif ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {\n\n\t\t\treturn color;\n\n\t\t}\n\n\t\tconst sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;\n\t\tconst targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;\n\n\t\treturn targetFromReference( sourceToReference( color ) );\n\n\t},\n\n\tfromWorkingColorSpace: function ( color, targetColorSpace ) {\n\n\t\treturn this.convert( color, this._workingColorSpace, targetColorSpace );\n\n\t},\n\n\ttoWorkingColorSpace: function ( color, sourceColorSpace ) {\n\n\t\treturn this.convert( color, sourceColorSpace, this._workingColorSpace );\n\n\t},\n\n\tgetPrimaries: function ( colorSpace ) {\n\n\t\treturn COLOR_SPACES[ colorSpace ].primaries;\n\n\t},\n\n\tgetTransfer: function ( colorSpace ) {\n\n\t\tif ( colorSpace === NoColorSpace ) return LinearTransfer;\n\n\t\treturn COLOR_SPACES[ colorSpace ].transfer;\n\n\t},\n\n};\n\n\nfunction SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nfunction LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n\nlet _canvas;\n\nclass ImageUtils {\n\n\tstatic getDataURL( image ) {\n\n\t\tif ( /^data:/i.test( image.src ) ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tif ( typeof HTMLCanvasElement === 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tlet canvas;\n\n\t\tif ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tconst context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );\n\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\n\n\t\t} else {\n\n\t\t\treturn canvas.toDataURL( 'image/png' );\n\n\t\t}\n\n\t}\n\n\tstatic sRGBToLinear( image ) {\n\n\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\tconst canvas = createElementNS( 'canvas' );\n\n\t\t\tcanvas.width = image.width;\n\t\t\tcanvas.height = image.height;\n\n\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\tconst imageData = context.getImageData( 0, 0, image.width, image.height );\n\t\t\tconst data = imageData.data;\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;\n\n\t\t\t}\n\n\t\t\tcontext.putImageData( imageData, 0, 0 );\n\n\t\t\treturn canvas;\n\n\t\t} else if ( image.data ) {\n\n\t\t\tconst data = image.data.slice( 0 );\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tif ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {\n\n\t\t\t\t\tdata[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// assuming float\n\n\t\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );\n\t\t\treturn image;\n\n\t\t}\n\n\t}\n\n}\n\nlet _sourceId = 0;\n\nclass Source {\n\n\tconstructor( data = null ) {\n\n\t\tthis.isSource = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _sourceId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.data = data;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.images[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\t\t\tuuid: this.uuid,\n\t\t\turl: ''\n\t\t};\n\n\t\tconst data = this.data;\n\n\t\tif ( data !== null ) {\n\n\t\t\tlet url;\n\n\t\t\tif ( Array.isArray( data ) ) {\n\n\t\t\t\t// cube texture\n\n\t\t\t\turl = [];\n\n\t\t\t\tfor ( let i = 0, l = data.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( data[ i ].isDataTexture ) {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ].image ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ] ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// texture\n\n\t\t\t\turl = serializeImage( data );\n\n\t\t\t}\n\n\t\t\toutput.url = url;\n\n\t\t}\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.images[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nfunction serializeImage( image ) {\n\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t// default images\n\n\t\treturn ImageUtils.getDataURL( image );\n\n\t} else {\n\n\t\tif ( image.data ) {\n\n\t\t\t// images of DataTexture\n\n\t\t\treturn {\n\t\t\t\tdata: Array.from( image.data ),\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height,\n\t\t\t\ttype: image.data.constructor.name\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Texture: Unable to serialize Texture.' );\n\t\t\treturn {};\n\n\t\t}\n\n\t}\n\n}\n\nlet _textureId = 0;\n\nclass Texture extends EventDispatcher {\n\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {\n\n\t\tsuper();\n\n\t\tthis.isTexture = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _textureId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\n\t\tthis.source = new Source( image );\n\t\tthis.mipmaps = [];\n\n\t\tthis.mapping = mapping;\n\t\tthis.channel = 0;\n\n\t\tthis.wrapS = wrapS;\n\t\tthis.wrapT = wrapT;\n\n\t\tthis.magFilter = magFilter;\n\t\tthis.minFilter = minFilter;\n\n\t\tthis.anisotropy = anisotropy;\n\n\t\tthis.format = format;\n\t\tthis.internalFormat = null;\n\t\tthis.type = type;\n\n\t\tthis.offset = new Vector2( 0, 0 );\n\t\tthis.repeat = new Vector2( 1, 1 );\n\t\tthis.center = new Vector2( 0, 0 );\n\t\tthis.rotation = 0;\n\n\t\tthis.matrixAutoUpdate = true;\n\t\tthis.matrix = new Matrix3();\n\n\t\tthis.generateMipmaps = true;\n\t\tthis.premultiplyAlpha = false;\n\t\tthis.flipY = true;\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t\tif ( typeof colorSpace === 'string' ) {\n\n\t\t\tthis.colorSpace = colorSpace;\n\n\t\t} else { // @deprecated, r152\n\n\t\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\t\tthis.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\t\tthis.onUpdate = null;\n\n\t\tthis.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n\t\tthis.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n\n\t}\n\n\tget image() {\n\n\t\treturn this.source.data;\n\n\t}\n\n\tset image( value = null ) {\n\n\t\tthis.source.data = value;\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.source = source.source;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\t\tthis.channel = source.channel;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.colorSpace = source.colorSpace;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tthis.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\timage: this.source.toJSON( meta ).uuid,\n\n\t\t\tmapping: this.mapping,\n\t\t\tchannel: this.channel,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\tinternalFormat: this.internalFormat,\n\t\t\ttype: this.type,\n\t\t\tcolorSpace: this.colorSpace,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tgenerateMipmaps: this.generateMipmaps,\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\ttransformUv( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.version ++;\n\t\t\tthis.source.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tget encoding() { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\treturn this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;\n\n\t}\n\n\tset encoding( encoding ) { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\tthis.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t}\n\n}\n\nTexture.DEFAULT_IMAGE = null;\nTexture.DEFAULT_MAPPING = UVMapping;\nTexture.DEFAULT_ANISOTROPY = 1;\n\nclass Vector4 {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tVector4.prototype.isVector4 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\t\tthis.w = Math.max( min.w, Math.min( max.w, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\t\tthis.w = Math.max( minVal, Math.min( maxVal, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\t\tthis.w = Math.trunc( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/\nclass RenderTarget extends EventDispatcher {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.isRenderTarget = true;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.depth = 1;\n\n\t\tthis.scissor = new Vector4( 0, 0, width, height );\n\t\tthis.scissorTest = false;\n\n\t\tthis.viewport = new Vector4( 0, 0, width, height );\n\n\t\tconst image = { width: width, height: height, depth: 1 };\n\n\t\tif ( options.encoding !== undefined ) {\n\n\t\t\t// @deprecated, r152\n\t\t\twarnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );\n\t\t\toptions.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\t\toptions = Object.assign( {\n\t\t\tgenerateMipmaps: false,\n\t\t\tinternalFormat: null,\n\t\t\tminFilter: LinearFilter,\n\t\t\tdepthBuffer: true,\n\t\t\tstencilBuffer: false,\n\t\t\tdepthTexture: null,\n\t\t\tsamples: 0\n\t\t}, options );\n\n\t\tthis.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.flipY = false;\n\t\tthis.texture.generateMipmaps = options.generateMipmaps;\n\t\tthis.texture.internalFormat = options.internalFormat;\n\n\t\tthis.depthBuffer = options.depthBuffer;\n\t\tthis.stencilBuffer = options.stencilBuffer;\n\n\t\tthis.depthTexture = options.depthTexture;\n\n\t\tthis.samples = options.samples;\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tthis.texture.image.width = width;\n\t\t\tthis.texture.image.height = height;\n\t\t\tthis.texture.image.depth = depth;\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.texture = source.texture.clone();\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\t// ensure image object is not shared, see #20328\n\n\t\tconst image = Object.assign( {}, source.texture.image );\n\t\tthis.texture.source = new Source( image );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.samples = source.samples;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nclass WebGLRenderTarget extends RenderTarget {\n\n\tconstructor( width = 1, height = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLRenderTarget = true;\n\n\t}\n\n}\n\nclass DataArrayTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( null );\n\n\t\tthis.isDataArrayTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGLArrayRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLArrayRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new DataArrayTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass Data3DTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\t// We're going to add .setXXX() methods for setting properties later.\n\t\t// Users can still set in DataTexture3D directly.\n\t\t//\n\t\t//\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n\t\t// \ttexture.anisotropy = 16;\n\t\t//\n\t\t// See #14839\n\n\t\tsuper( null );\n\n\t\tthis.isData3DTexture = true;\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nclass WebGL3DRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, depth = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGL3DRenderTarget = true;\n\n\t\tthis.depth = depth;\n\n\t\tthis.texture = new Data3DTexture( null, width, height, depth );\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t}\n\n}\n\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget {\n\n\tconstructor( width = 1, height = 1, count = 1, options = {} ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.isWebGLMultipleRenderTargets = true;\n\n\t\tconst texture = this.texture;\n\n\t\tthis.texture = [];\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.texture[ i ] = texture.clone();\n\t\t\tthis.texture[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tfor ( let i = 0, il = this.texture.length; i < il; i ++ ) {\n\n\t\t\t\tthis.texture[ i ].image.width = width;\n\t\t\t\tthis.texture[ i ].image.height = height;\n\t\t\t\tthis.texture[ i ].image.depth = depth;\n\n\t\t\t}\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.dispose();\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.scissor.copy( source.scissor );\n\t\tthis.scissorTest = source.scissorTest;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\n\t\tif ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();\n\n\t\tthis.texture.length = 0;\n\n\t\tfor ( let i = 0, il = source.texture.length; i < il; i ++ ) {\n\n\t\t\tthis.texture[ i ] = source.texture[ i ].clone();\n\t\t\tthis.texture[ i ].isRenderTargetTexture = true;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Quaternion {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tthis.isQuaternion = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t}\n\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\t// fuzz-free, array-based Quaternion SLERP operation\n\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( t === 0 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x0;\n\t\t\tdst[ dstOffset + 1 ] = y0;\n\t\t\tdst[ dstOffset + 2 ] = z0;\n\t\t\tdst[ dstOffset + 3 ] = w0;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( t === 1 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x1;\n\t\t\tdst[ dstOffset + 1 ] = y1;\n\t\t\tdst[ dstOffset + 2 ] = z1;\n\t\t\tdst[ dstOffset + 3 ] = w1;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tlet s = 1 - t;\n\t\t\tconst cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\n\t\t\t\tsqrSin = 1 - cos * cos;\n\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\n\t\t\tif ( sqrSin > Number.EPSILON ) {\n\n\t\t\t\tconst sin = Math.sqrt( sqrSin ),\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\n\n\t\t\t\ts = Math.sin( s * len ) / sin;\n\t\t\t\tt = Math.sin( t * len ) / sin;\n\n\t\t\t}\n\n\t\t\tconst tDir = t * dir;\n\n\t\t\tx0 = x0 * s + x1 * tDir;\n\t\t\ty0 = y0 * s + y1 * tDir;\n\t\t\tz0 = z0 * s + z1 * tDir;\n\t\t\tw0 = w0 * s + w1 * tDir;\n\n\t\t\t// Normalize in case we just did a lerp:\n\t\t\tif ( s === 1 - t ) {\n\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\n\n\t\tconst x0 = src0[ srcOffset0 ];\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 ];\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\n\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n\n\t\treturn dst;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget w() {\n\n\t\treturn this._w;\n\n\t}\n\n\tset w( value ) {\n\n\t\tthis._w = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t}\n\n\tcopy( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromEuler( euler, update = true ) {\n\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tconst cos = Math.cos;\n\t\tconst sin = Math.sin;\n\n\t\tconst c1 = cos( x / 2 );\n\t\tconst c2 = cos( y / 2 );\n\t\tconst c3 = cos( z / 2 );\n\n\t\tconst s1 = sin( x / 2 );\n\t\tconst s2 = sin( y / 2 );\n\t\tconst s3 = sin( z / 2 );\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAxisAngle( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\t// assumes axis is normalized\n\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromUnitVectors( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tlet r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < Number.EPSILON ) {\n\n\t\t\t// vFrom and vTo point in opposite directions\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t}\n\n\tangleTo( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );\n\n\t}\n\n\trotateTowards( q, step ) {\n\n\t\tconst angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tconst t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\treturn this.set( 0, 0, 0, 1 );\n\n\t}\n\n\tinvert() {\n\n\t\t// quaternion is assumed to have unit length\n\n\t\treturn this.conjugate();\n\n\t}\n\n\tconjugate() {\n\n\t\tthis._x *= - 1;\n\t\tthis._y *= - 1;\n\t\tthis._z *= - 1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t}\n\n\tnormalize() {\n\n\t\tlet l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t}\n\n\tpremultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t}\n\n\tmultiplyQuaternions( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerp( qb, t ) {\n\n\t\tif ( t === 0 ) return this;\n\t\tif ( t === 1 ) return this.copy( qb );\n\n\t\tconst x = this._x, y = this._y, z = this._z, w = this._w;\n\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n\t\tlet cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n\n\t\tif ( cosHalfTheta < 0 ) {\n\n\t\t\tthis._w = - qb._w;\n\t\t\tthis._x = - qb._x;\n\t\t\tthis._y = - qb._y;\n\t\t\tthis._z = - qb._z;\n\n\t\t\tcosHalfTheta = - cosHalfTheta;\n\n\t\t} else {\n\n\t\t\tthis.copy( qb );\n\n\t\t}\n\n\t\tif ( cosHalfTheta >= 1.0 ) {\n\n\t\t\tthis._w = w;\n\t\t\tthis._x = x;\n\t\t\tthis._y = y;\n\t\t\tthis._z = z;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\n\n\t\t\tconst s = 1 - t;\n\t\t\tthis._w = s * w + t * this._w;\n\t\t\tthis._x = s * x + t * this._x;\n\t\t\tthis._y = s * y + t * this._y;\n\t\t\tthis._z = s * z + t * this._z;\n\n\t\t\tthis.normalize(); // normalize calls _onChangeCallback()\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\n\t\tconst halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\n\t\tconst ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerpQuaternions( qa, qb, t ) {\n\n\t\treturn this.copy( qa ).slerp( qb, t );\n\n\t}\n\n\trandom() {\n\n\t\t// Derived from http://planning.cs.uiuc.edu/node198.html\n\t\t// Note, this source uses w, x, y, z ordering,\n\t\t// so we swap the order below.\n\n\t\tconst u1 = Math.random();\n\t\tconst sqrt1u1 = Math.sqrt( 1 - u1 );\n\t\tconst sqrtu1 = Math.sqrt( u1 );\n\n\t\tconst u2 = 2 * Math.PI * Math.random();\n\n\t\tconst u3 = 2 * Math.PI * Math.random();\n\n\t\treturn this.set(\n\t\t\tsqrt1u1 * Math.cos( u2 ),\n\t\t\tsqrtu1 * Math.sin( u3 ),\n\t\t\tsqrtu1 * Math.cos( u3 ),\n\t\t\tsqrt1u1 * Math.sin( u2 ),\n\t\t);\n\n\t}\n\n\tequals( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis._x = attribute.getX( index );\n\t\tthis._y = attribute.getY( index );\n\t\tthis._z = attribute.getZ( index );\n\t\tthis._w = attribute.getW( index );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.toArray();\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._w;\n\n\t}\n\n}\n\nclass Vector3 {\n\n\tconstructor( x = 0, y = 0, z = 0 ) {\n\n\t\tVector3.prototype.isVector3 = true;\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t}\n\n\tset( x, y, z ) {\n\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v ) {\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v ) {\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyVectors( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyEuler( euler ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromEuler( euler ) );\n\n\t}\n\n\tapplyAxisAngle( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromAxisAngle( axis, angle ) );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t// quaternion q is assumed to have unit length\n\n\t\tconst vx = this.x, vy = this.y, vz = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// t = 2 * cross( q.xyz, v );\n\t\tconst tx = 2 * ( qy * vz - qz * vy );\n\t\tconst ty = 2 * ( qz * vx - qx * vz );\n\t\tconst tz = 2 * ( qx * vy - qy * vx );\n\n\t\t// v + q.w * t + cross( q.xyz, t );\n\t\tthis.x = vx + qw * tx + qy * tz - qz * ty;\n\t\tthis.y = vy + qw * ty + qz * tx - qx * tz;\n\t\tthis.z = vz + qw * tz + qx * ty - qy * tx;\n\n\t\treturn this;\n\n\t}\n\n\tproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t}\n\n\tunproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = Math.trunc( this.x );\n\t\tthis.y = Math.trunc( this.y );\n\t\tthis.z = Math.trunc( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t}\n\n\t// TODO lengthSquared?\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.crossVectors( this, v );\n\n\t}\n\n\tcrossVectors( a, b ) {\n\n\t\tconst ax = a.x, ay = a.y, az = a.z;\n\t\tconst bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t}\n\n\tprojectOnVector( v ) {\n\n\t\tconst denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tconst scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t}\n\n\tprojectOnPlane( planeNormal ) {\n\n\t\t_vector$c.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$c );\n\n\t}\n\n\treflect( normal ) {\n\n\t\t// reflect incident vector off plane orthogonal to normal\n\t\t// normal is assumed to have unit length\n\n\t\treturn this.sub( _vector$c.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t}\n\n\tsetFromSpherical( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t}\n\n\tsetFromSphericalCoords( radius, phi, theta ) {\n\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCylindrical( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t}\n\n\tsetFromCylindricalCoords( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixScale( m ) {\n\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixColumn( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t}\n\n\tsetFromMatrix3Column( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t}\n\n\tsetFromEuler( e ) {\n\n\t\tthis.x = e._x;\n\t\tthis.y = e._y;\n\t\tthis.z = e._z;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromColor( c ) {\n\n\t\tthis.x = c.r;\n\t\tthis.y = c.g;\n\t\tthis.z = c.b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\trandomDirection() {\n\n\t\t// Derived from https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst u = ( Math.random() - 0.5 ) * 2;\n\t\tconst t = Math.random() * Math.PI * 2;\n\t\tconst f = Math.sqrt( 1 - u ** 2 );\n\n\t\tthis.x = f * Math.cos( t );\n\t\tthis.y = f * Math.sin( t );\n\t\tthis.z = u;\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\n\t}\n\n}\n\nconst _vector$c = /*@__PURE__*/ new Vector3();\nconst _quaternion$4 = /*@__PURE__*/ new Quaternion();\n\nclass Box3 {\n\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox3 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromArray( array ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = array.length; i < il; i += 3 ) {\n\n\t\t\tthis.expandByPoint( _vector$b.fromArray( array, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromBufferAttribute( attribute ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = attribute.count; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( _vector$b.fromBufferAttribute( attribute, i ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$b.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromObject( object, precise = false ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object, precise );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\texpandByObject( object, precise = false ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tconst geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\t\t// precise AABB computation based on vertex data requires at least a position attribute.\n\t\t\t// instancing isn't supported so far and uses the normal (conservative) code path.\n\n\t\t\tif ( precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true ) {\n\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\tif ( object.isMesh === true ) {\n\n\t\t\t\t\t\tobject.getVertexPosition( i, _vector$b );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_vector$b.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_vector$b.applyMatrix4( object.matrixWorld );\n\t\t\t\t\tthis.expandByPoint( _vector$b );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( object.boundingBox !== undefined ) {\n\n\t\t\t\t\t// object-level bounding box\n\n\t\t\t\t\tif ( object.boundingBox === null ) {\n\n\t\t\t\t\t\tobject.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( object.boundingBox );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// geometry-level bounding box\n\n\t\t\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t\t\t}\n\n\t\t\t\t\t_box$4.copy( geometry.boundingBox );\n\n\t\t\t\t}\n\n\t\t\t\t_box$4.applyMatrix4( object.matrixWorld );\n\n\t\t\t\tthis.union( _box$4 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ], precise );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ||\n\t\t\tpoint.z < this.min.z || point.z > this.max.z ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ||\n\t\t\tbox.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector$b );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$b.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tlet min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t}\n\n\tintersectsTriangle( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0$2.subVectors( triangle.a, _center );\n\t\t_v1$7.subVectors( triangle.b, _center );\n\t\t_v2$4.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1$7, _v0$2 );\n\t\t_f1.subVectors( _v2$4, _v1$7 );\n\t\t_f2.subVectors( _v0$2, _v2$4 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tlet axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents );\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$b ).distanceTo( point );\n\n\t}\n\n\tgetBoundingSphere( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\ttarget.makeEmpty();\n\n\t\t} else {\n\n\t\t\tthis.getCenter( target.center );\n\n\t\t\ttarget.radius = this.getSize( _vector$b ).length() * 0.5;\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _points = [\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3()\n];\n\nconst _vector$b = /*@__PURE__*/ new Vector3();\n\nconst _box$4 = /*@__PURE__*/ new Box3();\n\n// triangle centered vertices\n\nconst _v0$2 = /*@__PURE__*/ new Vector3();\nconst _v1$7 = /*@__PURE__*/ new Vector3();\nconst _v2$4 = /*@__PURE__*/ new Vector3();\n\n// triangle edge vectors\n\nconst _f0 = /*@__PURE__*/ new Vector3();\nconst _f1 = /*@__PURE__*/ new Vector3();\nconst _f2 = /*@__PURE__*/ new Vector3();\n\nconst _center = /*@__PURE__*/ new Vector3();\nconst _extents = /*@__PURE__*/ new Vector3();\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\nconst _testAxis = /*@__PURE__*/ new Vector3();\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the separating axis\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the separating axis\n\t\tconst p0 = v0.dot( _testAxis );\n\t\tconst p1 = v1.dot( _testAxis );\n\t\tconst p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is separating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\nconst _box$3 = /*@__PURE__*/ new Box3();\nconst _v1$6 = /*@__PURE__*/ new Vector3();\nconst _v2$3 = /*@__PURE__*/ new Vector3();\n\nclass Sphere {\n\n\tconstructor( center = new Vector3(), radius = - 1 ) {\n\n\t\tthis.isSphere = true;\n\n\t\tthis.center = center;\n\t\tthis.radius = radius;\n\n\t}\n\n\tset( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points, optionalCenter ) {\n\n\t\tconst center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box$3.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tlet maxRadiusSq = 0;\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\treturn ( this.radius < 0 );\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.center.set( 0, 0, 0 );\n\t\tthis.radius = - 1;\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\t// Empty sphere produces empty bounding box\n\t\t\ttarget.makeEmpty();\n\t\t\treturn target;\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.center.copy( point );\n\n\t\t\tthis.radius = 0;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t_v1$6.subVectors( point, this.center );\n\n\t\tconst lengthSq = _v1$6.lengthSq();\n\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\t// calculate the minimal sphere\n\n\t\t\tconst length = Math.sqrt( lengthSq );\n\n\t\t\tconst delta = ( length - this.radius ) * 0.5;\n\n\t\t\tthis.center.addScaledVector( _v1$6, delta / length );\n\n\t\t\tthis.radius += delta;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tunion( sphere ) {\n\n\t\tif ( sphere.isEmpty() ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\tthis.copy( sphere );\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( this.center.equals( sphere.center ) === true ) {\n\n\t\t\t this.radius = Math.max( this.radius, sphere.radius );\n\n\t\t} else {\n\n\t\t\t_v2$3.subVectors( sphere.center, this.center ).setLength( sphere.radius );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).add( _v2$3 ) );\n\n\t\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).sub( _v2$3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$a = /*@__PURE__*/ new Vector3();\nconst _segCenter = /*@__PURE__*/ new Vector3();\nconst _segDir = /*@__PURE__*/ new Vector3();\nconst _diff = /*@__PURE__*/ new Vector3();\n\nconst _edge1 = /*@__PURE__*/ new Vector3();\nconst _edge2 = /*@__PURE__*/ new Vector3();\nconst _normal$1 = /*@__PURE__*/ new Vector3();\n\nclass Ray {\n\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {\n\n\t\tthis.origin = origin;\n\t\tthis.direction = direction;\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, t );\n\n\t}\n\n\tlookAt( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\trecast( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector$a ) );\n\n\t\treturn this;\n\n\t}\n\n\tclosestPointToPoint( point, target ) {\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tconst directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t}\n\n\tdistanceSqToPoint( point ) {\n\n\t\tconst directionDistance = _vector$a.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector$a.copy( this.origin ).addScaledVector( this.direction, directionDistance );\n\n\t\treturn _vector$a.distanceToSquared( point );\n\n\t}\n\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tconst a01 = - this.direction.dot( _segDir );\n\t\tconst b0 = _diff.dot( this.direction );\n\t\tconst b1 = - _diff.dot( _segDir );\n\t\tconst c = _diff.lengthSq();\n\t\tconst det = Math.abs( 1 - a01 * a01 );\n\t\tlet s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tconst invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.origin ).addScaledVector( this.direction, s0 );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segCenter ).addScaledVector( _segDir, s1 );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t}\n\n\tintersectSphere( sphere, target ) {\n\n\t\t_vector$a.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$a.dot( this.direction );\n\t\tconst d2 = _vector$a.dot( _vector$a ) - tca * tca;\n\t\tconst radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tconst thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tconst t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tconst t1 = tca + thc;\n\n\t\t// test to see if t1 is behind the ray - if so, return null\n\t\tif ( t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tdistanceToPlane( plane ) {\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t}\n\n\tintersectPlane( plane, target ) {\n\n\t\tconst t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t}\n\n\tintersectBox( box, target ) {\n\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tconst invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tconst origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\tif ( tymin > tmin || isNaN( tmin ) ) tmin = tymin;\n\n\t\tif ( tymax < tmax || isNaN( tmax ) ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn this.intersectBox( box, _vector$a ) !== null;\n\n\t}\n\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal$1.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tlet DdN = this.direction.dot( _normal$1 );\n\t\tlet sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = - 1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tconst QdN = - sign * _diff.dot( _normal$1 );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t}\n\n\tapplyMatrix4( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t}\n\n\tequals( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass Matrix4 {\n\n\tconstructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tMatrix4.prototype.isMatrix4 = true;\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t];\n\n\t\tif ( n11 !== undefined ) {\n\n\t\t\tthis.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\tcopyPosition( m ) {\n\n\t\tconst te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix3( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmakeBasis( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractRotation( m ) {\n\n\t\t// this method does not support reflection matrices\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tconst scaleX = 1 / _v1$5.setFromMatrixColumn( m, 0 ).length();\n\t\tconst scaleY = 1 / _v1$5.setFromMatrixColumn( m, 1 ).length();\n\t\tconst scaleZ = 1 / _v1$5.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromEuler( euler ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromQuaternion( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t}\n\n\tlookAt( eye, target, up ) {\n\n\t\tconst te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\t//TODO: make this more efficient\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n\t\treturn (\n\t\t\tn41 * (\n\t\t\t\t+ n14 * n23 * n32\n\t\t\t\t - n13 * n24 * n32\n\t\t\t\t - n14 * n22 * n33\n\t\t\t\t + n12 * n24 * n33\n\t\t\t\t + n13 * n22 * n34\n\t\t\t\t - n12 * n23 * n34\n\t\t\t) +\n\t\t\tn42 * (\n\t\t\t\t+ n11 * n23 * n34\n\t\t\t\t - n11 * n24 * n33\n\t\t\t\t + n14 * n21 * n33\n\t\t\t\t - n13 * n21 * n34\n\t\t\t\t + n13 * n24 * n31\n\t\t\t\t - n14 * n23 * n31\n\t\t\t) +\n\t\t\tn43 * (\n\t\t\t\t+ n11 * n24 * n32\n\t\t\t\t - n11 * n22 * n34\n\t\t\t\t - n14 * n21 * n32\n\t\t\t\t + n12 * n21 * n34\n\t\t\t\t + n14 * n22 * n31\n\t\t\t\t - n12 * n24 * n31\n\t\t\t) +\n\t\t\tn44 * (\n\t\t\t\t- n13 * n22 * n31\n\t\t\t\t - n11 * n23 * n32\n\t\t\t\t + n11 * n22 * n33\n\t\t\t\t + n13 * n21 * n32\n\t\t\t\t - n12 * n21 * n33\n\t\t\t\t + n12 * n23 * n31\n\t\t\t)\n\n\t\t);\n\n\t}\n\n\ttranspose() {\n\n\t\tconst te = this.elements;\n\t\tlet tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tsetPosition( x, y, z ) {\n\n\t\tconst te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tinvert() {\n\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\n\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n\n\t\tconst det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\n\n\t\tte[ 4 ] = t12 * detInv;\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\n\n\t\tte[ 8 ] = t13 * detInv;\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\n\n\t\tte[ 12 ] = t14 * detInv;\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\tscale( v ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxScaleOnAxis() {\n\n\t\tconst te = this.elements;\n\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t}\n\n\tmakeTranslation( x, y, z ) {\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x.x,\n\t\t\t\t0, 1, 0, x.y,\n\t\t\t\t0, 0, 1, x.z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t} else {\n\n\t\t\tthis.set(\n\n\t\t\t\t1, 0, 0, x,\n\t\t\t\t0, 1, 0, y,\n\t\t\t\t0, 0, 1, z,\n\t\t\t\t0, 0, 0, 1\n\n\t\t\t);\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationX( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationY( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationZ( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationAxis( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tconst c = Math.cos( angle );\n\t\tconst s = Math.sin( angle );\n\t\tconst t = 1 - c;\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\n\t\tconst tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\n\n\t\tthis.set(\n\n\t\t\t1, yx, zx, 0,\n\t\t\txy, 1, zy, 0,\n\t\t\txz, yz, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tdecompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tlet sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tconst sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tconst sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determine is negative, we need to invert one scale\n\t\tconst det = this.determinant();\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\t// scale the rotation part\n\t\t_m1$2.copy( this );\n\n\t\tconst invSX = 1 / sx;\n\t\tconst invSY = 1 / sy;\n\t\tconst invSZ = 1 / sz;\n\n\t\t_m1$2.elements[ 0 ] *= invSX;\n\t\t_m1$2.elements[ 1 ] *= invSX;\n\t\t_m1$2.elements[ 2 ] *= invSX;\n\n\t\t_m1$2.elements[ 4 ] *= invSY;\n\t\t_m1$2.elements[ 5 ] *= invSY;\n\t\t_m1$2.elements[ 6 ] *= invSY;\n\n\t\t_m1$2.elements[ 8 ] *= invSZ;\n\t\t_m1$2.elements[ 9 ] *= invSZ;\n\t\t_m1$2.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$2 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tmakePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = 2 * near / ( right - left );\n\t\tconst y = 2 * near / ( top - bottom );\n\n\t\tconst a = ( right + left ) / ( right - left );\n\t\tconst b = ( top + bottom ) / ( top - bottom );\n\n\t\tlet c, d;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tc = - ( far + near ) / ( far - near );\n\t\t\td = ( - 2 * far * near ) / ( far - near );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tc = - far / ( far - near );\n\t\t\td = ( - far * near ) / ( far - near );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a; \tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b; \tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c; \tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t}\n\n\tmakeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst te = this.elements;\n\t\tconst w = 1.0 / ( right - left );\n\t\tconst h = 1.0 / ( top - bottom );\n\t\tconst p = 1.0 / ( far - near );\n\n\t\tconst x = ( right + left ) * w;\n\t\tconst y = ( top + bottom ) * h;\n\n\t\tlet z, zInv;\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tz = ( far + near ) * p;\n\t\t\tzInv = - 2 * p;\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tz = near * p;\n\t\t\tzInv = - 1 * p;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\t\tte[ 8 ] = 0; \t\tte[ 12 ] = - x;\n\t\tte[ 1 ] = 0; \t\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0; \t\tte[ 13 ] = - y;\n\t\tte[ 2 ] = 0; \t\tte[ 6 ] = 0;\t\tte[ 10 ] = zInv;\tte[ 14 ] = - z;\n\t\tte[ 3 ] = 0; \t\tte[ 7 ] = 0;\t\tte[ 11 ] = 0;\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n}\n\nconst _v1$5 = /*@__PURE__*/ new Vector3();\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\nconst _x = /*@__PURE__*/ new Vector3();\nconst _y = /*@__PURE__*/ new Vector3();\nconst _z = /*@__PURE__*/ new Vector3();\n\nconst _matrix$1 = /*@__PURE__*/ new Matrix4();\nconst _quaternion$3 = /*@__PURE__*/ new Quaternion();\n\nclass Euler {\n\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER ) {\n\n\t\tthis.isEuler = true;\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget order() {\n\n\t\treturn this._order;\n\n\t}\n\n\tset order( value ) {\n\n\t\tthis._order = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, order = this._order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t}\n\n\tcopy( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements;\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\n\t\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\n\t\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\n\t\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = 0;\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\n\t\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\n\t\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\n\t\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._y = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromQuaternion( q, order, update ) {\n\n\t\t_matrix$1.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix$1, order, update );\n\n\t}\n\n\tsetFromVector3( v, order = this._order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order );\n\n\t}\n\n\treorder( newOrder ) {\n\n\t\t// WARNING: this discards revolution information -bhouston\n\n\t\t_quaternion$3.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion$3, newOrder );\n\n\t}\n\n\tequals( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t}\n\n\tfromArray( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this._x;\n\t\tyield this._y;\n\t\tyield this._z;\n\t\tyield this._order;\n\n\t}\n\n}\n\nEuler.DEFAULT_ORDER = 'XYZ';\n\nclass Layers {\n\n\tconstructor() {\n\n\t\tthis.mask = 1 | 0;\n\n\t}\n\n\tset( channel ) {\n\n\t\tthis.mask = ( 1 << channel | 0 ) >>> 0;\n\n\t}\n\n\tenable( channel ) {\n\n\t\tthis.mask |= 1 << channel | 0;\n\n\t}\n\n\tenableAll() {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t}\n\n\ttoggle( channel ) {\n\n\t\tthis.mask ^= 1 << channel | 0;\n\n\t}\n\n\tdisable( channel ) {\n\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\n\n\t}\n\n\tdisableAll() {\n\n\t\tthis.mask = 0;\n\n\t}\n\n\ttest( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n\tisEnabled( channel ) {\n\n\t\treturn ( this.mask & ( 1 << channel | 0 ) ) !== 0;\n\n\t}\n\n}\n\nlet _object3DId = 0;\n\nconst _v1$4 = /*@__PURE__*/ new Vector3();\nconst _q1 = /*@__PURE__*/ new Quaternion();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\nconst _target = /*@__PURE__*/ new Vector3();\n\nconst _position$3 = /*@__PURE__*/ new Vector3();\nconst _scale$2 = /*@__PURE__*/ new Vector3();\nconst _quaternion$2 = /*@__PURE__*/ new Quaternion();\n\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\n\nconst _addedEvent = { type: 'added' };\nconst _removedEvent = { type: 'removed' };\n\nclass Object3D extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isObject3D = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Object3D';\n\n\t\tthis.parent = null;\n\t\tthis.children = [];\n\n\t\tthis.up = Object3D.DEFAULT_UP.clone();\n\n\t\tconst position = new Vector3();\n\t\tconst rotation = new Euler();\n\t\tconst quaternion = new Quaternion();\n\t\tconst scale = new Vector3( 1, 1, 1 );\n\n\t\tfunction onRotationChange() {\n\n\t\t\tquaternion.setFromEuler( rotation, false );\n\n\t\t}\n\n\t\tfunction onQuaternionChange() {\n\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t\t}\n\n\t\trotation._onChange( onRotationChange );\n\t\tquaternion._onChange( onQuaternionChange );\n\n\t\tObject.defineProperties( this, {\n\t\t\tposition: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: position\n\t\t\t},\n\t\t\trotation: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: rotation\n\t\t\t},\n\t\t\tquaternion: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: quaternion\n\t\t\t},\n\t\t\tscale: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: scale\n\t\t\t},\n\t\t\tmodelViewMatrix: {\n\t\t\t\tvalue: new Matrix4()\n\t\t\t},\n\t\t\tnormalMatrix: {\n\t\t\t\tvalue: new Matrix3()\n\t\t\t}\n\t\t} );\n\n\t\tthis.matrix = new Matrix4();\n\t\tthis.matrixWorld = new Matrix4();\n\n\t\tthis.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\n\n\t\tthis.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\tthis.layers = new Layers();\n\t\tthis.visible = true;\n\n\t\tthis.castShadow = false;\n\t\tthis.receiveShadow = false;\n\n\t\tthis.frustumCulled = true;\n\t\tthis.renderOrder = 0;\n\n\t\tthis.animations = [];\n\n\t\tthis.userData = {};\n\n\t}\n\n\tonBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t}\n\n\tsetRotationFromAxisAngle( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t}\n\n\tsetRotationFromEuler( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t}\n\n\tsetRotationFromMatrix( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t}\n\n\tsetRotationFromQuaternion( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t}\n\n\trotateOnAxis( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateOnWorldAxis( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t}\n\n\trotateY( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t}\n\n\ttranslateOnAxis( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1$4.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1$4.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslateX( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t}\n\n\ttranslateY( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t}\n\n\ttranslateZ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t}\n\n\tlocalToWorld( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t}\n\n\tworldToLocal( vector ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );\n\n\t}\n\n\tlookAt( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tconst parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position$3.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1$1.lookAt( _position$3, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$1.lookAt( _target, _position$3, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$1 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$1.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$1 );\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\n\n\t\t}\n\n\t}\n\n\tadd( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object can\\'t be added as a child of itself.', object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object && object.isObject3D ) {\n\n\t\t\tif ( object.parent !== null ) {\n\n\t\t\t\tobject.parent.remove( object );\n\n\t\t\t}\n\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst index = this.children.indexOf( object );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremoveFromParent() {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tparent.remove( this );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclear() {\n\n\t\treturn this.remove( ... this.children );\n\n\t}\n\n\tattach( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\t// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1$1.copy( this.matrixWorld ).invert();\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1$1.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$1 );\n\n\t\tthis.add( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\treturn this;\n\n\t}\n\n\tgetObjectById( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t}\n\n\tgetObjectByName( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t}\n\n\tgetObjectByProperty( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst child = this.children[ i ];\n\t\t\tconst object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tgetObjectsByProperty( name, value, result = [] ) {\n\n\t\tif ( this[ name ] === value ) result.push( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].getObjectsByProperty( name, value, result );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tgetWorldPosition( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t}\n\n\tgetWorldQuaternion( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, target, _scale$2 );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldScale( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, _quaternion$2, target );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t}\n\n\traycast( /* raycaster, intersects */ ) {}\n\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseVisible( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseAncestors( callback ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// update children\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tconst child = children[ i ];\n\n\t\t\tif ( child.matrixWorldAutoUpdate === true || force === true ) {\n\n\t\t\t\tchild.updateMatrixWorld( force );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.parent === null ) {\n\n\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t} else {\n\n\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t}\n\n\t\t// update children\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tconst children = this.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tconst child = children[ i ];\n\n\t\t\t\tif ( child.matrixWorldAutoUpdate === true ) {\n\n\t\t\t\t\tchild.updateWorldMatrix( false, true );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tconst output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {},\n\t\t\t\tskeletons: {},\n\t\t\t\tanimations: {},\n\t\t\t\tnodes: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tconst object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\t\tobject.up = this.up.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\n\n\t\t}\n\n\t\tif ( this.isBatchedMesh ) {\n\n\t\t\tobject.type = 'BatchedMesh';\n\t\t\tobject.perObjectFrustumCulled = this.perObjectFrustumCulled;\n\t\t\tobject.sortObjects = this.sortObjects;\n\n\t\t\tobject.drawRanges = this._drawRanges;\n\t\t\tobject.reservedRanges = this._reservedRanges;\n\n\t\t\tobject.visibility = this._visibility;\n\t\t\tobject.active = this._active;\n\t\t\tobject.bounds = this._bounds.map( bound => ( {\n\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\tboxMin: bound.box.min.toArray(),\n\t\t\t\tboxMax: bound.box.max.toArray(),\n\n\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\tsphereRadius: bound.sphere.radius,\n\t\t\t\tsphereCenter: bound.sphere.center.toArray()\n\t\t\t} ) );\n\n\t\t\tobject.maxGeometryCount = this._maxGeometryCount;\n\t\t\tobject.maxVertexCount = this._maxVertexCount;\n\t\t\tobject.maxIndexCount = this._maxIndexCount;\n\n\t\t\tobject.geometryInitialized = this._geometryInitialized;\n\t\t\tobject.geometryCount = this._geometryCount;\n\n\t\t\tobject.matricesTexture = this._matricesTexture.toJSON( meta );\n\n\t\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\t\tobject.boundingSphere = {\n\t\t\t\t\tcenter: object.boundingSphere.center.toArray(),\n\t\t\t\t\tradius: object.boundingSphere.radius\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\tif ( this.boundingBox !== null ) {\n\n\t\t\t\tobject.boundingBox = {\n\t\t\t\t\tmin: object.boundingBox.min.toArray(),\n\t\t\t\t\tmax: object.boundingBox.max.toArray()\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isScene ) {\n\n\t\t\tif ( this.background ) {\n\n\t\t\t\tif ( this.background.isColor ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON();\n\n\t\t\t\t} else if ( this.background.isTexture ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true ) {\n\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\n\n\t\t\t}\n\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tconst parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tconst shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.isSkinnedMesh ) {\n\n\t\t\tobject.bindMode = this.bindMode;\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\n\n\t\t\tif ( this.skeleton !== undefined ) {\n\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\n\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tconst uuids = [];\n\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.animations.length > 0 ) {\n\n\t\t\tobject.animations = [];\n\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\n\n\t\t\t\tconst animation = this.animations[ i ];\n\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst geometries = extractFromCache( meta.geometries );\n\t\t\tconst materials = extractFromCache( meta.materials );\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst shapes = extractFromCache( meta.shapes );\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\n\t\t\tconst animations = extractFromCache( meta.animations );\n\t\t\tconst nodes = extractFromCache( meta.nodes );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\n\t\t\tif ( nodes.length > 0 ) output.nodes = nodes;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t}\n\n\tclone( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t}\n\n\tcopy( source, recursive = true ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.rotation.order = source.rotation.order;\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\tthis.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.animations = source.animations.slice();\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tconst child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nObject3D.DEFAULT_UP = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\n\nconst _v0$1 = /*@__PURE__*/ new Vector3();\nconst _v1$3 = /*@__PURE__*/ new Vector3();\nconst _v2$2 = /*@__PURE__*/ new Vector3();\nconst _v3$1 = /*@__PURE__*/ new Vector3();\n\nconst _vab = /*@__PURE__*/ new Vector3();\nconst _vac = /*@__PURE__*/ new Vector3();\nconst _vbc = /*@__PURE__*/ new Vector3();\nconst _vap = /*@__PURE__*/ new Vector3();\nconst _vbp = /*@__PURE__*/ new Vector3();\nconst _vcp = /*@__PURE__*/ new Vector3();\n\nlet warnedGetUV = false;\n\nclass Triangle {\n\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\n\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\n\t}\n\n\tstatic getNormal( a, b, c, target ) {\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0$1.subVectors( a, b );\n\t\ttarget.cross( _v0$1 );\n\n\t\tconst targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t}\n\n\t// static/instance method to calculate barycentric coordinates\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\tstatic getBarycoord( point, a, b, c, target ) {\n\n\t\t_v0$1.subVectors( c, a );\n\t\t_v1$3.subVectors( b, a );\n\t\t_v2$2.subVectors( point, a );\n\n\t\tconst dot00 = _v0$1.dot( _v0$1 );\n\t\tconst dot01 = _v0$1.dot( _v1$3 );\n\t\tconst dot02 = _v0$1.dot( _v2$2 );\n\t\tconst dot11 = _v1$3.dot( _v1$3 );\n\t\tconst dot12 = _v1$3.dot( _v2$2 );\n\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\ttarget.set( 0, 0, 0 );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst invDenom = 1 / denom;\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t}\n\n\tstatic containsPoint( point, a, b, c ) {\n\n\t\t// if the triangle is degenerate then we can't contain a point\n\t\tif ( this.getBarycoord( point, a, b, c, _v3$1 ) === null ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 );\n\n\t}\n\n\tstatic getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );\n\n\t}\n\n\tstatic getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {\n\n\t\tif ( this.getBarycoord( point, p1, p2, p3, _v3$1 ) === null ) {\n\n\t\t\ttarget.x = 0;\n\t\t\ttarget.y = 0;\n\t\t\tif ( 'z' in target ) target.z = 0;\n\t\t\tif ( 'w' in target ) target.w = 0;\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttarget.setScalar( 0 );\n\t\ttarget.addScaledVector( v1, _v3$1.x );\n\t\ttarget.addScaledVector( v2, _v3$1.y );\n\t\ttarget.addScaledVector( v3, _v3$1.z );\n\n\t\treturn target;\n\n\t}\n\n\tstatic isFrontFacing( a, b, c, direction ) {\n\n\t\t_v0$1.subVectors( c, b );\n\t\t_v1$3.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn ( _v0$1.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;\n\n\t}\n\n\tset( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\n\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t}\n\n\tgetArea() {\n\n\t\t_v0$1.subVectors( this.c, this.b );\n\t\t_v1$3.subVectors( this.a, this.b );\n\n\t\treturn _v0$1.cross( _v1$3 ).length() * 0.5;\n\n\t}\n\n\tgetMidpoint( target ) {\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t}\n\n\tgetNormal( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t}\n\n\tgetPlane( target ) {\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t}\n\n\tgetBarycoord( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t}\n\n\tgetUV( point, uv1, uv2, uv3, target ) { // @deprecated, r151\n\n\t\tif ( warnedGetUV === false ) {\n\n\t\t\tconsole.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );\n\n\t\t\twarnedGetUV = true;\n\n\t\t}\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );\n\n\t}\n\n\tgetInterpolation( point, v1, v2, v3, target ) {\n\n\t\treturn Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t}\n\n\tisFrontFacing( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t}\n\n\tclosestPointToPoint( p, target ) {\n\n\t\tconst a = this.a, b = this.b, c = this.c;\n\t\tlet v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tconst d1 = _vab.dot( _vap );\n\t\tconst d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tconst d3 = _vab.dot( _vbp );\n\t\tconst d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tconst vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tconst d5 = _vab.dot( _vcp );\n\t\tconst d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tconst vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tconst va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tconst denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t}\n\n\tequals( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n}\n\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nconst _hslA = { h: 0, s: 0, l: 0 };\nconst _hslB = { h: 0, s: 0, l: 0 };\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\nclass Color {\n\n\tconstructor( r, g, b ) {\n\n\t\tthis.isColor = true;\n\n\t\tthis.r = 1;\n\t\tthis.g = 1;\n\t\tthis.b = 1;\n\n\t\treturn this.set( r, g, b );\n\n\t}\n\n\tset( r, g, b ) {\n\n\t\tif ( g === undefined && b === undefined ) {\n\n\t\t\t// r is THREE.Color, hex or string\n\n\t\t\tconst value = r;\n\n\t\t\tif ( value && value.isColor ) {\n\n\t\t\t\tthis.copy( value );\n\n\t\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\t\tthis.setHex( value );\n\n\t\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\t\tthis.setStyle( value );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.setRGB( r, g, b );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetHex( hex, colorSpace = SRGBColorSpace ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetRGB( r, g, b, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetHSL( h, s, l, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = euclideanModulo( h, 1 );\n\t\ts = clamp( s, 0, 1 );\n\t\tl = clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tconst q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\tColorManagement.toWorkingColorSpace( this, colorSpace );\n\n\t\treturn this;\n\n\t}\n\n\tsetStyle( style, colorSpace = SRGBColorSpace ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tlet m;\n\n\t\tif ( m = /^(\\w+)\\(([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tlet color;\n\t\t\tconst name = m[ 1 ];\n\t\t\tconst components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 1 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 2 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tMath.min( 255, parseInt( color[ 3 ], 10 ) ) / 255,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setRGB(\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 1 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 2 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tMath.min( 100, parseInt( color[ 3 ], 10 ) ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setHSL(\n\t\t\t\t\t\t\tparseFloat( color[ 1 ] ) / 360,\n\t\t\t\t\t\t\tparseFloat( color[ 2 ] ) / 100,\n\t\t\t\t\t\t\tparseFloat( color[ 3 ] ) / 100,\n\t\t\t\t\t\t\tcolorSpace\n\t\t\t\t\t\t);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tconsole.warn( 'THREE.Color: Unknown color model ' + style );\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tconst hex = m[ 1 ];\n\t\t\tconst size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\treturn this.setRGB(\n\t\t\t\t\tparseInt( hex.charAt( 0 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 1 ), 16 ) / 15,\n\t\t\t\t\tparseInt( hex.charAt( 2 ), 16 ) / 15,\n\t\t\t\t\tcolorSpace\n\t\t\t\t);\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\treturn this.setHex( parseInt( hex, 16 ), colorSpace );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Invalid hex color ' + style );\n\n\t\t\t}\n\n\t\t} else if ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style, colorSpace );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetColorName( style, colorSpace = SRGBColorSpace ) {\n\n\t\t// color keywords\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex, colorSpace );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t}\n\n\tcopy( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t}\n\n\tcopySRGBToLinear( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tcopyLinearToSRGB( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tconvertSRGBToLinear() {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t}\n\n\tconvertLinearToSRGB() {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t}\n\n\tgetHex( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\treturn Math.round( clamp( _color.r * 255, 0, 255 ) ) * 65536 + Math.round( clamp( _color.g * 255, 0, 255 ) ) * 256 + Math.round( clamp( _color.b * 255, 0, 255 ) );\n\n\t}\n\n\tgetHexString( colorSpace = SRGBColorSpace ) {\n\n\t\treturn ( '000000' + this.getHex( colorSpace ).toString( 16 ) ).slice( - 6 );\n\n\t}\n\n\tgetHSL( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tconst max = Math.max( r, g, b );\n\t\tconst min = Math.min( r, g, b );\n\n\t\tlet hue, saturation;\n\t\tconst lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tconst delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t}\n\n\tgetRGB( target, colorSpace = ColorManagement.workingColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\ttarget.r = _color.r;\n\t\ttarget.g = _color.g;\n\t\ttarget.b = _color.b;\n\n\t\treturn target;\n\n\t}\n\n\tgetStyle( colorSpace = SRGBColorSpace ) {\n\n\t\tColorManagement.fromWorkingColorSpace( _color.copy( this ), colorSpace );\n\n\t\tconst r = _color.r, g = _color.g, b = _color.b;\n\n\t\tif ( colorSpace !== SRGBColorSpace ) {\n\n\t\t\t// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n\t\t\treturn `color(${ colorSpace } ${ r.toFixed( 3 ) } ${ g.toFixed( 3 ) } ${ b.toFixed( 3 ) })`;\n\n\t\t}\n\n\t\treturn `rgb(${ Math.round( r * 255 ) },${ Math.round( g * 255 ) },${ Math.round( b * 255 ) })`;\n\n\t}\n\n\toffsetHSL( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\treturn this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );\n\n\t}\n\n\tadd( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t}\n\n\taddColors( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t}\n\n\tlerp( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpColors( color1, color2, alpha ) {\n\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpHSL( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\tthis.r = v.x;\n\t\tthis.g = v.y;\n\t\tthis.b = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst r = this.r, g = this.g, b = this.b;\n\t\tconst e = m.elements;\n\n\t\tthis.r = e[ 0 ] * r + e[ 3 ] * g + e[ 6 ] * b;\n\t\tthis.g = e[ 1 ] * r + e[ 4 ] * g + e[ 7 ] * b;\n\t\tthis.b = e[ 2 ] * r + e[ 5 ] * g + e[ 8 ] * b;\n\n\t\treturn this;\n\n\t}\n\n\tequals( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.r = attribute.getX( index );\n\t\tthis.g = attribute.getY( index );\n\t\tthis.b = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.getHex();\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.r;\n\t\tyield this.g;\n\t\tyield this.b;\n\n\t}\n\n}\n\nconst _color = /*@__PURE__*/ new Color();\n\nColor.NAMES = _colorKeywords;\n\nlet _materialId = 0;\n\nclass Material extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isMaterial = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _materialId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Material';\n\n\t\tthis.blending = NormalBlending;\n\t\tthis.side = FrontSide;\n\t\tthis.vertexColors = false;\n\n\t\tthis.opacity = 1;\n\t\tthis.transparent = false;\n\t\tthis.alphaHash = false;\n\n\t\tthis.blendSrc = SrcAlphaFactor;\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\n\t\tthis.blendEquation = AddEquation;\n\t\tthis.blendSrcAlpha = null;\n\t\tthis.blendDstAlpha = null;\n\t\tthis.blendEquationAlpha = null;\n\t\tthis.blendColor = new Color( 0, 0, 0 );\n\t\tthis.blendAlpha = 0;\n\n\t\tthis.depthFunc = LessEqualDepth;\n\t\tthis.depthTest = true;\n\t\tthis.depthWrite = true;\n\n\t\tthis.stencilWriteMask = 0xff;\n\t\tthis.stencilFunc = AlwaysStencilFunc;\n\t\tthis.stencilRef = 0;\n\t\tthis.stencilFuncMask = 0xff;\n\t\tthis.stencilFail = KeepStencilOp;\n\t\tthis.stencilZFail = KeepStencilOp;\n\t\tthis.stencilZPass = KeepStencilOp;\n\t\tthis.stencilWrite = false;\n\n\t\tthis.clippingPlanes = null;\n\t\tthis.clipIntersection = false;\n\t\tthis.clipShadows = false;\n\n\t\tthis.shadowSide = null;\n\n\t\tthis.colorWrite = true;\n\n\t\tthis.precision = null; // override the renderer's default precision for this material\n\n\t\tthis.polygonOffset = false;\n\t\tthis.polygonOffsetFactor = 0;\n\t\tthis.polygonOffsetUnits = 0;\n\n\t\tthis.dithering = false;\n\n\t\tthis.alphaToCoverage = false;\n\t\tthis.premultipliedAlpha = false;\n\t\tthis.forceSinglePass = false;\n\n\t\tthis.visible = true;\n\n\t\tthis.toneMapped = true;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\n\t\tthis._alphaTest = 0;\n\n\t}\n\n\tget alphaTest() {\n\n\t\treturn this._alphaTest;\n\n\t}\n\n\tset alphaTest( value ) {\n\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._alphaTest = value;\n\n\t}\n\n\tonBuild( /* shaderobject, renderer */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\n\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\n\n\tcustomProgramCacheKey() {\n\n\t\treturn this.onBeforeCompile.toString();\n\n\t}\n\n\tsetValues( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: parameter '${ key }' has value of undefined.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\tconsole.warn( `THREE.Material: '${ key }' is not a property of THREE.${ this.type }.` );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRootObject ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\n\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\n\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.iridescence !== undefined ) data.iridescence = this.iridescence;\n\t\tif ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;\n\t\tif ( this.iridescenceThicknessRange !== undefined ) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n\n\t\tif ( this.iridescenceMap && this.iridescenceMap.isTexture ) {\n\n\t\t\tdata.iridescenceMap = this.iridescenceMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture ) {\n\n\t\t\tdata.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;\n\t\tif ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;\n\n\t\tif ( this.anisotropyMap && this.anisotropyMap.isTexture ) {\n\n\t\t\tdata.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\n\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\n\t\t}\n\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\n\t\tif ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors === true ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.transparent === true ) data.transparent = true;\n\n\t\tif ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;\n\t\tif ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;\n\t\tif ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;\n\t\tif ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;\n\t\tif ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;\n\t\tif ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;\n\t\tif ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();\n\t\tif ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;\n\n\t\tif ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;\n\t\tif ( this.depthTest === false ) data.depthTest = this.depthTest;\n\t\tif ( this.depthWrite === false ) data.depthWrite = this.depthWrite;\n\t\tif ( this.colorWrite === false ) data.colorWrite = this.colorWrite;\n\n\t\tif ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;\n\t\tif ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;\n\t\tif ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;\n\t\tif ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;\n\t\tif ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;\n\t\tif ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;\n\t\tif ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;\n\t\tif ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.alphaHash === true ) data.alphaHash = true;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = true;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;\n\t\tif ( this.forceSinglePass === true ) data.forceSinglePass = true;\n\n\t\tif ( this.wireframe === true ) data.wireframe = true;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.flatShading === true ) data.flatShading = true;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( this.fog === false ) data.fog = false;\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\t\tthis.blendColor.copy( source.blendColor );\n\t\tthis.blendAlpha = source.blendAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tconst srcPlanes = source.clippingPlanes;\n\t\tlet dstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tconst n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.alphaHash = source.alphaHash;\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\t\tthis.forceSinglePass = source.forceSinglePass;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\nclass MeshBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshBasicMaterial = true;\n\n\t\tthis.type = 'MeshBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // emissive\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\n\nconst _tables = /*@__PURE__*/ _generateTables();\n\nfunction _generateTables() {\n\n\t// float32 to float16 helpers\n\n\tconst buffer = new ArrayBuffer( 4 );\n\tconst floatView = new Float32Array( buffer );\n\tconst uint32View = new Uint32Array( buffer );\n\n\tconst baseTable = new Uint32Array( 512 );\n\tconst shiftTable = new Uint32Array( 512 );\n\n\tfor ( let i = 0; i < 256; ++ i ) {\n\n\t\tconst e = i - 127;\n\n\t\t// very small number (0, -0)\n\n\t\tif ( e < - 27 ) {\n\n\t\t\tbaseTable[ i ] = 0x0000;\n\t\t\tbaseTable[ i | 0x100 ] = 0x8000;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// small number (denorm)\n\n\t\t} else if ( e < - 14 ) {\n\n\t\t\tbaseTable[ i ] = 0x0400 >> ( - e - 14 );\n\t\t\tbaseTable[ i | 0x100 ] = ( 0x0400 >> ( - e - 14 ) ) | 0x8000;\n\t\t\tshiftTable[ i ] = - e - 1;\n\t\t\tshiftTable[ i | 0x100 ] = - e - 1;\n\n\t\t\t// normal number\n\n\t\t} else if ( e <= 15 ) {\n\n\t\t\tbaseTable[ i ] = ( e + 15 ) << 10;\n\t\t\tbaseTable[ i | 0x100 ] = ( ( e + 15 ) << 10 ) | 0x8000;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t\t// large number (Infinity, -Infinity)\n\n\t\t} else if ( e < 128 ) {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 24;\n\t\t\tshiftTable[ i | 0x100 ] = 24;\n\n\t\t\t// stay (NaN, Infinity, -Infinity)\n\n\t\t} else {\n\n\t\t\tbaseTable[ i ] = 0x7c00;\n\t\t\tbaseTable[ i | 0x100 ] = 0xfc00;\n\t\t\tshiftTable[ i ] = 13;\n\t\t\tshiftTable[ i | 0x100 ] = 13;\n\n\t\t}\n\n\t}\n\n\t// float16 to float32 helpers\n\n\tconst mantissaTable = new Uint32Array( 2048 );\n\tconst exponentTable = new Uint32Array( 64 );\n\tconst offsetTable = new Uint32Array( 64 );\n\n\tfor ( let i = 1; i < 1024; ++ i ) {\n\n\t\tlet m = i << 13; // zero pad mantissa bits\n\t\tlet e = 0; // zero exponent\n\n\t\t// normalized\n\t\twhile ( ( m & 0x00800000 ) === 0 ) {\n\n\t\t\tm <<= 1;\n\t\t\te -= 0x00800000; // decrement exponent\n\n\t\t}\n\n\t\tm &= ~ 0x00800000; // clear leading 1 bit\n\t\te += 0x38800000; // adjust bias\n\n\t\tmantissaTable[ i ] = m | e;\n\n\t}\n\n\tfor ( let i = 1024; i < 2048; ++ i ) {\n\n\t\tmantissaTable[ i ] = 0x38000000 + ( ( i - 1024 ) << 13 );\n\n\t}\n\n\tfor ( let i = 1; i < 31; ++ i ) {\n\n\t\texponentTable[ i ] = i << 23;\n\n\t}\n\n\texponentTable[ 31 ] = 0x47800000;\n\texponentTable[ 32 ] = 0x80000000;\n\n\tfor ( let i = 33; i < 63; ++ i ) {\n\n\t\texponentTable[ i ] = 0x80000000 + ( ( i - 32 ) << 23 );\n\n\t}\n\n\texponentTable[ 63 ] = 0xc7800000;\n\n\tfor ( let i = 1; i < 64; ++ i ) {\n\n\t\tif ( i !== 32 ) {\n\n\t\t\toffsetTable[ i ] = 1024;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tfloatView: floatView,\n\t\tuint32View: uint32View,\n\t\tbaseTable: baseTable,\n\t\tshiftTable: shiftTable,\n\t\tmantissaTable: mantissaTable,\n\t\texponentTable: exponentTable,\n\t\toffsetTable: offsetTable\n\t};\n\n}\n\n// float32 to float16\n\nfunction toHalfFloat( val ) {\n\n\tif ( Math.abs( val ) > 65504 ) console.warn( 'THREE.DataUtils.toHalfFloat(): Value out of range.' );\n\n\tval = clamp( val, - 65504, 65504 );\n\n\t_tables.floatView[ 0 ] = val;\n\tconst f = _tables.uint32View[ 0 ];\n\tconst e = ( f >> 23 ) & 0x1ff;\n\treturn _tables.baseTable[ e ] + ( ( f & 0x007fffff ) >> _tables.shiftTable[ e ] );\n\n}\n\n// float16 to float32\n\nfunction fromHalfFloat( val ) {\n\n\tconst m = val >> 10;\n\t_tables.uint32View[ 0 ] = _tables.mantissaTable[ _tables.offsetTable[ m ] + ( val & 0x3ff ) ] + _tables.exponentTable[ m ];\n\treturn _tables.floatView[ 0 ];\n\n}\n\nconst DataUtils = {\n\ttoHalfFloat: toHalfFloat,\n\tfromHalfFloat: fromHalfFloat,\n};\n\nconst _vector$9 = /*@__PURE__*/ new Vector3();\nconst _vector2$1 = /*@__PURE__*/ new Vector2();\n\nclass BufferAttribute {\n\n\tconstructor( array, itemSize, normalized = false ) {\n\n\t\tif ( Array.isArray( array ) ) {\n\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t\t}\n\n\t\tthis.isBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.array = array;\n\t\tthis.itemSize = itemSize;\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\t\tthis.normalized = normalized;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis._updateRange = { offset: 0, count: - 1 };\n\t\tthis.updateRanges = [];\n\t\tthis.gpuType = FloatType;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tget updateRange() {\n\n\t\tconsole.warn( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\t\tthis.gpuType = source.gpuType;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyArray( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tif ( this.itemSize === 2 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector2$1.fromBufferAttribute( this, i );\n\t\t\t\t_vector2$1.applyMatrix3( m );\n\n\t\t\t\tthis.setXY( i, _vector2$1.x, _vector2$1.y );\n\n\t\t\t}\n\n\t\t} else if ( this.itemSize === 3 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector$9.fromBufferAttribute( this, i );\n\t\t\t\t_vector$9.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.fromBufferAttribute( this, i );\n\n\t\t\t_vector$9.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\t// Matching BufferAttribute constructor, do not normalize the array.\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index, component ) {\n\n\t\tlet value = this.array[ index * this.itemSize + component ];\n\n\t\tif ( this.normalized ) value = denormalize( value, this.array );\n\n\t\treturn value;\n\n\t}\n\n\tsetComponent( index, component, value ) {\n\n\t\tif ( this.normalized ) value = normalize( value, this.array );\n\n\t\tthis.array[ index * this.itemSize + component ] = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.array[ index * this.itemSize ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.array[ index * this.itemSize + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.array[ index * this.itemSize + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.array[ index * this.itemSize + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.from( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\n\n\t\treturn data;\n\n\t}\n\n}\n\n//\n\nclass Int8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t\tthis.isFloat16BufferAttribute = true;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = fromHalfFloat( this.array[ index * this.itemSize ] );\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.array[ index * this.itemSize ] = toHalfFloat( x );\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = fromHalfFloat( this.array[ index * this.itemSize + 1 ] );\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.array[ index * this.itemSize + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = fromHalfFloat( this.array[ index * this.itemSize + 2 ] );\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.array[ index * this.itemSize + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = fromHalfFloat( this.array[ index * this.itemSize + 3 ] );\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.array[ index * this.itemSize + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.array[ index + 0 ] = toHalfFloat( x );\n\t\tthis.array[ index + 1 ] = toHalfFloat( y );\n\t\tthis.array[ index + 2 ] = toHalfFloat( z );\n\t\tthis.array[ index + 3 ] = toHalfFloat( w );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nclass Float32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float64BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float64Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nlet _id$2 = 0;\n\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$8 = /*@__PURE__*/ new Vector3();\n\nclass BufferGeometry extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBufferGeometry = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id$2 ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'BufferGeometry';\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\n\t\tthis.morphAttributes = {};\n\t\tthis.morphTargetsRelative = false;\n\n\t\tthis.groups = [];\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tthis.drawRange = { start: 0, count: Infinity };\n\n\t\tthis.userData = {};\n\n\t}\n\n\tgetIndex() {\n\n\t\treturn this.index;\n\n\t}\n\n\tsetIndex( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetAttribute( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t}\n\n\tsetAttribute( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t}\n\n\tdeleteAttribute( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t}\n\n\thasAttribute( name ) {\n\n\t\treturn this.attributes[ name ] !== undefined;\n\n\t}\n\n\taddGroup( start, count, materialIndex = 0 ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex\n\n\t\t} );\n\n\t}\n\n\tclearGroups() {\n\n\t\tthis.groups = [];\n\n\t}\n\n\tsetDrawRange( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tconst normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tconst tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t_m1.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateY( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tscale( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tlookAt( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t}\n\n\tcenter() {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tconst position = [];\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst point = points[ i ];\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t}\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingBox.set(\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\n\t\t\t);\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box$2.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.min, _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.max, _box$2.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$2.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\t_box$2.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$2.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$2.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$2.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box$2.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector$8.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector$8.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector$8.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeTangents() {\n\n\t\tconst index = this.index;\n\t\tconst attributes = this.attributes;\n\n\t\t// based on http://www.terathon.com/code/tangent.html\n\t\t// (per vertex tangents)\n\n\t\tif ( index === null ||\n\t\t\t attributes.position === undefined ||\n\t\t\t attributes.normal === undefined ||\n\t\t\t attributes.uv === undefined ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst indices = index.array;\n\t\tconst positions = attributes.position.array;\n\t\tconst normals = attributes.normal.array;\n\t\tconst uvs = attributes.uv.array;\n\n\t\tconst nVertices = positions.length / 3;\n\n\t\tif ( this.hasAttribute( 'tangent' ) === false ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );\n\n\t\t}\n\n\t\tconst tangents = this.getAttribute( 'tangent' ).array;\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < nVertices; i ++ ) {\n\n\t\t\ttan1[ i ] = new Vector3();\n\t\t\ttan2[ i ] = new Vector3();\n\n\t\t}\n\n\t\tconst vA = new Vector3(),\n\t\t\tvB = new Vector3(),\n\t\t\tvC = new Vector3(),\n\n\t\t\tuvA = new Vector2(),\n\t\t\tuvB = new Vector2(),\n\t\t\tuvC = new Vector2(),\n\n\t\t\tsdir = new Vector3(),\n\t\t\ttdir = new Vector3();\n\n\t\tfunction handleTriangle( a, b, c ) {\n\n\t\t\tvA.fromArray( positions, a * 3 );\n\t\t\tvB.fromArray( positions, b * 3 );\n\t\t\tvC.fromArray( positions, c * 3 );\n\n\t\t\tuvA.fromArray( uvs, a * 2 );\n\t\t\tuvB.fromArray( uvs, b * 2 );\n\t\t\tuvC.fromArray( uvs, c * 2 );\n\n\t\t\tvB.sub( vA );\n\t\t\tvC.sub( vA );\n\n\t\t\tuvB.sub( uvA );\n\t\t\tuvC.sub( uvA );\n\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\n\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\n\n\t\t\tif ( ! isFinite( r ) ) return;\n\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\n\n\t\t\ttan1[ a ].add( sdir );\n\t\t\ttan1[ b ].add( sdir );\n\t\t\ttan1[ c ].add( sdir );\n\n\t\t\ttan2[ a ].add( tdir );\n\t\t\ttan2[ b ].add( tdir );\n\t\t\ttan2[ c ].add( tdir );\n\n\t\t}\n\n\t\tlet groups = this.groups;\n\n\t\tif ( groups.length === 0 ) {\n\n\t\t\tgroups = [ {\n\t\t\t\tstart: 0,\n\t\t\t\tcount: indices.length\n\t\t\t} ];\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleTriangle(\n\t\t\t\t\tindices[ j + 0 ],\n\t\t\t\t\tindices[ j + 1 ],\n\t\t\t\t\tindices[ j + 2 ]\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\n\t\tconst n = new Vector3(), n2 = new Vector3();\n\n\t\tfunction handleVertex( v ) {\n\n\t\t\tn.fromArray( normals, v * 3 );\n\t\t\tn2.copy( n );\n\n\t\t\tconst t = tan1[ v ];\n\n\t\t\t// Gram-Schmidt orthogonalize\n\n\t\t\ttmp.copy( t );\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\n\n\t\t\t// Calculate handedness\n\n\t\t\ttmp2.crossVectors( n2, t );\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\n\t\t\tconst w = ( test < 0.0 ) ? - 1.0 : 1.0;\n\n\t\t\ttangents[ v * 4 ] = tmp.x;\n\t\t\ttangents[ v * 4 + 1 ] = tmp.y;\n\t\t\ttangents[ v * 4 + 2 ] = tmp.z;\n\t\t\ttangents[ v * 4 + 3 ] = w;\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleVertex( indices[ j + 0 ] );\n\t\t\t\thandleVertex( indices[ j + 1 ] );\n\t\t\t\thandleVertex( indices[ j + 2 ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeVertexNormals() {\n\n\t\tconst index = this.index;\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute !== undefined ) {\n\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\n\n\t\t\tif ( normalAttribute === undefined ) {\n\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\n\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tconst vA = index.getX( i + 0 );\n\t\t\t\t\tconst vB = index.getX( i + 1 );\n\t\t\t\t\tconst vC = index.getX( i + 2 );\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\n\n\t\t\t\t\tnA.add( cb );\n\t\t\t\t\tnB.add( cb );\n\t\t\t\t\tnC.add( cb );\n\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tnormalAttribute.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tnormalizeNormals() {\n\n\t\tconst normals = this.attributes.normal;\n\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$8.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t}\n\n\ttoNonIndexed() {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tconst array = attribute.array;\n\t\t\tconst itemSize = attribute.itemSize;\n\t\t\tconst normalized = attribute.normalized;\n\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tlet index = 0, index2 = 0;\n\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst geometry2 = new BufferGeometry();\n\n\t\tconst indices = this.index.array;\n\t\tconst attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = this.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst morphArray = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = morphAttribute[ i ];\n\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = this.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tconst parameters = this.parameters;\n\n\t\t\tfor ( const key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n\t\tdata.data = { attributes: {} };\n\n\t\tconst index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\n\n\t\t}\n\n\t\tconst morphAttributes = {};\n\t\tlet hasMorphAttributes = false;\n\n\t\tfor ( const key in this.morphAttributes ) {\n\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = attributeArray[ i ];\n\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tconst groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = {\n\t\t\t\tcenter: boundingSphere.center.toArray(),\n\t\t\t\tradius: boundingSphere.radius\n\t\t\t};\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// used for storing cloned, shared data\n\n\t\tconst data = {};\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tconst index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone( data ) );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tconst attributes = source.attributes;\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = source.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = source.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tconst boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tconst boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nconst _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();\nconst _ray$3 = /*@__PURE__*/ new Ray();\nconst _sphere$6 = /*@__PURE__*/ new Sphere();\nconst _sphereHitAt = /*@__PURE__*/ new Vector3();\n\nconst _vA$1 = /*@__PURE__*/ new Vector3();\nconst _vB$1 = /*@__PURE__*/ new Vector3();\nconst _vC$1 = /*@__PURE__*/ new Vector3();\n\nconst _tempA = /*@__PURE__*/ new Vector3();\nconst _morphA = /*@__PURE__*/ new Vector3();\n\nconst _uvA$1 = /*@__PURE__*/ new Vector2();\nconst _uvB$1 = /*@__PURE__*/ new Vector2();\nconst _uvC$1 = /*@__PURE__*/ new Vector2();\n\nconst _normalA = /*@__PURE__*/ new Vector3();\nconst _normalB = /*@__PURE__*/ new Vector3();\nconst _normalC = /*@__PURE__*/ new Vector3();\n\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\n\nclass Mesh extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isMesh = true;\n\n\t\tthis.type = 'Mesh';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.attributes.position;\n\t\tconst morphPosition = geometry.morphAttributes.position;\n\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\n\t\ttarget.fromBufferAttribute( position, index );\n\n\t\tconst morphInfluences = this.morphTargetInfluences;\n\n\t\tif ( morphPosition && morphInfluences ) {\n\n\t\t\t_morphA.set( 0, 0, 0 );\n\n\t\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\t\tconst influence = morphInfluences[ i ];\n\t\t\t\tconst morphAttribute = morphPosition[ i ];\n\n\t\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t\t_tempA.fromBufferAttribute( morphAttribute, index );\n\n\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_morphA.addScaledVector( _tempA.sub( target ), influence );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttarget.add( _morphA );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$6.copy( geometry.boundingSphere );\n\t\t_sphere$6.applyMatrix4( matrixWorld );\n\n\t\t// check distance from ray origin to bounding sphere\n\n\t\t_ray$3.copy( raycaster.ray ).recast( raycaster.near );\n\n\t\tif ( _sphere$6.containsPoint( _ray$3.origin ) === false ) {\n\n\t\t\tif ( _ray$3.intersectSphere( _sphere$6, _sphereHitAt ) === null ) return;\n\n\t\t\tif ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;\n\n\t\t}\n\n\t\t// convert ray to local space of mesh\n\n\t\t_inverseMatrix$3.copy( matrixWorld ).invert();\n\t\t_ray$3.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$3 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray$3.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$3 );\n\n\t}\n\n\t_computeIntersections( raycaster, intersects, rayLocalSpace ) {\n\n\t\tlet intersection;\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\n\t\tconst index = geometry.index;\n\t\tconst position = geometry.attributes.position;\n\t\tconst uv = geometry.attributes.uv;\n\t\tconst uv1 = geometry.attributes.uv1;\n\t\tconst normal = geometry.attributes.normal;\n\t\tconst groups = geometry.groups;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\tif ( index !== null ) {\n\n\t\t\t// indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = index.getX( j );\n\t\t\t\t\t\tconst b = index.getX( j + 1 );\n\t\t\t\t\t\tconst c = index.getX( j + 2 );\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\tconst b = index.getX( i + 1 );\n\t\t\t\t\tconst c = index.getX( i + 2 );\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( position !== undefined ) {\n\n\t\t\t// non-indexed buffer geometry\n\n\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\tconst a = j;\n\t\t\t\t\t\tconst b = j + 1;\n\t\t\t\t\t\tconst c = j + 2;\n\n\t\t\t\t\t\tintersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\tconst a = i;\n\t\t\t\t\tconst b = i + 1;\n\t\t\t\t\tconst c = i + 2;\n\n\t\t\t\t\tintersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );\n\n\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tlet intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, ( material.side === FrontSide ), point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {\n\n\tobject.getVertexPosition( a, _vA$1 );\n\tobject.getVertexPosition( b, _vB$1 );\n\tobject.getVertexPosition( c, _vC$1 );\n\n\tconst intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv1 ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv1, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv1, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv1, c );\n\n\t\t\tintersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\t\t\tintersection.uv2 = intersection.uv1; // @deprecated, r152\n\n\t\t}\n\n\t\tif ( normal ) {\n\n\t\t\t_normalA.fromBufferAttribute( normal, a );\n\t\t\t_normalB.fromBufferAttribute( normal, b );\n\t\t\t_normalC.fromBufferAttribute( normal, c );\n\n\t\t\tintersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );\n\n\t\t\tif ( intersection.normal.dot( ray.direction ) > 0 ) {\n\n\t\t\t\tintersection.normal.multiplyScalar( - 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );\n\n\t\tintersection.face = face;\n\n\t}\n\n\treturn intersection;\n\n}\n\nclass BoxGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tconst scope = this;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\t\tdepthSegments = Math.floor( depthSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet numberOfVertices = 0;\n\t\tlet groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tconst segmentWidth = width / gridX;\n\t\t\tconst segmentHeight = height / gridY;\n\n\t\t\tconst widthHalf = width / 2;\n\t\t\tconst heightHalf = height / 2;\n\t\t\tconst depthHalf = depth / 2;\n\n\t\t\tconst gridX1 = gridX + 1;\n\t\t\tconst gridY1 = gridY + 1;\n\n\t\t\tlet vertexCounter = 0;\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\n\n\t}\n\n}\n\n/**\n * Uniform Utilities\n */\n\nfunction cloneUniforms( src ) {\n\n\tconst dst = {};\n\n\tfor ( const u in src ) {\n\n\t\tdst[ u ] = {};\n\n\t\tfor ( const p in src[ u ] ) {\n\n\t\t\tconst property = src[ u ][ p ];\n\n\t\t\tif ( property && ( property.isColor ||\n\t\t\t\tproperty.isMatrix3 || property.isMatrix4 ||\n\t\t\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\n\t\t\t\tproperty.isTexture || property.isQuaternion ) ) {\n\n\t\t\t\tif ( property.isRenderTargetTexture ) {\n\n\t\t\t\t\tconsole.warn( 'UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().' );\n\t\t\t\t\tdst[ u ][ p ] = null;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdst[ u ][ p ] = property.clone();\n\n\t\t\t\t}\n\n\t\t\t} else if ( Array.isArray( property ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.slice();\n\n\t\t\t} else {\n\n\t\t\t\tdst[ u ][ p ] = property;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction mergeUniforms( uniforms ) {\n\n\tconst merged = {};\n\n\tfor ( let u = 0; u < uniforms.length; u ++ ) {\n\n\t\tconst tmp = cloneUniforms( uniforms[ u ] );\n\n\t\tfor ( const p in tmp ) {\n\n\t\t\tmerged[ p ] = tmp[ p ];\n\n\t\t}\n\n\t}\n\n\treturn merged;\n\n}\n\nfunction cloneUniformsGroups( src ) {\n\n\tconst dst = [];\n\n\tfor ( let u = 0; u < src.length; u ++ ) {\n\n\t\tdst.push( src[ u ].clone() );\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction getUnlitUniformColorSpace( renderer ) {\n\n\tif ( renderer.getRenderTarget() === null ) {\n\n\t\t// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n\t\treturn renderer.outputColorSpace;\n\n\t}\n\n\treturn ColorManagement.workingColorSpace;\n\n}\n\n// Legacy\n\nconst UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\n\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\n\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\n\nclass ShaderMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShaderMaterial = true;\n\n\t\tthis.type = 'ShaderMaterial';\n\n\t\tthis.defines = {};\n\t\tthis.uniforms = {};\n\t\tthis.uniformsGroups = [];\n\n\t\tthis.vertexShader = default_vertex;\n\t\tthis.fragmentShader = default_fragment;\n\n\t\tthis.linewidth = 1;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.fog = false; // set to use scene fog\n\t\tthis.lights = false; // set to use scene lights\n\t\tthis.clipping = false; // set to use user-defined clipping planes\n\n\t\tthis.forceSinglePass = true;\n\n\t\tthis.extensions = {\n\t\t\tderivatives: false, // set to use derivatives\n\t\t\tfragDepth: false, // set to use fragment depth values\n\t\t\tdrawBuffers: false, // set to use draw buffers\n\t\t\tshaderTextureLOD: false, // set to use shader texture LOD\n\t\t\tclipCullDistance: false // set to use vertex shader clipping\n\t\t};\n\n\t\t// When rendered geometry doesn't include these attributes but the material does,\n\t\t// use these default values in WebGL. This avoids errors when buffer data is missing.\n\t\tthis.defaultAttributeValues = {\n\t\t\t'color': [ 1, 1, 1 ],\n\t\t\t'uv': [ 0, 0 ],\n\t\t\t'uv1': [ 0, 0 ]\n\t\t};\n\n\t\tthis.index0AttributeName = undefined;\n\t\tthis.uniformsNeedUpdate = false;\n\n\t\tthis.glslVersion = null;\n\n\t\tif ( parameters !== undefined ) {\n\n\t\t\tthis.setValues( parameters );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.fragmentShader = source.fragmentShader;\n\t\tthis.vertexShader = source.vertexShader;\n\n\t\tthis.uniforms = cloneUniforms( source.uniforms );\n\t\tthis.uniformsGroups = cloneUniformsGroups( source.uniformsGroups );\n\n\t\tthis.defines = Object.assign( {}, source.defines );\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.fog = source.fog;\n\t\tthis.lights = source.lights;\n\t\tthis.clipping = source.clipping;\n\n\t\tthis.extensions = Object.assign( {}, source.extensions );\n\n\t\tthis.glslVersion = source.glslVersion;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.glslVersion = this.glslVersion;\n\t\tdata.uniforms = {};\n\n\t\tfor ( const name in this.uniforms ) {\n\n\t\t\tconst uniform = this.uniforms[ name ];\n\t\t\tconst value = uniform.value;\n\n\t\t\tif ( value && value.isTexture ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 't',\n\t\t\t\t\tvalue: value.toJSON( meta ).uuid\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isColor ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'c',\n\t\t\t\t\tvalue: value.getHex()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector2 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v2',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\tvalue: value\n\t\t\t\t};\n\n\t\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\n\n\t\tdata.vertexShader = this.vertexShader;\n\t\tdata.fragmentShader = this.fragmentShader;\n\n\t\tdata.lights = this.lights;\n\t\tdata.clipping = this.clipping;\n\n\t\tconst extensions = {};\n\n\t\tfor ( const key in this.extensions ) {\n\n\t\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\n\n\t\t}\n\n\t\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass Camera extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isCamera = true;\n\n\t\tthis.type = 'Camera';\n\n\t\tthis.matrixWorldInverse = new Matrix4();\n\n\t\tthis.projectionMatrix = new Matrix4();\n\t\tthis.projectionMatrixInverse = new Matrix4();\n\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\tthis.coordinateSystem = source.coordinateSystem;\n\n\t\treturn this;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\treturn super.getWorldDirection( target ).negate();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass PerspectiveCamera extends Camera {\n\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isPerspectiveCamera = true;\n\n\t\tthis.type = 'PerspectiveCamera';\n\n\t\tthis.fov = fov;\n\t\tthis.zoom = 1;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.focus = 10;\n\n\t\tthis.aspect = aspect;\n\t\tthis.view = null;\n\n\t\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\n\t\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength( focalLength ) {\n\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */\n\tgetFocalLength() {\n\n\t\tconst vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t}\n\n\tgetEffectiveFOV() {\n\n\t\treturn RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t}\n\n\tgetFilmWidth() {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t}\n\n\tgetFilmHeight() {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst near = this.near;\n\t\tlet top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;\n\t\tlet height = 2 * top;\n\t\tlet width = this.aspect * height;\n\t\tlet left = - 0.5 * width;\n\t\tconst view = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tconst skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst fov = - 90; // negative fov is not an error\nconst aspect = 1;\n\nclass CubeCamera extends Object3D {\n\n\tconstructor( near, far, renderTarget ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubeCamera';\n\n\t\tthis.renderTarget = renderTarget;\n\t\tthis.coordinateSystem = null;\n\t\tthis.activeMipmapLevel = 0;\n\n\t\tconst cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPX.layers = this.layers;\n\t\tthis.add( cameraPX );\n\n\t\tconst cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNX.layers = this.layers;\n\t\tthis.add( cameraNX );\n\n\t\tconst cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPY.layers = this.layers;\n\t\tthis.add( cameraPY );\n\n\t\tconst cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNY.layers = this.layers;\n\t\tthis.add( cameraNY );\n\n\t\tconst cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPZ.layers = this.layers;\n\t\tthis.add( cameraPZ );\n\n\t\tconst cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNZ.layers = this.layers;\n\t\tthis.add( cameraNZ );\n\n\t}\n\n\tupdateCoordinateSystem() {\n\n\t\tconst coordinateSystem = this.coordinateSystem;\n\n\t\tconst cameras = this.children.concat();\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;\n\n\t\tfor ( const camera of cameras ) this.remove( camera );\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, 1, 0 );\n\t\t\tcameraPX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, 1, 0 );\n\t\t\tcameraNX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, - 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tcameraPX.up.set( 0, - 1, 0 );\n\t\t\tcameraPX.lookAt( - 1, 0, 0 );\n\n\t\t\tcameraNX.up.set( 0, - 1, 0 );\n\t\t\tcameraNX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, - 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, - 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, - 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tfor ( const camera of cameras ) {\n\n\t\t\tthis.add( camera );\n\n\t\t\tcamera.updateMatrixWorld();\n\n\t\t}\n\n\t}\n\n\tupdate( renderer, scene ) {\n\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t\tconst { renderTarget, activeMipmapLevel } = this;\n\n\t\tif ( this.coordinateSystem !== renderer.coordinateSystem ) {\n\n\t\t\tthis.coordinateSystem = renderer.coordinateSystem;\n\n\t\t\tthis.updateCoordinateSystem();\n\n\t\t}\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\t\tconst currentActiveCubeFace = renderer.getActiveCubeFace();\n\t\tconst currentActiveMipmapLevel = renderer.getActiveMipmapLevel();\n\n\t\tconst currentXrEnabled = renderer.xr.enabled;\n\n\t\trenderer.xr.enabled = false;\n\n\t\tconst generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t\trenderTarget.texture.generateMipmaps = false;\n\n\t\trenderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\t// mipmaps are generated during the last call of render()\n\t\t// at this point, all sides of the cube render target are defined\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );\n\n\t\trenderer.xr.enabled = currentXrEnabled;\n\n\t\trenderTarget.texture.needsPMREMUpdate = true;\n\n\t}\n\n}\n\nclass CubeTexture extends Texture {\n\n\tconstructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace ) {\n\n\t\timages = images !== undefined ? images : [];\n\t\tmapping = mapping !== undefined ? mapping : CubeReflectionMapping;\n\n\t\tsuper( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.flipY = false;\n\n\t}\n\n\tget images() {\n\n\t\treturn this.image;\n\n\t}\n\n\tset images( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n}\n\nclass WebGLCubeRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( size = 1, options = {} ) {\n\n\t\tsuper( size, size, options );\n\n\t\tthis.isWebGLCubeRenderTarget = true;\n\n\t\tconst image = { width: size, height: size, depth: 1 };\n\t\tconst images = [ image, image, image, image, image, image ];\n\n\t\tif ( options.encoding !== undefined ) {\n\n\t\t\t// @deprecated, r152\n\t\t\twarnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );\n\t\t\toptions.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\t\tthis.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );\n\n\t\t// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n\t\t// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n\t\t// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n\n\t\t// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n\t\t// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n\t\t// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t}\n\n\tfromEquirectangularTexture( renderer, texture ) {\n\n\t\tthis.texture.type = texture.type;\n\t\tthis.texture.colorSpace = texture.colorSpace;\n\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\n\t\tthis.texture.minFilter = texture.minFilter;\n\t\tthis.texture.magFilter = texture.magFilter;\n\n\t\tconst shader = {\n\n\t\t\tuniforms: {\n\t\t\t\ttEquirect: { value: null },\n\t\t\t},\n\n\t\t\tvertexShader: /* glsl */`\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 \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t\tfragmentShader: /* glsl */`\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \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`\n\t\t};\n\n\t\tconst geometry = new BoxGeometry( 5, 5, 5 );\n\n\t\tconst material = new ShaderMaterial( {\n\n\t\t\tname: 'CubemapFromEquirect',\n\n\t\t\tuniforms: cloneUniforms( shader.uniforms ),\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tside: BackSide,\n\t\t\tblending: NoBlending\n\n\t\t} );\n\n\t\tmaterial.uniforms.tEquirect.value = texture;\n\n\t\tconst mesh = new Mesh( geometry, material );\n\n\t\tconst currentMinFilter = texture.minFilter;\n\n\t\t// Avoid blurred poles\n\t\tif ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;\n\n\t\tconst camera = new CubeCamera( 1, 10, this );\n\t\tcamera.update( renderer, mesh );\n\n\t\ttexture.minFilter = currentMinFilter;\n\n\t\tmesh.geometry.dispose();\n\t\tmesh.material.dispose();\n\n\t\treturn this;\n\n\t}\n\n\tclear( renderer, color, depth, stencil ) {\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\trenderer.setRenderTarget( this, i );\n\n\t\t\trenderer.clear( color, depth, stencil );\n\n\t\t}\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t}\n\n}\n\nconst _vector1 = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector3();\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\n\nclass Plane {\n\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\n\n\t\tthis.isPlane = true;\n\n\t\t// normal is assumed to be normalized\n\n\t\tthis.normal = normal;\n\t\tthis.constant = constant;\n\n\t}\n\n\tset( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponents( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCoplanarPoints( a, b, c ) {\n\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t}\n\n\tnormalize() {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.constant *= - 1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t}\n\n\tdistanceToSphere( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t}\n\n\tprojectPoint( point, target ) {\n\n\t\treturn target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );\n\n\t}\n\n\tintersectLine( line, target ) {\n\n\t\tconst direction = line.delta( _vector1 );\n\n\t\tconst denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( t < 0 || t > 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn target.copy( line.start ).addScaledVector( direction, t );\n\n\t}\n\n\tintersectsLine( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tconst startSign = this.distanceToPoint( line.start );\n\t\tconst endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t}\n\n\tcoplanarPoint( target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t}\n\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\n\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tequals( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _sphere$5 = /*@__PURE__*/ new Sphere();\nconst _vector$7 = /*@__PURE__*/ new Vector3();\n\nclass Frustum {\n\n\tconstructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {\n\n\t\tthis.planes = [ p0, p1, p2, p3, p4, p5 ];\n\n\t}\n\n\tset( p0, p1, p2, p3, p4, p5 ) {\n\n\t\tconst planes = this.planes;\n\n\t\tplanes[ 0 ].copy( p0 );\n\t\tplanes[ 1 ].copy( p1 );\n\t\tplanes[ 2 ].copy( p2 );\n\t\tplanes[ 3 ].copy( p3 );\n\t\tplanes[ 4 ].copy( p4 );\n\t\tplanes[ 5 ].copy( p5 );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( frustum ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {\n\n\t\tconst planes = this.planes;\n\t\tconst me = m.elements;\n\t\tconst me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\n\t\tconst me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\n\t\tconst me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\n\t\tconst me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\n\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\n\n\t\tif ( coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\n\n\t\t} else if ( coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\tplanes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tintersectsObject( object ) {\n\n\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\n\t\t\t_sphere$5.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t} else {\n\n\t\t\tconst geometry = object.geometry;\n\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t\t_sphere$5.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\t}\n\n\t\treturn this.intersectsSphere( _sphere$5 );\n\n\t}\n\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$5.center.set( 0, 0, 0 );\n\t\t_sphere$5.radius = 0.7071067811865476;\n\t\t_sphere$5.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$5 );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst planes = this.planes;\n\t\tconst center = sphere.center;\n\t\tconst negRadius = - sphere.radius;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst distance = planes[ i ].distanceToPoint( center );\n\n\t\t\tif ( distance < negRadius ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst plane = planes[ i ];\n\n\t\t\t// corner at max distance\n\n\t\t\t_vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$7 ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nfunction WebGLAnimation() {\n\n\tlet context = null;\n\tlet isAnimating = false;\n\tlet animationLoop = null;\n\tlet requestId = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tanimationLoop( time, frame );\n\n\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t}\n\n\treturn {\n\n\t\tstart: function () {\n\n\t\t\tif ( isAnimating === true ) return;\n\t\t\tif ( animationLoop === null ) return;\n\n\t\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t\t\tisAnimating = true;\n\n\t\t},\n\n\t\tstop: function () {\n\n\t\t\tcontext.cancelAnimationFrame( requestId );\n\n\t\t\tisAnimating = false;\n\n\t\t},\n\n\t\tsetAnimationLoop: function ( callback ) {\n\n\t\t\tanimationLoop = callback;\n\n\t\t},\n\n\t\tsetContext: function ( value ) {\n\n\t\t\tcontext = value;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLAttributes( gl, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tconst buffers = new WeakMap();\n\n\tfunction createBuffer( attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst usage = attribute.usage;\n\t\tconst size = array.byteLength;\n\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\t\tgl.bufferData( bufferType, array, usage );\n\n\t\tattribute.onUploadCallback();\n\n\t\tlet type;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\ttype = gl.FLOAT;\n\n\t\t} else if ( array instanceof Uint16Array ) {\n\n\t\t\tif ( attribute.isFloat16BufferAttribute ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\ttype = gl.HALF_FLOAT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\ttype = gl.UNSIGNED_SHORT;\n\n\t\t\t}\n\n\t\t} else if ( array instanceof Int16Array ) {\n\n\t\t\ttype = gl.SHORT;\n\n\t\t} else if ( array instanceof Uint32Array ) {\n\n\t\t\ttype = gl.UNSIGNED_INT;\n\n\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = gl.INT;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = gl.BYTE;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\n\n\t\t\ttype = gl.UNSIGNED_BYTE;\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.WebGLAttributes: Unsupported buffer data format: ' + array );\n\n\t\t}\n\n\t\treturn {\n\t\t\tbuffer: buffer,\n\t\t\ttype: type,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version,\n\t\t\tsize: size\n\t\t};\n\n\t}\n\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst updateRange = attribute._updateRange; // deprecated\n\t\tconst updateRanges = attribute.updateRanges;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 && updateRanges.length === 0 ) {\n\n\t\t\t// Not using update ranges\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t}\n\n\t\tif ( updateRanges.length !== 0 ) {\n\n\t\t\tfor ( let i = 0, l = updateRanges.length; i < l; i ++ ) {\n\n\t\t\t\tconst range = updateRanges[ i ];\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tgl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,\n\t\t\t\t\t\tarray, range.start, range.count );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,\n\t\t\t\t\t\tarray.subarray( range.start, range.start + range.count ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tattribute.clearUpdateRanges();\n\n\t\t}\n\n\t\t// deprecated\n\t\tif ( updateRange.count !== - 1 ) {\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, updateRange.offset, updateRange.count );\n\n\t\t\t} else {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );\n\n\t\t\t}\n\n\t\t\tupdateRange.count = - 1; // reset range\n\n\t\t}\n\n\t\tattribute.onUploadCallback();\n\n\t}\n\n\t//\n\n\tfunction get( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\treturn buffers.get( attribute );\n\n\t}\n\n\tfunction remove( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data ) {\n\n\t\t\tgl.deleteBuffer( data.buffer );\n\n\t\t\tbuffers.delete( attribute );\n\n\t\t}\n\n\t}\n\n\tfunction update( attribute, bufferType ) {\n\n\t\tif ( attribute.isGLBufferAttribute ) {\n\n\t\t\tconst cached = buffers.get( attribute );\n\n\t\t\tif ( ! cached || cached.version < attribute.version ) {\n\n\t\t\t\tbuffers.set( attribute, {\n\t\t\t\t\tbuffer: attribute.buffer,\n\t\t\t\t\ttype: attribute.type,\n\t\t\t\t\tbytesPerElement: attribute.elementSize,\n\t\t\t\t\tversion: attribute.version\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data === undefined ) {\n\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\n\n\t\t} else if ( data.version < attribute.version ) {\n\n\t\t\tif ( data.size !== attribute.array.byteLength ) {\n\n\t\t\t\tthrow 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.' );\n\n\t\t\t}\n\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\n\n\t\t\tdata.version = attribute.version;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update\n\n\t};\n\n}\n\nclass PlaneGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PlaneGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments\n\t\t};\n\n\t\tconst width_half = width / 2;\n\t\tconst height_half = height / 2;\n\n\t\tconst gridX = Math.floor( widthSegments );\n\t\tconst gridY = Math.floor( heightSegments );\n\n\t\tconst gridX1 = gridX + 1;\n\t\tconst gridY1 = gridY + 1;\n\n\t\tconst segment_width = width / gridX;\n\t\tconst segment_height = height / gridY;\n\n\t\t//\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\tconst y = iy * segment_height - height_half;\n\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\tconst x = ix * segment_width - width_half;\n\n\t\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\tconst a = ix + gridX1 * iy;\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\n\n\t}\n\n}\n\nvar alphahash_fragment = \"#ifdef USE_ALPHAHASH\\n\\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\\n#endif\";\n\nvar alphahash_pars_fragment = \"#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\";\n\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\n\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n#endif\";\n\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\n\nvar aomap_fragment = \"#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\";\n\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\n\nvar batching_pars_vertex = \"#ifdef USE_BATCHING\\n\\tattribute float batchId;\\n\\tuniform highp sampler2D batchingTexture;\\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#endif\";\n\nvar batching_vertex = \"#ifdef USE_BATCHING\\n\\tmat4 batchingMatrix = getBatchingMatrix( batchId );\\n#endif\";\n\nvar begin_vertex = \"vec3 transformed = vec3( position );\\n#ifdef USE_ALPHAHASH\\n\\tvPosition = vec3( position );\\n#endif\";\n\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\n\nvar bsdfs = \"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\";\n\nvar iridescence_fragment = \"#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\";\n\nvar bumpmap_pars_fragment = \"#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\";\n\nvar clipping_planes_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvec4 plane;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\tplane = clippingPlanes[ i ];\\n\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\tbool clipped = true;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\tif ( clipped ) discard;\\n\\t#endif\\n#endif\";\n\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\n\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\n\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\n\nvar color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\n\nvar color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_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\nvar common = \"#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}\\nmat3 transposeMat3( const in mat3 m ) {\\n\\tmat3 tmp;\\n\\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\\treturn tmp;\\n}\\nfloat luminance( const in vec3 rgb ) {\\n\\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\\n\\treturn dot( weights, rgb );\\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\";\n\nvar cube_uv_reflection_fragment = \"#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\";\n\nvar defaultnormal_vertex = \"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\";\n\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\n\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\n\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\n\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\n\nvar colorspace_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\n\nvar colorspace_pars_fragment = \"\\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\\n\\tvec3( 0.8224621, 0.177538, 0.0 ),\\n\\tvec3( 0.0331941, 0.9668058, 0.0 ),\\n\\tvec3( 0.0170827, 0.0723974, 0.9105199 )\\n);\\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\\n\\tvec3( 1.2249401, - 0.2249404, 0.0 ),\\n\\tvec3( - 0.0420569, 1.0420571, 0.0 ),\\n\\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\\n);\\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\\n}\\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\\n\\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\\n}\\nvec4 LinearTransferOETF( in vec4 value ) {\\n\\treturn value;\\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}\\nvec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 LinearTosRGB( in vec4 value ) {\\n\\treturn sRGBTransferOETF( value );\\n}\";\n\nvar envmap_fragment = \"#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, 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\";\n\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n\\t\\n#endif\";\n\nvar envmap_pars_fragment = \"#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\";\n\nvar envmap_pars_vertex = \"#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\";\n\nvar envmap_vertex = \"#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\";\n\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\n\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\n\nvar fog_fragment = \"#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\";\n\nvar fog_pars_fragment = \"#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\";\n\nvar gradientmap_pars_fragment = \"#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}\";\n\nvar lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\treflectedLight.indirectDiffuse += lightMapIrradiance;\\n#endif\";\n\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\n\nvar lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_lambert_pars_fragment = \"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\";\n\nvar lights_pars_begin = \"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\\t#if defined ( LEGACY_LIGHTS )\\n\\t\\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\\t\\t\\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\\t\\t}\\n\\t\\treturn 1.0;\\n\\t#else\\n\\t\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\t\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t\\t}\\n\\t\\treturn distanceFalloff;\\n\\t#endif\\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\";\n\nvar envmap_physical_pars_fragment = \"#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, 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, roughness * roughness) );\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, 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\";\n\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\n\nvar lights_toon_pars_fragment = \"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\";\n\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_phong_pars_fragment = \"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\";\n\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - 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 = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( 0.04 ), 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_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.07, 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\";\n\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat roughness;\\n\\tvec3 specularColor;\\n\\tfloat specularF90;\\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#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 saturate(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.specularColor;\\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 * transposeMat3( 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 a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\\tvec4 r = roughness * c0 + c1;\\n\\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\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\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\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}\\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.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseColor * 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\\t\\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\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\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\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 );\\n\\t#endif\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\\t#endif\\n\\tvec3 totalScattering = singleScattering + multiScattering;\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\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}\";\n\nvar lights_fragment_begin = \"\\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.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\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 )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, 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.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.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\";\n\nvar lights_fragment_maps = \"#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\";\n\nvar lights_fragment_end = \"#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\";\n\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\n\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvarying float vFragDepth;\\n\\t\\tvarying float vIsPerspective;\\n\\t#else\\n\\t\\tuniform float logDepthBufFC;\\n\\t#endif\\n#endif\";\n\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvFragDepth = 1.0 + gl_Position.w;\\n\\t\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n\\t#else\\n\\t\\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\\n\\t\\t\\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\\n\\t\\t\\tgl_Position.z *= gl_Position.w;\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\\n\\t\\n\\t#endif\\n\\tdiffuseColor *= sampledDiffuseColor;\\n#endif\";\n\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\n\nvar map_particle_fragment = \"#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\";\n\nvar map_particle_pars_fragment = \"#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\";\n\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\n\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\n\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\\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\";\n\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\\t\\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\\t\\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\\t\\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n\\t#endif\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\tuniform float morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t\\tuniform sampler2DArray morphTargetsTexture;\\n\\t\\tuniform ivec2 morphTargetsTextureSize;\\n\\t\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t\\t}\\n\\t#else\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\tuniform float morphTargetInfluences[ 8 ];\\n\\t\\t#else\\n\\t\\t\\tuniform float morphTargetInfluences[ 4 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\\t\\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\\t\\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\\t\\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\\t\\t\\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\\t\\t\\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\\t\\t\\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar normal_fragment_begin = \"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;\";\n\nvar normal_fragment_maps = \"#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\";\n\nvar normal_pars_fragment = \"#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\";\n\nvar normal_pars_vertex = \"#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\";\n\nvar normal_vertex = \"#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\";\n\nvar normalmap_pars_fragment = \"#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\";\n\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = nonPerturbedNormal;\\n#endif\";\n\nvar clearcoat_normal_fragment_maps = \"#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\";\n\nvar clearcoat_pars_fragment = \"#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\";\n\nvar iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\n\nvar opaque_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\n\nvar packing = \"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.;\\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\\nconst float ShiftRight8 = 1. / 256.;\\nvec4 packDepthToRGBA( const in float v ) {\\n\\tvec4 r = vec4( fract( v * PackFactors ), v );\\n\\tr.yzw -= r.xyz * ShiftRight8;\\treturn r * PackUpscale;\\n}\\nfloat unpackRGBAToDepth( const in vec4 v ) {\\n\\treturn dot( v, UnpackFactors );\\n}\\nvec2 packDepthToRG( in highp float v ) {\\n\\treturn packDepthToRGBA( v ).yx;\\n}\\nfloat unpackRGToDepth( const in highp vec2 v ) {\\n\\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\\n}\\nvec4 pack2HalfToRGBA( 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( 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}\";\n\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\n\nvar project_vertex = \"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;\";\n\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\n\nvar dithering_pars_fragment = \"#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\";\n\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\n\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\n\nvar shadowmap_pars_fragment = \"#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\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\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\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\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 sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\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\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\n\\t}\\n\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\tshadowCoord.z += shadowBias;\\n\\t\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\n\\t\\tif ( frustumTest ) {\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx0 = - texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy0 = - texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx1 = + texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy1 = + texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx2 = dx0 / 2.0;\\n\\t\\t\\tfloat dy2 = dy0 / 2.0;\\n\\t\\t\\tfloat dx3 = dx1 / 2.0;\\n\\t\\t\\tfloat dy3 = dy1 / 2.0;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\\n\\t\\t\\t) * ( 1.0 / 17.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx = texelSize.x;\\n\\t\\t\\tfloat dy = texelSize.y;\\n\\t\\t\\tvec2 uv = shadowCoord.xy;\\n\\t\\t\\tvec2 f = fract( uv * shadowMapSize + 0.5 );\\n\\t\\t\\tuv -= f * texelSize;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t f.y )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#else\\n\\t\\t\\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn shadow;\\n\\t}\\n\\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\\n\\t\\tvec3 absV = abs( v );\\n\\t\\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\\n\\t\\tabsV *= scaleToCube;\\n\\t\\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\\n\\t\\tvec2 planar = v.xy;\\n\\t\\tfloat almostATexel = 1.5 * texelSizeY;\\n\\t\\tfloat almostOne = 1.0 - almostATexel;\\n\\t\\tif ( absV.z >= almostOne ) {\\n\\t\\t\\tif ( v.z > 0.0 )\\n\\t\\t\\t\\tplanar.x = 4.0 - v.x;\\n\\t\\t} else if ( absV.x >= almostOne ) {\\n\\t\\t\\tfloat signX = sign( v.x );\\n\\t\\t\\tplanar.x = v.z * signX + 2.0 * signX;\\n\\t\\t} else if ( absV.y >= almostOne ) {\\n\\t\\t\\tfloat signY = sign( v.y );\\n\\t\\t\\tplanar.x = v.x + 2.0 * signY + 2.0;\\n\\t\\t\\tplanar.y = v.z * signY - 2.0;\\n\\t\\t}\\n\\t\\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\\n\\t}\\n\\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\\t\\tdp += shadowBias;\\n\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\\n\\t\\t\\treturn (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#else\\n\\t\\t\\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar shadowmap_pars_vertex = \"#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 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 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 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\";\n\nvar shadowmap_vertex = \"#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\";\n\nvar shadowmask_pars_fragment = \"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.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.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\\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.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}\";\n\nvar skinbase_vertex = \"#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\";\n\nvar skinning_pars_vertex = \"#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\";\n\nvar skinning_vertex = \"#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\";\n\nvar skinnormal_vertex = \"#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\";\n\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\n\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\n\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\n\nvar tonemapping_pars_fragment = \"#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 OptimizedCineonToneMapping( 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 = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\\n\\tcolor *= toneMappingExposure;\\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\\treturn color;\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\n\nvar transmission_fragment = \"#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.diffuseColor, material.specularColor, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, 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\";\n\nvar transmission_pars_fragment = \"#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 ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\trefractionCoords += 1.0;\\n\\t\\trefractionCoords /= 2.0;\\n\\t\\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\\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\";\n\nvar uv_pars_fragment = \"#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\";\n\nvar uv_pars_vertex = \"#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\";\n\nvar uv_vertex = \"#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\";\n\nvar worldpos_vertex = \"#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\";\n\nconst vertex$h = \"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}\";\n\nconst fragment$h = \"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 \\n\\t#include \\n}\";\n\nconst vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$g = \"#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;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, 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 \\n\\t#include \\n}\";\n\nconst vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$f = \"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 \\n\\t#include \\n}\";\n\nconst vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\n\nconst fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\\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#endif\\n}\";\n\nconst vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\n\nconst fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main () {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\n\nconst vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$a = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t\\t#include \\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\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 \\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\n\nconst fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$7 = \"#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 \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\\n\\t#ifdef OPAQUE\\n\\t\\tgl_FragColor.a = 1.0;\\n\\t#endif\\n}\";\n\nconst vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$5 = \"#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_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 \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include \\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\\t\\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\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 \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$2 = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\tvec2 scale;\\n\\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\\n\\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\\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 \\n\\t#include \\n\\t#include \\n}\";\n\nconst fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\n\nconst ShaderChunk = {\n\talphahash_fragment: alphahash_fragment,\n\talphahash_pars_fragment: alphahash_pars_fragment,\n\talphamap_fragment: alphamap_fragment,\n\talphamap_pars_fragment: alphamap_pars_fragment,\n\talphatest_fragment: alphatest_fragment,\n\talphatest_pars_fragment: alphatest_pars_fragment,\n\taomap_fragment: aomap_fragment,\n\taomap_pars_fragment: aomap_pars_fragment,\n\tbatching_pars_vertex: batching_pars_vertex,\n\tbatching_vertex: batching_vertex,\n\tbegin_vertex: begin_vertex,\n\tbeginnormal_vertex: beginnormal_vertex,\n\tbsdfs: bsdfs,\n\tiridescence_fragment: iridescence_fragment,\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\n\tclipping_planes_fragment: clipping_planes_fragment,\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\n\tclipping_planes_vertex: clipping_planes_vertex,\n\tcolor_fragment: color_fragment,\n\tcolor_pars_fragment: color_pars_fragment,\n\tcolor_pars_vertex: color_pars_vertex,\n\tcolor_vertex: color_vertex,\n\tcommon: common,\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\n\tdefaultnormal_vertex: defaultnormal_vertex,\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\n\tdisplacementmap_vertex: displacementmap_vertex,\n\temissivemap_fragment: emissivemap_fragment,\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\n\tcolorspace_fragment: colorspace_fragment,\n\tcolorspace_pars_fragment: colorspace_pars_fragment,\n\tenvmap_fragment: envmap_fragment,\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\n\tenvmap_pars_fragment: envmap_pars_fragment,\n\tenvmap_pars_vertex: envmap_pars_vertex,\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\n\tenvmap_vertex: envmap_vertex,\n\tfog_vertex: fog_vertex,\n\tfog_pars_vertex: fog_pars_vertex,\n\tfog_fragment: fog_fragment,\n\tfog_pars_fragment: fog_pars_fragment,\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\n\tlightmap_fragment: lightmap_fragment,\n\tlightmap_pars_fragment: lightmap_pars_fragment,\n\tlights_lambert_fragment: lights_lambert_fragment,\n\tlights_lambert_pars_fragment: lights_lambert_pars_fragment,\n\tlights_pars_begin: lights_pars_begin,\n\tlights_toon_fragment: lights_toon_fragment,\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\n\tlights_phong_fragment: lights_phong_fragment,\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\n\tlights_physical_fragment: lights_physical_fragment,\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\n\tlights_fragment_begin: lights_fragment_begin,\n\tlights_fragment_maps: lights_fragment_maps,\n\tlights_fragment_end: lights_fragment_end,\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\n\tmap_fragment: map_fragment,\n\tmap_pars_fragment: map_pars_fragment,\n\tmap_particle_fragment: map_particle_fragment,\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\n\tmetalnessmap_fragment: metalnessmap_fragment,\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\n\tmorphcolor_vertex: morphcolor_vertex,\n\tmorphnormal_vertex: morphnormal_vertex,\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\n\tmorphtarget_vertex: morphtarget_vertex,\n\tnormal_fragment_begin: normal_fragment_begin,\n\tnormal_fragment_maps: normal_fragment_maps,\n\tnormal_pars_fragment: normal_pars_fragment,\n\tnormal_pars_vertex: normal_pars_vertex,\n\tnormal_vertex: normal_vertex,\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n\tclearcoat_pars_fragment: clearcoat_pars_fragment,\n\tiridescence_pars_fragment: iridescence_pars_fragment,\n\topaque_fragment: opaque_fragment,\n\tpacking: packing,\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\n\tproject_vertex: project_vertex,\n\tdithering_fragment: dithering_fragment,\n\tdithering_pars_fragment: dithering_pars_fragment,\n\troughnessmap_fragment: roughnessmap_fragment,\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\n\tshadowmap_vertex: shadowmap_vertex,\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\n\tskinbase_vertex: skinbase_vertex,\n\tskinning_pars_vertex: skinning_pars_vertex,\n\tskinning_vertex: skinning_vertex,\n\tskinnormal_vertex: skinnormal_vertex,\n\tspecularmap_fragment: specularmap_fragment,\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\n\ttonemapping_fragment: tonemapping_fragment,\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\n\ttransmission_fragment: transmission_fragment,\n\ttransmission_pars_fragment: transmission_pars_fragment,\n\tuv_pars_fragment: uv_pars_fragment,\n\tuv_pars_vertex: uv_pars_vertex,\n\tuv_vertex: uv_vertex,\n\tworldpos_vertex: worldpos_vertex,\n\n\tbackground_vert: vertex$h,\n\tbackground_frag: fragment$h,\n\tbackgroundCube_vert: vertex$g,\n\tbackgroundCube_frag: fragment$g,\n\tcube_vert: vertex$f,\n\tcube_frag: fragment$f,\n\tdepth_vert: vertex$e,\n\tdepth_frag: fragment$e,\n\tdistanceRGBA_vert: vertex$d,\n\tdistanceRGBA_frag: fragment$d,\n\tequirect_vert: vertex$c,\n\tequirect_frag: fragment$c,\n\tlinedashed_vert: vertex$b,\n\tlinedashed_frag: fragment$b,\n\tmeshbasic_vert: vertex$a,\n\tmeshbasic_frag: fragment$a,\n\tmeshlambert_vert: vertex$9,\n\tmeshlambert_frag: fragment$9,\n\tmeshmatcap_vert: vertex$8,\n\tmeshmatcap_frag: fragment$8,\n\tmeshnormal_vert: vertex$7,\n\tmeshnormal_frag: fragment$7,\n\tmeshphong_vert: vertex$6,\n\tmeshphong_frag: fragment$6,\n\tmeshphysical_vert: vertex$5,\n\tmeshphysical_frag: fragment$5,\n\tmeshtoon_vert: vertex$4,\n\tmeshtoon_frag: fragment$4,\n\tpoints_vert: vertex$3,\n\tpoints_frag: fragment$3,\n\tshadow_vert: vertex$2,\n\tshadow_frag: fragment$2,\n\tsprite_vert: vertex$1,\n\tsprite_frag: fragment$1\n};\n\n/**\n * Uniforms library for shared webgl shaders\n */\n\nconst UniformsLib = {\n\n\tcommon: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\n\t\talphaTest: { value: 0 }\n\n\t},\n\n\tspecularmap: {\n\n\t\tspecularMap: { value: null },\n\t\tspecularMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tenvmap: {\n\n\t\tenvMap: { value: null },\n\t\tflipEnvMap: { value: - 1 },\n\t\treflectivity: { value: 1.0 }, // basic, lambert, phong\n\t\tior: { value: 1.5 }, // physical\n\t\trefractionRatio: { value: 0.98 }, // basic, lambert, phong\n\n\t},\n\n\taomap: {\n\n\t\taoMap: { value: null },\n\t\taoMapIntensity: { value: 1 },\n\t\taoMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tlightmap: {\n\n\t\tlightMap: { value: null },\n\t\tlightMapIntensity: { value: 1 },\n\t\tlightMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tbumpmap: {\n\n\t\tbumpMap: { value: null },\n\t\tbumpMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tbumpScale: { value: 1 }\n\n\t},\n\n\tnormalmap: {\n\n\t\tnormalMap: { value: null },\n\t\tnormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tnormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) }\n\n\t},\n\n\tdisplacementmap: {\n\n\t\tdisplacementMap: { value: null },\n\t\tdisplacementMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\tdisplacementScale: { value: 1 },\n\t\tdisplacementBias: { value: 0 }\n\n\t},\n\n\temissivemap: {\n\n\t\temissiveMap: { value: null },\n\t\temissiveMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tmetalnessmap: {\n\n\t\tmetalnessMap: { value: null },\n\t\tmetalnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\troughnessmap: {\n\n\t\troughnessMap: { value: null },\n\t\troughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tgradientmap: {\n\n\t\tgradientMap: { value: null }\n\n\t},\n\n\tfog: {\n\n\t\tfogDensity: { value: 0.00025 },\n\t\tfogNear: { value: 1 },\n\t\tfogFar: { value: 2000 },\n\t\tfogColor: { value: /*@__PURE__*/ new Color( 0xffffff ) }\n\n\t},\n\n\tlights: {\n\n\t\tambientLightColor: { value: [] },\n\n\t\tlightProbe: { value: [] },\n\n\t\tdirectionalLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tcolor: {}\n\t\t} },\n\n\t\tdirectionalLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tdirectionalShadowMap: { value: [] },\n\t\tdirectionalShadowMatrix: { value: [] },\n\n\t\tspotLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdirection: {},\n\t\t\tdistance: {},\n\t\t\tconeCos: {},\n\t\t\tpenumbraCos: {},\n\t\t\tdecay: {}\n\t\t} },\n\n\t\tspotLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tspotLightMap: { value: [] },\n\t\tspotShadowMap: { value: [] },\n\t\tspotLightMatrix: { value: [] },\n\n\t\tpointLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdecay: {},\n\t\t\tdistance: {}\n\t\t} },\n\n\t\tpointLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {},\n\t\t\tshadowCameraNear: {},\n\t\t\tshadowCameraFar: {}\n\t\t} },\n\n\t\tpointShadowMap: { value: [] },\n\t\tpointShadowMatrix: { value: [] },\n\n\t\themisphereLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tskyColor: {},\n\t\t\tgroundColor: {}\n\t\t} },\n\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n\t\trectAreaLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\twidth: {},\n\t\t\theight: {}\n\t\t} },\n\n\t\tltc_1: { value: null },\n\t\tltc_2: { value: null }\n\n\t},\n\n\tpoints: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tsize: { value: 1.0 },\n\t\tscale: { value: 1.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 },\n\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() }\n\n\t},\n\n\tsprite: {\n\n\t\tdiffuse: { value: /*@__PURE__*/ new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tcenter: { value: /*@__PURE__*/ new Vector2( 0.5, 0.5 ) },\n\t\trotation: { value: 0.0 },\n\t\tmap: { value: null },\n\t\tmapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaMap: { value: null },\n\t\talphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\talphaTest: { value: 0 }\n\n\t}\n\n};\n\nconst ShaderLib = {\n\n\tbasic: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\n\n\t},\n\n\tlambert: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\n\n\t},\n\n\tphong: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: /*@__PURE__*/ new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphong_vert,\n\t\tfragmentShader: ShaderChunk.meshphong_frag\n\n\t},\n\n\tstandard: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.roughnessmap,\n\t\t\tUniformsLib.metalnessmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\t\troughness: { value: 1.0 },\n\t\t\t\tmetalness: { value: 0.0 },\n\t\t\t\tenvMapIntensity: { value: 1 } // temporary\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\n\n\t},\n\n\ttoon: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.gradientmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: /*@__PURE__*/ new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\n\n\t},\n\n\tmatcap: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tmatcap: { value: null }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\n\n\t},\n\n\tpoints: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.points,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.points_vert,\n\t\tfragmentShader: ShaderChunk.points_frag\n\n\t},\n\n\tdashed: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tscale: { value: 1 },\n\t\t\t\tdashSize: { value: 1 },\n\t\t\t\ttotalSize: { value: 2 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.linedashed_vert,\n\t\tfragmentShader: ShaderChunk.linedashed_frag\n\n\t},\n\n\tdepth: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.depth_vert,\n\t\tfragmentShader: ShaderChunk.depth_frag\n\n\t},\n\n\tnormal: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshnormal_vert,\n\t\tfragmentShader: ShaderChunk.meshnormal_frag\n\n\t},\n\n\tsprite: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.sprite,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.sprite_vert,\n\t\tfragmentShader: ShaderChunk.sprite_frag\n\n\t},\n\n\tbackground: {\n\n\t\tuniforms: {\n\t\t\tuvTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tt2D: { value: null },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.background_vert,\n\t\tfragmentShader: ShaderChunk.background_frag\n\n\t},\n\n\tbackgroundCube: {\n\n\t\tuniforms: {\n\t\t\tenvMap: { value: null },\n\t\t\tflipEnvMap: { value: - 1 },\n\t\t\tbackgroundBlurriness: { value: 0 },\n\t\t\tbackgroundIntensity: { value: 1 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.backgroundCube_vert,\n\t\tfragmentShader: ShaderChunk.backgroundCube_frag\n\n\t},\n\n\tcube: {\n\n\t\tuniforms: {\n\t\t\ttCube: { value: null },\n\t\t\ttFlip: { value: - 1 },\n\t\t\topacity: { value: 1.0 }\n\t\t},\n\n\t\tvertexShader: ShaderChunk.cube_vert,\n\t\tfragmentShader: ShaderChunk.cube_frag\n\n\t},\n\n\tequirect: {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.equirect_vert,\n\t\tfragmentShader: ShaderChunk.equirect_frag\n\n\t},\n\n\tdistanceRGBA: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\treferencePosition: { value: /*@__PURE__*/ new Vector3() },\n\t\t\t\tnearDistance: { value: 1 },\n\t\t\t\tfarDistance: { value: 1000 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.distanceRGBA_vert,\n\t\tfragmentShader: ShaderChunk.distanceRGBA_frag\n\n\t},\n\n\tshadow: {\n\n\t\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\t\tUniformsLib.lights,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tcolor: { value: /*@__PURE__*/ new Color( 0x00000 ) },\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t},\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.shadow_vert,\n\t\tfragmentShader: ShaderChunk.shadow_frag\n\n\t}\n\n};\n\nShaderLib.physical = {\n\n\tuniforms: /*@__PURE__*/ mergeUniforms( [\n\t\tShaderLib.standard.uniforms,\n\t\t{\n\t\t\tclearcoat: { value: 0 },\n\t\t\tclearcoatMap: { value: null },\n\t\t\tclearcoatMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalMap: { value: null },\n\t\t\tclearcoatNormalMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tclearcoatNormalScale: { value: /*@__PURE__*/ new Vector2( 1, 1 ) },\n\t\t\tclearcoatRoughness: { value: 0 },\n\t\t\tclearcoatRoughnessMap: { value: null },\n\t\t\tclearcoatRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescence: { value: 0 },\n\t\t\tiridescenceMap: { value: null },\n\t\t\tiridescenceMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tiridescenceIOR: { value: 1.3 },\n\t\t\tiridescenceThicknessMinimum: { value: 100 },\n\t\t\tiridescenceThicknessMaximum: { value: 400 },\n\t\t\tiridescenceThicknessMap: { value: null },\n\t\t\tiridescenceThicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheen: { value: 0 },\n\t\t\tsheenColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tsheenColorMap: { value: null },\n\t\t\tsheenColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tsheenRoughness: { value: 1 },\n\t\t\tsheenRoughnessMap: { value: null },\n\t\t\tsheenRoughnessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmission: { value: 0 },\n\t\t\ttransmissionMap: { value: null },\n\t\t\ttransmissionMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\ttransmissionSamplerSize: { value: /*@__PURE__*/ new Vector2() },\n\t\t\ttransmissionSamplerMap: { value: null },\n\t\t\tthickness: { value: 0 },\n\t\t\tthicknessMap: { value: null },\n\t\t\tthicknessMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tattenuationDistance: { value: 0 },\n\t\t\tattenuationColor: { value: /*@__PURE__*/ new Color( 0x000000 ) },\n\t\t\tspecularColor: { value: /*@__PURE__*/ new Color( 1, 1, 1 ) },\n\t\t\tspecularColorMap: { value: null },\n\t\t\tspecularColorMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tspecularIntensity: { value: 1 },\n\t\t\tspecularIntensityMap: { value: null },\n\t\t\tspecularIntensityMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t\tanisotropyVector: { value: /*@__PURE__*/ new Vector2() },\n\t\t\tanisotropyMap: { value: null },\n\t\t\tanisotropyMapTransform: { value: /*@__PURE__*/ new Matrix3() },\n\t\t}\n\t] ),\n\n\tvertexShader: ShaderChunk.meshphysical_vert,\n\tfragmentShader: ShaderChunk.meshphysical_frag\n\n};\n\nconst _rgb = { r: 0, b: 0, g: 0 };\n\nfunction WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {\n\n\tconst clearColor = new Color( 0x000000 );\n\tlet clearAlpha = alpha === true ? 0 : 1;\n\n\tlet planeMesh;\n\tlet boxMesh;\n\n\tlet currentBackground = null;\n\tlet currentBackgroundVersion = 0;\n\tlet currentTonemapping = null;\n\n\tfunction render( renderList, scene ) {\n\n\t\tlet forceClear = false;\n\t\tlet background = scene.isScene === true ? scene.background : null;\n\n\t\tif ( background && background.isTexture ) {\n\n\t\t\tconst usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n\t\t\tbackground = ( usePMREM ? cubeuvmaps : cubemaps ).get( background );\n\n\t\t}\n\n\t\tif ( background === null ) {\n\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t} else if ( background && background.isColor ) {\n\n\t\t\tsetClear( background, 1 );\n\t\t\tforceClear = true;\n\n\t\t}\n\n\t\tconst environmentBlendMode = renderer.xr.getEnvironmentBlendMode();\n\n\t\tif ( environmentBlendMode === 'additive' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );\n\n\t\t} else if ( environmentBlendMode === 'alpha-blend' ) {\n\n\t\t\tstate.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t\tif ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {\n\n\t\t\tif ( boxMesh === undefined ) {\n\n\t\t\t\tboxMesh = new Mesh(\n\t\t\t\t\tnew BoxGeometry( 1, 1, 1 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundCubeMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.backgroundCube.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.backgroundCube.fragmentShader,\n\t\t\t\t\t\tside: BackSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\n\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\n\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\n\n\t\t\t\t};\n\n\t\t\t\t// add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( boxMesh );\n\n\t\t\t}\n\n\t\t\tboxMesh.material.uniforms.envMap.value = background;\n\t\t\tboxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;\n\t\t\tboxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n\t\t\tboxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tboxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tboxMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tboxMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\n\n\t\t} else if ( background && background.isTexture ) {\n\n\t\t\tif ( planeMesh === undefined ) {\n\n\t\t\t\tplaneMesh = new Mesh(\n\t\t\t\t\tnew PlaneGeometry( 2, 2 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\n\t\t\t\t\t\tside: FrontSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\n\n\t\t\t\t// add \"map\" material property so the renderer can evaluate it like for built-in materials\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( planeMesh );\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\n\t\t\tplaneMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n\t\t\tplaneMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;\n\n\t\t\tif ( background.matrixAutoUpdate === true ) {\n\n\t\t\t\tbackground.updateMatrix();\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tplaneMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\tplaneMesh.layers.enableAll();\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\n\n\t\t}\n\n\t}\n\n\tfunction setClear( color, alpha ) {\n\n\t\tcolor.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );\n\n\t\tstate.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );\n\n\t}\n\n\treturn {\n\n\t\tgetClearColor: function () {\n\n\t\t\treturn clearColor;\n\n\t\t},\n\t\tsetClearColor: function ( color, alpha = 1 ) {\n\n\t\t\tclearColor.set( color );\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\tgetClearAlpha: function () {\n\n\t\t\treturn clearAlpha;\n\n\t\t},\n\t\tsetClearAlpha: function ( alpha ) {\n\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\trender: render\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, extensions, attributes, capabilities ) {\n\n\tconst maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\n\tconst extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );\n\tconst vaoAvailable = capabilities.isWebGL2 || extension !== null;\n\n\tconst bindingStates = {};\n\n\tconst defaultState = createBindingState( null );\n\tlet currentState = defaultState;\n\tlet forceUpdate = false;\n\n\tfunction setup( object, material, program, geometry, index ) {\n\n\t\tlet updateBuffers = false;\n\n\t\tif ( vaoAvailable ) {\n\n\t\t\tconst state = getBindingState( geometry, program, material );\n\n\t\t\tif ( currentState !== state ) {\n\n\t\t\t\tcurrentState = state;\n\t\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t\t}\n\n\t\t\tupdateBuffers = needsUpdate( object, geometry, program, index );\n\n\t\t\tif ( updateBuffers ) saveCache( object, geometry, program, index );\n\n\t\t} else {\n\n\t\t\tconst wireframe = ( material.wireframe === true );\n\n\t\t\tif ( currentState.geometry !== geometry.id ||\n\t\t\t\tcurrentState.program !== program.id ||\n\t\t\t\tcurrentState.wireframe !== wireframe ) {\n\n\t\t\t\tcurrentState.geometry = geometry.id;\n\t\t\t\tcurrentState.program = program.id;\n\t\t\t\tcurrentState.wireframe = wireframe;\n\n\t\t\t\tupdateBuffers = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( index !== null ) {\n\n\t\t\tattributes.update( index, gl.ELEMENT_ARRAY_BUFFER );\n\n\t\t}\n\n\t\tif ( updateBuffers || forceUpdate ) {\n\n\t\t\tforceUpdate = false;\n\n\t\t\tsetupVertexAttributes( object, material, program, geometry );\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, attributes.get( index ).buffer );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction createVertexArrayObject() {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.createVertexArray();\n\n\t\treturn extension.createVertexArrayOES();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.bindVertexArray( vao );\n\n\t\treturn extension.bindVertexArrayOES( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.deleteVertexArray( vao );\n\n\t\treturn extension.deleteVertexArrayOES( vao );\n\n\t}\n\n\tfunction getBindingState( geometry, program, material ) {\n\n\t\tconst wireframe = ( material.wireframe === true );\n\n\t\tlet programMap = bindingStates[ geometry.id ];\n\n\t\tif ( programMap === undefined ) {\n\n\t\t\tprogramMap = {};\n\t\t\tbindingStates[ geometry.id ] = programMap;\n\n\t\t}\n\n\t\tlet stateMap = programMap[ program.id ];\n\n\t\tif ( stateMap === undefined ) {\n\n\t\t\tstateMap = {};\n\t\t\tprogramMap[ program.id ] = stateMap;\n\n\t\t}\n\n\t\tlet state = stateMap[ wireframe ];\n\n\t\tif ( state === undefined ) {\n\n\t\t\tstate = createBindingState( createVertexArrayObject() );\n\t\t\tstateMap[ wireframe ] = state;\n\n\t\t}\n\n\t\treturn state;\n\n\t}\n\n\tfunction createBindingState( vao ) {\n\n\t\tconst newAttributes = [];\n\t\tconst enabledAttributes = [];\n\t\tconst attributeDivisors = [];\n\n\t\tfor ( let i = 0; i < maxVertexAttributes; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\t\t\tenabledAttributes[ i ] = 0;\n\t\t\tattributeDivisors[ i ] = 0;\n\n\t\t}\n\n\t\treturn {\n\n\t\t\t// for backward compatibility on non-VAO support browser\n\t\t\tgeometry: null,\n\t\t\tprogram: null,\n\t\t\twireframe: false,\n\n\t\t\tnewAttributes: newAttributes,\n\t\t\tenabledAttributes: enabledAttributes,\n\t\t\tattributeDivisors: attributeDivisors,\n\t\t\tobject: vao,\n\t\t\tattributes: {},\n\t\t\tindex: null\n\n\t\t};\n\n\t}\n\n\tfunction needsUpdate( object, geometry, program, index ) {\n\n\t\tconst cachedAttributes = currentState.attributes;\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tconst cachedAttribute = cachedAttributes[ name ];\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( cachedAttribute === undefined ) return true;\n\n\t\t\t\tif ( cachedAttribute.attribute !== geometryAttribute ) return true;\n\n\t\t\t\tif ( geometryAttribute && cachedAttribute.data !== geometryAttribute.data ) return true;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( currentState.attributesNum !== attributesNum ) return true;\n\n\t\tif ( currentState.index !== index ) return true;\n\n\t\treturn false;\n\n\t}\n\n\tfunction saveCache( object, geometry, program, index ) {\n\n\t\tconst cache = {};\n\t\tconst attributes = geometry.attributes;\n\t\tlet attributesNum = 0;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet attribute = attributes[ name ];\n\n\t\t\t\tif ( attribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) attribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) attribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tconst data = {};\n\t\t\t\tdata.attribute = attribute;\n\n\t\t\t\tif ( attribute && attribute.data ) {\n\n\t\t\t\t\tdata.data = attribute.data;\n\n\t\t\t\t}\n\n\t\t\t\tcache[ name ] = data;\n\n\t\t\t\tattributesNum ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tcurrentState.attributes = cache;\n\t\tcurrentState.attributesNum = attributesNum;\n\n\t\tcurrentState.index = index;\n\n\t}\n\n\tfunction initAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\n\t\tfor ( let i = 0, il = newAttributes.length; i < il; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\tfunction enableAttribute( attribute ) {\n\n\t\tenableAttributeAndDivisor( attribute, 0 );\n\n\t}\n\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\t\tconst attributeDivisors = currentState.attributeDivisors;\n\n\t\tnewAttributes[ attribute ] = 1;\n\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\n\n\t\t\tgl.enableVertexAttribArray( attribute );\n\t\t\tenabledAttributes[ attribute ] = 1;\n\n\t\t}\n\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\n\n\t\t\tconst extension = capabilities.isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' );\n\n\t\t\textension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\n\n\t\t}\n\n\t}\n\n\tfunction disableUnusedAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\n\t\tfor ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) {\n\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction vertexAttribPointer( index, size, type, normalized, stride, offset, integer ) {\n\n\t\tif ( integer === true ) {\n\n\t\t\tgl.vertexAttribIPointer( index, size, type, stride, offset );\n\n\t\t} else {\n\n\t\t\tgl.vertexAttribPointer( index, size, type, normalized, stride, offset );\n\n\t\t}\n\n\t}\n\n\tfunction setupVertexAttributes( object, material, program, geometry ) {\n\n\t\tif ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {\n\n\t\t\tif ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;\n\n\t\t}\n\n\t\tinitAttributes();\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tconst materialDefaultAttributeValues = material.defaultAttributeValues;\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( geometryAttribute !== undefined ) {\n\n\t\t\t\t\tconst normalized = geometryAttribute.normalized;\n\t\t\t\t\tconst size = geometryAttribute.itemSize;\n\n\t\t\t\t\tconst attribute = attributes.get( geometryAttribute );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tconst buffer = attribute.buffer;\n\t\t\t\t\tconst type = attribute.type;\n\t\t\t\t\tconst bytesPerElement = attribute.bytesPerElement;\n\n\t\t\t\t\t// check for integer attributes (WebGL 2 only)\n\n\t\t\t\t\tconst integer = ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType ) );\n\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst data = geometryAttribute.data;\n\t\t\t\t\t\tconst stride = data.stride;\n\t\t\t\t\t\tconst offset = geometryAttribute.offset;\n\n\t\t\t\t\t\tif ( data.isInstancedInterleavedBuffer ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, data.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = data.meshPerAttribute * data.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tstride * bytesPerElement,\n\t\t\t\t\t\t\t\t( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, geometryAttribute.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( gl.ARRAY_BUFFER, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tsize * bytesPerElement,\n\t\t\t\t\t\t\t\t( size / programAttribute.locationSize ) * i * bytesPerElement,\n\t\t\t\t\t\t\t\tinteger\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\n\n\t\t\t\t\tconst value = materialDefaultAttributeValues[ name ];\n\n\t\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\t\tswitch ( value.length ) {\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tgl.vertexAttrib2fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\tgl.vertexAttrib3fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\tgl.vertexAttrib4fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tgl.vertexAttrib1fv( programAttribute.location, value );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tdisableUnusedAttributes();\n\n\t}\n\n\tfunction dispose() {\n\n\t\treset();\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t}\n\n\t\t\tdelete bindingStates[ geometryId ];\n\n\t\t}\n\n\t}\n\n\tfunction releaseStatesOfGeometry( geometry ) {\n\n\t\tif ( bindingStates[ geometry.id ] === undefined ) return;\n\n\t\tconst programMap = bindingStates[ geometry.id ];\n\n\t\tfor ( const programId in programMap ) {\n\n\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ programId ];\n\n\t\t}\n\n\t\tdelete bindingStates[ geometry.id ];\n\n\t}\n\n\tfunction releaseStatesOfProgram( program ) {\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tif ( programMap[ program.id ] === undefined ) continue;\n\n\t\t\tconst stateMap = programMap[ program.id ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ program.id ];\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\tresetDefaultState();\n\t\tforceUpdate = true;\n\n\t\tif ( currentState === defaultState ) return;\n\n\t\tcurrentState = defaultState;\n\t\tbindVertexArrayObject( currentState.object );\n\n\t}\n\n\t// for backward-compatibility\n\n\tfunction resetDefaultState() {\n\n\t\tdefaultState.geometry = null;\n\t\tdefaultState.program = null;\n\t\tdefaultState.wireframe = false;\n\n\t}\n\n\treturn {\n\n\t\tsetup: setup,\n\t\treset: reset,\n\t\tresetDefaultState: resetDefaultState,\n\t\tdispose: dispose,\n\t\treleaseStatesOfGeometry: releaseStatesOfGeometry,\n\t\treleaseStatesOfProgram: releaseStatesOfProgram,\n\n\t\tinitAttributes: initAttributes,\n\t\tenableAttribute: enableAttribute,\n\t\tdisableUnusedAttributes: disableUnusedAttributes\n\n\t};\n\n}\n\nfunction WebGLBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawArrays( mode, start, count );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawArraysInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawArraysInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\tthis.render( starts[ i ], counts[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tinfo.update( elementCount, mode, 1 );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters ) {\n\n\tlet maxAnisotropy;\n\n\tfunction getMaxAnisotropy() {\n\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\n\n\t\t} else {\n\n\t\t\tmaxAnisotropy = 0;\n\n\t\t}\n\n\t\treturn maxAnisotropy;\n\n\t}\n\n\tfunction getMaxPrecision( precision ) {\n\n\t\tif ( precision === 'highp' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'highp';\n\n\t\t\t}\n\n\t\t\tprecision = 'mediump';\n\n\t\t}\n\n\t\tif ( precision === 'mediump' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {\n\n\t\t\t\treturn 'mediump';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn 'lowp';\n\n\t}\n\n\tconst isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';\n\n\tlet precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n\tconst maxPrecision = getMaxPrecision( precision );\n\n\tif ( maxPrecision !== precision ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\n\t\tprecision = maxPrecision;\n\n\t}\n\n\tconst drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );\n\n\tconst logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\n\tconst maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\n\tconst maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );\n\tconst maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );\n\n\tconst maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\n\tconst maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );\n\tconst maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );\n\tconst maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );\n\n\tconst vertexTextures = maxVertexTextures > 0;\n\tconst floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );\n\tconst floatVertexTextures = vertexTextures && floatFragmentTextures;\n\n\tconst maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;\n\n\treturn {\n\n\t\tisWebGL2: isWebGL2,\n\n\t\tdrawBuffers: drawBuffers,\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\tprecision: precision,\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\tmaxTextures: maxTextures,\n\t\tmaxVertexTextures: maxVertexTextures,\n\t\tmaxTextureSize: maxTextureSize,\n\t\tmaxCubemapSize: maxCubemapSize,\n\n\t\tmaxAttributes: maxAttributes,\n\t\tmaxVertexUniforms: maxVertexUniforms,\n\t\tmaxVaryings: maxVaryings,\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\n\n\t\tvertexTextures: vertexTextures,\n\t\tfloatFragmentTextures: floatFragmentTextures,\n\t\tfloatVertexTextures: floatVertexTextures,\n\n\t\tmaxSamples: maxSamples\n\n\t};\n\n}\n\nfunction WebGLClipping( properties ) {\n\n\tconst scope = this;\n\n\tlet globalState = null,\n\t\tnumGlobalPlanes = 0,\n\t\tlocalClippingEnabled = false,\n\t\trenderingShadows = false;\n\n\tconst plane = new Plane(),\n\t\tviewNormalMatrix = new Matrix3(),\n\n\t\tuniform = { value: null, needsUpdate: false };\n\n\tthis.uniform = uniform;\n\tthis.numPlanes = 0;\n\tthis.numIntersection = 0;\n\n\tthis.init = function ( planes, enableLocalClipping ) {\n\n\t\tconst enabled =\n\t\t\tplanes.length !== 0 ||\n\t\t\tenableLocalClipping ||\n\t\t\t// enable state of previous frame - the clipping code has to\n\t\t\t// run another frame in order to reset the state:\n\t\t\tnumGlobalPlanes !== 0 ||\n\t\t\tlocalClippingEnabled;\n\n\t\tlocalClippingEnabled = enableLocalClipping;\n\n\t\tnumGlobalPlanes = planes.length;\n\n\t\treturn enabled;\n\n\t};\n\n\tthis.beginShadows = function () {\n\n\t\trenderingShadows = true;\n\t\tprojectPlanes( null );\n\n\t};\n\n\tthis.endShadows = function () {\n\n\t\trenderingShadows = false;\n\n\t};\n\n\tthis.setGlobalState = function ( planes, camera ) {\n\n\t\tglobalState = projectPlanes( planes, camera, 0 );\n\n\t};\n\n\tthis.setState = function ( material, camera, useCache ) {\n\n\t\tconst planes = material.clippingPlanes,\n\t\t\tclipIntersection = material.clipIntersection,\n\t\t\tclipShadows = material.clipShadows;\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\n\n\t\t\t// there's no local clipping\n\n\t\t\tif ( renderingShadows ) {\n\n\t\t\t\t// there's no global clipping\n\n\t\t\t\tprojectPlanes( null );\n\n\t\t\t} else {\n\n\t\t\t\tresetGlobalState();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n\t\t\t\tlGlobal = nGlobal * 4;\n\n\t\t\tlet dstArray = materialProperties.clippingState || null;\n\n\t\t\tuniform.value = dstArray; // ensure unique state\n\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, useCache );\n\n\t\t\tfor ( let i = 0; i !== lGlobal; ++ i ) {\n\n\t\t\t\tdstArray[ i ] = globalState[ i ];\n\n\t\t\t}\n\n\t\t\tmaterialProperties.clippingState = dstArray;\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\n\t\t\tthis.numPlanes += nGlobal;\n\n\t\t}\n\n\n\t};\n\n\tfunction resetGlobalState() {\n\n\t\tif ( uniform.value !== globalState ) {\n\n\t\t\tuniform.value = globalState;\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\n\n\t\t}\n\n\t\tscope.numPlanes = numGlobalPlanes;\n\t\tscope.numIntersection = 0;\n\n\t}\n\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\n\n\t\tconst nPlanes = planes !== null ? planes.length : 0;\n\t\tlet dstArray = null;\n\n\t\tif ( nPlanes !== 0 ) {\n\n\t\t\tdstArray = uniform.value;\n\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\n\n\t\t\t\tconst flatSize = dstOffset + nPlanes * 4,\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\n\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\n\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\n\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\n\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\n\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tuniform.value = dstArray;\n\t\t\tuniform.needsUpdate = true;\n\n\t\t}\n\n\t\tscope.numPlanes = nPlanes;\n\t\tscope.numIntersection = 0;\n\n\t\treturn dstArray;\n\n\t}\n\n}\n\nfunction WebGLCubeMaps( renderer ) {\n\n\tlet cubemaps = new WeakMap();\n\n\tfunction mapTextureMapping( texture, mapping ) {\n\n\t\tif ( mapping === EquirectangularReflectionMapping ) {\n\n\t\t\ttexture.mapping = CubeReflectionMapping;\n\n\t\t} else if ( mapping === EquirectangularRefractionMapping ) {\n\n\t\t\ttexture.mapping = CubeRefractionMapping;\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tif ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) {\n\n\t\t\t\tif ( cubemaps.has( texture ) ) {\n\n\t\t\t\t\tconst cubemap = cubemaps.get( texture ).texture;\n\t\t\t\t\treturn mapTextureMapping( cubemap, texture.mapping );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\tif ( image && image.height > 0 ) {\n\n\t\t\t\t\t\tconst renderTarget = new WebGLCubeRenderTarget( image.height / 2 );\n\t\t\t\t\t\trenderTarget.fromEquirectangularTexture( renderer, texture );\n\t\t\t\t\t\tcubemaps.set( texture, renderTarget );\n\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\treturn mapTextureMapping( renderTarget.texture, texture.mapping );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemap = cubemaps.get( texture );\n\n\t\tif ( cubemap !== undefined ) {\n\n\t\t\tcubemaps.delete( texture );\n\t\t\tcubemap.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubemaps = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass OrthographicCamera extends Camera {\n\n\tconstructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isOrthographicCamera = true;\n\n\t\tthis.type = 'OrthographicCamera';\n\n\t\tthis.zoom = 1;\n\t\tthis.view = null;\n\n\t\tthis.left = left;\n\t\tthis.right = right;\n\t\tthis.top = top;\n\t\tthis.bottom = bottom;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t}\n\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tconst cx = ( this.right + this.left ) / 2;\n\t\tconst cy = ( this.top + this.bottom ) / 2;\n\n\t\tlet left = cx - dx;\n\t\tlet right = cx + dx;\n\t\tlet top = cy + dy;\n\t\tlet bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst LOD_MIN = 4;\n\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst MAX_SAMPLES = 20;\n\nconst _flatCamera = /*@__PURE__*/ new OrthographicCamera();\nconst _clearColor = /*@__PURE__*/ new Color();\nlet _oldTarget = null;\nlet _oldActiveCubeFace = 0;\nlet _oldActiveMipmapLevel = 0;\n\n// Golden Ratio\nconst PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\nconst INV_PHI = 1 / PHI;\n\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst _axisDirections = [\n\t/*@__PURE__*/ new Vector3( 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ) ];\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/\n\nclass PMREMGenerator {\n\n\tconstructor( renderer ) {\n\n\t\tthis._renderer = renderer;\n\t\tthis._pingPongRenderTarget = null;\n\n\t\tthis._lodMax = 0;\n\t\tthis._cubeSize = 0;\n\t\tthis._lodPlanes = [];\n\t\tthis._sizeLods = [];\n\t\tthis._sigmas = [];\n\n\t\tthis._blurMaterial = null;\n\t\tthis._cubemapMaterial = null;\n\t\tthis._equirectMaterial = null;\n\n\t\tthis._compileMaterial( this._blurMaterial );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100 ) {\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\n\t\tthis._setSize( 256 );\n\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\n\t\tcubeUVRenderTarget.depthBuffer = true;\n\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\n\n\t\tif ( sigma > 0 ) {\n\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * or HDR. The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromEquirectangular( equirectangular, renderTarget = null ) {\n\n\t\treturn this._fromTexture( equirectangular, renderTarget );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * or HDR. The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromCubemap( cubemap, renderTarget = null ) {\n\n\t\treturn this._fromTexture( cubemap, renderTarget );\n\n\t}\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader() {\n\n\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\t\t\tthis._compileMaterial( this._cubemapMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader() {\n\n\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\t\t\tthis._compileMaterial( this._equirectMaterial );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose() {\n\n\t\tthis._dispose();\n\n\t\tif ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();\n\t\tif ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();\n\n\t}\n\n\t// private interface\n\n\t_setSize( cubeSize ) {\n\n\t\tthis._lodMax = Math.floor( Math.log2( cubeSize ) );\n\t\tthis._cubeSize = Math.pow( 2, this._lodMax );\n\n\t}\n\n\t_dispose() {\n\n\t\tif ( this._blurMaterial !== null ) this._blurMaterial.dispose();\n\n\t\tif ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();\n\n\t\tfor ( let i = 0; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tthis._lodPlanes[ i ].dispose();\n\n\t\t}\n\n\t}\n\n\t_cleanup( outputTarget ) {\n\n\t\tthis._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );\n\t\toutputTarget.scissorTest = false;\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\n\n\t}\n\n\t_fromTexture( texture, renderTarget ) {\n\n\t\tif ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {\n\n\t\t\tthis._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );\n\n\t\t} else { // Equirectangular\n\n\t\t\tthis._setSize( texture.image.width / 4 );\n\n\t\t}\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\t_oldActiveCubeFace = this._renderer.getActiveCubeFace();\n\t\t_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();\n\n\t\tconst cubeUVRenderTarget = renderTarget || this._allocateTargets();\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_allocateTargets() {\n\n\t\tconst width = 3 * Math.max( this._cubeSize, 16 * 7 );\n\t\tconst height = 4 * this._cubeSize;\n\n\t\tconst params = {\n\t\t\tmagFilter: LinearFilter,\n\t\t\tminFilter: LinearFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\ttype: HalfFloatType,\n\t\t\tformat: RGBAFormat,\n\t\t\tcolorSpace: LinearSRGBColorSpace,\n\t\t\tdepthBuffer: false\n\t\t};\n\n\t\tconst cubeUVRenderTarget = _createRenderTarget( width, height, params );\n\n\t\tif ( this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height ) {\n\n\t\t\tif ( this._pingPongRenderTarget !== null ) {\n\n\t\t\t\tthis._dispose();\n\n\t\t\t}\n\n\t\t\tthis._pingPongRenderTarget = _createRenderTarget( width, height, params );\n\n\t\t\tconst { _lodMax } = this;\n\t\t\t( { sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes( _lodMax ) );\n\n\t\t\tthis._blurMaterial = _getBlurShader( _lodMax, width, height );\n\n\t\t}\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_compileMaterial( material ) {\n\n\t\tconst tmpMesh = new Mesh( this._lodPlanes[ 0 ], material );\n\t\tthis._renderer.compile( tmpMesh, _flatCamera );\n\n\t}\n\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\n\n\t\tconst fov = 90;\n\t\tconst aspect = 1;\n\t\tconst cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\n\t\tconst upSign = [ 1, - 1, 1, 1, 1, 1 ];\n\t\tconst forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];\n\t\tconst renderer = this._renderer;\n\n\t\tconst originalAutoClear = renderer.autoClear;\n\t\tconst toneMapping = renderer.toneMapping;\n\t\trenderer.getClearColor( _clearColor );\n\n\t\trenderer.toneMapping = NoToneMapping;\n\t\trenderer.autoClear = false;\n\n\t\tconst backgroundMaterial = new MeshBasicMaterial( {\n\t\t\tname: 'PMREM.Background',\n\t\t\tside: BackSide,\n\t\t\tdepthWrite: false,\n\t\t\tdepthTest: false,\n\t\t} );\n\n\t\tconst backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );\n\n\t\tlet useSolidColor = false;\n\t\tconst background = scene.background;\n\n\t\tif ( background ) {\n\n\t\t\tif ( background.isColor ) {\n\n\t\t\t\tbackgroundMaterial.color.copy( background );\n\t\t\t\tscene.background = null;\n\t\t\t\tuseSolidColor = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tbackgroundMaterial.color.copy( _clearColor );\n\t\t\tuseSolidColor = true;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst col = i % 3;\n\n\t\t\tif ( col === 0 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\n\n\t\t\t} else if ( col === 1 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\n\n\t\t\t}\n\n\t\t\tconst size = this._cubeSize;\n\n\t\t\t_setViewport( cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size );\n\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\n\t\t\tif ( useSolidColor ) {\n\n\t\t\t\trenderer.render( backgroundBox, cubeCamera );\n\n\t\t\t}\n\n\t\t\trenderer.render( scene, cubeCamera );\n\n\t\t}\n\n\t\tbackgroundBox.geometry.dispose();\n\t\tbackgroundBox.material.dispose();\n\n\t\trenderer.toneMapping = toneMapping;\n\t\trenderer.autoClear = originalAutoClear;\n\t\tscene.background = background;\n\n\t}\n\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );\n\n\t\tif ( isCubeTexture ) {\n\n\t\t\tif ( this._cubemapMaterial === null ) {\n\n\t\t\t\tthis._cubemapMaterial = _getCubemapMaterial();\n\n\t\t\t}\n\n\t\t\tthis._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t} else {\n\n\t\t\tif ( this._equirectMaterial === null ) {\n\n\t\t\t\tthis._equirectMaterial = _getEquirectMaterial();\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n\t\tconst mesh = new Mesh( this._lodPlanes[ 0 ], material );\n\n\t\tconst uniforms = material.uniforms;\n\n\t\tuniforms[ 'envMap' ].value = texture;\n\n\t\tconst size = this._cubeSize;\n\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * size, 2 * size );\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( mesh, _flatCamera );\n\n\t}\n\n\t_applyPMREM( cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst autoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\n\t\tfor ( let i = 1; i < this._lodPlanes.length; i ++ ) {\n\n\t\t\tconst sigma = Math.sqrt( this._sigmas[ i ] * this._sigmas[ i ] - this._sigmas[ i - 1 ] * this._sigmas[ i - 1 ] );\n\n\t\t\tconst poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];\n\n\t\t\tthis._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\n\n\t\t}\n\n\t\trenderer.autoClear = autoClear;\n\n\t}\n\n\t/**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tthis._halfBlur(\n\t\t\tcubeUVRenderTarget,\n\t\t\tpingPongRenderTarget,\n\t\t\tlodIn,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'latitudinal',\n\t\t\tpoleAxis );\n\n\t\tthis._halfBlur(\n\t\t\tpingPongRenderTarget,\n\t\t\tcubeUVRenderTarget,\n\t\t\tlodOut,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'longitudinal',\n\t\t\tpoleAxis );\n\n\t}\n\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst blurMaterial = this._blurMaterial;\n\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\t\tconsole.error(\n\t\t\t\t'blur direction must be either latitudinal or longitudinal!' );\n\n\t\t}\n\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\n\t\tconst STANDARD_DEVIATIONS = 3;\n\n\t\tconst blurMesh = new Mesh( this._lodPlanes[ lodOut ], blurMaterial );\n\t\tconst blurUniforms = blurMaterial.uniforms;\n\n\t\tconst pixels = this._sizeLods[ lodIn ] - 1;\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\t\tif ( samples > MAX_SAMPLES ) {\n\n\t\t\tconsole.warn( `sigmaRadians, ${\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t\t}\n\n\t\tconst weights = [];\n\t\tlet sum = 0;\n\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\t\tconst x = i / sigmaPixels;\n\t\t\tconst weight = Math.exp( - x * x / 2 );\n\t\t\tweights.push( weight );\n\n\t\t\tif ( i === 0 ) {\n\n\t\t\t\tsum += weight;\n\n\t\t\t} else if ( i < samples ) {\n\n\t\t\t\tsum += 2 * weight;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\n\n\t\t\tweights[ i ] = weights[ i ] / sum;\n\n\t\t}\n\n\t\tblurUniforms[ 'envMap' ].value = targetIn.texture;\n\t\tblurUniforms[ 'samples' ].value = samples;\n\t\tblurUniforms[ 'weights' ].value = weights;\n\t\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\n\n\t\tif ( poleAxis ) {\n\n\t\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\n\n\t\t}\n\n\t\tconst { _lodMax } = this;\n\t\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\n\t\tblurUniforms[ 'mipInt' ].value = _lodMax - lodIn;\n\n\t\tconst outputSize = this._sizeLods[ lodOut ];\n\t\tconst x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );\n\t\tconst y = 4 * ( this._cubeSize - outputSize );\n\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( targetOut );\n\t\trenderer.render( blurMesh, _flatCamera );\n\n\t}\n\n}\n\n\n\nfunction _createPlanes( lodMax ) {\n\n\tconst lodPlanes = [];\n\tconst sizeLods = [];\n\tconst sigmas = [];\n\n\tlet lod = lodMax;\n\n\tconst totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n\n\tfor ( let i = 0; i < totalLods; i ++ ) {\n\n\t\tconst sizeLod = Math.pow( 2, lod );\n\t\tsizeLods.push( sizeLod );\n\t\tlet sigma = 1.0 / sizeLod;\n\n\t\tif ( i > lodMax - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - lodMax + LOD_MIN - 1 ];\n\n\t\t} else if ( i === 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\n\t\tsigmas.push( sigma );\n\n\t\tconst texelSize = 1.0 / ( sizeLod - 2 );\n\t\tconst min = - texelSize;\n\t\tconst max = 1 + texelSize;\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tconst cubeFaces = 6;\n\t\tconst vertices = 6;\n\t\tconst positionSize = 3;\n\t\tconst uvSize = 2;\n\t\tconst faceIndexSize = 1;\n\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tconst y = face > 2 ? 0 : - 1;\n\t\t\tconst coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\n\t\t\tuv.set( uv1, uvSize * vertices * face );\n\t\t\tconst fill = [ face, face, face, face, face, face ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\n\n\t\t}\n\n\t\tconst planes = new BufferGeometry();\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\n\t\tlodPlanes.push( planes );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\n\treturn { lodPlanes, sizeLods, sigmas };\n\n}\n\nfunction _createRenderTarget( width, height, params ) {\n\n\tconst cubeUVRenderTarget = new WebGLRenderTarget( width, height, params );\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\ttarget.viewport.set( x, y, width, height );\n\ttarget.scissor.set( x, y, width, height );\n\n}\n\nfunction _getBlurShader( lodMax, width, height ) {\n\n\tconst weights = new Float32Array( MAX_SAMPLES );\n\tconst poleAxis = new Vector3( 0, 1, 0 );\n\tconst shaderMaterial = new ShaderMaterial( {\n\n\t\tname: 'SphericalGaussianBlur',\n\n\t\tdefines: {\n\t\t\t'n': MAX_SAMPLES,\n\t\t\t'CUBEUV_TEXEL_WIDTH': 1.0 / width,\n\t\t\t'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\n\t\t\t'CUBEUV_MAX_MIP': `${lodMax}.0`,\n\t\t},\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'samples': { value: 1 },\n\t\t\t'weights': { value: weights },\n\t\t\t'latitudinal': { value: false },\n\t\t\t'dTheta': { value: 0 },\n\t\t\t'mipInt': { value: 0 },\n\t\t\t'poleAxis': { value: poleAxis }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\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 \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`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getEquirectMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'EquirectangularToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\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 \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`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCubemapMaterial() {\n\n\treturn new ShaderMaterial( {\n\n\t\tname: 'CubemapToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'flipEnvMap': { value: - 1 }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\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`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n}\n\nfunction _getCommonVertexShader() {\n\n\treturn /* glsl */`\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`;\n\n}\n\nfunction WebGLCubeUVMaps( renderer ) {\n\n\tlet cubeUVmaps = new WeakMap();\n\n\tlet pmremGenerator = null;\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tconst isEquirectMap = ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping );\n\t\t\tconst isCubeMap = ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );\n\n\t\t\t// equirect/cube map to cubeUV conversion\n\n\t\t\tif ( isEquirectMap || isCubeMap ) {\n\n\t\t\t\tif ( texture.isRenderTargetTexture && texture.needsPMREMUpdate === true ) {\n\n\t\t\t\t\ttexture.needsPMREMUpdate = false;\n\n\t\t\t\t\tlet renderTarget = cubeUVmaps.get( texture );\n\n\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\trenderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );\n\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( cubeUVmaps.has( texture ) ) {\n\n\t\t\t\t\t\treturn cubeUVmaps.get( texture ).texture;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\t\tif ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {\n\n\t\t\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\t\t\tconst renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction isCubeTextureComplete( image ) {\n\n\t\tlet count = 0;\n\t\tconst length = 6;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tif ( image[ i ] !== undefined ) count ++;\n\n\t\t}\n\n\t\treturn count === length;\n\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemapUV = cubeUVmaps.get( texture );\n\n\t\tif ( cubemapUV !== undefined ) {\n\n\t\t\tcubeUVmaps.delete( texture );\n\t\t\tcubemapUV.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubeUVmaps = new WeakMap();\n\n\t\tif ( pmremGenerator !== null ) {\n\n\t\t\tpmremGenerator.dispose();\n\t\t\tpmremGenerator = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLExtensions( gl ) {\n\n\tconst extensions = {};\n\n\tfunction getExtension( name ) {\n\n\t\tif ( extensions[ name ] !== undefined ) {\n\n\t\t\treturn extensions[ name ];\n\n\t\t}\n\n\t\tlet extension;\n\n\t\tswitch ( name ) {\n\n\t\t\tcase 'WEBGL_depth_texture':\n\t\t\t\textension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'EXT_texture_filter_anisotropic':\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\textension = gl.getExtension( name );\n\n\t\t}\n\n\t\textensions[ name ] = extension;\n\n\t\treturn extension;\n\n\t}\n\n\treturn {\n\n\t\thas: function ( name ) {\n\n\t\t\treturn getExtension( name ) !== null;\n\n\t\t},\n\n\t\tinit: function ( capabilities ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\t\t\t\tgetExtension( 'WEBGL_clip_cull_distance' );\n\n\t\t\t} else {\n\n\t\t\t\tgetExtension( 'WEBGL_depth_texture' );\n\t\t\t\tgetExtension( 'OES_texture_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float_linear' );\n\t\t\t\tgetExtension( 'OES_standard_derivatives' );\n\t\t\t\tgetExtension( 'OES_element_index_uint' );\n\t\t\t\tgetExtension( 'OES_vertex_array_object' );\n\t\t\t\tgetExtension( 'ANGLE_instanced_arrays' );\n\n\t\t\t}\n\n\t\t\tgetExtension( 'OES_texture_float_linear' );\n\t\t\tgetExtension( 'EXT_color_buffer_half_float' );\n\t\t\tgetExtension( 'WEBGL_multisampled_render_to_texture' );\n\n\t\t},\n\n\t\tget: function ( name ) {\n\n\t\t\tconst extension = getExtension( name );\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\n\n\t\t\t}\n\n\t\t\treturn extension;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLGeometries( gl, attributes, info, bindingStates ) {\n\n\tconst geometries = {};\n\tconst wireframeAttributes = new WeakMap();\n\n\tfunction onGeometryDispose( event ) {\n\n\t\tconst geometry = event.target;\n\n\t\tif ( geometry.index !== null ) {\n\n\t\t\tattributes.remove( geometry.index );\n\n\t\t}\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tattributes.remove( geometry.attributes[ name ] );\n\n\t\t}\n\n\t\tfor ( const name in geometry.morphAttributes ) {\n\n\t\t\tconst array = geometry.morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.remove( array[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\n\n\t\tdelete geometries[ geometry.id ];\n\n\t\tconst attribute = wireframeAttributes.get( geometry );\n\n\t\tif ( attribute ) {\n\n\t\t\tattributes.remove( attribute );\n\t\t\twireframeAttributes.delete( geometry );\n\n\t\t}\n\n\t\tbindingStates.releaseStatesOfGeometry( geometry );\n\n\t\tif ( geometry.isInstancedBufferGeometry === true ) {\n\n\t\t\tdelete geometry._maxInstanceCount;\n\n\t\t}\n\n\t\t//\n\n\t\tinfo.memory.geometries --;\n\n\t}\n\n\tfunction get( object, geometry ) {\n\n\t\tif ( geometries[ geometry.id ] === true ) return geometry;\n\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\n\n\t\tgeometries[ geometry.id ] = true;\n\n\t\tinfo.memory.geometries ++;\n\n\t\treturn geometry;\n\n\t}\n\n\tfunction update( geometry ) {\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates.\n\n\t\tfor ( const name in geometryAttributes ) {\n\n\t\t\tattributes.update( geometryAttributes[ name ], gl.ARRAY_BUFFER );\n\n\t\t}\n\n\t\t// morph targets\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.update( array[ i ], gl.ARRAY_BUFFER );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateWireframeAttribute( geometry ) {\n\n\t\tconst indices = [];\n\n\t\tconst geometryIndex = geometry.index;\n\t\tconst geometryPosition = geometry.attributes.position;\n\t\tlet version = 0;\n\n\t\tif ( geometryIndex !== null ) {\n\n\t\t\tconst array = geometryIndex.array;\n\t\t\tversion = geometryIndex.version;\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\t\tconst a = array[ i + 0 ];\n\t\t\t\tconst b = array[ i + 1 ];\n\t\t\t\tconst c = array[ i + 2 ];\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else if ( geometryPosition !== undefined ) {\n\n\t\t\tconst array = geometryPosition.array;\n\t\t\tversion = geometryPosition.version;\n\n\t\t\tfor ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\n\n\t\t\t\tconst a = i + 0;\n\t\t\t\tconst b = i + 1;\n\t\t\t\tconst c = i + 2;\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\n\t\tattribute.version = version;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates\n\n\t\t//\n\n\t\tconst previousAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\n\n\t\t//\n\n\t\twireframeAttributes.set( geometry, attribute );\n\n\t}\n\n\tfunction getWireframeAttribute( geometry ) {\n\n\t\tconst currentAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( currentAttribute ) {\n\n\t\t\tconst geometryIndex = geometry.index;\n\n\t\t\tif ( geometryIndex !== null ) {\n\n\t\t\t\t// if the attribute is obsolete, create a new one\n\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\n\n\t\t\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t}\n\n\t\treturn wireframeAttributes.get( geometry );\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tupdate: update,\n\n\t\tgetWireframeAttribute: getWireframeAttribute\n\n\t};\n\n}\n\nfunction WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tlet type, bytesPerElement;\n\n\tfunction setIndex( value ) {\n\n\t\ttype = value.type;\n\t\tbytesPerElement = value.bytesPerElement;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawElementsInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawElementsInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\tfunction renderMultiDraw( starts, counts, drawCount ) {\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\tconst extension = extensions.get( 'WEBGL_multi_draw' );\n\t\tif ( extension === null ) {\n\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\tthis.render( starts[ i ] / bytesPerElement, counts[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\textension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );\n\n\t\t\tlet elementCount = 0;\n\t\t\tfor ( let i = 0; i < drawCount; i ++ ) {\n\n\t\t\t\telementCount += counts[ i ];\n\n\t\t\t}\n\n\t\t\tinfo.update( elementCount, mode, 1 );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\tthis.renderMultiDraw = renderMultiDraw;\n\n}\n\nfunction WebGLInfo( gl ) {\n\n\tconst memory = {\n\t\tgeometries: 0,\n\t\ttextures: 0\n\t};\n\n\tconst render = {\n\t\tframe: 0,\n\t\tcalls: 0,\n\t\ttriangles: 0,\n\t\tpoints: 0,\n\t\tlines: 0\n\t};\n\n\tfunction update( count, mode, instanceCount ) {\n\n\t\trender.calls ++;\n\n\t\tswitch ( mode ) {\n\n\t\t\tcase gl.TRIANGLES:\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINES:\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_STRIP:\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\n\t\t\t\tbreak;\n\n\t\t\tcase gl.LINE_LOOP:\n\t\t\t\trender.lines += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tcase gl.POINTS:\n\t\t\t\trender.points += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.error( 'THREE.WebGLInfo: Unknown draw mode:', mode );\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\trender.calls = 0;\n\t\trender.triangles = 0;\n\t\trender.points = 0;\n\t\trender.lines = 0;\n\n\t}\n\n\treturn {\n\t\tmemory: memory,\n\t\trender: render,\n\t\tprograms: null,\n\t\tautoReset: true,\n\t\treset: reset,\n\t\tupdate: update\n\t};\n\n}\n\nfunction numericalSort( a, b ) {\n\n\treturn a[ 0 ] - b[ 0 ];\n\n}\n\nfunction absNumericalSort( a, b ) {\n\n\treturn Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );\n\n}\n\nfunction WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst influencesList = {};\n\tconst morphInfluences = new Float32Array( 8 );\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector4();\n\n\tconst workInfluences = [];\n\n\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\tworkInfluences[ i ] = [ i, 0 ];\n\n\t}\n\n\tfunction update( object, geometry, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tif ( capabilities.isWebGL2 === true ) {\n\n\t\t\t// instead of using attributes, the WebGL 2 code path encodes morph targets\n\t\t\t// into an array of data textures. Each layer represents a single morph target.\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tlet entry = morphTextures.get( geometry );\n\n\t\t\tif ( entry === undefined || entry.count !== morphTargetsCount ) {\n\n\t\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\t\tconst hasMorphPosition = geometry.morphAttributes.position !== undefined;\n\t\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\t\t\t\tconst hasMorphColors = geometry.morphAttributes.color !== undefined;\n\n\t\t\t\tconst morphTargets = geometry.morphAttributes.position || [];\n\t\t\t\tconst morphNormals = geometry.morphAttributes.normal || [];\n\t\t\t\tconst morphColors = geometry.morphAttributes.color || [];\n\n\t\t\t\tlet vertexDataCount = 0;\n\n\t\t\t\tif ( hasMorphPosition === true ) vertexDataCount = 1;\n\t\t\t\tif ( hasMorphNormals === true ) vertexDataCount = 2;\n\t\t\t\tif ( hasMorphColors === true ) vertexDataCount = 3;\n\n\t\t\t\tlet width = geometry.attributes.position.count * vertexDataCount;\n\t\t\t\tlet height = 1;\n\n\t\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t\t}\n\n\t\t\t\tconst buffer = new Float32Array( width * height * 4 * morphTargetsCount );\n\n\t\t\t\tconst texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );\n\t\t\t\ttexture.type = FloatType;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t// fill buffer\n\n\t\t\t\tconst vertexDataStride = vertexDataCount * 4;\n\n\t\t\t\tfor ( let i = 0; i < morphTargetsCount; i ++ ) {\n\n\t\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\t\tconst morphNormal = morphNormals[ i ];\n\t\t\t\t\tconst morphColor = morphColors[ i ];\n\n\t\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\t\tif ( hasMorphPosition === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( hasMorphColors === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphColor, j );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 8 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 9 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 10 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tentry = {\n\t\t\t\t\tcount: morphTargetsCount,\n\t\t\t\t\ttexture: texture,\n\t\t\t\t\tsize: new Vector2( width, height )\n\t\t\t\t};\n\n\t\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\t\tfunction disposeTexture() {\n\n\t\t\t\t\ttexture.dispose();\n\n\t\t\t\t\tmorphTextures.delete( geometry );\n\n\t\t\t\t\tgeometry.removeEventListener( 'dispose', disposeTexture );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.addEventListener( 'dispose', disposeTexture );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\n\n\n\t\t} else {\n\n\t\t\t// When object doesn't have morph target influences defined, we treat it as a 0-length array\n\t\t\t// This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences\n\n\t\t\tconst length = objectInfluences === undefined ? 0 : objectInfluences.length;\n\n\t\t\tlet influences = influencesList[ geometry.id ];\n\n\t\t\tif ( influences === undefined || influences.length !== length ) {\n\n\t\t\t\t// initialise list\n\n\t\t\t\tinfluences = [];\n\n\t\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\t\tinfluences[ i ] = [ i, 0 ];\n\n\t\t\t\t}\n\n\t\t\t\tinfluencesList[ geometry.id ] = influences;\n\n\t\t\t}\n\n\t\t\t// Collect influences\n\n\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\tconst influence = influences[ i ];\n\n\t\t\t\tinfluence[ 0 ] = i;\n\t\t\t\tinfluence[ 1 ] = objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tinfluences.sort( absNumericalSort );\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tif ( i < length && influences[ i ][ 1 ] ) {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = influences[ i ][ 0 ];\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = influences[ i ][ 1 ];\n\n\t\t\t\t} else {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tworkInfluences.sort( numericalSort );\n\n\t\t\tconst morphTargets = geometry.morphAttributes.position;\n\t\t\tconst morphNormals = geometry.morphAttributes.normal;\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tconst influence = workInfluences[ i ];\n\t\t\t\tconst index = influence[ 0 ];\n\t\t\t\tconst value = influence[ 1 ];\n\n\t\t\t\tif ( index !== Number.MAX_SAFE_INTEGER && value ) {\n\n\t\t\t\t\tif ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = value;\n\t\t\t\t\tmorphInfluencesSum += value;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphTarget' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphNormal' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// GLSL shader uses formula baseinfluence * base + sum(target * influence)\n\t\t\t// This allows us to switch between absolute morphs and relative morphs without changing shader code\n\t\t\t// When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tupdate: update\n\n\t};\n\n}\n\nfunction WebGLObjects( gl, geometries, attributes, info ) {\n\n\tlet updateMap = new WeakMap();\n\n\tfunction update( object ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\tconst geometry = object.geometry;\n\t\tconst buffergeometry = geometries.get( object, geometry );\n\n\t\t// Update once per frame\n\n\t\tif ( updateMap.get( buffergeometry ) !== frame ) {\n\n\t\t\tgeometries.update( buffergeometry );\n\n\t\t\tupdateMap.set( buffergeometry, frame );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\tif ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) {\n\n\t\t\t\tobject.addEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\t\t}\n\n\t\t\tif ( updateMap.get( object ) !== frame ) {\n\n\t\t\t\tattributes.update( object.instanceMatrix, gl.ARRAY_BUFFER );\n\n\t\t\t\tif ( object.instanceColor !== null ) {\n\n\t\t\t\t\tattributes.update( object.instanceColor, gl.ARRAY_BUFFER );\n\n\t\t\t\t}\n\n\t\t\t\tupdateMap.set( object, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tconst skeleton = object.skeleton;\n\n\t\t\tif ( updateMap.get( skeleton ) !== frame ) {\n\n\t\t\t\tskeleton.update();\n\n\t\t\t\tupdateMap.set( skeleton, frame );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tupdateMap = new WeakMap();\n\n\t}\n\n\tfunction onInstancedMeshDispose( event ) {\n\n\t\tconst instancedMesh = event.target;\n\n\t\tinstancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\tattributes.remove( instancedMesh.instanceMatrix );\n\n\t\tif ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update,\n\t\tdispose: dispose\n\n\t};\n\n}\n\nclass DepthTexture extends Texture {\n\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {\n\n\t\tformat = format !== undefined ? format : DepthFormat;\n\n\t\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\n\n\t\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\n\n\t\t}\n\n\t\tif ( type === undefined && format === DepthFormat ) type = UnsignedIntType;\n\t\tif ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isDepthTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n\n\t\tthis.flipY = false;\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.compareFunction = null;\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.compareFunction = source.compareFunction;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\n\nconst emptyTexture = /*@__PURE__*/ new Texture();\n\nconst emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );\nemptyShadowTexture.compareFunction = LessEqualCompare;\n\nconst emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();\nconst empty3dTexture = /*@__PURE__*/ new Data3DTexture();\nconst emptyCubeTexture = /*@__PURE__*/ new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nconst arrayCacheF32 = [];\nconst arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nconst mat4array = new Float32Array( 16 );\nconst mat3array = new Float32Array( 9 );\nconst mat2array = new Float32Array( 4 );\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten( array, nBlocks, blockSize ) {\n\n\tconst firstElem = array[ 0 ];\n\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\n\t// unoptimized: ! isNaN( firstElem )\n\t// see http://jacksondunstan.com/articles/983\n\n\tconst n = nBlocks * blockSize;\n\tlet r = arrayCacheF32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Float32Array( n );\n\t\tarrayCacheF32[ n ] = r;\n\n\t}\n\n\tif ( nBlocks !== 0 ) {\n\n\t\tfirstElem.toArray( r, 0 );\n\n\t\tfor ( let i = 1, offset = 0; i !== nBlocks; ++ i ) {\n\n\t\t\toffset += blockSize;\n\t\t\tarray[ i ].toArray( r, offset );\n\n\t\t}\n\n\t}\n\n\treturn r;\n\n}\n\nfunction arraysEqual( a, b ) {\n\n\tif ( a.length !== b.length ) return false;\n\n\tfor ( let i = 0, l = a.length; i < l; i ++ ) {\n\n\t\tif ( a[ i ] !== b[ i ] ) return false;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction copyArray( a, b ) {\n\n\tfor ( let i = 0, l = b.length; i < l; i ++ ) {\n\n\t\ta[ i ] = b[ i ];\n\n\t}\n\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits( textures, n ) {\n\n\tlet r = arrayCacheI32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Int32Array( n );\n\t\tarrayCacheI32[ n ] = r;\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\tr[ i ] = textures.allocateTextureUnit();\n\n\t}\n\n\treturn r;\n\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1f( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else if ( v.r !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\n\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\n\n\t\t\tcache[ 0 ] = v.r;\n\t\t\tcache[ 1 ] = v.g;\n\t\t\tcache[ 2 ] = v.b;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single matrix (from flat array or THREE.MatrixN)\n\nfunction setValueM2( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM3( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat3array.set( elements );\n\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM4( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat4array.set( elements );\n\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\n// Single integer / boolean\n\nfunction setValueV1i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1i( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single integer / boolean vector (from flat array or THREE.VectorN)\n\nfunction setValueV2i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2i( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3i( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4i( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4iv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single unsigned integer\n\nfunction setValueV1ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1ui( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single unsigned integer vector (from flat array or THREE.VectorN)\n\nfunction setValueV2ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2ui( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3ui( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4ui( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4uiv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n\n// Single texture (2D / Cube)\n\nfunction setValueT1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\tconst emptyTexture2D = ( this.type === gl.SAMPLER_2D_SHADOW ) ? emptyShadowTexture : emptyTexture;\n\n\ttextures.setTexture2D( v || emptyTexture2D, unit );\n\n}\n\nfunction setValueT3D1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture3D( v || empty3dTexture, unit );\n\n}\n\nfunction setValueT6( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTextureCube( v || emptyCubeTexture, unit );\n\n}\n\nfunction setValueT2DArray1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2DArray( v || emptyArrayTexture, unit );\n\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1f; // FLOAT\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\n\n\t\tcase 0x1405: return setValueV1ui; // UINT\n\t\tcase 0x8dc6: return setValueV2ui; // _VEC2\n\t\tcase 0x8dc7: return setValueV3ui; // _VEC3\n\t\tcase 0x8dc8: return setValueV4ui; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3D1;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArray1;\n\n\t}\n\n}\n\n\n// Array of scalars\n\nfunction setValueV1fArray( gl, v ) {\n\n\tgl.uniform1fv( this.addr, v );\n\n}\n\n// Array of vectors (from flat array or array of THREE.VectorN)\n\nfunction setValueV2fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 2 );\n\n\tgl.uniform2fv( this.addr, data );\n\n}\n\nfunction setValueV3fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 3 );\n\n\tgl.uniform3fv( this.addr, data );\n\n}\n\nfunction setValueV4fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniform4fv( this.addr, data );\n\n}\n\n// Array of matrices (from flat array or array of THREE.MatrixN)\n\nfunction setValueM2Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}\n\nfunction setValueM3Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 9 );\n\n\tgl.uniformMatrix3fv( this.addr, false, data );\n\n}\n\nfunction setValueM4Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 16 );\n\n\tgl.uniformMatrix4fv( this.addr, false, data );\n\n}\n\n// Array of integer / boolean\n\nfunction setValueV1iArray( gl, v ) {\n\n\tgl.uniform1iv( this.addr, v );\n\n}\n\n// Array of integer / boolean vectors (from flat array)\n\nfunction setValueV2iArray( gl, v ) {\n\n\tgl.uniform2iv( this.addr, v );\n\n}\n\nfunction setValueV3iArray( gl, v ) {\n\n\tgl.uniform3iv( this.addr, v );\n\n}\n\nfunction setValueV4iArray( gl, v ) {\n\n\tgl.uniform4iv( this.addr, v );\n\n}\n\n// Array of unsigned integer\n\nfunction setValueV1uiArray( gl, v ) {\n\n\tgl.uniform1uiv( this.addr, v );\n\n}\n\n// Array of unsigned integer vectors (from flat array)\n\nfunction setValueV2uiArray( gl, v ) {\n\n\tgl.uniform2uiv( this.addr, v );\n\n}\n\nfunction setValueV3uiArray( gl, v ) {\n\n\tgl.uniform3uiv( this.addr, v );\n\n}\n\nfunction setValueV4uiArray( gl, v ) {\n\n\tgl.uniform4uiv( this.addr, v );\n\n}\n\n\n// Array of textures (2D / 3D / Cube / 2DArray)\n\nfunction setValueT1Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2D( v[ i ] || emptyTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT3DArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture3D( v[ i ] || empty3dTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT6Array( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT2DArrayArray( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tif ( ! arraysEqual( cache, units ) ) {\n\n\t\tgl.uniform1iv( this.addr, units );\n\n\t\tcopyArray( cache, units );\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.setTexture2DArray( v[ i ] || emptyArrayTexture, units[ i ] );\n\n\t}\n\n}\n\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\n\n\t\tcase 0x1405: return setValueV1uiArray; // UINT\n\t\tcase 0x8dc6: return setValueV2uiArray; // _VEC2\n\t\tcase 0x8dc7: return setValueV3uiArray; // _VEC3\n\t\tcase 0x8dc8: return setValueV4uiArray; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1Array;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3DArray;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6Array;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArrayArray;\n\n\t}\n\n}\n\n// --- Uniform Classes ---\n\nclass SingleUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.type = activeInfo.type;\n\t\tthis.setValue = getSingularSetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass PureArrayUniform {\n\n\tconstructor( id, activeInfo, addr ) {\n\n\t\tthis.id = id;\n\t\tthis.addr = addr;\n\t\tthis.cache = [];\n\t\tthis.type = activeInfo.type;\n\t\tthis.size = activeInfo.size;\n\t\tthis.setValue = getPureArraySetter( activeInfo.type );\n\n\t\t// this.path = activeInfo.name; // DEBUG\n\n\t}\n\n}\n\nclass StructuredUniform {\n\n\tconstructor( id ) {\n\n\t\tthis.id = id;\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t}\n\n\tsetValue( gl, value, textures ) {\n\n\t\tconst seq = this.seq;\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tu.setValue( gl, value[ u.id ], textures );\n\n\t\t}\n\n\t}\n\n}\n\n// --- Top-level ---\n\n// Parser - builds up the property tree from the path strings\n\nconst RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}\n\nfunction parseUniform( activeInfo, addr, container ) {\n\n\tconst path = activeInfo.name,\n\t\tpathLength = path.length;\n\n\t// reset RegExp object, because of the early exit of a previous run\n\tRePathPart.lastIndex = 0;\n\n\twhile ( true ) {\n\n\t\tconst match = RePathPart.exec( path ),\n\t\t\tmatchEnd = RePathPart.lastIndex;\n\n\t\tlet id = match[ 1 ];\n\t\tconst idIsIndex = match[ 2 ] === ']',\n\t\t\tsubscript = match[ 3 ];\n\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\n\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\n\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n\t\t\taddUniform( container, subscript === undefined ?\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\n\n\t\t\tbreak;\n\n\t\t} else {\n\n\t\t\t// step into inner node / create it in case it doesn't exist\n\n\t\t\tconst map = container.map;\n\t\t\tlet next = map[ id ];\n\n\t\t\tif ( next === undefined ) {\n\n\t\t\t\tnext = new StructuredUniform( id );\n\t\t\t\taddUniform( container, next );\n\n\t\t\t}\n\n\t\t\tcontainer = next;\n\n\t\t}\n\n\t}\n\n}\n\n// Root Container\n\nclass WebGLUniforms {\n\n\tconstructor( gl, program ) {\n\n\t\tthis.seq = [];\n\t\tthis.map = {};\n\n\t\tconst n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );\n\n\t\tfor ( let i = 0; i < n; ++ i ) {\n\n\t\t\tconst info = gl.getActiveUniform( program, i ),\n\t\t\t\taddr = gl.getUniformLocation( program, info.name );\n\n\t\t\tparseUniform( info, addr, this );\n\n\t\t}\n\n\t}\n\n\tsetValue( gl, name, value, textures ) {\n\n\t\tconst u = this.map[ name ];\n\n\t\tif ( u !== undefined ) u.setValue( gl, value, textures );\n\n\t}\n\n\tsetOptional( gl, object, name ) {\n\n\t\tconst v = object[ name ];\n\n\t\tif ( v !== undefined ) this.setValue( gl, name, v );\n\n\t}\n\n\tstatic upload( gl, seq, values, textures ) {\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ],\n\t\t\t\tv = values[ u.id ];\n\n\t\t\tif ( v.needsUpdate !== false ) {\n\n\t\t\t\t// note: always updating when .needsUpdate is undefined\n\t\t\t\tu.setValue( gl, v.value, textures );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tstatic seqWithValue( seq, values ) {\n\n\t\tconst r = [];\n\n\t\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\t\tconst u = seq[ i ];\n\t\t\tif ( u.id in values ) r.push( u );\n\n\t\t}\n\n\t\treturn r;\n\n\t}\n\n}\n\nfunction WebGLShader( gl, type, string ) {\n\n\tconst shader = gl.createShader( type );\n\n\tgl.shaderSource( shader, string );\n\tgl.compileShader( shader );\n\n\treturn shader;\n\n}\n\n// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/\nconst COMPLETION_STATUS_KHR = 0x91B1;\n\nlet programIdCount = 0;\n\nfunction handleSource( string, errorLine ) {\n\n\tconst lines = string.split( '\\n' );\n\tconst lines2 = [];\n\n\tconst from = Math.max( errorLine - 6, 0 );\n\tconst to = Math.min( errorLine + 6, lines.length );\n\n\tfor ( let i = from; i < to; i ++ ) {\n\n\t\tconst line = i + 1;\n\t\tlines2.push( `${line === errorLine ? '>' : ' '} ${line}: ${lines[ i ]}` );\n\n\t}\n\n\treturn lines2.join( '\\n' );\n\n}\n\nfunction getEncodingComponents( colorSpace ) {\n\n\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\tconst encodingPrimaries = ColorManagement.getPrimaries( colorSpace );\n\n\tlet gamutMapping;\n\n\tif ( workingPrimaries === encodingPrimaries ) {\n\n\t\tgamutMapping = '';\n\n\t} else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {\n\n\t\tgamutMapping = 'LinearDisplayP3ToLinearSRGB';\n\n\t} else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {\n\n\t\tgamutMapping = 'LinearSRGBToLinearDisplayP3';\n\n\t}\n\n\tswitch ( colorSpace ) {\n\n\t\tcase LinearSRGBColorSpace:\n\t\tcase LinearDisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t\tcase SRGBColorSpace:\n\t\tcase DisplayP3ColorSpace:\n\t\t\treturn [ gamutMapping, 'sRGBTransferOETF' ];\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );\n\t\t\treturn [ gamutMapping, 'LinearTransferOETF' ];\n\n\t}\n\n}\n\nfunction getShaderErrors( gl, shader, type ) {\n\n\tconst status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );\n\tconst errors = gl.getShaderInfoLog( shader ).trim();\n\n\tif ( status && errors === '' ) return '';\n\n\tconst errorMatches = /ERROR: 0:(\\d+)/.exec( errors );\n\tif ( errorMatches ) {\n\n\t\t// --enable-privileged-webgl-extension\n\t\t// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n\t\tconst errorLine = parseInt( errorMatches[ 1 ] );\n\t\treturn type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + handleSource( gl.getShaderSource( shader ), errorLine );\n\n\t} else {\n\n\t\treturn errors;\n\n\t}\n\n}\n\nfunction getTexelEncodingFunction( functionName, colorSpace ) {\n\n\tconst components = getEncodingComponents( colorSpace );\n\treturn `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;\n\n}\n\nfunction getToneMappingFunction( functionName, toneMapping ) {\n\n\tlet toneMappingName;\n\n\tswitch ( toneMapping ) {\n\n\t\tcase LinearToneMapping:\n\t\t\ttoneMappingName = 'Linear';\n\t\t\tbreak;\n\n\t\tcase ReinhardToneMapping:\n\t\t\ttoneMappingName = 'Reinhard';\n\t\t\tbreak;\n\n\t\tcase CineonToneMapping:\n\t\t\ttoneMappingName = 'OptimizedCineon';\n\t\t\tbreak;\n\n\t\tcase ACESFilmicToneMapping:\n\t\t\ttoneMappingName = 'ACESFilmic';\n\t\t\tbreak;\n\n\t\tcase AgXToneMapping:\n\t\t\ttoneMappingName = 'AgX';\n\t\t\tbreak;\n\n\t\tcase CustomToneMapping:\n\t\t\ttoneMappingName = 'Custom';\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported toneMapping:', toneMapping );\n\t\t\ttoneMappingName = 'Linear';\n\n\t}\n\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n\n}\n\nfunction generateExtensions( parameters ) {\n\n\tconst chunks = [\n\t\t( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',\n\t\t( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',\n\t\t( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',\n\t\t( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateVertexExtensions( parameters ) {\n\n\tconst chunks = [\n\t\tparameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : ''\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateDefines( defines ) {\n\n\tconst chunks = [];\n\n\tfor ( const name in defines ) {\n\n\t\tconst value = defines[ name ];\n\n\t\tif ( value === false ) continue;\n\n\t\tchunks.push( '#define ' + name + ' ' + value );\n\n\t}\n\n\treturn chunks.join( '\\n' );\n\n}\n\nfunction fetchAttributeLocations( gl, program ) {\n\n\tconst attributes = {};\n\n\tconst n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );\n\n\tfor ( let i = 0; i < n; i ++ ) {\n\n\t\tconst info = gl.getActiveAttrib( program, i );\n\t\tconst name = info.name;\n\n\t\tlet locationSize = 1;\n\t\tif ( info.type === gl.FLOAT_MAT2 ) locationSize = 2;\n\t\tif ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;\n\t\tif ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;\n\n\t\t// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n\t\tattributes[ name ] = {\n\t\t\ttype: info.type,\n\t\t\tlocation: gl.getAttribLocation( program, name ),\n\t\t\tlocationSize: locationSize\n\t\t};\n\n\t}\n\n\treturn attributes;\n\n}\n\nfunction filterEmptyLine( string ) {\n\n\treturn string !== '';\n\n}\n\nfunction replaceLightNums( string, parameters ) {\n\n\tconst numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n\n\treturn string\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\n\t\t.replace( /NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords )\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\n\n}\n\nfunction replaceClippingPlaneNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\n\n}\n\n// Resolve Includes\n\nconst includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\n\nfunction resolveIncludes( string ) {\n\n\treturn string.replace( includePattern, includeReplacer );\n\n}\n\nconst shaderChunkMap = new Map( [\n\t[ 'encodings_fragment', 'colorspace_fragment' ], // @deprecated, r154\n\t[ 'encodings_pars_fragment', 'colorspace_pars_fragment' ], // @deprecated, r154\n\t[ 'output_fragment', 'opaque_fragment' ], // @deprecated, r154\n] );\n\nfunction includeReplacer( match, include ) {\n\n\tlet string = ShaderChunk[ include ];\n\n\tif ( string === undefined ) {\n\n\t\tconst newInclude = shaderChunkMap.get( include );\n\n\t\tif ( newInclude !== undefined ) {\n\n\t\t\tstring = ShaderChunk[ newInclude ];\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Shader chunk \"%s\" has been deprecated. Use \"%s\" instead.', include, newInclude );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\n\n\t\t}\n\n\t}\n\n\treturn resolveIncludes( string );\n\n}\n\n// Unroll Loops\n\nconst unrollLoopPattern = /#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;\n\nfunction unrollLoops( string ) {\n\n\treturn string.replace( unrollLoopPattern, loopReplacer );\n\n}\n\nfunction loopReplacer( match, start, end, snippet ) {\n\n\tlet string = '';\n\n\tfor ( let i = parseInt( start ); i < parseInt( end ); i ++ ) {\n\n\t\tstring += snippet\n\t\t\t.replace( /\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]' )\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\n\n\t}\n\n\treturn string;\n\n}\n\n//\n\nfunction generatePrecision( parameters ) {\n\n\tlet precisionstring = 'precision ' + parameters.precision + ' float;\\nprecision ' + parameters.precision + ' int;';\n\n\tif ( parameters.precision === 'highp' ) {\n\n\t\tprecisionstring += '\\n#define HIGH_PRECISION';\n\n\t} else if ( parameters.precision === 'mediump' ) {\n\n\t\tprecisionstring += '\\n#define MEDIUM_PRECISION';\n\n\t} else if ( parameters.precision === 'lowp' ) {\n\n\t\tprecisionstring += '\\n#define LOW_PRECISION';\n\n\t}\n\n\treturn precisionstring;\n\n}\n\nfunction generateShadowMapTypeDefine( parameters ) {\n\n\tlet shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\n\n\tif ( parameters.shadowMapType === PCFShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\n\n\t} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\n\n\t} else if ( parameters.shadowMapType === VSMShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\n\n\t}\n\n\treturn shadowMapTypeDefine;\n\n}\n\nfunction generateEnvMapTypeDefine( parameters ) {\n\n\tlet envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeReflectionMapping:\n\t\t\tcase CubeRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\t\t\t\tbreak;\n\n\t\t\tcase CubeUVReflectionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapTypeDefine;\n\n}\n\nfunction generateEnvMapModeDefine( parameters ) {\n\n\tlet envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeRefractionMapping:\n\n\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapModeDefine;\n\n}\n\nfunction generateEnvMapBlendingDefine( parameters ) {\n\n\tlet envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.combine ) {\n\n\t\t\tcase MultiplyOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\n\t\t\t\tbreak;\n\n\t\t\tcase MixOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\n\t\t\t\tbreak;\n\n\t\t\tcase AddOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapBlendingDefine;\n\n}\n\nfunction generateCubeUVSize( parameters ) {\n\n\tconst imageHeight = parameters.envMapCubeUVHeight;\n\n\tif ( imageHeight === null ) return null;\n\n\tconst maxMip = Math.log2( imageHeight ) - 2;\n\n\tconst texelHeight = 1.0 / imageHeight;\n\n\tconst texelWidth = 1.0 / ( 3 * Math.max( Math.pow( 2, maxMip ), 7 * 16 ) );\n\n\treturn { texelWidth, texelHeight, maxMip };\n\n}\n\nfunction WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {\n\n\t// TODO Send this event to Three.js DevTools\n\t// console.log( 'WebGLProgram', cacheKey );\n\n\tconst gl = renderer.getContext();\n\n\tconst defines = parameters.defines;\n\n\tlet vertexShader = parameters.vertexShader;\n\tlet fragmentShader = parameters.fragmentShader;\n\n\tconst shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\n\tconst envMapTypeDefine = generateEnvMapTypeDefine( parameters );\n\tconst envMapModeDefine = generateEnvMapModeDefine( parameters );\n\tconst envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\n\tconst envMapCubeUVSize = generateCubeUVSize( parameters );\n\n\tconst customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );\n\n\tconst customVertexExtensions = generateVertexExtensions( parameters );\n\n\tconst customDefines = generateDefines( defines );\n\n\tconst program = gl.createProgram();\n\n\tlet prefixVertex, prefixFragment;\n\tlet versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\n\n\tif ( parameters.isRawShaderMaterial ) {\n\n\t\tprefixVertex = [\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixVertex.length > 0 ) {\n\n\t\t\tprefixVertex += '\\n';\n\n\t\t}\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixFragment.length > 0 ) {\n\n\t\t\tprefixFragment += '\\n';\n\n\t\t}\n\n\t} else {\n\n\t\tprefixVertex = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',\n\t\t\tparameters.batching ? '#define USE_BATCHING' : '',\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\t//\n\n\t\t\tparameters.mapUv ? '#define MAP_UV ' + parameters.mapUv : '',\n\t\t\tparameters.alphaMapUv ? '#define ALPHAMAP_UV ' + parameters.alphaMapUv : '',\n\t\t\tparameters.lightMapUv ? '#define LIGHTMAP_UV ' + parameters.lightMapUv : '',\n\t\t\tparameters.aoMapUv ? '#define AOMAP_UV ' + parameters.aoMapUv : '',\n\t\t\tparameters.emissiveMapUv ? '#define EMISSIVEMAP_UV ' + parameters.emissiveMapUv : '',\n\t\t\tparameters.bumpMapUv ? '#define BUMPMAP_UV ' + parameters.bumpMapUv : '',\n\t\t\tparameters.normalMapUv ? '#define NORMALMAP_UV ' + parameters.normalMapUv : '',\n\t\t\tparameters.displacementMapUv ? '#define DISPLACEMENTMAP_UV ' + parameters.displacementMapUv : '',\n\n\t\t\tparameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '',\n\t\t\tparameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '',\n\n\t\t\tparameters.anisotropyMapUv ? '#define ANISOTROPYMAP_UV ' + parameters.anisotropyMapUv : '',\n\n\t\t\tparameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '',\n\t\t\tparameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '',\n\t\t\tparameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '',\n\n\t\t\tparameters.iridescenceMapUv ? '#define IRIDESCENCEMAP_UV ' + parameters.iridescenceMapUv : '',\n\t\t\tparameters.iridescenceThicknessMapUv ? '#define IRIDESCENCE_THICKNESSMAP_UV ' + parameters.iridescenceThicknessMapUv : '',\n\n\t\t\tparameters.sheenColorMapUv ? '#define SHEEN_COLORMAP_UV ' + parameters.sheenColorMapUv : '',\n\t\t\tparameters.sheenRoughnessMapUv ? '#define SHEEN_ROUGHNESSMAP_UV ' + parameters.sheenRoughnessMapUv : '',\n\n\t\t\tparameters.specularMapUv ? '#define SPECULARMAP_UV ' + parameters.specularMapUv : '',\n\t\t\tparameters.specularColorMapUv ? '#define SPECULAR_COLORMAP_UV ' + parameters.specularColorMapUv : '',\n\t\t\tparameters.specularIntensityMapUv ? '#define SPECULAR_INTENSITYMAP_UV ' + parameters.specularIntensityMapUv : '',\n\n\t\t\tparameters.transmissionMapUv ? '#define TRANSMISSIONMAP_UV ' + parameters.transmissionMapUv : '',\n\t\t\tparameters.thicknessMapUv ? '#define THICKNESSMAP_UV ' + parameters.thicknessMapUv : '',\n\n\t\t\t//\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\n\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\n\t\t\t( parameters.morphColors && parameters.isWebGL2 ) ? '#define USE_MORPHCOLORS' : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',\n\t\t\t( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 modelMatrix;',\n\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform mat3 normalMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t'#ifdef USE_INSTANCING',\n\n\t\t\t'\tattribute mat4 instanceMatrix;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_COLOR',\n\n\t\t\t'\tattribute vec3 instanceColor;',\n\n\t\t\t'#endif',\n\n\t\t\t'attribute vec3 position;',\n\t\t\t'attribute vec3 normal;',\n\t\t\t'attribute vec2 uv;',\n\n\t\t\t'#ifdef USE_UV1',\n\n\t\t\t'\tattribute vec2 uv1;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV2',\n\n\t\t\t'\tattribute vec2 uv2;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_UV3',\n\n\t\t\t'\tattribute vec2 uv3;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_TANGENT',\n\n\t\t\t'\tattribute vec4 tangent;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if defined( USE_COLOR_ALPHA )',\n\n\t\t\t'\tattribute vec4 color;',\n\n\t\t\t'#elif defined( USE_COLOR )',\n\n\t\t\t'\tattribute vec3 color;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )',\n\n\t\t\t'\tattribute vec3 morphTarget0;',\n\t\t\t'\tattribute vec3 morphTarget1;',\n\t\t\t'\tattribute vec3 morphTarget2;',\n\t\t\t'\tattribute vec3 morphTarget3;',\n\n\t\t\t'\t#ifdef USE_MORPHNORMALS',\n\n\t\t\t'\t\tattribute vec3 morphNormal0;',\n\t\t\t'\t\tattribute vec3 morphNormal1;',\n\t\t\t'\t\tattribute vec3 morphNormal2;',\n\t\t\t'\t\tattribute vec3 morphNormal3;',\n\n\t\t\t'\t#else',\n\n\t\t\t'\t\tattribute vec3 morphTarget4;',\n\t\t\t'\t\tattribute vec3 morphTarget5;',\n\t\t\t'\t\tattribute vec3 morphTarget6;',\n\t\t\t'\t\tattribute vec3 morphTarget7;',\n\n\t\t\t'\t#endif',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_SKINNING',\n\n\t\t\t'\tattribute vec4 skinIndex;',\n\t\t\t'\tattribute vec4 skinWeight;',\n\n\t\t\t'#endif',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_TYPE ' + parameters.shaderType,\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.useFog && parameters.fog ? '#define USE_FOG' : '',\n\t\t\tparameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '',\n\t\t\tenvMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\tparameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',\n\t\t\tparameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\n\t\t\tparameters.anisotropy ? '#define USE_ANISOTROPY' : '',\n\t\t\tparameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',\n\n\t\t\tparameters.clearcoat ? '#define USE_CLEARCOAT' : '',\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.iridescence ? '#define USE_IRIDESCENCE' : '',\n\t\t\tparameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',\n\t\t\tparameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaTest ? '#define USE_ALPHATEST' : '',\n\t\t\tparameters.alphaHash ? '#define USE_ALPHAHASH' : '',\n\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.vertexTangents && parameters.flatShading === false ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUv1s ? '#define USE_UV1' : '',\n\t\t\tparameters.vertexUv2s ? '#define USE_UV2' : '',\n\t\t\tparameters.vertexUv3s ? '#define USE_UV3' : '',\n\n\t\t\tparameters.pointsUvs ? '#define USE_POINTS_UV' : '',\n\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\n\n\t\t\tparameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',\n\n\t\t\tparameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',\n\n\t\t\tparameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\n\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\n\t\t\tparameters.opaque ? '#define OPAQUE' : '',\n\n\t\t\tShaderChunk[ 'colorspace_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below\n\t\t\tgetTexelEncodingFunction( 'linearToOutputTexel', parameters.outputColorSpace ),\n\n\t\t\tparameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t}\n\n\tvertexShader = resolveIncludes( vertexShader );\n\tvertexShader = replaceLightNums( vertexShader, parameters );\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\n\n\tfragmentShader = resolveIncludes( fragmentShader );\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\n\n\tvertexShader = unrollLoops( vertexShader );\n\tfragmentShader = unrollLoops( fragmentShader );\n\n\tif ( parameters.isWebGL2 && parameters.isRawShaderMaterial !== true ) {\n\n\t\t// GLSL 3.0 conversion for built-in materials and ShaderMaterial\n\n\t\tversionString = '#version 300 es\\n';\n\n\t\tprefixVertex = [\n\t\t\tcustomVertexExtensions,\n\t\t\t'precision mediump sampler2DArray;',\n\t\t\t'#define attribute in',\n\t\t\t'#define varying out',\n\t\t\t'#define texture2D texture'\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\n\n\t\tprefixFragment = [\n\t\t\t'precision mediump sampler2DArray;',\n\t\t\t'#define varying in',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\n\t\t\t'#define texture2D texture',\n\t\t\t'#define textureCube texture',\n\t\t\t'#define texture2DProj textureProj',\n\t\t\t'#define texture2DLodEXT textureLod',\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\n\t\t\t'#define textureCubeLodEXT textureLod',\n\t\t\t'#define texture2DGradEXT textureGrad',\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\n\t\t\t'#define textureCubeGradEXT textureGrad'\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\n\n\t}\n\n\tconst vertexGlsl = versionString + prefixVertex + vertexShader;\n\tconst fragmentGlsl = versionString + prefixFragment + fragmentShader;\n\n\t// console.log( '*VERTEX*', vertexGlsl );\n\t// console.log( '*FRAGMENT*', fragmentGlsl );\n\n\tconst glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );\n\tconst glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );\n\n\tgl.attachShader( program, glVertexShader );\n\tgl.attachShader( program, glFragmentShader );\n\n\t// Force a particular attribute to index 0.\n\n\tif ( parameters.index0AttributeName !== undefined ) {\n\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\n\n\t} else if ( parameters.morphTargets === true ) {\n\n\t\t// programs with morphTargets displace position out of attribute 0\n\t\tgl.bindAttribLocation( program, 0, 'position' );\n\n\t}\n\n\tgl.linkProgram( program );\n\n\tfunction onFirstUse( self ) {\n\n\t\t// check for link errors\n\t\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\n\t\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\t\tlet runnable = true;\n\t\t\tlet haveDiagnostics = true;\n\n\t\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\n\n\t\t\t\trunnable = false;\n\n\t\t\t\tif ( typeof renderer.debug.onShaderError === 'function' ) {\n\n\t\t\t\t\trenderer.debug.onShaderError( gl, program, glVertexShader, glFragmentShader );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// default error reporting\n\n\t\t\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\\n\\n' +\n\t\t\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\t\t\tfragmentErrors\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t} else if ( programLog !== '' ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\n\n\t\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\t\thaveDiagnostics = false;\n\n\t\t\t}\n\n\t\t\tif ( haveDiagnostics ) {\n\n\t\t\t\tself.diagnostics = {\n\n\t\t\t\t\trunnable: runnable,\n\n\t\t\t\t\tprogramLog: programLog,\n\n\t\t\t\t\tvertexShader: {\n\n\t\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t\t},\n\n\t\t\t\t\tfragmentShader: {\n\n\t\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\t\tprefix: prefixFragment\n\n\t\t\t\t\t}\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Clean up\n\n\t\t// Crashes in iOS9 and iOS10. #18402\n\t\t// gl.detachShader( program, glVertexShader );\n\t\t// gl.detachShader( program, glFragmentShader );\n\n\t\tgl.deleteShader( glVertexShader );\n\t\tgl.deleteShader( glFragmentShader );\n\n\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t}\n\n\t// set up caching for uniform locations\n\n\tlet cachedUniforms;\n\n\tthis.getUniforms = function () {\n\n\t\tif ( cachedUniforms === undefined ) {\n\n\t\t\t// Populates cachedUniforms and cachedAttributes\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedUniforms;\n\n\t};\n\n\t// set up caching for attribute locations\n\n\tlet cachedAttributes;\n\n\tthis.getAttributes = function () {\n\n\t\tif ( cachedAttributes === undefined ) {\n\n\t\t\t// Populates cachedAttributes and cachedUniforms\n\t\t\tonFirstUse( this );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,\n\t// flag the program as ready immediately. It may cause a stall when it's first used.\n\n\tlet programReady = ( parameters.rendererExtensionParallelShaderCompile === false );\n\n\tthis.isReady = function () {\n\n\t\tif ( programReady === false ) {\n\n\t\t\tprogramReady = gl.getProgramParameter( program, COMPLETION_STATUS_KHR );\n\n\t\t}\n\n\t\treturn programReady;\n\n\t};\n\n\t// free resource\n\n\tthis.destroy = function () {\n\n\t\tbindingStates.releaseStatesOfProgram( this );\n\n\t\tgl.deleteProgram( program );\n\t\tthis.program = undefined;\n\n\t};\n\n\t//\n\n\tthis.type = parameters.shaderType;\n\tthis.name = parameters.shaderName;\n\tthis.id = programIdCount ++;\n\tthis.cacheKey = cacheKey;\n\tthis.usedTimes = 1;\n\tthis.program = program;\n\tthis.vertexShader = glVertexShader;\n\tthis.fragmentShader = glFragmentShader;\n\n\treturn this;\n\n}\n\nlet _id$1 = 0;\n\nclass WebGLShaderCache {\n\n\tconstructor() {\n\n\t\tthis.shaderCache = new Map();\n\t\tthis.materialCache = new Map();\n\n\t}\n\n\tupdate( material ) {\n\n\t\tconst vertexShader = material.vertexShader;\n\t\tconst fragmentShader = material.fragmentShader;\n\n\t\tconst vertexShaderStage = this._getShaderStage( vertexShader );\n\t\tconst fragmentShaderStage = this._getShaderStage( fragmentShader );\n\n\t\tconst materialShaders = this._getShaderCacheForMaterial( material );\n\n\t\tif ( materialShaders.has( vertexShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( vertexShaderStage );\n\t\t\tvertexShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\tif ( materialShaders.has( fragmentShaderStage ) === false ) {\n\n\t\t\tmaterialShaders.add( fragmentShaderStage );\n\t\t\tfragmentShaderStage.usedTimes ++;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( material ) {\n\n\t\tconst materialShaders = this.materialCache.get( material );\n\n\t\tfor ( const shaderStage of materialShaders ) {\n\n\t\t\tshaderStage.usedTimes --;\n\n\t\t\tif ( shaderStage.usedTimes === 0 ) this.shaderCache.delete( shaderStage.code );\n\n\t\t}\n\n\t\tthis.materialCache.delete( material );\n\n\t\treturn this;\n\n\t}\n\n\tgetVertexShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.vertexShader ).id;\n\n\t}\n\n\tgetFragmentShaderID( material ) {\n\n\t\treturn this._getShaderStage( material.fragmentShader ).id;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shaderCache.clear();\n\t\tthis.materialCache.clear();\n\n\t}\n\n\t_getShaderCacheForMaterial( material ) {\n\n\t\tconst cache = this.materialCache;\n\t\tlet set = cache.get( material );\n\n\t\tif ( set === undefined ) {\n\n\t\t\tset = new Set();\n\t\t\tcache.set( material, set );\n\n\t\t}\n\n\t\treturn set;\n\n\t}\n\n\t_getShaderStage( code ) {\n\n\t\tconst cache = this.shaderCache;\n\t\tlet stage = cache.get( code );\n\n\t\tif ( stage === undefined ) {\n\n\t\t\tstage = new WebGLShaderStage( code );\n\t\t\tcache.set( code, stage );\n\n\t\t}\n\n\t\treturn stage;\n\n\t}\n\n}\n\nclass WebGLShaderStage {\n\n\tconstructor( code ) {\n\n\t\tthis.id = _id$1 ++;\n\n\t\tthis.code = code;\n\t\tthis.usedTimes = 0;\n\n\t}\n\n}\n\nfunction WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {\n\n\tconst _programLayers = new Layers();\n\tconst _customShaders = new WebGLShaderCache();\n\tconst programs = [];\n\n\tconst IS_WEBGL2 = capabilities.isWebGL2;\n\tconst logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n\tconst SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\n\n\tlet precision = capabilities.precision;\n\n\tconst shaderIDs = {\n\t\tMeshDepthMaterial: 'depth',\n\t\tMeshDistanceMaterial: 'distanceRGBA',\n\t\tMeshNormalMaterial: 'normal',\n\t\tMeshBasicMaterial: 'basic',\n\t\tMeshLambertMaterial: 'lambert',\n\t\tMeshPhongMaterial: 'phong',\n\t\tMeshToonMaterial: 'toon',\n\t\tMeshStandardMaterial: 'physical',\n\t\tMeshPhysicalMaterial: 'physical',\n\t\tMeshMatcapMaterial: 'matcap',\n\t\tLineBasicMaterial: 'basic',\n\t\tLineDashedMaterial: 'dashed',\n\t\tPointsMaterial: 'points',\n\t\tShadowMaterial: 'shadow',\n\t\tSpriteMaterial: 'sprite'\n\t};\n\n\tfunction getChannel( value ) {\n\n\t\tif ( value === 0 ) return 'uv';\n\n\t\treturn `uv${ value }`;\n\n\t}\n\n\tfunction getParameters( material, lights, shadows, scene, object ) {\n\n\t\tconst fog = scene.fog;\n\t\tconst geometry = object.geometry;\n\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\n\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\tconst envMapCubeUVHeight = ( !! envMap ) && ( envMap.mapping === CubeUVReflectionMapping ) ? envMap.image.height : null;\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\n\t\t// heuristics to create shader parameters according to lights in the scene\n\t\t// (not to blow over maxLights budget)\n\n\t\tif ( material.precision !== null ) {\n\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\n\n\t\t\tif ( precision !== material.precision ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\tlet morphTextureStride = 0;\n\n\t\tif ( geometry.morphAttributes.position !== undefined ) morphTextureStride = 1;\n\t\tif ( geometry.morphAttributes.normal !== undefined ) morphTextureStride = 2;\n\t\tif ( geometry.morphAttributes.color !== undefined ) morphTextureStride = 3;\n\n\t\t//\n\n\t\tlet vertexShader, fragmentShader;\n\t\tlet customVertexShaderID, customFragmentShaderID;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\n\t\t\tvertexShader = shader.vertexShader;\n\t\t\tfragmentShader = shader.fragmentShader;\n\n\t\t} else {\n\n\t\t\tvertexShader = material.vertexShader;\n\t\t\tfragmentShader = material.fragmentShader;\n\n\t\t\t_customShaders.update( material );\n\n\t\t\tcustomVertexShaderID = _customShaders.getVertexShaderID( material );\n\t\t\tcustomFragmentShaderID = _customShaders.getFragmentShaderID( material );\n\n\t\t}\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tconst IS_INSTANCEDMESH = object.isInstancedMesh === true;\n\t\tconst IS_BATCHEDMESH = object.isBatchedMesh === true;\n\n\t\tconst HAS_MAP = !! material.map;\n\t\tconst HAS_MATCAP = !! material.matcap;\n\t\tconst HAS_ENVMAP = !! envMap;\n\t\tconst HAS_AOMAP = !! material.aoMap;\n\t\tconst HAS_LIGHTMAP = !! material.lightMap;\n\t\tconst HAS_BUMPMAP = !! material.bumpMap;\n\t\tconst HAS_NORMALMAP = !! material.normalMap;\n\t\tconst HAS_DISPLACEMENTMAP = !! material.displacementMap;\n\t\tconst HAS_EMISSIVEMAP = !! material.emissiveMap;\n\n\t\tconst HAS_METALNESSMAP = !! material.metalnessMap;\n\t\tconst HAS_ROUGHNESSMAP = !! material.roughnessMap;\n\n\t\tconst HAS_ANISOTROPY = material.anisotropy > 0;\n\t\tconst HAS_CLEARCOAT = material.clearcoat > 0;\n\t\tconst HAS_IRIDESCENCE = material.iridescence > 0;\n\t\tconst HAS_SHEEN = material.sheen > 0;\n\t\tconst HAS_TRANSMISSION = material.transmission > 0;\n\n\t\tconst HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !! material.anisotropyMap;\n\n\t\tconst HAS_CLEARCOATMAP = HAS_CLEARCOAT && !! material.clearcoatMap;\n\t\tconst HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !! material.clearcoatNormalMap;\n\t\tconst HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !! material.clearcoatRoughnessMap;\n\n\t\tconst HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !! material.iridescenceMap;\n\t\tconst HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !! material.iridescenceThicknessMap;\n\n\t\tconst HAS_SHEEN_COLORMAP = HAS_SHEEN && !! material.sheenColorMap;\n\t\tconst HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !! material.sheenRoughnessMap;\n\n\t\tconst HAS_SPECULARMAP = !! material.specularMap;\n\t\tconst HAS_SPECULAR_COLORMAP = !! material.specularColorMap;\n\t\tconst HAS_SPECULAR_INTENSITYMAP = !! material.specularIntensityMap;\n\n\t\tconst HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !! material.transmissionMap;\n\t\tconst HAS_THICKNESSMAP = HAS_TRANSMISSION && !! material.thicknessMap;\n\n\t\tconst HAS_GRADIENTMAP = !! material.gradientMap;\n\n\t\tconst HAS_ALPHAMAP = !! material.alphaMap;\n\n\t\tconst HAS_ALPHATEST = material.alphaTest > 0;\n\n\t\tconst HAS_ALPHAHASH = !! material.alphaHash;\n\n\t\tconst HAS_EXTENSIONS = !! material.extensions;\n\n\t\tconst HAS_ATTRIBUTE_UV1 = !! geometry.attributes.uv1;\n\t\tconst HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;\n\t\tconst HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;\n\n\t\tlet toneMapping = NoToneMapping;\n\n\t\tif ( material.toneMapped ) {\n\n\t\t\tif ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\ttoneMapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst parameters = {\n\n\t\t\tisWebGL2: IS_WEBGL2,\n\n\t\t\tshaderID: shaderID,\n\t\t\tshaderType: material.type,\n\t\t\tshaderName: material.name,\n\n\t\t\tvertexShader: vertexShader,\n\t\t\tfragmentShader: fragmentShader,\n\t\t\tdefines: material.defines,\n\n\t\t\tcustomVertexShaderID: customVertexShaderID,\n\t\t\tcustomFragmentShaderID: customFragmentShaderID,\n\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial === true,\n\t\t\tglslVersion: material.glslVersion,\n\n\t\t\tprecision: precision,\n\n\t\t\tbatching: IS_BATCHEDMESH,\n\t\t\tinstancing: IS_INSTANCEDMESH,\n\t\t\tinstancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n\n\t\t\tsupportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\n\t\t\toutputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),\n\n\t\t\tmap: HAS_MAP,\n\t\t\tmatcap: HAS_MATCAP,\n\t\t\tenvMap: HAS_ENVMAP,\n\t\t\tenvMapMode: HAS_ENVMAP && envMap.mapping,\n\t\t\tenvMapCubeUVHeight: envMapCubeUVHeight,\n\t\t\taoMap: HAS_AOMAP,\n\t\t\tlightMap: HAS_LIGHTMAP,\n\t\t\tbumpMap: HAS_BUMPMAP,\n\t\t\tnormalMap: HAS_NORMALMAP,\n\t\t\tdisplacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\n\t\t\temissiveMap: HAS_EMISSIVEMAP,\n\n\t\t\tnormalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,\n\t\t\tnormalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,\n\n\t\t\tmetalnessMap: HAS_METALNESSMAP,\n\t\t\troughnessMap: HAS_ROUGHNESSMAP,\n\n\t\t\tanisotropy: HAS_ANISOTROPY,\n\t\t\tanisotropyMap: HAS_ANISOTROPYMAP,\n\n\t\t\tclearcoat: HAS_CLEARCOAT,\n\t\t\tclearcoatMap: HAS_CLEARCOATMAP,\n\t\t\tclearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n\t\t\tclearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n\n\t\t\tiridescence: HAS_IRIDESCENCE,\n\t\t\tiridescenceMap: HAS_IRIDESCENCEMAP,\n\t\t\tiridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n\n\t\t\tsheen: HAS_SHEEN,\n\t\t\tsheenColorMap: HAS_SHEEN_COLORMAP,\n\t\t\tsheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n\n\t\t\tspecularMap: HAS_SPECULARMAP,\n\t\t\tspecularColorMap: HAS_SPECULAR_COLORMAP,\n\t\t\tspecularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n\n\t\t\ttransmission: HAS_TRANSMISSION,\n\t\t\ttransmissionMap: HAS_TRANSMISSIONMAP,\n\t\t\tthicknessMap: HAS_THICKNESSMAP,\n\n\t\t\tgradientMap: HAS_GRADIENTMAP,\n\n\t\t\topaque: material.transparent === false && material.blending === NormalBlending,\n\n\t\t\talphaMap: HAS_ALPHAMAP,\n\t\t\talphaTest: HAS_ALPHATEST,\n\t\t\talphaHash: HAS_ALPHAHASH,\n\n\t\t\tcombine: material.combine,\n\n\t\t\t//\n\n\t\t\tmapUv: HAS_MAP && getChannel( material.map.channel ),\n\t\t\taoMapUv: HAS_AOMAP && getChannel( material.aoMap.channel ),\n\t\t\tlightMapUv: HAS_LIGHTMAP && getChannel( material.lightMap.channel ),\n\t\t\tbumpMapUv: HAS_BUMPMAP && getChannel( material.bumpMap.channel ),\n\t\t\tnormalMapUv: HAS_NORMALMAP && getChannel( material.normalMap.channel ),\n\t\t\tdisplacementMapUv: HAS_DISPLACEMENTMAP && getChannel( material.displacementMap.channel ),\n\t\t\temissiveMapUv: HAS_EMISSIVEMAP && getChannel( material.emissiveMap.channel ),\n\n\t\t\tmetalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),\n\t\t\troughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),\n\n\t\t\tanisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),\n\n\t\t\tclearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),\n\t\t\tclearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),\n\t\t\tclearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),\n\n\t\t\tiridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel( material.iridescenceMap.channel ),\n\t\t\tiridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel( material.iridescenceThicknessMap.channel ),\n\n\t\t\tsheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel( material.sheenColorMap.channel ),\n\t\t\tsheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel( material.sheenRoughnessMap.channel ),\n\n\t\t\tspecularMapUv: HAS_SPECULARMAP && getChannel( material.specularMap.channel ),\n\t\t\tspecularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel( material.specularColorMap.channel ),\n\t\t\tspecularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel( material.specularIntensityMap.channel ),\n\n\t\t\ttransmissionMapUv: HAS_TRANSMISSIONMAP && getChannel( material.transmissionMap.channel ),\n\t\t\tthicknessMapUv: HAS_THICKNESSMAP && getChannel( material.thicknessMap.channel ),\n\n\t\t\talphaMapUv: HAS_ALPHAMAP && getChannel( material.alphaMap.channel ),\n\n\t\t\t//\n\n\t\t\tvertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),\n\t\t\tvertexColors: material.vertexColors,\n\t\t\tvertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n\t\t\tvertexUv1s: HAS_ATTRIBUTE_UV1,\n\t\t\tvertexUv2s: HAS_ATTRIBUTE_UV2,\n\t\t\tvertexUv3s: HAS_ATTRIBUTE_UV3,\n\n\t\t\tpointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),\n\n\t\t\tfog: !! fog,\n\t\t\tuseFog: material.fog === true,\n\t\t\tfogExp2: ( fog && fog.isFogExp2 ),\n\n\t\t\tflatShading: material.flatShading === true,\n\n\t\t\tsizeAttenuation: material.sizeAttenuation === true,\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\t\tskinning: object.isSkinnedMesh === true,\n\n\t\t\tmorphTargets: geometry.morphAttributes.position !== undefined,\n\t\t\tmorphNormals: geometry.morphAttributes.normal !== undefined,\n\t\t\tmorphColors: geometry.morphAttributes.color !== undefined,\n\t\t\tmorphTargetsCount: morphTargetsCount,\n\t\t\tmorphTextureStride: morphTextureStride,\n\n\t\t\tnumDirLights: lights.directional.length,\n\t\t\tnumPointLights: lights.point.length,\n\t\t\tnumSpotLights: lights.spot.length,\n\t\t\tnumSpotLightMaps: lights.spotLightMap.length,\n\t\t\tnumRectAreaLights: lights.rectArea.length,\n\t\t\tnumHemiLights: lights.hemi.length,\n\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\n\t\t\tnumSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n\n\t\t\tnumLightProbes: lights.numLightProbes,\n\n\t\t\tnumClippingPlanes: clipping.numPlanes,\n\t\t\tnumClipIntersection: clipping.numIntersection,\n\n\t\t\tdithering: material.dithering,\n\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n\t\t\tshadowMapType: renderer.shadowMap.type,\n\n\t\t\ttoneMapping: toneMapping,\n\t\t\tuseLegacyLights: renderer._useLegacyLights,\n\n\t\t\tdecodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),\n\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\n\n\t\t\tdoubleSided: material.side === DoubleSide,\n\t\t\tflipSided: material.side === BackSide,\n\n\t\t\tuseDepthPacking: material.depthPacking >= 0,\n\t\t\tdepthPacking: material.depthPacking || 0,\n\n\t\t\tindex0AttributeName: material.index0AttributeName,\n\n\t\t\textensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,\n\t\t\textensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,\n\t\t\textensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,\n\t\t\textensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,\n\t\t\textensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance && extensions.has( 'WEBGL_clip_cull_distance' ),\n\n\t\t\trendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),\n\t\t\trendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),\n\t\t\trendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),\n\t\t\trendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\treturn parameters;\n\n\t}\n\n\tfunction getProgramCacheKey( parameters ) {\n\n\t\tconst array = [];\n\n\t\tif ( parameters.shaderID ) {\n\n\t\t\tarray.push( parameters.shaderID );\n\n\t\t} else {\n\n\t\t\tarray.push( parameters.customVertexShaderID );\n\t\t\tarray.push( parameters.customFragmentShaderID );\n\n\t\t}\n\n\t\tif ( parameters.defines !== undefined ) {\n\n\t\t\tfor ( const name in parameters.defines ) {\n\n\t\t\t\tarray.push( name );\n\t\t\t\tarray.push( parameters.defines[ name ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parameters.isRawShaderMaterial === false ) {\n\n\t\t\tgetProgramCacheKeyParameters( array, parameters );\n\t\t\tgetProgramCacheKeyBooleans( array, parameters );\n\t\t\tarray.push( renderer.outputColorSpace );\n\n\t\t}\n\n\t\tarray.push( parameters.customProgramCacheKey );\n\n\t\treturn array.join();\n\n\t}\n\n\tfunction getProgramCacheKeyParameters( array, parameters ) {\n\n\t\tarray.push( parameters.precision );\n\t\tarray.push( parameters.outputColorSpace );\n\t\tarray.push( parameters.envMapMode );\n\t\tarray.push( parameters.envMapCubeUVHeight );\n\t\tarray.push( parameters.mapUv );\n\t\tarray.push( parameters.alphaMapUv );\n\t\tarray.push( parameters.lightMapUv );\n\t\tarray.push( parameters.aoMapUv );\n\t\tarray.push( parameters.bumpMapUv );\n\t\tarray.push( parameters.normalMapUv );\n\t\tarray.push( parameters.displacementMapUv );\n\t\tarray.push( parameters.emissiveMapUv );\n\t\tarray.push( parameters.metalnessMapUv );\n\t\tarray.push( parameters.roughnessMapUv );\n\t\tarray.push( parameters.anisotropyMapUv );\n\t\tarray.push( parameters.clearcoatMapUv );\n\t\tarray.push( parameters.clearcoatNormalMapUv );\n\t\tarray.push( parameters.clearcoatRoughnessMapUv );\n\t\tarray.push( parameters.iridescenceMapUv );\n\t\tarray.push( parameters.iridescenceThicknessMapUv );\n\t\tarray.push( parameters.sheenColorMapUv );\n\t\tarray.push( parameters.sheenRoughnessMapUv );\n\t\tarray.push( parameters.specularMapUv );\n\t\tarray.push( parameters.specularColorMapUv );\n\t\tarray.push( parameters.specularIntensityMapUv );\n\t\tarray.push( parameters.transmissionMapUv );\n\t\tarray.push( parameters.thicknessMapUv );\n\t\tarray.push( parameters.combine );\n\t\tarray.push( parameters.fogExp2 );\n\t\tarray.push( parameters.sizeAttenuation );\n\t\tarray.push( parameters.morphTargetsCount );\n\t\tarray.push( parameters.morphAttributeCount );\n\t\tarray.push( parameters.numDirLights );\n\t\tarray.push( parameters.numPointLights );\n\t\tarray.push( parameters.numSpotLights );\n\t\tarray.push( parameters.numSpotLightMaps );\n\t\tarray.push( parameters.numHemiLights );\n\t\tarray.push( parameters.numRectAreaLights );\n\t\tarray.push( parameters.numDirLightShadows );\n\t\tarray.push( parameters.numPointLightShadows );\n\t\tarray.push( parameters.numSpotLightShadows );\n\t\tarray.push( parameters.numSpotLightShadowsWithMaps );\n\t\tarray.push( parameters.numLightProbes );\n\t\tarray.push( parameters.shadowMapType );\n\t\tarray.push( parameters.toneMapping );\n\t\tarray.push( parameters.numClippingPlanes );\n\t\tarray.push( parameters.numClipIntersection );\n\t\tarray.push( parameters.depthPacking );\n\n\t}\n\n\tfunction getProgramCacheKeyBooleans( array, parameters ) {\n\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.isWebGL2 )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.supportsVertexTextures )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.instancing )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.instancingColor )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.matcap )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.envMap )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.normalMapObjectSpace )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.normalMapTangentSpace )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.clearcoat )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.iridescence )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.alphaTest )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.vertexColors )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.vertexAlphas )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.vertexUv1s )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.vertexUv2s )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.vertexUv3s )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.vertexTangents )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.anisotropy )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.alphaHash )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.batching )\n\t\t\t_programLayers.enable( 19 );\n\n\t\tarray.push( _programLayers.mask );\n\t\t_programLayers.disableAll();\n\n\t\tif ( parameters.fog )\n\t\t\t_programLayers.enable( 0 );\n\t\tif ( parameters.useFog )\n\t\t\t_programLayers.enable( 1 );\n\t\tif ( parameters.flatShading )\n\t\t\t_programLayers.enable( 2 );\n\t\tif ( parameters.logarithmicDepthBuffer )\n\t\t\t_programLayers.enable( 3 );\n\t\tif ( parameters.skinning )\n\t\t\t_programLayers.enable( 4 );\n\t\tif ( parameters.morphTargets )\n\t\t\t_programLayers.enable( 5 );\n\t\tif ( parameters.morphNormals )\n\t\t\t_programLayers.enable( 6 );\n\t\tif ( parameters.morphColors )\n\t\t\t_programLayers.enable( 7 );\n\t\tif ( parameters.premultipliedAlpha )\n\t\t\t_programLayers.enable( 8 );\n\t\tif ( parameters.shadowMapEnabled )\n\t\t\t_programLayers.enable( 9 );\n\t\tif ( parameters.useLegacyLights )\n\t\t\t_programLayers.enable( 10 );\n\t\tif ( parameters.doubleSided )\n\t\t\t_programLayers.enable( 11 );\n\t\tif ( parameters.flipSided )\n\t\t\t_programLayers.enable( 12 );\n\t\tif ( parameters.useDepthPacking )\n\t\t\t_programLayers.enable( 13 );\n\t\tif ( parameters.dithering )\n\t\t\t_programLayers.enable( 14 );\n\t\tif ( parameters.transmission )\n\t\t\t_programLayers.enable( 15 );\n\t\tif ( parameters.sheen )\n\t\t\t_programLayers.enable( 16 );\n\t\tif ( parameters.opaque )\n\t\t\t_programLayers.enable( 17 );\n\t\tif ( parameters.pointsUvs )\n\t\t\t_programLayers.enable( 18 );\n\t\tif ( parameters.decodeVideoTexture )\n\t\t\t_programLayers.enable( 19 );\n\n\t\tarray.push( _programLayers.mask );\n\n\t}\n\n\tfunction getUniforms( material ) {\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\t\tlet uniforms;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\t\t\tuniforms = UniformsUtils.clone( shader.uniforms );\n\n\t\t} else {\n\n\t\t\tuniforms = material.uniforms;\n\n\t\t}\n\n\t\treturn uniforms;\n\n\t}\n\n\tfunction acquireProgram( parameters, cacheKey ) {\n\n\t\tlet program;\n\n\t\t// Check if code has been already compiled\n\t\tfor ( let p = 0, pl = programs.length; p < pl; p ++ ) {\n\n\t\t\tconst preexistingProgram = programs[ p ];\n\n\t\t\tif ( preexistingProgram.cacheKey === cacheKey ) {\n\n\t\t\t\tprogram = preexistingProgram;\n\t\t\t\t++ program.usedTimes;\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( program === undefined ) {\n\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );\n\t\t\tprograms.push( program );\n\n\t\t}\n\n\t\treturn program;\n\n\t}\n\n\tfunction releaseProgram( program ) {\n\n\t\tif ( -- program.usedTimes === 0 ) {\n\n\t\t\t// Remove from unordered set\n\t\t\tconst i = programs.indexOf( program );\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\n\t\t\tprograms.pop();\n\n\t\t\t// Free WebGL resources\n\t\t\tprogram.destroy();\n\n\t\t}\n\n\t}\n\n\tfunction releaseShaderCache( material ) {\n\n\t\t_customShaders.remove( material );\n\n\t}\n\n\tfunction dispose() {\n\n\t\t_customShaders.dispose();\n\n\t}\n\n\treturn {\n\t\tgetParameters: getParameters,\n\t\tgetProgramCacheKey: getProgramCacheKey,\n\t\tgetUniforms: getUniforms,\n\t\tacquireProgram: acquireProgram,\n\t\treleaseProgram: releaseProgram,\n\t\treleaseShaderCache: releaseShaderCache,\n\t\t// Exposed for resource monitoring & error feedback via renderer.info:\n\t\tprograms: programs,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLProperties() {\n\n\tlet properties = new WeakMap();\n\n\tfunction get( object ) {\n\n\t\tlet map = properties.get( object );\n\n\t\tif ( map === undefined ) {\n\n\t\t\tmap = {};\n\t\t\tproperties.set( object, map );\n\n\t\t}\n\n\t\treturn map;\n\n\t}\n\n\tfunction remove( object ) {\n\n\t\tproperties.delete( object );\n\n\t}\n\n\tfunction update( object, key, value ) {\n\n\t\tproperties.get( object )[ key ] = value;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tproperties = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction painterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.material.id !== b.material.id ) {\n\n\t\treturn a.material.id - b.material.id;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn a.z - b.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\nfunction reversePainterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn b.z - a.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\n\nfunction WebGLRenderList() {\n\n\tconst renderItems = [];\n\tlet renderItemsIndex = 0;\n\n\tconst opaque = [];\n\tconst transmissive = [];\n\tconst transparent = [];\n\n\tfunction init() {\n\n\t\trenderItemsIndex = 0;\n\n\t\topaque.length = 0;\n\t\ttransmissive.length = 0;\n\t\ttransparent.length = 0;\n\n\t}\n\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\n\n\t\tlet renderItem = renderItems[ renderItemsIndex ];\n\n\t\tif ( renderItem === undefined ) {\n\n\t\t\trenderItem = {\n\t\t\t\tid: object.id,\n\t\t\t\tobject: object,\n\t\t\t\tgeometry: geometry,\n\t\t\t\tmaterial: material,\n\t\t\t\tgroupOrder: groupOrder,\n\t\t\t\trenderOrder: object.renderOrder,\n\t\t\t\tz: z,\n\t\t\t\tgroup: group\n\t\t\t};\n\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\n\n\t\t} else {\n\n\t\t\trenderItem.id = object.id;\n\t\t\trenderItem.object = object;\n\t\t\trenderItem.geometry = geometry;\n\t\t\trenderItem.material = material;\n\t\t\trenderItem.groupOrder = groupOrder;\n\t\t\trenderItem.renderOrder = object.renderOrder;\n\t\t\trenderItem.z = z;\n\t\t\trenderItem.group = group;\n\n\t\t}\n\n\t\trenderItemsIndex ++;\n\n\t\treturn renderItem;\n\n\t}\n\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.push( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.push( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.push( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.unshift( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.unshift( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.unshift( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\n\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\n\t\tif ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\n\n\t}\n\n\tfunction finish() {\n\n\t\t// Clear references from inactive renderItems in the list\n\n\t\tfor ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) {\n\n\t\t\tconst renderItem = renderItems[ i ];\n\n\t\t\tif ( renderItem.id === null ) break;\n\n\t\t\trenderItem.id = null;\n\t\t\trenderItem.object = null;\n\t\t\trenderItem.geometry = null;\n\t\t\trenderItem.material = null;\n\t\t\trenderItem.group = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\topaque: opaque,\n\t\ttransmissive: transmissive,\n\t\ttransparent: transparent,\n\n\t\tinit: init,\n\t\tpush: push,\n\t\tunshift: unshift,\n\t\tfinish: finish,\n\n\t\tsort: sort\n\t};\n\n}\n\nfunction WebGLRenderLists() {\n\n\tlet lists = new WeakMap();\n\n\tfunction get( scene, renderCallDepth ) {\n\n\t\tconst listArray = lists.get( scene );\n\t\tlet list;\n\n\t\tif ( listArray === undefined ) {\n\n\t\t\tlist = new WebGLRenderList();\n\t\t\tlists.set( scene, [ list ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= listArray.length ) {\n\n\t\t\t\tlist = new WebGLRenderList();\n\t\t\t\tlistArray.push( list );\n\n\t\t\t} else {\n\n\t\t\t\tlist = listArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn list;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tlists = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction UniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tconeCos: 0,\n\t\t\t\t\t\tpenumbraCos: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'HemisphereLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tskyColor: new Color(),\n\t\t\t\t\t\tgroundColor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RectAreaLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\thalfWidth: new Vector3(),\n\t\t\t\t\t\thalfHeight: new Vector3()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\nfunction ShadowUniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\n\t\t\t\t\t\tshadowCameraNear: 1,\n\t\t\t\t\t\tshadowCameraFar: 1000\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\n\n\nlet nextVersion = 0;\n\nfunction shadowCastingAndTexturingLightsFirst( lightA, lightB ) {\n\n\treturn ( lightB.castShadow ? 2 : 0 ) - ( lightA.castShadow ? 2 : 0 ) + ( lightB.map ? 1 : 0 ) - ( lightA.map ? 1 : 0 );\n\n}\n\nfunction WebGLLights( extensions, capabilities ) {\n\n\tconst cache = new UniformsCache();\n\n\tconst shadowCache = ShadowUniformsCache();\n\n\tconst state = {\n\n\t\tversion: 0,\n\n\t\thash: {\n\t\t\tdirectionalLength: - 1,\n\t\t\tpointLength: - 1,\n\t\t\tspotLength: - 1,\n\t\t\trectAreaLength: - 1,\n\t\t\themiLength: - 1,\n\n\t\t\tnumDirectionalShadows: - 1,\n\t\t\tnumPointShadows: - 1,\n\t\t\tnumSpotShadows: - 1,\n\t\t\tnumSpotMaps: - 1,\n\n\t\t\tnumLightProbes: - 1\n\t\t},\n\n\t\tambient: [ 0, 0, 0 ],\n\t\tprobe: [],\n\t\tdirectional: [],\n\t\tdirectionalShadow: [],\n\t\tdirectionalShadowMap: [],\n\t\tdirectionalShadowMatrix: [],\n\t\tspot: [],\n\t\tspotLightMap: [],\n\t\tspotShadow: [],\n\t\tspotShadowMap: [],\n\t\tspotLightMatrix: [],\n\t\trectArea: [],\n\t\trectAreaLTC1: null,\n\t\trectAreaLTC2: null,\n\t\tpoint: [],\n\t\tpointShadow: [],\n\t\tpointShadowMap: [],\n\t\tpointShadowMatrix: [],\n\t\themi: [],\n\t\tnumSpotLightShadowsWithMaps: 0,\n\t\tnumLightProbes: 0\n\n\t};\n\n\tfor ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\n\n\tconst vector3 = new Vector3();\n\tconst matrix4 = new Matrix4();\n\tconst matrix42 = new Matrix4();\n\n\tfunction setup( lights, useLegacyLights ) {\n\n\t\tlet r = 0, g = 0, b = 0;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tlet numDirectionalShadows = 0;\n\t\tlet numPointShadows = 0;\n\t\tlet numSpotShadows = 0;\n\t\tlet numSpotMaps = 0;\n\t\tlet numSpotShadowsWithMaps = 0;\n\n\t\tlet numLightProbes = 0;\n\n\t\t// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n\t\tlights.sort( shadowCastingAndTexturingLightsFirst );\n\n\t\t// artist-friendly light intensity scaling factor\n\t\tconst scaleFactor = ( useLegacyLights === true ) ? Math.PI : 1;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tconst color = light.color;\n\t\t\tconst intensity = light.intensity;\n\t\t\tconst distance = light.distance;\n\n\t\t\tconst shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;\n\n\t\t\tif ( light.isAmbientLight ) {\n\n\t\t\t\tr += color.r * intensity * scaleFactor;\n\t\t\t\tg += color.g * intensity * scaleFactor;\n\t\t\t\tb += color.b * intensity * scaleFactor;\n\n\t\t\t} else if ( light.isLightProbe ) {\n\n\t\t\t\tfor ( let j = 0; j < 9; j ++ ) {\n\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\n\n\t\t\t\t}\n\n\t\t\t\tnumLightProbes ++;\n\n\t\t\t} else if ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.directionalShadow[ directionalLength ] = shadowUniforms;\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumDirectionalShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.distance = distance;\n\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\n\n\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\tif ( light.map ) {\n\n\t\t\t\t\tstate.spotLightMap[ numSpotMaps ] = light.map;\n\t\t\t\t\tnumSpotMaps ++;\n\n\t\t\t\t\t// make sure the lightMatrix is up to date\n\t\t\t\t\t// TODO : do it if required only\n\t\t\t\t\tshadow.updateMatrices( light );\n\n\t\t\t\t\tif ( light.castShadow ) numSpotShadowsWithMaps ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.spotLightMatrix[ spotLength ] = shadow.matrix;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.spotShadow[ spotLength ] = shadowUniforms;\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\n\n\t\t\t\t\tnumSpotShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\t\t\t\tuniforms.distance = light.distance;\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\t\t\t\t\tshadowUniforms.shadowCameraNear = shadow.camera.near;\n\t\t\t\t\tshadowUniforms.shadowCameraFar = shadow.camera.far;\n\n\t\t\t\t\tstate.pointShadow[ pointLength ] = shadowUniforms;\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumPointShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.point[ pointLength ] = uniforms;\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity * scaleFactor );\n\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( rectAreaLength > 0 ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t// WebGL 2\n\n\t\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// WebGL 1\n\n\t\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t\t} else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.ambient[ 0 ] = r;\n\t\tstate.ambient[ 1 ] = g;\n\t\tstate.ambient[ 2 ] = b;\n\n\t\tconst hash = state.hash;\n\n\t\tif ( hash.directionalLength !== directionalLength ||\n\t\t\thash.pointLength !== pointLength ||\n\t\t\thash.spotLength !== spotLength ||\n\t\t\thash.rectAreaLength !== rectAreaLength ||\n\t\t\thash.hemiLength !== hemiLength ||\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\n\t\t\thash.numPointShadows !== numPointShadows ||\n\t\t\thash.numSpotShadows !== numSpotShadows ||\n\t\t\thash.numSpotMaps !== numSpotMaps ||\n\t\t\thash.numLightProbes !== numLightProbes ) {\n\n\t\t\tstate.directional.length = directionalLength;\n\t\t\tstate.spot.length = spotLength;\n\t\t\tstate.rectArea.length = rectAreaLength;\n\t\t\tstate.point.length = pointLength;\n\t\t\tstate.hemi.length = hemiLength;\n\n\t\t\tstate.directionalShadow.length = numDirectionalShadows;\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\n\t\t\tstate.pointShadow.length = numPointShadows;\n\t\t\tstate.pointShadowMap.length = numPointShadows;\n\t\t\tstate.spotShadow.length = numSpotShadows;\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\n\t\t\tstate.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n\t\t\tstate.spotLightMap.length = numSpotMaps;\n\t\t\tstate.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n\t\t\tstate.numLightProbes = numLightProbes;\n\n\t\t\thash.directionalLength = directionalLength;\n\t\t\thash.pointLength = pointLength;\n\t\t\thash.spotLength = spotLength;\n\t\t\thash.rectAreaLength = rectAreaLength;\n\t\t\thash.hemiLength = hemiLength;\n\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\n\t\t\thash.numPointShadows = numPointShadows;\n\t\t\thash.numSpotShadows = numSpotShadows;\n\t\t\thash.numSpotMaps = numSpotMaps;\n\n\t\t\thash.numLightProbes = numLightProbes;\n\n\t\t\tstate.version = nextVersion ++;\n\n\t\t}\n\n\t}\n\n\tfunction setupView( lights, camera ) {\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tconst viewMatrix = camera.matrixWorldInverse;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tif ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = state.directional[ directionalLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = state.spot[ spotLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = state.rectArea[ rectAreaLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\n\t\t\t\tmatrix42.identity();\n\t\t\t\tmatrix4.copy( light.matrixWorld );\n\t\t\t\tmatrix4.premultiply( viewMatrix );\n\t\t\t\tmatrix42.extractRotation( matrix4 );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = state.point[ pointLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = state.hemi[ hemiLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tsetup: setup,\n\t\tsetupView: setupView,\n\t\tstate: state\n\t};\n\n}\n\nfunction WebGLRenderState( extensions, capabilities ) {\n\n\tconst lights = new WebGLLights( extensions, capabilities );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\n\tfunction init() {\n\n\t\tlightsArray.length = 0;\n\t\tshadowsArray.length = 0;\n\n\t}\n\n\tfunction pushLight( light ) {\n\n\t\tlightsArray.push( light );\n\n\t}\n\n\tfunction pushShadow( shadowLight ) {\n\n\t\tshadowsArray.push( shadowLight );\n\n\t}\n\n\tfunction setupLights( useLegacyLights ) {\n\n\t\tlights.setup( lightsArray, useLegacyLights );\n\n\t}\n\n\tfunction setupLightsView( camera ) {\n\n\t\tlights.setupView( lightsArray, camera );\n\n\t}\n\n\tconst state = {\n\t\tlightsArray: lightsArray,\n\t\tshadowsArray: shadowsArray,\n\n\t\tlights: lights\n\t};\n\n\treturn {\n\t\tinit: init,\n\t\tstate: state,\n\t\tsetupLights: setupLights,\n\t\tsetupLightsView: setupLightsView,\n\n\t\tpushLight: pushLight,\n\t\tpushShadow: pushShadow\n\t};\n\n}\n\nfunction WebGLRenderStates( extensions, capabilities ) {\n\n\tlet renderStates = new WeakMap();\n\n\tfunction get( scene, renderCallDepth = 0 ) {\n\n\t\tconst renderStateArray = renderStates.get( scene );\n\t\tlet renderState;\n\n\t\tif ( renderStateArray === undefined ) {\n\n\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\trenderStates.set( scene, [ renderState ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= renderStateArray.length ) {\n\n\t\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\t\trenderStateArray.push( renderState );\n\n\t\t\t} else {\n\n\t\t\t\trenderState = renderStateArray[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn renderState;\n\n\t}\n\n\tfunction dispose() {\n\n\t\trenderStates = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass MeshDepthMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDepthMaterial = true;\n\n\t\tthis.type = 'MeshDepthMaterial';\n\n\t\tthis.depthPacking = BasicDepthPacking;\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.depthPacking = source.depthPacking;\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshDistanceMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshDistanceMaterial = true;\n\n\t\tthis.type = 'MeshDistanceMaterial';\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\n\nconst fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\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 = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\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 = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\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( squared_mean - mean * mean );\\n\\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\n\nfunction WebGLShadowMap( _renderer, _objects, _capabilities ) {\n\n\tlet _frustum = new Frustum();\n\n\tconst _shadowMapSize = new Vector2(),\n\t\t_viewportSize = new Vector2(),\n\n\t\t_viewport = new Vector4(),\n\n\t\t_depthMaterial = new MeshDepthMaterial( { depthPacking: RGBADepthPacking } ),\n\t\t_distanceMaterial = new MeshDistanceMaterial(),\n\n\t\t_materialCache = {},\n\n\t\t_maxTextureSize = _capabilities.maxTextureSize;\n\n\tconst shadowSide = { [ FrontSide ]: BackSide, [ BackSide ]: FrontSide, [ DoubleSide ]: DoubleSide };\n\n\tconst shadowMaterialVertical = new ShaderMaterial( {\n\t\tdefines: {\n\t\t\tVSM_SAMPLES: 8\n\t\t},\n\t\tuniforms: {\n\t\t\tshadow_pass: { value: null },\n\t\t\tresolution: { value: new Vector2() },\n\t\t\tradius: { value: 4.0 }\n\t\t},\n\n\t\tvertexShader: vertex,\n\t\tfragmentShader: fragment\n\n\t} );\n\n\tconst shadowMaterialHorizontal = shadowMaterialVertical.clone();\n\tshadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n\n\tconst fullScreenTri = new BufferGeometry();\n\tfullScreenTri.setAttribute(\n\t\t'position',\n\t\tnew BufferAttribute(\n\t\t\tnew Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),\n\t\t\t3\n\t\t)\n\t);\n\n\tconst fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\n\n\tconst scope = this;\n\n\tthis.enabled = false;\n\n\tthis.autoUpdate = true;\n\tthis.needsUpdate = false;\n\n\tthis.type = PCFShadowMap;\n\tlet _previousType = this.type;\n\n\tthis.render = function ( lights, scene, camera ) {\n\n\t\tif ( scope.enabled === false ) return;\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\n\n\t\tif ( lights.length === 0 ) return;\n\n\t\tconst currentRenderTarget = _renderer.getRenderTarget();\n\t\tconst activeCubeFace = _renderer.getActiveCubeFace();\n\t\tconst activeMipmapLevel = _renderer.getActiveMipmapLevel();\n\n\t\tconst _state = _renderer.state;\n\n\t\t// Set GL state for depth map.\n\t\t_state.setBlending( NoBlending );\n\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\n\t\t_state.buffers.depth.setTest( true );\n\t\t_state.setScissorTest( false );\n\n\t\t// check for shadow map type changes\n\n\t\tconst toVSM = ( _previousType !== VSMShadowMap && this.type === VSMShadowMap );\n\t\tconst fromVSM = ( _previousType === VSMShadowMap && this.type !== VSMShadowMap );\n\n\t\t// render depth map\n\n\t\tfor ( let i = 0, il = lights.length; i < il; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\t\t\tconst shadow = light.shadow;\n\n\t\t\tif ( shadow === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue;\n\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\n\n\t\t\tconst shadowFrameExtents = shadow.getFrameExtents();\n\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\n\n\t\t\t_viewportSize.copy( shadow.mapSize );\n\n\t\t\tif ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\tif ( _shadowMapSize.x > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null || toVSM === true || fromVSM === true ) {\n\n\t\t\t\tconst pars = ( this.type !== VSMShadowMap ) ? { minFilter: NearestFilter, magFilter: NearestFilter } : {};\n\n\t\t\t\tif ( shadow.map !== null ) {\n\n\t\t\t\t\tshadow.map.dispose();\n\n\t\t\t\t}\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\t_renderer.setRenderTarget( shadow.map );\n\t\t\t_renderer.clear();\n\n\t\t\tconst viewportCount = shadow.getViewportCount();\n\n\t\t\tfor ( let vp = 0; vp < viewportCount; vp ++ ) {\n\n\t\t\t\tconst viewport = shadow.getViewport( vp );\n\n\t\t\t\t_viewport.set(\n\t\t\t\t\t_viewportSize.x * viewport.x,\n\t\t\t\t\t_viewportSize.y * viewport.y,\n\t\t\t\t\t_viewportSize.x * viewport.z,\n\t\t\t\t\t_viewportSize.y * viewport.w\n\t\t\t\t);\n\n\t\t\t\t_state.viewport( _viewport );\n\n\t\t\t\tshadow.updateMatrices( light, vp );\n\n\t\t\t\t_frustum = shadow.getFrustum();\n\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\n\n\t\t\t}\n\n\t\t\t// do blur pass for VSM\n\n\t\t\tif ( shadow.isPointLightShadow !== true && this.type === VSMShadowMap ) {\n\n\t\t\t\tVSMPass( shadow, camera );\n\n\t\t\t}\n\n\t\t\tshadow.needsUpdate = false;\n\n\t\t}\n\n\t\t_previousType = this.type;\n\n\t\tscope.needsUpdate = false;\n\n\t\t_renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t};\n\n\tfunction VSMPass( shadow, camera ) {\n\n\t\tconst geometry = _objects.update( fullScreenMesh );\n\n\t\tif ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {\n\n\t\t\tshadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n\t\t\tshadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n\n\t\t\tshadowMaterialVertical.needsUpdate = true;\n\t\t\tshadowMaterialHorizontal.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( shadow.mapPass === null ) {\n\n\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y );\n\n\t\t}\n\n\t\t// vertical pass\n\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.mapPass );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\n\n\t\t// horizontal pass\n\n\t\tshadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n\t\tshadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.map );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );\n\n\t}\n\n\tfunction getDepthMaterial( object, material, light, type ) {\n\n\t\tlet result = null;\n\n\t\tconst customMaterial = ( light.isPointLight === true ) ? object.customDistanceMaterial : object.customDepthMaterial;\n\n\t\tif ( customMaterial !== undefined ) {\n\n\t\t\tresult = customMaterial;\n\n\t\t} else {\n\n\t\t\tresult = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;\n\n\t\t\tif ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||\n\t\t\t\t( material.displacementMap && material.displacementScale !== 0 ) ||\n\t\t\t\t( material.alphaMap && material.alphaTest > 0 ) ||\n\t\t\t\t( material.map && material.alphaTest > 0 ) ) {\n\n\t\t\t\t// in this case we need a unique material instance reflecting the\n\t\t\t\t// appropriate state\n\n\t\t\t\tconst keyA = result.uuid, keyB = material.uuid;\n\n\t\t\t\tlet materialsForVariant = _materialCache[ keyA ];\n\n\t\t\t\tif ( materialsForVariant === undefined ) {\n\n\t\t\t\t\tmaterialsForVariant = {};\n\t\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\n\n\t\t\t\t}\n\n\t\t\t\tlet cachedMaterial = materialsForVariant[ keyB ];\n\n\t\t\t\tif ( cachedMaterial === undefined ) {\n\n\t\t\t\t\tcachedMaterial = result.clone();\n\t\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\n\t\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\t}\n\n\t\t\t\tresult = cachedMaterial;\n\n\t\t\t}\n\n\t\t}\n\n\t\tresult.visible = material.visible;\n\t\tresult.wireframe = material.wireframe;\n\n\t\tif ( type === VSMShadowMap ) {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\n\n\t\t} else {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\n\n\t\t}\n\n\t\tresult.alphaMap = material.alphaMap;\n\t\tresult.alphaTest = material.alphaTest;\n\t\tresult.map = material.map;\n\n\t\tresult.clipShadows = material.clipShadows;\n\t\tresult.clippingPlanes = material.clippingPlanes;\n\t\tresult.clipIntersection = material.clipIntersection;\n\n\t\tresult.displacementMap = material.displacementMap;\n\t\tresult.displacementScale = material.displacementScale;\n\t\tresult.displacementBias = material.displacementBias;\n\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\n\t\tresult.linewidth = material.linewidth;\n\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\n\n\t\t\tconst materialProperties = _renderer.properties.get( result );\n\t\t\tmaterialProperties.light = light;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tconst visible = object.layers.test( camera.layers );\n\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\n\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\n\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\n\n\t\t\t\tconst geometry = _objects.update( object );\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\tfor ( let k = 0, kl = groups.length; k < kl; k ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ k ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, groupMaterial, light, type );\n\n\t\t\t\t\t\t\tobject.onBeforeShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t\tobject.onAfterShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, material, light, type );\n\n\t\t\t\t\tobject.onBeforeShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t\tobject.onAfterShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\n\n\t\t}\n\n\t}\n\n\tfunction onMaterialDispose( event ) {\n\n\t\tconst material = event.target;\n\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t// make sure to remove the unique distance/depth materials used for shadow map rendering\n\n\t\tfor ( const id in _materialCache ) {\n\n\t\t\tconst cache = _materialCache[ id ];\n\n\t\t\tconst uuid = event.target.uuid;\n\n\t\t\tif ( uuid in cache ) {\n\n\t\t\t\tconst shadowMaterial = cache[ uuid ];\n\t\t\t\tshadowMaterial.dispose();\n\t\t\t\tdelete cache[ uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction ColorBuffer() {\n\n\t\tlet locked = false;\n\n\t\tconst color = new Vector4();\n\t\tlet currentColorMask = null;\n\t\tconst currentColorClear = new Vector4( 0, 0, 0, 0 );\n\n\t\treturn {\n\n\t\t\tsetMask: function ( colorMask ) {\n\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\n\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\n\t\t\t\t\tcurrentColorMask = colorMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\n\n\t\t\t\tif ( premultipliedAlpha === true ) {\n\n\t\t\t\t\tr *= a; g *= a; b *= a;\n\n\t\t\t\t}\n\n\t\t\t\tcolor.set( r, g, b, a );\n\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\n\n\t\t\t\t\tgl.clearColor( r, g, b, a );\n\t\t\t\t\tcurrentColorClear.copy( color );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentColorMask = null;\n\t\t\t\tcurrentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction DepthBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentDepthMask = null;\n\t\tlet currentDepthFunc = null;\n\t\tlet currentDepthClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( depthTest ) {\n\n\t\t\t\tif ( depthTest ) {\n\n\t\t\t\t\tenable( gl.DEPTH_TEST );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdisable( gl.DEPTH_TEST );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( depthMask ) {\n\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\n\n\t\t\t\t\tgl.depthMask( depthMask );\n\t\t\t\t\tcurrentDepthMask = depthMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( depthFunc ) {\n\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\n\n\t\t\t\t\tswitch ( depthFunc ) {\n\n\t\t\t\t\t\tcase NeverDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AlwaysDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LESS );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase LessEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase EqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase GreaterDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase NotEqualDepth:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( depth ) {\n\n\t\t\t\tif ( currentDepthClear !== depth ) {\n\n\t\t\t\t\tgl.clearDepth( depth );\n\t\t\t\t\tcurrentDepthClear = depth;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentDepthMask = null;\n\t\t\t\tcurrentDepthFunc = null;\n\t\t\t\tcurrentDepthClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction StencilBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentStencilMask = null;\n\t\tlet currentStencilFunc = null;\n\t\tlet currentStencilRef = null;\n\t\tlet currentStencilFuncMask = null;\n\t\tlet currentStencilFail = null;\n\t\tlet currentStencilZFail = null;\n\t\tlet currentStencilZPass = null;\n\t\tlet currentStencilClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( stencilTest ) {\n\n\t\t\t\tif ( ! locked ) {\n\n\t\t\t\t\tif ( stencilTest ) {\n\n\t\t\t\t\t\tenable( gl.STENCIL_TEST );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdisable( gl.STENCIL_TEST );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( stencilMask ) {\n\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\n\n\t\t\t\t\tgl.stencilMask( stencilMask );\n\t\t\t\t\tcurrentStencilMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\n\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\n\t\t\t\t currentStencilRef !== stencilRef ||\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\n\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\n\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\n\t\t\t\t\tcurrentStencilRef = stencilRef;\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\n\n\t\t\t\tif ( currentStencilFail !== stencilFail ||\n\t\t\t\t currentStencilZFail !== stencilZFail ||\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\n\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\n\n\t\t\t\t\tcurrentStencilFail = stencilFail;\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( stencil ) {\n\n\t\t\t\tif ( currentStencilClear !== stencil ) {\n\n\t\t\t\t\tgl.clearStencil( stencil );\n\t\t\t\t\tcurrentStencilClear = stencil;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentStencilMask = null;\n\t\t\t\tcurrentStencilFunc = null;\n\t\t\t\tcurrentStencilRef = null;\n\t\t\t\tcurrentStencilFuncMask = null;\n\t\t\t\tcurrentStencilFail = null;\n\t\t\t\tcurrentStencilZFail = null;\n\t\t\t\tcurrentStencilZPass = null;\n\t\t\t\tcurrentStencilClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t//\n\n\tconst colorBuffer = new ColorBuffer();\n\tconst depthBuffer = new DepthBuffer();\n\tconst stencilBuffer = new StencilBuffer();\n\n\tconst uboBindings = new WeakMap();\n\tconst uboProgramMap = new WeakMap();\n\n\tlet enabledCapabilities = {};\n\n\tlet currentBoundFramebuffers = {};\n\tlet currentDrawbuffers = new WeakMap();\n\tlet defaultDrawbuffers = [];\n\n\tlet currentProgram = null;\n\n\tlet currentBlendingEnabled = false;\n\tlet currentBlending = null;\n\tlet currentBlendEquation = null;\n\tlet currentBlendSrc = null;\n\tlet currentBlendDst = null;\n\tlet currentBlendEquationAlpha = null;\n\tlet currentBlendSrcAlpha = null;\n\tlet currentBlendDstAlpha = null;\n\tlet currentBlendColor = new Color( 0, 0, 0 );\n\tlet currentBlendAlpha = 0;\n\tlet currentPremultipledAlpha = false;\n\n\tlet currentFlipSided = null;\n\tlet currentCullFace = null;\n\n\tlet currentLineWidth = null;\n\n\tlet currentPolygonOffsetFactor = null;\n\tlet currentPolygonOffsetUnits = null;\n\n\tconst maxTextures = gl.getParameter( gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS );\n\n\tlet lineWidthAvailable = false;\n\tlet version = 0;\n\tconst glVersion = gl.getParameter( gl.VERSION );\n\n\tif ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^WebGL (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 1.0 );\n\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^OpenGL ES (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 2.0 );\n\n\t}\n\n\tlet currentTextureSlot = null;\n\tlet currentBoundTextures = {};\n\n\tconst scissorParam = gl.getParameter( gl.SCISSOR_BOX );\n\tconst viewportParam = gl.getParameter( gl.VIEWPORT );\n\n\tconst currentScissor = new Vector4().fromArray( scissorParam );\n\tconst currentViewport = new Vector4().fromArray( viewportParam );\n\n\tfunction createTexture( type, target, count, dimensions ) {\n\n\t\tconst data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture( type, texture );\n\t\tgl.texParameteri( type, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\n\t\tgl.texParameteri( type, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tif ( isWebGL2 && ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) ) {\n\n\t\t\t\tgl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t} else {\n\n\t\t\t\tgl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tconst emptyTextures = {};\n\temptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );\n\temptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );\n\n\tif ( isWebGL2 ) {\n\n\t\temptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );\n\t\temptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );\n\n\t}\n\n\t// init\n\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\n\tdepthBuffer.setClear( 1 );\n\tstencilBuffer.setClear( 0 );\n\n\tenable( gl.DEPTH_TEST );\n\tdepthBuffer.setFunc( LessEqualDepth );\n\n\tsetFlipSided( false );\n\tsetCullFace( CullFaceBack );\n\tenable( gl.CULL_FACE );\n\n\tsetBlending( NoBlending );\n\n\t//\n\n\tfunction enable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== true ) {\n\n\t\t\tgl.enable( id );\n\t\t\tenabledCapabilities[ id ] = true;\n\n\t\t}\n\n\t}\n\n\tfunction disable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== false ) {\n\n\t\t\tgl.disable( id );\n\t\t\tenabledCapabilities[ id ] = false;\n\n\t\t}\n\n\t}\n\n\tfunction bindFramebuffer( target, framebuffer ) {\n\n\t\tif ( currentBoundFramebuffers[ target ] !== framebuffer ) {\n\n\t\t\tgl.bindFramebuffer( target, framebuffer );\n\n\t\t\tcurrentBoundFramebuffers[ target ] = framebuffer;\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER\n\n\t\t\t\tif ( target === gl.DRAW_FRAMEBUFFER ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t\tif ( target === gl.FRAMEBUFFER ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction drawBuffers( renderTarget, framebuffer ) {\n\n\t\tlet drawBuffers = defaultDrawbuffers;\n\n\t\tlet needsUpdate = false;\n\n\t\tif ( renderTarget ) {\n\n\t\t\tdrawBuffers = currentDrawbuffers.get( framebuffer );\n\n\t\t\tif ( drawBuffers === undefined ) {\n\n\t\t\t\tdrawBuffers = [];\n\t\t\t\tcurrentDrawbuffers.set( framebuffer, drawBuffers );\n\n\t\t\t}\n\n\t\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\tif ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tdrawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tdrawBuffers.length = textures.length;\n\n\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {\n\n\t\t\t\t\tdrawBuffers[ 0 ] = gl.COLOR_ATTACHMENT0;\n\n\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( drawBuffers[ 0 ] !== gl.BACK ) {\n\n\t\t\t\tdrawBuffers[ 0 ] = gl.BACK;\n\n\t\t\t\tneedsUpdate = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\tgl.drawBuffers( drawBuffers );\n\n\t\t\t} else {\n\n\t\t\t\textensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );\n\n\t\t\t}\n\n\t\t}\n\n\n\t}\n\n\tfunction useProgram( program ) {\n\n\t\tif ( currentProgram !== program ) {\n\n\t\t\tgl.useProgram( program );\n\n\t\t\tcurrentProgram = program;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tconst equationToGL = {\n\t\t[ AddEquation ]: gl.FUNC_ADD,\n\t\t[ SubtractEquation ]: gl.FUNC_SUBTRACT,\n\t\t[ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT\n\t};\n\n\tif ( isWebGL2 ) {\n\n\t\tequationToGL[ MinEquation ] = gl.MIN;\n\t\tequationToGL[ MaxEquation ] = gl.MAX;\n\n\t} else {\n\n\t\tconst extension = extensions.get( 'EXT_blend_minmax' );\n\n\t\tif ( extension !== null ) {\n\n\t\t\tequationToGL[ MinEquation ] = extension.MIN_EXT;\n\t\t\tequationToGL[ MaxEquation ] = extension.MAX_EXT;\n\n\t\t}\n\n\t}\n\n\tconst factorToGL = {\n\t\t[ ZeroFactor ]: gl.ZERO,\n\t\t[ OneFactor ]: gl.ONE,\n\t\t[ SrcColorFactor ]: gl.SRC_COLOR,\n\t\t[ SrcAlphaFactor ]: gl.SRC_ALPHA,\n\t\t[ SrcAlphaSaturateFactor ]: gl.SRC_ALPHA_SATURATE,\n\t\t[ DstColorFactor ]: gl.DST_COLOR,\n\t\t[ DstAlphaFactor ]: gl.DST_ALPHA,\n\t\t[ OneMinusSrcColorFactor ]: gl.ONE_MINUS_SRC_COLOR,\n\t\t[ OneMinusSrcAlphaFactor ]: gl.ONE_MINUS_SRC_ALPHA,\n\t\t[ OneMinusDstColorFactor ]: gl.ONE_MINUS_DST_COLOR,\n\t\t[ OneMinusDstAlphaFactor ]: gl.ONE_MINUS_DST_ALPHA,\n\t\t[ ConstantColorFactor ]: gl.CONSTANT_COLOR,\n\t\t[ OneMinusConstantColorFactor ]: gl.ONE_MINUS_CONSTANT_COLOR,\n\t\t[ ConstantAlphaFactor ]: gl.CONSTANT_ALPHA,\n\t\t[ OneMinusConstantAlphaFactor ]: gl.ONE_MINUS_CONSTANT_ALPHA\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha ) {\n\n\t\tif ( blending === NoBlending ) {\n\n\t\t\tif ( currentBlendingEnabled === true ) {\n\n\t\t\t\tdisable( gl.BLEND );\n\t\t\t\tcurrentBlendingEnabled = false;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( currentBlendingEnabled === false ) {\n\n\t\t\tenable( gl.BLEND );\n\t\t\tcurrentBlendingEnabled = true;\n\n\t\t}\n\n\t\tif ( blending !== CustomBlending ) {\n\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\n\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\n\n\t\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\n\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\n\n\t\t\t\t}\n\n\t\t\t\tif ( premultipliedAlpha ) {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ONE, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFunc( gl.ZERO, gl.SRC_COLOR );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcurrentBlendSrc = null;\n\t\t\t\tcurrentBlendDst = null;\n\t\t\t\tcurrentBlendSrcAlpha = null;\n\t\t\t\tcurrentBlendDstAlpha = null;\n\t\t\t\tcurrentBlendColor.set( 0, 0, 0 );\n\t\t\t\tcurrentBlendAlpha = 0;\n\n\t\t\t\tcurrentBlending = blending;\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// custom blending\n\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\n\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\n\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\n\n\t\t\tcurrentBlendEquation = blendEquation;\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\n\n\t\t}\n\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\n\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\n\n\t\t\tcurrentBlendSrc = blendSrc;\n\t\t\tcurrentBlendDst = blendDst;\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\n\n\t\t}\n\n\t\tif ( blendColor.equals( currentBlendColor ) === false || blendAlpha !== currentBlendAlpha ) {\n\n\t\t\tgl.blendColor( blendColor.r, blendColor.g, blendColor.b, blendAlpha );\n\n\t\t\tcurrentBlendColor.copy( blendColor );\n\t\t\tcurrentBlendAlpha = blendAlpha;\n\n\t\t}\n\n\t\tcurrentBlending = blending;\n\t\tcurrentPremultipledAlpha = false;\n\n\t}\n\n\tfunction setMaterial( material, frontFaceCW ) {\n\n\t\tmaterial.side === DoubleSide\n\t\t\t? disable( gl.CULL_FACE )\n\t\t\t: enable( gl.CULL_FACE );\n\n\t\tlet flipSided = ( material.side === BackSide );\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\n\n\t\tsetFlipSided( flipSided );\n\n\t\t( material.blending === NormalBlending && material.transparent === false )\n\t\t\t? setBlending( NoBlending )\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.blendColor, material.blendAlpha, material.premultipliedAlpha );\n\n\t\tdepthBuffer.setFunc( material.depthFunc );\n\t\tdepthBuffer.setTest( material.depthTest );\n\t\tdepthBuffer.setMask( material.depthWrite );\n\t\tcolorBuffer.setMask( material.colorWrite );\n\n\t\tconst stencilWrite = material.stencilWrite;\n\t\tstencilBuffer.setTest( stencilWrite );\n\t\tif ( stencilWrite ) {\n\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\n\n\t\t}\n\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\n\n\t\tmaterial.alphaToCoverage === true\n\t\t\t? enable( gl.SAMPLE_ALPHA_TO_COVERAGE )\n\t\t\t: disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t}\n\n\t//\n\n\tfunction setFlipSided( flipSided ) {\n\n\t\tif ( currentFlipSided !== flipSided ) {\n\n\t\t\tif ( flipSided ) {\n\n\t\t\t\tgl.frontFace( gl.CW );\n\n\t\t\t} else {\n\n\t\t\t\tgl.frontFace( gl.CCW );\n\n\t\t\t}\n\n\t\t\tcurrentFlipSided = flipSided;\n\n\t\t}\n\n\t}\n\n\tfunction setCullFace( cullFace ) {\n\n\t\tif ( cullFace !== CullFaceNone ) {\n\n\t\t\tenable( gl.CULL_FACE );\n\n\t\t\tif ( cullFace !== currentCullFace ) {\n\n\t\t\t\tif ( cullFace === CullFaceBack ) {\n\n\t\t\t\t\tgl.cullFace( gl.BACK );\n\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.cullFace( gl.FRONT_AND_BACK );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.CULL_FACE );\n\n\t\t}\n\n\t\tcurrentCullFace = cullFace;\n\n\t}\n\n\tfunction setLineWidth( width ) {\n\n\t\tif ( width !== currentLineWidth ) {\n\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\n\n\t\t\tcurrentLineWidth = width;\n\n\t\t}\n\n\t}\n\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\n\n\t\tif ( polygonOffset ) {\n\n\t\t\tenable( gl.POLYGON_OFFSET_FILL );\n\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\n\n\t\t\t\tgl.polygonOffset( factor, units );\n\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\n\t\t\t\tcurrentPolygonOffsetUnits = units;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( gl.POLYGON_OFFSET_FILL );\n\n\t\t}\n\n\t}\n\n\tfunction setScissorTest( scissorTest ) {\n\n\t\tif ( scissorTest ) {\n\n\t\t\tenable( gl.SCISSOR_TEST );\n\n\t\t} else {\n\n\t\t\tdisable( gl.SCISSOR_TEST );\n\n\t\t}\n\n\t}\n\n\t// texture\n\n\tfunction activeTexture( webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\tgl.activeTexture( webglSlot );\n\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t}\n\n\t}\n\n\tfunction bindTexture( webglType, webglTexture, webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) {\n\n\t\t\tif ( currentTextureSlot === null ) {\n\n\t\t\t\twebglSlot = gl.TEXTURE0 + maxTextures - 1;\n\n\t\t\t} else {\n\n\t\t\t\twebglSlot = currentTextureSlot;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet boundTexture = currentBoundTextures[ webglSlot ];\n\n\t\tif ( boundTexture === undefined ) {\n\n\t\t\tboundTexture = { type: undefined, texture: undefined };\n\t\t\tcurrentBoundTextures[ webglSlot ] = boundTexture;\n\n\t\t}\n\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\n\n\t\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\t\tgl.activeTexture( webglSlot );\n\t\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t\t}\n\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\n\n\t\t\tboundTexture.type = webglType;\n\t\t\tboundTexture.texture = webglTexture;\n\n\t\t}\n\n\t}\n\n\tfunction unbindTexture() {\n\n\t\tconst boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\n\n\t\t\tgl.bindTexture( boundTexture.type, null );\n\n\t\t\tboundTexture.type = undefined;\n\t\t\tboundTexture.texture = undefined;\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexSubImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexSubImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texStorage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texStorage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction scissor( scissor ) {\n\n\t\tif ( currentScissor.equals( scissor ) === false ) {\n\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\n\t\t\tcurrentScissor.copy( scissor );\n\n\t\t}\n\n\t}\n\n\tfunction viewport( viewport ) {\n\n\t\tif ( currentViewport.equals( viewport ) === false ) {\n\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\n\t\t\tcurrentViewport.copy( viewport );\n\n\t\t}\n\n\t}\n\n\tfunction updateUBOMapping( uniformsGroup, program ) {\n\n\t\tlet mapping = uboProgramMap.get( program );\n\n\t\tif ( mapping === undefined ) {\n\n\t\t\tmapping = new WeakMap();\n\n\t\t\tuboProgramMap.set( program, mapping );\n\n\t\t}\n\n\t\tlet blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( blockIndex === undefined ) {\n\n\t\t\tblockIndex = gl.getUniformBlockIndex( program, uniformsGroup.name );\n\n\t\t\tmapping.set( uniformsGroup, blockIndex );\n\n\t\t}\n\n\t}\n\n\tfunction uniformBlockBinding( uniformsGroup, program ) {\n\n\t\tconst mapping = uboProgramMap.get( program );\n\t\tconst blockIndex = mapping.get( uniformsGroup );\n\n\t\tif ( uboBindings.get( program ) !== blockIndex ) {\n\n\t\t\t// bind shader specific block index to global block point\n\t\t\tgl.uniformBlockBinding( program, blockIndex, uniformsGroup.__bindingPointIndex );\n\n\t\t\tuboBindings.set( program, blockIndex );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction reset() {\n\n\t\t// reset state\n\n\t\tgl.disable( gl.BLEND );\n\t\tgl.disable( gl.CULL_FACE );\n\t\tgl.disable( gl.DEPTH_TEST );\n\t\tgl.disable( gl.POLYGON_OFFSET_FILL );\n\t\tgl.disable( gl.SCISSOR_TEST );\n\t\tgl.disable( gl.STENCIL_TEST );\n\t\tgl.disable( gl.SAMPLE_ALPHA_TO_COVERAGE );\n\n\t\tgl.blendEquation( gl.FUNC_ADD );\n\t\tgl.blendFunc( gl.ONE, gl.ZERO );\n\t\tgl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );\n\t\tgl.blendColor( 0, 0, 0, 0 );\n\n\t\tgl.colorMask( true, true, true, true );\n\t\tgl.clearColor( 0, 0, 0, 0 );\n\n\t\tgl.depthMask( true );\n\t\tgl.depthFunc( gl.LESS );\n\t\tgl.clearDepth( 1 );\n\n\t\tgl.stencilMask( 0xffffffff );\n\t\tgl.stencilFunc( gl.ALWAYS, 0, 0xffffffff );\n\t\tgl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );\n\t\tgl.clearStencil( 0 );\n\n\t\tgl.cullFace( gl.BACK );\n\t\tgl.frontFace( gl.CCW );\n\n\t\tgl.polygonOffset( 0, 0 );\n\n\t\tgl.activeTexture( gl.TEXTURE0 );\n\n\t\tgl.bindFramebuffer( gl.FRAMEBUFFER, null );\n\n\t\tif ( isWebGL2 === true ) {\n\n\t\t\tgl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );\n\t\t\tgl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );\n\n\t\t}\n\n\t\tgl.useProgram( null );\n\n\t\tgl.lineWidth( 1 );\n\n\t\tgl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tgl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\t// reset internals\n\n\t\tenabledCapabilities = {};\n\n\t\tcurrentTextureSlot = null;\n\t\tcurrentBoundTextures = {};\n\n\t\tcurrentBoundFramebuffers = {};\n\t\tcurrentDrawbuffers = new WeakMap();\n\t\tdefaultDrawbuffers = [];\n\n\t\tcurrentProgram = null;\n\n\t\tcurrentBlendingEnabled = false;\n\t\tcurrentBlending = null;\n\t\tcurrentBlendEquation = null;\n\t\tcurrentBlendSrc = null;\n\t\tcurrentBlendDst = null;\n\t\tcurrentBlendEquationAlpha = null;\n\t\tcurrentBlendSrcAlpha = null;\n\t\tcurrentBlendDstAlpha = null;\n\t\tcurrentBlendColor = new Color( 0, 0, 0 );\n\t\tcurrentBlendAlpha = 0;\n\t\tcurrentPremultipledAlpha = false;\n\n\t\tcurrentFlipSided = null;\n\t\tcurrentCullFace = null;\n\n\t\tcurrentLineWidth = null;\n\n\t\tcurrentPolygonOffsetFactor = null;\n\t\tcurrentPolygonOffsetUnits = null;\n\n\t\tcurrentScissor.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tcurrentViewport.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\tcolorBuffer.reset();\n\t\tdepthBuffer.reset();\n\t\tstencilBuffer.reset();\n\n\t}\n\n\treturn {\n\n\t\tbuffers: {\n\t\t\tcolor: colorBuffer,\n\t\t\tdepth: depthBuffer,\n\t\t\tstencil: stencilBuffer\n\t\t},\n\n\t\tenable: enable,\n\t\tdisable: disable,\n\n\t\tbindFramebuffer: bindFramebuffer,\n\t\tdrawBuffers: drawBuffers,\n\n\t\tuseProgram: useProgram,\n\n\t\tsetBlending: setBlending,\n\t\tsetMaterial: setMaterial,\n\n\t\tsetFlipSided: setFlipSided,\n\t\tsetCullFace: setCullFace,\n\n\t\tsetLineWidth: setLineWidth,\n\t\tsetPolygonOffset: setPolygonOffset,\n\n\t\tsetScissorTest: setScissorTest,\n\n\t\tactiveTexture: activeTexture,\n\t\tbindTexture: bindTexture,\n\t\tunbindTexture: unbindTexture,\n\t\tcompressedTexImage2D: compressedTexImage2D,\n\t\tcompressedTexImage3D: compressedTexImage3D,\n\t\ttexImage2D: texImage2D,\n\t\ttexImage3D: texImage3D,\n\n\t\tupdateUBOMapping: updateUBOMapping,\n\t\tuniformBlockBinding: uniformBlockBinding,\n\n\t\ttexStorage2D: texStorage2D,\n\t\ttexStorage3D: texStorage3D,\n\t\ttexSubImage2D: texSubImage2D,\n\t\ttexSubImage3D: texSubImage3D,\n\t\tcompressedTexSubImage2D: compressedTexSubImage2D,\n\t\tcompressedTexSubImage3D: compressedTexSubImage3D,\n\n\t\tscissor: scissor,\n\t\tviewport: viewport,\n\n\t\treset: reset\n\n\t};\n\n}\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\tconst multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;\n\tconst supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );\n\n\tconst _videoTextures = new WeakMap();\n\tlet _canvas;\n\n\tconst _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n\tlet useOffscreenCanvas = false;\n\n\ttry {\n\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;\n\n\t} catch ( err ) {\n\n\t\t// Ignore any errors\n\n\t}\n\n\tfunction createCanvas( width, height ) {\n\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\n\n\t\treturn useOffscreenCanvas ?\n\t\t\t// eslint-disable-next-line compat/compat\n\t\t\tnew OffscreenCanvas( width, height ) : createElementNS( 'canvas' );\n\n\t}\n\n\tfunction resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( image.width > maxSize || image.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( image.width, image.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 || needsPowerOfTwo === true ) {\n\n\t\t\t// only perform resize for certain image types\n\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\t\tconst floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;\n\n\t\t\t\tconst width = floor( scale * image.width );\n\t\t\t\tconst height = floor( scale * image.height );\n\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\n\n\t\t\t\t// cube textures can't reuse the same canvas\n\n\t\t\t\tconst canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\n\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\n\t\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );\n\n\t\t\t\treturn canvas;\n\n\t\t\t} else {\n\n\t\t\t\tif ( 'data' in image ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );\n\n\t\t\t\t}\n\n\t\t\t\treturn image;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction isPowerOfTwo$1( image ) {\n\n\t\treturn isPowerOfTwo( image.width ) && isPowerOfTwo( image.height );\n\n\t}\n\n\tfunction textureNeedsPowerOfTwo( texture ) {\n\n\t\tif ( isWebGL2 ) return false;\n\n\t\treturn ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) ||\n\t\t\t( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );\n\n\t}\n\n\tfunction textureNeedsGenerateMipmaps( texture, supportsMips ) {\n\n\t\treturn texture.generateMipmaps && supportsMips &&\n\t\t\ttexture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n\n\t}\n\n\tfunction generateMipmap( target ) {\n\n\t\t_gl.generateMipmap( target );\n\n\t}\n\n\tfunction getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {\n\n\t\tif ( isWebGL2 === false ) return glFormat;\n\n\t\tif ( internalFormatName !== null ) {\n\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\n\n\t\t}\n\n\t\tlet internalFormat = glFormat;\n\n\t\tif ( glFormat === _gl.RED ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RED_INTEGER ) {\n\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8UI;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.R16UI;\n\t\t\tif ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.R32UI;\n\t\t\tif ( glType === _gl.BYTE ) internalFormat = _gl.R8I;\n\t\t\tif ( glType === _gl.SHORT ) internalFormat = _gl.R16I;\n\t\t\tif ( glType === _gl.INT ) internalFormat = _gl.R32I;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RG ) {\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;\n\n\t\t}\n\n\t\tif ( glFormat === _gl.RGBA ) {\n\n\t\t\tconst transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );\n\n\t\t\tif ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;\n\t\t\tif ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;\n\t\t\tif ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;\n\t\t\tif ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;\n\n\t\t}\n\n\t\tif ( internalFormat === _gl.R16F || internalFormat === _gl.R32F ||\n\t\t\tinternalFormat === _gl.RG16F || internalFormat === _gl.RG32F ||\n\t\t\tinternalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F ) {\n\n\t\t\textensions.get( 'EXT_color_buffer_float' );\n\n\t\t}\n\n\t\treturn internalFormat;\n\n\t}\n\n\tfunction getMipLevels( texture, image, supportsMips ) {\n\n\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {\n\n\t\t\treturn Math.log2( Math.max( image.width, image.height ) ) + 1;\n\n\t\t} else if ( texture.mipmaps !== undefined && texture.mipmaps.length > 0 ) {\n\n\t\t\t// user-defined mipmaps\n\n\t\t\treturn texture.mipmaps.length;\n\n\t\t} else if ( texture.isCompressedTexture && Array.isArray( texture.image ) ) {\n\n\t\t\treturn image.mipmaps.length;\n\n\t\t} else {\n\n\t\t\t// texture without mipmaps (only base level)\n\n\t\t\treturn 1;\n\n\t\t}\n\n\t}\n\n\t// Fallback filters for non-power-of-2 textures\n\n\tfunction filterFallback( f ) {\n\n\t\tif ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {\n\n\t\t\treturn _gl.NEAREST;\n\n\t\t}\n\n\t\treturn _gl.LINEAR;\n\n\t}\n\n\t//\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tdeallocateTexture( texture );\n\n\t\tif ( texture.isVideoTexture ) {\n\n\t\t\t_videoTextures.delete( texture );\n\n\t\t}\n\n\t}\n\n\tfunction onRenderTargetDispose( event ) {\n\n\t\tconst renderTarget = event.target;\n\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tdeallocateRenderTarget( renderTarget );\n\n\t}\n\n\t//\n\n\tfunction deallocateTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglInit === undefined ) return;\n\n\t\t// check if it's necessary to remove the WebGLTexture object\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures ) {\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\t\t\twebglTexture.usedTimes --;\n\n\t\t\t// the WebGLTexture object is not used anymore, remove it\n\n\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\tdeleteTexture( texture );\n\n\t\t\t}\n\n\t\t\t// remove the weak map entry if no WebGLTexture uses the source anymore\n\n\t\t\tif ( Object.keys( webglTextures ).length === 0 ) {\n\n\t\t\t\t_sources.delete( source );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\n\t}\n\n\tfunction deleteTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\tconst source = texture.source;\n\t\tconst webglTextures = _sources.get( source );\n\t\tdelete webglTextures[ textureProperties.__cacheKey ];\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\tfunction deallocateRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglTexture !== undefined ) {\n\n\t\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\t\tinfo.memory.textures --;\n\n\t\t}\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\trenderTarget.depthTexture.dispose();\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer[ i ] ) ) {\n\n\t\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer[ i ].length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ][ level ] );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( Array.isArray( renderTargetProperties.__webglFramebuffer ) ) {\n\n\t\t\t\tfor ( let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level ++ ) _gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ level ] );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\n\t\t\tif ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer ) {\n\n\t\t\t\tfor ( let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i ++ ) {\n\n\t\t\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer[ i ] ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer );\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\tfor ( let i = 0, il = texture.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachmentProperties = properties.get( texture[ i ] );\n\n\t\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\t\tinfo.memory.textures --;\n\n\t\t\t\t}\n\n\t\t\t\tproperties.remove( texture[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\t\tproperties.remove( renderTarget );\n\n\t}\n\n\t//\n\n\tlet textureUnits = 0;\n\n\tfunction resetTextureUnits() {\n\n\t\ttextureUnits = 0;\n\n\t}\n\n\tfunction allocateTextureUnit() {\n\n\t\tconst textureUnit = textureUnits;\n\n\t\tif ( textureUnit >= capabilities.maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );\n\n\t\t}\n\n\t\ttextureUnits += 1;\n\n\t\treturn textureUnit;\n\n\t}\n\n\tfunction getTextureCacheKey( texture ) {\n\n\t\tconst array = [];\n\n\t\tarray.push( texture.wrapS );\n\t\tarray.push( texture.wrapT );\n\t\tarray.push( texture.wrapR || 0 );\n\t\tarray.push( texture.magFilter );\n\t\tarray.push( texture.minFilter );\n\t\tarray.push( texture.anisotropy );\n\t\tarray.push( texture.internalFormat );\n\t\tarray.push( texture.format );\n\t\tarray.push( texture.type );\n\t\tarray.push( texture.generateMipmaps );\n\t\tarray.push( texture.premultiplyAlpha );\n\t\tarray.push( texture.flipY );\n\t\tarray.push( texture.unpackAlignment );\n\t\tarray.push( texture.colorSpace );\n\n\t\treturn array.join();\n\n\t}\n\n\t//\n\n\tfunction setTexture2D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\n\n\t\tif ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tconst image = texture.image;\n\n\t\t\tif ( image === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but no image data found.' );\n\n\t\t\t} else if ( image.complete === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );\n\n\t\t\t} else {\n\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture2DArray( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTexture3D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tfunction setTextureCube( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadCubeTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t}\n\n\tconst wrappingToGL = {\n\t\t[ RepeatWrapping ]: _gl.REPEAT,\n\t\t[ ClampToEdgeWrapping ]: _gl.CLAMP_TO_EDGE,\n\t\t[ MirroredRepeatWrapping ]: _gl.MIRRORED_REPEAT\n\t};\n\n\tconst filterToGL = {\n\t\t[ NearestFilter ]: _gl.NEAREST,\n\t\t[ NearestMipmapNearestFilter ]: _gl.NEAREST_MIPMAP_NEAREST,\n\t\t[ NearestMipmapLinearFilter ]: _gl.NEAREST_MIPMAP_LINEAR,\n\n\t\t[ LinearFilter ]: _gl.LINEAR,\n\t\t[ LinearMipmapNearestFilter ]: _gl.LINEAR_MIPMAP_NEAREST,\n\t\t[ LinearMipmapLinearFilter ]: _gl.LINEAR_MIPMAP_LINEAR\n\t};\n\n\tconst compareToGL = {\n\t\t[ NeverCompare ]: _gl.NEVER,\n\t\t[ AlwaysCompare ]: _gl.ALWAYS,\n\t\t[ LessCompare ]: _gl.LESS,\n\t\t[ LessEqualCompare ]: _gl.LEQUAL,\n\t\t[ EqualCompare ]: _gl.EQUAL,\n\t\t[ GreaterEqualCompare ]: _gl.GEQUAL,\n\t\t[ GreaterCompare ]: _gl.GREATER,\n\t\t[ NotEqualCompare ]: _gl.NOTEQUAL\n\t};\n\n\tfunction setTextureParameters( textureType, texture, supportsMips ) {\n\n\t\tif ( supportsMips ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );\n\n\t\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );\n\n\t\t} else {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );\n\n\t\t\tif ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );\n\n\t\t\t}\n\n\t\t\tif ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );\n\n\t\t\tif ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( texture.compareFunction ) {\n\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[ texture.compareFunction ] );\n\n\t\t}\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tif ( texture.magFilter === NearestFilter ) return;\n\t\t\tif ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;\n\t\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2\n\t\t\tif ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction initTexture( textureProperties, texture ) {\n\n\t\tlet forceUpload = false;\n\n\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\ttextureProperties.__webglInit = true;\n\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t}\n\n\t\t// create Source <-> WebGLTextures mapping if necessary\n\n\t\tconst source = texture.source;\n\t\tlet webglTextures = _sources.get( source );\n\n\t\tif ( webglTextures === undefined ) {\n\n\t\t\twebglTextures = {};\n\t\t\t_sources.set( source, webglTextures );\n\n\t\t}\n\n\t\t// check if there is already a WebGLTexture object for the given texture parameters\n\n\t\tconst textureCacheKey = getTextureCacheKey( texture );\n\n\t\tif ( textureCacheKey !== textureProperties.__cacheKey ) {\n\n\t\t\t// if not, create a new instance of WebGLTexture\n\n\t\t\tif ( webglTextures[ textureCacheKey ] === undefined ) {\n\n\t\t\t\t// create new entry\n\n\t\t\t\twebglTextures[ textureCacheKey ] = {\n\t\t\t\t\ttexture: _gl.createTexture(),\n\t\t\t\t\tusedTimes: 0\n\t\t\t\t};\n\n\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t// when a new instance of WebGLTexture was created, a texture upload is required\n\t\t\t\t// even if the image contents are identical\n\n\t\t\t\tforceUpload = true;\n\n\t\t\t}\n\n\t\t\twebglTextures[ textureCacheKey ].usedTimes ++;\n\n\t\t\t// every time the texture cache key changes, it's necessary to check if an instance of\n\t\t\t// WebGLTexture can be deleted in order to avoid a memory leak.\n\n\t\t\tconst webglTexture = webglTextures[ textureProperties.__cacheKey ];\n\n\t\t\tif ( webglTexture !== undefined ) {\n\n\t\t\t\twebglTextures[ textureProperties.__cacheKey ].usedTimes --;\n\n\t\t\t\tif ( webglTexture.usedTimes === 0 ) {\n\n\t\t\t\t\tdeleteTexture( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// store references to cache key and WebGLTexture object\n\n\t\t\ttextureProperties.__cacheKey = textureCacheKey;\n\t\t\ttextureProperties.__webglTexture = webglTextures[ textureCacheKey ].texture;\n\n\t\t}\n\n\t\treturn forceUpload;\n\n\t}\n\n\tfunction uploadTexture( textureProperties, texture, slot ) {\n\n\t\tlet textureType = _gl.TEXTURE_2D;\n\n\t\tif ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;\n\t\tif ( texture.isData3DTexture ) textureType = _gl.TEXTURE_3D;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\tconst needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;\n\t\t\tlet image = resizeImage( texture.image, needsPowerOfTwo, false, capabilities.maxTextureSize );\n\t\t\timage = verifyColorSpace( texture, image );\n\n\t\t\tconst supportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace );\n\n\t\t\tlet glType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );\n\n\t\t\tsetTextureParameters( textureType, texture, supportsMips );\n\n\t\t\tlet mipmap;\n\t\t\tconst mipmaps = texture.mipmaps;\n\n\t\t\tconst useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tconst levels = getMipLevels( texture, image, supportsMips );\n\n\t\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t\t// populate depth texture with dummy data\n\n\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT;\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t\t} else if ( texture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t\t} else if ( texture.type === UnsignedInt248Type ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH24_STENCIL8;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\t\tconsole.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// validation checks for WebGL 1\n\n\t\t\t\tif ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {\n\n\t\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t\t// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tif ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );\n\n\t\t\t\t\t\ttexture.type = UnsignedIntType;\n\t\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {\n\n\t\t\t\t\t// Depth stencil textures need the DEPTH_STENCIL internal format\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tglInternalFormat = _gl.DEPTH_STENCIL;\n\n\t\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t\t// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.\n\t\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\t\tif ( texture.type !== UnsignedInt248Type ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );\n\n\t\t\t\t\t\ttexture.type = UnsignedInt248Type;\n\t\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t//\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataTexture ) {\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isCompressedTexture ) {\n\n\t\t\t\tif ( texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0 );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isDataArrayTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage3D( _gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\n\t\t\t\t}\n\n\t\t\t} else if ( texture.isFramebufferTexture ) {\n\n\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tlet width = image.width, height = image.height;\n\n\t\t\t\t\t\tfor ( let i = 0; i < levels; i ++ ) {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t\t\t\t\twidth >>= 1;\n\t\t\t\t\t\t\theight >>= 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// regular Texture (image, video, canvas)\n\n\t\t\t\t// use manually created mipmaps if available\n\t\t\t\t// if there are no manual mipmaps\n\t\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\tif ( allocateMemory ) {\n\n\t\t\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( textureType );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\tfunction uploadCubeTexture( textureProperties, texture, slot ) {\n\n\t\tif ( texture.image.length !== 6 ) return;\n\n\t\tconst forceUpload = initTexture( textureProperties, texture );\n\t\tconst source = texture.source;\n\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );\n\n\t\tconst sourceProperties = properties.get( source );\n\n\t\tif ( source.version !== sourceProperties.__version || forceUpload === true ) {\n\n\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\n\n\t\t\tconst workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );\n\t\t\tconst texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );\n\t\t\tconst unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );\n\n\t\t\tconst isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );\n\t\t\tconst isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\n\n\t\t\tconst cubeImage = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( ! isCompressed && ! isDataTexture ) {\n\n\t\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], false, true, capabilities.maxCubemapSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\n\n\t\t\t\t}\n\n\t\t\t\tcubeImage[ i ] = verifyColorSpace( texture, cubeImage[ i ] );\n\n\t\t\t}\n\n\t\t\tconst image = cubeImage[ 0 ],\n\t\t\t\tsupportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\t\tglFormat = utils.convert( texture.format, texture.colorSpace ),\n\t\t\t\tglType = utils.convert( texture.type ),\n\t\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\n\t\t\tconst useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );\n\t\t\tconst allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );\n\t\t\tlet levels = getMipLevels( texture, image, supportsMips );\n\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );\n\n\t\t\tlet mipmaps;\n\n\t\t\tif ( isCompressed ) {\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\n\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\tif ( texture.format !== RGBAFormat ) {\n\n\t\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );\n\n\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tmipmaps = texture.mipmaps;\n\n\t\t\t\tif ( useTexStorage && allocateMemory ) {\n\n\t\t\t\t\t// TODO: Uniformly handle mipmap definitions\n\t\t\t\t\t// Normal textures and compressed cube textures define base level + mips with their mipmap array\n\t\t\t\t\t// Uncompressed cube textures use their mipmap array only for mips (no base level)\n\n\t\t\t\t\tif ( mipmaps.length > 0 ) levels ++;\n\n\t\t\t\t\tstate.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tif ( isDataTexture ) {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\t\t\t\t\t\t\tconst mipmapImage = mipmap.image[ i ].image;\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\t\tif ( useTexStorage ) {\n\n\t\t\t\t\t\t\t\tstate.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\t// We assume images for cube map have the same size.\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tsourceProperties.__version = source.version;\n\n\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t}\n\n\t// Render targets\n\n\t// Setup storage for target texture and bind it to correct framebuffer\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget, level ) {\n\n\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\tconst glType = utils.convert( texture.type );\n\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( ! renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\tconst width = Math.max( 1, renderTarget.width >> level );\n\t\t\tconst height = Math.max( 1, renderTarget.height >> level );\n\n\t\t\tif ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {\n\n\t\t\t\tstate.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );\n\n\t\t} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753\n\n\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, properties.get( texture ).__webglTexture, level );\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\n\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\n\n\t\t\tlet glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;\n\n\t\t\tif ( isMultisample || useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tconst depthTexture = renderTarget.depthTexture;\n\n\t\t\t\tif ( depthTexture && depthTexture.isDepthTexture ) {\n\n\t\t\t\t\tif ( depthTexture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT32F;\n\n\t\t\t\t\t} else if ( depthTexture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = _gl.DEPTH_COMPONENT24;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\n\n\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\n\n\t\t} else {\n\n\t\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tconst texture = textures[ i ];\n\n\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\tif ( isMultisample && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else if ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\t\tmultisampledRTTExt.renderbufferStorageMultisampleEXT( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t}\n\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\n\tfunction setupDepthTexture( framebuffer, renderTarget ) {\n\n\t\tconst isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );\n\t\tif ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\n\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\n\n\t\t}\n\n\t\t// upload an empty depth texture with framebuffer size\n\t\tif ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\n\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tsetTexture2D( renderTarget.depthTexture, 0 );\n\n\t\tconst webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;\n\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\tif ( useMultisampledRTT( renderTarget ) ) {\n\n\t\t\t\tmultisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\n\n\t\t}\n\n\t}\n\n\t// Setup GL resources for a non-texture depth buffer\n\tfunction setupDepthRenderbuffer( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\tif ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\tif ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );\n\n\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );\n\n\t\t} else {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t}\n\n\t// rebind framebuffer with external textures\n\tfunction rebindTextures( renderTarget, colorTexture, depthTexture ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tif ( colorTexture !== undefined ) {\n\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0 );\n\n\t\t}\n\n\t\tif ( depthTexture !== undefined ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\t// Set up GL resources for the render target\n\tfunction setupRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets !== true ) {\n\n\t\t\tif ( textureProperties.__webglTexture === undefined ) {\n\n\t\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t}\n\n\t\t\ttextureProperties.__version = texture.version;\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\t// Setup framebuffer\n\n\t\tif ( isCube ) {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = [];\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ][ level ] = _gl.createFramebuffer();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ level ] = _gl.createFramebuffer();\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n\n\t\t\t}\n\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tif ( capabilities.drawBuffers ) {\n\n\t\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\tconst textures = isMultipleRenderTargets ? texture : [ texture ];\n\n\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = [];\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tconst texture = textures[ i ];\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer[ i ] = _gl.createRenderbuffer();\n\n\t\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst glFormat = utils.convert( texture.format, texture.colorSpace );\n\t\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true );\n\t\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\t\t\t_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\n\n\t\t\t\t}\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Setup color buffer\n\n\t\tif ( isCube ) {\n\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ][ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( _gl.TEXTURE_CUBE_MAP );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else if ( isMultipleRenderTargets ) {\n\n\t\t\tconst textures = renderTarget.texture;\n\n\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachment = textures[ i ];\n\t\t\t\tconst attachmentProperties = properties.get( attachment );\n\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );\n\n\t\t\t\tif ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {\n\n\t\t\t\t\tgenerateMipmap( _gl.TEXTURE_2D );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else {\n\n\t\t\tlet glTextureType = _gl.TEXTURE_2D;\n\n\t\t\tif ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tglTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture, supportsMips );\n\n\t\t\tif ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {\n\n\t\t\t\tfor ( let level = 0; level < texture.mipmaps.length; level ++ ) {\n\n\t\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ level ], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0 );\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( glTextureType );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t}\n\n\t\t// Setup depth and stencil buffers\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\tfunction updateRenderTargetMipmap( renderTarget ) {\n\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst texture = textures[ i ];\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tconst target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;\n\t\t\t\tconst webglTexture = properties.get( texture ).__webglTexture;\n\n\t\t\t\tstate.bindTexture( target, webglTexture );\n\t\t\t\tgenerateMipmap( target );\n\t\t\t\tstate.unbindTexture();\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];\n\t\t\tconst width = renderTarget.width;\n\t\t\tconst height = renderTarget.height;\n\t\t\tlet mask = _gl.COLOR_BUFFER_BIT;\n\t\t\tconst invalidationArray = [];\n\t\t\tconst depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\tconst isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );\n\n\t\t\t// If MRT we need to remove FBO attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null );\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\n\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\tinvalidationArray.push( _gl.COLOR_ATTACHMENT0 + i );\n\n\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\tinvalidationArray.push( depthStyle );\n\n\t\t\t\t}\n\n\t\t\t\tconst ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : false;\n\n\t\t\t\tif ( ignoreDepthValues === false ) {\n\n\t\t\t\t\tif ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;\n\t\t\t\t\tif ( renderTarget.stencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( ignoreDepthValues === true ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, [ depthStyle ] );\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.DRAW_FRAMEBUFFER, [ depthStyle ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST );\n\n\t\t\t\tif ( supportsInvalidateFramebuffer ) {\n\n\t\t\t\t\t_gl.invalidateFramebuffer( _gl.READ_FRAMEBUFFER, invalidationArray );\n\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );\n\n\t\t\t// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tfor ( let i = 0; i < textures.length; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[ i ] );\n\n\t\t\t\t\tconst webglTexture = properties.get( textures[ i ] ).__webglTexture;\n\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );\n\t\t\t\t\t_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn Math.min( capabilities.maxSamples, renderTarget.samples );\n\n\t}\n\n\tfunction useMultisampledRTT( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\treturn isWebGL2 && renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;\n\n\t}\n\n\tfunction updateVideoTexture( texture ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\t// Check the last frame we updated the VideoTexture\n\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\n\n\t\t\t_videoTextures.set( texture, frame );\n\t\t\ttexture.update();\n\n\t\t}\n\n\t}\n\n\tfunction verifyColorSpace( texture, image ) {\n\n\t\tconst colorSpace = texture.colorSpace;\n\t\tconst format = texture.format;\n\t\tconst type = texture.type;\n\n\t\tif ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;\n\n\t\tif ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {\n\n\t\t\t// sRGB\n\n\t\t\tif ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {\n\n\t\t\t\tif ( isWebGL2 === false ) {\n\n\t\t\t\t\t// in WebGL 1, try to use EXT_sRGB extension and unsized formats\n\n\t\t\t\t\tif ( extensions.has( 'EXT_sRGB' ) === true && format === RGBAFormat ) {\n\n\t\t\t\t\t\ttexture.format = _SRGBAFormat;\n\n\t\t\t\t\t\t// it's not possible to generate mips in WebGL 1 with this extension\n\n\t\t\t\t\t\ttexture.minFilter = LinearFilter;\n\t\t\t\t\t\ttexture.generateMipmaps = false;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// slow fallback (CPU decode)\n\n\t\t\t\t\t\timage = ImageUtils.sRGBToLinear( image );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n\n\t\t\t\t\tif ( format !== RGBAFormat || type !== UnsignedByteType ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\t//\n\n\tthis.allocateTextureUnit = allocateTextureUnit;\n\tthis.resetTextureUnits = resetTextureUnits;\n\n\tthis.setTexture2D = setTexture2D;\n\tthis.setTexture2DArray = setTexture2DArray;\n\tthis.setTexture3D = setTexture3D;\n\tthis.setTextureCube = setTextureCube;\n\tthis.rebindTextures = rebindTextures;\n\tthis.setupRenderTarget = setupRenderTarget;\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n\tthis.setupDepthRenderbuffer = setupDepthRenderbuffer;\n\tthis.setupFrameBufferTexture = setupFrameBufferTexture;\n\tthis.useMultisampledRTT = useMultisampledRTT;\n\n}\n\nfunction WebGLUtils( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction convert( p, colorSpace = NoColorSpace ) {\n\n\t\tlet extension;\n\n\t\tconst transfer = ColorManagement.getTransfer( colorSpace );\n\n\t\tif ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;\n\t\tif ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;\n\t\tif ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;\n\n\t\tif ( p === ByteType ) return gl.BYTE;\n\t\tif ( p === ShortType ) return gl.SHORT;\n\t\tif ( p === UnsignedShortType ) return gl.UNSIGNED_SHORT;\n\t\tif ( p === IntType ) return gl.INT;\n\t\tif ( p === UnsignedIntType ) return gl.UNSIGNED_INT;\n\t\tif ( p === FloatType ) return gl.FLOAT;\n\n\t\tif ( p === HalfFloatType ) {\n\n\t\t\tif ( isWebGL2 ) return gl.HALF_FLOAT;\n\n\t\t\textension = extensions.get( 'OES_texture_half_float' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.HALF_FLOAT_OES;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === AlphaFormat ) return gl.ALPHA;\n\t\tif ( p === RGBAFormat ) return gl.RGBA;\n\t\tif ( p === LuminanceFormat ) return gl.LUMINANCE;\n\t\tif ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;\n\t\tif ( p === DepthFormat ) return gl.DEPTH_COMPONENT;\n\t\tif ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;\n\n\t\t// WebGL 1 sRGB fallback\n\n\t\tif ( p === _SRGBAFormat ) {\n\n\t\t\textension = extensions.get( 'EXT_sRGB' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.SRGB_ALPHA_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// WebGL2 formats.\n\n\t\tif ( p === RedFormat ) return gl.RED;\n\t\tif ( p === RedIntegerFormat ) return gl.RED_INTEGER;\n\t\tif ( p === RGFormat ) return gl.RG;\n\t\tif ( p === RGIntegerFormat ) return gl.RG_INTEGER;\n\t\tif ( p === RGBAIntegerFormat ) return gl.RGBA_INTEGER;\n\n\t\t// S3TC\n\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\n\n\t\t\tif ( transfer === SRGBTransfer ) {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t\t\t\tif ( extension !== null ) {\n\n\t\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n\t\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// PVRTC\n\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC1\n\n\t\tif ( p === RGB_ETC1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc1' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.COMPRESSED_RGB_ETC1_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ETC2\n\n\t\tif ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ASTC\n\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_ASTC_4x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n\t\t\t\tif ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// BPTC\n\n\t\tif ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_bptc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n\t\t\t\tif ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;\n\t\t\t\tif ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// RGTC\n\n\t\tif ( p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_rgtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGBA_BPTC_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n\t\t\t\tif ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n\t\t\t\tif ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( p === UnsignedInt248Type ) {\n\n\t\t\tif ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;\n\n\t\t\textension = extensions.get( 'WEBGL_depth_texture' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.UNSIGNED_INT_24_8_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n\n\t\treturn ( gl[ p ] !== undefined ) ? gl[ p ] : null;\n\n\t}\n\n\treturn { convert: convert };\n\n}\n\nclass ArrayCamera extends PerspectiveCamera {\n\n\tconstructor( array = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isArrayCamera = true;\n\n\t\tthis.cameras = array;\n\n\t}\n\n}\n\nclass Group extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isGroup = true;\n\n\t\tthis.type = 'Group';\n\n\t}\n\n}\n\nconst _moveEvent = { type: 'move' };\n\nclass WebXRController {\n\n\tconstructor() {\n\n\t\tthis._targetRay = null;\n\t\tthis._grip = null;\n\t\tthis._hand = null;\n\n\t}\n\n\tgetHandSpace() {\n\n\t\tif ( this._hand === null ) {\n\n\t\t\tthis._hand = new Group();\n\t\t\tthis._hand.matrixAutoUpdate = false;\n\t\t\tthis._hand.visible = false;\n\n\t\t\tthis._hand.joints = {};\n\t\t\tthis._hand.inputState = { pinching: false };\n\n\t\t}\n\n\t\treturn this._hand;\n\n\t}\n\n\tgetTargetRaySpace() {\n\n\t\tif ( this._targetRay === null ) {\n\n\t\t\tthis._targetRay = new Group();\n\t\t\tthis._targetRay.matrixAutoUpdate = false;\n\t\t\tthis._targetRay.visible = false;\n\t\t\tthis._targetRay.hasLinearVelocity = false;\n\t\t\tthis._targetRay.linearVelocity = new Vector3();\n\t\t\tthis._targetRay.hasAngularVelocity = false;\n\t\t\tthis._targetRay.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._targetRay;\n\n\t}\n\n\tgetGripSpace() {\n\n\t\tif ( this._grip === null ) {\n\n\t\t\tthis._grip = new Group();\n\t\t\tthis._grip.matrixAutoUpdate = false;\n\t\t\tthis._grip.visible = false;\n\t\t\tthis._grip.hasLinearVelocity = false;\n\t\t\tthis._grip.linearVelocity = new Vector3();\n\t\t\tthis._grip.hasAngularVelocity = false;\n\t\t\tthis._grip.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._grip;\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.dispatchEvent( event );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tconnect( inputSource ) {\n\n\t\tif ( inputSource && inputSource.hand ) {\n\n\t\t\tconst hand = this._hand;\n\n\t\t\tif ( hand ) {\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Initialize hand with joints when connected\n\t\t\t\t\tthis._getHandJoint( hand, inputjoint );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect( inputSource ) {\n\n\t\tthis.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.visible = false;\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.visible = false;\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.visible = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tupdate( inputSource, frame, referenceSpace ) {\n\n\t\tlet inputPose = null;\n\t\tlet gripPose = null;\n\t\tlet handPose = null;\n\n\t\tconst targetRay = this._targetRay;\n\t\tconst grip = this._grip;\n\t\tconst hand = this._hand;\n\n\t\tif ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {\n\n\t\t\tif ( hand && inputSource.hand ) {\n\n\t\t\t\thandPose = true;\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Update the joints groups with the XRJoint poses\n\t\t\t\t\tconst jointPose = frame.getJointPose( inputjoint, referenceSpace );\n\n\t\t\t\t\t// The transform of this joint will be updated with the joint pose on each frame\n\t\t\t\t\tconst joint = this._getHandJoint( hand, inputjoint );\n\n\t\t\t\t\tif ( jointPose !== null ) {\n\n\t\t\t\t\t\tjoint.matrix.fromArray( jointPose.transform.matrix );\n\t\t\t\t\t\tjoint.matrix.decompose( joint.position, joint.rotation, joint.scale );\n\t\t\t\t\t\tjoint.matrixWorldNeedsUpdate = true;\n\t\t\t\t\t\tjoint.jointRadius = jointPose.radius;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tjoint.visible = jointPose !== null;\n\n\t\t\t\t}\n\n\t\t\t\t// Custom events\n\n\t\t\t\t// Check pinchz\n\t\t\t\tconst indexTip = hand.joints[ 'index-finger-tip' ];\n\t\t\t\tconst thumbTip = hand.joints[ 'thumb-tip' ];\n\t\t\t\tconst distance = indexTip.position.distanceTo( thumbTip.position );\n\n\t\t\t\tconst distanceToPinch = 0.02;\n\t\t\t\tconst threshold = 0.005;\n\n\t\t\t\tif ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = false;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchend',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t} else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = true;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchstart',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( grip !== null && inputSource.gripSpace ) {\n\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\n\n\t\t\t\t\tif ( gripPose !== null ) {\n\n\t\t\t\t\t\tgrip.matrix.fromArray( gripPose.transform.matrix );\n\t\t\t\t\t\tgrip.matrix.decompose( grip.position, grip.rotation, grip.scale );\n\t\t\t\t\t\tgrip.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\t\tif ( gripPose.linearVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = true;\n\t\t\t\t\t\t\tgrip.linearVelocity.copy( gripPose.linearVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( gripPose.angularVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = true;\n\t\t\t\t\t\t\tgrip.angularVelocity.copy( gripPose.angularVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( targetRay !== null ) {\n\n\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\n\n\t\t\t\t// Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n\t\t\t\tif ( inputPose === null && gripPose !== null ) {\n\n\t\t\t\t\tinputPose = gripPose;\n\n\t\t\t\t}\n\n\t\t\t\tif ( inputPose !== null ) {\n\n\t\t\t\t\ttargetRay.matrix.fromArray( inputPose.transform.matrix );\n\t\t\t\t\ttargetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );\n\t\t\t\t\ttargetRay.matrixWorldNeedsUpdate = true;\n\n\t\t\t\t\tif ( inputPose.linearVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = true;\n\t\t\t\t\t\ttargetRay.linearVelocity.copy( inputPose.linearVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( inputPose.angularVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = true;\n\t\t\t\t\t\ttargetRay.angularVelocity.copy( inputPose.angularVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.dispatchEvent( _moveEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t}\n\n\t\tif ( targetRay !== null ) {\n\n\t\t\ttargetRay.visible = ( inputPose !== null );\n\n\t\t}\n\n\t\tif ( grip !== null ) {\n\n\t\t\tgrip.visible = ( gripPose !== null );\n\n\t\t}\n\n\t\tif ( hand !== null ) {\n\n\t\t\thand.visible = ( handPose !== null );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// private method\n\n\t_getHandJoint( hand, inputjoint ) {\n\n\t\tif ( hand.joints[ inputjoint.jointName ] === undefined ) {\n\n\t\t\tconst joint = new Group();\n\t\t\tjoint.matrixAutoUpdate = false;\n\t\t\tjoint.visible = false;\n\t\t\thand.joints[ inputjoint.jointName ] = joint;\n\n\t\t\thand.add( joint );\n\n\t\t}\n\n\t\treturn hand.joints[ inputjoint.jointName ];\n\n\t}\n\n}\n\nclass WebXRManager extends EventDispatcher {\n\n\tconstructor( renderer, gl ) {\n\n\t\tsuper();\n\n\t\tconst scope = this;\n\n\t\tlet session = null;\n\n\t\tlet framebufferScaleFactor = 1.0;\n\n\t\tlet referenceSpace = null;\n\t\tlet referenceSpaceType = 'local-floor';\n\t\t// Set default foveation to maximum.\n\t\tlet foveation = 1.0;\n\t\tlet customReferenceSpace = null;\n\n\t\tlet pose = null;\n\t\tlet glBinding = null;\n\t\tlet glProjLayer = null;\n\t\tlet glBaseLayer = null;\n\t\tlet xrFrame = null;\n\t\tconst attributes = gl.getContextAttributes();\n\t\tlet initialRenderTarget = null;\n\t\tlet newRenderTarget = null;\n\n\t\tconst controllers = [];\n\t\tconst controllerInputSources = [];\n\n\t\tconst currentSize = new Vector2();\n\t\tlet currentPixelRatio = null;\n\n\t\t//\n\n\t\tconst cameraL = new PerspectiveCamera();\n\t\tcameraL.layers.enable( 1 );\n\t\tcameraL.viewport = new Vector4();\n\n\t\tconst cameraR = new PerspectiveCamera();\n\t\tcameraR.layers.enable( 2 );\n\t\tcameraR.viewport = new Vector4();\n\n\t\tconst cameras = [ cameraL, cameraR ];\n\n\t\tconst cameraXR = new ArrayCamera();\n\t\tcameraXR.layers.enable( 1 );\n\t\tcameraXR.layers.enable( 2 );\n\n\t\tlet _currentDepthNear = null;\n\t\tlet _currentDepthFar = null;\n\n\t\t//\n\n\t\tthis.cameraAutoUpdate = true;\n\t\tthis.enabled = false;\n\n\t\tthis.isPresenting = false;\n\n\t\tthis.getController = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getTargetRaySpace();\n\n\t\t};\n\n\t\tthis.getControllerGrip = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getGripSpace();\n\n\t\t};\n\n\t\tthis.getHand = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getHandSpace();\n\n\t\t};\n\n\t\t//\n\n\t\tfunction onSessionEvent( event ) {\n\n\t\t\tconst controllerIndex = controllerInputSources.indexOf( event.inputSource );\n\n\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\tif ( controller !== undefined ) {\n\n\t\t\t\tcontroller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );\n\t\t\t\tcontroller.dispatchEvent( { type: event.type, data: event.inputSource } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onSessionEnd() {\n\n\t\t\tsession.removeEventListener( 'select', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectstart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'selectend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeeze', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezestart', onSessionEvent );\n\t\t\tsession.removeEventListener( 'squeezeend', onSessionEvent );\n\t\t\tsession.removeEventListener( 'end', onSessionEnd );\n\t\t\tsession.removeEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\n\t\t\t\tif ( inputSource === null ) continue;\n\n\t\t\t\tcontrollerInputSources[ i ] = null;\n\n\t\t\t\tcontrollers[ i ].disconnect( inputSource );\n\n\t\t\t}\n\n\t\t\t_currentDepthNear = null;\n\t\t\t_currentDepthFar = null;\n\n\t\t\t// restore framebuffer/rendering state\n\n\t\t\trenderer.setRenderTarget( initialRenderTarget );\n\n\t\t\tglBaseLayer = null;\n\t\t\tglProjLayer = null;\n\t\t\tglBinding = null;\n\t\t\tsession = null;\n\t\t\tnewRenderTarget = null;\n\n\t\t\t//\n\n\t\t\tanimation.stop();\n\n\t\t\tscope.isPresenting = false;\n\n\t\t\trenderer.setPixelRatio( currentPixelRatio );\n\t\t\trenderer.setSize( currentSize.width, currentSize.height, false );\n\n\t\t\tscope.dispatchEvent( { type: 'sessionend' } );\n\n\t\t}\n\n\t\tthis.setFramebufferScaleFactor = function ( value ) {\n\n\t\t\tframebufferScaleFactor = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setReferenceSpaceType = function ( value ) {\n\n\t\t\treferenceSpaceType = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change reference space type while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getReferenceSpace = function () {\n\n\t\t\treturn customReferenceSpace || referenceSpace;\n\n\t\t};\n\n\t\tthis.setReferenceSpace = function ( space ) {\n\n\t\t\tcustomReferenceSpace = space;\n\n\t\t};\n\n\t\tthis.getBaseLayer = function () {\n\n\t\t\treturn glProjLayer !== null ? glProjLayer : glBaseLayer;\n\n\t\t};\n\n\t\tthis.getBinding = function () {\n\n\t\t\treturn glBinding;\n\n\t\t};\n\n\t\tthis.getFrame = function () {\n\n\t\t\treturn xrFrame;\n\n\t\t};\n\n\t\tthis.getSession = function () {\n\n\t\t\treturn session;\n\n\t\t};\n\n\t\tthis.setSession = async function ( value ) {\n\n\t\t\tsession = value;\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\tinitialRenderTarget = renderer.getRenderTarget();\n\n\t\t\t\tsession.addEventListener( 'select', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'end', onSessionEnd );\n\t\t\t\tsession.addEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\t\tif ( attributes.xrCompatible !== true ) {\n\n\t\t\t\t\tawait gl.makeXRCompatible();\n\n\t\t\t\t}\n\n\t\t\t\tcurrentPixelRatio = renderer.getPixelRatio();\n\t\t\t\trenderer.getSize( currentSize );\n\n\t\t\t\tif ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,\n\t\t\t\t\t\talpha: true,\n\t\t\t\t\t\tdepth: attributes.depth,\n\t\t\t\t\t\tstencil: attributes.stencil,\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\t\t\tsession.updateRenderState( { baseLayer: glBaseLayer } );\n\n\t\t\t\t\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglBaseLayer.framebufferWidth,\n\t\t\t\t\t\tglBaseLayer.framebufferHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlet depthFormat = null;\n\t\t\t\t\tlet depthType = null;\n\t\t\t\t\tlet glDepthFormat = null;\n\n\t\t\t\t\tif ( attributes.depth ) {\n\n\t\t\t\t\t\tglDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;\n\t\t\t\t\t\tdepthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;\n\t\t\t\t\t\tdepthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst projectionlayerInit = {\n\t\t\t\t\t\tcolorFormat: gl.RGBA8,\n\t\t\t\t\t\tdepthFormat: glDepthFormat,\n\t\t\t\t\t\tscaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBinding = new XRWebGLBinding( session, gl );\n\n\t\t\t\t\tglProjLayer = glBinding.createProjectionLayer( projectionlayerInit );\n\n\t\t\t\t\tsession.updateRenderState( { layers: [ glProjLayer ] } );\n\n\t\t\t\t\trenderer.setPixelRatio( 1 );\n\t\t\t\t\trenderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );\n\n\t\t\t\t\tnewRenderTarget = new WebGLRenderTarget(\n\t\t\t\t\t\tglProjLayer.textureWidth,\n\t\t\t\t\t\tglProjLayer.textureHeight,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tformat: RGBAFormat,\n\t\t\t\t\t\t\ttype: UnsignedByteType,\n\t\t\t\t\t\t\tdepthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),\n\t\t\t\t\t\t\tstencilBuffer: attributes.stencil,\n\t\t\t\t\t\t\tcolorSpace: renderer.outputColorSpace,\n\t\t\t\t\t\t\tsamples: attributes.antialias ? 4 : 0\n\t\t\t\t\t\t} );\n\n\t\t\t\t\tconst renderTargetProperties = renderer.properties.get( newRenderTarget );\n\t\t\t\t\trenderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;\n\n\t\t\t\t}\n\n\t\t\t\tnewRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n\n\t\t\t\tthis.setFoveation( foveation );\n\n\t\t\t\tcustomReferenceSpace = null;\n\t\t\t\treferenceSpace = await session.requestReferenceSpace( referenceSpaceType );\n\n\t\t\t\tanimation.setContext( session );\n\t\t\t\tanimation.start();\n\n\t\t\t\tscope.isPresenting = true;\n\n\t\t\t\tscope.dispatchEvent( { type: 'sessionstart' } );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getEnvironmentBlendMode = function () {\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\treturn session.environmentBlendMode;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction onInputSourcesChange( event ) {\n\n\t\t\t// Notify disconnected\n\n\t\t\tfor ( let i = 0; i < event.removed.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.removed[ i ];\n\t\t\t\tconst index = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( index >= 0 ) {\n\n\t\t\t\t\tcontrollerInputSources[ index ] = null;\n\t\t\t\t\tcontrollers[ index ].disconnect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Notify connected\n\n\t\t\tfor ( let i = 0; i < event.added.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.added[ i ];\n\n\t\t\t\tlet controllerIndex = controllerInputSources.indexOf( inputSource );\n\n\t\t\t\tif ( controllerIndex === - 1 ) {\n\n\t\t\t\t\t// Assign input source a controller that currently has no input source\n\n\t\t\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\t\t\tif ( i >= controllerInputSources.length ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources.push( inputSource );\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t} else if ( controllerInputSources[ i ] === null ) {\n\n\t\t\t\t\t\t\tcontrollerInputSources[ i ] = inputSource;\n\t\t\t\t\t\t\tcontrollerIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// If all controllers do currently receive input we ignore new ones\n\n\t\t\t\t\tif ( controllerIndex === - 1 ) break;\n\n\t\t\t\t}\n\n\t\t\t\tconst controller = controllers[ controllerIndex ];\n\n\t\t\t\tif ( controller ) {\n\n\t\t\t\t\tcontroller.connect( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst cameraLPos = new Vector3();\n\t\tconst cameraRPos = new Vector3();\n\n\t\t/**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t */\n\t\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\n\n\t\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\n\t\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\n\n\t\t\tconst ipd = cameraLPos.distanceTo( cameraRPos );\n\n\t\t\tconst projL = cameraL.projectionMatrix.elements;\n\t\t\tconst projR = cameraR.projectionMatrix.elements;\n\n\t\t\t// VR systems will have identical far and near planes, and\n\t\t\t// most likely identical top and bottom frustum extents.\n\t\t\t// Use the left camera for these values.\n\t\t\tconst near = projL[ 14 ] / ( projL[ 10 ] - 1 );\n\t\t\tconst far = projL[ 14 ] / ( projL[ 10 ] + 1 );\n\t\t\tconst topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\n\t\t\tconst bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\n\n\t\t\tconst leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\n\t\t\tconst rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\n\t\t\tconst left = near * leftFov;\n\t\t\tconst right = near * rightFov;\n\n\t\t\t// Calculate the new camera's position offset from the\n\t\t\t// left camera. xOffset should be roughly half `ipd`.\n\t\t\tconst zOffset = ipd / ( - leftFov + rightFov );\n\t\t\tconst xOffset = zOffset * - leftFov;\n\n\t\t\t// TODO: Better way to apply this offset?\n\t\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.translateX( xOffset );\n\t\t\tcamera.translateZ( zOffset );\n\t\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t\t// Find the union of the frustum values of the cameras and scale\n\t\t\t// the values so that the near plane's position does not change in world space,\n\t\t\t// although must now be relative to the new union camera.\n\t\t\tconst near2 = near + zOffset;\n\t\t\tconst far2 = far + zOffset;\n\t\t\tconst left2 = left - xOffset;\n\t\t\tconst right2 = right + ( ipd - xOffset );\n\t\t\tconst top2 = topFov * far / far2 * near2;\n\t\t\tconst bottom2 = bottomFov * far / far2 * near2;\n\n\t\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\n\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\n\t\t}\n\n\t\tfunction updateCamera( camera, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrixWorld.copy( camera.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\n\n\t\t\t}\n\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t}\n\n\t\tthis.updateCamera = function ( camera ) {\n\n\t\t\tif ( session === null ) return;\n\n\t\t\tcameraXR.near = cameraR.near = cameraL.near = camera.near;\n\t\t\tcameraXR.far = cameraR.far = cameraL.far = camera.far;\n\n\t\t\tif ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {\n\n\t\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\n\n\t\t\t\tsession.updateRenderState( {\n\t\t\t\t\tdepthNear: cameraXR.near,\n\t\t\t\t\tdepthFar: cameraXR.far\n\t\t\t\t} );\n\n\t\t\t\t_currentDepthNear = cameraXR.near;\n\t\t\t\t_currentDepthFar = cameraXR.far;\n\n\t\t\t}\n\n\t\t\tconst parent = camera.parent;\n\t\t\tconst cameras = cameraXR.cameras;\n\n\t\t\tupdateCamera( cameraXR, parent );\n\n\t\t\tfor ( let i = 0; i < cameras.length; i ++ ) {\n\n\t\t\t\tupdateCamera( cameras[ i ], parent );\n\n\t\t\t}\n\n\t\t\t// update projection matrix for proper view frustum culling\n\n\t\t\tif ( cameras.length === 2 ) {\n\n\t\t\t\tsetProjectionFromUnion( cameraXR, cameraL, cameraR );\n\n\t\t\t} else {\n\n\t\t\t\t// assume single camera setup (AR)\n\n\t\t\t\tcameraXR.projectionMatrix.copy( cameraL.projectionMatrix );\n\n\t\t\t}\n\n\t\t\t// update user camera and its children\n\n\t\t\tupdateUserCamera( camera, cameraXR, parent );\n\n\t\t};\n\n\t\tfunction updateUserCamera( camera, cameraXR, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrix.copy( cameraXR.matrixWorld );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrix.copy( parent.matrixWorld );\n\t\t\t\tcamera.matrix.invert();\n\t\t\t\tcamera.matrix.multiply( cameraXR.matrixWorld );\n\n\t\t\t}\n\n\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.updateMatrixWorld( true );\n\n\t\t\tcamera.projectionMatrix.copy( cameraXR.projectionMatrix );\n\t\t\tcamera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );\n\n\t\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\t\tcamera.fov = RAD2DEG * 2 * Math.atan( 1 / camera.projectionMatrix.elements[ 5 ] );\n\t\t\t\tcamera.zoom = 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.getCamera = function () {\n\n\t\t\treturn cameraXR;\n\n\t\t};\n\n\t\tthis.getFoveation = function () {\n\n\t\t\tif ( glProjLayer === null && glBaseLayer === null ) {\n\n\t\t\t\treturn undefined;\n\n\t\t\t}\n\n\t\t\treturn foveation;\n\n\t\t};\n\n\t\tthis.setFoveation = function ( value ) {\n\n\t\t\t// 0 = no foveation = full resolution\n\t\t\t// 1 = maximum foveation = the edges render at lower resolution\n\n\t\t\tfoveation = value;\n\n\t\t\tif ( glProjLayer !== null ) {\n\n\t\t\t\tglProjLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t\tif ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) {\n\n\t\t\t\tglBaseLayer.fixedFoveation = value;\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time, frame ) {\n\n\t\t\tpose = frame.getViewerPose( customReferenceSpace || referenceSpace );\n\t\t\txrFrame = frame;\n\n\t\t\tif ( pose !== null ) {\n\n\t\t\t\tconst views = pose.views;\n\n\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\trenderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );\n\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t}\n\n\t\t\t\tlet cameraXRNeedsUpdate = false;\n\n\t\t\t\t// check if it's necessary to rebuild cameraXR's camera list\n\n\t\t\t\tif ( views.length !== cameraXR.cameras.length ) {\n\n\t\t\t\t\tcameraXR.cameras.length = 0;\n\t\t\t\t\tcameraXRNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\n\n\t\t\t\t\tconst view = views[ i ];\n\n\t\t\t\t\tlet viewport = null;\n\n\t\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\t\tviewport = glBaseLayer.getViewport( view );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst glSubImage = glBinding.getViewSubImage( glProjLayer, view );\n\t\t\t\t\t\tviewport = glSubImage.viewport;\n\n\t\t\t\t\t\t// For side-by-side projection, we only produce a single texture for both eyes.\n\t\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\t\trenderer.setRenderTargetTextures(\n\t\t\t\t\t\t\t\tnewRenderTarget,\n\t\t\t\t\t\t\t\tglSubImage.colorTexture,\n\t\t\t\t\t\t\t\tglProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );\n\n\t\t\t\t\t\t\trenderer.setRenderTarget( newRenderTarget );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlet camera = cameras[ i ];\n\n\t\t\t\t\tif ( camera === undefined ) {\n\n\t\t\t\t\t\tcamera = new PerspectiveCamera();\n\t\t\t\t\t\tcamera.layers.enable( i );\n\t\t\t\t\t\tcamera.viewport = new Vector4();\n\t\t\t\t\t\tcameras[ i ] = camera;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\n\t\t\t\t\tcamera.matrix.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\n\t\t\t\t\tcamera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();\n\t\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\n\n\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\tcameraXR.matrix.copy( camera.matrix );\n\t\t\t\t\t\tcameraXR.matrix.decompose( cameraXR.position, cameraXR.quaternion, cameraXR.scale );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( cameraXRNeedsUpdate === true ) {\n\n\t\t\t\t\t\tcameraXR.cameras.push( camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst inputSource = controllerInputSources[ i ];\n\t\t\t\tconst controller = controllers[ i ];\n\n\t\t\t\tif ( inputSource !== null && controller !== undefined ) {\n\n\t\t\t\t\tcontroller.update( inputSource, frame, customReferenceSpace || referenceSpace );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\n\n\t\t\tif ( frame.detectedPlanes ) {\n\n\t\t\t\tscope.dispatchEvent( { type: 'planesdetected', data: frame } );\n\n\t\t\t}\n\n\t\t\txrFrame = null;\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\n\t\t};\n\n\t\tthis.dispose = function () {};\n\n\t}\n\n}\n\nfunction WebGLMaterials( renderer, properties ) {\n\n\tfunction refreshTransformUniform( map, uniform ) {\n\n\t\tif ( map.matrixAutoUpdate === true ) {\n\n\t\t\tmap.updateMatrix();\n\n\t\t}\n\n\t\tuniform.value.copy( map.matrix );\n\n\t}\n\n\tfunction refreshFogUniforms( uniforms, fog ) {\n\n\t\tfog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );\n\n\t\tif ( fog.isFog ) {\n\n\t\t\tuniforms.fogNear.value = fog.near;\n\t\t\tuniforms.fogFar.value = fog.far;\n\n\t\t} else if ( fog.isFogExp2 ) {\n\n\t\t\tuniforms.fogDensity.value = fog.density;\n\n\t\t}\n\n\t}\n\n\tfunction refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {\n\n\t\tif ( material.isMeshBasicMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshLambertMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshToonMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsToon( uniforms, material );\n\n\t\t} else if ( material.isMeshPhongMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsPhong( uniforms, material );\n\n\t\t} else if ( material.isMeshStandardMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsStandard( uniforms, material );\n\n\t\t\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\t\t\trefreshUniformsPhysical( uniforms, material, transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshMatcapMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsMatcap( uniforms, material );\n\n\t\t} else if ( material.isMeshDepthMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshDistanceMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsDistance( uniforms, material );\n\n\t\t} else if ( material.isMeshNormalMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isLineBasicMaterial ) {\n\n\t\t\trefreshUniformsLine( uniforms, material );\n\n\t\t\tif ( material.isLineDashedMaterial ) {\n\n\t\t\t\trefreshUniformsDash( uniforms, material );\n\n\t\t\t}\n\n\t\t} else if ( material.isPointsMaterial ) {\n\n\t\t\trefreshUniformsPoints( uniforms, material, pixelRatio, height );\n\n\t\t} else if ( material.isSpriteMaterial ) {\n\n\t\t\trefreshUniformsSprites( uniforms, material );\n\n\t\t} else if ( material.isShadowMaterial ) {\n\n\t\t\tuniforms.color.value.copy( material.color );\n\t\t\tuniforms.opacity.value = material.opacity;\n\n\t\t} else if ( material.isShaderMaterial ) {\n\n\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsCommon( uniforms, material ) {\n\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.color ) {\n\n\t\t\tuniforms.diffuse.value.copy( material.color );\n\n\t\t}\n\n\t\tif ( material.emissive ) {\n\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\n\n\t\t}\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\n\t\t\trefreshTransformUniform( material.bumpMap, uniforms.bumpMapTransform );\n\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.bumpScale.value *= - 1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\n\t\t\trefreshTransformUniform( material.normalMap, uniforms.normalMapTransform );\n\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\n\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\tuniforms.normalScale.value.negate();\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\n\t\t\trefreshTransformUniform( material.displacementMap, uniforms.displacementMapTransform );\n\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t\trefreshTransformUniform( material.emissiveMap, uniforms.emissiveMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularMap ) {\n\n\t\t\tuniforms.specularMap.value = material.specularMap;\n\n\t\t\trefreshTransformUniform( material.specularMap, uniforms.specularMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\tuniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\n\t\t\tuniforms.ior.value = material.ior;\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\n\n\t\t}\n\n\t\tif ( material.lightMap ) {\n\n\t\t\tuniforms.lightMap.value = material.lightMap;\n\n\t\t\t// artist-friendly light intensity scaling factor\n\t\t\tconst scaleFactor = ( renderer._useLegacyLights === true ) ? Math.PI : 1;\n\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;\n\n\t\t\trefreshTransformUniform( material.lightMap, uniforms.lightMapTransform );\n\n\t\t}\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuniforms.aoMap.value = material.aoMap;\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\n\n\t\t\trefreshTransformUniform( material.aoMap, uniforms.aoMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLine( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDash( uniforms, material ) {\n\n\t\tuniforms.dashSize.value = material.dashSize;\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\n\t\tuniforms.scale.value = material.scale;\n\n\t}\n\n\tfunction refreshUniformsPoints( uniforms, material, pixelRatio, height ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.size.value = material.size * pixelRatio;\n\t\tuniforms.scale.value = height * 0.5;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.uvTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsSprites( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.rotation.value = material.rotation;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t\trefreshTransformUniform( material.map, uniforms.mapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t\trefreshTransformUniform( material.alphaMap, uniforms.alphaMapTransform );\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhong( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t}\n\n\tfunction refreshUniformsToon( uniforms, material ) {\n\n\t\tif ( material.gradientMap ) {\n\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsStandard( uniforms, material ) {\n\n\t\tuniforms.metalness.value = material.metalness;\n\n\t\tif ( material.metalnessMap ) {\n\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\n\n\t\t\trefreshTransformUniform( material.metalnessMap, uniforms.metalnessMapTransform );\n\n\t\t}\n\n\t\tuniforms.roughness.value = material.roughness;\n\n\t\tif ( material.roughnessMap ) {\n\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\n\n\t\t\trefreshTransformUniform( material.roughnessMap, uniforms.roughnessMapTransform );\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhysical( uniforms, material, transmissionRenderTarget ) {\n\n\t\tuniforms.ior.value = material.ior; // also part of uniforms common\n\n\t\tif ( material.sheen > 0 ) {\n\n\t\t\tuniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );\n\n\t\t\tuniforms.sheenRoughness.value = material.sheenRoughness;\n\n\t\t\tif ( material.sheenColorMap ) {\n\n\t\t\t\tuniforms.sheenColorMap.value = material.sheenColorMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenColorMap, uniforms.sheenColorMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.sheenRoughnessMap ) {\n\n\t\t\t\tuniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.clearcoat > 0 ) {\n\n\t\t\tuniforms.clearcoat.value = material.clearcoat;\n\t\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n\n\t\t\tif ( material.clearcoatMap ) {\n\n\t\t\t\tuniforms.clearcoatMap.value = material.clearcoatMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatMap, uniforms.clearcoatMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatRoughnessMap ) {\n\n\t\t\t\tuniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n\n\t\t\t\trefreshTransformUniform( material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform );\n\n\t\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\n\n\t\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.iridescence > 0 ) {\n\n\t\t\tuniforms.iridescence.value = material.iridescence;\n\t\t\tuniforms.iridescenceIOR.value = material.iridescenceIOR;\n\t\t\tuniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[ 0 ];\n\t\t\tuniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[ 1 ];\n\n\t\t\tif ( material.iridescenceMap ) {\n\n\t\t\t\tuniforms.iridescenceMap.value = material.iridescenceMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceMap, uniforms.iridescenceMapTransform );\n\n\t\t\t}\n\n\t\t\tif ( material.iridescenceThicknessMap ) {\n\n\t\t\t\tuniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.transmission > 0 ) {\n\n\t\t\tuniforms.transmission.value = material.transmission;\n\t\t\tuniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n\t\t\tuniforms.transmissionSamplerSize.value.set( transmissionRenderTarget.width, transmissionRenderTarget.height );\n\n\t\t\tif ( material.transmissionMap ) {\n\n\t\t\t\tuniforms.transmissionMap.value = material.transmissionMap;\n\n\t\t\t\trefreshTransformUniform( material.transmissionMap, uniforms.transmissionMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.thickness.value = material.thickness;\n\n\t\t\tif ( material.thicknessMap ) {\n\n\t\t\t\tuniforms.thicknessMap.value = material.thicknessMap;\n\n\t\t\t\trefreshTransformUniform( material.thicknessMap, uniforms.thicknessMapTransform );\n\n\t\t\t}\n\n\t\t\tuniforms.attenuationDistance.value = material.attenuationDistance;\n\t\t\tuniforms.attenuationColor.value.copy( material.attenuationColor );\n\n\t\t}\n\n\t\tif ( material.anisotropy > 0 ) {\n\n\t\t\tuniforms.anisotropyVector.value.set( material.anisotropy * Math.cos( material.anisotropyRotation ), material.anisotropy * Math.sin( material.anisotropyRotation ) );\n\n\t\t\tif ( material.anisotropyMap ) {\n\n\t\t\t\tuniforms.anisotropyMap.value = material.anisotropyMap;\n\n\t\t\t\trefreshTransformUniform( material.anisotropyMap, uniforms.anisotropyMapTransform );\n\n\t\t\t}\n\n\t\t}\n\n\t\tuniforms.specularIntensity.value = material.specularIntensity;\n\t\tuniforms.specularColor.value.copy( material.specularColor );\n\n\t\tif ( material.specularColorMap ) {\n\n\t\t\tuniforms.specularColorMap.value = material.specularColorMap;\n\n\t\t\trefreshTransformUniform( material.specularColorMap, uniforms.specularColorMapTransform );\n\n\t\t}\n\n\t\tif ( material.specularIntensityMap ) {\n\n\t\t\tuniforms.specularIntensityMap.value = material.specularIntensityMap;\n\n\t\t\trefreshTransformUniform( material.specularIntensityMap, uniforms.specularIntensityMapTransform );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsMatcap( uniforms, material ) {\n\n\t\tif ( material.matcap ) {\n\n\t\t\tuniforms.matcap.value = material.matcap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDistance( uniforms, material ) {\n\n\t\tconst light = properties.get( material ).light;\n\n\t\tuniforms.referencePosition.value.setFromMatrixPosition( light.matrixWorld );\n\t\tuniforms.nearDistance.value = light.shadow.camera.near;\n\t\tuniforms.farDistance.value = light.shadow.camera.far;\n\n\t}\n\n\treturn {\n\t\trefreshFogUniforms: refreshFogUniforms,\n\t\trefreshMaterialUniforms: refreshMaterialUniforms\n\t};\n\n}\n\nfunction WebGLUniformsGroups( gl, info, capabilities, state ) {\n\n\tlet buffers = {};\n\tlet updateList = {};\n\tlet allocatedBindingPoints = [];\n\n\tconst maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ) : 0; // binding points are global whereas block indices are per shader program\n\n\tfunction bind( uniformsGroup, program ) {\n\n\t\tconst webglProgram = program.program;\n\t\tstate.uniformBlockBinding( uniformsGroup, webglProgram );\n\n\t}\n\n\tfunction update( uniformsGroup, program ) {\n\n\t\tlet buffer = buffers[ uniformsGroup.id ];\n\n\t\tif ( buffer === undefined ) {\n\n\t\t\tprepareUniformsGroup( uniformsGroup );\n\n\t\t\tbuffer = createBuffer( uniformsGroup );\n\t\t\tbuffers[ uniformsGroup.id ] = buffer;\n\n\t\t\tuniformsGroup.addEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\t}\n\n\t\t// ensure to update the binding points/block indices mapping for this program\n\n\t\tconst webglProgram = program.program;\n\t\tstate.updateUBOMapping( uniformsGroup, webglProgram );\n\n\t\t// update UBO once per frame\n\n\t\tconst frame = info.render.frame;\n\n\t\tif ( updateList[ uniformsGroup.id ] !== frame ) {\n\n\t\t\tupdateBufferData( uniformsGroup );\n\n\t\t\tupdateList[ uniformsGroup.id ] = frame;\n\n\t\t}\n\n\t}\n\n\tfunction createBuffer( uniformsGroup ) {\n\n\t\t// the setup of an UBO is independent of a particular shader program but global\n\n\t\tconst bindingPointIndex = allocateBindingPointIndex();\n\t\tuniformsGroup.__bindingPointIndex = bindingPointIndex;\n\n\t\tconst buffer = gl.createBuffer();\n\t\tconst size = uniformsGroup.__size;\n\t\tconst usage = uniformsGroup.usage;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\t\tgl.bufferData( gl.UNIFORM_BUFFER, size, usage );\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\t\tgl.bindBufferBase( gl.UNIFORM_BUFFER, bindingPointIndex, buffer );\n\n\t\treturn buffer;\n\n\t}\n\n\tfunction allocateBindingPointIndex() {\n\n\t\tfor ( let i = 0; i < maxBindingPoints; i ++ ) {\n\n\t\t\tif ( allocatedBindingPoints.indexOf( i ) === - 1 ) {\n\n\t\t\t\tallocatedBindingPoints.push( i );\n\t\t\t\treturn i;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconsole.error( 'THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );\n\n\t\treturn 0;\n\n\t}\n\n\tfunction updateBufferData( uniformsGroup ) {\n\n\t\tconst buffer = buffers[ uniformsGroup.id ];\n\t\tconst uniforms = uniformsGroup.uniforms;\n\t\tconst cache = uniformsGroup.__cache;\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, buffer );\n\n\t\tfor ( let i = 0, il = uniforms.length; i < il; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tif ( hasUniformChanged( uniform, i, j, cache ) === true ) {\n\n\t\t\t\t\tconst offset = uniform.__offset;\n\n\t\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\t\tlet arrayOffset = 0;\n\n\t\t\t\t\tfor ( let k = 0; k < values.length; k ++ ) {\n\n\t\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t\t// TODO add integer and struct support\n\t\t\t\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value;\n\t\t\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );\n\n\t\t\t\t\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t\t\t\t\t// manually converting 3x3 to 3x4\n\n\t\t\t\t\t\t\tuniform.__data[ 0 ] = value.elements[ 0 ];\n\t\t\t\t\t\t\tuniform.__data[ 1 ] = value.elements[ 1 ];\n\t\t\t\t\t\t\tuniform.__data[ 2 ] = value.elements[ 2 ];\n\t\t\t\t\t\t\tuniform.__data[ 3 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 4 ] = value.elements[ 3 ];\n\t\t\t\t\t\t\tuniform.__data[ 5 ] = value.elements[ 4 ];\n\t\t\t\t\t\t\tuniform.__data[ 6 ] = value.elements[ 5 ];\n\t\t\t\t\t\t\tuniform.__data[ 7 ] = 0;\n\t\t\t\t\t\t\tuniform.__data[ 8 ] = value.elements[ 6 ];\n\t\t\t\t\t\t\tuniform.__data[ 9 ] = value.elements[ 7 ];\n\t\t\t\t\t\t\tuniform.__data[ 10 ] = value.elements[ 8 ];\n\t\t\t\t\t\t\tuniform.__data[ 11 ] = 0;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tvalue.toArray( uniform.__data, arrayOffset );\n\n\t\t\t\t\t\t\tarrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tgl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tgl.bindBuffer( gl.UNIFORM_BUFFER, null );\n\n\t}\n\n\tfunction hasUniformChanged( uniform, index, indexArray, cache ) {\n\n\t\tconst value = uniform.value;\n\t\tconst indexString = index + '_' + indexArray;\n\n\t\tif ( cache[ indexString ] === undefined ) {\n\n\t\t\t// cache entry does not exist so far\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tcache[ indexString ] = value;\n\n\t\t\t} else {\n\n\t\t\t\tcache[ indexString ] = value.clone();\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t} else {\n\n\t\t\tconst cachedObject = cache[ indexString ];\n\n\t\t\t// compare current value with cached entry\n\n\t\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t\tif ( cachedObject !== value ) {\n\n\t\t\t\t\tcache[ indexString ] = value;\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( cachedObject.equals( value ) === false ) {\n\n\t\t\t\t\tcachedObject.copy( value );\n\t\t\t\t\treturn true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction prepareUniformsGroup( uniformsGroup ) {\n\n\t\t// determine total buffer size according to the STD140 layout\n\t\t// Hint: STD140 is the only supported layout in WebGL 2\n\n\t\tconst uniforms = uniformsGroup.uniforms;\n\n\t\tlet offset = 0; // global buffer offset in bytes\n\t\tconst chunkSize = 16; // size of a chunk in bytes\n\n\t\tfor ( let i = 0, l = uniforms.length; i < l; i ++ ) {\n\n\t\t\tconst uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];\n\n\t\t\tfor ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {\n\n\t\t\t\tconst uniform = uniformArray[ j ];\n\n\t\t\t\tconst values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];\n\n\t\t\t\tfor ( let k = 0, kl = values.length; k < kl; k ++ ) {\n\n\t\t\t\t\tconst value = values[ k ];\n\n\t\t\t\t\tconst info = getUniformSize( value );\n\n\t\t\t\t\t// Calculate the chunk offset\n\t\t\t\t\tconst chunkOffsetUniform = offset % chunkSize;\n\n\t\t\t\t\t// Check for chunk overflow\n\t\t\t\t\tif ( chunkOffsetUniform !== 0 && ( chunkSize - chunkOffsetUniform ) < info.boundary ) {\n\n\t\t\t\t\t\t// Add padding and adjust offset\n\t\t\t\t\t\toffset += ( chunkSize - chunkOffsetUniform );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following two properties will be used for partial buffer updates\n\n\t\t\t\t\tuniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );\n\t\t\t\t\tuniform.__offset = offset;\n\n\n\t\t\t\t\t// Update the global offset\n\t\t\t\t\toffset += info.storage;\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// ensure correct final padding\n\n\t\tconst chunkOffset = offset % chunkSize;\n\n\t\tif ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );\n\n\t\t//\n\n\t\tuniformsGroup.__size = offset;\n\t\tuniformsGroup.__cache = {};\n\n\t\treturn this;\n\n\t}\n\n\tfunction getUniformSize( value ) {\n\n\t\tconst info = {\n\t\t\tboundary: 0, // bytes\n\t\t\tstorage: 0 // bytes\n\t\t};\n\n\t\t// determine sizes according to STD140\n\n\t\tif ( typeof value === 'number' || typeof value === 'boolean' ) {\n\n\t\t\t// float/int/bool\n\n\t\t\tinfo.boundary = 4;\n\t\t\tinfo.storage = 4;\n\n\t\t} else if ( value.isVector2 ) {\n\n\t\t\t// vec2\n\n\t\t\tinfo.boundary = 8;\n\t\t\tinfo.storage = 8;\n\n\t\t} else if ( value.isVector3 || value.isColor ) {\n\n\t\t\t// vec3\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n\n\t\t} else if ( value.isVector4 ) {\n\n\t\t\t// vec4\n\n\t\t\tinfo.boundary = 16;\n\t\t\tinfo.storage = 16;\n\n\t\t} else if ( value.isMatrix3 ) {\n\n\t\t\t// mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n\n\t\t\tinfo.boundary = 48;\n\t\t\tinfo.storage = 48;\n\n\t\t} else if ( value.isMatrix4 ) {\n\n\t\t\t// mat4\n\n\t\t\tinfo.boundary = 64;\n\t\t\tinfo.storage = 64;\n\n\t\t} else if ( value.isTexture ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.' );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unsupported uniform value type.', value );\n\n\t\t}\n\n\t\treturn info;\n\n\t}\n\n\tfunction onUniformsGroupsDispose( event ) {\n\n\t\tconst uniformsGroup = event.target;\n\n\t\tuniformsGroup.removeEventListener( 'dispose', onUniformsGroupsDispose );\n\n\t\tconst index = allocatedBindingPoints.indexOf( uniformsGroup.__bindingPointIndex );\n\t\tallocatedBindingPoints.splice( index, 1 );\n\n\t\tgl.deleteBuffer( buffers[ uniformsGroup.id ] );\n\n\t\tdelete buffers[ uniformsGroup.id ];\n\t\tdelete updateList[ uniformsGroup.id ];\n\n\t}\n\n\tfunction dispose() {\n\n\t\tfor ( const id in buffers ) {\n\n\t\t\tgl.deleteBuffer( buffers[ id ] );\n\n\t\t}\n\n\t\tallocatedBindingPoints = [];\n\t\tbuffers = {};\n\t\tupdateList = {};\n\n\t}\n\n\treturn {\n\n\t\tbind: bind,\n\t\tupdate: update,\n\n\t\tdispose: dispose\n\n\t};\n\n}\n\nclass WebGLRenderer {\n\n\tconstructor( parameters = {} ) {\n\n\t\tconst {\n\t\t\tcanvas = createCanvasElement(),\n\t\t\tcontext = null,\n\t\t\tdepth = true,\n\t\t\tstencil = true,\n\t\t\talpha = false,\n\t\t\tantialias = false,\n\t\t\tpremultipliedAlpha = true,\n\t\t\tpreserveDrawingBuffer = false,\n\t\t\tpowerPreference = 'default',\n\t\t\tfailIfMajorPerformanceCaveat = false,\n\t\t} = parameters;\n\n\t\tthis.isWebGLRenderer = true;\n\n\t\tlet _alpha;\n\n\t\tif ( context !== null ) {\n\n\t\t\t_alpha = context.getContextAttributes().alpha;\n\n\t\t} else {\n\n\t\t\t_alpha = alpha;\n\n\t\t}\n\n\t\tconst uintClearColor = new Uint32Array( 4 );\n\t\tconst intClearColor = new Int32Array( 4 );\n\n\t\tlet currentRenderList = null;\n\t\tlet currentRenderState = null;\n\n\t\t// render() can be called from within a callback triggered by another render.\n\t\t// We track this so that the nested render call gets its list and state isolated from the parent render call.\n\n\t\tconst renderListStack = [];\n\t\tconst renderStateStack = [];\n\n\t\t// public properties\n\n\t\tthis.domElement = canvas;\n\n\t\t// Debug configuration container\n\t\tthis.debug = {\n\n\t\t\t/**\n\t\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tcheckShaderErrors: true,\n\t\t\t/**\n\t\t\t * Callback for custom error reporting.\n\t\t\t * @type {?Function}\n\t\t\t */\n\t\t\tonShaderError: null\n\t\t};\n\n\t\t// clearing\n\n\t\tthis.autoClear = true;\n\t\tthis.autoClearColor = true;\n\t\tthis.autoClearDepth = true;\n\t\tthis.autoClearStencil = true;\n\n\t\t// scene graph\n\n\t\tthis.sortObjects = true;\n\n\t\t// user-defined clipping\n\n\t\tthis.clippingPlanes = [];\n\t\tthis.localClippingEnabled = false;\n\n\t\t// physically based shading\n\n\t\tthis._outputColorSpace = SRGBColorSpace;\n\n\t\t// physical lights\n\n\t\tthis._useLegacyLights = false;\n\n\t\t// tone mapping\n\n\t\tthis.toneMapping = NoToneMapping;\n\t\tthis.toneMappingExposure = 1.0;\n\n\t\t// internal properties\n\n\t\tconst _this = this;\n\n\t\tlet _isContextLost = false;\n\n\t\t// internal state cache\n\n\t\tlet _currentActiveCubeFace = 0;\n\t\tlet _currentActiveMipmapLevel = 0;\n\t\tlet _currentRenderTarget = null;\n\t\tlet _currentMaterialId = - 1;\n\n\t\tlet _currentCamera = null;\n\n\t\tconst _currentViewport = new Vector4();\n\t\tconst _currentScissor = new Vector4();\n\t\tlet _currentScissorTest = null;\n\n\t\tconst _currentClearColor = new Color( 0x000000 );\n\t\tlet _currentClearAlpha = 0;\n\n\t\t//\n\n\t\tlet _width = canvas.width;\n\t\tlet _height = canvas.height;\n\n\t\tlet _pixelRatio = 1;\n\t\tlet _opaqueSort = null;\n\t\tlet _transparentSort = null;\n\n\t\tconst _viewport = new Vector4( 0, 0, _width, _height );\n\t\tconst _scissor = new Vector4( 0, 0, _width, _height );\n\t\tlet _scissorTest = false;\n\n\t\t// frustum\n\n\t\tconst _frustum = new Frustum();\n\n\t\t// clipping\n\n\t\tlet _clippingEnabled = false;\n\t\tlet _localClippingEnabled = false;\n\n\t\t// transmission\n\n\t\tlet _transmissionRenderTarget = null;\n\n\t\t// camera matrices cache\n\n\t\tconst _projScreenMatrix = new Matrix4();\n\n\t\tconst _vector2 = new Vector2();\n\t\tconst _vector3 = new Vector3();\n\n\t\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\t\tfunction getTargetPixelRatio() {\n\n\t\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\n\n\t\t}\n\n\t\t// initialize\n\n\t\tlet _gl = context;\n\n\t\tfunction getContext( contextNames, contextAttributes ) {\n\n\t\t\tfor ( let i = 0; i < contextNames.length; i ++ ) {\n\n\t\t\t\tconst contextName = contextNames[ i ];\n\t\t\t\tconst context = canvas.getContext( contextName, contextAttributes );\n\t\t\t\tif ( context !== null ) return context;\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\ttry {\n\n\t\t\tconst contextAttributes = {\n\t\t\t\talpha: true,\n\t\t\t\tdepth,\n\t\t\t\tstencil,\n\t\t\t\tantialias,\n\t\t\t\tpremultipliedAlpha,\n\t\t\t\tpreserveDrawingBuffer,\n\t\t\t\tpowerPreference,\n\t\t\t\tfailIfMajorPerformanceCaveat,\n\t\t\t};\n\n\t\t\t// OffscreenCanvas does not have setAttribute, see #22811\n\t\t\tif ( 'setAttribute' in canvas ) canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );\n\n\t\t\t// event listeners must be registered before WebGL context is created, see #12753\n\t\t\tcanvas.addEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.addEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\tif ( _gl === null ) {\n\n\t\t\t\tconst contextNames = [ 'webgl2', 'webgl', 'experimental-webgl' ];\n\n\t\t\t\tif ( _this.isWebGL1Renderer === true ) {\n\n\t\t\t\t\tcontextNames.shift();\n\n\t\t\t\t}\n\n\t\t\t\t_gl = getContext( contextNames, contextAttributes );\n\n\t\t\t\tif ( _gl === null ) {\n\n\t\t\t\t\tif ( getContext( contextNames ) ) {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( typeof WebGLRenderingContext !== 'undefined' && _gl instanceof WebGLRenderingContext ) { // @deprecated, r153\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );\n\n\t\t\t}\n\n\t\t\t// Some experimental-webgl implementations do not have getShaderPrecisionFormat\n\n\t\t\tif ( _gl.getShaderPrecisionFormat === undefined ) {\n\n\t\t\t\t_gl.getShaderPrecisionFormat = function () {\n\n\t\t\t\t\treturn { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };\n\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: ' + error.message );\n\t\t\tthrow error;\n\n\t\t}\n\n\t\tlet extensions, capabilities, state, info;\n\t\tlet properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n\t\tlet programCache, materials, renderLists, renderStates, clipping, shadowMap;\n\n\t\tlet background, morphtargets, bufferRenderer, indexedBufferRenderer;\n\n\t\tlet utils, bindingStates, uniformsGroups;\n\n\t\tfunction initGLContext() {\n\n\t\t\textensions = new WebGLExtensions( _gl );\n\n\t\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters );\n\n\t\t\textensions.init( capabilities );\n\n\t\t\tutils = new WebGLUtils( _gl, extensions, capabilities );\n\n\t\t\tstate = new WebGLState( _gl, extensions, capabilities );\n\n\t\t\tinfo = new WebGLInfo( _gl );\n\t\t\tproperties = new WebGLProperties();\n\t\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\n\t\t\tcubemaps = new WebGLCubeMaps( _this );\n\t\t\tcubeuvmaps = new WebGLCubeUVMaps( _this );\n\t\t\tattributes = new WebGLAttributes( _gl, capabilities );\n\t\t\tbindingStates = new WebGLBindingStates( _gl, extensions, attributes, capabilities );\n\t\t\tgeometries = new WebGLGeometries( _gl, attributes, info, bindingStates );\n\t\t\tobjects = new WebGLObjects( _gl, geometries, attributes, info );\n\t\t\tmorphtargets = new WebGLMorphtargets( _gl, capabilities, textures );\n\t\t\tclipping = new WebGLClipping( properties );\n\t\t\tprogramCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );\n\t\t\tmaterials = new WebGLMaterials( _this, properties );\n\t\t\trenderLists = new WebGLRenderLists();\n\t\t\trenderStates = new WebGLRenderStates( extensions, capabilities );\n\t\t\tbackground = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );\n\t\t\tshadowMap = new WebGLShadowMap( _this, objects, capabilities );\n\t\t\tuniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );\n\n\t\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );\n\t\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );\n\n\t\t\tinfo.programs = programCache.programs;\n\n\t\t\t_this.capabilities = capabilities;\n\t\t\t_this.extensions = extensions;\n\t\t\t_this.properties = properties;\n\t\t\t_this.renderLists = renderLists;\n\t\t\t_this.shadowMap = shadowMap;\n\t\t\t_this.state = state;\n\t\t\t_this.info = info;\n\n\t\t}\n\n\t\tinitGLContext();\n\n\t\t// xr\n\n\t\tconst xr = new WebXRManager( _this, _gl );\n\n\t\tthis.xr = xr;\n\n\t\t// API\n\n\t\tthis.getContext = function () {\n\n\t\t\treturn _gl;\n\n\t\t};\n\n\t\tthis.getContextAttributes = function () {\n\n\t\t\treturn _gl.getContextAttributes();\n\n\t\t};\n\n\t\tthis.forceContextLoss = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.loseContext();\n\n\t\t};\n\n\t\tthis.forceContextRestore = function () {\n\n\t\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\t\tif ( extension ) extension.restoreContext();\n\n\t\t};\n\n\t\tthis.getPixelRatio = function () {\n\n\t\t\treturn _pixelRatio;\n\n\t\t};\n\n\t\tthis.setPixelRatio = function ( value ) {\n\n\t\t\tif ( value === undefined ) return;\n\n\t\t\t_pixelRatio = value;\n\n\t\t\tthis.setSize( _width, _height, false );\n\n\t\t};\n\n\t\tthis.getSize = function ( target ) {\n\n\t\t\treturn target.set( _width, _height );\n\n\t\t};\n\n\t\tthis.setSize = function ( width, height, updateStyle = true ) {\n\n\t\t\tif ( xr.isPresenting ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\tcanvas.width = Math.floor( width * _pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * _pixelRatio );\n\n\t\t\tif ( updateStyle === true ) {\n\n\t\t\t\tcanvas.style.width = width + 'px';\n\t\t\t\tcanvas.style.height = height + 'px';\n\n\t\t\t}\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getDrawingBufferSize = function ( target ) {\n\n\t\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\n\n\t\t};\n\n\t\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\n\n\t\t\t_width = width;\n\t\t\t_height = height;\n\n\t\t\t_pixelRatio = pixelRatio;\n\n\t\t\tcanvas.width = Math.floor( width * pixelRatio );\n\t\t\tcanvas.height = Math.floor( height * pixelRatio );\n\n\t\t\tthis.setViewport( 0, 0, width, height );\n\n\t\t};\n\n\t\tthis.getCurrentViewport = function ( target ) {\n\n\t\t\treturn target.copy( _currentViewport );\n\n\t\t};\n\n\t\tthis.getViewport = function ( target ) {\n\n\t\t\treturn target.copy( _viewport );\n\n\t\t};\n\n\t\tthis.setViewport = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_viewport.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );\n\n\t\t};\n\n\t\tthis.getScissor = function ( target ) {\n\n\t\t\treturn target.copy( _scissor );\n\n\t\t};\n\n\t\tthis.setScissor = function ( x, y, width, height ) {\n\n\t\t\tif ( x.isVector4 ) {\n\n\t\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\n\n\t\t\t} else {\n\n\t\t\t\t_scissor.set( x, y, width, height );\n\n\t\t\t}\n\n\t\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );\n\n\t\t};\n\n\t\tthis.getScissorTest = function () {\n\n\t\t\treturn _scissorTest;\n\n\t\t};\n\n\t\tthis.setScissorTest = function ( boolean ) {\n\n\t\t\tstate.setScissorTest( _scissorTest = boolean );\n\n\t\t};\n\n\t\tthis.setOpaqueSort = function ( method ) {\n\n\t\t\t_opaqueSort = method;\n\n\t\t};\n\n\t\tthis.setTransparentSort = function ( method ) {\n\n\t\t\t_transparentSort = method;\n\n\t\t};\n\n\t\t// Clearing\n\n\t\tthis.getClearColor = function ( target ) {\n\n\t\t\treturn target.copy( background.getClearColor() );\n\n\t\t};\n\n\t\tthis.setClearColor = function () {\n\n\t\t\tbackground.setClearColor.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.getClearAlpha = function () {\n\n\t\t\treturn background.getClearAlpha();\n\n\t\t};\n\n\t\tthis.setClearAlpha = function () {\n\n\t\t\tbackground.setClearAlpha.apply( background, arguments );\n\n\t\t};\n\n\t\tthis.clear = function ( color = true, depth = true, stencil = true ) {\n\n\t\t\tlet bits = 0;\n\n\t\t\tif ( color ) {\n\n\t\t\t\t// check if we're trying to clear an integer target\n\t\t\t\tlet isIntegerFormat = false;\n\t\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t\tconst targetFormat = _currentRenderTarget.texture.format;\n\t\t\t\t\tisIntegerFormat = targetFormat === RGBAIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RGIntegerFormat ||\n\t\t\t\t\t\ttargetFormat === RedIntegerFormat;\n\n\t\t\t\t}\n\n\t\t\t\t// use the appropriate clear functions to clear the target if it's a signed\n\t\t\t\t// or unsigned integer target\n\t\t\t\tif ( isIntegerFormat ) {\n\n\t\t\t\t\tconst targetType = _currentRenderTarget.texture.type;\n\t\t\t\t\tconst isUnsignedType = targetType === UnsignedByteType ||\n\t\t\t\t\t\ttargetType === UnsignedIntType ||\n\t\t\t\t\t\ttargetType === UnsignedShortType ||\n\t\t\t\t\t\ttargetType === UnsignedInt248Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort4444Type ||\n\t\t\t\t\t\ttargetType === UnsignedShort5551Type;\n\n\t\t\t\t\tconst clearColor = background.getClearColor();\n\t\t\t\t\tconst a = background.getClearAlpha();\n\t\t\t\t\tconst r = clearColor.r;\n\t\t\t\t\tconst g = clearColor.g;\n\t\t\t\t\tconst b = clearColor.b;\n\n\t\t\t\t\tif ( isUnsignedType ) {\n\n\t\t\t\t\t\tuintClearColor[ 0 ] = r;\n\t\t\t\t\t\tuintClearColor[ 1 ] = g;\n\t\t\t\t\t\tuintClearColor[ 2 ] = b;\n\t\t\t\t\t\tuintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferuiv( _gl.COLOR, 0, uintClearColor );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tintClearColor[ 0 ] = r;\n\t\t\t\t\t\tintClearColor[ 1 ] = g;\n\t\t\t\t\t\tintClearColor[ 2 ] = b;\n\t\t\t\t\t\tintClearColor[ 3 ] = a;\n\t\t\t\t\t\t_gl.clearBufferiv( _gl.COLOR, 0, intClearColor );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbits |= _gl.COLOR_BUFFER_BIT;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( depth ) bits |= _gl.DEPTH_BUFFER_BIT;\n\t\t\tif ( stencil ) {\n\n\t\t\t\tbits |= _gl.STENCIL_BUFFER_BIT;\n\t\t\t\tthis.state.buffers.stencil.setMask( 0xffffffff );\n\n\t\t\t}\n\n\t\t\t_gl.clear( bits );\n\n\t\t};\n\n\t\tthis.clearColor = function () {\n\n\t\t\tthis.clear( true, false, false );\n\n\t\t};\n\n\t\tthis.clearDepth = function () {\n\n\t\t\tthis.clear( false, true, false );\n\n\t\t};\n\n\t\tthis.clearStencil = function () {\n\n\t\t\tthis.clear( false, false, true );\n\n\t\t};\n\n\t\t//\n\n\t\tthis.dispose = function () {\n\n\t\t\tcanvas.removeEventListener( 'webglcontextlost', onContextLost, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\n\t\t\tcanvas.removeEventListener( 'webglcontextcreationerror', onContextCreationError, false );\n\n\t\t\trenderLists.dispose();\n\t\t\trenderStates.dispose();\n\t\t\tproperties.dispose();\n\t\t\tcubemaps.dispose();\n\t\t\tcubeuvmaps.dispose();\n\t\t\tobjects.dispose();\n\t\t\tbindingStates.dispose();\n\t\t\tuniformsGroups.dispose();\n\t\t\tprogramCache.dispose();\n\n\t\t\txr.dispose();\n\n\t\t\txr.removeEventListener( 'sessionstart', onXRSessionStart );\n\t\t\txr.removeEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t\tif ( _transmissionRenderTarget ) {\n\n\t\t\t\t_transmissionRenderTarget.dispose();\n\t\t\t\t_transmissionRenderTarget = null;\n\n\t\t\t}\n\n\t\t\tanimation.stop();\n\n\t\t};\n\n\t\t// Events\n\n\t\tfunction onContextLost( event ) {\n\n\t\t\tevent.preventDefault();\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Lost.' );\n\n\t\t\t_isContextLost = true;\n\n\t\t}\n\n\t\tfunction onContextRestore( /* event */ ) {\n\n\t\t\tconsole.log( 'THREE.WebGLRenderer: Context Restored.' );\n\n\t\t\t_isContextLost = false;\n\n\t\t\tconst infoAutoReset = info.autoReset;\n\t\t\tconst shadowMapEnabled = shadowMap.enabled;\n\t\t\tconst shadowMapAutoUpdate = shadowMap.autoUpdate;\n\t\t\tconst shadowMapNeedsUpdate = shadowMap.needsUpdate;\n\t\t\tconst shadowMapType = shadowMap.type;\n\n\t\t\tinitGLContext();\n\n\t\t\tinfo.autoReset = infoAutoReset;\n\t\t\tshadowMap.enabled = shadowMapEnabled;\n\t\t\tshadowMap.autoUpdate = shadowMapAutoUpdate;\n\t\t\tshadowMap.needsUpdate = shadowMapNeedsUpdate;\n\t\t\tshadowMap.type = shadowMapType;\n\n\t\t}\n\n\t\tfunction onContextCreationError( event ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );\n\n\t\t}\n\n\t\tfunction onMaterialDispose( event ) {\n\n\t\t\tconst material = event.target;\n\n\t\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\t\tdeallocateMaterial( material );\n\n\t\t}\n\n\t\t// Buffer deallocation\n\n\t\tfunction deallocateMaterial( material ) {\n\n\t\t\treleaseMaterialProgramReferences( material );\n\n\t\t\tproperties.remove( material );\n\n\t\t}\n\n\n\t\tfunction releaseMaterialProgramReferences( material ) {\n\n\t\t\tconst programs = properties.get( material ).programs;\n\n\t\t\tif ( programs !== undefined ) {\n\n\t\t\t\tprograms.forEach( function ( program ) {\n\n\t\t\t\t\tprogramCache.releaseProgram( program );\n\n\t\t\t\t} );\n\n\t\t\t\tif ( material.isShaderMaterial ) {\n\n\t\t\t\t\tprogramCache.releaseShaderCache( material );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Buffer rendering\n\n\t\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\n\n\t\t\tif ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n\t\t\tconst frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\n\n\t\t\tconst program = setProgram( camera, scene, geometry, material, object );\n\n\t\t\tstate.setMaterial( material, frontFaceCW );\n\n\t\t\t//\n\n\t\t\tlet index = geometry.index;\n\t\t\tlet rangeFactor = 1;\n\n\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\tindex = geometries.getWireframeAttribute( geometry );\n\n\t\t\t\tif ( index === undefined ) return;\n\n\t\t\t\trangeFactor = 2;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst drawRange = geometry.drawRange;\n\t\t\tconst position = geometry.attributes.position;\n\n\t\t\tlet drawStart = drawRange.start * rangeFactor;\n\t\t\tlet drawEnd = ( drawRange.start + drawRange.count ) * rangeFactor;\n\n\t\t\tif ( group !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, group.start * rangeFactor );\n\t\t\t\tdrawEnd = Math.min( drawEnd, ( group.start + group.count ) * rangeFactor );\n\n\t\t\t}\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, index.count );\n\n\t\t\t} else if ( position !== undefined && position !== null ) {\n\n\t\t\t\tdrawStart = Math.max( drawStart, 0 );\n\t\t\t\tdrawEnd = Math.min( drawEnd, position.count );\n\n\t\t\t}\n\n\t\t\tconst drawCount = drawEnd - drawStart;\n\n\t\t\tif ( drawCount < 0 || drawCount === Infinity ) return;\n\n\t\t\t//\n\n\t\t\tbindingStates.setup( object, material, program, geometry, index );\n\n\t\t\tlet attribute;\n\t\t\tlet renderer = bufferRenderer;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tattribute = attributes.get( index );\n\n\t\t\t\trenderer = indexedBufferRenderer;\n\t\t\t\trenderer.setIndex( attribute );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( object.isMesh ) {\n\n\t\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isLine ) {\n\n\t\t\t\tlet lineWidth = material.linewidth;\n\n\t\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\n\n\t\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\n\n\t\t\t\tif ( object.isLineSegments ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINES );\n\n\t\t\t\t} else if ( object.isLineLoop ) {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_LOOP );\n\n\t\t\t\t} else {\n\n\t\t\t\t\trenderer.setMode( _gl.LINE_STRIP );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isPoints ) {\n\n\t\t\t\trenderer.setMode( _gl.POINTS );\n\n\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\trenderer.setMode( _gl.TRIANGLES );\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\trenderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );\n\n\t\t\t} else if ( object.isInstancedMesh ) {\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, object.count );\n\n\t\t\t} else if ( geometry.isInstancedBufferGeometry ) {\n\n\t\t\t\tconst maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n\t\t\t\tconst instanceCount = Math.min( geometry.instanceCount, maxInstanceCount );\n\n\t\t\t\trenderer.renderInstances( drawStart, drawCount, instanceCount );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.render( drawStart, drawCount );\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Compile\n\n\t\tfunction prepareMaterial( material, scene, object ) {\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.compile = function ( scene, camera, targetScene = null ) {\n\n\t\t\tif ( targetScene === null ) targetScene = scene;\n\n\t\t\tcurrentRenderState = renderStates.get( targetScene );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t// gather lights from both the target scene and the new object that will be added to the scene.\n\n\t\t\ttargetScene.traverseVisible( function ( object ) {\n\n\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tif ( scene !== targetScene ) {\n\n\t\t\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\t// Only initialize materials in the new scene, not the targetScene.\n\n\t\t\tconst materials = new Set();\n\n\t\t\tscene.traverse( function ( object ) {\n\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( material ) {\n\n\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\tfor ( let i = 0; i < material.length; i ++ ) {\n\n\t\t\t\t\t\t\tconst material2 = material[ i ];\n\n\t\t\t\t\t\t\tprepareMaterial( material2, targetScene, object );\n\t\t\t\t\t\t\tmaterials.add( material2 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tprepareMaterial( material, targetScene, object );\n\t\t\t\t\t\tmaterials.add( material );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\trenderStateStack.pop();\n\t\t\tcurrentRenderState = null;\n\n\t\t\treturn materials;\n\n\t\t};\n\n\t\t// compileAsync\n\n\t\tthis.compileAsync = function ( scene, camera, targetScene = null ) {\n\n\t\t\tconst materials = this.compile( scene, camera, targetScene );\n\n\t\t\t// Wait for all the materials in the new object to indicate that they're\n\t\t\t// ready to be used before resolving the promise.\n\n\t\t\treturn new Promise( ( resolve ) => {\n\n\t\t\t\tfunction checkMaterialsReady() {\n\n\t\t\t\t\tmaterials.forEach( function ( material ) {\n\n\t\t\t\t\t\tconst materialProperties = properties.get( material );\n\t\t\t\t\t\tconst program = materialProperties.currentProgram;\n\n\t\t\t\t\t\tif ( program.isReady() ) {\n\n\t\t\t\t\t\t\t// remove any programs that report they're ready to use from the list\n\t\t\t\t\t\t\tmaterials.delete( material );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\t// once the list of compiling materials is empty, call the callback\n\n\t\t\t\t\tif ( materials.size === 0 ) {\n\n\t\t\t\t\t\tresolve( scene );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// if some materials are still not ready, wait a bit and check again\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( extensions.get( 'KHR_parallel_shader_compile' ) !== null ) {\n\n\t\t\t\t\t// If we can check the compilation status of the materials without\n\t\t\t\t\t// blocking then do so right away.\n\n\t\t\t\t\tcheckMaterialsReady();\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Otherwise start by waiting a bit to give the materials we just\n\t\t\t\t\t// initialized a chance to finish.\n\n\t\t\t\t\tsetTimeout( checkMaterialsReady, 10 );\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time ) {\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\n\n\t\t}\n\n\t\tfunction onXRSessionStart() {\n\n\t\t\tanimation.stop();\n\n\t\t}\n\n\t\tfunction onXRSessionEnd() {\n\n\t\t\tanimation.start();\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tif ( typeof self !== 'undefined' ) animation.setContext( self );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\t\t\txr.setAnimationLoop( callback );\n\n\t\t\t( callback === null ) ? animation.stop() : animation.start();\n\n\t\t};\n\n\t\txr.addEventListener( 'sessionstart', onXRSessionStart );\n\t\txr.addEventListener( 'sessionend', onXRSessionEnd );\n\n\t\t// Rendering\n\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tif ( camera !== undefined && camera.isCamera !== true ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tif ( _isContextLost === true ) return;\n\n\t\t\t// update scene graph\n\n\t\t\tif ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();\n\n\t\t\t// update camera matrices and frustum\n\n\t\t\tif ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();\n\n\t\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\t\tif ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );\n\n\t\t\t\tcamera = xr.getCamera(); // use XR camera for rendering\n\n\t\t\t}\n\n\t\t\t//\n\t\t\tif ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );\n\n\t\t\tcurrentRenderState = renderStates.get( scene, renderStateStack.length );\n\t\t\tcurrentRenderState.init();\n\n\t\t\trenderStateStack.push( currentRenderState );\n\n\t\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t\t\t_localClippingEnabled = this.localClippingEnabled;\n\t\t\t_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );\n\n\t\t\tcurrentRenderList = renderLists.get( scene, renderListStack.length );\n\t\t\tcurrentRenderList.init();\n\n\t\t\trenderListStack.push( currentRenderList );\n\n\t\t\tprojectObject( scene, camera, 0, _this.sortObjects );\n\n\t\t\tcurrentRenderList.finish();\n\n\t\t\tif ( _this.sortObjects === true ) {\n\n\t\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tthis.info.render.frame ++;\n\n\t\t\tif ( _clippingEnabled === true ) clipping.beginShadows();\n\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tshadowMap.render( shadowsArray, scene, camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.endShadows();\n\n\t\t\t//\n\n\t\t\tif ( this.info.autoReset === true ) this.info.reset();\n\n\n\t\t\t//\n\n\t\t\tbackground.render( currentRenderList, scene );\n\n\t\t\t// render scene\n\n\t\t\tcurrentRenderState.setupLights( _this._useLegacyLights );\n\n\t\t\tif ( camera.isArrayCamera ) {\n\n\t\t\t\tconst cameras = camera.cameras;\n\n\t\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\t\trenderScene( currentRenderList, scene, camera2, camera2.viewport );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\trenderScene( currentRenderList, scene, camera );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\n\n\t\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\n\n\t\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tif ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );\n\n\t\t\t// _gl.finish();\n\n\t\t\tbindingStates.resetDefaultState();\n\t\t\t_currentMaterialId = - 1;\n\t\t\t_currentCamera = null;\n\n\t\t\trenderStateStack.pop();\n\n\t\t\tif ( renderStateStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderState = renderStateStack[ renderStateStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderState = null;\n\n\t\t\t}\n\n\t\t\trenderListStack.pop();\n\n\t\t\tif ( renderListStack.length > 0 ) {\n\n\t\t\t\tcurrentRenderList = renderListStack[ renderListStack.length - 1 ];\n\n\t\t\t} else {\n\n\t\t\t\tcurrentRenderList = null;\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\n\n\t\t\tif ( object.visible === false ) return;\n\n\t\t\tconst visible = object.layers.test( camera.layers );\n\n\t\t\tif ( visible ) {\n\n\t\t\t\tif ( object.isGroup ) {\n\n\t\t\t\t\tgroupOrder = object.renderOrder;\n\n\t\t\t\t} else if ( object.isLOD ) {\n\n\t\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\n\n\t\t\t\t} else if ( object.isLight ) {\n\n\t\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\n\n\t\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\n\n\t\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t\tif ( object.boundingSphere !== undefined ) {\n\n\t\t\t\t\t\t\t\tif ( object.boundingSphere === null ) object.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( object.boundingSphere.center );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\t\t\t\t\t\t\t\t_vector3.copy( geometry.boundingSphere.center );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t_vector3\n\t\t\t\t\t\t\t\t.applyMatrix4( object.matrixWorld )\n\t\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector3.z, group );\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst children = object.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderScene( currentRenderList, scene, camera, viewport ) {\n\n\t\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\t\t\tconst transparentObjects = currentRenderList.transparent;\n\n\t\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\t\tif ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, camera );\n\n\t\t\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera );\n\n\t\t\tif ( viewport ) state.viewport( _currentViewport.copy( viewport ) );\n\n\t\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\n\t\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\n\t\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\n\n\t\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\n\n\t\t\tstate.buffers.depth.setTest( true );\n\t\t\tstate.buffers.depth.setMask( true );\n\t\t\tstate.buffers.color.setMask( true );\n\n\t\t\tstate.setPolygonOffset( false );\n\n\t\t}\n\n\t\tfunction renderTransmissionPass( opaqueObjects, transmissiveObjects, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tif ( overrideMaterial !== null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst isWebGL2 = capabilities.isWebGL2;\n\n\t\t\tif ( _transmissionRenderTarget === null ) {\n\n\t\t\t\t_transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {\n\t\t\t\t\tgenerateMipmaps: true,\n\t\t\t\t\ttype: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,\n\t\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\t\tsamples: ( isWebGL2 ) ? 4 : 0\n\t\t\t\t} );\n\n\t\t\t\t// debug\n\n\t\t\t\t/*\n\t\t\t\tconst geometry = new PlaneGeometry();\n\t\t\t\tconst material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );\n\n\t\t\t\tconst mesh = new Mesh( geometry, material );\n\t\t\t\tscene.add( mesh );\n\t\t\t\t*/\n\n\t\t\t}\n\n\t\t\t_this.getDrawingBufferSize( _vector2 );\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t_transmissionRenderTarget.setSize( _vector2.x, _vector2.y );\n\n\t\t\t} else {\n\n\t\t\t\t_transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst currentRenderTarget = _this.getRenderTarget();\n\t\t\t_this.setRenderTarget( _transmissionRenderTarget );\n\n\t\t\t_this.getClearColor( _currentClearColor );\n\t\t\t_currentClearAlpha = _this.getClearAlpha();\n\t\t\tif ( _currentClearAlpha < 1 ) _this.setClearColor( 0xffffff, 0.5 );\n\n\t\t\t_this.clear();\n\n\t\t\t// Turn off the features which can affect the frag color for opaque objects pass.\n\t\t\t// Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n\t\t\tconst currentToneMapping = _this.toneMapping;\n\t\t\t_this.toneMapping = NoToneMapping;\n\n\t\t\trenderObjects( opaqueObjects, scene, camera );\n\n\t\t\ttextures.updateMultisampleRenderTarget( _transmissionRenderTarget );\n\t\t\ttextures.updateRenderTargetMipmap( _transmissionRenderTarget );\n\n\t\t\tlet renderTargetNeedsUpdate = false;\n\n\t\t\tfor ( let i = 0, l = transmissiveObjects.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = transmissiveObjects[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = renderItem.material;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\tconst currentSide = material.side;\n\n\t\t\t\t\tmaterial.side = BackSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t\tmaterial.side = currentSide;\n\t\t\t\t\tmaterial.needsUpdate = true;\n\n\t\t\t\t\trenderTargetNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( renderTargetNeedsUpdate === true ) {\n\n\t\t\t\ttextures.updateMultisampleRenderTarget( _transmissionRenderTarget );\n\t\t\t\ttextures.updateRenderTargetMipmap( _transmissionRenderTarget );\n\n\t\t\t}\n\n\t\t\t_this.setRenderTarget( currentRenderTarget );\n\n\t\t\t_this.setClearColor( _currentClearColor, _currentClearAlpha );\n\n\t\t\t_this.toneMapping = currentToneMapping;\n\n\t\t}\n\n\t\tfunction renderObjects( renderList, scene, camera ) {\n\n\t\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\t\tfor ( let i = 0, l = renderList.length; i < l; i ++ ) {\n\n\t\t\t\tconst renderItem = renderList[ i ];\n\n\t\t\t\tconst object = renderItem.object;\n\t\t\t\tconst geometry = renderItem.geometry;\n\t\t\t\tconst material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n\t\t\t\tconst group = renderItem.group;\n\n\t\t\t\tif ( object.layers.test( camera.layers ) ) {\n\n\t\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction renderObject( object, scene, camera, geometry, material, group ) {\n\n\t\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\n\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\n\n\t\t\tmaterial.onBeforeRender( _this, scene, camera, geometry, object, group );\n\n\t\t\tif ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {\n\n\t\t\t\tmaterial.side = BackSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = FrontSide;\n\t\t\t\tmaterial.needsUpdate = true;\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t\tmaterial.side = DoubleSide;\n\n\t\t\t} else {\n\n\t\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\t}\n\n\t\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\n\n\t\t}\n\n\t\tfunction getProgram( material, scene, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tconst lights = currentRenderState.state.lights;\n\t\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\t\tconst lightsStateVersion = lights.state.version;\n\n\t\t\tconst parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );\n\t\t\tconst programCacheKey = programCache.getProgramCacheKey( parameters );\n\n\t\t\tlet programs = materialProperties.programs;\n\n\t\t\t// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n\n\t\t\tmaterialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tmaterialProperties.fog = scene.fog;\n\t\t\tmaterialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );\n\n\t\t\tif ( programs === undefined ) {\n\n\t\t\t\t// new material\n\n\t\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\t\tprograms = new Map();\n\t\t\t\tmaterialProperties.programs = programs;\n\n\t\t\t}\n\n\t\t\tlet program = programs.get( programCacheKey );\n\n\t\t\tif ( program !== undefined ) {\n\n\t\t\t\t// early out if program and light state is identical\n\n\t\t\t\tif ( materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion ) {\n\n\t\t\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t\t\treturn program;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tparameters.uniforms = programCache.getUniforms( material );\n\n\t\t\t\tmaterial.onBuild( object, parameters, _this );\n\n\t\t\t\tmaterial.onBeforeCompile( parameters, _this );\n\n\t\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\n\t\t\t\tprograms.set( programCacheKey, program );\n\n\t\t\t\tmaterialProperties.uniforms = parameters.uniforms;\n\n\t\t\t}\n\n\t\t\tconst uniforms = materialProperties.uniforms;\n\n\t\t\tif ( ( ! material.isShaderMaterial && ! material.isRawShaderMaterial ) || material.clipping === true ) {\n\n\t\t\t\tuniforms.clippingPlanes = clipping.uniform;\n\n\t\t\t}\n\n\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t// store the light setup it was created for\n\n\t\t\tmaterialProperties.needsLights = materialNeedsLights( material );\n\t\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// wire up the material to this renderer's lighting state\n\n\t\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\n\t\t\t\tuniforms.lightProbe.value = lights.state.probe;\n\t\t\t\tuniforms.directionalLights.value = lights.state.directional;\n\t\t\t\tuniforms.directionalLightShadows.value = lights.state.directionalShadow;\n\t\t\t\tuniforms.spotLights.value = lights.state.spot;\n\t\t\t\tuniforms.spotLightShadows.value = lights.state.spotShadow;\n\t\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\n\t\t\t\tuniforms.ltc_1.value = lights.state.rectAreaLTC1;\n\t\t\t\tuniforms.ltc_2.value = lights.state.rectAreaLTC2;\n\t\t\t\tuniforms.pointLights.value = lights.state.point;\n\t\t\t\tuniforms.pointLightShadows.value = lights.state.pointShadow;\n\t\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\n\n\t\t\t\tuniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n\t\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n\t\t\t\tuniforms.spotShadowMap.value = lights.state.spotShadowMap;\n\t\t\t\tuniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n\t\t\t\tuniforms.spotLightMap.value = lights.state.spotLightMap;\n\t\t\t\tuniforms.pointShadowMap.value = lights.state.pointShadowMap;\n\t\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n\t\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\n\n\t\t\t}\n\n\t\t\tmaterialProperties.currentProgram = program;\n\t\t\tmaterialProperties.uniformsList = null;\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\tfunction getUniformList( materialProperties ) {\n\n\t\t\tif ( materialProperties.uniformsList === null ) {\n\n\t\t\t\tconst progUniforms = materialProperties.currentProgram.getUniforms();\n\t\t\t\tmaterialProperties.uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, materialProperties.uniforms );\n\n\t\t\t}\n\n\t\t\treturn materialProperties.uniformsList;\n\n\t\t}\n\n\t\tfunction updateCommonMaterialProperties( material, parameters ) {\n\n\t\t\tconst materialProperties = properties.get( material );\n\n\t\t\tmaterialProperties.outputColorSpace = parameters.outputColorSpace;\n\t\t\tmaterialProperties.batching = parameters.batching;\n\t\t\tmaterialProperties.instancing = parameters.instancing;\n\t\t\tmaterialProperties.instancingColor = parameters.instancingColor;\n\t\t\tmaterialProperties.skinning = parameters.skinning;\n\t\t\tmaterialProperties.morphTargets = parameters.morphTargets;\n\t\t\tmaterialProperties.morphNormals = parameters.morphNormals;\n\t\t\tmaterialProperties.morphColors = parameters.morphColors;\n\t\t\tmaterialProperties.morphTargetsCount = parameters.morphTargetsCount;\n\t\t\tmaterialProperties.numClippingPlanes = parameters.numClippingPlanes;\n\t\t\tmaterialProperties.numIntersection = parameters.numClipIntersection;\n\t\t\tmaterialProperties.vertexAlphas = parameters.vertexAlphas;\n\t\t\tmaterialProperties.vertexTangents = parameters.vertexTangents;\n\t\t\tmaterialProperties.toneMapping = parameters.toneMapping;\n\n\t\t}\n\n\t\tfunction setProgram( camera, scene, geometry, material, object ) {\n\n\t\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\t\ttextures.resetTextureUnits();\n\n\t\t\tconst fog = scene.fog;\n\t\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\t\tconst colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );\n\t\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\t\tconst vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n\t\t\tconst vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );\n\t\t\tconst morphTargets = !! geometry.morphAttributes.position;\n\t\t\tconst morphNormals = !! geometry.morphAttributes.normal;\n\t\t\tconst morphColors = !! geometry.morphAttributes.color;\n\n\t\t\tlet toneMapping = NoToneMapping;\n\n\t\t\tif ( material.toneMapped ) {\n\n\t\t\t\tif ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {\n\n\t\t\t\t\ttoneMapping = _this.toneMapping;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n\t\t\tconst morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;\n\n\t\t\tconst materialProperties = properties.get( material );\n\t\t\tconst lights = currentRenderState.state.lights;\n\n\t\t\tif ( _clippingEnabled === true ) {\n\n\t\t\t\tif ( _localClippingEnabled === true || camera !== _currentCamera ) {\n\n\t\t\t\t\tconst useCache =\n\t\t\t\t\t\tcamera === _currentCamera &&\n\t\t\t\t\t\tmaterial.id === _currentMaterialId;\n\n\t\t\t\t\t// we might want to call this function with some ClippingGroup\n\t\t\t\t\t// object instead of the material, once it becomes feasible\n\t\t\t\t\t// (#8465, #8379)\n\t\t\t\t\tclipping.setState( material, camera, useCache );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet needsProgramChange = false;\n\n\t\t\tif ( material.version === materialProperties.__version ) {\n\n\t\t\t\tif ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.outputColorSpace !== colorSpace ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isBatchedMesh && materialProperties.batching === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isBatchedMesh && materialProperties.batching === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isInstancedMesh && materialProperties.instancing === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isSkinnedMesh && materialProperties.skinning === false ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( ! object.isSkinnedMesh && materialProperties.skinning === true ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.envMap !== envMap ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( material.fog === true && materialProperties.fog !== fog ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\n\t\t\t\t\t( materialProperties.numClippingPlanes !== clipping.numPlanes ||\n\t\t\t\t\tmaterialProperties.numIntersection !== clipping.numIntersection ) ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexAlphas !== vertexAlphas ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.vertexTangents !== vertexTangents ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphTargets !== morphTargets ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphNormals !== morphNormals ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.morphColors !== morphColors ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( materialProperties.toneMapping !== toneMapping ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t} else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {\n\n\t\t\t\t\tneedsProgramChange = true;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tneedsProgramChange = true;\n\t\t\t\tmaterialProperties.__version = material.version;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet program = materialProperties.currentProgram;\n\n\t\t\tif ( needsProgramChange === true ) {\n\n\t\t\t\tprogram = getProgram( material, scene, object );\n\n\t\t\t}\n\n\t\t\tlet refreshProgram = false;\n\t\t\tlet refreshMaterial = false;\n\t\t\tlet refreshLights = false;\n\n\t\t\tconst p_uniforms = program.getUniforms(),\n\t\t\t\tm_uniforms = materialProperties.uniforms;\n\n\t\t\tif ( state.useProgram( program.program ) ) {\n\n\t\t\t\trefreshProgram = true;\n\t\t\t\trefreshMaterial = true;\n\t\t\t\trefreshLights = true;\n\n\t\t\t}\n\n\t\t\tif ( material.id !== _currentMaterialId ) {\n\n\t\t\t\t_currentMaterialId = material.id;\n\n\t\t\t\trefreshMaterial = true;\n\n\t\t\t}\n\n\t\t\tif ( refreshProgram || _currentCamera !== camera ) {\n\n\t\t\t\t// common camera uniforms\n\n\t\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\tuCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t}\n\n\t\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\n\t\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\n\n\t\t\t\t}\n\n\t\t\t\t// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067\n\n\t\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\t\tmaterial.isShaderMaterial ) {\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\n\n\t\t\t\t}\n\n\t\t\t\tif ( _currentCamera !== camera ) {\n\n\t\t\t\t\t_currentCamera = camera;\n\n\t\t\t\t\t// lighting uniforms depend on the camera so enforce an update\n\t\t\t\t\t// now, in case this material supports lights - or later, when\n\t\t\t\t\t// the next material that does gets activated:\n\n\t\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\n\t\t\t\t\trefreshLights = true;\t\t// remains set until update done\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// skinning and morph target uniforms must be set even if material didn't change\n\t\t\t// auto-setting of texture unit for bone and morph texture must go before other textures\n\t\t\t// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n\n\t\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\n\n\t\t\t\tconst skeleton = object.skeleton;\n\n\t\t\t\tif ( skeleton ) {\n\n\t\t\t\t\tif ( capabilities.floatVertexTextures ) {\n\n\t\t\t\t\t\tif ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( object.isBatchedMesh ) {\n\n\t\t\t\tp_uniforms.setOptional( _gl, object, 'batchingTexture' );\n\t\t\t\tp_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );\n\n\t\t\t}\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\t\tif ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {\n\n\t\t\t\tmorphtargets.update( object, geometry, program );\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\n\n\t\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\n\t\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\n\n\t\t\t}\n\n\t\t\t// https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\n\n\t\t\tif ( material.isMeshGouraudMaterial && material.envMap !== null ) {\n\n\t\t\t\tm_uniforms.envMap.value = envMap;\n\n\t\t\t\tm_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\t}\n\n\t\t\tif ( refreshMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\n\n\t\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t\t// the current material requires lighting info\n\n\t\t\t\t\t// note: all lighting uniforms are always set correctly\n\t\t\t\t\t// they simply reference the renderer's state for their\n\t\t\t\t\t// values\n\t\t\t\t\t//\n\t\t\t\t\t// use the current material's .needsUpdate flags to set\n\t\t\t\t\t// the GL state when required\n\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\n\n\t\t\t\t}\n\n\t\t\t\t// refresh uniforms common to several materials\n\n\t\t\t\tif ( fog && material.fog === true ) {\n\n\t\t\t\t\tmaterials.refreshFogUniforms( m_uniforms, fog );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\n\t\t\t}\n\n\t\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\n\n\t\t\t\tWebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );\n\t\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t\t}\n\n\t\t\tif ( material.isSpriteMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\n\n\t\t\t}\n\n\t\t\t// common matrices\n\n\t\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\n\t\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\n\n\t\t\t// UBOs\n\n\t\t\tif ( material.isShaderMaterial || material.isRawShaderMaterial ) {\n\n\t\t\t\tconst groups = material.uniformsGroups;\n\n\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\t\t\tuniformsGroups.update( group, program );\n\t\t\t\t\t\tuniformsGroups.bind( group, program );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn program;\n\n\t\t}\n\n\t\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n\t\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\n\n\t\t\tuniforms.ambientLightColor.needsUpdate = value;\n\t\t\tuniforms.lightProbe.needsUpdate = value;\n\n\t\t\tuniforms.directionalLights.needsUpdate = value;\n\t\t\tuniforms.directionalLightShadows.needsUpdate = value;\n\t\t\tuniforms.pointLights.needsUpdate = value;\n\t\t\tuniforms.pointLightShadows.needsUpdate = value;\n\t\t\tuniforms.spotLights.needsUpdate = value;\n\t\t\tuniforms.spotLightShadows.needsUpdate = value;\n\t\t\tuniforms.rectAreaLights.needsUpdate = value;\n\t\t\tuniforms.hemisphereLights.needsUpdate = value;\n\n\t\t}\n\n\t\tfunction materialNeedsLights( material ) {\n\n\t\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\n\t\t\t\t( material.isShaderMaterial && material.lights === true );\n\n\t\t}\n\n\t\tthis.getActiveCubeFace = function () {\n\n\t\t\treturn _currentActiveCubeFace;\n\n\t\t};\n\n\t\tthis.getActiveMipmapLevel = function () {\n\n\t\t\treturn _currentActiveMipmapLevel;\n\n\t\t};\n\n\t\tthis.getRenderTarget = function () {\n\n\t\t\treturn _currentRenderTarget;\n\n\t\t};\n\n\t\tthis.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {\n\n\t\t\tproperties.get( renderTarget.texture ).__webglTexture = colorTexture;\n\t\t\tproperties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__hasExternalTextures = true;\n\n\t\t\tif ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\trenderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n\n\t\t\t\tif ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {\n\n\t\t\t\t\t// The multisample_render_to_texture extension doesn't work properly if there\n\t\t\t\t\t// are midframe flushes and an external depth buffer. Disable use of the extension.\n\t\t\t\t\tif ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );\n\t\t\t\t\t\trenderTargetProperties.__useRenderToTexture = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {\n\n\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\t\trenderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n\t\t\trenderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n\n\t\t};\n\n\t\tthis.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {\n\n\t\t\t_currentRenderTarget = renderTarget;\n\t\t\t_currentActiveCubeFace = activeCubeFace;\n\t\t\t_currentActiveMipmapLevel = activeMipmapLevel;\n\n\t\t\tlet useDefaultFramebuffer = true;\n\t\t\tlet framebuffer = null;\n\t\t\tlet isCube = false;\n\t\t\tlet isRenderTarget3D = false;\n\n\t\t\tif ( renderTarget ) {\n\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\t\t\tif ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {\n\n\t\t\t\t\t// We need to make sure to rebind the framebuffer.\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, null );\n\t\t\t\t\tuseDefaultFramebuffer = false;\n\n\t\t\t\t} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {\n\n\t\t\t\t\ttextures.setupRenderTarget( renderTarget );\n\n\t\t\t\t} else if ( renderTargetProperties.__hasExternalTextures ) {\n\n\t\t\t\t\t// Color and depth texture must be rebound in order for the swapchain to update.\n\t\t\t\t\ttextures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );\n\n\t\t\t\t}\n\n\t\t\t\tconst texture = renderTarget.texture;\n\n\t\t\t\tif ( texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tisRenderTarget3D = true;\n\n\t\t\t\t}\n\n\t\t\t\tconst __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer[ activeCubeFace ] ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ][ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ];\n\n\t\t\t\t\t}\n\n\t\t\t\t\tisCube = true;\n\n\t\t\t\t} else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {\n\n\t\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( Array.isArray( __webglFramebuffer ) ) {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer[ activeMipmapLevel ];\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tframebuffer = __webglFramebuffer;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t\t} else {\n\n\t\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t\t_currentScissorTest = _scissorTest;\n\n\t\t\t}\n\n\t\t\tconst framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\tif ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {\n\n\t\t\t\tstate.drawBuffers( renderTarget, framebuffer );\n\n\t\t\t}\n\n\t\t\tstate.viewport( _currentViewport );\n\t\t\tstate.scissor( _currentScissor );\n\t\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );\n\n\t\t\t} else if ( isRenderTarget3D ) {\n\n\t\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t\tconst layer = activeCubeFace || 0;\n\t\t\t\t_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );\n\n\t\t\t}\n\n\t\t\t_currentMaterialId = - 1; // reset current material to ensure correct uniform bindings\n\n\t\t};\n\n\t\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t\t}\n\n\t\t\tif ( framebuffer ) {\n\n\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\ttry {\n\n\t\t\t\t\tconst texture = renderTarget.texture;\n\t\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_FORMAT ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );\n\n\t\t\t\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\t\t\t\t! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox\n\t\t\t\t\t\t! halfFloatSupportedByExt ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\n\t\t\t\t\t// restore framebuffer of current render target if necessary\n\n\t\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\t\tstate.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.copyFramebufferToTexture = function ( position, texture, level = 0 ) {\n\n\t\t\tconst levelScale = Math.pow( 2, - level );\n\t\t\tconst width = Math.floor( texture.image.width * levelScale );\n\t\t\tconst height = Math.floor( texture.image.height * levelScale );\n\n\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t_gl.copyTexSubImage2D( _gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture = function ( position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tconst width = srcTexture.image.width;\n\t\t\tconst height = srcTexture.image.height;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\n\t\t\ttextures.setTexture2D( dstTexture, 0 );\n\n\t\t\t// As another texture upload may have changed pixelStorei\n\t\t\t// parameters, make sure they are correct for the dstTexture\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedTexture ) {\n\n\t\t\t\t\t_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[ 0 ].width, srcTexture.mipmaps[ 0 ].height, glFormat, srcTexture.mipmaps[ 0 ].data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( _gl.TEXTURE_2D );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {\n\n\t\t\tif ( _this.isWebGL1Renderer ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst width = sourceBox.max.x - sourceBox.min.x + 1;\n\t\t\tconst height = sourceBox.max.y - sourceBox.min.y + 1;\n\t\t\tconst depth = sourceBox.max.z - sourceBox.min.z + 1;\n\t\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\t\tconst glType = utils.convert( dstTexture.type );\n\t\t\tlet glTarget;\n\n\t\t\tif ( dstTexture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_3D;\n\n\t\t\t} else if ( dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( dstTexture, 0 );\n\t\t\t\tglTarget = _gl.TEXTURE_2D_ARRAY;\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );\n\n\t\t\tconst unpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );\n\t\t\tconst unpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );\n\t\t\tconst unpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );\n\t\t\tconst unpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );\n\t\t\tconst unpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );\n\n\t\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, sourceBox.min.x );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, sourceBox.min.y );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, sourceBox.min.z );\n\n\t\t\tif ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {\n\n\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );\n\n\t\t\t} else {\n\n\t\t\t\tif ( srcTexture.isCompressedArrayTexture ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );\n\t\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, unpackRowLen );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, unpackSkipPixels );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, unpackSkipRows );\n\t\t\t_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, unpackSkipImages );\n\n\t\t\t// Generate mipmaps only when copying level 0\n\t\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.initTexture = function ( texture ) {\n\n\t\t\tif ( texture.isCubeTexture ) {\n\n\t\t\t\ttextures.setTextureCube( texture, 0 );\n\n\t\t\t} else if ( texture.isData3DTexture ) {\n\n\t\t\t\ttextures.setTexture3D( texture, 0 );\n\n\t\t\t} else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {\n\n\t\t\t\ttextures.setTexture2DArray( texture, 0 );\n\n\t\t\t} else {\n\n\t\t\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t};\n\n\t\tthis.resetState = function () {\n\n\t\t\t_currentActiveCubeFace = 0;\n\t\t\t_currentActiveMipmapLevel = 0;\n\t\t\t_currentRenderTarget = null;\n\n\t\t\tstate.reset();\n\t\t\tbindingStates.reset();\n\n\t\t};\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tget coordinateSystem() {\n\n\t\treturn WebGLCoordinateSystem;\n\n\t}\n\n\tget outputColorSpace() {\n\n\t\treturn this._outputColorSpace;\n\n\t}\n\n\tset outputColorSpace( colorSpace ) {\n\n\t\tthis._outputColorSpace = colorSpace;\n\n\t\tconst gl = this.getContext();\n\t\tgl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\t\tgl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';\n\n\t}\n\n\tget outputEncoding() { // @deprecated, r152\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );\n\t\treturn this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;\n\n\t}\n\n\tset outputEncoding( encoding ) { // @deprecated, r152\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );\n\t\tthis.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n\n\t}\n\n\tget useLegacyLights() { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\treturn this._useLegacyLights;\n\n\t}\n\n\tset useLegacyLights( value ) { // @deprecated, r155\n\n\t\tconsole.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );\n\t\tthis._useLegacyLights = value;\n\n\t}\n\n}\n\nclass WebGL1Renderer extends WebGLRenderer {}\n\nWebGL1Renderer.prototype.isWebGL1Renderer = true;\n\nclass FogExp2 {\n\n\tconstructor( color, density = 0.00025 ) {\n\n\t\tthis.isFogExp2 = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\t\tthis.density = density;\n\n\t}\n\n\tclone() {\n\n\t\treturn new FogExp2( this.color, this.density );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'FogExp2',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tdensity: this.density\n\t\t};\n\n\t}\n\n}\n\nclass Fog {\n\n\tconstructor( color, near = 1, far = 1000 ) {\n\n\t\tthis.isFog = true;\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Fog( this.color, this.near, this.far );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'Fog',\n\t\t\tname: this.name,\n\t\t\tcolor: this.color.getHex(),\n\t\t\tnear: this.near,\n\t\t\tfar: this.far\n\t\t};\n\n\t}\n\n}\n\nclass Scene extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isScene = true;\n\n\t\tthis.type = 'Scene';\n\n\t\tthis.background = null;\n\t\tthis.environment = null;\n\t\tthis.fog = null;\n\n\t\tthis.backgroundBlurriness = 0;\n\t\tthis.backgroundIntensity = 1;\n\n\t\tthis.overrideMaterial = null;\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.background !== null ) this.background = source.background.clone();\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\n\n\t\tthis.backgroundBlurriness = source.backgroundBlurriness;\n\t\tthis.backgroundIntensity = source.backgroundIntensity;\n\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\n\t\tif ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;\n\t\tif ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InterleavedBuffer {\n\n\tconstructor( array, stride ) {\n\n\t\tthis.isInterleavedBuffer = true;\n\n\t\tthis.array = array;\n\t\tthis.stride = stride;\n\t\tthis.count = array !== undefined ? array.length / stride : 0;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis._updateRange = { offset: 0, count: - 1 };\n\t\tthis.updateRanges = [];\n\n\t\tthis.version = 0;\n\n\t\tthis.uuid = generateUUID();\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tget updateRange() {\n\n\t\tconsole.warn( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159\n\t\treturn this._updateRange;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\taddUpdateRange( start, count ) {\n\n\t\tthis.updateRanges.push( { start, count } );\n\n\t}\n\n\tclearUpdateRanges() {\n\n\t\tthis.updateRanges.length = 0;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.count = source.count;\n\t\tthis.stride = source.stride;\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.stride;\n\t\tindex2 *= attribute.stride;\n\n\t\tfor ( let i = 0, l = this.stride; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer;\n\n\t\t}\n\n\t\tconst array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] );\n\n\t\tconst ib = new this.constructor( array, this.stride );\n\t\tib.setUsage( this.usage );\n\n\t\treturn ib;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\t// generate UUID for array buffer if necessary\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );\n\n\t\t}\n\n\t\t//\n\n\t\treturn {\n\t\t\tuuid: this.uuid,\n\t\t\tbuffer: this.array.buffer._uuid,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tstride: this.stride\n\t\t};\n\n\t}\n\n}\n\nconst _vector$6 = /*@__PURE__*/ new Vector3();\n\nclass InterleavedBufferAttribute {\n\n\tconstructor( interleavedBuffer, itemSize, offset, normalized = false ) {\n\n\t\tthis.isInterleavedBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.data = interleavedBuffer;\n\t\tthis.itemSize = itemSize;\n\t\tthis.offset = offset;\n\n\t\tthis.normalized = normalized;\n\n\t}\n\n\tget count() {\n\n\t\treturn this.data.count;\n\n\t}\n\n\tget array() {\n\n\t\treturn this.data.array;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tthis.data.needsUpdate = value;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.data.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.fromBufferAttribute( this, i );\n\n\t\t\t_vector$6.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tif ( this.normalized ) x = normalize( x, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tif ( this.normalized ) y = normalize( y, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tif ( this.normalized ) z = normalize( z, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tif ( this.normalized ) w = normalize( w, this.array );\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\tlet x = this.data.array[ index * this.data.stride + this.offset ];\n\n\t\tif ( this.normalized ) x = denormalize( x, this.array );\n\n\t\treturn x;\n\n\t}\n\n\tgetY( index ) {\n\n\t\tlet y = this.data.array[ index * this.data.stride + this.offset + 1 ];\n\n\t\tif ( this.normalized ) y = denormalize( y, this.array );\n\n\t\treturn y;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\tlet z = this.data.array[ index * this.data.stride + this.offset + 2 ];\n\n\t\tif ( this.normalized ) z = denormalize( z, this.array );\n\n\t\treturn z;\n\n\t}\n\n\tgetW( index ) {\n\n\t\tlet w = this.data.array[ index * this.data.stride + this.offset + 3 ];\n\n\t\tif ( this.normalized ) w = denormalize( w, this.array );\n\n\t\treturn w;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tif ( this.normalized ) {\n\n\t\t\tx = normalize( x, this.array );\n\t\t\ty = normalize( y, this.array );\n\t\t\tz = normalize( z, this.array );\n\t\t\tw = normalize( w, this.array );\n\n\t\t}\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\t\tthis.data.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized );\n\n\t\t} else {\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.clone( data );\n\n\t\t\t}\n\n\t\t\treturn new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized );\n\n\t\t}\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// de-interleave data and save it as an ordinary buffer attribute for now\n\n\t\t\treturn {\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\ttype: this.array.constructor.name,\n\t\t\t\tarray: array,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t} else {\n\n\t\t\t// save as true interleaved attribute\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data );\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisInterleavedBufferAttribute: true,\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\tdata: this.data.uuid,\n\t\t\t\toffset: this.offset,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t}\n\n\t}\n\n}\n\nclass SpriteMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isSpriteMaterial = true;\n\n\t\tthis.type = 'SpriteMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.rotation = 0;\n\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nlet _geometry;\n\nconst _intersectPoint = /*@__PURE__*/ new Vector3();\nconst _worldScale = /*@__PURE__*/ new Vector3();\nconst _mvPosition = /*@__PURE__*/ new Vector3();\n\nconst _alignedPosition = /*@__PURE__*/ new Vector2();\nconst _rotatedPosition = /*@__PURE__*/ new Vector2();\nconst _viewWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _vA = /*@__PURE__*/ new Vector3();\nconst _vB = /*@__PURE__*/ new Vector3();\nconst _vC = /*@__PURE__*/ new Vector3();\n\nconst _uvA = /*@__PURE__*/ new Vector2();\nconst _uvB = /*@__PURE__*/ new Vector2();\nconst _uvC = /*@__PURE__*/ new Vector2();\n\nclass Sprite extends Object3D {\n\n\tconstructor( material = new SpriteMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isSprite = true;\n\n\t\tthis.type = 'Sprite';\n\n\t\tif ( _geometry === undefined ) {\n\n\t\t\t_geometry = new BufferGeometry();\n\n\t\t\tconst float32Array = new Float32Array( [\n\t\t\t\t- 0.5, - 0.5, 0, 0, 0,\n\t\t\t\t0.5, - 0.5, 0, 1, 0,\n\t\t\t\t0.5, 0.5, 0, 1, 1,\n\t\t\t\t- 0.5, 0.5, 0, 0, 1\n\t\t\t] );\n\n\t\t\tconst interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\n\n\t\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\n\t\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\n\t\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\n\n\t\t}\n\n\t\tthis.geometry = _geometry;\n\t\tthis.material = material;\n\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tif ( raycaster.camera === null ) {\n\n\t\t\tconsole.error( 'THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\n\n\t\t}\n\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\n\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\n\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\n\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\n\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\n\n\t\t}\n\n\t\tconst rotation = this.material.rotation;\n\t\tlet sin, cos;\n\n\t\tif ( rotation !== 0 ) {\n\n\t\t\tcos = Math.cos( rotation );\n\t\t\tsin = Math.sin( rotation );\n\n\t\t}\n\n\t\tconst center = this.center;\n\n\t\ttransformVertex( _vA.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vB.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vC.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\n\t\t_uvA.set( 0, 0 );\n\t\t_uvB.set( 1, 0 );\n\t\t_uvC.set( 1, 1 );\n\n\t\t// check first triangle\n\t\tlet intersect = raycaster.ray.intersectTriangle( _vA, _vB, _vC, false, _intersectPoint );\n\n\t\tif ( intersect === null ) {\n\n\t\t\t// check second triangle\n\t\t\ttransformVertex( _vB.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\t\t_uvB.set( 0, 1 );\n\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint );\n\t\t\tif ( intersect === null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( _intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tpoint: _intersectPoint.clone(),\n\t\t\tuv: Triangle.getInterpolation( _intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ),\n\t\t\tface: null,\n\t\t\tobject: this\n\n\t\t} );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\n\n\t\tthis.material = source.material;\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\n\n\t// compute position in camera space\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\n\n\t// to check if rotation is not zero\n\tif ( sin !== undefined ) {\n\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\n\n\t} else {\n\n\t\t_rotatedPosition.copy( _alignedPosition );\n\n\t}\n\n\n\tvertexPosition.copy( mvPosition );\n\tvertexPosition.x += _rotatedPosition.x;\n\tvertexPosition.y += _rotatedPosition.y;\n\n\t// transform to world space\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\n\n}\n\nconst _v1$2 = /*@__PURE__*/ new Vector3();\nconst _v2$1 = /*@__PURE__*/ new Vector3();\n\nclass LOD extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis._currentLevel = 0;\n\n\t\tthis.type = 'LOD';\n\n\t\tObject.defineProperties( this, {\n\t\t\tlevels: {\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: []\n\t\t\t},\n\t\t\tisLOD: {\n\t\t\t\tvalue: true,\n\t\t\t}\n\t\t} );\n\n\t\tthis.autoUpdate = true;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tconst levels = source.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tthis.addLevel( level.object.clone(), level.distance, level.hysteresis );\n\n\t\t}\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\taddLevel( object, distance = 0, hysteresis = 0 ) {\n\n\t\tdistance = Math.abs( distance );\n\n\t\tconst levels = this.levels;\n\n\t\tlet l;\n\n\t\tfor ( l = 0; l < levels.length; l ++ ) {\n\n\t\t\tif ( distance < levels[ l ].distance ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlevels.splice( l, 0, { distance: distance, hysteresis: hysteresis, object: object } );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t}\n\n\tgetCurrentLevel() {\n\n\t\treturn this._currentLevel;\n\n\t}\n\n\n\n\tgetObjectForDistance( distance ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance < levelDistance ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn levels[ i - 1 ].object;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = raycaster.ray.origin.distanceTo( _v1$2 );\n\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\n\n\t\t}\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 1 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( camera.matrixWorld );\n\t\t\t_v2$1.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom;\n\n\t\t\tlevels[ 0 ].object.visible = true;\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tlet levelDistance = levels[ i ].distance;\n\n\t\t\t\tif ( levels[ i ].object.visible ) {\n\n\t\t\t\t\tlevelDistance -= levelDistance * levels[ i ].hysteresis;\n\n\t\t\t\t}\n\n\t\t\t\tif ( distance >= levelDistance ) {\n\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\n\t\t\t\t\tlevels[ i ].object.visible = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._currentLevel = i - 1;\n\n\t\t\tfor ( ; i < l; i ++ ) {\n\n\t\t\t\tlevels[ i ].object.visible = false;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\n\n\t\tdata.object.levels = [];\n\n\t\tconst levels = this.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tdata.object.levels.push( {\n\t\t\t\tobject: level.object.uuid,\n\t\t\t\tdistance: level.distance,\n\t\t\t\thysteresis: level.hysteresis\n\t\t\t} );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _basePosition = /*@__PURE__*/ new Vector3();\n\nconst _skinIndex = /*@__PURE__*/ new Vector4();\nconst _skinWeight = /*@__PURE__*/ new Vector4();\n\nconst _vector3 = /*@__PURE__*/ new Vector3();\nconst _matrix4 = /*@__PURE__*/ new Matrix4();\nconst _vertex = /*@__PURE__*/ new Vector3();\n\nconst _sphere$4 = /*@__PURE__*/ new Sphere();\nconst _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _ray$2 = /*@__PURE__*/ new Ray();\n\nclass SkinnedMesh extends Mesh {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkinnedMesh = true;\n\n\t\tthis.type = 'SkinnedMesh';\n\n\t\tthis.bindMode = AttachedBindMode;\n\t\tthis.bindMatrix = new Matrix4();\n\t\tthis.bindMatrixInverse = new Matrix4();\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingBox.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tconst positionAttribute = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0; i < positionAttribute.count; i ++ ) {\n\n\t\t\tthis.getVertexPosition( i, _vertex );\n\t\t\tthis.boundingSphere.expandByPoint( _vertex );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.bindMode = source.bindMode;\n\t\tthis.bindMatrix.copy( source.bindMatrix );\n\t\tthis.bindMatrixInverse.copy( source.bindMatrixInverse );\n\n\t\tthis.skeleton = source.skeleton;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// test with bounding sphere in world space\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$4.copy( this.boundingSphere );\n\t\t_sphere$4.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;\n\n\t\t// convert ray to local space of skinned mesh\n\n\t\t_inverseMatrix$2.copy( matrixWorld ).invert();\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\n\n\t\t// test with bounding box in local space\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tif ( _ray$2.intersectsBox( this.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\t// test for intersections with geometry\n\n\t\tthis._computeIntersections( raycaster, intersects, _ray$2 );\n\n\t}\n\n\tgetVertexPosition( index, target ) {\n\n\t\tsuper.getVertexPosition( index, target );\n\n\t\tthis.applyBoneTransform( index, target );\n\n\t\treturn target;\n\n\t}\n\n\tbind( skeleton, bindMatrix ) {\n\n\t\tthis.skeleton = skeleton;\n\n\t\tif ( bindMatrix === undefined ) {\n\n\t\t\tthis.updateMatrixWorld( true );\n\n\t\t\tthis.skeleton.calculateInverses();\n\n\t\t\tbindMatrix = this.matrixWorld;\n\n\t\t}\n\n\t\tthis.bindMatrix.copy( bindMatrix );\n\t\tthis.bindMatrixInverse.copy( bindMatrix ).invert();\n\n\t}\n\n\tpose() {\n\n\t\tthis.skeleton.pose();\n\n\t}\n\n\tnormalizeSkinWeights() {\n\n\t\tconst vector = new Vector4();\n\n\t\tconst skinWeight = this.geometry.attributes.skinWeight;\n\n\t\tfor ( let i = 0, l = skinWeight.count; i < l; i ++ ) {\n\n\t\t\tvector.fromBufferAttribute( skinWeight, i );\n\n\t\t\tconst scale = 1.0 / vector.manhattanLength();\n\n\t\t\tif ( scale !== Infinity ) {\n\n\t\t\t\tvector.multiplyScalar( scale );\n\n\t\t\t} else {\n\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\n\n\t\t\t}\n\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\n\n\t\t}\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.bindMode === AttachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === DetachedBindMode ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.bindMatrix ).invert();\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\n\n\t\t}\n\n\t}\n\n\tapplyBoneTransform( index, vector ) {\n\n\t\tconst skeleton = this.skeleton;\n\t\tconst geometry = this.geometry;\n\n\t\t_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );\n\t\t_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );\n\n\t\t_basePosition.copy( vector ).applyMatrix4( this.bindMatrix );\n\n\t\tvector.set( 0, 0, 0 );\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tconst weight = _skinWeight.getComponent( i );\n\n\t\t\tif ( weight !== 0 ) {\n\n\t\t\t\tconst boneIndex = _skinIndex.getComponent( i );\n\n\t\t\t\t_matrix4.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );\n\n\t\t\t\tvector.addScaledVector( _vector3.copy( _basePosition ).applyMatrix4( _matrix4 ), weight );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn vector.applyMatrix4( this.bindMatrixInverse );\n\n\t}\n\n\tboneTransform( index, vector ) { // @deprecated, r151\n\n\t\tconsole.warn( 'THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.' );\n\t\treturn this.applyBoneTransform( index, vector );\n\n\t}\n\n\n}\n\nclass Bone extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isBone = true;\n\n\t\tthis.type = 'Bone';\n\n\t}\n\n}\n\nclass DataTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isDataTexture = true;\n\n\t\tthis.image = { data: data, width: width, height: height };\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t}\n\n}\n\nconst _offsetMatrix = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix$1 = /*@__PURE__*/ new Matrix4();\n\nclass Skeleton {\n\n\tconstructor( bones = [], boneInverses = [] ) {\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.bones = bones.slice( 0 );\n\t\tthis.boneInverses = boneInverses;\n\t\tthis.boneMatrices = null;\n\n\t\tthis.boneTexture = null;\n\n\t\tthis.init();\n\n\t}\n\n\tinit() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tthis.boneMatrices = new Float32Array( bones.length * 16 );\n\n\t\t// calculate inverse bone matrices if necessary\n\n\t\tif ( boneInverses.length === 0 ) {\n\n\t\t\tthis.calculateInverses();\n\n\t\t} else {\n\n\t\t\t// handle special case\n\n\t\t\tif ( bones.length !== boneInverses.length ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' );\n\n\t\t\t\tthis.boneInverses = [];\n\n\t\t\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\t\t\tthis.boneInverses.push( new Matrix4() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcalculateInverses() {\n\n\t\tthis.boneInverses.length = 0;\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst inverse = new Matrix4();\n\n\t\t\tif ( this.bones[ i ] ) {\n\n\t\t\t\tinverse.copy( this.bones[ i ].matrixWorld ).invert();\n\n\t\t\t}\n\n\t\t\tthis.boneInverses.push( inverse );\n\n\t\t}\n\n\t}\n\n\tpose() {\n\n\t\t// recover the bind-time world matrices\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tbone.matrixWorld.copy( this.boneInverses[ i ] ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\t// compute the local matrices, positions, rotations and scales\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\n\n\t\t\t\t}\n\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdate() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\t\tconst boneMatrices = this.boneMatrices;\n\t\tconst boneTexture = this.boneTexture;\n\n\t\t// flatten bone matrices to array\n\n\t\tfor ( let i = 0, il = bones.length; i < il; i ++ ) {\n\n\t\t\t// compute the offset between the current and the original transform\n\n\t\t\tconst matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix$1;\n\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\n\n\t\t}\n\n\t\tif ( boneTexture !== null ) {\n\n\t\t\tboneTexture.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new Skeleton( this.bones, this.boneInverses );\n\n\t}\n\n\tcomputeBoneTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tboneMatrices.set( this.boneMatrices ); // copy current values\n\n\t\tconst boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\n\t\tboneTexture.needsUpdate = true;\n\n\t\tthis.boneMatrices = boneMatrices;\n\t\tthis.boneTexture = boneTexture;\n\n\t\treturn this;\n\n\t}\n\n\tgetBoneByName( name ) {\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone.name === name ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tdispose( ) {\n\n\t\tif ( this.boneTexture !== null ) {\n\n\t\t\tthis.boneTexture.dispose();\n\n\t\t\tthis.boneTexture = null;\n\n\t\t}\n\n\t}\n\n\tfromJSON( json, bones ) {\n\n\t\tthis.uuid = json.uuid;\n\n\t\tfor ( let i = 0, l = json.bones.length; i < l; i ++ ) {\n\n\t\t\tconst uuid = json.bones[ i ];\n\t\t\tlet bone = bones[ uuid ];\n\n\t\t\tif ( bone === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: No bone found with UUID:', uuid );\n\t\t\t\tbone = new Bone();\n\n\t\t\t}\n\n\t\t\tthis.bones.push( bone );\n\t\t\tthis.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );\n\n\t\t}\n\n\t\tthis.init();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Skeleton',\n\t\t\t\tgenerator: 'Skeleton.toJSON'\n\t\t\t},\n\t\t\tbones: [],\n\t\t\tboneInverses: []\n\t\t};\n\n\t\tdata.uuid = this.uuid;\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tfor ( let i = 0, l = bones.length; i < l; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\t\t\tdata.bones.push( bone.uuid );\n\n\t\t\tconst boneInverse = boneInverses[ i ];\n\t\t\tdata.boneInverses.push( boneInverse.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InstancedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, itemSize, normalized );\n\n\t\tthis.isInstancedBufferAttribute = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _instanceIntersects = [];\n\nconst _box3 = /*@__PURE__*/ new Box3();\nconst _identity = /*@__PURE__*/ new Matrix4();\nconst _mesh$1 = /*@__PURE__*/ new Mesh();\nconst _sphere$3 = /*@__PURE__*/ new Sphere();\n\nclass InstancedMesh extends Mesh {\n\n\tconstructor( geometry, material, count ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isInstancedMesh = true;\n\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\n\t\tthis.instanceColor = null;\n\n\t\tthis.count = count;\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.setMatrixAt( i, _identity );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\tgeometry.computeBoundingBox();\n\n\t\t}\n\n\t\tthis.boundingBox.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingBox.union( _box3 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst count = this.count;\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere === null ) {\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t}\n\n\t\tthis.boundingSphere.makeEmpty();\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.getMatrixAt( i, _instanceLocalMatrix );\n\n\t\t\t_sphere$3.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );\n\n\t\t\tthis.boundingSphere.union( _sphere$3 );\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\n\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\n\n\t\tthis.count = source.count;\n\n\t\tif ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();\n\t\tif ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( index, color ) {\n\n\t\tcolor.fromArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tgetMatrixAt( index, matrix ) {\n\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst raycastTimes = this.count;\n\n\t\t_mesh$1.geometry = this.geometry;\n\t\t_mesh$1.material = this.material;\n\n\t\tif ( _mesh$1.material === undefined ) return;\n\n\t\t// test with bounding sphere first\n\n\t\tif ( this.boundingSphere === null ) this.computeBoundingSphere();\n\n\t\t_sphere$3.copy( this.boundingSphere );\n\t\t_sphere$3.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;\n\n\t\t// now test each instance\n\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh$1.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh$1.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\n\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\n\t\t\t\tintersect.instanceId = instanceId;\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_instanceIntersects.length = 0;\n\n\t\t}\n\n\t}\n\n\tsetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );\n\n\t\t}\n\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tsetMatrixAt( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nfunction sortOpaque( a, b ) {\n\n\treturn a.z - b.z;\n\n}\n\nfunction sortTransparent( a, b ) {\n\n\treturn b.z - a.z;\n\n}\n\nclass MultiDrawRenderList {\n\n\tconstructor() {\n\n\t\tthis.index = 0;\n\t\tthis.pool = [];\n\t\tthis.list = [];\n\n\t}\n\n\tpush( drawRange, z ) {\n\n\t\tconst pool = this.pool;\n\t\tconst list = this.list;\n\t\tif ( this.index >= pool.length ) {\n\n\t\t\tpool.push( {\n\n\t\t\t\tstart: - 1,\n\t\t\t\tcount: - 1,\n\t\t\t\tz: - 1,\n\n\t\t\t} );\n\n\t\t}\n\n\t\tconst item = pool[ this.index ];\n\t\tlist.push( item );\n\t\tthis.index ++;\n\n\t\titem.start = drawRange.start;\n\t\titem.count = drawRange.count;\n\t\titem.z = z;\n\n\t}\n\n\treset() {\n\n\t\tthis.list.length = 0;\n\t\tthis.index = 0;\n\n\t}\n\n}\n\nconst ID_ATTR_NAME = 'batchId';\nconst _matrix = /*@__PURE__*/ new Matrix4();\nconst _invMatrixWorld = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\nconst _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _frustum = /*@__PURE__*/ new Frustum();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\nconst _vector$5 = /*@__PURE__*/ new Vector3();\nconst _renderList = /*@__PURE__*/ new MultiDrawRenderList();\nconst _mesh = /*@__PURE__*/ new Mesh();\nconst _batchIntersects = [];\n\n// @TODO: SkinnedMesh support?\n// @TODO: geometry.groups support?\n// @TODO: geometry.drawRange support?\n// @TODO: geometry.morphAttributes support?\n// @TODO: Support uniform parameter per geometry\n// @TODO: Add an \"optimize\" function to pack geometry and remove data gaps\n\n// copies data from attribute \"src\" into \"target\" starting at \"targetOffset\"\nfunction copyAttributeData( src, target, targetOffset = 0 ) {\n\n\tconst itemSize = target.itemSize;\n\tif ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {\n\n\t\t// use the component getters and setters if the array data cannot\n\t\t// be copied directly\n\t\tconst vertexCount = src.count;\n\t\tfor ( let i = 0; i < vertexCount; i ++ ) {\n\n\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\ttarget.setComponent( i + targetOffset, c, src.getComponent( i, c ) );\n\n\t\t\t}\n\n\t\t}\n\n\t} else {\n\n\t\t// faster copy approach using typed array set function\n\t\ttarget.array.set( src.array, targetOffset * itemSize );\n\n\t}\n\n\ttarget.needsUpdate = true;\n\n}\n\nclass BatchedMesh extends Mesh {\n\n\tget maxGeometryCount() {\n\n\t\treturn this._maxGeometryCount;\n\n\t}\n\n\tconstructor( maxGeometryCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {\n\n\t\tsuper( new BufferGeometry(), material );\n\n\t\tthis.isBatchedMesh = true;\n\t\tthis.perObjectFrustumCulled = true;\n\t\tthis.sortObjects = true;\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\t\tthis.customSort = null;\n\n\t\tthis._drawRanges = [];\n\t\tthis._reservedRanges = [];\n\n\t\tthis._visibility = [];\n\t\tthis._active = [];\n\t\tthis._bounds = [];\n\n\t\tthis._maxGeometryCount = maxGeometryCount;\n\t\tthis._maxVertexCount = maxVertexCount;\n\t\tthis._maxIndexCount = maxIndexCount;\n\n\t\tthis._geometryInitialized = false;\n\t\tthis._geometryCount = 0;\n\t\tthis._multiDrawCounts = new Int32Array( maxGeometryCount );\n\t\tthis._multiDrawStarts = new Int32Array( maxGeometryCount );\n\t\tthis._multiDrawCount = 0;\n\t\tthis._visibilityChanged = true;\n\n\t\t// Local matrix per geometry by using data texture\n\t\tthis._matricesTexture = null;\n\n\t\tthis._initMatricesTexture();\n\n\t}\n\n\t_initMatricesTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this._maxGeometryCount * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = Math.ceil( size / 4 ) * 4;\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tconst matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );\n\n\t\tthis._matricesTexture = matricesTexture;\n\n\t}\n\n\t_initializeGeometry( reference ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst maxVertexCount = this._maxVertexCount;\n\t\tconst maxGeometryCount = this._maxGeometryCount;\n\t\tconst maxIndexCount = this._maxIndexCount;\n\t\tif ( this._geometryInitialized === false ) {\n\n\t\t\tfor ( const attributeName in reference.attributes ) {\n\n\t\t\t\tconst srcAttribute = reference.getAttribute( attributeName );\n\t\t\t\tconst { array, itemSize, normalized } = srcAttribute;\n\n\t\t\t\tconst dstArray = new array.constructor( maxVertexCount * itemSize );\n\t\t\t\tconst dstAttribute = new srcAttribute.constructor( dstArray, itemSize, normalized );\n\t\t\t\tdstAttribute.setUsage( srcAttribute.usage );\n\n\t\t\t\tgeometry.setAttribute( attributeName, dstAttribute );\n\n\t\t\t}\n\n\t\t\tif ( reference.getIndex() !== null ) {\n\n\t\t\t\tconst indexArray = maxVertexCount > 65536\n\t\t\t\t\t? new Uint32Array( maxIndexCount )\n\t\t\t\t\t: new Uint16Array( maxIndexCount );\n\n\t\t\t\tgeometry.setIndex( new BufferAttribute( indexArray, 1 ) );\n\n\t\t\t}\n\n\t\t\tconst idArray = maxGeometryCount > 65536\n\t\t\t\t? new Uint32Array( maxVertexCount )\n\t\t\t\t: new Uint16Array( maxVertexCount );\n\t\t\tgeometry.setAttribute( ID_ATTR_NAME, new BufferAttribute( idArray, 1 ) );\n\n\t\t\tthis._geometryInitialized = true;\n\n\t\t}\n\n\t}\n\n\t// Make sure the geometry is compatible with the existing combined geometry atributes\n\t_validateGeometry( geometry ) {\n\n\t\t// check that the geometry doesn't have a version of our reserved id attribute\n\t\tif ( geometry.getAttribute( ID_ATTR_NAME ) ) {\n\n\t\t\tthrow new Error( `BatchedMesh: Geometry cannot use attribute \"${ ID_ATTR_NAME }\"` );\n\n\t\t}\n\n\t\t// check to ensure the geometries are using consistent attributes and indices\n\t\tconst batchGeometry = this.geometry;\n\t\tif ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: All geometries must consistently have \"index\".' );\n\n\t\t}\n\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\tif ( attributeName === ID_ATTR_NAME ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( ! geometry.hasAttribute( attributeName ) ) {\n\n\t\t\t\tthrow new Error( `BatchedMesh: Added geometry missing \"${ attributeName }\". All geometries must have consistent attributes.` );\n\n\t\t\t}\n\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tif ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {\n\n\t\t\t\tthrow new Error( 'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tsetCustomSort( func ) {\n\n\t\tthis.customSort = func;\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst geometryCount = this._geometryCount;\n\t\tconst boundingBox = this.boundingBox;\n\t\tconst active = this._active;\n\n\t\tboundingBox.makeEmpty();\n\t\tfor ( let i = 0; i < geometryCount; i ++ ) {\n\n\t\t\tif ( active[ i ] === false ) continue;\n\n\t\t\tthis.getMatrixAt( i, _matrix );\n\t\t\tthis.getBoundingBoxAt( i, _box$1 ).applyMatrix4( _matrix );\n\t\t\tboundingBox.union( _box$1 );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst geometryCount = this._geometryCount;\n\t\tconst boundingSphere = this.boundingSphere;\n\t\tconst active = this._active;\n\n\t\tboundingSphere.makeEmpty();\n\t\tfor ( let i = 0; i < geometryCount; i ++ ) {\n\n\t\t\tif ( active[ i ] === false ) continue;\n\n\t\t\tthis.getMatrixAt( i, _matrix );\n\t\t\tthis.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );\n\t\t\tboundingSphere.union( _sphere$2 );\n\n\t\t}\n\n\t}\n\n\taddGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {\n\n\t\tthis._initializeGeometry( geometry );\n\n\t\tthis._validateGeometry( geometry );\n\n\t\t// ensure we're not over geometry\n\t\tif ( this._geometryCount >= this._maxGeometryCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum geometry count reached.' );\n\n\t\t}\n\n\t\t// get the necessary range fo the geometry\n\t\tconst reservedRange = {\n\t\t\tvertexStart: - 1,\n\t\t\tvertexCount: - 1,\n\t\t\tindexStart: - 1,\n\t\t\tindexCount: - 1,\n\t\t};\n\n\t\tlet lastRange = null;\n\t\tconst reservedRanges = this._reservedRanges;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst bounds = this._bounds;\n\t\tif ( this._geometryCount !== 0 ) {\n\n\t\t\tlastRange = reservedRanges[ reservedRanges.length - 1 ];\n\n\t\t}\n\n\t\tif ( vertexCount === - 1 ) {\n\n\t\t\treservedRange.vertexCount = geometry.getAttribute( 'position' ).count;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexCount = vertexCount;\n\n\t\t}\n\n\t\tif ( lastRange === null ) {\n\n\t\t\treservedRange.vertexStart = 0;\n\n\t\t} else {\n\n\t\t\treservedRange.vertexStart = lastRange.vertexStart + lastRange.vertexCount;\n\n\t\t}\n\n\t\tconst index = geometry.getIndex();\n\t\tconst hasIndex = index !== null;\n\t\tif ( hasIndex ) {\n\n\t\t\tif ( indexCount\t=== - 1 ) {\n\n\t\t\t\treservedRange.indexCount = index.count;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexCount = indexCount;\n\n\t\t\t}\n\n\t\t\tif ( lastRange === null ) {\n\n\t\t\t\treservedRange.indexStart = 0;\n\n\t\t\t} else {\n\n\t\t\t\treservedRange.indexStart = lastRange.indexStart + lastRange.indexCount;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif (\n\t\t\treservedRange.indexStart !== - 1 &&\n\t\t\treservedRange.indexStart + reservedRange.indexCount > this._maxIndexCount ||\n\t\t\treservedRange.vertexStart + reservedRange.vertexCount > this._maxVertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );\n\n\t\t}\n\n\t\tconst visibility = this._visibility;\n\t\tconst active = this._active;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\n\t\t// push new visibility states\n\t\tvisibility.push( true );\n\t\tactive.push( true );\n\n\t\t// update id\n\t\tconst geometryId = this._geometryCount;\n\t\tthis._geometryCount ++;\n\n\t\t// initialize matrix information\n\t\t_identityMatrix.toArray( matricesArray, geometryId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\t// add the reserved range and draw range objects\n\t\treservedRanges.push( reservedRange );\n\t\tdrawRanges.push( {\n\t\t\tstart: hasIndex ? reservedRange.indexStart : reservedRange.vertexStart,\n\t\t\tcount: - 1\n\t\t} );\n\t\tbounds.push( {\n\t\t\tboxInitialized: false,\n\t\t\tbox: new Box3(),\n\n\t\t\tsphereInitialized: false,\n\t\t\tsphere: new Sphere()\n\t\t} );\n\n\t\t// set the id for the geometry\n\t\tconst idAttribute = this.geometry.getAttribute( ID_ATTR_NAME );\n\t\tfor ( let i = 0; i < reservedRange.vertexCount; i ++ ) {\n\n\t\t\tidAttribute.setX( reservedRange.vertexStart + i, geometryId );\n\n\t\t}\n\n\t\tidAttribute.needsUpdate = true;\n\n\t\t// update the geometry\n\t\tthis.setGeometryAt( geometryId, geometry );\n\n\t\treturn geometryId;\n\n\t}\n\n\tsetGeometryAt( id, geometry ) {\n\n\t\tif ( id >= this._geometryCount ) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Maximum geometry count reached.' );\n\n\t\t}\n\n\t\tthis._validateGeometry( geometry );\n\n\t\tconst batchGeometry = this.geometry;\n\t\tconst hasIndex = batchGeometry.getIndex() !== null;\n\t\tconst dstIndex = batchGeometry.getIndex();\n\t\tconst srcIndex = geometry.getIndex();\n\t\tconst reservedRange = this._reservedRanges[ id ];\n\t\tif (\n\t\t\thasIndex &&\n\t\t\tsrcIndex.count > reservedRange.indexCount ||\n\t\t\tgeometry.attributes.position.count > reservedRange.vertexCount\n\t\t) {\n\n\t\t\tthrow new Error( 'BatchedMesh: Reserved space not large enough for provided geometry.' );\n\n\t\t}\n\n\t\t// copy geometry over\n\t\tconst vertexStart = reservedRange.vertexStart;\n\t\tconst vertexCount = reservedRange.vertexCount;\n\t\tfor ( const attributeName in batchGeometry.attributes ) {\n\n\t\t\tif ( attributeName === ID_ATTR_NAME ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// copy attribute data\n\t\t\tconst srcAttribute = geometry.getAttribute( attributeName );\n\t\t\tconst dstAttribute = batchGeometry.getAttribute( attributeName );\n\t\t\tcopyAttributeData( srcAttribute, dstAttribute, vertexStart );\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tconst itemSize = srcAttribute.itemSize;\n\t\t\tfor ( let i = srcAttribute.count, l = vertexCount; i < l; i ++ ) {\n\n\t\t\t\tconst index = vertexStart + i;\n\t\t\t\tfor ( let c = 0; c < itemSize; c ++ ) {\n\n\t\t\t\t\tdstAttribute.setComponent( index, c, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tdstAttribute.needsUpdate = true;\n\n\t\t}\n\n\t\t// copy index\n\t\tif ( hasIndex ) {\n\n\t\t\tconst indexStart = reservedRange.indexStart;\n\n\t\t\t// copy index data over\n\t\t\tfor ( let i = 0; i < srcIndex.count; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );\n\n\t\t\t}\n\n\t\t\t// fill the rest in with zeroes\n\t\t\tfor ( let i = srcIndex.count, l = reservedRange.indexCount; i < l; i ++ ) {\n\n\t\t\t\tdstIndex.setX( indexStart + i, vertexStart );\n\n\t\t\t}\n\n\t\t\tdstIndex.needsUpdate = true;\n\n\t\t}\n\n\t\t// store the bounding boxes\n\t\tconst bound = this._bounds[ id ];\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tbound.box.copy( geometry.boundingBox );\n\t\t\tbound.boxInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.boxInitialized = false;\n\n\t\t}\n\n\t\tif ( geometry.boundingSphere !== null ) {\n\n\t\t\tbound.sphere.copy( geometry.boundingSphere );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t} else {\n\n\t\t\tbound.sphereInitialized = false;\n\n\t\t}\n\n\t\t// set drawRange count\n\t\tconst drawRange = this._drawRanges[ id ];\n\t\tconst posAttr = geometry.getAttribute( 'position' );\n\t\tdrawRange.count = hasIndex ? srcIndex.count : posAttr.count;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn id;\n\n\t}\n\n\tdeleteGeometry( geometryId ) {\n\n\t\t// Note: User needs to call optimize() afterward to pack the data.\n\n\t\tconst active = this._active;\n\t\tif ( geometryId >= active.length || active[ geometryId ] === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tactive[ geometryId ] = false;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\t// get bounding box and compute it if it doesn't exist\n\tgetBoundingBoxAt( id, target ) {\n\n\t\tconst active = this._active;\n\t\tif ( active[ id ] === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t// compute bounding box\n\t\tconst bound = this._bounds[ id ];\n\t\tconst box = bound.box;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.boxInitialized === false ) {\n\n\t\t\tbox.makeEmpty();\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ id ];\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\tbox.expandByPoint( _vector$5.fromBufferAttribute( position, iv ) );\n\n\t\t\t}\n\n\t\t\tbound.boxInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( box );\n\t\treturn target;\n\n\t}\n\n\t// get bounding sphere and compute it if it doesn't exist\n\tgetBoundingSphereAt( id, target ) {\n\n\t\tconst active = this._active;\n\t\tif ( active[ id ] === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\t// compute bounding sphere\n\t\tconst bound = this._bounds[ id ];\n\t\tconst sphere = bound.sphere;\n\t\tconst geometry = this.geometry;\n\t\tif ( bound.sphereInitialized === false ) {\n\n\t\t\tsphere.makeEmpty();\n\n\t\t\tthis.getBoundingBoxAt( id, _box$1 );\n\t\t\t_box$1.getCenter( sphere.center );\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst drawRange = this._drawRanges[ id ];\n\n\t\t\tlet maxRadiusSq = 0;\n\t\t\tfor ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {\n\n\t\t\t\tlet iv = i;\n\t\t\t\tif ( index ) {\n\n\t\t\t\t\tiv = index.getX( iv );\n\n\t\t\t\t}\n\n\t\t\t\t_vector$5.fromBufferAttribute( position, iv );\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector$5 ) );\n\n\t\t\t}\n\n\t\t\tsphere.radius = Math.sqrt( maxRadiusSq );\n\t\t\tbound.sphereInitialized = true;\n\n\t\t}\n\n\t\ttarget.copy( sphere );\n\t\treturn target;\n\n\t}\n\n\tsetMatrixAt( geometryId, matrix ) {\n\n\t\t// @TODO: Map geometryId to index of the arrays because\n\t\t// optimize() can make geometryId mismatch the index\n\n\t\tconst active = this._active;\n\t\tconst matricesTexture = this._matricesTexture;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tconst geometryCount = this._geometryCount;\n\t\tif ( geometryId >= geometryCount || active[ geometryId ] === false ) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tmatrix.toArray( matricesArray, geometryId * 16 );\n\t\tmatricesTexture.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetMatrixAt( geometryId, matrix ) {\n\n\t\tconst active = this._active;\n\t\tconst matricesArray = this._matricesTexture.image.data;\n\t\tconst geometryCount = this._geometryCount;\n\t\tif ( geometryId >= geometryCount || active[ geometryId ] === false ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn matrix.fromArray( matricesArray, geometryId * 16 );\n\n\t}\n\n\tsetVisibleAt( geometryId, value ) {\n\n\t\tconst visibility = this._visibility;\n\t\tconst active = this._active;\n\t\tconst geometryCount = this._geometryCount;\n\n\t\t// if the geometry is out of range, not active, or visibility state\n\t\t// does not change then return early\n\t\tif (\n\t\t\tgeometryId >= geometryCount ||\n\t\t\tactive[ geometryId ] === false ||\n\t\t\tvisibility[ geometryId ] === value\n\t\t) {\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tvisibility[ geometryId ] = value;\n\t\tthis._visibilityChanged = true;\n\n\t\treturn this;\n\n\t}\n\n\tgetVisibleAt( geometryId ) {\n\n\t\tconst visibility = this._visibility;\n\t\tconst active = this._active;\n\t\tconst geometryCount = this._geometryCount;\n\n\t\t// return early if the geometry is out of range or not active\n\t\tif ( geometryId >= geometryCount || active[ geometryId ] === false ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn visibility[ geometryId ];\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst visibility = this._visibility;\n\t\tconst active = this._active;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst geometryCount = this._geometryCount;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst batchGeometry = this.geometry;\n\n\t\t// iterate over each geometry\n\t\t_mesh.material = this.material;\n\t\t_mesh.geometry.index = batchGeometry.index;\n\t\t_mesh.geometry.attributes = batchGeometry.attributes;\n\t\tif ( _mesh.geometry.boundingBox === null ) {\n\n\t\t\t_mesh.geometry.boundingBox = new Box3();\n\n\t\t}\n\n\t\tif ( _mesh.geometry.boundingSphere === null ) {\n\n\t\t\t_mesh.geometry.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tfor ( let i = 0; i < geometryCount; i ++ ) {\n\n\t\t\tif ( ! visibility[ i ] || ! active[ i ] ) {\n\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst drawRange = drawRanges[ i ];\n\t\t\t_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );\n\n\t\t\t// ge the intersects\n\t\t\tthis.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );\n\t\t\tthis.getBoundingBoxAt( i, _mesh.geometry.boundingBox );\n\t\t\tthis.getBoundingSphereAt( i, _mesh.geometry.boundingSphere );\n\t\t\t_mesh.raycast( raycaster, _batchIntersects );\n\n\t\t\t// add batch id to the intersects\n\t\t\tfor ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {\n\n\t\t\t\tconst intersect = _batchIntersects[ j ];\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersect.batchId = i;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_batchIntersects.length = 0;\n\n\t\t}\n\n\t\t_mesh.material = null;\n\t\t_mesh.geometry.index = null;\n\t\t_mesh.geometry.attributes = {};\n\t\t_mesh.geometry.setDrawRange( 0, Infinity );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.geometry = source.geometry.clone();\n\t\tthis.perObjectFrustumCulled = source.perObjectFrustumCulled;\n\t\tthis.sortObjects = source.sortObjects;\n\t\tthis.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;\n\t\tthis.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;\n\n\t\tthis._drawRanges = source._drawRanges.map( range => ( { ...range } ) );\n\t\tthis._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );\n\n\t\tthis._visibility = source._visibility.slice();\n\t\tthis._active = source._active.slice();\n\t\tthis._bounds = source._bounds.map( bound => ( {\n\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\tbox: bound.box.clone(),\n\n\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\tsphere: bound.sphere.clone()\n\t\t} ) );\n\n\t\tthis._maxGeometryCount = source._maxGeometryCount;\n\t\tthis._maxVertexCount = source._maxVertexCount;\n\t\tthis._maxIndexCount = source._maxIndexCount;\n\n\t\tthis._geometryInitialized = source._geometryInitialized;\n\t\tthis._geometryCount = source._geometryCount;\n\t\tthis._multiDrawCounts = source._multiDrawCounts.slice();\n\t\tthis._multiDrawStarts = source._multiDrawStarts.slice();\n\n\t\tthis._matricesTexture = source._matricesTexture.clone();\n\t\tthis._matricesTexture.image.data = this._matricesTexture.image.slice();\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\t// Assuming the geometry is not shared with other meshes\n\t\tthis.geometry.dispose();\n\n\t\tthis._matricesTexture.dispose();\n\t\tthis._matricesTexture = null;\n\t\treturn this;\n\n\t}\n\n\tonBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {\n\n\t\t// if visibility has not changed and frustum culling and object sorting is not required\n\t\t// then skip iterating over all items\n\t\tif ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// the indexed version of the multi draw function requires specifying the start\n\t\t// offset in bytes.\n\t\tconst index = geometry.getIndex();\n\t\tconst bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;\n\n\t\tconst visibility = this._visibility;\n\t\tconst multiDrawStarts = this._multiDrawStarts;\n\t\tconst multiDrawCounts = this._multiDrawCounts;\n\t\tconst drawRanges = this._drawRanges;\n\t\tconst perObjectFrustumCulled = this.perObjectFrustumCulled;\n\n\t\t// prepare the frustum in the local frame\n\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t_projScreenMatrix$2\n\t\t\t\t.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )\n\t\t\t\t.multiply( this.matrixWorld );\n\t\t\t_frustum.setFromProjectionMatrix(\n\t\t\t\t_projScreenMatrix$2,\n\t\t\t\trenderer.isWebGPURenderer ? WebGPUCoordinateSystem : WebGLCoordinateSystem\n\t\t\t);\n\n\t\t}\n\n\t\tlet count = 0;\n\t\tif ( this.sortObjects ) {\n\n\t\t\t// get the camera position in the local frame\n\t\t\t_invMatrixWorld.copy( this.matrixWorld ).invert();\n\t\t\t_vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );\n\n\t\t\tfor ( let i = 0, l = visibility.length; i < l; i ++ ) {\n\n\t\t\t\tif ( visibility[ i ] ) {\n\n\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\tthis.getMatrixAt( i, _matrix );\n\t\t\t\t\tthis.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\t// get the distance from camera used for sorting\n\t\t\t\t\t\tconst z = _vector$5.distanceTo( _sphere$2.center );\n\t\t\t\t\t\t_renderList.push( drawRanges[ i ], z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Sort the draw ranges and prep for rendering\n\t\t\tconst list = _renderList.list;\n\t\t\tconst customSort = this.customSort;\n\t\t\tif ( customSort === null ) {\n\n\t\t\t\tlist.sort( material.transparent ? sortTransparent : sortOpaque );\n\n\t\t\t} else {\n\n\t\t\t\tcustomSort.call( this, list, camera );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = list.length; i < l; i ++ ) {\n\n\t\t\t\tconst item = list[ i ];\n\t\t\t\tmultiDrawStarts[ count ] = item.start * bytesPerElement;\n\t\t\t\tmultiDrawCounts[ count ] = item.count;\n\t\t\t\tcount ++;\n\n\t\t\t}\n\n\t\t\t_renderList.reset();\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0, l = visibility.length; i < l; i ++ ) {\n\n\t\t\t\tif ( visibility[ i ] ) {\n\n\t\t\t\t\t// determine whether the batched geometry is within the frustum\n\t\t\t\t\tlet culled = false;\n\t\t\t\t\tif ( perObjectFrustumCulled ) {\n\n\t\t\t\t\t\t// get the bounds in world space\n\t\t\t\t\t\tthis.getMatrixAt( i, _matrix );\n\t\t\t\t\t\tthis.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );\n\t\t\t\t\t\tculled = ! _frustum.intersectsSphere( _sphere$2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! culled ) {\n\n\t\t\t\t\t\tconst range = drawRanges[ i ];\n\t\t\t\t\t\tmultiDrawStarts[ count ] = range.start * bytesPerElement;\n\t\t\t\t\t\tmultiDrawCounts[ count ] = range.count;\n\t\t\t\t\t\tcount ++;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._multiDrawCount = count;\n\t\tthis._visibilityChanged = false;\n\n\t}\n\n\tonBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {\n\n\t\tthis.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );\n\n\t}\n\n}\n\nclass LineBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineBasicMaterial = true;\n\n\t\tthis.type = 'LineBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.linewidth = 1;\n\t\tthis.linecap = 'round';\n\t\tthis.linejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.linewidth = source.linewidth;\n\t\tthis.linecap = source.linecap;\n\t\tthis.linejoin = source.linejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _start$1 = /*@__PURE__*/ new Vector3();\nconst _end$1 = /*@__PURE__*/ new Vector3();\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nclass Line extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isLine = true;\n\n\t\tthis.type = 'Line';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [ 0 ];\n\n\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t_start$1.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t_end$1.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i ] += _start$1.distanceTo( _end$1 );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Line.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$1.copy( geometry.boundingSphere );\n\t\t_sphere$1.applyMatrix4( matrixWorld );\n\t\t_sphere$1.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$1.copy( matrixWorld ).invert();\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst vStart = new Vector3();\n\t\tconst vEnd = new Vector3();\n\t\tconst interSegment = new Vector3();\n\t\tconst interRay = new Vector3();\n\t\tconst step = this.isLineSegments ? 2 : 1;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tconst a = index.getX( i );\n\t\t\t\tconst b = index.getX( i + 1 );\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, a );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, b );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\tvStart.fromBufferAttribute( positionAttribute, i );\n\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\tintersects.push( {\n\n\t\t\t\t\tdistance: distance,\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\tindex: i,\n\t\t\t\t\tface: null,\n\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\tobject: this\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nconst _start = /*@__PURE__*/ new Vector3();\nconst _end = /*@__PURE__*/ new Vector3();\n\nclass LineSegments extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineSegments = true;\n\n\t\tthis.type = 'LineSegments';\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\t// we assume non-indexed geometry\n\n\t\tif ( geometry.index === null ) {\n\n\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\tconst lineDistances = [];\n\n\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {\n\n\t\t\t\t_start.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t_end.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineLoop extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isLineLoop = true;\n\n\t\tthis.type = 'LineLoop';\n\n\t}\n\n}\n\nclass PointsMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isPointsMaterial = true;\n\n\t\tthis.type = 'PointsMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.size = 1;\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.size = source.size;\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _position$2 = /*@__PURE__*/ new Vector3();\n\nclass Points extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.isPoints = true;\n\n\t\tthis.type = 'Points';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.material = Array.isArray( source.material ) ? source.material.slice() : source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Points.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst index = geometry.index;\n\t\tconst attributes = geometry.attributes;\n\t\tconst positionAttribute = attributes.position;\n\n\t\tif ( index !== null ) {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\n\n\t\t\t\tconst a = index.getX( i );\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, a );\n\n\t\t\t\ttestPoint( _position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\n\n\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\ttestPoint( _position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\t\tconst keys = Object.keys( morphAttributes );\n\n\t\tif ( keys.length > 0 ) {\n\n\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tconst intersectPoint = new Vector3();\n\n\t\t_ray.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\nclass VideoTexture extends Texture {\n\n\tconstructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isVideoTexture = true;\n\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tconst scope = this;\n\n\t\tfunction updateVideo() {\n\n\t\t\tscope.needsUpdate = true;\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t\tif ( 'requestVideoFrameCallback' in video ) {\n\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.image ).copy( this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst video = this.image;\n\t\tconst hasVideoFrameCallback = 'requestVideoFrameCallback' in video;\n\n\t\tif ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n}\n\nclass FramebufferTexture extends Texture {\n\n\tconstructor( width, height ) {\n\n\t\tsuper( { width, height } );\n\n\t\tthis.isFramebufferTexture = true;\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nclass CompressedTexture extends Texture {\n\n\tconstructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );\n\n\t\tthis.isCompressedTexture = true;\n\n\t\tthis.image = { width: width, height: height };\n\t\tthis.mipmaps = mipmaps;\n\n\t\t// no flipping for cube textures\n\t\t// (also flipping doesn't work for compressed textures )\n\n\t\tthis.flipY = false;\n\n\t\t// can't generate mipmaps for compressed textures\n\t\t// mips must be embedded in DDS files\n\n\t\tthis.generateMipmaps = false;\n\n\t}\n\n}\n\nclass CompressedArrayTexture extends CompressedTexture {\n\n\tconstructor( mipmaps, width, height, depth, format, type ) {\n\n\t\tsuper( mipmaps, width, height, format, type );\n\n\t\tthis.isCompressedArrayTexture = true;\n\t\tthis.image.depth = depth;\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t}\n\n}\n\nclass CompressedCubeTexture extends CompressedTexture {\n\n\tconstructor( images, format, type ) {\n\n\t\tsuper( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );\n\n\t\tthis.isCompressedCubeTexture = true;\n\t\tthis.isCubeTexture = true;\n\n\t\tthis.image = images;\n\n\t}\n\n}\n\nclass CanvasTexture extends Texture {\n\n\tconstructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.isCanvasTexture = true;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\n\nclass Curve {\n\n\tconstructor() {\n\n\t\tthis.type = 'Curve';\n\n\t\tthis.arcLengthDivisions = 200;\n\n\t}\n\n\t// Virtual base class method to overwrite and implement in subclasses\n\t//\t- t [0 .. 1]\n\n\tgetPoint( /* t, optionalTarget */ ) {\n\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\n\t\treturn null;\n\n\t}\n\n\t// Get point at relative position in curve according to arc length\n\t// - u [0 .. 1]\n\n\tgetPointAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t}\n\n\t// Get sequence of points using getPoint( t )\n\n\tgetPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get sequence of points using getPointAt( u )\n\n\tgetSpacedPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get total curve arc length\n\n\tgetLength() {\n\n\t\tconst lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t}\n\n\t// Get list of cumulative segment lengths\n\n\tgetLengths( divisions = this.arcLengthDivisions ) {\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tconst cache = [];\n\t\tlet current, last = this.getPoint( 0 );\n\t\tlet sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t}\n\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t}\n\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n\n\tgetUtoTmapping( u, distance ) {\n\n\t\tconst arcLengths = this.getLengths();\n\n\t\tlet i = 0;\n\t\tconst il = arcLengths.length;\n\n\t\tlet targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tlet low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tconst lengthBefore = arcLengths[ i ];\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\n\n\t\tconst segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t}\n\n\t// Returns a unit vector tangent at t\n\t// In case any sub curve does not implement its tangent derivation,\n\t// 2 points a small delta apart will be used to find its gradient\n\t// which seems to give a reasonable approximation\n\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst delta = 0.0001;\n\t\tlet t1 = t - delta;\n\t\tlet t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tconst pt1 = this.getPoint( t1 );\n\t\tconst pt2 = this.getPoint( t2 );\n\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\n\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t, optionalTarget );\n\n\t}\n\n\tcomputeFrenetFrames( segments, closed ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tconst normal = new Vector3();\n\n\t\tconst tangents = [];\n\t\tconst normals = [];\n\t\tconst binormals = [];\n\n\t\tconst vec = new Vector3();\n\t\tconst mat = new Matrix4();\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst u = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tlet min = Number.MAX_VALUE;\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\tconst theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\tlet theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass EllipseCurve extends Curve {\n\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.isEllipseCurve = true;\n\n\t\tthis.type = 'EllipseCurve';\n\n\t\tthis.aX = aX;\n\t\tthis.aY = aY;\n\n\t\tthis.xRadius = xRadius;\n\t\tthis.yRadius = yRadius;\n\n\t\tthis.aStartAngle = aStartAngle;\n\t\tthis.aEndAngle = aEndAngle;\n\n\t\tthis.aClockwise = aClockwise;\n\n\t\tthis.aRotation = aRotation;\n\n\t}\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst point = optionalTarget || new Vector2();\n\n\t\tconst twoPi = Math.PI * 2;\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t\t// ensures that deltaAngle is 0 .. 2 PI\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\t\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\t\tif ( samePoints ) {\n\n\t\t\t\tdeltaAngle = 0;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\t\tdeltaAngle = - twoPi;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\n\n\t\tif ( this.aRotation !== 0 ) {\n\n\t\t\tconst cos = Math.cos( this.aRotation );\n\t\t\tconst sin = Math.sin( this.aRotation );\n\n\t\t\tconst tx = x - this.aX;\n\t\t\tconst ty = y - this.aY;\n\n\t\t\t// Rotate the point about the center of the ellipse.\n\t\t\tx = tx * cos - ty * sin + this.aX;\n\t\t\ty = tx * sin + ty * cos + this.aY;\n\n\t\t}\n\n\t\treturn point.set( x, y );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.aX = source.aX;\n\t\tthis.aY = source.aY;\n\n\t\tthis.xRadius = source.xRadius;\n\t\tthis.yRadius = source.yRadius;\n\n\t\tthis.aStartAngle = source.aStartAngle;\n\t\tthis.aEndAngle = source.aEndAngle;\n\n\t\tthis.aClockwise = source.aClockwise;\n\n\t\tthis.aRotation = source.aRotation;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.aX = this.aX;\n\t\tdata.aY = this.aY;\n\n\t\tdata.xRadius = this.xRadius;\n\t\tdata.yRadius = this.yRadius;\n\n\t\tdata.aStartAngle = this.aStartAngle;\n\t\tdata.aEndAngle = this.aEndAngle;\n\n\t\tdata.aClockwise = this.aClockwise;\n\n\t\tdata.aRotation = this.aRotation;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.aX = json.aX;\n\t\tthis.aY = json.aY;\n\n\t\tthis.xRadius = json.xRadius;\n\t\tthis.yRadius = json.yRadius;\n\n\t\tthis.aStartAngle = json.aStartAngle;\n\t\tthis.aEndAngle = json.aEndAngle;\n\n\t\tthis.aClockwise = json.aClockwise;\n\n\t\tthis.aRotation = json.aRotation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass ArcCurve extends EllipseCurve {\n\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\tthis.isArcCurve = true;\n\n\t\tthis.type = 'ArcCurve';\n\n\t}\n\n}\n\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n\n\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\n\nfunction CubicPoly() {\n\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tconst t2 = t * t;\n\t\t\tconst t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nconst tmp = /*@__PURE__*/ new Vector3();\nconst px = /*@__PURE__*/ new CubicPoly();\nconst py = /*@__PURE__*/ new CubicPoly();\nconst pz = /*@__PURE__*/ new CubicPoly();\n\nclass CatmullRomCurve3 extends Curve {\n\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\n\n\t\tsuper();\n\n\t\tthis.isCatmullRomCurve3 = true;\n\n\t\tthis.type = 'CatmullRomCurve3';\n\n\t\tthis.points = points;\n\t\tthis.closed = closed;\n\t\tthis.curveType = curveType;\n\t\tthis.tension = tension;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst l = points.length;\n\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\t\tlet intPoint = Math.floor( p );\n\t\tlet weight = p - intPoint;\n\n\t\tif ( this.closed ) {\n\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\t\tintPoint = l - 2;\n\t\t\tweight = 1;\n\n\t\t}\n\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\n\n\t\tif ( this.closed || intPoint > 0 ) {\n\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate first point\n\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\t\tp0 = tmp;\n\n\t\t}\n\n\t\tconst p1 = points[ intPoint % l ];\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\n\n\t\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate last point\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\t\tp3 = tmp;\n\n\t\t}\n\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t\t// init Centripetal / Chordal Catmull-Rom\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t\t// safety check for repeated points\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t\t}\n\n\t\tpoint.set(\n\t\t\tpx.calc( weight ),\n\t\t\tpy.calc( weight ),\n\t\t\tpz.calc( weight )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\tthis.closed = source.closed;\n\t\tthis.curveType = source.curveType;\n\t\tthis.tension = source.tension;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\tdata.closed = this.closed;\n\t\tdata.curveType = this.curveType;\n\t\tdata.tension = this.tension;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t\t}\n\n\t\tthis.closed = json.closed;\n\t\tthis.curveType = json.curveType;\n\t\tthis.tension = json.tension;\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */\n\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tconst v0 = ( p2 - p0 ) * 0.5;\n\tconst v1 = ( p3 - p1 ) * 0.5;\n\tconst t2 = t * t;\n\tconst t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tconst k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\nclass CubicBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve = true;\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass CubicBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve3 = true;\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve extends Curve {\n\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve = true;\n\n\t\tthis.type = 'LineCurve';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector2() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineCurve3 extends Curve {\n\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve3 = true;\n\n\t\tthis.type = 'LineCurve3';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector3() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve = true;\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve3 = true;\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SplineCurve extends Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isSplineCurve = true;\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nvar Curves = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tArcCurve: ArcCurve,\n\tCatmullRomCurve3: CatmullRomCurve3,\n\tCubicBezierCurve: CubicBezierCurve,\n\tCubicBezierCurve3: CubicBezierCurve3,\n\tEllipseCurve: EllipseCurve,\n\tLineCurve: LineCurve,\n\tLineCurve3: LineCurve3,\n\tQuadraticBezierCurve: QuadraticBezierCurve,\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\n\tSplineCurve: SplineCurve\n});\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\n\nclass CurvePath extends Curve {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'CurvePath';\n\n\t\tthis.curves = [];\n\t\tthis.autoClose = false; // Automatically closes the path\n\n\t}\n\n\tadd( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t}\n\n\tclosePath() {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tconst lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';\n\t\t\tthis.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// To get accurate point with reference to\n\t// entire path distance at time t,\n\t// following has to be done:\n\n\t// 1. Length of each sub path have to be known\n\t// 2. Locate and identify type of curve\n\t// 3. Get t for the curve\n\t// 4. Return curve.getPointAt(t')\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst d = t * this.getLength();\n\t\tconst curveLengths = this.getCurveLengths();\n\t\tlet i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tconst diff = curveLengths[ i ] - d;\n\t\t\t\tconst curve = this.curves[ i ];\n\n\t\t\t\tconst segmentLength = curve.getLength();\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Path extends CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LatheGeometry extends BufferGeometry {\n\n\tconstructor( points = [ new Vector2( 0, - 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LatheGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpoints: points,\n\t\t\tsegments: segments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength\n\t\t};\n\n\t\tsegments = Math.floor( segments );\n\n\t\t// clamp phiLength so it's in range of [ 0, 2PI ]\n\n\t\tphiLength = clamp( phiLength, 0, Math.PI * 2 );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst uvs = [];\n\t\tconst initNormals = [];\n\t\tconst normals = [];\n\n\t\t// helper variables\n\n\t\tconst inverseSegments = 1.0 / segments;\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tconst normal = new Vector3();\n\t\tconst curNormal = new Vector3();\n\t\tconst prevNormal = new Vector3();\n\t\tlet dx = 0;\n\t\tlet dy = 0;\n\n\t\t// pre-compute normals for initial \"meridian\"\n\n\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\tswitch ( j ) {\n\n\t\t\t\tcase 0:\t\t\t\t// special handling for 1st vertex on path\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tprevNormal.copy( normal );\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ( points.length - 1 ):\t// special handling for last Vertex on path\n\n\t\t\t\t\tinitNormals.push( prevNormal.x, prevNormal.y, prevNormal.z );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\t\t\t// default handling for all vertices in between\n\n\t\t\t\t\tdx = points[ j + 1 ].x - points[ j ].x;\n\t\t\t\t\tdy = points[ j + 1 ].y - points[ j ].y;\n\n\t\t\t\t\tnormal.x = dy * 1.0;\n\t\t\t\t\tnormal.y = - dx;\n\t\t\t\t\tnormal.z = dy * 0.0;\n\n\t\t\t\t\tcurNormal.copy( normal );\n\n\t\t\t\t\tnormal.x += prevNormal.x;\n\t\t\t\t\tnormal.y += prevNormal.y;\n\t\t\t\t\tnormal.z += prevNormal.z;\n\n\t\t\t\t\tnormal.normalize();\n\n\t\t\t\t\tinitNormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\tprevNormal.copy( curNormal );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate vertices, uvs and normals\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst phi = phiStart + i * inverseSegments * phiLength;\n\n\t\t\tconst sin = Math.sin( phi );\n\t\t\tconst cos = Math.cos( phi );\n\n\t\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = points[ j ].x * sin;\n\t\t\t\tvertex.y = points[ j ].y;\n\t\t\t\tvertex.z = points[ j ].x * cos;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = i / segments;\n\t\t\t\tuv.y = j / ( points.length - 1 );\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// normal\n\n\t\t\t\tconst x = initNormals[ 3 * j + 0 ] * sin;\n\t\t\t\tconst y = initNormals[ 3 * j + 1 ];\n\t\t\t\tconst z = initNormals[ 3 * j + 0 ] * cos;\n\n\t\t\t\tnormals.push( x, y, z );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 0; i < segments; i ++ ) {\n\n\t\t\tfor ( let j = 0; j < ( points.length - 1 ); j ++ ) {\n\n\t\t\t\tconst base = j + i * points.length;\n\n\t\t\t\tconst a = base;\n\t\t\t\tconst b = base + points.length;\n\t\t\t\tconst c = base + points.length + 1;\n\t\t\t\tconst d = base + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( c, d, b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new LatheGeometry( data.points, data.segments, data.phiStart, data.phiLength );\n\n\t}\n\n}\n\nclass CapsuleGeometry extends LatheGeometry {\n\n\tconstructor( radius = 1, length = 1, capSegments = 4, radialSegments = 8 ) {\n\n\t\tconst path = new Path();\n\t\tpath.absarc( 0, - length / 2, radius, Math.PI * 1.5, 0 );\n\t\tpath.absarc( 0, length / 2, radius, 0, Math.PI * 0.5 );\n\n\t\tsuper( path.getPoints( capSegments ), radialSegments );\n\n\t\tthis.type = 'CapsuleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tlength: length,\n\t\t\tcapSegments: capSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CapsuleGeometry( data.radius, data.length, data.capSegments, data.radialSegments );\n\n\t}\n\n}\n\nclass CircleGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CircleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tsegments: segments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tsegments = Math.max( 3, segments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// center point\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tnormals.push( 0, 0, 1 );\n\t\tuvs.push( 0.5, 0.5 );\n\n\t\tfor ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {\n\n\t\t\tconst segment = thetaStart + s / segments * thetaLength;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t// uvs\n\n\t\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\n\t\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tindices.push( i, i + 1, 0 );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CircleGeometry( data.radius, data.segments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass CylinderGeometry extends BufferGeometry {\n\n\tconstructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CylinderGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradiusTop: radiusTop,\n\t\t\tradiusBottom: radiusBottom,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tconst scope = this;\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet index = 0;\n\t\tconst indexArray = [];\n\t\tconst halfHeight = height / 2;\n\t\tlet groupStart = 0;\n\n\t\t// generate geometry\n\n\t\tgenerateTorso();\n\n\t\tif ( openEnded === false ) {\n\n\t\t\tif ( radiusTop > 0 ) generateCap( true );\n\t\t\tif ( radiusBottom > 0 ) generateCap( false );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction generateTorso() {\n\n\t\t\tconst normal = new Vector3();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\t// this will be used to calculate the normal\n\t\t\tconst slope = ( radiusBottom - radiusTop ) / height;\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let y = 0; y <= heightSegments; y ++ ) {\n\n\t\t\t\tconst indexRow = [];\n\n\t\t\t\tconst v = y / heightSegments;\n\n\t\t\t\t// calculate the radius of the current row\n\n\t\t\t\tconst radius = v * ( radiusBottom - radiusTop ) + radiusTop;\n\n\t\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\t\tconst u = x / radialSegments;\n\n\t\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\t\tconst sinTheta = Math.sin( theta );\n\t\t\t\t\tconst cosTheta = Math.cos( theta );\n\n\t\t\t\t\t// vertex\n\n\t\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\t\tvertex.y = - v * height + halfHeight;\n\t\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t\t// normal\n\n\t\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\n\t\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\t// uv\n\n\t\t\t\t\tuvs.push( u, 1 - v );\n\n\t\t\t\t\t// save index of vertex in respective row\n\n\t\t\t\t\tindexRow.push( index ++ );\n\n\t\t\t\t}\n\n\t\t\t\t// now save vertices of the row in our index array\n\n\t\t\t\tindexArray.push( indexRow );\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tfor ( let y = 0; y < heightSegments; y ++ ) {\n\n\t\t\t\t\t// we use the index array to access the correct indices\n\n\t\t\t\t\tconst a = indexArray[ y ][ x ];\n\t\t\t\t\tconst b = indexArray[ y + 1 ][ x ];\n\t\t\t\t\tconst c = indexArray[ y + 1 ][ x + 1 ];\n\t\t\t\t\tconst d = indexArray[ y ][ x + 1 ];\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// update group counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, 0 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t\tfunction generateCap( top ) {\n\n\t\t\t// save the index of the first center vertex\n\t\t\tconst centerIndexStart = index;\n\n\t\t\tconst uv = new Vector2();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst radius = ( top === true ) ? radiusTop : radiusBottom;\n\t\t\tconst sign = ( top === true ) ? 1 : - 1;\n\n\t\t\t// first we generate the center vertex data of the cap.\n\t\t\t// because the geometry needs one set of uvs per face,\n\t\t\t// we must generate a center vertex per face/segment\n\n\t\t\tfor ( let x = 1; x <= radialSegments; x ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertices.push( 0, halfHeight * sign, 0 );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( 0.5, 0.5 );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// save the index of the last center vertex\n\t\t\tconst centerIndexEnd = index;\n\n\t\t\t// now we generate the surrounding vertices, normals and uvs\n\n\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\tconst u = x / radialSegments;\n\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\tconst cosTheta = Math.cos( theta );\n\t\t\t\tconst sinTheta = Math.sin( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\tvertex.y = halfHeight * sign;\n\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\n\t\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tconst c = centerIndexStart + x;\n\t\t\t\tconst i = centerIndexEnd + x;\n\n\t\t\t\tif ( top === true ) {\n\n\t\t\t\t\t// face top\n\n\t\t\t\t\tindices.push( i, i + 1, c );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// face bottom\n\n\t\t\t\t\tindices.push( i + 1, i, c );\n\n\t\t\t\t}\n\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CylinderGeometry( data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ConeGeometry extends CylinderGeometry {\n\n\tconstructor( radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\t\tthis.type = 'ConeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new ConeGeometry( data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass PolyhedronGeometry extends BufferGeometry {\n\n\tconstructor( vertices = [], indices = [], radius = 1, detail = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PolyhedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tvertices: vertices,\n\t\t\tindices: indices,\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t\t// default buffer data\n\n\t\tconst vertexBuffer = [];\n\t\tconst uvBuffer = [];\n\n\t\t// the subdivision creates the vertex buffer data\n\n\t\tsubdivide( detail );\n\n\t\t// all vertices should lie on a conceptual sphere with a given radius\n\n\t\tapplyRadius( radius );\n\n\t\t// finally, create the uv data\n\n\t\tgenerateUVs();\n\n\t\t// build non-indexed geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\n\n\t\tif ( detail === 0 ) {\n\n\t\t\tthis.computeVertexNormals(); // flat normals\n\n\t\t} else {\n\n\t\t\tthis.normalizeNormals(); // smooth normals\n\n\t\t}\n\n\t\t// helper functions\n\n\t\tfunction subdivide( detail ) {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\t// iterate over all faces and apply a subdivision with the given detail value\n\n\t\t\tfor ( let i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t\t// get the vertices of the face\n\n\t\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\n\t\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\n\t\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\n\n\t\t\t\t// perform subdivision\n\n\t\t\t\tsubdivideFace( a, b, c, detail );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction subdivideFace( a, b, c, detail ) {\n\n\t\t\tconst cols = detail + 1;\n\n\t\t\t// we use this multidimensional array as a data structure for creating the subdivision\n\n\t\t\tconst v = [];\n\n\t\t\t// construct all of the vertices for this subdivision\n\n\t\t\tfor ( let i = 0; i <= cols; i ++ ) {\n\n\t\t\t\tv[ i ] = [];\n\n\t\t\t\tconst aj = a.clone().lerp( c, i / cols );\n\t\t\t\tconst bj = b.clone().lerp( c, i / cols );\n\n\t\t\t\tconst rows = cols - i;\n\n\t\t\t\tfor ( let j = 0; j <= rows; j ++ ) {\n\n\t\t\t\t\tif ( j === 0 && i === cols ) {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// construct all of the faces\n\n\t\t\tfor ( let i = 0; i < cols; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\n\n\t\t\t\t\tconst k = Math.floor( j / 2 );\n\n\t\t\t\t\tif ( j % 2 === 0 ) {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\t\t\t\t\t\tpushVertex( v[ i ][ k ] );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction applyRadius( radius ) {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\t// iterate over the entire buffer and apply the radius to each vertex\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tvertex.normalize().multiplyScalar( radius );\n\n\t\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\n\t\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\n\t\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tconst u = azimuth( vertex ) / 2 / Math.PI + 0.5;\n\t\t\t\tconst v = inclination( vertex ) / Math.PI + 0.5;\n\t\t\t\tuvBuffer.push( u, 1 - v );\n\n\t\t\t}\n\n\t\t\tcorrectUVs();\n\n\t\t\tcorrectSeam();\n\n\t\t}\n\n\t\tfunction correctSeam() {\n\n\t\t\t// handle case when face straddles the seam, see #3269\n\n\t\t\tfor ( let i = 0; i < uvBuffer.length; i += 6 ) {\n\n\t\t\t\t// uv data of a single face\n\n\t\t\t\tconst x0 = uvBuffer[ i + 0 ];\n\t\t\t\tconst x1 = uvBuffer[ i + 2 ];\n\t\t\t\tconst x2 = uvBuffer[ i + 4 ];\n\n\t\t\t\tconst max = Math.max( x0, x1, x2 );\n\t\t\t\tconst min = Math.min( x0, x1, x2 );\n\n\t\t\t\t// 0.9 is somewhat arbitrary\n\n\t\t\t\tif ( max > 0.9 && min < 0.1 ) {\n\n\t\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\n\t\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\n\t\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction pushVertex( vertex ) {\n\n\t\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t\tfunction getVertexByIndex( index, vertex ) {\n\n\t\t\tconst stride = index * 3;\n\n\t\t\tvertex.x = vertices[ stride + 0 ];\n\t\t\tvertex.y = vertices[ stride + 1 ];\n\t\t\tvertex.z = vertices[ stride + 2 ];\n\n\t\t}\n\n\t\tfunction correctUVs() {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\tconst centroid = new Vector3();\n\n\t\t\tconst uvA = new Vector2();\n\t\t\tconst uvB = new Vector2();\n\t\t\tconst uvC = new Vector2();\n\n\t\t\tfor ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\n\n\t\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\n\t\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\n\t\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\n\n\t\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\n\t\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\n\t\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\n\n\t\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\n\n\t\t\t\tconst azi = azimuth( centroid );\n\n\t\t\t\tcorrectUV( uvA, j + 0, a, azi );\n\t\t\t\tcorrectUV( uvB, j + 2, b, azi );\n\t\t\t\tcorrectUV( uvC, j + 4, c, azi );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction correctUV( uv, stride, vector, azimuth ) {\n\n\t\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = uv.x - 1;\n\n\t\t\t}\n\n\t\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Angle around the Y axis, counter-clockwise when looking from above.\n\n\t\tfunction azimuth( vector ) {\n\n\t\t\treturn Math.atan2( vector.z, - vector.x );\n\n\t\t}\n\n\n\t\t// Angle above the XZ plane.\n\n\t\tfunction inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.details );\n\n\t}\n\n}\n\nclass DodecahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\t\tconst r = 1 / t;\n\n\t\tconst vertices = [\n\n\t\t\t// (\u00B11, \u00B11, \u00B11)\n\t\t\t- 1, - 1, - 1,\t- 1, - 1, 1,\n\t\t\t- 1, 1, - 1, - 1, 1, 1,\n\t\t\t1, - 1, - 1, 1, - 1, 1,\n\t\t\t1, 1, - 1, 1, 1, 1,\n\n\t\t\t// (0, \u00B11/\u03C6, \u00B1\u03C6)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (\u00B11/\u03C6, \u00B1\u03C6, 0)\n\t\t\t- r, - t, 0, - r, t, 0,\n\t\t\tr, - t, 0, r, t, 0,\n\n\t\t\t// (\u00B1\u03C6, 0, \u00B11/\u03C6)\n\t\t\t- t, 0, - r, t, 0, - r,\n\t\t\t- t, 0, r, t, 0, r\n\t\t];\n\n\t\tconst indices = [\n\t\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\n\t\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\n\t\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\n\t\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\n\t\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\n\t\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\n\t\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\n\t\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\n\t\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\n\t\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\n\t\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\n\t\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'DodecahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new DodecahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nconst _v0 = /*@__PURE__*/ new Vector3();\nconst _v1$1 = /*@__PURE__*/ new Vector3();\nconst _normal = /*@__PURE__*/ new Vector3();\nconst _triangle = /*@__PURE__*/ new Triangle();\n\nclass EdgesGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null, thresholdAngle = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'EdgesGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry,\n\t\t\tthresholdAngle: thresholdAngle\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\tconst precisionPoints = 4;\n\t\t\tconst precision = Math.pow( 10, precisionPoints );\n\t\t\tconst thresholdDot = Math.cos( DEG2RAD * thresholdAngle );\n\n\t\t\tconst indexAttr = geometry.getIndex();\n\t\t\tconst positionAttr = geometry.getAttribute( 'position' );\n\t\t\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\t\t\tconst indexArr = [ 0, 0, 0 ];\n\t\t\tconst vertKeys = [ 'a', 'b', 'c' ];\n\t\t\tconst hashes = new Array( 3 );\n\n\t\t\tconst edgeData = {};\n\t\t\tconst vertices = [];\n\t\t\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\t\t\tif ( indexAttr ) {\n\n\t\t\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindexArr[ 0 ] = i;\n\t\t\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t\t\t}\n\n\t\t\t\tconst { a, b, c } = _triangle;\n\t\t\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\t\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\t\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t\t\t_triangle.getNormal( _normal );\n\n\t\t\t\t// create hashes for the edge from the vertices\n\t\t\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\t\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\t\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t\t\t// skip degenerate triangles\n\t\t\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over every edge\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t// get the first and next vertex making up the edge\n\t\t\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\t\t\tif ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {\n\n\t\t\t\t\t\t\tvertices.push( v0.x, v0.y, v0.z );\n\t\t\t\t\t\t\tvertices.push( v1.x, v1.y, v1.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\t\t\tfor ( const key in edgeData ) {\n\n\t\t\t\tif ( edgeData[ key ] ) {\n\n\t\t\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t\t\t_v1$1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\t\t\tvertices.push( _v0.x, _v0.y, _v0.z );\n\t\t\t\t\tvertices.push( _v1$1.x, _v1$1.y, _v1$1.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Shape extends Path {\n\n\tconstructor( points ) {\n\n\t\tsuper( points );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.type = 'Shape';\n\n\t\tthis.holes = [];\n\n\t}\n\n\tgetPointsHoles( divisions ) {\n\n\t\tconst holesPts = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t}\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\textractPoints( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */\n\nconst Earcut = {\n\n\ttriangulate: function ( data, holeIndices, dim = 2 ) {\n\n\t\tconst hasHoles = holeIndices && holeIndices.length;\n\t\tconst outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;\n\t\tlet outerNode = linkedList( data, 0, outerLen, dim, true );\n\t\tconst triangles = [];\n\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\n\n\t\tlet minX, minY, maxX, maxY, x, y, invSize;\n\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\n\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t\tif ( data.length > 80 * dim ) {\n\n\t\t\tminX = maxX = data[ 0 ];\n\t\t\tminY = maxY = data[ 1 ];\n\n\t\t\tfor ( let i = dim; i < outerLen; i += dim ) {\n\n\t\t\t\tx = data[ i ];\n\t\t\t\ty = data[ i + 1 ];\n\t\t\t\tif ( x < minX ) minX = x;\n\t\t\t\tif ( y < minY ) minY = y;\n\t\t\t\tif ( x > maxX ) maxX = x;\n\t\t\t\tif ( y > maxY ) maxY = y;\n\n\t\t\t}\n\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\n\t\t\tinvSize = invSize !== 0 ? 32767 / invSize : 0;\n\n\t\t}\n\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize, 0 );\n\n\t\treturn triangles;\n\n\t}\n\n};\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList( data, start, end, dim, clockwise ) {\n\n\tlet i, last;\n\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\n\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t} else {\n\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t}\n\n\tif ( last && equals( last, last.next ) ) {\n\n\t\tremoveNode( last );\n\t\tlast = last.next;\n\n\t}\n\n\treturn last;\n\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tlet p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) {\n\n\tif ( ! ear ) return;\n\n\t// interlink polygon nodes in z-order\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\n\n\tlet stop = ear,\n\t\tprev, next;\n\n\t// iterate through ears, slicing them one by one\n\twhile ( ear.prev !== ear.next ) {\n\n\t\tprev = ear.prev;\n\t\tnext = ear.next;\n\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\n\n\t\t\t// cut off the triangle\n\t\t\ttriangles.push( prev.i / dim | 0 );\n\t\t\ttriangles.push( ear.i / dim | 0 );\n\t\t\ttriangles.push( next.i / dim | 0 );\n\n\t\t\tremoveNode( ear );\n\n\t\t\t// skipping the next vertex leads to less sliver triangles\n\t\t\tear = next.next;\n\t\t\tstop = next.next;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tear = next;\n\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\n\t\tif ( ear === stop ) {\n\n\t\t\t// try filtering points and slicing again\n\t\t\tif ( ! pass ) {\n\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\n\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\n\n\t\t\t} else if ( pass === 1 ) {\n\n\t\t\t\tear = cureLocalIntersections( filterPoints( ear ), triangles, dim );\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\n\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\n\n\t\t\t} else if ( pass === 2 ) {\n\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\n\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar( ear ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// now make sure we don't have other points inside the potential ear\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\tlet p = c.next;\n\twhile ( p !== a ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.next;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction isEarHashed( ear, minX, minY, invSize ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\t// z-order range for the current triangle bbox;\n\tconst minZ = zOrder( x0, y0, minX, minY, invSize ),\n\t\tmaxZ = zOrder( x1, y1, minX, minY, invSize );\n\n\tlet p = ear.prevZ,\n\t\tn = ear.nextZ;\n\n\t// look for points inside the triangle in both directions\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\t// look for remaining points in decreasing z-order\n\twhile ( p && p.z >= minZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t}\n\n\t// look for remaining points in increasing z-order\n\twhile ( n && n.z <= maxZ ) {\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\treturn true;\n\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections( start, triangles, dim ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tconst a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim | 0 );\n\t\t\ttriangles.push( p.i / dim | 0 );\n\t\t\ttriangles.push( b.i / dim | 0 );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn filterPoints( p );\n\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\n\n\t// look for a valid diagonal that divides the polygon into two\n\tlet a = start;\n\tdo {\n\n\t\tlet b = a.next.next;\n\t\twhile ( b !== a.prev ) {\n\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\n\n\t\t\t\t// split the polygon in two by the diagonal\n\t\t\t\tlet c = splitPolygon( a, b );\n\n\t\t\t\t// filter colinear points around the cuts\n\t\t\t\ta = filterPoints( a, a.next );\n\t\t\t\tc = filterPoints( c, c.next );\n\n\t\t\t\t// run earcut on each half\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tb = b.next;\n\n\t\t}\n\n\t\ta = a.next;\n\n\t} while ( a !== start );\n\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\n\n\tconst queue = [];\n\tlet i, len, start, end, list;\n\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\n\n\t\tstart = holeIndices[ i ] * dim;\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\n\t\tlist = linkedList( data, start, end, dim, false );\n\t\tif ( list === list.next ) list.steiner = true;\n\t\tqueue.push( getLeftmost( list ) );\n\n\t}\n\n\tqueue.sort( compareX );\n\n\t// process holes from left to right\n\tfor ( i = 0; i < queue.length; i ++ ) {\n\n\t\touterNode = eliminateHole( queue[ i ], outerNode );\n\n\t}\n\n\treturn outerNode;\n\n}\n\nfunction compareX( a, b ) {\n\n\treturn a.x - b.x;\n\n}\n\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction eliminateHole( hole, outerNode ) {\n\n\tconst bridge = findHoleBridge( hole, outerNode );\n\tif ( ! bridge ) {\n\n\t\treturn outerNode;\n\n\t}\n\n\tconst bridgeReverse = splitPolygon( bridge, hole );\n\n\t// filter collinear points around the cuts\n\tfilterPoints( bridgeReverse, bridgeReverse.next );\n\treturn filterPoints( bridge, bridge.next );\n\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge( hole, outerNode ) {\n\n\tlet p = outerNode,\n\t\tqx = - Infinity,\n\t\tm;\n\n\tconst hx = hole.x, hy = hole.y;\n\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\n\t// segment's endpoint with lesser x will be potential connection point\n\tdo {\n\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\n\n\t\t\tconst x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\n\t\t\tif ( x <= hx && x > qx ) {\n\n\t\t\t\tqx = x;\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\n\t\t\t\tif ( x === hx ) return m; // hole touches outer segment; pick leftmost endpoint\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== outerNode );\n\n\tif ( ! m ) return null;\n\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\n\t// if there are no points found, we have a valid connection;\n\t// otherwise choose the point of the minimum angle with the ray as connection point\n\n\tconst stop = m,\n\t\tmx = m.x,\n\t\tmy = m.y;\n\tlet tanMin = Infinity, tan;\n\n\tp = m;\n\n\tdo {\n\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\n\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\n\n\t\t\tif ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) {\n\n\t\t\t\tm = p;\n\t\t\t\ttanMin = tan;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== stop );\n\n\treturn m;\n\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector( m, p ) {\n\n\treturn area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0;\n\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve( start, minX, minY, invSize ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tif ( p.z === 0 ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\n\t\tp.prevZ = p.prev;\n\t\tp.nextZ = p.next;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\tp.prevZ.nextZ = null;\n\tp.prevZ = null;\n\n\tsortLinked( p );\n\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked( list ) {\n\n\tlet i, p, q, e, tail, numMerges, pSize, qSize,\n\t\tinSize = 1;\n\n\tdo {\n\n\t\tp = list;\n\t\tlist = null;\n\t\ttail = null;\n\t\tnumMerges = 0;\n\n\t\twhile ( p ) {\n\n\t\t\tnumMerges ++;\n\t\t\tq = p;\n\t\t\tpSize = 0;\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\n\n\t\t\t\tpSize ++;\n\t\t\t\tq = q.nextZ;\n\t\t\t\tif ( ! q ) break;\n\n\t\t\t}\n\n\t\t\tqSize = inSize;\n\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\n\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\n\n\t\t\t\t\te = p;\n\t\t\t\t\tp = p.nextZ;\n\t\t\t\t\tpSize --;\n\n\t\t\t\t} else {\n\n\t\t\t\t\te = q;\n\t\t\t\t\tq = q.nextZ;\n\t\t\t\t\tqSize --;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tail ) tail.nextZ = e;\n\t\t\t\telse list = e;\n\n\t\t\t\te.prevZ = tail;\n\t\t\t\ttail = e;\n\n\t\t\t}\n\n\t\t\tp = q;\n\n\t\t}\n\n\t\ttail.nextZ = null;\n\t\tinSize *= 2;\n\n\t} while ( numMerges > 1 );\n\n\treturn list;\n\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = ( x - minX ) * invSize | 0;\n\ty = ( y - minY ) * invSize | 0;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost( start ) {\n\n\tlet p = start,\n\t\tleftmost = start;\n\tdo {\n\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn leftmost;\n\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) >= ( ax - px ) * ( cy - py ) &&\n ( ax - px ) * ( by - py ) >= ( bx - px ) * ( ay - py ) &&\n ( bx - px ) * ( cy - py ) >= ( cx - px ) * ( by - py );\n\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal( a, b ) {\n\n\treturn a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges\n ( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible\n ( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors\n equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case\n\n}\n\n// signed area of a triangle\nfunction area( p, q, r ) {\n\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\n\n}\n\n// check if two points are equal\nfunction equals( p1, p2 ) {\n\n\treturn p1.x === p2.x && p1.y === p2.y;\n\n}\n\n// check if two segments intersect\nfunction intersects( p1, q1, p2, q2 ) {\n\n\tconst o1 = sign( area( p1, q1, p2 ) );\n\tconst o2 = sign( area( p1, q1, q2 ) );\n\tconst o3 = sign( area( p2, q2, p1 ) );\n\tconst o4 = sign( area( p2, q2, q1 ) );\n\n\tif ( o1 !== o2 && o3 !== o4 ) return true; // general case\n\n\tif ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n\tif ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n\tif ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n\tif ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n\treturn false;\n\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}\n\nfunction sign( num ) {\n\n\treturn num > 0 ? 1 : num < 0 ? - 1 : 0;\n\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon( a, b ) {\n\n\tlet p = a;\n\tdo {\n\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t\t\tintersects( p, p.next, a, b ) ) return true;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn false;\n\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside( a, b ) {\n\n\treturn area( a.prev, a, a.next ) < 0 ?\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\n\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside( a, b ) {\n\n\tlet p = a,\n\t\tinside = false;\n\tconst px = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon( a, b ) {\n\n\tconst a2 = new Node( a.i, a.x, a.y ),\n\t\tb2 = new Node( b.i, b.x, b.y ),\n\t\tan = a.next,\n\t\tbp = b.prev;\n\n\ta.next = b;\n\tb.prev = a;\n\n\ta2.next = an;\n\tan.prev = a2;\n\n\tb2.next = a2;\n\ta2.prev = b2;\n\n\tbp.next = b2;\n\tb2.prev = bp;\n\n\treturn b2;\n\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode( i, x, y, last ) {\n\n\tconst p = new Node( i, x, y );\n\n\tif ( ! last ) {\n\n\t\tp.prev = p;\n\t\tp.next = p;\n\n\t} else {\n\n\t\tp.next = last.next;\n\t\tp.prev = last;\n\t\tlast.next.prev = p;\n\t\tlast.next = p;\n\n\t}\n\n\treturn p;\n\n}\n\nfunction removeNode( p ) {\n\n\tp.next.prev = p.prev;\n\tp.prev.next = p.next;\n\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\n\n}\n\nfunction Node( i, x, y ) {\n\n\t// vertex index in coordinates array\n\tthis.i = i;\n\n\t// vertex coordinates\n\tthis.x = x;\n\tthis.y = y;\n\n\t// previous and next vertex nodes in a polygon ring\n\tthis.prev = null;\n\tthis.next = null;\n\n\t// z-order curve value\n\tthis.z = 0;\n\n\t// previous and next nodes in z-order\n\tthis.prevZ = null;\n\tthis.nextZ = null;\n\n\t// indicates whether this is a steiner point\n\tthis.steiner = false;\n\n}\n\nfunction signedArea( data, start, end, dim ) {\n\n\tlet sum = 0;\n\tfor ( let i = start, j = end - dim; i < end; i += dim ) {\n\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\n\t\tj = i;\n\n\t}\n\n\treturn sum;\n\n}\n\nclass ShapeUtils {\n\n\t// calculate area of the contour polygon\n\n\tstatic area( contour ) {\n\n\t\tconst n = contour.length;\n\t\tlet a = 0.0;\n\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t}\n\n\tstatic isClockWise( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t}\n\n\tstatic triangulateShape( contour, holes ) {\n\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tconst holeIndices = []; // array of hole indices\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tlet holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n}\n\nfunction removeDupEndPts( points ) {\n\n\tconst l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( let i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */\n\n\nclass ExtrudeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ExtrudeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\toptions: options\n\t\t};\n\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\t\tconst scope = this;\n\n\t\tconst verticesArray = [];\n\t\tconst uvArray = [];\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\t\t\taddShape( shape );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\t\tthis.computeVertexNormals();\n\n\t\t// functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst placeholder = [];\n\n\t\t\t// options\n\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\n\t\t\tconst depth = options.depth !== undefined ? options.depth : 1;\n\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\t\tconst extrudePath = options.extrudePath;\n\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t\t//\n\n\t\t\tlet extrudePts, extrudeByPath = false;\n\t\t\tlet splineTube, binormal, normal, position2;\n\n\t\t\tif ( extrudePath ) {\n\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\t\textrudeByPath = true;\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t\t// SETUP TNB variables\n\n\t\t\t\t// TODO1 - have a .isClosed in spline?\n\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\n\n\t\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\t\tbinormal = new Vector3();\n\t\t\t\tnormal = new Vector3();\n\t\t\t\tposition2 = new Vector3();\n\n\t\t\t}\n\n\t\t\t// Safeguards if bevels are not enabled\n\n\t\t\tif ( ! bevelEnabled ) {\n\n\t\t\t\tbevelSegments = 0;\n\t\t\t\tbevelThickness = 0;\n\t\t\t\tbevelSize = 0;\n\t\t\t\tbevelOffset = 0;\n\n\t\t\t}\n\n\t\t\t// Variables initialization\n\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\n\n\t\t\tlet vertices = shapePoints.shape;\n\t\t\tconst holes = shapePoints.holes;\n\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\t\tif ( reverse ) {\n\n\t\t\t\tvertices = vertices.reverse();\n\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( vertices, holes );\n\n\t\t\t/* Vertices */\n\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\tvertices = vertices.concat( ahole );\n\n\t\t\t}\n\n\n\t\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\t\tif ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );\n\n\t\t\t\treturn pt.clone().addScaledVector( vec, size );\n\n\t\t\t}\n\n\t\t\tconst vlen = vertices.length, flen = faces.length;\n\n\n\t\t\t// Find directions for point movement\n\n\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t\t//\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t\t// check for collinear edges\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not collinear\n\n\t\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t\t// but prevent crazy spikes\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\n\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\n\t\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t\t}\n\n\n\t\t\tconst contourMovements = [];\n\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t// console.log('i,j,k', i, j , k)\n\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t\t}\n\n\t\t\tconst holesMovements = [];\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\toneHoleMovements = [];\n\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t\t}\n\n\t\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t\t}\n\n\n\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst bs = bevelSize + bevelOffset;\n\n\t\t\t// Back facing vertices\n\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Add stepped vertices...\n\t\t\t// Including front facing vertices\n\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\n\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\t// Add bevel segments planes\n\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/* Faces */\n\n\t\t\t// Top and bottom faces\n\n\t\t\tbuildLidFaces();\n\n\t\t\t// Sides faces\n\n\t\t\tbuildSideFaces();\n\n\n\t\t\t///// Internal functions\n\n\t\t\tfunction buildLidFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\n\t\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\t\tlet layer = 0; // steps + 1\n\t\t\t\t\tlet offset = vlen * layer;\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t\t}\n\n\t\t\t// Create faces for the z-sides of the shape\n\n\t\t\tfunction buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}\n\n\t\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\t\tlet i = contour.length;\n\n\t\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\t\tconst j = i;\n\t\t\t\t\tlet k = i - 1;\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\n\n\t\t\t\t\t\tconst slen1 = vlen * s;\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfunction v( x, y, z ) {\n\n\t\t\t\tplaceholder.push( x );\n\t\t\t\tplaceholder.push( y );\n\t\t\t\tplaceholder.push( z );\n\n\t\t\t}\n\n\n\t\t\tfunction f3( a, b, c ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\n\t\t\t}\n\n\t\t\tfunction f4( a, b, c, d ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( d );\n\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\t\t\t\taddVertex( d );\n\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t}\n\n\t\t\tfunction addVertex( index ) {\n\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t\t}\n\n\n\t\t\tfunction addUV( vector2 ) {\n\n\t\t\t\tuvArray.push( vector2.x );\n\t\t\t\tuvArray.push( vector2.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\t\tconst options = this.parameters.options;\n\n\t\treturn toJSON$1( shapes, options, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\tconst extrudePath = data.options.extrudePath;\n\n\t\tif ( extrudePath !== undefined ) {\n\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t}\n\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\n\n\t}\n\n}\n\nconst WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\n\t\tconst d_x = vertices[ indexD * 3 ];\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n\n};\n\nfunction toJSON$1( shapes, options, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\tdata.options = Object.assign( {}, options );\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\nclass IcosahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\n\t\tconst vertices = [\n\t\t\t- 1, t, 0, \t1, t, 0, \t- 1, - t, 0, \t1, - t, 0,\n\t\t\t0, - 1, t, \t0, 1, t,\t0, - 1, - t, \t0, 1, - t,\n\t\t\tt, 0, - 1, \tt, 0, 1, \t- t, 0, - 1, \t- t, 0, 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\n\t\t\t1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\n\t\t\t3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\n\t\t\t4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'IcosahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new IcosahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass OctahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 0, 0, \t- 1, 0, 0,\t0, 1, 0,\n\t\t\t0, - 1, 0, \t0, 0, 1,\t0, 0, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\n\t\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\n\t\t\t1, 3, 4,\t1, 4, 2\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'OctahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new OctahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass RingGeometry extends BufferGeometry {\n\n\tconstructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'RingGeometry';\n\n\t\tthis.parameters = {\n\t\t\tinnerRadius: innerRadius,\n\t\t\touterRadius: outerRadius,\n\t\t\tthetaSegments: thetaSegments,\n\t\t\tphiSegments: phiSegments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tthetaSegments = Math.max( 3, thetaSegments );\n\t\tphiSegments = Math.max( 1, phiSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// some helper variables\n\n\t\tlet radius = innerRadius;\n\t\tconst radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= phiSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= thetaSegments; i ++ ) {\n\n\t\t\t\t// values are generate from the inside of the ring to the outside\n\n\t\t\t\tconst segment = thetaStart + i / thetaSegments * thetaLength;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\n\t\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t}\n\n\t\t\t// increase the radius for next row of vertices\n\n\t\t\tradius += radiusStep;\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let j = 0; j < phiSegments; j ++ ) {\n\n\t\t\tconst thetaSegmentLevel = j * ( thetaSegments + 1 );\n\n\t\t\tfor ( let i = 0; i < thetaSegments; i ++ ) {\n\n\t\t\t\tconst segment = i + thetaSegmentLevel;\n\n\t\t\t\tconst a = segment;\n\t\t\t\tconst b = segment + thetaSegments + 1;\n\t\t\t\tconst c = segment + thetaSegments + 2;\n\t\t\t\tconst d = segment + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new RingGeometry( data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ShapeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShapeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\tcurveSegments: curveSegments\n\t\t};\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet groupStart = 0;\n\t\tlet groupCount = 0;\n\n\t\t// allow single and array values for \"shapes\" parameter\n\n\t\tif ( Array.isArray( shapes ) === false ) {\n\n\t\t\taddShape( shapes );\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\n\n\t\t\t\taddShape( shapes[ i ] );\n\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\t\tgroupStart += groupCount;\n\t\t\t\tgroupCount = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t\t// helper functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst indexOffset = vertices.length / 3;\n\t\t\tconst points = shape.extractPoints( curveSegments );\n\n\t\t\tlet shapeVertices = points.shape;\n\t\t\tconst shapeHoles = points.holes;\n\n\t\t\t// check direction of vertices\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t\t// join vertices of inner and outer paths to a single array\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t\t}\n\n\t\t\t// vertices, normals, uvs\n\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\t\tconst vertex = shapeVertices[ i ];\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\t\tnormals.push( 0, 0, 1 );\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\t\tconst face = faces[ i ];\n\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\n\n\t\t\t\tindices.push( a, b, c );\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\n\t\treturn toJSON( shapes, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\n\n\t}\n\n}\n\nfunction toJSON( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\nclass SphereGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SphereGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\n\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\t\tlet index = 0;\n\t\tconst grid = [];\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\t\tconst verticesRow = [];\n\n\t\t\tconst v = iy / heightSegments;\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy === 0 && thetaStart === 0 ) {\n\n\t\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t\t} else if ( iy === heightSegments && thetaEnd === Math.PI ) {\n\n\t\t\t\tuOffset = - 0.5 / widthSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / widthSegments;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.copy( vertex ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\t\tverticesRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\tgrid.push( verticesRow );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\n\t\t\t\tconst b = grid[ iy ][ ix ];\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass TetrahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 1, 1, \t- 1, - 1, 1, \t- 1, 1, - 1, \t1, - 1, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'TetrahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TetrahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass TorusGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\tradialSegments: radialSegments,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tarc: arc\n\t\t};\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\ttubularSegments = Math.floor( tubularSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst center = new Vector3();\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tconst u = i / tubularSegments * arc;\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\n\n\t}\n\n}\n\nclass TorusKnotGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusKnotGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t\tp: p,\n\t\t\tq: q\n\t\t};\n\n\t\ttubularSegments = Math.floor( tubularSegments );\n\t\tradialSegments = Math.floor( radialSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\tconst P1 = new Vector3();\n\t\tconst P2 = new Vector3();\n\n\t\tconst B = new Vector3();\n\t\tconst T = new Vector3();\n\t\tconst N = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let i = 0; i <= tubularSegments; ++ i ) {\n\n\t\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n\n\t\t\tconst u = i / tubularSegments * p * Math.PI * 2;\n\n\t\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n\t\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n\t\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\n\t\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\n\n\t\t\t// calculate orthonormal basis\n\n\t\t\tT.subVectors( P2, P1 );\n\t\t\tN.addVectors( P2, P1 );\n\t\t\tB.crossVectors( T, N );\n\t\t\tN.crossVectors( B, T );\n\n\t\t\t// normalize B, N. T can be ignored, we don't use it\n\n\t\t\tB.normalize();\n\t\t\tN.normalize();\n\n\t\t\tfor ( let j = 0; j <= radialSegments; ++ j ) {\n\n\t\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n\t\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\t\t\t\tconst cx = - tube * Math.cos( v );\n\t\t\t\tconst cy = tube * Math.sin( v );\n\n\t\t\t\t// now calculate the final vertex position.\n\t\t\t\t// first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n\n\t\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\n\t\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\n\t\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n\t\t\t\tnormal.subVectors( vertex, P1 ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// this function calculates the current position on the torus curve\n\n\t\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\n\n\t\t\tconst cu = Math.cos( u );\n\t\t\tconst su = Math.sin( u );\n\t\t\tconst quOverP = q / p * u;\n\t\t\tconst cs = Math.cos( quOverP );\n\n\t\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\n\t\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\n\t\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusKnotGeometry( data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q );\n\n\t}\n\n}\n\nclass TubeGeometry extends BufferGeometry {\n\n\tconstructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TubeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpath: path,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradius: radius,\n\t\t\tradialSegments: radialSegments,\n\t\t\tclosed: closed\n\t\t};\n\n\t\tconst frames = path.computeFrenetFrames( tubularSegments, closed );\n\n\t\t// expose internals\n\n\t\tthis.tangents = frames.tangents;\n\t\tthis.normals = frames.normals;\n\t\tthis.binormals = frames.binormals;\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tlet P = new Vector3();\n\n\t\t// buffer\n\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\t\tconst indices = [];\n\n\t\t// create buffer data\n\n\t\tgenerateBufferData();\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// functions\n\n\t\tfunction generateBufferData() {\n\n\t\t\tfor ( let i = 0; i < tubularSegments; i ++ ) {\n\n\t\t\t\tgenerateSegment( i );\n\n\t\t\t}\n\n\t\t\t// if the geometry is not closed, generate the last row of vertices and normals\n\t\t\t// at the regular position on the given path\n\t\t\t//\n\t\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n\t\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\n\n\t\t\t// uvs are generated in a separate function.\n\t\t\t// this makes it easy compute correct values for closed geometries\n\n\t\t\tgenerateUVs();\n\n\t\t\t// finally create faces\n\n\t\t\tgenerateIndices();\n\n\t\t}\n\n\t\tfunction generateSegment( i ) {\n\n\t\t\t// we use getPointAt to sample evenly distributed points from the given path\n\n\t\t\tP = path.getPointAt( i / tubularSegments, P );\n\n\t\t\t// retrieve corresponding normal and binormal\n\n\t\t\tconst N = frames.normals[ i ];\n\t\t\tconst B = frames.binormals[ i ];\n\n\t\t\t// generate normals and vertices for the current segment\n\n\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\tconst sin = Math.sin( v );\n\t\t\t\tconst cos = - Math.cos( v );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.x = ( cos * N.x + sin * B.x );\n\t\t\t\tnormal.y = ( cos * N.y + sin * B.y );\n\t\t\t\tnormal.z = ( cos * N.z + sin * B.z );\n\t\t\t\tnormal.normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = P.x + radius * normal.x;\n\t\t\t\tvertex.y = P.y + radius * normal.y;\n\t\t\t\tvertex.z = P.z + radius * normal.z;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateIndices() {\n\n\t\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\t\tuv.x = i / tubularSegments;\n\t\t\t\t\tuv.y = j / radialSegments;\n\n\t\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.path = this.parameters.path.toJSON();\n\n\t\treturn data;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\n\t\t// User defined curves or instances of CurvePath will not be deserialized.\n\t\treturn new TubeGeometry(\n\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\n\t\t\tdata.tubularSegments,\n\t\t\tdata.radius,\n\t\t\tdata.radialSegments,\n\t\t\tdata.closed\n\t\t);\n\n\t}\n\n}\n\nclass WireframeGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'WireframeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\t// buffer\n\n\t\t\tconst vertices = [];\n\t\t\tconst edges = new Set();\n\n\t\t\t// helper variables\n\n\t\t\tconst start = new Vector3();\n\t\t\tconst end = new Vector3();\n\n\t\t\tif ( geometry.index !== null ) {\n\n\t\t\t\t// indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\tconst indices = geometry.index;\n\t\t\t\tlet groups = geometry.groups;\n\n\t\t\t\tif ( groups.length === 0 ) {\n\n\t\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\n\n\t\t\t\t}\n\n\t\t\t\t// create a data structure that contains all edges without duplicates\n\n\t\t\t\tfor ( let o = 0, ol = groups.length; o < ol; ++ o ) {\n\n\t\t\t\t\tconst group = groups[ o ];\n\n\t\t\t\t\tconst groupStart = group.start;\n\t\t\t\t\tconst groupCount = group.count;\n\n\t\t\t\t\tfor ( let i = groupStart, l = ( groupStart + groupCount ); i < l; i += 3 ) {\n\n\t\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t\tconst index1 = indices.getX( i + j );\n\t\t\t\t\t\t\tconst index2 = indices.getX( i + ( j + 1 ) % 3 );\n\n\t\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\n\t\t\t\tfor ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\n\n\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\n\t\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n\t\t\t\t\t\tconst index1 = 3 * i + j;\n\t\t\t\t\t\tconst index2 = 3 * i + ( ( j + 1 ) % 3 );\n\n\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// build geometry\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n}\n\nfunction isUniqueEdge( start, end, edges ) {\n\n\tconst hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n\tconst hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n\n\tif ( edges.has( hash1 ) === true || edges.has( hash2 ) === true ) {\n\n\t\treturn false;\n\n\t} else {\n\n\t\tedges.add( hash1 );\n\t\tedges.add( hash2 );\n\t\treturn true;\n\n\t}\n\n}\n\nvar Geometries = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tBoxGeometry: BoxGeometry,\n\tCapsuleGeometry: CapsuleGeometry,\n\tCircleGeometry: CircleGeometry,\n\tConeGeometry: ConeGeometry,\n\tCylinderGeometry: CylinderGeometry,\n\tDodecahedronGeometry: DodecahedronGeometry,\n\tEdgesGeometry: EdgesGeometry,\n\tExtrudeGeometry: ExtrudeGeometry,\n\tIcosahedronGeometry: IcosahedronGeometry,\n\tLatheGeometry: LatheGeometry,\n\tOctahedronGeometry: OctahedronGeometry,\n\tPlaneGeometry: PlaneGeometry,\n\tPolyhedronGeometry: PolyhedronGeometry,\n\tRingGeometry: RingGeometry,\n\tShapeGeometry: ShapeGeometry,\n\tSphereGeometry: SphereGeometry,\n\tTetrahedronGeometry: TetrahedronGeometry,\n\tTorusGeometry: TorusGeometry,\n\tTorusKnotGeometry: TorusKnotGeometry,\n\tTubeGeometry: TubeGeometry,\n\tWireframeGeometry: WireframeGeometry\n});\n\nclass ShadowMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isShadowMaterial = true;\n\n\t\tthis.type = 'ShadowMaterial';\n\n\t\tthis.color = new Color( 0x000000 );\n\t\tthis.transparent = true;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass RawShaderMaterial extends ShaderMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( parameters );\n\n\t\tthis.isRawShaderMaterial = true;\n\n\t\tthis.type = 'RawShaderMaterial';\n\n\t}\n\n}\n\nclass MeshStandardMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshStandardMaterial = true;\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.type = 'MeshStandardMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.roughness = 1.0;\n\t\tthis.metalness = 0.0;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.roughnessMap = null;\n\n\t\tthis.metalnessMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapIntensity = 1.0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.color.copy( source.color );\n\t\tthis.roughness = source.roughness;\n\t\tthis.metalness = source.metalness;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.roughnessMap = source.roughnessMap;\n\n\t\tthis.metalnessMap = source.metalnessMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhysicalMaterial = true;\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.type = 'MeshPhysicalMaterial';\n\n\t\tthis.anisotropyRotation = 0;\n\t\tthis.anisotropyMap = null;\n\n\t\tthis.clearcoatMap = null;\n\t\tthis.clearcoatRoughness = 0.0;\n\t\tthis.clearcoatRoughnessMap = null;\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\t\tthis.clearcoatNormalMap = null;\n\n\t\tthis.ior = 1.5;\n\n\t\tObject.defineProperty( this, 'reflectivity', {\n\t\t\tget: function () {\n\n\t\t\t\treturn ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\n\n\t\t\t},\n\t\t\tset: function ( reflectivity ) {\n\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.iridescenceMap = null;\n\t\tthis.iridescenceIOR = 1.3;\n\t\tthis.iridescenceThicknessRange = [ 100, 400 ];\n\t\tthis.iridescenceThicknessMap = null;\n\n\t\tthis.sheenColor = new Color( 0x000000 );\n\t\tthis.sheenColorMap = null;\n\t\tthis.sheenRoughness = 1.0;\n\t\tthis.sheenRoughnessMap = null;\n\n\t\tthis.transmissionMap = null;\n\n\t\tthis.thickness = 0;\n\t\tthis.thicknessMap = null;\n\t\tthis.attenuationDistance = Infinity;\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\n\n\t\tthis.specularIntensity = 1.0;\n\t\tthis.specularIntensityMap = null;\n\t\tthis.specularColor = new Color( 1, 1, 1 );\n\t\tthis.specularColorMap = null;\n\n\t\tthis._anisotropy = 0;\n\t\tthis._clearcoat = 0;\n\t\tthis._iridescence = 0;\n\t\tthis._sheen = 0.0;\n\t\tthis._transmission = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget anisotropy() {\n\n\t\treturn this._anisotropy;\n\n\t}\n\n\tset anisotropy( value ) {\n\n\t\tif ( this._anisotropy > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._anisotropy = value;\n\n\t}\n\n\tget clearcoat() {\n\n\t\treturn this._clearcoat;\n\n\t}\n\n\tset clearcoat( value ) {\n\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._clearcoat = value;\n\n\t}\n\n\tget iridescence() {\n\n\t\treturn this._iridescence;\n\n\t}\n\n\tset iridescence( value ) {\n\n\t\tif ( this._iridescence > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._iridescence = value;\n\n\t}\n\n\tget sheen() {\n\n\t\treturn this._sheen;\n\n\t}\n\n\tset sheen( value ) {\n\n\t\tif ( this._sheen > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._sheen = value;\n\n\t}\n\n\tget transmission() {\n\n\t\treturn this._transmission;\n\n\t}\n\n\tset transmission( value ) {\n\n\t\tif ( this._transmission > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._transmission = value;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.anisotropy = source.anisotropy;\n\t\tthis.anisotropyRotation = source.anisotropyRotation;\n\t\tthis.anisotropyMap = source.anisotropyMap;\n\n\t\tthis.clearcoat = source.clearcoat;\n\t\tthis.clearcoatMap = source.clearcoatMap;\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\t\tthis.ior = source.ior;\n\n\t\tthis.iridescence = source.iridescence;\n\t\tthis.iridescenceMap = source.iridescenceMap;\n\t\tthis.iridescenceIOR = source.iridescenceIOR;\n\t\tthis.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];\n\t\tthis.iridescenceThicknessMap = source.iridescenceThicknessMap;\n\n\t\tthis.sheen = source.sheen;\n\t\tthis.sheenColor.copy( source.sheenColor );\n\t\tthis.sheenColorMap = source.sheenColorMap;\n\t\tthis.sheenRoughness = source.sheenRoughness;\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\n\n\t\tthis.transmission = source.transmission;\n\t\tthis.transmissionMap = source.transmissionMap;\n\n\t\tthis.thickness = source.thickness;\n\t\tthis.thicknessMap = source.thicknessMap;\n\t\tthis.attenuationDistance = source.attenuationDistance;\n\t\tthis.attenuationColor.copy( source.attenuationColor );\n\n\t\tthis.specularIntensity = source.specularIntensity;\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\n\t\tthis.specularColor.copy( source.specularColor );\n\t\tthis.specularColorMap = source.specularColorMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshPhongMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhongMaterial = true;\n\n\t\tthis.type = 'MeshPhongMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.specular = new Color( 0x111111 );\n\t\tthis.shininess = 30;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.specular.copy( source.specular );\n\t\tthis.shininess = source.shininess;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshToonMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshToonMaterial = true;\n\n\t\tthis.defines = { 'TOON': '' };\n\n\t\tthis.type = 'MeshToonMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\t\tthis.gradientMap = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\t\tthis.gradientMap = source.gradientMap;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshNormalMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshNormalMaterial = true;\n\n\t\tthis.type = 'MeshNormalMaterial';\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshLambertMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshLambertMaterial = true;\n\n\t\tthis.type = 'MeshLambertMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass MeshMatcapMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshMatcapMaterial = true;\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.type = 'MeshMatcapMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.matcap = null;\n\n\t\tthis.map = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.matcap = source.matcap;\n\n\t\tthis.map = source.map;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass LineDashedMaterial extends LineBasicMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isLineDashedMaterial = true;\n\n\t\tthis.type = 'LineDashedMaterial';\n\n\t\tthis.scale = 1;\n\t\tthis.dashSize = 3;\n\t\tthis.gapSize = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.scale = source.scale;\n\t\tthis.dashSize = source.dashSize;\n\t\tthis.gapSize = source.gapSize;\n\n\t\treturn this;\n\n\t}\n\n}\n\n// converts an array to a specific type\nfunction convertArray( array, type, forceClone ) {\n\n\tif ( ! array || // let 'undefined' and 'null' pass\n\t\t! forceClone && array.constructor === type ) return array;\n\n\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\treturn new type( array ); // create typed array\n\n\t}\n\n\treturn Array.prototype.slice.call( array ); // create Array\n\n}\n\nfunction isTypedArray( object ) {\n\n\treturn ArrayBuffer.isView( object ) &&\n\t\t! ( object instanceof DataView );\n\n}\n\n// returns an array by which times and values can be sorted\nfunction getKeyframeOrder( times ) {\n\n\tfunction compareTime( i, j ) {\n\n\t\treturn times[ i ] - times[ j ];\n\n\t}\n\n\tconst n = times.length;\n\tconst result = new Array( n );\n\tfor ( let i = 0; i !== n; ++ i ) result[ i ] = i;\n\n\tresult.sort( compareTime );\n\n\treturn result;\n\n}\n\n// uses the array previously returned by 'getKeyframeOrder' to sort data\nfunction sortedArray( values, stride, order ) {\n\n\tconst nValues = values.length;\n\tconst result = new values.constructor( nValues );\n\n\tfor ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\n\n\t\tconst srcOffset = order[ i ] * stride;\n\n\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\n\n\t\t}\n\n\t}\n\n\treturn result;\n\n}\n\n// function for parsing AOS keyframe formats\nfunction flattenJSON( jsonKeys, times, values, valuePropertyName ) {\n\n\tlet i = 1, key = jsonKeys[ 0 ];\n\n\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\n\n\t\tkey = jsonKeys[ i ++ ];\n\n\t}\n\n\tif ( key === undefined ) return; // no data\n\n\tlet value = key[ valuePropertyName ];\n\tif ( value === undefined ) return; // no data\n\n\tif ( Array.isArray( value ) ) {\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push.apply( values, value ); // push all elements\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else if ( value.toArray !== undefined ) {\n\n\t\t// ...assume THREE.Math-ish\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalue.toArray( values, values.length );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t} else {\n\n\t\t// otherwise push as-is\n\n\t\tdo {\n\n\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\tif ( value !== undefined ) {\n\n\t\t\t\ttimes.push( key.time );\n\t\t\t\tvalues.push( value );\n\n\t\t\t}\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t} while ( key !== undefined );\n\n\t}\n\n}\n\nfunction subclip( sourceClip, name, startFrame, endFrame, fps = 30 ) {\n\n\tconst clip = sourceClip.clone();\n\n\tclip.name = name;\n\n\tconst tracks = [];\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tconst track = clip.tracks[ i ];\n\t\tconst valueSize = track.getValueSize();\n\n\t\tconst times = [];\n\t\tconst values = [];\n\n\t\tfor ( let j = 0; j < track.times.length; ++ j ) {\n\n\t\t\tconst frame = track.times[ j ] * fps;\n\n\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\n\n\t\t\ttimes.push( track.times[ j ] );\n\n\t\t\tfor ( let k = 0; k < valueSize; ++ k ) {\n\n\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( times.length === 0 ) continue;\n\n\t\ttrack.times = convertArray( times, track.times.constructor );\n\t\ttrack.values = convertArray( values, track.values.constructor );\n\n\t\ttracks.push( track );\n\n\t}\n\n\tclip.tracks = tracks;\n\n\t// find minimum .times value across all tracks in the trimmed clip\n\n\tlet minStartTime = Infinity;\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\n\n\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\n\n\t\t}\n\n\t}\n\n\t// shift all tracks such that clip begins at t=0\n\n\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\tclip.tracks[ i ].shift( - 1 * minStartTime );\n\n\t}\n\n\tclip.resetDuration();\n\n\treturn clip;\n\n}\n\nfunction makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\n\n\tif ( fps <= 0 ) fps = 30;\n\n\tconst numTracks = referenceClip.tracks.length;\n\tconst referenceTime = referenceFrame / fps;\n\n\t// Make each track's values relative to the values at the reference frame\n\tfor ( let i = 0; i < numTracks; ++ i ) {\n\n\t\tconst referenceTrack = referenceClip.tracks[ i ];\n\t\tconst referenceTrackType = referenceTrack.ValueTypeName;\n\n\t\t// Skip this track if it's non-numeric\n\t\tif ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue;\n\n\t\t// Find the track in the target clip whose name and type matches the reference track\n\t\tconst targetTrack = targetClip.tracks.find( function ( track ) {\n\n\t\t\treturn track.name === referenceTrack.name\n\t\t\t\t&& track.ValueTypeName === referenceTrackType;\n\n\t\t} );\n\n\t\tif ( targetTrack === undefined ) continue;\n\n\t\tlet referenceOffset = 0;\n\t\tconst referenceValueSize = referenceTrack.getValueSize();\n\n\t\tif ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\treferenceOffset = referenceValueSize / 3;\n\n\t\t}\n\n\t\tlet targetOffset = 0;\n\t\tconst targetValueSize = targetTrack.getValueSize();\n\n\t\tif ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\ttargetOffset = targetValueSize / 3;\n\n\t\t}\n\n\t\tconst lastIndex = referenceTrack.times.length - 1;\n\t\tlet referenceValue;\n\n\t\t// Find the value to subtract out of the track\n\t\tif ( referenceTime <= referenceTrack.times[ 0 ] ) {\n\n\t\t\t// Reference frame is earlier than the first keyframe, so just use the first keyframe\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {\n\n\t\t\t// Reference frame is after the last keyframe, so just use the last keyframe\n\t\t\tconst startIndex = lastIndex * referenceValueSize + referenceOffset;\n\t\t\tconst endIndex = startIndex + referenceValueSize - referenceOffset;\n\t\t\treferenceValue = referenceTrack.values.slice( startIndex, endIndex );\n\n\t\t} else {\n\n\t\t\t// Interpolate to the reference value\n\t\t\tconst interpolant = referenceTrack.createInterpolant();\n\t\t\tconst startIndex = referenceOffset;\n\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\tinterpolant.evaluate( referenceTime );\n\t\t\treferenceValue = interpolant.resultBuffer.slice( startIndex, endIndex );\n\n\t\t}\n\n\t\t// Conjugate the quaternion\n\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\tconst referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate();\n\t\t\treferenceQuat.toArray( referenceValue );\n\n\t\t}\n\n\t\t// Subtract the reference value from all of the track values\n\n\t\tconst numTimes = targetTrack.times.length;\n\t\tfor ( let j = 0; j < numTimes; ++ j ) {\n\n\t\t\tconst valueStart = j * targetValueSize + targetOffset;\n\n\t\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\t\t// Multiply the conjugate for quaternion track types\n\t\t\t\tQuaternion.multiplyQuaternionsFlat(\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart,\n\t\t\t\t\treferenceValue,\n\t\t\t\t\t0,\n\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\tvalueStart\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconst valueEnd = targetValueSize - targetOffset * 2;\n\n\t\t\t\t// Subtract each value for all other numeric track types\n\t\t\t\tfor ( let k = 0; k < valueEnd; ++ k ) {\n\n\t\t\t\t\ttargetTrack.values[ valueStart + k ] -= referenceValue[ k ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttargetClip.blendMode = AdditiveAnimationBlendMode;\n\n\treturn targetClip;\n\n}\n\nconst AnimationUtils = {\n\tconvertArray: convertArray,\n\tisTypedArray: isTypedArray,\n\tgetKeyframeOrder: getKeyframeOrder,\n\tsortedArray: sortedArray,\n\tflattenJSON: flattenJSON,\n\tsubclip: subclip,\n\tmakeClipAdditive: makeClipAdditive\n};\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */\n\nclass Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tthis.parameterPositions = parameterPositions;\n\t\tthis._cachedIndex = 0;\n\n\t\tthis.resultBuffer = resultBuffer !== undefined ?\n\t\t\tresultBuffer : new sampleValues.constructor( sampleSize );\n\t\tthis.sampleValues = sampleValues;\n\t\tthis.valueSize = sampleSize;\n\n\t\tthis.settings = null;\n\t\tthis.DefaultSettings_ = {};\n\n\t}\n\n\tevaluate( t ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet i1 = this._cachedIndex,\n\t\t\tt1 = pp[ i1 ],\n\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\tvalidate_interval: {\n\n\t\t\tseek: {\n\n\t\t\t\tlet right;\n\n\t\t\t\tlinear_scan: {\n\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 + 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\n\n\t\t\t\t\t\t\t\t// after end\n\n\t\t\t\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt0 = t1;\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\n\n\t\t\t\t\t\t\tif ( t < t1 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the right side of the index\n\t\t\t\t\t\tright = pp.length;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\n\n\t\t\t\t\t\t// looping?\n\n\t\t\t\t\t\tconst t1global = pp[ 1 ];\n\n\t\t\t\t\t\tif ( t < t1global ) {\n\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\n\t\t\t\t\t\t\tt0 = t1global;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// linear reverse scan\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 - 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\t\t\t\t// before start\n\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt1 = t0;\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\n\n\t\t\t\t\t\t\tif ( t >= t0 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the left side of the index\n\t\t\t\t\t\tright = i1;\n\t\t\t\t\t\ti1 = 0;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the interval is valid\n\n\t\t\t\t\tbreak validate_interval;\n\n\t\t\t\t} // linear scan\n\n\t\t\t\t// binary search\n\n\t\t\t\twhile ( i1 < right ) {\n\n\t\t\t\t\tconst mid = ( i1 + right ) >>> 1;\n\n\t\t\t\t\tif ( t < pp[ mid ] ) {\n\n\t\t\t\t\t\tright = mid;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ti1 = mid + 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tt1 = pp[ i1 ];\n\t\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\t\t\t// check boundary cases, again\n\n\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\treturn this.copySampleValue_( 0 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t\t\t\t}\n\n\t\t\t} // seek\n\n\t\t\tthis._cachedIndex = i1;\n\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\n\n\t\t} // validate_interval\n\n\t\treturn this.interpolate_( i1, t0, t, t1 );\n\n\t}\n\n\tgetSettings_() {\n\n\t\treturn this.settings || this.DefaultSettings_;\n\n\t}\n\n\tcopySampleValue_( index ) {\n\n\t\t// copies a sample value to the result buffer\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = index * stride;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t// Template methods for derived classes:\n\n\tinterpolate_( /* i1, t0, t, t1 */ ) {\n\n\t\tthrow new Error( 'call to abstract method' );\n\t\t// implementations shall return this.resultBuffer\n\n\t}\n\n\tintervalChanged_( /* i1, t0, t1 */ ) {\n\n\t\t// empty\n\n\t}\n\n}\n\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */\n\nclass CubicInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t\tthis._weightPrev = - 0;\n\t\tthis._offsetPrev = - 0;\n\t\tthis._weightNext = - 0;\n\t\tthis._offsetNext = - 0;\n\n\t\tthis.DefaultSettings_ = {\n\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\n\t\t};\n\n\t}\n\n\tintervalChanged_( i1, t0, t1 ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet iPrev = i1 - 2,\n\t\t\tiNext = i1 + 1,\n\n\t\t\ttPrev = pp[ iPrev ],\n\t\t\ttNext = pp[ iNext ];\n\n\t\tif ( tPrev === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingStart ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(t0) = 0\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = 2 * t0 - t1;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiPrev = pp.length - 2;\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = t1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tNext === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(tN) = 0\n\t\t\t\t\tiNext = i1;\n\t\t\t\t\ttNext = 2 * t1 - t0;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiNext = 1;\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\n\t\t\t\t\tiNext = i1 - 1;\n\t\t\t\t\ttNext = t0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst halfDt = ( t1 - t0 ) * 0.5,\n\t\t\tstride = this.valueSize;\n\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\n\t\tthis._offsetPrev = iPrev * stride;\n\t\tthis._offsetNext = iNext * stride;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\n\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tpp = p * p,\n\t\t\tppp = pp * p;\n\n\t\t// evaluate polynomials\n\n\t\tconst sP = - wP * ppp + 2 * wP * pp - wP * p;\n\t\tconst s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;\n\t\tconst s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\n\t\tconst sN = wN * ppp - wN * pp;\n\n\t\t// combine data linearly\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tsP * values[ oP + i ] +\n\t\t\t\t\ts0 * values[ o0 + i ] +\n\t\t\t\t\ts1 * values[ o1 + i ] +\n\t\t\t\t\tsN * values[ oN + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nclass LinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset1 = i1 * stride,\n\t\t\toffset0 = offset1 - stride,\n\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tweight0 = 1 - weight1;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n */\n\nclass DiscreteInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1 /*, t0, t, t1 */ ) {\n\n\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t}\n\n}\n\nclass KeyframeTrack {\n\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\t\tthis.name = name;\n\n\t\tthis.times = convertArray( times, this.TimeBufferType );\n\t\tthis.values = convertArray( values, this.ValueBufferType );\n\n\t\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\n\n\t}\n\n\t// Serialization (in static context, because of constructor invocation\n\t// and automatic invocation of .toJSON):\n\n\tstatic toJSON( track ) {\n\n\t\tconst trackType = track.constructor;\n\n\t\tlet json;\n\n\t\t// derived classes can define a static toJSON method\n\t\tif ( trackType.toJSON !== this.toJSON ) {\n\n\t\t\tjson = trackType.toJSON( track );\n\n\t\t} else {\n\n\t\t\t// by default, we assume the data can be serialized as-is\n\t\t\tjson = {\n\n\t\t\t\t'name': track.name,\n\t\t\t\t'times': convertArray( track.times, Array ),\n\t\t\t\t'values': convertArray( track.values, Array )\n\n\t\t\t};\n\n\t\t\tconst interpolation = track.getInterpolation();\n\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\n\n\t\t\t\tjson.interpolation = interpolation;\n\n\t\t\t}\n\n\t\t}\n\n\t\tjson.type = track.ValueTypeName; // mandatory\n\n\t\treturn json;\n\n\t}\n\n\tInterpolantFactoryMethodDiscrete( result ) {\n\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodSmooth( result ) {\n\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tsetInterpolation( interpolation ) {\n\n\t\tlet factoryMethod;\n\n\t\tswitch ( interpolation ) {\n\n\t\t\tcase InterpolateDiscrete:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateLinear:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateSmooth:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( factoryMethod === undefined ) {\n\n\t\t\tconst message = 'unsupported interpolation for ' +\n\t\t\t\tthis.ValueTypeName + ' keyframe track named ' + this.name;\n\n\t\t\tif ( this.createInterpolant === undefined ) {\n\n\t\t\t\t// fall back to default, unless the default itself is messed up\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\n\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconsole.warn( 'THREE.KeyframeTrack:', message );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.createInterpolant = factoryMethod;\n\n\t\treturn this;\n\n\t}\n\n\tgetInterpolation() {\n\n\t\tswitch ( this.createInterpolant ) {\n\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\n\n\t\t\t\treturn InterpolateDiscrete;\n\n\t\t\tcase this.InterpolantFactoryMethodLinear:\n\n\t\t\t\treturn InterpolateLinear;\n\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\n\n\t\t\t\treturn InterpolateSmooth;\n\n\t\t}\n\n\t}\n\n\tgetValueSize() {\n\n\t\treturn this.values.length / this.times.length;\n\n\t}\n\n\t// move all keyframes either forwards or backwards in time\n\tshift( timeOffset ) {\n\n\t\tif ( timeOffset !== 0.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] += timeOffset;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n\tscale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n\t// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n\ttrim( startTime, endTime ) {\n\n\t\tconst times = this.times,\n\t\t\tnKeys = times.length;\n\n\t\tlet from = 0,\n\t\t\tto = nKeys - 1;\n\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\n\n\t\t\t++ from;\n\n\t\t}\n\n\t\twhile ( to !== - 1 && times[ to ] > endTime ) {\n\n\t\t\t-- to;\n\n\t\t}\n\n\t\t++ to; // inclusive -> exclusive bound\n\n\t\tif ( from !== 0 || to !== nKeys ) {\n\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\n\t\t\tif ( from >= to ) {\n\n\t\t\t\tto = Math.max( to, 1 );\n\t\t\t\tfrom = to - 1;\n\n\t\t\t}\n\n\t\t\tconst stride = this.getValueSize();\n\t\t\tthis.times = times.slice( from, to );\n\t\t\tthis.values = this.values.slice( from * stride, to * stride );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tconst valueSize = this.getValueSize();\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tconst times = this.times,\n\t\t\tvalues = this.values,\n\n\t\t\tnKeys = times.length;\n\n\t\tif ( nKeys === 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Track is empty.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tlet prevTime = null;\n\n\t\tfor ( let i = 0; i !== nKeys; i ++ ) {\n\n\t\t\tconst currTime = times[ i ];\n\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t\tif ( values !== undefined ) {\n\n\t\t\tif ( isTypedArray( values ) ) {\n\n\t\t\t\tfor ( let i = 0, n = values.length; i !== n; ++ i ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tif ( isNaN( value ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value );\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\t// removes equivalent sequential keys as common in morph target sequences\n\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n\toptimize() {\n\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\n\t\tconst times = this.times.slice(),\n\t\t\tvalues = this.values.slice(),\n\t\t\tstride = this.getValueSize(),\n\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n\n\t\t\tlastIndex = times.length - 1;\n\n\t\tlet writeIndex = 1;\n\n\t\tfor ( let i = 1; i < lastIndex; ++ i ) {\n\n\t\t\tlet keep = false;\n\n\t\t\tconst time = times[ i ];\n\t\t\tconst timeNext = times[ i + 1 ];\n\n\t\t\t// remove adjacent keyframes scheduled at the same time\n\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) {\n\n\t\t\t\tif ( ! smoothInterpolation ) {\n\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\n\n\t\t\t\t\tconst offset = i * stride,\n\t\t\t\t\t\toffsetP = offset - stride,\n\t\t\t\t\t\toffsetN = offset + stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tconst value = values[ offset + j ];\n\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\n\n\t\t\t\t\t\t\tkeep = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tkeep = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// in-place compaction\n\n\t\t\tif ( keep ) {\n\n\t\t\t\tif ( i !== writeIndex ) {\n\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\n\n\t\t\t\t\tconst readOffset = i * stride,\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t++ writeIndex;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// flush last keyframe (compaction looks ahead)\n\n\t\tif ( lastIndex > 0 ) {\n\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\n\n\t\t\tfor ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t}\n\n\t\t\t++ writeIndex;\n\n\t\t}\n\n\t\tif ( writeIndex !== times.length ) {\n\n\t\t\tthis.times = times.slice( 0, writeIndex );\n\t\t\tthis.values = values.slice( 0, writeIndex * stride );\n\n\t\t} else {\n\n\t\t\tthis.times = times;\n\t\t\tthis.values = values;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst times = this.times.slice();\n\t\tconst values = this.values.slice();\n\n\t\tconst TypedKeyframeTrack = this.constructor;\n\t\tconst track = new TypedKeyframeTrack( this.name, times, values );\n\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\n\t\ttrack.createInterpolant = this.createInterpolant;\n\n\t\treturn track;\n\n\t}\n\n}\n\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\n\n/**\n * A Track of Boolean keyframe values.\n */\nclass BooleanKeyframeTrack extends KeyframeTrack {}\n\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of keyframe values that represent color.\n */\nclass ColorKeyframeTrack extends KeyframeTrack {}\n\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\n\n/**\n * A Track of numeric keyframe values.\n */\nclass NumberKeyframeTrack extends KeyframeTrack {}\n\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\n\n/**\n * Spherical linear unit quaternion interpolant.\n */\n\nclass QuaternionLinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\n\n\t\tlet offset = i1 * stride;\n\n\t\tfor ( let end = offset + stride; offset !== end; offset += 4 ) {\n\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * A Track of quaternion keyframe values.\n */\nclass QuaternionKeyframeTrack extends KeyframeTrack {\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n}\n\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\n// ValueBufferType is inherited\nQuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nclass StringKeyframeTrack extends KeyframeTrack {}\n\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\nStringKeyframeTrack.prototype.ValueBufferType = Array;\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of vectored keyframe values.\n */\nclass VectorKeyframeTrack extends KeyframeTrack {}\n\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\n\nclass AnimationClip {\n\n\tconstructor( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) {\n\n\t\tthis.name = name;\n\t\tthis.tracks = tracks;\n\t\tthis.duration = duration;\n\t\tthis.blendMode = blendMode;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// this means it should figure out its duration by scanning the tracks\n\t\tif ( this.duration < 0 ) {\n\n\t\t\tthis.resetDuration();\n\n\t\t}\n\n\t}\n\n\n\tstatic parse( json ) {\n\n\t\tconst tracks = [],\n\t\t\tjsonTracks = json.tracks,\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\n\n\t\tfor ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\n\n\t\t}\n\n\t\tconst clip = new this( json.name, json.duration, tracks, json.blendMode );\n\t\tclip.uuid = json.uuid;\n\n\t\treturn clip;\n\n\t}\n\n\tstatic toJSON( clip ) {\n\n\t\tconst tracks = [],\n\t\t\tclipTracks = clip.tracks;\n\n\t\tconst json = {\n\n\t\t\t'name': clip.name,\n\t\t\t'duration': clip.duration,\n\t\t\t'tracks': tracks,\n\t\t\t'uuid': clip.uuid,\n\t\t\t'blendMode': clip.blendMode\n\n\t\t};\n\n\t\tfor ( let i = 0, n = clipTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\n\n\t\t}\n\n\t\treturn json;\n\n\t}\n\n\tstatic CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) {\n\n\t\tconst numMorphTargets = morphTargetSequence.length;\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; i ++ ) {\n\n\t\t\tlet times = [];\n\t\t\tlet values = [];\n\n\t\t\ttimes.push(\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\n\t\t\t\ti,\n\t\t\t\t( i + 1 ) % numMorphTargets );\n\n\t\t\tvalues.push( 0, 1, 0 );\n\n\t\t\tconst order = getKeyframeOrder( times );\n\t\t\ttimes = sortedArray( times, 1, order );\n\t\t\tvalues = sortedArray( values, 1, order );\n\n\t\t\t// if there is a key at the first frame, duplicate it as the\n\t\t\t// last frame as well for perfect loop.\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\n\n\t\t\t\ttimes.push( numMorphTargets );\n\t\t\t\tvalues.push( values[ 0 ] );\n\n\t\t\t}\n\n\t\t\ttracks.push(\n\t\t\t\tnew NumberKeyframeTrack(\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\n\t\t\t\t\ttimes, values\n\t\t\t\t).scale( 1.0 / fps ) );\n\n\t\t}\n\n\t\treturn new this( name, - 1, tracks );\n\n\t}\n\n\tstatic findByName( objectOrClipArray, name ) {\n\n\t\tlet clipArray = objectOrClipArray;\n\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\n\n\t\t\tconst o = objectOrClipArray;\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < clipArray.length; i ++ ) {\n\n\t\t\tif ( clipArray[ i ].name === name ) {\n\n\t\t\t\treturn clipArray[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\tstatic CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) {\n\n\t\tconst animationToMorphTargets = {};\n\n\t\t// tested with https://regex101.com/ on trick sequences\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n\t\tconst pattern = /^([\\w-]*?)([\\d]+)$/;\n\n\t\t// sort morph target names into animation groups based\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\n\t\tfor ( let i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\tconst parts = morphTarget.name.match( pattern );\n\n\t\t\tif ( parts && parts.length > 1 ) {\n\n\t\t\t\tconst name = parts[ 1 ];\n\n\t\t\t\tlet animationMorphTargets = animationToMorphTargets[ name ];\n\n\t\t\t\tif ( ! animationMorphTargets ) {\n\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\n\n\t\t\t\t}\n\n\t\t\t\tanimationMorphTargets.push( morphTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst clips = [];\n\n\t\tfor ( const name in animationToMorphTargets ) {\n\n\t\t\tclips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\n\n\t\t}\n\n\t\treturn clips;\n\n\t}\n\n\t// parse the animation.hierarchy format\n\tstatic parseAnimation( animation, bones ) {\n\n\t\tif ( ! animation ) {\n\n\t\t\tconsole.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\n\n\t\t\t// only return track if there are actually keys.\n\t\t\tif ( animationKeys.length !== 0 ) {\n\n\t\t\t\tconst times = [];\n\t\t\t\tconst values = [];\n\n\t\t\t\tflattenJSON( animationKeys, times, values, propertyName );\n\n\t\t\t\t// empty keys are filtered out, so check again\n\t\t\t\tif ( times.length !== 0 ) {\n\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tconst tracks = [];\n\n\t\tconst clipName = animation.name || 'default';\n\t\tconst fps = animation.fps || 30;\n\t\tconst blendMode = animation.blendMode;\n\n\t\t// automatic length determination in AnimationClip.\n\t\tlet duration = animation.length || - 1;\n\n\t\tconst hierarchyTracks = animation.hierarchy || [];\n\n\t\tfor ( let h = 0; h < hierarchyTracks.length; h ++ ) {\n\n\t\t\tconst animationKeys = hierarchyTracks[ h ].keys;\n\n\t\t\t// skip empty tracks\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\n\n\t\t\t// process morph targets\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\n\n\t\t\t\t// figure out all morph targets used in this track\n\t\t\t\tconst morphTargetNames = {};\n\n\t\t\t\tlet k;\n\n\t\t\t\tfor ( k = 0; k < animationKeys.length; k ++ ) {\n\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\n\n\t\t\t\t\t\tfor ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\n\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// create a track for each morph target with all zero\n\t\t\t\t// morphTargetInfluences except for the keys in which\n\t\t\t\t// the morphTarget is named.\n\t\t\t\tfor ( const morphTargetName in morphTargetNames ) {\n\n\t\t\t\t\tconst times = [];\n\t\t\t\t\tconst values = [];\n\n\t\t\t\t\tfor ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\n\n\t\t\t\t\t\tconst animationKey = animationKeys[ k ];\n\n\t\t\t\t\t\ttimes.push( animationKey.time );\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\n\n\t\t\t\t}\n\n\t\t\t\tduration = morphTargetNames.length * fps;\n\n\t\t\t} else {\n\n\t\t\t\t// ...assume skeletal animation\n\n\t\t\t\tconst boneName = '.bones[' + bones[ h ].name + ']';\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\n\t\t\t\t\tanimationKeys, 'pos', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\n\t\t\t\t\tanimationKeys, 'rot', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\n\t\t\t\t\tanimationKeys, 'scl', tracks );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tracks.length === 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst clip = new this( clipName, duration, tracks, blendMode );\n\n\t\treturn clip;\n\n\t}\n\n\tresetDuration() {\n\n\t\tconst tracks = this.tracks;\n\t\tlet duration = 0;\n\n\t\tfor ( let i = 0, n = tracks.length; i !== n; ++ i ) {\n\n\t\t\tconst track = this.tracks[ i ];\n\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\n\n\t\t}\n\n\t\tthis.duration = duration;\n\n\t\treturn this;\n\n\t}\n\n\ttrim() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tvalid = valid && this.tracks[ i ].validate();\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\toptimize() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].optimize();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\ttracks.push( this.tracks[ i ].clone() );\n\n\t\t}\n\n\t\treturn new this.constructor( this.name, this.duration, tracks, this.blendMode );\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.constructor.toJSON( this );\n\n\t}\n\n}\n\nfunction getTrackTypeForValueTypeName( typeName ) {\n\n\tswitch ( typeName.toLowerCase() ) {\n\n\t\tcase 'scalar':\n\t\tcase 'double':\n\t\tcase 'float':\n\t\tcase 'number':\n\t\tcase 'integer':\n\n\t\t\treturn NumberKeyframeTrack;\n\n\t\tcase 'vector':\n\t\tcase 'vector2':\n\t\tcase 'vector3':\n\t\tcase 'vector4':\n\n\t\t\treturn VectorKeyframeTrack;\n\n\t\tcase 'color':\n\n\t\t\treturn ColorKeyframeTrack;\n\n\t\tcase 'quaternion':\n\n\t\t\treturn QuaternionKeyframeTrack;\n\n\t\tcase 'bool':\n\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tconst times = [], values = [];\n\n\t\tflattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {\n\n\t\treturn trackType.parse( json );\n\n\t} else {\n\n\t\t// by default, we assume a constructor compatible with the base\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\n\n\t}\n\n}\n\nconst Cache = {\n\n\tenabled: false,\n\n\tfiles: {},\n\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\nclass LoadingManager {\n\n\tconstructor( onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet isLoading = false;\n\t\tlet itemsLoaded = 0;\n\t\tlet itemsTotal = 0;\n\t\tlet urlModifier = undefined;\n\t\tconst handlers = [];\n\n\t\t// Refer to #5689 for the reason why we don't set .onStart\n\t\t// in the constructor\n\n\t\tthis.onStart = undefined;\n\t\tthis.onLoad = onLoad;\n\t\tthis.onProgress = onProgress;\n\t\tthis.onError = onError;\n\n\t\tthis.itemStart = function ( url ) {\n\n\t\t\titemsTotal ++;\n\n\t\t\tif ( isLoading === false ) {\n\n\t\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tisLoading = true;\n\n\t\t};\n\n\t\tthis.itemEnd = function ( url ) {\n\n\t\t\titemsLoaded ++;\n\n\t\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\t\tisLoading = false;\n\n\t\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\t\tscope.onLoad();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.itemError = function ( url ) {\n\n\t\t\tif ( scope.onError !== undefined ) {\n\n\t\t\t\tscope.onError( url );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.resolveURL = function ( url ) {\n\n\t\t\tif ( urlModifier ) {\n\n\t\t\t\treturn urlModifier( url );\n\n\t\t\t}\n\n\t\t\treturn url;\n\n\t\t};\n\n\t\tthis.setURLModifier = function ( transform ) {\n\n\t\t\turlModifier = transform;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.addHandler = function ( regex, loader ) {\n\n\t\t\thandlers.push( regex, loader );\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.removeHandler = function ( regex ) {\n\n\t\t\tconst index = handlers.indexOf( regex );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\thandlers.splice( index, 2 );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.getHandler = function ( file ) {\n\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\t\tconst regex = handlers[ i ];\n\t\t\t\tconst loader = handlers[ i + 1 ];\n\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\t\treturn loader;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t};\n\n\t}\n\n}\n\nconst DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();\n\nclass Loader {\n\n\tconstructor( manager ) {\n\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\t\tthis.crossOrigin = 'anonymous';\n\t\tthis.withCredentials = false;\n\t\tthis.path = '';\n\t\tthis.resourcePath = '';\n\t\tthis.requestHeader = {};\n\n\t}\n\n\tload( /* url, onLoad, onProgress, onError */ ) {}\n\n\tloadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.load( url, resolve, onProgress, reject );\n\n\t\t} );\n\n\t}\n\n\tparse( /* data */ ) {}\n\n\tsetCrossOrigin( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t}\n\n\tsetWithCredentials( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t}\n\n\tsetPath( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t}\n\n\tsetResourcePath( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n\tsetRequestHeader( requestHeader ) {\n\n\t\tthis.requestHeader = requestHeader;\n\t\treturn this;\n\n\t}\n\n}\n\nLoader.DEFAULT_MATERIAL_NAME = '__DEFAULT';\n\nconst loading = {};\n\nclass HttpError extends Error {\n\n\tconstructor( message, response ) {\n\n\t\tsuper( message );\n\t\tthis.response = response;\n\n\t}\n\n}\n\nclass FileLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tthis.manager.itemStart( url );\n\n\t\t\tsetTimeout( () => {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\t// Check if request is duplicate\n\n\t\tif ( loading[ url ] !== undefined ) {\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Initialise array for duplicate requests\n\t\tloading[ url ] = [];\n\n\t\tloading[ url ].push( {\n\t\t\tonLoad: onLoad,\n\t\t\tonProgress: onProgress,\n\t\t\tonError: onError,\n\t\t} );\n\n\t\t// create request\n\t\tconst req = new Request( url, {\n\t\t\theaders: new Headers( this.requestHeader ),\n\t\t\tcredentials: this.withCredentials ? 'include' : 'same-origin',\n\t\t\t// An abort controller could be added within a future PR\n\t\t} );\n\n\t\t// record states ( avoid data race )\n\t\tconst mimeType = this.mimeType;\n\t\tconst responseType = this.responseType;\n\n\t\t// start the fetch\n\t\tfetch( req )\n\t\t\t.then( response => {\n\n\t\t\t\tif ( response.status === 200 || response.status === 0 ) {\n\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\n\n\t\t\t\t\tif ( response.status === 0 ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.FileLoader: HTTP Status 0 received.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Workaround: Checking if response.body === undefined for Alipay browser #23548\n\n\t\t\t\t\tif ( typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined ) {\n\n\t\t\t\t\t\treturn response;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\t\tconst reader = response.body.getReader();\n\n\t\t\t\t\t// Nginx needs X-File-Size check\n\t\t\t\t\t// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n\t\t\t\t\tconst contentLength = response.headers.get( 'Content-Length' ) || response.headers.get( 'X-File-Size' );\n\t\t\t\t\tconst total = contentLength ? parseInt( contentLength ) : 0;\n\t\t\t\t\tconst lengthComputable = total !== 0;\n\t\t\t\t\tlet loaded = 0;\n\n\t\t\t\t\t// periodically read data into the new stream tracking while download progress\n\t\t\t\t\tconst stream = new ReadableStream( {\n\t\t\t\t\t\tstart( controller ) {\n\n\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\tfunction readData() {\n\n\t\t\t\t\t\t\t\treader.read().then( ( { done, value } ) => {\n\n\t\t\t\t\t\t\t\t\tif ( done ) {\n\n\t\t\t\t\t\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\tloaded += value.byteLength;\n\n\t\t\t\t\t\t\t\t\t\tconst event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );\n\t\t\t\t\t\t\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\t\t\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcontroller.enqueue( value );\n\t\t\t\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn new Response( stream );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new HttpError( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( response => {\n\n\t\t\t\tswitch ( responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\n\t\t\t\t\t\treturn response.arrayBuffer();\n\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\treturn response.blob();\n\n\t\t\t\t\tcase 'document':\n\n\t\t\t\t\t\treturn response.text()\n\t\t\t\t\t\t\t.then( text => {\n\n\t\t\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\t\t\treturn parser.parseFromString( text, mimeType );\n\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\tcase 'json':\n\n\t\t\t\t\t\treturn response.json();\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( mimeType === undefined ) {\n\n\t\t\t\t\t\t\treturn response.text();\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// sniff encoding\n\t\t\t\t\t\t\tconst re = /charset=\"?([^;\"\\s]*)\"?/i;\n\t\t\t\t\t\t\tconst exec = re.exec( mimeType );\n\t\t\t\t\t\t\tconst label = exec && exec[ 1 ] ? exec[ 1 ].toLowerCase() : undefined;\n\t\t\t\t\t\t\tconst decoder = new TextDecoder( label );\n\t\t\t\t\t\t\treturn response.arrayBuffer().then( ab => decoder.decode( ab ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( data => {\n\n\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\n\t\t\t\t// error response bodies as proper responses to requests.\n\t\t\t\tCache.add( url, data );\n\n\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( data );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.catch( err => {\n\n\t\t\t\t// Abort errors and other errors are handled the same\n\n\t\t\t\tconst callbacks = loading[ url ];\n\n\t\t\t\tif ( callbacks === undefined ) {\n\n\t\t\t\t\t// When onLoad was called and url was deleted in `loading`\n\t\t\t\t\tthis.manager.itemError( url );\n\t\t\t\t\tthrow err;\n\n\t\t\t\t}\n\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( err );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemError( url );\n\n\t\t\t} )\n\t\t\t.finally( () => {\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\tthis.manager.itemStart( url );\n\n\t}\n\n\tsetResponseType( value ) {\n\n\t\tthis.responseType = value;\n\t\treturn this;\n\n\t}\n\n\tsetMimeType( value ) {\n\n\t\tthis.mimeType = value;\n\t\treturn this;\n\n\t}\n\n}\n\nclass AnimationLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst animations = [];\n\n\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\tconst clip = AnimationClip.parse( json[ i ] );\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass CompressedTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst images = [];\n\n\t\tconst texture = new CompressedTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( url[ i ], function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\timages[ i ] = {\n\t\t\t\t\twidth: texDatas.width,\n\t\t\t\t\theight: texDatas.height,\n\t\t\t\t\tformat: texDatas.format,\n\t\t\t\t\tmipmaps: texDatas.mipmaps\n\t\t\t\t};\n\n\t\t\t\tloaded += 1;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;\n\n\t\t\t\t\ttexture.image = images;\n\t\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\tif ( Array.isArray( url ) ) {\n\n\t\t\tfor ( let i = 0, il = url.length; i < il; ++ i ) {\n\n\t\t\t\tloadTexture( i );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// compressed cubemap texture stored in a single DDS file\n\n\t\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\tif ( texDatas.isCubemap ) {\n\n\t\t\t\t\tconst faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n\n\t\t\t\t\tfor ( let f = 0; f < faces; f ++ ) {\n\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\n\n\t\t\t\t\t\tfor ( let i = 0; i < texDatas.mipmapCount; i ++ ) {\n\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.image = images;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture.image.width = texDatas.width;\n\t\t\t\t\ttexture.image.height = texDatas.height;\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\n\n\t\t\t\t}\n\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\n\n\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t}\n\n\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass ImageLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst image = createElementNS( 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tCache.add( url, this );\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction removeEventListeners() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.slice( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n}\n\nclass CubeTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( urls, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new CubeTexture();\n\t\ttexture.colorSpace = SRGBColorSpace;\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( urls[ i ], function ( image ) {\n\n\t\t\t\ttexture.images[ i ] = image;\n\n\t\t\t\tloaded ++;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, undefined, onError );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < urls.length; ++ i ) {\n\n\t\t\tloadTexture( i );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass DataTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst texture = new DataTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setPath( this.path );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\tlet texData;\n\n\t\t\ttry {\n\n\t\t\t\ttexData = scope.parse( buffer );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) {\n\n\t\t\t\t\tonError( error );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( error );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( texData.image !== undefined ) {\n\n\t\t\t\ttexture.image = texData.image;\n\n\t\t\t} else if ( texData.data !== undefined ) {\n\n\t\t\t\ttexture.image.width = texData.width;\n\t\t\t\ttexture.image.height = texData.height;\n\t\t\t\ttexture.image.data = texData.data;\n\n\t\t\t}\n\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n\n\t\t\tif ( texData.colorSpace !== undefined ) {\n\n\t\t\t\ttexture.colorSpace = texData.colorSpace;\n\n\t\t\t} else if ( texData.encoding !== undefined ) { // @deprecated, r152\n\n\t\t\t\ttexture.encoding = texData.encoding;\n\n\t\t\t}\n\n\t\t\tif ( texData.flipY !== undefined ) {\n\n\t\t\t\ttexture.flipY = texData.flipY;\n\n\t\t\t}\n\n\t\t\tif ( texData.format !== undefined ) {\n\n\t\t\t\ttexture.format = texData.format;\n\n\t\t\t}\n\n\t\t\tif ( texData.type !== undefined ) {\n\n\t\t\t\ttexture.type = texData.type;\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmaps !== undefined ) {\n\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmapCount === 1 ) {\n\n\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t}\n\n\t\t\tif ( texData.generateMipmaps !== undefined ) {\n\n\t\t\t\ttexture.generateMipmaps = texData.generateMipmaps;\n\n\t\t\t}\n\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad ) onLoad( texture, texData );\n\n\t\t}, onProgress, onError );\n\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass TextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new Texture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass Light extends Object3D {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.isLight = true;\n\n\t\tthis.type = 'Light';\n\n\t\tthis.color = new Color( color );\n\t\tthis.intensity = intensity;\n\n\t}\n\n\tdispose() {\n\n\t\t// Empty here in base class; some subclasses override.\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.color = this.color.getHex();\n\t\tdata.object.intensity = this.intensity;\n\n\t\tif ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();\n\n\t\tif ( this.distance !== undefined ) data.object.distance = this.distance;\n\t\tif ( this.angle !== undefined ) data.object.angle = this.angle;\n\t\tif ( this.decay !== undefined ) data.object.decay = this.decay;\n\t\tif ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;\n\n\t\tif ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass HemisphereLight extends Light {\n\n\tconstructor( skyColor, groundColor, intensity ) {\n\n\t\tsuper( skyColor, intensity );\n\n\t\tthis.isHemisphereLight = true;\n\n\t\tthis.type = 'HemisphereLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.groundColor = new Color( groundColor );\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.groundColor.copy( source.groundColor );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();\nconst _lookTarget$1 = /*@__PURE__*/ new Vector3();\n\nclass LightShadow {\n\n\tconstructor( camera ) {\n\n\t\tthis.camera = camera;\n\n\t\tthis.bias = 0;\n\t\tthis.normalBias = 0;\n\t\tthis.radius = 1;\n\t\tthis.blurSamples = 8;\n\n\t\tthis.mapSize = new Vector2( 512, 512 );\n\n\t\tthis.map = null;\n\t\tthis.mapPass = null;\n\t\tthis.matrix = new Matrix4();\n\n\t\tthis.autoUpdate = true;\n\t\tthis.needsUpdate = false;\n\n\t\tthis._frustum = new Frustum();\n\t\tthis._frameExtents = new Vector2( 1, 1 );\n\n\t\tthis._viewportCount = 1;\n\n\t\tthis._viewports = [\n\n\t\t\tnew Vector4( 0, 0, 1, 1 )\n\n\t\t];\n\n\t}\n\n\tgetViewportCount() {\n\n\t\treturn this._viewportCount;\n\n\t}\n\n\tgetFrustum() {\n\n\t\treturn this._frustum;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst shadowCamera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\t_lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );\n\t\tshadowCamera.position.copy( _lightPositionWorld$1 );\n\n\t\t_lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );\n\t\tshadowCamera.lookAt( _lookTarget$1 );\n\t\tshadowCamera.updateMatrixWorld();\n\n\t\t_projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );\n\n\t\tshadowMatrix.set(\n\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t0.0, 0.0, 0.5, 0.5,\n\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t);\n\n\t\tshadowMatrix.multiply( _projScreenMatrix$1 );\n\n\t}\n\n\tgetViewport( viewportIndex ) {\n\n\t\treturn this._viewports[ viewportIndex ];\n\n\t}\n\n\tgetFrameExtents() {\n\n\t\treturn this._frameExtents;\n\n\t}\n\n\tdispose() {\n\n\t\tif ( this.map ) {\n\n\t\t\tthis.map.dispose();\n\n\t\t}\n\n\t\tif ( this.mapPass ) {\n\n\t\t\tthis.mapPass.dispose();\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.camera = source.camera.clone();\n\n\t\tthis.bias = source.bias;\n\t\tthis.radius = source.radius;\n\n\t\tthis.mapSize.copy( source.mapSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst object = {};\n\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\n\t\tif ( this.normalBias !== 0 ) object.normalBias = this.normalBias;\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\n\n\t\tobject.camera = this.camera.toJSON( false ).object;\n\t\tdelete object.camera.matrix;\n\n\t\treturn object;\n\n\t}\n\n}\n\nclass SpotLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 50, 1, 0.5, 500 ) );\n\n\t\tthis.isSpotLightShadow = true;\n\n\t\tthis.focus = 1;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst camera = this.camera;\n\n\t\tconst fov = RAD2DEG * 2 * light.angle * this.focus;\n\t\tconst aspect = this.mapSize.width / this.mapSize.height;\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\n\n\t\t\tcamera.fov = fov;\n\t\t\tcamera.aspect = aspect;\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\tsuper.updateMatrices( light );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.focus = source.focus;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass SpotLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isSpotLight = true;\n\n\t\tthis.type = 'SpotLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.distance = distance;\n\t\tthis.angle = angle;\n\t\tthis.penumbra = penumbra;\n\t\tthis.decay = decay;\n\n\t\tthis.map = null;\n\n\t\tthis.shadow = new SpotLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// by convention for a spotlight, luminous power (lm) = \u03C0 * luminous intensity (cd)\n\t\treturn this.intensity * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / Math.PI;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.angle = source.angle;\n\t\tthis.penumbra = source.penumbra;\n\t\tthis.decay = source.decay;\n\n\t\tthis.target = source.target.clone();\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\nconst _lookTarget = /*@__PURE__*/ new Vector3();\n\nclass PointLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 90, 1, 0.5, 500 ) );\n\n\t\tthis.isPointLightShadow = true;\n\n\t\tthis._frameExtents = new Vector2( 4, 2 );\n\n\t\tthis._viewportCount = 6;\n\n\t\tthis._viewports = [\n\t\t\t// These viewports map a cube-map onto a 2D texture with the\n\t\t\t// following orientation:\n\t\t\t//\n\t\t\t// xzXZ\n\t\t\t// y Y\n\t\t\t//\n\t\t\t// X - Positive x direction\n\t\t\t// x - Negative x direction\n\t\t\t// Y - Positive y direction\n\t\t\t// y - Negative y direction\n\t\t\t// Z - Positive z direction\n\t\t\t// z - Negative z direction\n\n\t\t\t// positive X\n\t\t\tnew Vector4( 2, 1, 1, 1 ),\n\t\t\t// negative X\n\t\t\tnew Vector4( 0, 1, 1, 1 ),\n\t\t\t// positive Z\n\t\t\tnew Vector4( 3, 1, 1, 1 ),\n\t\t\t// negative Z\n\t\t\tnew Vector4( 1, 1, 1, 1 ),\n\t\t\t// positive Y\n\t\t\tnew Vector4( 3, 0, 1, 1 ),\n\t\t\t// negative Y\n\t\t\tnew Vector4( 1, 0, 1, 1 )\n\t\t];\n\n\t\tthis._cubeDirections = [\n\t\t\tnew Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),\n\t\t\tnew Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )\n\t\t];\n\n\t\tthis._cubeUps = [\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ),\tnew Vector3( 0, 0, - 1 )\n\t\t];\n\n\t}\n\n\tupdateMatrices( light, viewportIndex = 0 ) {\n\n\t\tconst camera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( far !== camera.far ) {\n\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tcamera.position.copy( _lightPositionWorld );\n\n\t\t_lookTarget.copy( camera.position );\n\t\t_lookTarget.add( this._cubeDirections[ viewportIndex ] );\n\t\tcamera.up.copy( this._cubeUps[ viewportIndex ] );\n\t\tcamera.lookAt( _lookTarget );\n\t\tcamera.updateMatrixWorld();\n\n\t\tshadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );\n\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t}\n\n}\n\nclass PointLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, decay = 2 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isPointLight = true;\n\n\t\tthis.type = 'PointLight';\n\n\t\tthis.distance = distance;\n\t\tthis.decay = decay;\n\n\t\tthis.shadow = new PointLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// for an isotropic light source, luminous power (lm) = 4 \u03C0 luminous intensity (cd)\n\t\treturn this.intensity * 4 * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( 4 * Math.PI );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.distance = source.distance;\n\t\tthis.decay = source.decay;\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass DirectionalLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );\n\n\t\tthis.isDirectionalLightShadow = true;\n\n\t}\n\n}\n\nclass DirectionalLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isDirectionalLight = true;\n\n\t\tthis.type = 'DirectionalLight';\n\n\t\tthis.position.copy( Object3D.DEFAULT_UP );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.shadow = new DirectionalLightShadow();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.target = source.target.clone();\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass AmbientLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isAmbientLight = true;\n\n\t\tthis.type = 'AmbientLight';\n\n\t}\n\n}\n\nclass RectAreaLight extends Light {\n\n\tconstructor( color, intensity, width = 10, height = 10 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.isRectAreaLight = true;\n\n\t\tthis.type = 'RectAreaLight';\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in nits)\n\t\treturn this.intensity * this.width * this.height * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in nits) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( this.width * this.height * Math.PI );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.width = this.width;\n\t\tdata.object.height = this.height;\n\n\t\treturn data;\n\n\t}\n\n}\n\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */\n\n// 3-band SH defined by 9 coefficients\n\nclass SphericalHarmonics3 {\n\n\tconstructor() {\n\n\t\tthis.isSphericalHarmonics3 = true;\n\n\t\tthis.coefficients = [];\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients.push( new Vector3() );\n\n\t\t}\n\n\t}\n\n\tset( coefficients ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tzero() {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// get the radiance in the direction of the normal\n\t// target is a Vector3\n\tgetAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 0.488603 * y );\n\t\ttarget.addScaledVector( coeff[ 2 ], 0.488603 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 0.488603 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );\n\t\ttarget.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\n\t\ttarget.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\n\n\t\treturn target;\n\n\t}\n\n\t// get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n\t// target is a Vector3\n\t// https://graphics.stanford.edu/papers/envmap/envmap.pdf\n\tgetIrradianceAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // \u03C0 * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * \u03C0 / 3 ) * 0.488603\n\t\ttarget.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( \u03C0 / 4 ) * 1.092548\n\t\ttarget.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( \u03C0 / 4 ) * 0.315392 * 3\n\t\ttarget.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( \u03C0 / 4 ) * 0.546274\n\n\t\treturn target;\n\n\t}\n\n\tadd( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\taddScaledSH( sh, s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tscale( s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tlerp( sh, alpha ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcopy( sh ) {\n\n\t\treturn this.set( sh.coefficients );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn array;\n\n\t}\n\n\t// evaluate the basis functions\n\t// shBasis is an Array[ 9 ]\n\tstatic getBasisAt( normal, shBasis ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\t// band 0\n\t\tshBasis[ 0 ] = 0.282095;\n\n\t\t// band 1\n\t\tshBasis[ 1 ] = 0.488603 * y;\n\t\tshBasis[ 2 ] = 0.488603 * z;\n\t\tshBasis[ 3 ] = 0.488603 * x;\n\n\t\t// band 2\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\n\n\t}\n\n}\n\nclass LightProbe extends Light {\n\n\tconstructor( sh = new SphericalHarmonics3(), intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.isLightProbe = true;\n\n\t\tthis.sh = sh;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.sh.copy( source.sh );\n\n\t\treturn this;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n\t\tthis.sh.fromArray( json.sh );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.sh = this.sh.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass MaterialLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\t\tthis.textures = {};\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst textures = this.textures;\n\n\t\tfunction getTexture( name ) {\n\n\t\t\tif ( textures[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\n\n\t\t\t}\n\n\t\t\treturn textures[ name ];\n\n\t\t}\n\n\t\tconst material = MaterialLoader.createMaterialFromType( json.type );\n\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\n\t\tif ( json.name !== undefined ) material.name = json.name;\n\t\tif ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\n\t\tif ( json.sheen !== undefined ) material.sheen = json.sheen;\n\t\tif ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );\n\t\tif ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;\n\t\tif ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );\n\t\tif ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );\n\t\tif ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;\n\t\tif ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\n\t\tif ( json.iridescence !== undefined ) material.iridescence = json.iridescence;\n\t\tif ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;\n\t\tif ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n\t\tif ( json.transmission !== undefined ) material.transmission = json.transmission;\n\t\tif ( json.thickness !== undefined ) material.thickness = json.thickness;\n\t\tif ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;\n\t\tif ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );\n\t\tif ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;\n\t\tif ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\n\t\tif ( json.side !== undefined ) material.side = json.side;\n\t\tif ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\n\t\tif ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;\n\t\tif ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\n\t\tif ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;\n\t\tif ( json.blendDst !== undefined ) material.blendDst = json.blendDst;\n\t\tif ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;\n\t\tif ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;\n\t\tif ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;\n\t\tif ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;\n\t\tif ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );\n\t\tif ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\n\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\n\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\n\n\t\tif ( json.linewidth !== undefined ) material.linewidth = json.linewidth;\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\n\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\n\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\n\n\t\tif ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;\n\t\tif ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;\n\t\tif ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;\n\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\n\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\n\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\n\n\t\tif ( json.vertexColors !== undefined ) {\n\n\t\t\tif ( typeof json.vertexColors === 'number' ) {\n\n\t\t\t\tmaterial.vertexColors = ( json.vertexColors > 0 ) ? true : false;\n\n\t\t\t} else {\n\n\t\t\t\tmaterial.vertexColors = json.vertexColors;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Shader Material\n\n\t\tif ( json.uniforms !== undefined ) {\n\n\t\t\tfor ( const name in json.uniforms ) {\n\n\t\t\t\tconst uniform = json.uniforms[ name ];\n\n\t\t\t\tmaterial.uniforms[ name ] = {};\n\n\t\t\t\tswitch ( uniform.type ) {\n\n\t\t\t\t\tcase 't':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v2':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\n\t\tif ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;\n\n\t\tif ( json.extensions !== undefined ) {\n\n\t\t\tfor ( const key in json.extensions ) {\n\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.lights !== undefined ) material.lights = json.lights;\n\t\tif ( json.clipping !== undefined ) material.clipping = json.clipping;\n\n\t\t// for PointsMaterial\n\n\t\tif ( json.size !== undefined ) material.size = json.size;\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\n\n\t\t// maps\n\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\n\n\t\tif ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );\n\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\n\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\n\t\tif ( json.normalScale !== undefined ) {\n\n\t\t\tlet normalScale = json.normalScale;\n\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\n\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\n\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\n\n\t\t\t}\n\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\n\n\t\t}\n\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\n\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\n\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\n\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\n\t\tif ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );\n\t\tif ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );\n\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\n\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\n\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\n\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\n\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\n\n\t\tif ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );\n\t\tif ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\n\n\t\tif ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );\n\t\tif ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );\n\n\t\tif ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );\n\t\tif ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );\n\n\t\tif ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );\n\n\t\tif ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );\n\t\tif ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );\n\n\t\treturn material;\n\n\t}\n\n\tsetTextures( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n\tstatic createMaterialFromType( type ) {\n\n\t\tconst materialLib = {\n\t\t\tShadowMaterial,\n\t\t\tSpriteMaterial,\n\t\t\tRawShaderMaterial,\n\t\t\tShaderMaterial,\n\t\t\tPointsMaterial,\n\t\t\tMeshPhysicalMaterial,\n\t\t\tMeshStandardMaterial,\n\t\t\tMeshPhongMaterial,\n\t\t\tMeshToonMaterial,\n\t\t\tMeshNormalMaterial,\n\t\t\tMeshLambertMaterial,\n\t\t\tMeshDepthMaterial,\n\t\t\tMeshDistanceMaterial,\n\t\t\tMeshBasicMaterial,\n\t\t\tMeshMatcapMaterial,\n\t\t\tLineDashedMaterial,\n\t\t\tLineBasicMaterial,\n\t\t\tMaterial\n\t\t};\n\n\t\treturn new materialLib[ type ]();\n\n\t}\n\n}\n\nclass LoaderUtils {\n\n\tstatic decodeText( array ) {\n\n\t\tif ( typeof TextDecoder !== 'undefined' ) {\n\n\t\t\treturn new TextDecoder().decode( array );\n\n\t\t}\n\n\t\t// Avoid the String.fromCharCode.apply(null, array) shortcut, which\n\t\t// throws a \"maximum call stack size exceeded\" error for large arrays.\n\n\t\tlet s = '';\n\n\t\tfor ( let i = 0, il = array.length; i < il; i ++ ) {\n\n\t\t\t// Implicitly assumes little-endian.\n\t\t\ts += String.fromCharCode( array[ i ] );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\t// merges multi-byte utf-8 characters.\n\n\t\t\treturn decodeURIComponent( escape( s ) );\n\n\t\t} catch ( e ) { // see #16358\n\n\t\t\treturn s;\n\n\t\t}\n\n\t}\n\n\tstatic extractUrlBase( url ) {\n\n\t\tconst index = url.lastIndexOf( '/' );\n\n\t\tif ( index === - 1 ) return './';\n\n\t\treturn url.slice( 0, index + 1 );\n\n\t}\n\n\tstatic resolveURL( url, path ) {\n\n\t\t// Invalid URL\n\t\tif ( typeof url !== 'string' || url === '' ) return '';\n\n\t\t// Host Relative URL\n\t\tif ( /^https?:\\/\\//i.test( path ) && /^\\//.test( url ) ) {\n\n\t\t\tpath = path.replace( /(^https?:\\/\\/[^\\/]+).*/i, '$1' );\n\n\t\t}\n\n\t\t// Absolute URL http://,https://,//\n\t\tif ( /^(https?:)?\\/\\//i.test( url ) ) return url;\n\n\t\t// Data URI\n\t\tif ( /^data:.*,.*$/i.test( url ) ) return url;\n\n\t\t// Blob URL\n\t\tif ( /^blob:.*$/i.test( url ) ) return url;\n\n\t\t// Relative URL\n\t\treturn path + url;\n\n\t}\n\n}\n\nclass InstancedBufferGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isInstancedBufferGeometry = true;\n\n\t\tthis.type = 'InstancedBufferGeometry';\n\t\tthis.instanceCount = Infinity;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.instanceCount = source.instanceCount;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.instanceCount = this.instanceCount;\n\n\t\tdata.isInstancedBufferGeometry = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass BufferGeometryLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst interleavedBufferMap = {};\n\t\tconst arrayBufferMap = {};\n\n\t\tfunction getInterleavedBuffer( json, uuid ) {\n\n\t\t\tif ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];\n\n\t\t\tconst interleavedBuffers = json.interleavedBuffers;\n\t\t\tconst interleavedBuffer = interleavedBuffers[ uuid ];\n\n\t\t\tconst buffer = getArrayBuffer( json, interleavedBuffer.buffer );\n\n\t\t\tconst array = getTypedArray( interleavedBuffer.type, buffer );\n\t\t\tconst ib = new InterleavedBuffer( array, interleavedBuffer.stride );\n\t\t\tib.uuid = interleavedBuffer.uuid;\n\n\t\t\tinterleavedBufferMap[ uuid ] = ib;\n\n\t\t\treturn ib;\n\n\t\t}\n\n\t\tfunction getArrayBuffer( json, uuid ) {\n\n\t\t\tif ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];\n\n\t\t\tconst arrayBuffers = json.arrayBuffers;\n\t\t\tconst arrayBuffer = arrayBuffers[ uuid ];\n\n\t\t\tconst ab = new Uint32Array( arrayBuffer ).buffer;\n\n\t\t\tarrayBufferMap[ uuid ] = ab;\n\n\t\t\treturn ab;\n\n\t\t}\n\n\t\tconst geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n\n\t\tconst index = json.data.index;\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst typedArray = getTypedArray( index.type, index.array );\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\n\n\t\t}\n\n\t\tconst attributes = json.data.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\t\t\tlet bufferAttribute;\n\n\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t} else {\n\n\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\tconst bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n\t\t\t\tbufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t}\n\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\tif ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );\n\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\n\n\t\t}\n\n\t\tconst morphAttributes = json.data.morphAttributes;\n\n\t\tif ( morphAttributes ) {\n\n\t\t\tfor ( const key in morphAttributes ) {\n\n\t\t\t\tconst attributeArray = morphAttributes[ key ];\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attribute = attributeArray[ i ];\n\t\t\t\t\tlet bufferAttribute;\n\n\t\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\t\t\tbufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\t\t\tarray.push( bufferAttribute );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst morphTargetsRelative = json.data.morphTargetsRelative;\n\n\t\tif ( morphTargetsRelative ) {\n\n\t\t\tgeometry.morphTargetsRelative = true;\n\n\t\t}\n\n\t\tconst groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n\n\t\tif ( groups !== undefined ) {\n\n\t\t\tfor ( let i = 0, n = groups.length; i !== n; ++ i ) {\n\n\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst boundingSphere = json.data.boundingSphere;\n\n\t\tif ( boundingSphere !== undefined ) {\n\n\t\t\tconst center = new Vector3();\n\n\t\t\tif ( boundingSphere.center !== undefined ) {\n\n\t\t\t\tcenter.fromArray( boundingSphere.center );\n\n\t\t\t}\n\n\t\t\tgeometry.boundingSphere = new Sphere( center, boundingSphere.radius );\n\n\t\t}\n\n\t\tif ( json.name ) geometry.name = json.name;\n\t\tif ( json.userData ) geometry.userData = json.userData;\n\n\t\treturn geometry;\n\n\t}\n\n}\n\nclass ObjectLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tlet json = null;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( error );\n\n\t\t\t\tconsole.error( 'THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst metadata = json.metadata;\n\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( new Error( 'THREE.ObjectLoader: Can\\'t load ' + url ) );\n\n\t\t\t\tconsole.error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tscope.parse( json, onLoad );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tasync loadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tconst text = await loader.loadAsync( url, onProgress );\n\n\t\tconst json = JSON.parse( text );\n\n\t\tconst metadata = json.metadata;\n\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\n\t\t}\n\n\t\treturn await scope.parseAsync( json );\n\n\t}\n\n\tparse( json, onLoad ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = this.parseImages( json.images, function () {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t} );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\t//\n\n\t\tif ( onLoad !== undefined ) {\n\n\t\t\tlet hasImages = false;\n\n\t\t\tfor ( const uuid in images ) {\n\n\t\t\t\tif ( images[ uuid ].data instanceof HTMLImageElement ) {\n\n\t\t\t\t\thasImages = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hasImages === false ) onLoad( object );\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tasync parseAsync( json ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = await this.parseImagesAsync( json.images );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\treturn object;\n\n\t}\n\n\tparseShapes( json ) {\n\n\t\tconst shapes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst shape = new Shape().fromJSON( json[ i ] );\n\n\t\t\t\tshapes[ shape.uuid ] = shape;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n\tparseSkeletons( json, object ) {\n\n\t\tconst skeletons = {};\n\t\tconst bones = {};\n\n\t\t// generate bone lookup table\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isBone ) bones[ child.uuid ] = child;\n\n\t\t} );\n\n\t\t// create skeletons\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst skeleton = new Skeleton().fromJSON( json[ i ], bones );\n\n\t\t\t\tskeletons[ skeleton.uuid ] = skeleton;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn skeletons;\n\n\t}\n\n\tparseGeometries( json, shapes ) {\n\n\t\tconst geometries = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst bufferGeometryLoader = new BufferGeometryLoader();\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tlet geometry;\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tswitch ( data.type ) {\n\n\t\t\t\t\tcase 'BufferGeometry':\n\t\t\t\t\tcase 'InstancedBufferGeometry':\n\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( data.type in Geometries ) {\n\n\t\t\t\t\t\t\tgeometry = Geometries[ data.type ].fromJSON( data, shapes );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tconsole.warn( `THREE.ObjectLoader: Unsupported geometry type \"${ data.type }\"` );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\n\t\t\t\tif ( data.userData !== undefined ) geometry.userData = data.userData;\n\n\t\t\t\tgeometries[ data.uuid ] = geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn geometries;\n\n\t}\n\n\tparseMaterials( json, textures ) {\n\n\t\tconst cache = {}; // MultiMaterial\n\t\tconst materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst loader = new MaterialLoader();\n\t\t\tloader.setTextures( textures );\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\n\n\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\n\n\t\t\t\t}\n\n\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t}\n\n\tparseAnimations( json ) {\n\n\t\tconst animations = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tconst clip = AnimationClip.parse( data );\n\n\t\t\t\tanimations[ clip.uuid ] = clip;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n\tparseImages( json, onLoad ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tfunction loadImage( url ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\treturn loader.load( url, function () {\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, undefined, function () {\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tfunction deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn loadImage( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tconst manager = new LoadingManager( onLoad );\n\n\t\t\tloader = new ImageLoader( manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tasync parseImagesAsync( json ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tasync function deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn await loader.loadAsync( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tloader = new ImageLoader( this.manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\tconst imageArray = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = await deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timageArray.push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timageArray.push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\timages[ image.uuid ] = new Source( imageArray );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = await deserializeImage( image.url );\n\t\t\t\t\timages[ image.uuid ] = new Source( deserializedImage );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tparseTextures( json, images ) {\n\n\t\tfunction parseConstant( value, type ) {\n\n\t\t\tif ( typeof value === 'number' ) return value;\n\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\n\n\t\t\treturn type[ value ];\n\n\t\t}\n\n\t\tconst textures = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( data.image === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( images[ data.image ] === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\n\n\t\t\t\t}\n\n\t\t\t\tconst source = images[ data.image ];\n\t\t\t\tconst image = source.data;\n\n\t\t\t\tlet texture;\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\ttexture = new CubeTexture();\n\n\t\t\t\t\tif ( image.length === 6 ) texture.needsUpdate = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( image && image.data ) {\n\n\t\t\t\t\t\ttexture = new DataTexture();\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttexture = new Texture();\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( image ) texture.needsUpdate = true; // textures can have undefined image data\n\n\t\t\t\t}\n\n\t\t\t\ttexture.source = source;\n\n\t\t\t\ttexture.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\n\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\n\t\t\t\tif ( data.channel !== undefined ) texture.channel = data.channel;\n\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\n\n\t\t\t\tif ( data.wrap !== undefined ) {\n\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\n\t\t\t\tif ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\n\t\t\t\tif ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;\n\t\t\t\tif ( data.encoding !== undefined ) texture.encoding = data.encoding; // @deprecated, r152\n\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\n\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\n\n\t\t\t\tif ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\n\t\t\t\tif ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;\n\n\t\t\t\tif ( data.userData !== undefined ) texture.userData = data.userData;\n\n\t\t\t\ttextures[ data.uuid ] = texture;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn textures;\n\n\t}\n\n\tparseObject( data, geometries, materials, textures, animations ) {\n\n\t\tlet object;\n\n\t\tfunction getGeometry( name ) {\n\n\t\t\tif ( geometries[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\n\n\t\t\t}\n\n\t\t\treturn geometries[ name ];\n\n\t\t}\n\n\t\tfunction getMaterial( name ) {\n\n\t\t\tif ( name === undefined ) return undefined;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, l = name.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst uuid = name[ i ];\n\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', uuid );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tarray.push( materials[ uuid ] );\n\n\t\t\t\t}\n\n\t\t\t\treturn array;\n\n\t\t\t}\n\n\t\t\tif ( materials[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\n\n\t\t\t}\n\n\t\t\treturn materials[ name ];\n\n\t\t}\n\n\t\tfunction getTexture( uuid ) {\n\n\t\t\tif ( textures[ uuid ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined texture', uuid );\n\n\t\t\t}\n\n\t\t\treturn textures[ uuid ];\n\n\t\t}\n\n\t\tlet geometry, material;\n\n\t\tswitch ( data.type ) {\n\n\t\t\tcase 'Scene':\n\n\t\t\t\tobject = new Scene();\n\n\t\t\t\tif ( data.background !== undefined ) {\n\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\n\n\t\t\t\t\t\tobject.background = new Color( data.background );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tobject.background = getTexture( data.background );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.environment !== undefined ) {\n\n\t\t\t\t\tobject.environment = getTexture( data.environment );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.fog !== undefined ) {\n\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\n\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\n\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\n\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( data.fog.name !== '' ) {\n\n\t\t\t\t\t\tobject.fog.name = data.fog.name;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;\n\t\t\t\tif ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PerspectiveCamera':\n\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\n\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'OrthographicCamera':\n\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\n\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'AmbientLight':\n\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'DirectionalLight':\n\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointLight':\n\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'RectAreaLight':\n\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SpotLight':\n\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'HemisphereLight':\n\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LightProbe':\n\n\t\t\t\tobject = new LightProbe().fromJSON( data );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SkinnedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t \tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new SkinnedMesh( geometry, material );\n\n\t\t\t\tif ( data.bindMode !== undefined ) object.bindMode = data.bindMode;\n\t\t\t\tif ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );\n\t\t\t\tif ( data.skeleton !== undefined ) object.skeleton = data.skeleton;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Mesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new Mesh( geometry, material );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'InstancedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\t\t\t\tconst count = data.count;\n\t\t\t\tconst instanceMatrix = data.instanceMatrix;\n\t\t\t\tconst instanceColor = data.instanceColor;\n\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\n\t\t\t\tobject.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\n\t\t\t\tif ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'BatchedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new BatchedMesh( data.maxGeometryCount, data.maxVertexCount, data.maxIndexCount, material );\n\t\t\t\tobject.geometry = geometry;\n\t\t\t\tobject.perObjectFrustumCulled = data.perObjectFrustumCulled;\n\t\t\t\tobject.sortObjects = data.sortObjects;\n\n\t\t\t\tobject._drawRanges = data.drawRanges;\n\t\t\t\tobject._reservedRanges = data.reservedRanges;\n\n\t\t\t\tobject._visibility = data.visibility;\n\t\t\t\tobject._active = data.active;\n\t\t\t\tobject._bounds = data.bounds.map( bound => {\n\n\t\t\t\t\tconst box = new Box3();\n\t\t\t\t\tbox.min.fromArray( bound.boxMin );\n\t\t\t\t\tbox.max.fromArray( bound.boxMax );\n\n\t\t\t\t\tconst sphere = new Sphere();\n\t\t\t\t\tsphere.radius = bound.sphereRadius;\n\t\t\t\t\tsphere.center.fromArray( bound.sphereCenter );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tboxInitialized: bound.boxInitialized,\n\t\t\t\t\t\tbox: box,\n\n\t\t\t\t\t\tsphereInitialized: bound.sphereInitialized,\n\t\t\t\t\t\tsphere: sphere\n\t\t\t\t\t};\n\n\t\t\t\t} );\n\n\t\t\t\tobject._maxGeometryCount = data.maxGeometryCount;\n\t\t\t\tobject._maxVertexCount = data.maxVertexCount;\n\t\t\t\tobject._maxIndexCount = data.maxIndexCount;\n\n\t\t\t\tobject._geometryInitialized = data.geometryInitialized;\n\t\t\t\tobject._geometryCount = data.geometryCount;\n\n\t\t\t\tobject._matricesTexture = getTexture( data.matricesTexture.uuid );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LOD':\n\n\t\t\t\tobject = new LOD();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Line':\n\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineLoop':\n\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineSegments':\n\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointCloud':\n\t\t\tcase 'Points':\n\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Sprite':\n\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Group':\n\n\t\t\t\tobject = new Group();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Bone':\n\n\t\t\t\tobject = new Bone();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tobject = new Object3D();\n\n\t\t}\n\n\t\tobject.uuid = data.uuid;\n\n\t\tif ( data.name !== undefined ) object.name = data.name;\n\n\t\tif ( data.matrix !== undefined ) {\n\n\t\t\tobject.matrix.fromArray( data.matrix );\n\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\n\n\t\t} else {\n\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\n\n\t\t}\n\n\t\tif ( data.up !== undefined ) object.up.fromArray( data.up );\n\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\n\n\t\tif ( data.shadow ) {\n\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\n\t\t\tif ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\n\n\t\t}\n\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\n\n\t\tif ( data.children !== undefined ) {\n\n\t\t\tconst children = data.children;\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.animations !== undefined ) {\n\n\t\t\tconst objectAnimations = data.animations;\n\n\t\t\tfor ( let i = 0; i < objectAnimations.length; i ++ ) {\n\n\t\t\t\tconst uuid = objectAnimations[ i ];\n\n\t\t\t\tobject.animations.push( animations[ uuid ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.type === 'LOD' ) {\n\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\n\n\t\t\tconst levels = data.levels;\n\n\t\t\tfor ( let l = 0; l < levels.length; l ++ ) {\n\n\t\t\t\tconst level = levels[ l ];\n\t\t\t\tconst child = object.getObjectByProperty( 'uuid', level.object );\n\n\t\t\t\tif ( child !== undefined ) {\n\n\t\t\t\t\tobject.addLevel( child, level.distance, level.hysteresis );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tbindSkeletons( object, skeletons ) {\n\n\t\tif ( Object.keys( skeletons ).length === 0 ) return;\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {\n\n\t\t\t\tconst skeleton = skeletons[ child.skeleton ];\n\n\t\t\t\tif ( skeleton === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.bind( skeleton, child.bindMatrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n}\n\nconst TEXTURE_MAPPING = {\n\tUVMapping: UVMapping,\n\tCubeReflectionMapping: CubeReflectionMapping,\n\tCubeRefractionMapping: CubeRefractionMapping,\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\n\tCubeUVReflectionMapping: CubeUVReflectionMapping\n};\n\nconst TEXTURE_WRAPPING = {\n\tRepeatWrapping: RepeatWrapping,\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\n};\n\nconst TEXTURE_FILTER = {\n\tNearestFilter: NearestFilter,\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\n\tLinearFilter: LinearFilter,\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\n\nclass ImageBitmapLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.isImageBitmapLoader = true;\n\n\t\tif ( typeof createImageBitmap === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );\n\n\t\t}\n\n\t\tif ( typeof fetch === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );\n\n\t\t}\n\n\t\tthis.options = { premultiplyAlpha: 'none' };\n\n\t}\n\n\tsetOptions( options ) {\n\n\t\tthis.options = options;\n\n\t\treturn this;\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\t// If cached is a promise, wait for it to resolve\n\t\t\tif ( cached.then ) {\n\n\t\t\t\tcached.then( imageBitmap => {\n\n\t\t\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t\t} ).catch( e => {\n\n\t\t\t\t\tif ( onError ) onError( e );\n\n\t\t\t\t} );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\t// If cached is not a promise (i.e., it's already an imageBitmap)\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst fetchOptions = {};\n\t\tfetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';\n\t\tfetchOptions.headers = this.requestHeader;\n\n\t\tconst promise = fetch( url, fetchOptions ).then( function ( res ) {\n\n\t\t\treturn res.blob();\n\n\t\t} ).then( function ( blob ) {\n\n\t\t\treturn createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );\n\n\t\t} ).then( function ( imageBitmap ) {\n\n\t\t\tCache.add( url, imageBitmap );\n\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t\treturn imageBitmap;\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tCache.remove( url );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tCache.add( url, promise );\n\t\tscope.manager.itemStart( url );\n\n\t}\n\n}\n\nlet _context;\n\nclass AudioContext {\n\n\tstatic getContext() {\n\n\t\tif ( _context === undefined ) {\n\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\n\n\t\t}\n\n\t\treturn _context;\n\n\t}\n\n\tstatic setContext( value ) {\n\n\t\t_context = value;\n\n\t}\n\n}\n\nclass AudioLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\ttry {\n\n\t\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\n\t\t\t\t// detaches the buffer when complete, preventing reuse.\n\t\t\t\tconst bufferCopy = buffer.slice( 0 );\n\n\t\t\t\tconst context = AudioContext.getContext();\n\t\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\n\n\t\t\t\t\tonLoad( audioBuffer );\n\n\t\t\t\t} ).catch( handleError );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\thandleError( e );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\tfunction handleError( e ) {\n\n\t\t\tif ( onError ) {\n\n\t\t\t\tonError( e );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.error( e );\n\n\t\t\t}\n\n\t\t\tscope.manager.itemError( url );\n\n\t\t}\n\n\t}\n\n}\n\nconst _eyeRight = /*@__PURE__*/ new Matrix4();\nconst _eyeLeft = /*@__PURE__*/ new Matrix4();\nconst _projectionMatrix = /*@__PURE__*/ new Matrix4();\n\nclass StereoCamera {\n\n\tconstructor() {\n\n\t\tthis.type = 'StereoCamera';\n\n\t\tthis.aspect = 1;\n\n\t\tthis.eyeSep = 0.064;\n\n\t\tthis.cameraL = new PerspectiveCamera();\n\t\tthis.cameraL.layers.enable( 1 );\n\t\tthis.cameraL.matrixAutoUpdate = false;\n\n\t\tthis.cameraR = new PerspectiveCamera();\n\t\tthis.cameraR.layers.enable( 2 );\n\t\tthis.cameraR.matrixAutoUpdate = false;\n\n\t\tthis._cache = {\n\t\t\tfocus: null,\n\t\t\tfov: null,\n\t\t\taspect: null,\n\t\t\tnear: null,\n\t\t\tfar: null,\n\t\t\tzoom: null,\n\t\t\teyeSep: null\n\t\t};\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst cache = this._cache;\n\n\t\tconst needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tcache.focus = camera.focus;\n\t\t\tcache.fov = camera.fov;\n\t\t\tcache.aspect = camera.aspect * this.aspect;\n\t\t\tcache.near = camera.near;\n\t\t\tcache.far = camera.far;\n\t\t\tcache.zoom = camera.zoom;\n\t\t\tcache.eyeSep = this.eyeSep;\n\n\t\t\t// Off-axis stereoscopic effect based on\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\n\n\t\t\t_projectionMatrix.copy( camera.projectionMatrix );\n\t\t\tconst eyeSepHalf = cache.eyeSep / 2;\n\t\t\tconst eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n\t\t\tconst ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\n\t\t\tlet xmin, xmax;\n\n\t\t\t// translate xOffset\n\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\n\n\t\t\t// for left eye\n\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraL.projectionMatrix.copy( _projectionMatrix );\n\n\t\t\t// for right eye\n\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\n\n\t\t\t_projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\t_projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraR.projectionMatrix.copy( _projectionMatrix );\n\n\t\t}\n\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\n\n\t}\n\n}\n\nclass Clock {\n\n\tconstructor( autoStart = true ) {\n\n\t\tthis.autoStart = autoStart;\n\n\t\tthis.startTime = 0;\n\t\tthis.oldTime = 0;\n\t\tthis.elapsedTime = 0;\n\n\t\tthis.running = false;\n\n\t}\n\n\tstart() {\n\n\t\tthis.startTime = now();\n\n\t\tthis.oldTime = this.startTime;\n\t\tthis.elapsedTime = 0;\n\t\tthis.running = true;\n\n\t}\n\n\tstop() {\n\n\t\tthis.getElapsedTime();\n\t\tthis.running = false;\n\t\tthis.autoStart = false;\n\n\t}\n\n\tgetElapsedTime() {\n\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\n\t}\n\n\tgetDelta() {\n\n\t\tlet diff = 0;\n\n\t\tif ( this.autoStart && ! this.running ) {\n\n\t\t\tthis.start();\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif ( this.running ) {\n\n\t\t\tconst newTime = now();\n\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\n\t\t\tthis.oldTime = newTime;\n\n\t\t\tthis.elapsedTime += diff;\n\n\t\t}\n\n\t\treturn diff;\n\n\t}\n\n}\n\nfunction now() {\n\n\treturn ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732\n\n}\n\nconst _position$1 = /*@__PURE__*/ new Vector3();\nconst _quaternion$1 = /*@__PURE__*/ new Quaternion();\nconst _scale$1 = /*@__PURE__*/ new Vector3();\nconst _orientation$1 = /*@__PURE__*/ new Vector3();\n\nclass AudioListener extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'AudioListener';\n\n\t\tthis.context = AudioContext.getContext();\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( this.context.destination );\n\n\t\tthis.filter = null;\n\n\t\tthis.timeDelta = 0;\n\n\t\t// private\n\n\t\tthis._clock = new Clock();\n\n\t}\n\n\tgetInput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tremoveFilter() {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\t\t\tthis.gain.connect( this.context.destination );\n\t\t\tthis.filter = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.filter;\n\n\t}\n\n\tsetFilter( value ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\n\t\t} else {\n\n\t\t\tthis.gain.disconnect( this.context.destination );\n\n\t\t}\n\n\t\tthis.filter = value;\n\t\tthis.gain.connect( this.filter );\n\t\tthis.filter.connect( this.context.destination );\n\n\t\treturn this;\n\n\t}\n\n\tgetMasterVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetMasterVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tconst listener = this.context.listener;\n\t\tconst up = this.up;\n\n\t\tthis.timeDelta = this._clock.getDelta();\n\n\t\tthis.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );\n\n\t\t_orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );\n\n\t\tif ( listener.positionX ) {\n\n\t\t\t// code path for Chrome (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.timeDelta;\n\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$1.x, endTime );\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$1.y, endTime );\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime );\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime );\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime );\n\t\t\tlistener.upX.linearRampToValueAtTime( up.x, endTime );\n\t\t\tlistener.upY.linearRampToValueAtTime( up.y, endTime );\n\t\t\tlistener.upZ.linearRampToValueAtTime( up.z, endTime );\n\n\t\t} else {\n\n\t\t\tlistener.setPosition( _position$1.x, _position$1.y, _position$1.z );\n\t\t\tlistener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass Audio extends Object3D {\n\n\tconstructor( listener ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Audio';\n\n\t\tthis.listener = listener;\n\t\tthis.context = listener.context;\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.getInput() );\n\n\t\tthis.autoplay = false;\n\n\t\tthis.buffer = null;\n\t\tthis.detune = 0;\n\t\tthis.loop = false;\n\t\tthis.loopStart = 0;\n\t\tthis.loopEnd = 0;\n\t\tthis.offset = 0;\n\t\tthis.duration = undefined;\n\t\tthis.playbackRate = 1;\n\t\tthis.isPlaying = false;\n\t\tthis.hasPlaybackControl = true;\n\t\tthis.source = null;\n\t\tthis.sourceType = 'empty';\n\n\t\tthis._startedAt = 0;\n\t\tthis._progress = 0;\n\t\tthis._connected = false;\n\n\t\tthis.filters = [];\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tsetNodeSource( audioNode ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'audioNode';\n\t\tthis.source = audioNode;\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaElementSource( mediaElement ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaNode';\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaStreamSource( mediaStream ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaStreamNode';\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetBuffer( audioBuffer ) {\n\n\t\tthis.buffer = audioBuffer;\n\t\tthis.sourceType = 'buffer';\n\n\t\tif ( this.autoplay ) this.play();\n\n\t\treturn this;\n\n\t}\n\n\tplay( delay = 0 ) {\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._startedAt = this.context.currentTime + delay;\n\n\t\tconst source = this.context.createBufferSource();\n\t\tsource.buffer = this.buffer;\n\t\tsource.loop = this.loop;\n\t\tsource.loopStart = this.loopStart;\n\t\tsource.loopEnd = this.loopEnd;\n\t\tsource.onended = this.onEnded.bind( this );\n\t\tsource.start( this._startedAt, this._progress + this.offset, this.duration );\n\n\t\tthis.isPlaying = true;\n\n\t\tthis.source = source;\n\n\t\tthis.setDetune( this.detune );\n\t\tthis.setPlaybackRate( this.playbackRate );\n\n\t\treturn this.connect();\n\n\t}\n\n\tpause() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\t// update current progress\n\n\t\t\tthis._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;\n\n\t\t\tif ( this.loop === true ) {\n\n\t\t\t\t// ensure _progress does not exceed duration with looped audios\n\n\t\t\t\tthis._progress = this._progress % ( this.duration || this.buffer.duration );\n\n\t\t\t}\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t\tthis.isPlaying = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._progress = 0;\n\n\t\tif ( this.source !== null ) {\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t}\n\n\t\tthis.isPlaying = false;\n\n\t\treturn this;\n\n\t}\n\n\tconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.connect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.connect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = true;\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect() {\n\n\t\tif ( this._connected === false ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.disconnect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = false;\n\n\t\treturn this;\n\n\t}\n\n\tgetFilters() {\n\n\t\treturn this.filters;\n\n\t}\n\n\tsetFilters( value ) {\n\n\t\tif ( ! value ) value = [];\n\n\t\tif ( this._connected === true ) {\n\n\t\t\tthis.disconnect();\n\t\t\tthis.filters = value.slice();\n\t\t\tthis.connect();\n\n\t\t} else {\n\n\t\t\tthis.filters = value.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetDetune( value ) {\n\n\t\tthis.detune = value;\n\n\t\tif ( this.source.detune === undefined ) return; // only set detune when available\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetDetune() {\n\n\t\treturn this.detune;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.getFilters()[ 0 ];\n\n\t}\n\n\tsetFilter( filter ) {\n\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\n\n\t}\n\n\tsetPlaybackRate( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.playbackRate = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetPlaybackRate() {\n\n\t\treturn this.playbackRate;\n\n\t}\n\n\tonEnded() {\n\n\t\tthis.isPlaying = false;\n\n\t}\n\n\tgetLoop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn this.loop;\n\n\t}\n\n\tsetLoop( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.loop = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.loop = this.loop;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopStart( value ) {\n\n\t\tthis.loopStart = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopEnd( value ) {\n\n\t\tthis.loopEnd = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _position = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\nconst _scale = /*@__PURE__*/ new Vector3();\nconst _orientation = /*@__PURE__*/ new Vector3();\n\nclass PositionalAudio extends Audio {\n\n\tconstructor( listener ) {\n\n\t\tsuper( listener );\n\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.panningModel = 'HRTF';\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tconnect() {\n\n\t\tsuper.connect();\n\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tdisconnect() {\n\n\t\tsuper.disconnect();\n\n\t\tthis.panner.disconnect( this.gain );\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.panner;\n\n\t}\n\n\tgetRefDistance() {\n\n\t\treturn this.panner.refDistance;\n\n\t}\n\n\tsetRefDistance( value ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetRolloffFactor() {\n\n\t\treturn this.panner.rolloffFactor;\n\n\t}\n\n\tsetRolloffFactor( value ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetDistanceModel() {\n\n\t\treturn this.panner.distanceModel;\n\n\t}\n\n\tsetDistanceModel( value ) {\n\n\t\tthis.panner.distanceModel = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxDistance() {\n\n\t\treturn this.panner.maxDistance;\n\n\t}\n\n\tsetMaxDistance( value ) {\n\n\t\tthis.panner.maxDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\n\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\n\t\tthis.panner.coneOuterGain = coneOuterGain;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion, _scale );\n\n\t\t_orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );\n\n\t\tconst panner = this.panner;\n\n\t\tif ( panner.positionX ) {\n\n\t\t\t// code path for Chrome and Firefox (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.listener.timeDelta;\n\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position.x, endTime );\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position.y, endTime );\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position.z, endTime );\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );\n\n\t\t} else {\n\n\t\t\tpanner.setPosition( _position.x, _position.y, _position.z );\n\t\t\tpanner.setOrientation( _orientation.x, _orientation.y, _orientation.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass AudioAnalyser {\n\n\tconstructor( audio, fftSize = 2048 ) {\n\n\t\tthis.analyser = audio.context.createAnalyser();\n\t\tthis.analyser.fftSize = fftSize;\n\n\t\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\n\n\t\taudio.getOutput().connect( this.analyser );\n\n\t}\n\n\n\tgetFrequencyData() {\n\n\t\tthis.analyser.getByteFrequencyData( this.data );\n\n\t\treturn this.data;\n\n\t}\n\n\tgetAverageFrequency() {\n\n\t\tlet value = 0;\n\t\tconst data = this.getFrequencyData();\n\n\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\tvalue += data[ i ];\n\n\t\t}\n\n\t\treturn value / data.length;\n\n\t}\n\n}\n\nclass PropertyMixer {\n\n\tconstructor( binding, typeName, valueSize ) {\n\n\t\tthis.binding = binding;\n\t\tthis.valueSize = valueSize;\n\n\t\tlet mixFunction,\n\t\t\tmixFunctionAdditive,\n\t\t\tsetIdentity;\n\n\t\t// buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n\t\t//\n\t\t// interpolators can use .buffer as their .result\n\t\t// the data then goes to 'incoming'\n\t\t//\n\t\t// 'accu0' and 'accu1' are used frame-interleaved for\n\t\t// the cumulative result and are compared to detect\n\t\t// changes\n\t\t//\n\t\t// 'orig' stores the original state of the property\n\t\t//\n\t\t// 'add' is used for additive cumulative results\n\t\t//\n\t\t// 'work' is optional and is only present for quaternion types. It is used\n\t\t// to store intermediate quaternion multiplication results\n\n\t\tswitch ( typeName ) {\n\n\t\t\tcase 'quaternion':\n\t\t\t\tmixFunction = this._slerp;\n\t\t\t\tmixFunctionAdditive = this._slerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityQuaternion;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 6 );\n\t\t\t\tthis._workIndex = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 'string':\n\t\t\tcase 'bool':\n\t\t\t\tmixFunction = this._select;\n\n\t\t\t\t// Use the regular mix function and for additive on these types,\n\t\t\t\t// additive is not relevant for non-numeric types\n\t\t\t\tmixFunctionAdditive = this._select;\n\n\t\t\t\tsetIdentity = this._setAdditiveIdentityOther;\n\n\t\t\t\tthis.buffer = new Array( valueSize * 5 );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmixFunction = this._lerp;\n\t\t\t\tmixFunctionAdditive = this._lerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityNumeric;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 5 );\n\n\t\t}\n\n\t\tthis._mixBufferRegion = mixFunction;\n\t\tthis._mixBufferRegionAdditive = mixFunctionAdditive;\n\t\tthis._setIdentity = setIdentity;\n\t\tthis._origIndex = 3;\n\t\tthis._addIndex = 4;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tthis.useCount = 0;\n\t\tthis.referenceCount = 0;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'accu'\n\taccumulate( accuIndex, weight ) {\n\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t// the weight and shouldn't have made the call in the first place\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = accuIndex * stride + stride;\n\n\t\tlet currentWeight = this.cumulativeWeight;\n\n\t\tif ( currentWeight === 0 ) {\n\n\t\t\t// accuN := incoming * weight\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\n\n\t\t\t}\n\n\t\t\tcurrentWeight = weight;\n\n\t\t} else {\n\n\t\t\t// accuN := accuN + incoming * weight\n\n\t\t\tcurrentWeight += weight;\n\t\t\tconst mix = weight / currentWeight;\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\n\n\t\t}\n\n\t\tthis.cumulativeWeight = currentWeight;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'add'\n\taccumulateAdditive( weight ) {\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = stride * this._addIndex;\n\n\t\tif ( this.cumulativeWeightAdditive === 0 ) {\n\n\t\t\t// add = identity\n\n\t\t\tthis._setIdentity();\n\n\t\t}\n\n\t\t// add := add + incoming * weight\n\n\t\tthis._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );\n\t\tthis.cumulativeWeightAdditive += weight;\n\n\t}\n\n\t// apply the state of 'accu' to the binding when accus differ\n\tapply( accuIndex ) {\n\n\t\tconst stride = this.valueSize,\n\t\t\tbuffer = this.buffer,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tweight = this.cumulativeWeight,\n\t\t\tweightAdditive = this.cumulativeWeightAdditive,\n\n\t\t\tbinding = this.binding;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tif ( weight < 1 ) {\n\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\n\t\t\tconst originalValueOffset = stride * this._origIndex;\n\n\t\t\tthis._mixBufferRegion(\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\n\n\t\t}\n\n\t\tif ( weightAdditive > 0 ) {\n\n\t\t\t// accuN := accuN + additive accuN\n\n\t\t\tthis._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );\n\n\t\t}\n\n\t\tfor ( let i = stride, e = stride + stride; i !== e; ++ i ) {\n\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\n\n\t\t\t\t// value has changed -> update scene graph\n\n\t\t\t\tbinding.setValue( buffer, offset );\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remember the state of the bound property and copy it to both accus\n\tsaveOriginalState() {\n\n\t\tconst binding = this.binding;\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\n\t\t\toriginalValueOffset = stride * this._origIndex;\n\n\t\tbinding.getValue( buffer, originalValueOffset );\n\n\t\t// accu[0..1] := orig -- initially detect changes against the original\n\t\tfor ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {\n\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\n\n\t\t}\n\n\t\t// Add to identity for additive\n\t\tthis._setIdentity();\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t}\n\n\t// apply the state previously taken via 'saveOriginalState' to the binding\n\trestoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}\n\n\t_setAdditiveIdentityNumeric() {\n\n\t\tconst startIndex = this._addIndex * this.valueSize;\n\t\tconst endIndex = startIndex + this.valueSize;\n\n\t\tfor ( let i = startIndex; i < endIndex; i ++ ) {\n\n\t\t\tthis.buffer[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\t_setAdditiveIdentityQuaternion() {\n\n\t\tthis._setAdditiveIdentityNumeric();\n\t\tthis.buffer[ this._addIndex * this.valueSize + 3 ] = 1;\n\n\t}\n\n\t_setAdditiveIdentityOther() {\n\n\t\tconst startIndex = this._origIndex * this.valueSize;\n\t\tconst targetIndex = this._addIndex * this.valueSize;\n\n\t\tfor ( let i = 0; i < this.valueSize; i ++ ) {\n\n\t\t\tthis.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];\n\n\t\t}\n\n\t}\n\n\n\t// mix functions\n\n\t_select( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tif ( t >= 0.5 ) {\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_slerp( buffer, dstOffset, srcOffset, t ) {\n\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\n\n\t}\n\n\t_slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst workOffset = this._workIndex * stride;\n\n\t\t// Store result in intermediate buffer offset\n\t\tQuaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );\n\n\t\t// Slerp to the intermediate result\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );\n\n\t}\n\n\t_lerp( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst s = 1 - t;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n\t_lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n}\n\n// Characters [].:/ are reserved for track binding syntax.\nconst _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nconst _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nconst _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst _directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst _objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst _propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\n\nconst _trackRe = new RegExp( ''\n\t+ '^'\n\t+ _directoryRe\n\t+ _nodeRe\n\t+ _objectRe\n\t+ _propertyRe\n\t+ '$'\n);\n\nconst _supportedObjectNames = [ 'material', 'materials', 'bones', 'map' ];\n\nclass Composite {\n\n\tconstructor( targetGroup, path, optionalParsedPath ) {\n\n\t\tconst parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis._targetGroup = targetGroup;\n\t\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\n\n\t}\n\n\tgetValue( array, offset ) {\n\n\t\tthis.bind(); // bind all binding\n\n\t\tconst firstValidIndex = this._targetGroup.nCachedObjects_,\n\t\t\tbinding = this._bindings[ firstValidIndex ];\n\n\t\t// and only call .getValue on the first\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\n\n\t}\n\n\tsetValue( array, offset ) {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].setValue( array, offset );\n\n\t\t}\n\n\t}\n\n\tbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].bind();\n\n\t\t}\n\n\t}\n\n\tunbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].unbind();\n\n\t\t}\n\n\t}\n\n}\n\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nclass PropertyBinding {\n\n\tconstructor( rootNode, path, parsedPath ) {\n\n\t\tthis.path = path;\n\t\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName );\n\n\t\tthis.rootNode = rootNode;\n\n\t\t// initial state of these methods that calls 'bind'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n\n\tstatic create( root, path, parsedPath ) {\n\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\n\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\n\n\t\t} else {\n\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */\n\tstatic sanitizeNodeName( name ) {\n\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\n\n\t}\n\n\tstatic parseTrackName( trackName ) {\n\n\t\tconst matches = _trackRe.exec( trackName );\n\n\t\tif ( matches === null ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\n\n\t\t}\n\n\t\tconst results = {\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\n\t\t\tnodeName: matches[ 2 ],\n\t\t\tobjectName: matches[ 3 ],\n\t\t\tobjectIndex: matches[ 4 ],\n\t\t\tpropertyName: matches[ 5 ], // required\n\t\t\tpropertyIndex: matches[ 6 ]\n\t\t};\n\n\t\tconst lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\n\n\t\tif ( lastDot !== undefined && lastDot !== - 1 ) {\n\n\t\t\tconst objectName = results.nodeName.substring( lastDot + 1 );\n\n\t\t\t// Object names must be checked against an allowlist. Otherwise, there\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\n\t\t\t// include '.' characters).\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {\n\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\n\t\t\t\tresults.objectName = objectName;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\n\n\t\t}\n\n\t\treturn results;\n\n\t}\n\n\tstatic findNode( root, nodeName ) {\n\n\t\tif ( nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {\n\n\t\t\treturn root;\n\n\t\t}\n\n\t\t// search into skeleton bones.\n\t\tif ( root.skeleton ) {\n\n\t\t\tconst bone = root.skeleton.getBoneByName( nodeName );\n\n\t\t\tif ( bone !== undefined ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// search into node subtree.\n\t\tif ( root.children ) {\n\n\t\t\tconst searchNodeSubtree = function ( children ) {\n\n\t\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\t\tconst childNode = children[ i ];\n\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\n\n\t\t\t\t\t\treturn childNode;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = searchNodeSubtree( childNode.children );\n\n\t\t\t\t\tif ( result ) return result;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t};\n\n\t\t\tconst subTreeNode = searchNodeSubtree( root.children );\n\n\t\t\tif ( subTreeNode ) {\n\n\t\t\t\treturn subTreeNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// these are used to \"bind\" a nonexistent property\n\t_getValue_unavailable() {}\n\t_setValue_unavailable() {}\n\n\t// Getters\n\n\t_getValue_direct( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.targetObject[ this.propertyName ];\n\n\t}\n\n\t_getValue_array( buffer, offset ) {\n\n\t\tconst source = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = source.length; i !== n; ++ i ) {\n\n\t\t\tbuffer[ offset ++ ] = source[ i ];\n\n\t\t}\n\n\t}\n\n\t_getValue_arrayElement( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\n\n\t}\n\n\t_getValue_toArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.toArray( buffer, offset );\n\n\t}\n\n\t// Direct\n\n\t_setValue_direct( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_direct_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// EntireArray\n\n\t_setValue_array( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t}\n\n\t_setValue_array_setNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// ArrayElement\n\n\t_setValue_arrayElement( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// HasToFromArray\n\n\t_setValue_fromArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\n\t}\n\n\t_setValue_fromArray_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t_getValue_unbound( targetArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.getValue( targetArray, offset );\n\n\t}\n\n\t_setValue_unbound( sourceArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.setValue( sourceArray, offset );\n\n\t}\n\n\t// create getter / setter pair for a property in the scene graph\n\tbind() {\n\n\t\tlet targetObject = this.node;\n\t\tconst parsedPath = this.parsedPath;\n\n\t\tconst objectName = parsedPath.objectName;\n\t\tconst propertyName = parsedPath.propertyName;\n\t\tlet propertyIndex = parsedPath.propertyIndex;\n\n\t\tif ( ! targetObject ) {\n\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName );\n\n\t\t\tthis.node = targetObject;\n\n\t\t}\n\n\t\t// set fail state so we can just 'return' on error\n\t\tthis.getValue = this._getValue_unavailable;\n\t\tthis.setValue = this._setValue_unavailable;\n\n\t\t// ensure there is a value node\n\t\tif ( ! targetObject ) {\n\n\t\t\tconsole.warn( 'THREE.PropertyBinding: No target node found for track: ' + this.path + '.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( objectName ) {\n\n\t\t\tlet objectIndex = parsedPath.objectIndex;\n\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\n\t\t\tswitch ( objectName ) {\n\n\t\t\t\tcase 'materials':\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.materials;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bones':\n\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\n\t\t\t\t\t// and convert the integer string to a true integer.\n\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\n\n\t\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\t\tfor ( let i = 0; i < targetObject.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\n\n\t\t\t\t\t\t\tobjectIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'map':\n\n\t\t\t\t\tif ( 'map' in targetObject ) {\n\n\t\t\t\t\t\ttargetObject = targetObject.map;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.map ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.map;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\n\n\t\t\t}\n\n\n\t\t\tif ( objectIndex !== undefined ) {\n\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// resolve property\n\t\tconst nodeProperty = targetObject[ propertyName ];\n\n\t\tif ( nodeProperty === undefined ) {\n\n\t\t\tconst nodeName = parsedPath.nodeName;\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\n\t\t\treturn;\n\n\t\t}\n\n\t\t// determine versioning scheme\n\t\tlet versioning = this.Versioning.None;\n\n\t\tthis.targetObject = targetObject;\n\n\t\tif ( targetObject.needsUpdate !== undefined ) { // material\n\n\t\t\tversioning = this.Versioning.NeedsUpdate;\n\n\t\t} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform\n\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\n\n\t\t}\n\n\t\t// determine how the property gets bound\n\t\tlet bindingType = this.BindingType.Direct;\n\n\t\tif ( propertyIndex !== undefined ) {\n\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\n\n\t\t\tif ( propertyName === 'morphTargetInfluences' ) {\n\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\tif ( ! targetObject.geometry ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {\n\n\t\t\t\t\tpropertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbindingType = this.BindingType.ArrayElement;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\t\t\tthis.propertyIndex = propertyIndex;\n\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\n\n\t\t\t// must use copy for Object3D.Euler/Quaternion\n\n\t\t\tbindingType = this.BindingType.HasFromToArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\n\n\t\t\tbindingType = this.BindingType.EntireArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else {\n\n\t\t\tthis.propertyName = propertyName;\n\n\t\t}\n\n\t\t// select getter / setter\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\n\n\t}\n\n\tunbind() {\n\n\t\tthis.node = null;\n\n\t\t// back to the prototype version of getValue / setValue\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n}\n\nPropertyBinding.Composite = Composite;\n\nPropertyBinding.prototype.BindingType = {\n\tDirect: 0,\n\tEntireArray: 1,\n\tArrayElement: 2,\n\tHasFromToArray: 3\n};\n\nPropertyBinding.prototype.Versioning = {\n\tNone: 0,\n\tNeedsUpdate: 1,\n\tMatrixWorldNeedsUpdate: 2\n};\n\nPropertyBinding.prototype.GetterByBindingType = [\n\n\tPropertyBinding.prototype._getValue_direct,\n\tPropertyBinding.prototype._getValue_array,\n\tPropertyBinding.prototype._getValue_arrayElement,\n\tPropertyBinding.prototype._getValue_toArray,\n\n];\n\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [\n\n\t[\n\t\t// Direct\n\t\tPropertyBinding.prototype._setValue_direct,\n\t\tPropertyBinding.prototype._setValue_direct_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// EntireArray\n\n\t\tPropertyBinding.prototype._setValue_array,\n\t\tPropertyBinding.prototype._setValue_array_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// ArrayElement\n\t\tPropertyBinding.prototype._setValue_arrayElement,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// HasToFromArray\n\t\tPropertyBinding.prototype._setValue_fromArray,\n\t\tPropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,\n\n\t]\n\n];\n\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */\n\nclass AnimationObjectGroup {\n\n\tconstructor() {\n\n\t\tthis.isAnimationObjectGroup = true;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// cached objects followed by the active ones\n\t\tthis._objects = Array.prototype.slice.call( arguments );\n\n\t\tthis.nCachedObjects_ = 0; // threshold\n\t\t// note: read by PropertyBinding.Composite\n\n\t\tconst indices = {};\n\t\tthis._indicesByUUID = indices; // for bookkeeping\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tindices[ arguments[ i ].uuid ] = i;\n\n\t\t}\n\n\t\tthis._paths = []; // inside: string\n\t\tthis._parsedPaths = []; // inside: { we don't care, here }\n\t\tthis._bindings = []; // inside: Array< PropertyBinding >\n\t\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tobjects: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._objects.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn this.total - scope.nCachedObjects_;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tget bindingsPerObject() {\n\n\t\t\t\treturn scope._bindings.length;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tadd() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tpaths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet knownObject = undefined,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid;\n\t\t\tlet index = indicesByUUID[ uuid ];\n\n\t\t\tif ( index === undefined ) {\n\n\t\t\t\t// unknown object -> add it to the ACTIVE region\n\n\t\t\t\tindex = nObjects ++;\n\t\t\t\tindicesByUUID[ uuid ] = index;\n\t\t\t\tobjects.push( object );\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\n\n\t\t\t\t}\n\n\t\t\t} else if ( index < nCachedObjects ) {\n\n\t\t\t\tknownObject = objects[ index ];\n\n\t\t\t\t// move existing object to the ACTIVE region\n\n\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\n\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\n\t\t\t\tobjects[ firstActiveIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ];\n\n\t\t\t\t\tlet binding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\n\t\t\t\t\tif ( binding === undefined ) {\n\n\t\t\t\t\t\t// since we do not bother to create new bindings\n\t\t\t\t\t\t// for objects that are cached, the binding may\n\t\t\t\t\t\t// or may not exist\n\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\n\n\t\t\t\tconsole.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\n\n\t\t\t} // else the object is already where we want it to be\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\tremove() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\n\n\t\t\t\t// move existing object into the CACHED region\n\n\t\t\t\tconst lastCachedIndex = nCachedObjects ++,\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\n\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = firstActiveObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\n\t\t\t\tobjects[ lastCachedIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// remove & forget\n\tuncache() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_,\n\t\t\tnObjects = objects.length;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tdelete indicesByUUID[ uuid ];\n\n\t\t\t\tif ( index < nCachedObjects ) {\n\n\t\t\t\t\t// object is cached, shrink the CACHED region\n\n\t\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\n\t\t\t\t\t\tlastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\t// last cached object takes this object's place\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\t\t// last object goes to the activated slot and pop\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// object is active, just swap with the last and pop\n\n\t\t\t\t\tconst lastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\tif ( lastIndex > 0 ) {\n\n\t\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobjects[ index ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} // cached or active\n\n\t\t\t} // if object is known\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// Internal interface used by befriended PropertyBinding.Composite:\n\n\tsubscribe_( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\n\t\tlet index = indicesByPath[ path ];\n\t\tconst bindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tconst paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tconst object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t}\n\n\tunsubscribe_( path ) {\n\n\t\t// tells the group to forget about a property path and no longer\n\t\t// update the array previously obtained with 'subscribe_'\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ];\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst paths = this._paths,\n\t\t\t\tparsedPaths = this._parsedPaths,\n\t\t\t\tbindings = this._bindings,\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\n\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\n\n\t\t\tbindings[ index ] = lastBindings;\n\t\t\tbindings.pop();\n\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\n\t\t\tparsedPaths.pop();\n\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\n\t\t\tpaths.pop();\n\n\t\t}\n\n\t}\n\n}\n\nclass AnimationAction {\n\n\tconstructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {\n\n\t\tthis._mixer = mixer;\n\t\tthis._clip = clip;\n\t\tthis._localRoot = localRoot;\n\t\tthis.blendMode = blendMode;\n\n\t\tconst tracks = clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tinterpolants = new Array( nTracks );\n\n\t\tconst interpolantSettings = {\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\t\t};\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst interpolant = tracks[ i ].createInterpolant( null );\n\t\t\tinterpolants[ i ] = interpolant;\n\t\t\tinterpolant.settings = interpolantSettings;\n\n\t\t}\n\n\t\tthis._interpolantSettings = interpolantSettings;\n\n\t\tthis._interpolants = interpolants; // bound by the mixer\n\n\t\t// inside: PropertyMixer (managed by the mixer)\n\t\tthis._propertyBindings = new Array( nTracks );\n\n\t\tthis._cacheIndex = null; // for the memory manager\n\t\tthis._byClipCacheIndex = null; // for the memory manager\n\n\t\tthis._timeScaleInterpolant = null;\n\t\tthis._weightInterpolant = null;\n\n\t\tthis.loop = LoopRepeat;\n\t\tthis._loopCount = - 1;\n\n\t\t// global mixer time when the action is to be started\n\t\t// it's set back to 'null' upon start of the action\n\t\tthis._startTime = null;\n\n\t\t// scaled local time of the action\n\t\t// gets clamped or wrapped to 0..clip.duration according to loop\n\t\tthis.time = 0;\n\n\t\tthis.timeScale = 1;\n\t\tthis._effectiveTimeScale = 1;\n\n\t\tthis.weight = 1;\n\t\tthis._effectiveWeight = 1;\n\n\t\tthis.repetitions = Infinity; // no. of repetitions when looping\n\n\t\tthis.paused = false; // true -> zero effective time scale\n\t\tthis.enabled = true; // false -> zero effective weight\n\n\t\tthis.clampWhenFinished = false;// keep feeding the last frame?\n\n\t\tthis.zeroSlopeAtStart = true;// for smooth interpolation w/o separate\n\t\tthis.zeroSlopeAtEnd = true;// clips for start, loop and end\n\n\t}\n\n\t// State & Scheduling\n\n\tplay() {\n\n\t\tthis._mixer._activateAction( this );\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tthis._mixer._deactivateAction( this );\n\n\t\treturn this.reset();\n\n\t}\n\n\treset() {\n\n\t\tthis.paused = false;\n\t\tthis.enabled = true;\n\n\t\tthis.time = 0; // restart clip\n\t\tthis._loopCount = - 1;// forget previous loops\n\t\tthis._startTime = null;// forget scheduling\n\n\t\treturn this.stopFading().stopWarping();\n\n\t}\n\n\tisRunning() {\n\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\n\n\t}\n\n\t// return true when play has been called\n\tisScheduled() {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t}\n\n\tstartAt( time ) {\n\n\t\tthis._startTime = time;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoop( mode, repetitions ) {\n\n\t\tthis.loop = mode;\n\t\tthis.repetitions = repetitions;\n\n\t\treturn this;\n\n\t}\n\n\t// Weight\n\n\t// set the weight stopping any scheduled fading\n\t// although .enabled = false yields an effective weight of zero, this\n\t// method does *not* change .enabled, because it would be confusing\n\tsetEffectiveWeight( weight ) {\n\n\t\tthis.weight = weight;\n\n\t\t// note: same logic as when updated at runtime\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\n\n\t\treturn this.stopFading();\n\n\t}\n\n\t// return the weight considering fading and .enabled\n\tgetEffectiveWeight() {\n\n\t\treturn this._effectiveWeight;\n\n\t}\n\n\tfadeIn( duration ) {\n\n\t\treturn this._scheduleFading( duration, 0, 1 );\n\n\t}\n\n\tfadeOut( duration ) {\n\n\t\treturn this._scheduleFading( duration, 1, 0 );\n\n\t}\n\n\tcrossFadeFrom( fadeOutAction, duration, warp ) {\n\n\t\tfadeOutAction.fadeOut( duration );\n\t\tthis.fadeIn( duration );\n\n\t\tif ( warp ) {\n\n\t\t\tconst fadeInDuration = this._clip.duration,\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\n\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\n\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcrossFadeTo( fadeInAction, duration, warp ) {\n\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\n\n\t}\n\n\tstopFading() {\n\n\t\tconst weightInterpolant = this._weightInterpolant;\n\n\t\tif ( weightInterpolant !== null ) {\n\n\t\t\tthis._weightInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Time Scale Control\n\n\t// set the time scale stopping any scheduled warping\n\t// although .paused = true yields an effective time scale of zero, this\n\t// method does *not* change .paused, because it would be confusing\n\tsetEffectiveTimeScale( timeScale ) {\n\n\t\tthis.timeScale = timeScale;\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t// return the time scale considering warping and .paused\n\tgetEffectiveTimeScale() {\n\n\t\treturn this._effectiveTimeScale;\n\n\t}\n\n\tsetDuration( duration ) {\n\n\t\tthis.timeScale = this._clip.duration / duration;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\tsyncWith( action ) {\n\n\t\tthis.time = action.time;\n\t\tthis.timeScale = action.timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\thalt( duration ) {\n\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\n\n\t}\n\n\twarp( startTimeScale, endTimeScale, duration ) {\n\n\t\tconst mixer = this._mixer,\n\t\t\tnow = mixer.time,\n\t\t\ttimeScale = this.timeScale;\n\n\t\tlet interpolant = this._timeScaleInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._timeScaleInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\ttimes[ 1 ] = now + duration;\n\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\n\n\t\treturn this;\n\n\t}\n\n\tstopWarping() {\n\n\t\tconst timeScaleInterpolant = this._timeScaleInterpolant;\n\n\t\tif ( timeScaleInterpolant !== null ) {\n\n\t\t\tthis._timeScaleInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Object Accessors\n\n\tgetMixer() {\n\n\t\treturn this._mixer;\n\n\t}\n\n\tgetClip() {\n\n\t\treturn this._clip;\n\n\t}\n\n\tgetRoot() {\n\n\t\treturn this._localRoot || this._mixer._root;\n\n\t}\n\n\t// Interna\n\n\t_update( time, deltaTime, timeDirection, accuIndex ) {\n\n\t\t// called by the mixer\n\n\t\tif ( ! this.enabled ) {\n\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\n\n\t\t\tthis._updateWeight( time );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst startTime = this._startTime;\n\n\t\tif ( startTime !== null ) {\n\n\t\t\t// check for scheduled start of action\n\n\t\t\tconst timeRunning = ( time - startTime ) * timeDirection;\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\n\n\t\t\t\tdeltaTime = 0;\n\n\t\t\t} else {\n\n\n\t\t\t\tthis._startTime = null; // unschedule\n\t\t\t\tdeltaTime = timeDirection * timeRunning;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// apply time scale and advance time\n\n\t\tdeltaTime *= this._updateTimeScale( time );\n\t\tconst clipTime = this._updateTime( deltaTime );\n\n\t\t// note: _updateTime may disable the action resulting in\n\t\t// an effective weight of 0\n\n\t\tconst weight = this._updateWeight( time );\n\n\t\tif ( weight > 0 ) {\n\n\t\t\tconst interpolants = this._interpolants;\n\t\t\tconst propertyMixers = this._propertyBindings;\n\n\t\t\tswitch ( this.blendMode ) {\n\n\t\t\t\tcase AdditiveAnimationBlendMode:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulateAdditive( weight );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase NormalAnimationBlendMode:\n\t\t\t\tdefault:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\n\n\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_updateWeight( time ) {\n\n\t\tlet weight = 0;\n\n\t\tif ( this.enabled ) {\n\n\t\t\tweight = this.weight;\n\t\t\tconst interpolant = this._weightInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\tweight *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopFading();\n\n\t\t\t\t\tif ( interpolantValue === 0 ) {\n\n\t\t\t\t\t\t// faded out, disable\n\t\t\t\t\t\tthis.enabled = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveWeight = weight;\n\t\treturn weight;\n\n\t}\n\n\t_updateTimeScale( time ) {\n\n\t\tlet timeScale = 0;\n\n\t\tif ( ! this.paused ) {\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\t\tconst interpolant = this._timeScaleInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\ttimeScale *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopWarping();\n\n\t\t\t\t\tif ( timeScale === 0 ) {\n\n\t\t\t\t\t\t// motion has halted, pause\n\t\t\t\t\t\tthis.paused = true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// warp done - apply final time scale\n\t\t\t\t\t\tthis.timeScale = timeScale;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveTimeScale = timeScale;\n\t\treturn timeScale;\n\n\t}\n\n\t_updateTime( deltaTime ) {\n\n\t\tconst duration = this._clip.duration;\n\t\tconst loop = this.loop;\n\n\t\tlet time = this.time + deltaTime;\n\t\tlet loopCount = this._loopCount;\n\n\t\tconst pingPong = ( loop === LoopPingPong );\n\n\t\tif ( deltaTime === 0 ) {\n\n\t\t\tif ( loopCount === - 1 ) return time;\n\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\n\n\t\t}\n\n\t\tif ( loop === LoopOnce ) {\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tthis._loopCount = 0;\n\t\t\t\tthis._setEndings( true, true, false );\n\n\t\t\t}\n\n\t\t\thandle_stop: {\n\n\t\t\t\tif ( time >= duration ) {\n\n\t\t\t\t\ttime = duration;\n\n\t\t\t\t} else if ( time < 0 ) {\n\n\t\t\t\t\ttime = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tbreak handle_stop;\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\telse this.enabled = false;\n\n\t\t\t\tthis.time = time;\n\n\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\tdirection: deltaTime < 0 ? - 1 : 1\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else { // repetitive Repeat or PingPong\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tif ( deltaTime >= 0 ) {\n\n\t\t\t\t\tloopCount = 0;\n\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// when looping in reverse direction, the initial\n\t\t\t\t\t// transition through zero counts as a repetition,\n\t\t\t\t\t// so leave loopCount at -1\n\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( time >= duration || time < 0 ) {\n\n\t\t\t\t// wrap around\n\n\t\t\t\tconst loopDelta = Math.floor( time / duration ); // signed\n\t\t\t\ttime -= duration * loopDelta;\n\n\t\t\t\tloopCount += Math.abs( loopDelta );\n\n\t\t\t\tconst pending = this.repetitions - loopCount;\n\n\t\t\t\tif ( pending <= 0 ) {\n\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\n\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\t\telse this.enabled = false;\n\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : - 1\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// keep running\n\n\t\t\t\t\tif ( pending === 1 ) {\n\n\t\t\t\t\t\t// entering the last round\n\n\t\t\t\t\t\tconst atStart = deltaTime < 0;\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._loopCount = loopCount;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tthis.time = time;\n\n\t\t\t}\n\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\n\n\t\t\t\t// invert time for the \"pong round\"\n\n\t\t\t\treturn duration - time;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn time;\n\n\t}\n\n\t_setEndings( atStart, atEnd, pingPong ) {\n\n\t\tconst settings = this._interpolantSettings;\n\n\t\tif ( pingPong ) {\n\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\n\n\t\t} else {\n\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\n\n\t\t\tif ( atStart ) {\n\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t\tif ( atEnd ) {\n\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingEnd \t = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_scheduleFading( duration, weightNow, weightThen ) {\n\n\t\tconst mixer = this._mixer, now = mixer.time;\n\t\tlet interpolant = this._weightInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._weightInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\tvalues[ 0 ] = weightNow;\n\t\ttimes[ 1 ] = now + duration;\n\t\tvalues[ 1 ] = weightThen;\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _controlInterpolantsResultBuffer = new Float32Array( 1 );\n\n\nclass AnimationMixer extends EventDispatcher {\n\n\tconstructor( root ) {\n\n\t\tsuper();\n\n\t\tthis._root = root;\n\t\tthis._initMemoryManager();\n\t\tthis._accuIndex = 0;\n\t\tthis.time = 0;\n\t\tthis.timeScale = 1.0;\n\n\t}\n\n\t_bindAction( action, prototypeAction ) {\n\n\t\tconst root = action._localRoot || this._root,\n\t\t\ttracks = action._clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tbindings = action._propertyBindings,\n\t\t\tinterpolants = action._interpolants,\n\t\t\trootUuid = root.uuid,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName;\n\n\t\tlet bindingsByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingsByName === undefined ) {\n\n\t\t\tbindingsByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\n\n\t\t}\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst track = tracks[ i ],\n\t\t\t\ttrackName = track.name;\n\n\t\t\tlet binding = bindingsByName[ trackName ];\n\n\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t} else {\n\n\t\t\t\tbinding = bindings[ i ];\n\n\t\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t\t// existing binding, make sure the cache knows\n\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\n\n\t\t\t\t\t\t++ binding.referenceCount;\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tconst path = prototypeAction && prototypeAction.\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\n\n\t\t\t\tbinding = new PropertyMixer(\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t}\n\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\n\n\t\t}\n\n\t}\n\n\t_activateAction( action ) {\n\n\t\tif ( ! this._isActiveAction( action ) ) {\n\n\t\t\tif ( action._cacheIndex === null ) {\n\n\t\t\t\t// this action has been forgotten by the cache, but the user\n\t\t\t\t// appears to be still using it -> rebind\n\n\t\t\t\tconst rootUuid = ( action._localRoot || this._root ).uuid,\n\t\t\t\t\tclipUuid = action._clip.uuid,\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\t\t\tthis._bindAction( action,\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\n\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\n\n\t\t\t}\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// increment reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\n\n\t\t\t\t\tthis._lendBinding( binding );\n\t\t\t\t\tbinding.saveOriginalState();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._lendAction( action );\n\n\t\t}\n\n\t}\n\n\t_deactivateAction( action ) {\n\n\t\tif ( this._isActiveAction( action ) ) {\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// decrement reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( -- binding.useCount === 0 ) {\n\n\t\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\t\tthis._takeBackBinding( binding );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._takeBackAction( action );\n\n\t\t}\n\n\t}\n\n\t// Memory manager\n\n\t_initMemoryManager() {\n\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\n\t\tthis._nActiveActions = 0;\n\n\t\tthis._actionsByClip = {};\n\t\t// inside:\n\t\t// {\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\n\t\t// \tactionByRoot: AnimationAction - lookup\n\t\t// }\n\n\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\n\t\tthis._nActiveBindings = 0;\n\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n\n\t\tthis._controlInterpolants = []; // same game as above\n\t\tthis._nActiveControlInterpolants = 0;\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tactions: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._actions.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveActions;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindings: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._bindings.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveBindings;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontrolInterpolants: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._controlInterpolants.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t// Memory management for AnimationAction objects\n\n\t_isActiveAction( action ) {\n\n\t\tconst index = action._cacheIndex;\n\t\treturn index !== null && index < this._nActiveActions;\n\n\t}\n\n\t_addInactiveAction( action, clipUuid, rootUuid ) {\n\n\t\tconst actions = this._actions,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tlet actionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip === undefined ) {\n\n\t\t\tactionsForClip = {\n\n\t\t\t\tknownActions: [ action ],\n\t\t\t\tactionByRoot: {}\n\n\t\t\t};\n\n\t\t\taction._byClipCacheIndex = 0;\n\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\n\n\t\t} else {\n\n\t\t\tconst knownActions = actionsForClip.knownActions;\n\n\t\t\taction._byClipCacheIndex = knownActions.length;\n\t\t\tknownActions.push( action );\n\n\t\t}\n\n\t\taction._cacheIndex = actions.length;\n\t\tactions.push( action );\n\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\n\n\t}\n\n\t_removeInactiveAction( action ) {\n\n\t\tconst actions = this._actions,\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\n\t\t\tcacheIndex = action._cacheIndex;\n\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\tactions.pop();\n\n\t\taction._cacheIndex = null;\n\n\n\t\tconst clipUuid = action._clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\n\n\t\t\tlastKnownAction =\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\n\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\n\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\n\t\tknownActionsForClip.pop();\n\n\t\taction._byClipCacheIndex = null;\n\n\n\t\tconst actionByRoot = actionsForClip.actionByRoot,\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\n\n\t\tdelete actionByRoot[ rootUuid ];\n\n\t\tif ( knownActionsForClip.length === 0 ) {\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t\tthis._removeInactiveBindingsForAction( action );\n\n\t}\n\n\t_removeInactiveBindingsForAction( action ) {\n\n\t\tconst bindings = action._propertyBindings;\n\n\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tconst binding = bindings[ i ];\n\n\t\t\tif ( -- binding.referenceCount === 0 ) {\n\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_lendAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions >| inactive actions ]\n\t\t// s a\n\t\t// <-swap->\n\t\t// a s\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveActions ++,\n\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\n\n\t\taction._cacheIndex = lastActiveIndex;\n\t\tactions[ lastActiveIndex ] = action;\n\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = firstInactiveAction;\n\n\t}\n\n\t_takeBackAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions |< inactive actions ]\n\t\t// a s\n\t\t// <-swap->\n\t\t// s a\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\n\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\n\n\t\taction._cacheIndex = firstInactiveIndex;\n\t\tactions[ firstInactiveIndex ] = action;\n\n\t\tlastActiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = lastActiveAction;\n\n\t}\n\n\t// Memory management for PropertyMixer objects\n\n\t_addInactiveBinding( binding, rootUuid, trackName ) {\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindings = this._bindings;\n\n\t\tlet bindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName === undefined ) {\n\n\t\t\tbindingByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\n\n\t\t}\n\n\t\tbindingByName[ trackName ] = binding;\n\n\t\tbinding._cacheIndex = bindings.length;\n\t\tbindings.push( binding );\n\n\t}\n\n\t_removeInactiveBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tpropBinding = binding.binding,\n\t\t\trootUuid = propBinding.rootNode.uuid,\n\t\t\ttrackName = propBinding.path,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\n\t\t\tcacheIndex = binding._cacheIndex;\n\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\n\t\tbindings.pop();\n\n\t\tdelete bindingByName[ trackName ];\n\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\n\n\t\t\tdelete bindingsByRoot[ rootUuid ];\n\n\t\t}\n\n\t}\n\n\t_lendBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\n\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\n\n\t\tbinding._cacheIndex = lastActiveIndex;\n\t\tbindings[ lastActiveIndex ] = binding;\n\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\n\n\t}\n\n\t_takeBackBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\n\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\n\n\t\tbinding._cacheIndex = firstInactiveIndex;\n\t\tbindings[ firstInactiveIndex ] = binding;\n\n\t\tlastActiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = lastActiveBinding;\n\n\t}\n\n\n\t// Memory management of Interpolants for weight and time scale\n\n\t_lendControlInterpolant() {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++;\n\n\t\tlet interpolant = interpolants[ lastActiveIndex ];\n\n\t\tif ( interpolant === undefined ) {\n\n\t\t\tinterpolant = new LinearInterpolant(\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\n\t\t\t\t1, _controlInterpolantsResultBuffer );\n\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t}\n\n\t_takeBackControlInterpolant( interpolant ) {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tprevIndex = interpolant.__cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\n\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\n\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\n\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\n\n\t}\n\n\t// return an action for a clip optionally using a custom root target\n\t// object (this method allocates a lot of dynamic memory in case a\n\t// previously unknown clip/root combination is specified)\n\tclipAction( clip, optionalRoot, blendMode ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid;\n\n\t\tlet clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;\n\n\t\tconst clipUuid = clipObject !== null ? clipObject.uuid : clip;\n\n\t\tconst actionsForClip = this._actionsByClip[ clipUuid ];\n\t\tlet prototypeAction = null;\n\n\t\tif ( blendMode === undefined ) {\n\n\t\t\tif ( clipObject !== null ) {\n\n\t\t\t\tblendMode = clipObject.blendMode;\n\n\t\t\t} else {\n\n\t\t\t\tblendMode = NormalAnimationBlendMode;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\tconst existingAction = actionsForClip.actionByRoot[ rootUuid ];\n\n\t\t\tif ( existingAction !== undefined && existingAction.blendMode === blendMode ) {\n\n\t\t\t\treturn existingAction;\n\n\t\t\t}\n\n\t\t\t// we know the clip, so we don't have to parse all\n\t\t\t// the bindings again but can just copy\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\n\n\t\t\t// also, take the clip from the prototype action\n\t\t\tif ( clipObject === null )\n\t\t\t\tclipObject = prototypeAction._clip;\n\n\t\t}\n\n\t\t// clip must be known when specified via string\n\t\tif ( clipObject === null ) return null;\n\n\t\t// allocate all resources required to run it\n\t\tconst newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );\n\n\t\tthis._bindAction( newAction, prototypeAction );\n\n\t\t// and make the action known to the memory manager\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\n\n\t\treturn newAction;\n\n\t}\n\n\t// get an existing action\n\texistingAction( clip, optionalRoot ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// deactivates all previously scheduled actions\n\tstopAllAction() {\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions;\n\n\t\tfor ( let i = nActions - 1; i >= 0; -- i ) {\n\n\t\t\tactions[ i ].stop();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// advance the time and update apply the animation\n\tupdate( deltaTime ) {\n\n\t\tdeltaTime *= this.timeScale;\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\n\t\t\ttime = this.time += deltaTime,\n\t\t\ttimeDirection = Math.sign( deltaTime ),\n\n\t\t\taccuIndex = this._accuIndex ^= 1;\n\n\t\t// run active actions\n\n\t\tfor ( let i = 0; i !== nActions; ++ i ) {\n\n\t\t\tconst action = actions[ i ];\n\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\n\n\t\t}\n\n\t\t// update scene graph\n\n\t\tconst bindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tfor ( let i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].apply( accuIndex );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Allows you to seek to a specific time in an animation.\n\tsetTime( timeInSeconds ) {\n\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\n\t\tfor ( let i = 0; i < this._actions.length; i ++ ) {\n\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n\n\t\t}\n\n\t\treturn this.update( timeInSeconds ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n\n\t}\n\n\t// return this mixer's root target object\n\tgetRoot() {\n\n\t\treturn this._root;\n\n\t}\n\n\t// free all resources specific to a particular clip\n\tuncacheClip( clip ) {\n\n\t\tconst actions = this._actions,\n\t\t\tclipUuid = clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\t// note: just calling _removeInactiveAction would mess up the\n\t\t\t// iteration state and also require updating the state we can\n\t\t\t// just throw away\n\n\t\t\tconst actionsToRemove = actionsForClip.knownActions;\n\n\t\t\tfor ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\n\n\t\t\t\tconst action = actionsToRemove[ i ];\n\n\t\t\t\tthis._deactivateAction( action );\n\n\t\t\t\tconst cacheIndex = action._cacheIndex,\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\n\n\t\t\t\taction._cacheIndex = null;\n\t\t\t\taction._byClipCacheIndex = null;\n\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\t\t\tactions.pop();\n\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\n\n\t\t\t}\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t}\n\n\t// free all resources specific to a particular root target object\n\tuncacheRoot( root ) {\n\n\t\tconst rootUuid = root.uuid,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tfor ( const clipUuid in actionsByClip ) {\n\n\t\t\tconst actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\n\t\t\t\taction = actionByRoot[ rootUuid ];\n\n\t\t\tif ( action !== undefined ) {\n\n\t\t\t\tthis._deactivateAction( action );\n\t\t\t\tthis._removeInactiveAction( action );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName !== undefined ) {\n\n\t\t\tfor ( const trackName in bindingByName ) {\n\n\t\t\t\tconst binding = bindingByName[ trackName ];\n\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remove a targeted clip from the cache\n\tuncacheAction( clip, optionalRoot ) {\n\n\t\tconst action = this.existingAction( clip, optionalRoot );\n\n\t\tif ( action !== null ) {\n\n\t\t\tthis._deactivateAction( action );\n\t\t\tthis._removeInactiveAction( action );\n\n\t\t}\n\n\t}\n\n}\n\nclass Uniform {\n\n\tconstructor( value ) {\n\n\t\tthis.value = value;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\n\n\t}\n\n}\n\nlet _id = 0;\n\nclass UniformsGroup extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isUniformsGroup = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _id ++ } );\n\n\t\tthis.name = '';\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.uniforms = [];\n\n\t}\n\n\tadd( uniform ) {\n\n\t\tthis.uniforms.push( uniform );\n\n\t\treturn this;\n\n\t}\n\n\tremove( uniform ) {\n\n\t\tconst index = this.uniforms.indexOf( uniform );\n\n\t\tif ( index !== - 1 ) this.uniforms.splice( index, 1 );\n\n\t\treturn this;\n\n\t}\n\n\tsetName( name ) {\n\n\t\tthis.name = name;\n\n\t\treturn this;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.usage = source.usage;\n\n\t\tconst uniformsSource = source.uniforms;\n\n\t\tthis.uniforms.length = 0;\n\n\t\tfor ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {\n\n\t\t\tconst uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];\n\n\t\t\tfor ( let j = 0; j < uniforms.length; j ++ ) {\n\n\t\t\t\tthis.uniforms.push( uniforms[ j ].clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass InstancedInterleavedBuffer extends InterleavedBuffer {\n\n\tconstructor( array, stride, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, stride );\n\n\t\tthis.isInstancedInterleavedBuffer = true;\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tconst ib = super.clone( data );\n\n\t\tib.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn ib;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tconst json = super.toJSON( data );\n\n\t\tjson.isInstancedInterleavedBuffer = true;\n\t\tjson.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn json;\n\n\t}\n\n}\n\nclass GLBufferAttribute {\n\n\tconstructor( buffer, type, itemSize, elementSize, count ) {\n\n\t\tthis.isGLBufferAttribute = true;\n\n\t\tthis.name = '';\n\n\t\tthis.buffer = buffer;\n\t\tthis.type = type;\n\t\tthis.itemSize = itemSize;\n\t\tthis.elementSize = elementSize;\n\t\tthis.count = count;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetBuffer( buffer ) {\n\n\t\tthis.buffer = buffer;\n\n\t\treturn this;\n\n\t}\n\n\tsetType( type, elementSize ) {\n\n\t\tthis.type = type;\n\t\tthis.elementSize = elementSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetItemSize( itemSize ) {\n\n\t\tthis.itemSize = itemSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetCount( count ) {\n\n\t\tthis.count = count;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Raycaster {\n\n\tconstructor( origin, direction, near = 0, far = Infinity ) {\n\n\t\tthis.ray = new Ray( origin, direction );\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.camera = null;\n\t\tthis.layers = new Layers();\n\n\t\tthis.params = {\n\t\t\tMesh: {},\n\t\t\tLine: { threshold: 1 },\n\t\t\tLOD: {},\n\t\t\tPoints: { threshold: 1 },\n\t\t\tSprite: {}\n\t\t};\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.ray.set( origin, direction );\n\n\t}\n\n\tsetFromCamera( coords, camera ) {\n\n\t\tif ( camera.isPerspectiveCamera ) {\n\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\n\t\t\tthis.camera = camera;\n\n\t\t} else if ( camera.isOrthographicCamera ) {\n\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\n\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\n\t\t\tthis.camera = camera;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type );\n\n\t\t}\n\n\t}\n\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersectObject( object, this, intersects, recursive );\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n\tintersectObjects( objects, recursive = true, intersects = [] ) {\n\n\t\tfor ( let i = 0, l = objects.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( objects[ i ], this, intersects, recursive );\n\n\t\t}\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n}\n\nfunction ascSort( a, b ) {\n\n\treturn a.distance - b.distance;\n\n}\n\nfunction intersectObject( object, raycaster, intersects, recursive ) {\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tobject.raycast( raycaster, intersects );\n\n\t}\n\n\tif ( recursive === true ) {\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( children[ i ], raycaster, intersects, true );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.\n * The azimuthal angle (theta) is measured from the positive z-axis.\n */\n\n\nclass Spherical {\n\n\tconstructor( radius = 1, phi = 0, theta = 0 ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi; // polar angle\n\t\tthis.theta = theta; // azimuthal angle\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, phi, theta ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi;\n\t\tthis.theta = theta;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.phi = other.phi;\n\t\tthis.theta = other.theta;\n\n\t\treturn this;\n\n\t}\n\n\t// restrict phi to be between EPS and PI-EPS\n\tmakeSafe() {\n\n\t\tconst EPS = 0.000001;\n\t\tthis.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\n\n\t\tif ( this.radius === 0 ) {\n\n\t\t\tthis.theta = 0;\n\t\t\tthis.phi = 0;\n\n\t\t} else {\n\n\t\t\tthis.theta = Math.atan2( x, z );\n\t\t\tthis.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */\n\nclass Cylindrical {\n\n\tconstructor( radius = 1, theta = 0, y = 0 ) {\n\n\t\tthis.radius = radius; // distance from the origin to a point in the x-z plane\n\t\tthis.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\t\tthis.y = y; // height above the x-z plane\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, theta, y ) {\n\n\t\tthis.radius = radius;\n\t\tthis.theta = theta;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.theta = other.theta;\n\t\tthis.y = other.y;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + z * z );\n\t\tthis.theta = Math.atan2( x, z );\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$4 = /*@__PURE__*/ new Vector2();\n\nclass Box2 {\n\n\tconstructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {\n\n\t\tthis.isBox2 = true;\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = + Infinity;\n\t\tthis.max.x = this.max.y = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 4 splitting planes to rule out intersections\n\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.clampPoint( point, _vector$4 ).distanceTo( point );\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nconst _startP = /*@__PURE__*/ new Vector3();\nconst _startEnd = /*@__PURE__*/ new Vector3();\n\nclass Line3 {\n\n\tconstructor( start = new Vector3(), end = new Vector3() ) {\n\n\t\tthis.start = start;\n\t\tthis.end = end;\n\n\t}\n\n\tset( start, end ) {\n\n\t\tthis.start.copy( start );\n\t\tthis.end.copy( end );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( line ) {\n\n\t\tthis.start.copy( line.start );\n\t\tthis.end.copy( line.end );\n\n\t\treturn this;\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\n\n\t}\n\n\tdelta( target ) {\n\n\t\treturn target.subVectors( this.end, this.start );\n\n\t}\n\n\tdistanceSq() {\n\n\t\treturn this.start.distanceToSquared( this.end );\n\n\t}\n\n\tdistance() {\n\n\t\treturn this.start.distanceTo( this.end );\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tclosestPointToPointParameter( point, clampToLine ) {\n\n\t\t_startP.subVectors( point, this.start );\n\t\t_startEnd.subVectors( this.end, this.start );\n\n\t\tconst startEnd2 = _startEnd.dot( _startEnd );\n\t\tconst startEnd_startP = _startEnd.dot( _startP );\n\n\t\tlet t = startEnd_startP / startEnd2;\n\n\t\tif ( clampToLine ) {\n\n\t\t\tt = clamp( t, 0, 1 );\n\n\t\t}\n\n\t\treturn t;\n\n\t}\n\n\tclosestPointToPoint( point, clampToLine, target ) {\n\n\t\tconst t = this.closestPointToPointParameter( point, clampToLine );\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.start.applyMatrix4( matrix );\n\t\tthis.end.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t}\n\n\tequals( line ) {\n\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$3 = /*@__PURE__*/ new Vector3();\n\nclass SpotLightHelper extends Object3D {\n\n\tconstructor( light, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'SpotLightHelper';\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst positions = [\n\t\t\t0, 0, 0, \t0, 0, 1,\n\t\t\t0, 0, 0, \t1, 0, 1,\n\t\t\t0, 0, 0,\t- 1, 0, 1,\n\t\t\t0, 0, 0, \t0, 1, 1,\n\t\t\t0, 0, 0, \t0, - 1, 1\n\t\t];\n\n\t\tfor ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\n\n\t\t\tconst p1 = ( i / l ) * Math.PI * 2;\n\t\t\tconst p2 = ( j / l ) * Math.PI * 2;\n\n\t\t\tpositions.push(\n\t\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\n\t\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\n\t\t\t);\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.cone = new LineSegments( geometry, material );\n\t\tthis.add( this.cone );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\tconst coneLength = this.light.distance ? this.light.distance : 1000;\n\t\tconst coneWidth = coneLength * Math.tan( this.light.angle );\n\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\n\n\t\t_vector$3.setFromMatrixPosition( this.light.target.matrixWorld );\n\n\t\tthis.cone.lookAt( _vector$3 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.cone.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.cone.material.color.copy( this.light.color );\n\n\t\t}\n\n\t}\n\n}\n\nconst _vector$2 = /*@__PURE__*/ new Vector3();\nconst _boneMatrix = /*@__PURE__*/ new Matrix4();\nconst _matrixWorldInv = /*@__PURE__*/ new Matrix4();\n\n\nclass SkeletonHelper extends LineSegments {\n\n\tconstructor( object ) {\n\n\t\tconst bones = getBoneList( object );\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst color1 = new Color( 0, 0, 1 );\n\t\tconst color2 = new Color( 0, 1, 0 );\n\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tcolors.push( color1.r, color1.g, color1.b );\n\t\t\t\tcolors.push( color2.r, color2.g, color2.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.isSkeletonHelper = true;\n\n\t\tthis.type = 'SkeletonHelper';\n\n\t\tthis.root = object;\n\t\tthis.bones = bones;\n\n\t\tthis.matrix = object.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst bones = this.bones;\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t_matrixWorldInv.copy( this.root.matrixWorld ).invert();\n\n\t\tfor ( let i = 0, j = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\tj += 2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction getBoneList( object ) {\n\n\tconst boneList = [];\n\n\tif ( object.isBone === true ) {\n\n\t\tboneList.push( object );\n\n\t}\n\n\tfor ( let i = 0; i < object.children.length; i ++ ) {\n\n\t\tboneList.push.apply( boneList, getBoneList( object.children[ i ] ) );\n\n\t}\n\n\treturn boneList;\n\n}\n\nclass PointLightHelper extends Mesh {\n\n\tconstructor( light, sphereSize, color ) {\n\n\t\tconst geometry = new SphereGeometry( sphereSize, 4, 2 );\n\t\tconst material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.light = light;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'PointLightHelper';\n\n\t\tthis.matrix = this.light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\n\t\t/*\n\t// TODO: delete this comment?\n\tconst distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tconst d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\t/*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/\n\n\t}\n\n}\n\nconst _vector$1 = /*@__PURE__*/ new Vector3();\nconst _color1 = /*@__PURE__*/ new Color();\nconst _color2 = /*@__PURE__*/ new Color();\n\nclass HemisphereLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'HemisphereLightHelper';\n\n\t\tconst geometry = new OctahedronGeometry( size );\n\t\tgeometry.rotateY( Math.PI * 0.5 );\n\n\t\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\t\tif ( this.color === undefined ) this.material.vertexColors = true;\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\t\tconst colors = new Float32Array( position.count * 3 );\n\n\t\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\n\n\t\tthis.add( new Mesh( geometry, this.material ) );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tconst mesh = this.children[ 0 ];\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tconst colors = mesh.geometry.getAttribute( 'color' );\n\n\t\t\t_color1.copy( this.light.color );\n\t\t\t_color2.copy( this.light.groundColor );\n\n\t\t\tfor ( let i = 0, l = colors.count; i < l; i ++ ) {\n\n\t\t\t\tconst color = ( i < ( l / 2 ) ) ? _color1 : _color2;\n\n\t\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t\tcolors.needsUpdate = true;\n\n\t\t}\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\n\t\tmesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );\n\n\t}\n\n}\n\nclass GridHelper extends LineSegments {\n\n\tconstructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst center = divisions / 2;\n\t\tconst step = size / divisions;\n\t\tconst halfSize = size / 2;\n\n\t\tconst vertices = [], colors = [];\n\n\t\tfor ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\n\n\t\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\n\t\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\n\n\t\t\tconst color = i === center ? color1 : color2;\n\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'GridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PolarGridHelper extends LineSegments {\n\n\tconstructor( radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\t// create the sectors\n\n\t\tif ( sectors > 1 ) {\n\n\t\t\tfor ( let i = 0; i < sectors; i ++ ) {\n\n\t\t\t\tconst v = ( i / sectors ) * ( Math.PI * 2 );\n\n\t\t\t\tconst x = Math.sin( v ) * radius;\n\t\t\t\tconst z = Math.cos( v ) * radius;\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( x, 0, z );\n\n\t\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// create the rings\n\n\t\tfor ( let i = 0; i < rings; i ++ ) {\n\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\tconst r = radius - ( radius / rings * i );\n\n\t\t\tfor ( let j = 0; j < divisions; j ++ ) {\n\n\t\t\t\t// first vertex\n\n\t\t\t\tlet v = ( j / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tlet x = Math.sin( v ) * r;\n\t\t\t\tlet z = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t\t// second vertex\n\n\t\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tx = Math.sin( v ) * r;\n\t\t\t\tz = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'PolarGridHelper';\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\nconst _v3 = /*@__PURE__*/ new Vector3();\n\nclass DirectionalLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\n\t\tthis.light = light;\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'DirectionalLightHelper';\n\n\t\tif ( size === undefined ) size = 1;\n\n\t\tlet geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\n\t\t\t- size, size, 0,\n\t\t\tsize, size, 0,\n\t\t\tsize, - size, 0,\n\t\t\t- size, - size, 0,\n\t\t\t- size, size, 0\n\t\t], 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.lightPlane = new Line( geometry, material );\n\t\tthis.add( this.lightPlane );\n\n\t\tgeometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\n\n\t\tthis.targetLine = new Line( geometry, material );\n\t\tthis.add( this.targetLine );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.lightPlane.geometry.dispose();\n\t\tthis.lightPlane.material.dispose();\n\t\tthis.targetLine.geometry.dispose();\n\t\tthis.targetLine.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateWorldMatrix( true, false );\n\t\tthis.light.target.updateWorldMatrix( true, false );\n\n\t\t_v1.setFromMatrixPosition( this.light.matrixWorld );\n\t\t_v2.setFromMatrixPosition( this.light.target.matrixWorld );\n\t\t_v3.subVectors( _v2, _v1 );\n\n\t\tthis.lightPlane.lookAt( _v2 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.lightPlane.material.color.set( this.color );\n\t\t\tthis.targetLine.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.lightPlane.material.color.copy( this.light.color );\n\t\t\tthis.targetLine.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\tthis.targetLine.lookAt( _v2 );\n\t\tthis.targetLine.scale.z = _v3.length();\n\n\t}\n\n}\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _camera = /*@__PURE__*/ new Camera();\n\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\n */\n\nclass CameraHelper extends LineSegments {\n\n\tconstructor( camera ) {\n\n\t\tconst geometry = new BufferGeometry();\n\t\tconst material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst pointMap = {};\n\n\t\t// near\n\n\t\taddLine( 'n1', 'n2' );\n\t\taddLine( 'n2', 'n4' );\n\t\taddLine( 'n4', 'n3' );\n\t\taddLine( 'n3', 'n1' );\n\n\t\t// far\n\n\t\taddLine( 'f1', 'f2' );\n\t\taddLine( 'f2', 'f4' );\n\t\taddLine( 'f4', 'f3' );\n\t\taddLine( 'f3', 'f1' );\n\n\t\t// sides\n\n\t\taddLine( 'n1', 'f1' );\n\t\taddLine( 'n2', 'f2' );\n\t\taddLine( 'n3', 'f3' );\n\t\taddLine( 'n4', 'f4' );\n\n\t\t// cone\n\n\t\taddLine( 'p', 'n1' );\n\t\taddLine( 'p', 'n2' );\n\t\taddLine( 'p', 'n3' );\n\t\taddLine( 'p', 'n4' );\n\n\t\t// up\n\n\t\taddLine( 'u1', 'u2' );\n\t\taddLine( 'u2', 'u3' );\n\t\taddLine( 'u3', 'u1' );\n\n\t\t// target\n\n\t\taddLine( 'c', 't' );\n\t\taddLine( 'p', 'c' );\n\n\t\t// cross\n\n\t\taddLine( 'cn1', 'cn2' );\n\t\taddLine( 'cn3', 'cn4' );\n\n\t\taddLine( 'cf1', 'cf2' );\n\t\taddLine( 'cf3', 'cf4' );\n\n\t\tfunction addLine( a, b ) {\n\n\t\t\taddPoint( a );\n\t\t\taddPoint( b );\n\n\t\t}\n\n\t\tfunction addPoint( id ) {\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tcolors.push( 0, 0, 0 );\n\n\t\t\tif ( pointMap[ id ] === undefined ) {\n\n\t\t\t\tpointMap[ id ] = [];\n\n\t\t\t}\n\n\t\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'CameraHelper';\n\n\t\tthis.camera = camera;\n\t\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\n\n\t\tthis.matrix = camera.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.pointMap = pointMap;\n\n\t\tthis.update();\n\n\t\t// colors\n\n\t\tconst colorFrustum = new Color( 0xffaa00 );\n\t\tconst colorCone = new Color( 0xff0000 );\n\t\tconst colorUp = new Color( 0x00aaff );\n\t\tconst colorTarget = new Color( 0xffffff );\n\t\tconst colorCross = new Color( 0x333333 );\n\n\t\tthis.setColors( colorFrustum, colorCone, colorUp, colorTarget, colorCross );\n\n\t}\n\n\tsetColors( frustum, cone, up, target, cross ) {\n\n\t\tconst geometry = this.geometry;\n\n\t\tconst colorAttribute = geometry.getAttribute( 'color' );\n\n\t\t// near\n\n\t\tcolorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2\n\t\tcolorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4\n\t\tcolorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3\n\t\tcolorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1\n\n\t\t// far\n\n\t\tcolorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2\n\t\tcolorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4\n\t\tcolorAttribute.setXYZ( 12, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 13, frustum.r, frustum.g, frustum.b ); // f4, f3\n\t\tcolorAttribute.setXYZ( 14, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 15, frustum.r, frustum.g, frustum.b ); // f3, f1\n\n\t\t// sides\n\n\t\tcolorAttribute.setXYZ( 16, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 17, frustum.r, frustum.g, frustum.b ); // n1, f1\n\t\tcolorAttribute.setXYZ( 18, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 19, frustum.r, frustum.g, frustum.b ); // n2, f2\n\t\tcolorAttribute.setXYZ( 20, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 21, frustum.r, frustum.g, frustum.b ); // n3, f3\n\t\tcolorAttribute.setXYZ( 22, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 23, frustum.r, frustum.g, frustum.b ); // n4, f4\n\n\t\t// cone\n\n\t\tcolorAttribute.setXYZ( 24, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 25, cone.r, cone.g, cone.b ); // p, n1\n\t\tcolorAttribute.setXYZ( 26, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 27, cone.r, cone.g, cone.b ); // p, n2\n\t\tcolorAttribute.setXYZ( 28, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 29, cone.r, cone.g, cone.b ); // p, n3\n\t\tcolorAttribute.setXYZ( 30, cone.r, cone.g, cone.b ); colorAttribute.setXYZ( 31, cone.r, cone.g, cone.b ); // p, n4\n\n\t\t// up\n\n\t\tcolorAttribute.setXYZ( 32, up.r, up.g, up.b ); colorAttribute.setXYZ( 33, up.r, up.g, up.b ); // u1, u2\n\t\tcolorAttribute.setXYZ( 34, up.r, up.g, up.b ); colorAttribute.setXYZ( 35, up.r, up.g, up.b ); // u2, u3\n\t\tcolorAttribute.setXYZ( 36, up.r, up.g, up.b ); colorAttribute.setXYZ( 37, up.r, up.g, up.b ); // u3, u1\n\n\t\t// target\n\n\t\tcolorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t\n\t\tcolorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c\n\n\t\t// cross\n\n\t\tcolorAttribute.setXYZ( 42, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 43, cross.r, cross.g, cross.b ); // cn1, cn2\n\t\tcolorAttribute.setXYZ( 44, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 45, cross.r, cross.g, cross.b ); // cn3, cn4\n\n\t\tcolorAttribute.setXYZ( 46, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 47, cross.r, cross.g, cross.b ); // cf1, cf2\n\t\tcolorAttribute.setXYZ( 48, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 49, cross.r, cross.g, cross.b ); // cf3, cf4\n\n\t\tcolorAttribute.needsUpdate = true;\n\n\t}\n\n\tupdate() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst pointMap = this.pointMap;\n\n\t\tconst w = 1, h = 1;\n\n\t\t// we need just camera projection matrix inverse\n\t\t// world matrix must be identity\n\n\t\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\n\n\t\t// center / target\n\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );\n\n\t\t// near\n\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );\n\n\t\t// far\n\n\t\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );\n\t\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );\n\t\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );\n\t\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );\n\n\t\t// up\n\n\t\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );\n\n\t\t// cross\n\n\t\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );\n\t\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );\n\t\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );\n\t\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );\n\n\t\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );\n\t\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );\n\t\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );\n\t\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\n\n\t_vector.set( x, y, z ).unproject( camera );\n\n\tconst points = pointMap[ point ];\n\n\tif ( points !== undefined ) {\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tposition.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t}\n\n}\n\nconst _box = /*@__PURE__*/ new Box3();\n\nclass BoxHelper extends LineSegments {\n\n\tconstructor( object, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\t\tconst positions = new Float32Array( 8 * 3 );\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.object = object;\n\t\tthis.type = 'BoxHelper';\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\t}\n\n\tupdate( object ) {\n\n\t\tif ( object !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );\n\n\t\t}\n\n\t\tif ( this.object !== undefined ) {\n\n\t\t\t_box.setFromObject( this.object );\n\n\t\t}\n\n\t\tif ( _box.isEmpty() ) return;\n\n\t\tconst min = _box.min;\n\t\tconst max = _box.max;\n\n\t\t/*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tconst position = this.geometry.attributes.position;\n\t\tconst array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tsetFromObject( object ) {\n\n\t\tthis.object = object;\n\t\tthis.update();\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.object = source.object;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass Box3Helper extends LineSegments {\n\n\tconstructor( box, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\n\t\tconst positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.box = box;\n\n\t\tthis.type = 'Box3Helper';\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst box = this.box;\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tbox.getCenter( this.position );\n\n\t\tbox.getSize( this.scale );\n\n\t\tthis.scale.multiplyScalar( 0.5 );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass PlaneHelper extends Line {\n\n\tconstructor( plane, size = 1, hex = 0xffff00 ) {\n\n\t\tconst color = hex;\n\n\t\tconst positions = [ 1, - 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tgeometry.computeBoundingSphere();\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.type = 'PlaneHelper';\n\n\t\tthis.plane = plane;\n\n\t\tthis.size = size;\n\n\t\tconst positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];\n\n\t\tconst geometry2 = new BufferGeometry();\n\t\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\n\t\tgeometry2.computeBoundingSphere();\n\n\t\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tthis.position.set( 0, 0, 0 );\n\n\t\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, 1 );\n\n\t\tthis.lookAt( this.plane.normal );\n\n\t\tthis.translateZ( - this.plane.constant );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n}\n\nconst _axis = /*@__PURE__*/ new Vector3();\nlet _lineGeometry, _coneGeometry;\n\nclass ArrowHelper extends Object3D {\n\n\t// dir is assumed to be normalized\n\n\tconstructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ArrowHelper';\n\n\t\tif ( _lineGeometry === undefined ) {\n\n\t\t\t_lineGeometry = new BufferGeometry();\n\t\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\n\n\t\t\t_coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );\n\t\t\t_coneGeometry.translate( 0, - 0.5, 0 );\n\n\t\t}\n\n\t\tthis.position.copy( origin );\n\n\t\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.line.matrixAutoUpdate = false;\n\t\tthis.add( this.line );\n\n\t\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.cone.matrixAutoUpdate = false;\n\t\tthis.add( this.cone );\n\n\t\tthis.setDirection( dir );\n\t\tthis.setLength( length, headLength, headWidth );\n\n\t}\n\n\tsetDirection( dir ) {\n\n\t\t// dir is assumed to be normalized\n\n\t\tif ( dir.y > 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\n\n\t\t} else if ( dir.y < - 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\n\n\t\t\tconst radians = Math.acos( dir.y );\n\n\t\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\n\n\t\t}\n\n\t}\n\n\tsetLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\n\t\tthis.line.updateMatrix();\n\n\t\tthis.cone.scale.set( headWidth, headLength, headWidth );\n\t\tthis.cone.position.y = length;\n\t\tthis.cone.updateMatrix();\n\n\t}\n\n\tsetColor( color ) {\n\n\t\tthis.line.material.color.set( color );\n\t\tthis.cone.material.color.set( color );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tthis.line.copy( source.line );\n\t\tthis.cone.copy( source.cone );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.line.geometry.dispose();\n\t\tthis.line.material.dispose();\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n}\n\nclass AxesHelper extends LineSegments {\n\n\tconstructor( size = 1 ) {\n\n\t\tconst vertices = [\n\t\t\t0, 0, 0,\tsize, 0, 0,\n\t\t\t0, 0, 0,\t0, size, 0,\n\t\t\t0, 0, 0,\t0, 0, size\n\t\t];\n\n\t\tconst colors = [\n\t\t\t1, 0, 0,\t1, 0.6, 0,\n\t\t\t0, 1, 0,\t0.6, 1, 0,\n\t\t\t0, 0, 1,\t0, 0.6, 1\n\t\t];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'AxesHelper';\n\n\t}\n\n\tsetColors( xAxisColor, yAxisColor, zAxisColor ) {\n\n\t\tconst color = new Color();\n\t\tconst array = this.geometry.attributes.color.array;\n\n\t\tcolor.set( xAxisColor );\n\t\tcolor.toArray( array, 0 );\n\t\tcolor.toArray( array, 3 );\n\n\t\tcolor.set( yAxisColor );\n\t\tcolor.toArray( array, 6 );\n\t\tcolor.toArray( array, 9 );\n\n\t\tcolor.set( zAxisColor );\n\t\tcolor.toArray( array, 12 );\n\t\tcolor.toArray( array, 15 );\n\n\t\tthis.geometry.attributes.color.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass ShapePath {\n\n\tconstructor() {\n\n\t\tthis.type = 'ShapePath';\n\n\t\tthis.color = new Color();\n\n\t\tthis.subPaths = [];\n\t\tthis.currentPath = null;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t}\n\n\ttoShapes( isCCW ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tconst shapes = [];\n\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\n\n\t\t\t\tconst tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tconst polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tlet inside = false;\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tconst isClockWise = ShapeUtils.isClockWise;\n\n\t\tconst subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tlet solid, tmpPath, tmpShape;\n\t\tconst shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// console.log(\"Holes first\", holesFirst);\n\n\t\tconst betterShapeHoles = [];\n\t\tconst newShapes = [];\n\t\tlet newShapeHoles = [];\n\t\tlet mainIdx = 0;\n\t\tlet tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//console.log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//console.log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tlet ambiguous = false;\n\t\t\tlet toChange = 0;\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tconst ho = sho[ hIdx ];\n\t\t\t\t\tlet hole_unassigned = true;\n\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange ++;\n\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( toChange > 0 && ambiguous === false ) {\n\n\t\t\t\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet tmpHoles;\n\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//console.log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n}\n\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\n\t\trevision: REVISION,\n\t} } ) );\n\n}\n\nif ( typeof window !== 'undefined' ) {\n\n\tif ( window.__THREE__ ) {\n\n\t\tconsole.warn( 'WARNING: Multiple instances of Three.js being imported.' );\n\n\t} else {\n\n\t\twindow.__THREE__ = REVISION;\n\n\t}\n\n}\n\nexport { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Float64BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearDisplayP3ColorSpace, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, TwoPassDoubleSide, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL1Renderer, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, createCanvasElement, sRGBEncoding };\n", "import {\n\tBufferGeometry,\n\tFileLoader,\n\tFloat32BufferAttribute,\n\tLoader,\n\tColor\n} from 'three';\n\n/**\n * Description: A THREE loader for PLY ASCII files (known as the Polygon\n * File Format or the Stanford Triangle Format).\n *\n * Limitations: ASCII decoding assumes file is UTF-8.\n *\n * Usage:\n *\tconst loader = new PLYLoader();\n *\tloader.load('./models/ply/ascii/dolphins.ply', function (geometry) {\n *\n *\t\tscene.add( new THREE.Mesh( geometry ) );\n *\n *\t} );\n *\n * If the PLY file uses non standard property names, they can be mapped while\n * loading. For example, the following maps the properties\n * \u201Cdiffuse_(red|green|blue)\u201D in the file to standard color names.\n *\n * loader.setPropertyNameMapping( {\n *\tdiffuse_red: 'red',\n *\tdiffuse_green: 'green',\n *\tdiffuse_blue: 'blue'\n * } );\n *\n * Custom properties outside of the defaults for position, uv, normal\n * and color attributes can be added using the setCustomPropertyNameMapping method.\n * For example, the following maps the element properties \u201Ccustom_property_a\u201D\n * and \u201Ccustom_property_b\u201D to an attribute \u201CcustomAttribute\u201D with an item size of 2.\n * Attribute item sizes are set from the number of element properties in the property array.\n *\n * loader.setCustomPropertyNameMapping( {\n *\tcustomAttribute: ['custom_property_a', 'custom_property_b'],\n * } );\n *\n */\n\nconst _color = new Color();\n\nclass PLYLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tthis.propertyNameMapping = {};\n\t\tthis.customPropertyMapping = {};\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( text ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tsetPropertyNameMapping( mapping ) {\n\n\t\tthis.propertyNameMapping = mapping;\n\n\t}\n\n\tsetCustomPropertyNameMapping( mapping ) {\n\n\t\tthis.customPropertyMapping = mapping;\n\n\t}\n\n\tparse( data ) {\n\n\t\tfunction parseHeader( data, headerLength = 0 ) {\n\n\t\t\tconst patternHeader = /^ply([\\s\\S]*)end_header(\\r\\n|\\r|\\n)/;\n\t\t\tlet headerText = '';\n\t\t\tconst result = patternHeader.exec( data );\n\n\t\t\tif ( result !== null ) {\n\n\t\t\t\theaderText = result[ 1 ];\n\n\t\t\t}\n\n\t\t\tconst header = {\n\t\t\t\tcomments: [],\n\t\t\t\telements: [],\n\t\t\t\theaderLength: headerLength,\n\t\t\t\tobjInfo: ''\n\t\t\t};\n\n\t\t\tconst lines = headerText.split( /\\r\\n|\\r|\\n/ );\n\t\t\tlet currentElement;\n\n\t\t\tfunction make_ply_element_property( propertValues, propertyNameMapping ) {\n\n\t\t\t\tconst property = { type: propertValues[ 0 ] };\n\n\t\t\t\tif ( property.type === 'list' ) {\n\n\t\t\t\t\tproperty.name = propertValues[ 3 ];\n\t\t\t\t\tproperty.countType = propertValues[ 1 ];\n\t\t\t\t\tproperty.itemType = propertValues[ 2 ];\n\n\t\t\t\t} else {\n\n\t\t\t\t\tproperty.name = propertValues[ 1 ];\n\n\t\t\t\t}\n\n\t\t\t\tif ( property.name in propertyNameMapping ) {\n\n\t\t\t\t\tproperty.name = propertyNameMapping[ property.name ];\n\n\t\t\t\t}\n\n\t\t\t\treturn property;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < lines.length; i ++ ) {\n\n\t\t\t\tlet line = lines[ i ];\n\t\t\t\tline = line.trim();\n\n\t\t\t\tif ( line === '' ) continue;\n\n\t\t\t\tconst lineValues = line.split( /\\s+/ );\n\t\t\t\tconst lineType = lineValues.shift();\n\t\t\t\tline = lineValues.join( ' ' );\n\n\t\t\t\tswitch ( lineType ) {\n\n\t\t\t\t\tcase 'format':\n\n\t\t\t\t\t\theader.format = lineValues[ 0 ];\n\t\t\t\t\t\theader.version = lineValues[ 1 ];\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'comment':\n\n\t\t\t\t\t\theader.comments.push( line );\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'element':\n\n\t\t\t\t\t\tif ( currentElement !== undefined ) {\n\n\t\t\t\t\t\t\theader.elements.push( currentElement );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrentElement = {};\n\t\t\t\t\t\tcurrentElement.name = lineValues[ 0 ];\n\t\t\t\t\t\tcurrentElement.count = parseInt( lineValues[ 1 ] );\n\t\t\t\t\t\tcurrentElement.properties = [];\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'property':\n\n\t\t\t\t\t\tcurrentElement.properties.push( make_ply_element_property( lineValues, scope.propertyNameMapping ) );\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'obj_info':\n\n\t\t\t\t\t\theader.objInfo = line;\n\n\t\t\t\t\t\tbreak;\n\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tconsole.log( 'unhandled', lineType, lineValues );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( currentElement !== undefined ) {\n\n\t\t\t\theader.elements.push( currentElement );\n\n\t\t\t}\n\n\t\t\treturn header;\n\n\t\t}\n\n\t\tfunction parseASCIINumber( n, type ) {\n\n\t\t\tswitch ( type ) {\n\n\t\t\t\tcase 'char': case 'uchar': case 'short': case 'ushort': case 'int': case 'uint':\n\t\t\t\tcase 'int8': case 'uint8': case 'int16': case 'uint16': case 'int32': case 'uint32':\n\n\t\t\t\t\treturn parseInt( n );\n\n\t\t\t\tcase 'float': case 'double': case 'float32': case 'float64':\n\n\t\t\t\t\treturn parseFloat( n );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction parseASCIIElement( properties, tokens ) {\n\n\t\t\tconst element = {};\n\n\t\t\tfor ( let i = 0; i < properties.length; i ++ ) {\n\n\t\t\t\tif ( tokens.empty() ) return null;\n\n\t\t\t\tif ( properties[ i ].type === 'list' ) {\n\n\t\t\t\t\tconst list = [];\n\t\t\t\t\tconst n = parseASCIINumber( tokens.next(), properties[ i ].countType );\n\n\t\t\t\t\tfor ( let j = 0; j < n; j ++ ) {\n\n\t\t\t\t\t\tif ( tokens.empty() ) return null;\n\n\t\t\t\t\t\tlist.push( parseASCIINumber( tokens.next(), properties[ i ].itemType ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t\telement[ properties[ i ].name ] = list;\n\n\t\t\t\t} else {\n\n\t\t\t\t\telement[ properties[ i ].name ] = parseASCIINumber( tokens.next(), properties[ i ].type );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn element;\n\n\t\t}\n\n\t\tfunction createBuffer() {\n\n\t\t\tconst buffer = {\n\t\t\t indices: [],\n\t\t\t vertices: [],\n\t\t\t normals: [],\n\t\t\t uvs: [],\n\t\t\t faceVertexUvs: [],\n\t\t\t colors: [],\n\t\t\t faceVertexColors: []\n\t\t\t};\n\n\t\t\tfor ( const customProperty of Object.keys( scope.customPropertyMapping ) ) {\n\n\t\t\t buffer[ customProperty ] = [];\n\n\t\t\t}\n\n\t\t\treturn buffer;\n\n\t\t}\n\n\t\tfunction mapElementAttributes( properties ) {\n\n\t\t\tconst elementNames = properties.map( property => {\n\n\t\t\t\treturn property.name;\n\n\t\t\t} );\n\n\t\t\tfunction findAttrName( names ) {\n\n\t\t\t\tfor ( let i = 0, l = names.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst name = names[ i ];\n\n\t\t\t\t\tif ( elementNames.includes( name ) ) return name;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tattrX: findAttrName( [ 'x', 'px', 'posx' ] ) || 'x',\n\t\t\t\tattrY: findAttrName( [ 'y', 'py', 'posy' ] ) || 'y',\n\t\t\t\tattrZ: findAttrName( [ 'z', 'pz', 'posz' ] ) || 'z',\n\t\t\t\tattrNX: findAttrName( [ 'nx', 'normalx' ] ),\n\t\t\t\tattrNY: findAttrName( [ 'ny', 'normaly' ] ),\n\t\t\t\tattrNZ: findAttrName( [ 'nz', 'normalz' ] ),\n\t\t\t\tattrS: findAttrName( [ 's', 'u', 'texture_u', 'tx' ] ),\n\t\t\t\tattrT: findAttrName( [ 't', 'v', 'texture_v', 'ty' ] ),\n\t\t\t\tattrR: findAttrName( [ 'red', 'diffuse_red', 'r', 'diffuse_r' ] ),\n\t\t\t\tattrG: findAttrName( [ 'green', 'diffuse_green', 'g', 'diffuse_g' ] ),\n\t\t\t\tattrB: findAttrName( [ 'blue', 'diffuse_blue', 'b', 'diffuse_b' ] ),\n\t\t\t};\n\n\t\t}\n\n\t\tfunction parseASCII( data, header ) {\n\n\t\t\t// PLY ascii format specification, as per http://en.wikipedia.org/wiki/PLY_(file_format)\n\n\t\t\tconst buffer = createBuffer();\n\n\t\t\tconst patternBody = /end_header\\s+(\\S[\\s\\S]*\\S|\\S)\\s*$/;\n\t\t\tlet body, matches;\n\n\t\t\tif ( ( matches = patternBody.exec( data ) ) !== null ) {\n\n\t\t\t\tbody = matches[ 1 ].split( /\\s+/ );\n\n\t\t\t} else {\n\n\t\t\t\tbody = [ ];\n\n\t\t\t}\n\n\t\t\tconst tokens = new ArrayStream( body );\n\n\t\t\tloop: for ( let i = 0; i < header.elements.length; i ++ ) {\n\n\t\t\t\tconst elementDesc = header.elements[ i ];\n\t\t\t\tconst attributeMap = mapElementAttributes( elementDesc.properties );\n\n\t\t\t\tfor ( let j = 0; j < elementDesc.count; j ++ ) {\n\n\t\t\t\t\tconst element = parseASCIIElement( elementDesc.properties, tokens );\n\n\t\t\t\t\tif ( ! element ) break loop;\n\n\t\t\t\t\thandleElement( buffer, elementDesc.name, element, attributeMap );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn postProcess( buffer );\n\n\t\t}\n\n\t\tfunction postProcess( buffer ) {\n\n\t\t\tlet geometry = new BufferGeometry();\n\n\t\t\t// mandatory buffer data\n\n\t\t\tif ( buffer.indices.length > 0 ) {\n\n\t\t\t\tgeometry.setIndex( buffer.indices );\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( buffer.vertices, 3 ) );\n\n\t\t\t// optional buffer data\n\n\t\t\tif ( buffer.normals.length > 0 ) {\n\n\t\t\t\tgeometry.setAttribute( 'normal', new Float32BufferAttribute( buffer.normals, 3 ) );\n\n\t\t\t}\n\n\t\t\tif ( buffer.uvs.length > 0 ) {\n\n\t\t\t\tgeometry.setAttribute( 'uv', new Float32BufferAttribute( buffer.uvs, 2 ) );\n\n\t\t\t}\n\n\t\t\tif ( buffer.colors.length > 0 ) {\n\n\t\t\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( buffer.colors, 3 ) );\n\n\t\t\t}\n\n\t\t\tif ( buffer.faceVertexUvs.length > 0 || buffer.faceVertexColors.length > 0 ) {\n\n\t\t\t\tgeometry = geometry.toNonIndexed();\n\n\t\t\t\tif ( buffer.faceVertexUvs.length > 0 ) geometry.setAttribute( 'uv', new Float32BufferAttribute( buffer.faceVertexUvs, 2 ) );\n\t\t\t\tif ( buffer.faceVertexColors.length > 0 ) geometry.setAttribute( 'color', new Float32BufferAttribute( buffer.faceVertexColors, 3 ) );\n\n\t\t\t}\n\n\t\t\t// custom buffer data\n\n\t\t\tfor ( const customProperty of Object.keys( scope.customPropertyMapping ) ) {\n\n\t\t\t\tif ( buffer[ customProperty ].length > 0 ) {\n\n\t\t\t\t \tgeometry.setAttribute(\n\t\t\t\t\t\tcustomProperty,\n\t\t\t\t\t\tnew Float32BufferAttribute(\n\t\t\t\t\t \t\tbuffer[ customProperty ],\n\t\t\t\t\t \t\tscope.customPropertyMapping[ customProperty ].length\n\t\t\t\t\t\t)\n\t\t\t\t \t);\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tgeometry.computeBoundingSphere();\n\n\t\t\treturn geometry;\n\n\t\t}\n\n\t\tfunction handleElement( buffer, elementName, element, cacheEntry ) {\n\n\t\t\tif ( elementName === 'vertex' ) {\n\n\t\t\t\tbuffer.vertices.push( element[ cacheEntry.attrX ], element[ cacheEntry.attrY ], element[ cacheEntry.attrZ ] );\n\n\t\t\t\tif ( cacheEntry.attrNX !== null && cacheEntry.attrNY !== null && cacheEntry.attrNZ !== null ) {\n\n\t\t\t\t\tbuffer.normals.push( element[ cacheEntry.attrNX ], element[ cacheEntry.attrNY ], element[ cacheEntry.attrNZ ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( cacheEntry.attrS !== null && cacheEntry.attrT !== null ) {\n\n\t\t\t\t\tbuffer.uvs.push( element[ cacheEntry.attrS ], element[ cacheEntry.attrT ] );\n\n\t\t\t\t}\n\n\t\t\t\tif ( cacheEntry.attrR !== null && cacheEntry.attrG !== null && cacheEntry.attrB !== null ) {\n\n\t\t\t\t\t_color.setRGB(\n\t\t\t\t\t\telement[ cacheEntry.attrR ] / 255.0,\n\t\t\t\t\t\telement[ cacheEntry.attrG ] / 255.0,\n\t\t\t\t\t\telement[ cacheEntry.attrB ] / 255.0\n\t\t\t\t\t).convertSRGBToLinear();\n\n\t\t\t\t\tbuffer.colors.push( _color.r, _color.g, _color.b );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( const customProperty of Object.keys( scope.customPropertyMapping ) ) {\n\n\t\t\t\t\tfor ( const elementProperty of scope.customPropertyMapping[ customProperty ] ) {\n\n\t\t\t\t\t buffer[ customProperty ].push( element[ elementProperty ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( elementName === 'face' ) {\n\n\t\t\t\tconst vertex_indices = element.vertex_indices || element.vertex_index; // issue #9338\n\t\t\t\tconst texcoord = element.texcoord;\n\n\t\t\t\tif ( vertex_indices.length === 3 ) {\n\n\t\t\t\t\tbuffer.indices.push( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 2 ] );\n\n\t\t\t\t\tif ( texcoord && texcoord.length === 6 ) {\n\n\t\t\t\t\t\tbuffer.faceVertexUvs.push( texcoord[ 0 ], texcoord[ 1 ] );\n\t\t\t\t\t\tbuffer.faceVertexUvs.push( texcoord[ 2 ], texcoord[ 3 ] );\n\t\t\t\t\t\tbuffer.faceVertexUvs.push( texcoord[ 4 ], texcoord[ 5 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( vertex_indices.length === 4 ) {\n\n\t\t\t\t\tbuffer.indices.push( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 3 ] );\n\t\t\t\t\tbuffer.indices.push( vertex_indices[ 1 ], vertex_indices[ 2 ], vertex_indices[ 3 ] );\n\n\t\t\t\t}\n\n\t\t\t\t// face colors\n\n\t\t\t\tif ( cacheEntry.attrR !== null && cacheEntry.attrG !== null && cacheEntry.attrB !== null ) {\n\n\t\t\t\t\t_color.setRGB(\n\t\t\t\t\t\telement[ cacheEntry.attrR ] / 255.0,\n\t\t\t\t\t\telement[ cacheEntry.attrG ] / 255.0,\n\t\t\t\t\t\telement[ cacheEntry.attrB ] / 255.0\n\t\t\t\t\t).convertSRGBToLinear();\n\t\t\t\t\tbuffer.faceVertexColors.push( _color.r, _color.g, _color.b );\n\t\t\t\t\tbuffer.faceVertexColors.push( _color.r, _color.g, _color.b );\n\t\t\t\t\tbuffer.faceVertexColors.push( _color.r, _color.g, _color.b );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction binaryReadElement( at, properties ) {\n\n\t\t\tconst element = {};\n\t\t\tlet read = 0;\n\n\t\t\tfor ( let i = 0; i < properties.length; i ++ ) {\n\n\t\t\t\tconst property = properties[ i ];\n\t\t\t\tconst valueReader = property.valueReader;\n\n\t\t\t\tif ( property.type === 'list' ) {\n\n\t\t\t\t\tconst list = [];\n\n\t\t\t\t\tconst n = property.countReader.read( at + read );\n\t\t\t\t\tread += property.countReader.size;\n\n\t\t\t\t\tfor ( let j = 0; j < n; j ++ ) {\n\n\t\t\t\t\t\tlist.push( valueReader.read( at + read ) );\n\t\t\t\t\t\tread += valueReader.size;\n\n\t\t\t\t\t}\n\n\t\t\t\t\telement[ property.name ] = list;\n\n\t\t\t\t} else {\n\n\t\t\t\t\telement[ property.name ] = valueReader.read( at + read );\n\t\t\t\t\tread += valueReader.size;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn [ element, read ];\n\n\t\t}\n\n\t\tfunction setPropertyBinaryReaders( properties, body, little_endian ) {\n\n\t\t\tfunction getBinaryReader( dataview, type, little_endian ) {\n\n\t\t\t\tswitch ( type ) {\n\n\t\t\t\t\t// corespondences for non-specific length types here match rply:\n\t\t\t\t\tcase 'int8':\tcase 'char':\treturn { read: ( at ) => {\n\n\t\t\t\t\t\treturn dataview.getInt8( at );\n\n\t\t\t\t\t}, size: 1 };\n\t\t\t\t\tcase 'uint8':\tcase 'uchar':\treturn { read: ( at ) => {\n\n\t\t\t\t\t\treturn dataview.getUint8( at );\n\n\t\t\t\t\t}, size: 1 };\n\t\t\t\t\tcase 'int16':\tcase 'short':\treturn { read: ( at ) => {\n\n\t\t\t\t\t\treturn dataview.getInt16( at, little_endian );\n\n\t\t\t\t\t}, size: 2 };\n\t\t\t\t\tcase 'uint16':\tcase 'ushort':\treturn { read: ( at ) => {\n\n\t\t\t\t\t\treturn dataview.getUint16( at, little_endian );\n\n\t\t\t\t\t}, size: 2 };\n\t\t\t\t\tcase 'int32':\tcase 'int':\t\treturn { read: ( at ) => {\n\n\t\t\t\t\t\treturn dataview.getInt32( at, little_endian );\n\n\t\t\t\t\t}, size: 4 };\n\t\t\t\t\tcase 'uint32':\tcase 'uint':\treturn { read: ( at ) => {\n\n\t\t\t\t\t\treturn dataview.getUint32( at, little_endian );\n\n\t\t\t\t\t}, size: 4 };\n\t\t\t\t\tcase 'float32': case 'float':\treturn { read: ( at ) => {\n\n\t\t\t\t\t\treturn dataview.getFloat32( at, little_endian );\n\n\t\t\t\t\t}, size: 4 };\n\t\t\t\t\tcase 'float64': case 'double':\treturn { read: ( at ) => {\n\n\t\t\t\t\t\treturn dataview.getFloat64( at, little_endian );\n\n\t\t\t\t\t}, size: 8 };\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = properties.length; i < l; i ++ ) {\n\n\t\t\t\tconst property = properties[ i ];\n\n\t\t\t\tif ( property.type === 'list' ) {\n\n\t\t\t\t\tproperty.countReader = getBinaryReader( body, property.countType, little_endian );\n\t\t\t\t\tproperty.valueReader = getBinaryReader( body, property.itemType, little_endian );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tproperty.valueReader = getBinaryReader( body, property.type, little_endian );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction parseBinary( data, header ) {\n\n\t\t\tconst buffer = createBuffer();\n\n\t\t\tconst little_endian = ( header.format === 'binary_little_endian' );\n\t\t\tconst body = new DataView( data, header.headerLength );\n\t\t\tlet result, loc = 0;\n\n\t\t\tfor ( let currentElement = 0; currentElement < header.elements.length; currentElement ++ ) {\n\n\t\t\t\tconst elementDesc = header.elements[ currentElement ];\n\t\t\t\tconst properties = elementDesc.properties;\n\t\t\t\tconst attributeMap = mapElementAttributes( properties );\n\n\t\t\t\tsetPropertyBinaryReaders( properties, body, little_endian );\n\n\t\t\t\tfor ( let currentElementCount = 0; currentElementCount < elementDesc.count; currentElementCount ++ ) {\n\n\t\t\t\t\tresult = binaryReadElement( loc, properties );\n\t\t\t\t\tloc += result[ 1 ];\n\t\t\t\t\tconst element = result[ 0 ];\n\n\t\t\t\t\thandleElement( buffer, elementDesc.name, element, attributeMap );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn postProcess( buffer );\n\n\t\t}\n\n\t\tfunction extractHeaderText( bytes ) {\n\n\t\t\tlet i = 0;\n\t\t\tlet cont = true;\n\n\t\t\tlet line = '';\n\t\t\tconst lines = [];\n\n\t\t\tconst startLine = new TextDecoder().decode( bytes.subarray( 0, 5 ) );\n\t\t\tconst hasCRNL = /^ply\\r\\n/.test( startLine );\n\n\t\t\tdo {\n\n\t\t\t\tconst c = String.fromCharCode( bytes[ i ++ ] );\n\n\t\t\t\tif ( c !== '\\n' && c !== '\\r' ) {\n\n\t\t\t\t\tline += c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( line === 'end_header' ) cont = false;\n\t\t\t\t\tif ( line !== '' ) {\n\n\t\t\t\t\t\tlines.push( line );\n\t\t\t\t\t\tline = '';\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} while ( cont && i < bytes.length );\n\n\t\t\t// ascii section using \\r\\n as line endings\n\t\t\tif ( hasCRNL === true ) i ++;\n\n\t\t\treturn { headerText: lines.join( '\\r' ) + '\\r', headerLength: i };\n\n\t\t}\n\n\t\t//\n\n\t\tlet geometry;\n\t\tconst scope = this;\n\n\t\tif ( data instanceof ArrayBuffer ) {\n\n\t\t\tconst bytes = new Uint8Array( data );\n\t\t\tconst { headerText, headerLength } = extractHeaderText( bytes );\n\t\t\tconst header = parseHeader( headerText, headerLength );\n\n\t\t\tif ( header.format === 'ascii' ) {\n\n\t\t\t\tconst text = new TextDecoder().decode( bytes );\n\n\t\t\t\tgeometry = parseASCII( text, header );\n\n\t\t\t} else {\n\n\t\t\t\tgeometry = parseBinary( data, header );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tgeometry = parseASCII( data, parseHeader( data ) );\n\n\t\t}\n\n\t\treturn geometry;\n\n\t}\n\n}\n\nclass ArrayStream {\n\n\tconstructor( arr ) {\n\n\t\tthis.arr = arr;\n\t\tthis.i = 0;\n\n\t}\n\n\tempty() {\n\n\t\treturn this.i >= this.arr.length;\n\n\t}\n\n\tnext() {\n\n\t\treturn this.arr[ this.i ++ ];\n\n\t}\n\n}\n\nexport { PLYLoader };\n", "import type {Constructor} from 'lowclass'\nimport type {GLTF} from 'three/examples/jsm/loaders/GLTFLoader.js'\nimport type {Collada} from 'three/examples/jsm/loaders/ColladaLoader.js'\nimport type {Group} from 'three/src/objects/Group.js'\nimport type {BufferGeometry} from 'three/src/core/BufferGeometry.js'\n\nexport class EventTypes {\n\tconstructor(\n\t\t// This event is fired when a *-model element, or a node element with a\n\t\t// *-model behavior, has loaded it's model.\n\t\tpublic MODEL_LOAD: {\n\t\t\tformat: 'obj' | 'gltf' | 'collada' | 'fbx' | 'ply'\n\t\t\tmodel: Group | GLTF | Collada | BufferGeometry\n\t\t},\n\t\t// Fired if a *-model element, or node element with *-model behavior,\n\t\t// has an error during load.\n\t\tpublic MODEL_ERROR: Error,\n\t\t// Fired by elements that load resources. See\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/ProgressEvent\n\t\tpublic PROGRESS: ProgressEvent,\n\t) {}\n}\n\nexport const Events = makeEnumFromClassProperties(EventTypes)\n\n// loop on the keys of a dummy class instance in order to create an enum-like\n// object.\nexport function makeEnumFromClassProperties(Class: Constructor) {\n\tconst Enum = {} as any\n\n\tfor (const key in new (Class as any)()) {\n\t\tEnum[key] = key\n\t}\n\n\treturn Object.freeze(Enum as {[k in keyof T]: k})\n}\n", "import {signal} from 'classy-solid'\nimport 'element-behaviors'\nimport {stringAttribute} from '@lume/element'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {PLYLoader} from 'three/examples/jsm/loaders/PLYLoader.js'\nimport {BufferGeometry} from 'three/src/core/BufferGeometry.js'\nimport {Events} from '../../../core/Events.js'\nimport {GeometryBehavior} from './GeometryBehavior.js'\nimport {onCleanup} from 'solid-js'\n\n/**\n * @class PlyGeometryBehavior -\n *\n * Behavior: `ply-geometry`\n *\n * This is useful for rendering a set of points from a `.ply` file.\n *\n * Given a `src` attribute that points to a `.ply` file, the behavior will load\n * a set of points from the file to use as geometry.\n *\n * It can be useful to use this behavior on a\n * [``](../../../meshes/Points) element, which has a\n * [`points-material`](../materials/PointsMaterialBehavior) behavior for\n * configuring how points are rendered.\n *\n * @extends GeometryBehavior\n */\nexport\n@behavior\nclass PlyGeometryBehavior extends GeometryBehavior {\n\t/**\n\t * @property {string} src\n\t *\n\t * `string` `attribute`\n\t *\n\t * Default: `''`\n\t *\n\t * Path to a `.ply` file to load points from.\n\t */\n\t@stringAttribute @receiver src = ''\n\n\tloader = new PLYLoader()\n\t@signal model: BufferGeometry | null = null\n\n\toverride _createComponent() {\n\t\t// An empty geometry to start with. It will be replaced once the PLY file is loaded.\n\t\tif (!this.model) return new BufferGeometry()\n\t\treturn this.model\n\t}\n\n\t// This is incremented any time we need to cancel a pending load() (f.e. on\n\t// src change, or on disconnect), so that the loader will ignore the\n\t// result when a version change has happened.\n\t#version = 0\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.src\n\n\t\t\tthis.#loadModel()\n\n\t\t\tonCleanup(() => {\n\t\t\t\tthis.model?.dispose()\n\t\t\t\t// Note that dispose is already called in the super.resetMeshComponent process.\n\t\t\t\tthis.model = null\n\t\t\t\t// Increment this in case the loader is still loading, so it will ignore the result.\n\t\t\t\tthis.#version++\n\t\t\t})\n\t\t})\n\t}\n\n\t#loadModel() {\n\t\tconst {src} = this\n\t\tconst version = this.#version\n\n\t\tif (!src) return\n\n\t\t// In the following fbxLoader.load() callbacks, if #version doesn't\n\t\t// match, it means this.src or this.dracoDecoder changed while\n\t\t// a previous model was loading, in which case we ignore that\n\t\t// result and wait for the next model to load.\n\n\t\tthis.loader!.load(\n\t\t\tsrc,\n\t\t\tmodel => version === this.#version && this.#setModel(model),\n\t\t\tprogress => version === this.#version && this.element.emit(Events.PROGRESS, progress),\n\t\t\terror => version === this.#version && this.#onError(error),\n\t\t)\n\t}\n\n\t#onError(error: unknown) {\n\t\tconst message = `Failed to load ${this.element.tagName.toLowerCase()} with src \"${\n\t\t\tthis.src\n\t\t}\". See the following error.`\n\t\tconsole.warn(message)\n\t\tconst err = error instanceof ErrorEvent && error.error ? error.error : error\n\t\tconsole.error(err)\n\t\tthis.element.emit(Events.MODEL_ERROR, err)\n\t}\n\n\t#setModel(model: BufferGeometry) {\n\t\tmodel.computeVertexNormals()\n\t\tthis.model = model // triggers the resetMeshComponent effect\n\t\tthis.element.emit(Events.MODEL_LOAD, {format: 'ply', model})\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('ply-geometry'))\n\telementBehaviors.define('ply-geometry', PlyGeometryBehavior)\n", "import * as MathUtils from '../../math/MathUtils.js';\nimport { Vector2 } from '../../math/Vector2.js';\nimport { Vector3 } from '../../math/Vector3.js';\nimport { Matrix4 } from '../../math/Matrix4.js';\n\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\n\nclass Curve {\n\n\tconstructor() {\n\n\t\tthis.type = 'Curve';\n\n\t\tthis.arcLengthDivisions = 200;\n\n\t}\n\n\t// Virtual base class method to overwrite and implement in subclasses\n\t//\t- t [0 .. 1]\n\n\tgetPoint( /* t, optionalTarget */ ) {\n\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\n\t\treturn null;\n\n\t}\n\n\t// Get point at relative position in curve according to arc length\n\t// - u [0 .. 1]\n\n\tgetPointAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t}\n\n\t// Get sequence of points using getPoint( t )\n\n\tgetPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get sequence of points using getPointAt( u )\n\n\tgetSpacedPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get total curve arc length\n\n\tgetLength() {\n\n\t\tconst lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t}\n\n\t// Get list of cumulative segment lengths\n\n\tgetLengths( divisions = this.arcLengthDivisions ) {\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tconst cache = [];\n\t\tlet current, last = this.getPoint( 0 );\n\t\tlet sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t}\n\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t}\n\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n\n\tgetUtoTmapping( u, distance ) {\n\n\t\tconst arcLengths = this.getLengths();\n\n\t\tlet i = 0;\n\t\tconst il = arcLengths.length;\n\n\t\tlet targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tlet low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tconst lengthBefore = arcLengths[ i ];\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\n\n\t\tconst segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t}\n\n\t// Returns a unit vector tangent at t\n\t// In case any sub curve does not implement its tangent derivation,\n\t// 2 points a small delta apart will be used to find its gradient\n\t// which seems to give a reasonable approximation\n\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst delta = 0.0001;\n\t\tlet t1 = t - delta;\n\t\tlet t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tconst pt1 = this.getPoint( t1 );\n\t\tconst pt2 = this.getPoint( t2 );\n\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\n\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t, optionalTarget );\n\n\t}\n\n\tcomputeFrenetFrames( segments, closed ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tconst normal = new Vector3();\n\n\t\tconst tangents = [];\n\t\tconst normals = [];\n\t\tconst binormals = [];\n\n\t\tconst vec = new Vector3();\n\t\tconst mat = new Matrix4();\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst u = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tlet min = Number.MAX_VALUE;\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\tconst theta = Math.acos( MathUtils.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\tlet theta = Math.acos( MathUtils.clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nexport { Curve };\n", "export { ArcCurve } from './ArcCurve.js';\nexport { CatmullRomCurve3 } from './CatmullRomCurve3.js';\nexport { CubicBezierCurve } from './CubicBezierCurve.js';\nexport { CubicBezierCurve3 } from './CubicBezierCurve3.js';\nexport { EllipseCurve } from './EllipseCurve.js';\nexport { LineCurve } from './LineCurve.js';\nexport { LineCurve3 } from './LineCurve3.js';\nexport { QuadraticBezierCurve } from './QuadraticBezierCurve.js';\nexport { QuadraticBezierCurve3 } from './QuadraticBezierCurve3.js';\nexport { SplineCurve } from './SplineCurve.js';\n", "import { Curve } from '../core/Curve.js';\nimport { Vector2 } from '../../math/Vector2.js';\n\nclass EllipseCurve extends Curve {\n\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.isEllipseCurve = true;\n\n\t\tthis.type = 'EllipseCurve';\n\n\t\tthis.aX = aX;\n\t\tthis.aY = aY;\n\n\t\tthis.xRadius = xRadius;\n\t\tthis.yRadius = yRadius;\n\n\t\tthis.aStartAngle = aStartAngle;\n\t\tthis.aEndAngle = aEndAngle;\n\n\t\tthis.aClockwise = aClockwise;\n\n\t\tthis.aRotation = aRotation;\n\n\t}\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst point = optionalTarget || new Vector2();\n\n\t\tconst twoPi = Math.PI * 2;\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t\t// ensures that deltaAngle is 0 .. 2 PI\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\t\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\t\tif ( samePoints ) {\n\n\t\t\t\tdeltaAngle = 0;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\t\tdeltaAngle = - twoPi;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\n\n\t\tif ( this.aRotation !== 0 ) {\n\n\t\t\tconst cos = Math.cos( this.aRotation );\n\t\t\tconst sin = Math.sin( this.aRotation );\n\n\t\t\tconst tx = x - this.aX;\n\t\t\tconst ty = y - this.aY;\n\n\t\t\t// Rotate the point about the center of the ellipse.\n\t\t\tx = tx * cos - ty * sin + this.aX;\n\t\t\ty = tx * sin + ty * cos + this.aY;\n\n\t\t}\n\n\t\treturn point.set( x, y );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.aX = source.aX;\n\t\tthis.aY = source.aY;\n\n\t\tthis.xRadius = source.xRadius;\n\t\tthis.yRadius = source.yRadius;\n\n\t\tthis.aStartAngle = source.aStartAngle;\n\t\tthis.aEndAngle = source.aEndAngle;\n\n\t\tthis.aClockwise = source.aClockwise;\n\n\t\tthis.aRotation = source.aRotation;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.aX = this.aX;\n\t\tdata.aY = this.aY;\n\n\t\tdata.xRadius = this.xRadius;\n\t\tdata.yRadius = this.yRadius;\n\n\t\tdata.aStartAngle = this.aStartAngle;\n\t\tdata.aEndAngle = this.aEndAngle;\n\n\t\tdata.aClockwise = this.aClockwise;\n\n\t\tdata.aRotation = this.aRotation;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.aX = json.aX;\n\t\tthis.aY = json.aY;\n\n\t\tthis.xRadius = json.xRadius;\n\t\tthis.yRadius = json.yRadius;\n\n\t\tthis.aStartAngle = json.aStartAngle;\n\t\tthis.aEndAngle = json.aEndAngle;\n\n\t\tthis.aClockwise = json.aClockwise;\n\n\t\tthis.aRotation = json.aRotation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { EllipseCurve };\n", "import { EllipseCurve } from './EllipseCurve.js';\n\nclass ArcCurve extends EllipseCurve {\n\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\tthis.isArcCurve = true;\n\n\t\tthis.type = 'ArcCurve';\n\n\t}\n\n}\n\nexport { ArcCurve };\n", "import { Vector3 } from '../../math/Vector3.js';\nimport { Curve } from '../core/Curve.js';\n\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n\n\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\n\nfunction CubicPoly() {\n\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tconst t2 = t * t;\n\t\t\tconst t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nconst tmp = /*@__PURE__*/ new Vector3();\nconst px = /*@__PURE__*/ new CubicPoly();\nconst py = /*@__PURE__*/ new CubicPoly();\nconst pz = /*@__PURE__*/ new CubicPoly();\n\nclass CatmullRomCurve3 extends Curve {\n\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\n\n\t\tsuper();\n\n\t\tthis.isCatmullRomCurve3 = true;\n\n\t\tthis.type = 'CatmullRomCurve3';\n\n\t\tthis.points = points;\n\t\tthis.closed = closed;\n\t\tthis.curveType = curveType;\n\t\tthis.tension = tension;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst l = points.length;\n\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\t\tlet intPoint = Math.floor( p );\n\t\tlet weight = p - intPoint;\n\n\t\tif ( this.closed ) {\n\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\t\tintPoint = l - 2;\n\t\t\tweight = 1;\n\n\t\t}\n\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\n\n\t\tif ( this.closed || intPoint > 0 ) {\n\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate first point\n\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\t\tp0 = tmp;\n\n\t\t}\n\n\t\tconst p1 = points[ intPoint % l ];\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\n\n\t\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate last point\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\t\tp3 = tmp;\n\n\t\t}\n\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t\t// init Centripetal / Chordal Catmull-Rom\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t\t// safety check for repeated points\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t\t}\n\n\t\tpoint.set(\n\t\t\tpx.calc( weight ),\n\t\t\tpy.calc( weight ),\n\t\t\tpz.calc( weight )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\tthis.closed = source.closed;\n\t\tthis.curveType = source.curveType;\n\t\tthis.tension = source.tension;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\tdata.closed = this.closed;\n\t\tdata.curveType = this.curveType;\n\t\tdata.tension = this.tension;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t\t}\n\n\t\tthis.closed = json.closed;\n\t\tthis.curveType = json.curveType;\n\t\tthis.tension = json.tension;\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { CatmullRomCurve3 };\n", "/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */\n\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tconst v0 = ( p2 - p0 ) * 0.5;\n\tconst v1 = ( p3 - p1 ) * 0.5;\n\tconst t2 = t * t;\n\tconst t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tconst k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\nexport { CatmullRom, QuadraticBezier, CubicBezier };\n", "import { Curve } from '../core/Curve.js';\nimport { CubicBezier } from '../core/Interpolations.js';\nimport { Vector2 } from '../../math/Vector2.js';\n\nclass CubicBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve = true;\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { CubicBezierCurve };\n", "import { Curve } from '../core/Curve.js';\nimport { CubicBezier } from '../core/Interpolations.js';\nimport { Vector3 } from '../../math/Vector3.js';\n\nclass CubicBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isCubicBezierCurve3 = true;\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { CubicBezierCurve3 };\n", "import { Vector2 } from '../../math/Vector2.js';\nimport { Curve } from '../core/Curve.js';\n\nclass LineCurve extends Curve {\n\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve = true;\n\n\t\tthis.type = 'LineCurve';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector2() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { LineCurve };\n", "import { Vector3 } from '../../math/Vector3.js';\nimport { Curve } from '../core/Curve.js';\n\nclass LineCurve3 extends Curve {\n\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isLineCurve3 = true;\n\n\t\tthis.type = 'LineCurve3';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget = new Vector3() ) {\n\n\t\treturn optionalTarget.subVectors( this.v2, this.v1 ).normalize();\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\treturn this.getTangent( u, optionalTarget );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { LineCurve3 };\n", "import { Curve } from '../core/Curve.js';\nimport { QuadraticBezier } from '../core/Interpolations.js';\nimport { Vector2 } from '../../math/Vector2.js';\n\nclass QuadraticBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve = true;\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { QuadraticBezierCurve };\n", "import { Curve } from '../core/Curve.js';\nimport { QuadraticBezier } from '../core/Interpolations.js';\nimport { Vector3 } from '../../math/Vector3.js';\n\nclass QuadraticBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.isQuadraticBezierCurve3 = true;\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { QuadraticBezierCurve3 };\n", "import { Curve } from '../core/Curve.js';\nimport { CatmullRom } from '../core/Interpolations.js';\nimport { Vector2 } from '../../math/Vector2.js';\n\nclass SplineCurve extends Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.isSplineCurve = true;\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { SplineCurve };\n", "import { Curve } from './Curve.js';\nimport * as Curves from '../curves/Curves.js';\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\n\nclass CurvePath extends Curve {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'CurvePath';\n\n\t\tthis.curves = [];\n\t\tthis.autoClose = false; // Automatically closes the path\n\n\t}\n\n\tadd( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t}\n\n\tclosePath() {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tconst lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';\n\t\t\tthis.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// To get accurate point with reference to\n\t// entire path distance at time t,\n\t// following has to be done:\n\n\t// 1. Length of each sub path have to be known\n\t// 2. Locate and identify type of curve\n\t// 3. Get t for the curve\n\t// 4. Return curve.getPointAt(t')\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst d = t * this.getLength();\n\t\tconst curveLengths = this.getCurveLengths();\n\t\tlet i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tconst diff = curveLengths[ i ] - d;\n\t\t\t\tconst curve = this.curves[ i ];\n\n\t\t\t\tconst segmentLength = curve.getLength();\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nexport { CurvePath };\n", "import { Vector2 } from '../../math/Vector2.js';\nimport { CurvePath } from './CurvePath.js';\nimport { EllipseCurve } from '../curves/EllipseCurve.js';\nimport { SplineCurve } from '../curves/SplineCurve.js';\nimport { CubicBezierCurve } from '../curves/CubicBezierCurve.js';\nimport { QuadraticBezierCurve } from '../curves/QuadraticBezierCurve.js';\nimport { LineCurve } from '../curves/LineCurve.js';\n\nclass Path extends CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nexport { Path };\n", "import { Path } from './Path.js';\nimport * as MathUtils from '../../math/MathUtils.js';\n\nclass Shape extends Path {\n\n\tconstructor( points ) {\n\n\t\tsuper( points );\n\n\t\tthis.uuid = MathUtils.generateUUID();\n\n\t\tthis.type = 'Shape';\n\n\t\tthis.holes = [];\n\n\t}\n\n\tgetPointsHoles( divisions ) {\n\n\t\tconst holesPts = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t}\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\textractPoints( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n\nexport { Shape };\n", "/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */\n\nconst Earcut = {\n\n\ttriangulate: function ( data, holeIndices, dim = 2 ) {\n\n\t\tconst hasHoles = holeIndices && holeIndices.length;\n\t\tconst outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;\n\t\tlet outerNode = linkedList( data, 0, outerLen, dim, true );\n\t\tconst triangles = [];\n\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\n\n\t\tlet minX, minY, maxX, maxY, x, y, invSize;\n\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\n\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t\tif ( data.length > 80 * dim ) {\n\n\t\t\tminX = maxX = data[ 0 ];\n\t\t\tminY = maxY = data[ 1 ];\n\n\t\t\tfor ( let i = dim; i < outerLen; i += dim ) {\n\n\t\t\t\tx = data[ i ];\n\t\t\t\ty = data[ i + 1 ];\n\t\t\t\tif ( x < minX ) minX = x;\n\t\t\t\tif ( y < minY ) minY = y;\n\t\t\t\tif ( x > maxX ) maxX = x;\n\t\t\t\tif ( y > maxY ) maxY = y;\n\n\t\t\t}\n\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\n\t\t\tinvSize = invSize !== 0 ? 32767 / invSize : 0;\n\n\t\t}\n\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize, 0 );\n\n\t\treturn triangles;\n\n\t}\n\n};\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList( data, start, end, dim, clockwise ) {\n\n\tlet i, last;\n\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\n\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t} else {\n\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t}\n\n\tif ( last && equals( last, last.next ) ) {\n\n\t\tremoveNode( last );\n\t\tlast = last.next;\n\n\t}\n\n\treturn last;\n\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tlet p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) {\n\n\tif ( ! ear ) return;\n\n\t// interlink polygon nodes in z-order\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\n\n\tlet stop = ear,\n\t\tprev, next;\n\n\t// iterate through ears, slicing them one by one\n\twhile ( ear.prev !== ear.next ) {\n\n\t\tprev = ear.prev;\n\t\tnext = ear.next;\n\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\n\n\t\t\t// cut off the triangle\n\t\t\ttriangles.push( prev.i / dim | 0 );\n\t\t\ttriangles.push( ear.i / dim | 0 );\n\t\t\ttriangles.push( next.i / dim | 0 );\n\n\t\t\tremoveNode( ear );\n\n\t\t\t// skipping the next vertex leads to less sliver triangles\n\t\t\tear = next.next;\n\t\t\tstop = next.next;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tear = next;\n\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\n\t\tif ( ear === stop ) {\n\n\t\t\t// try filtering points and slicing again\n\t\t\tif ( ! pass ) {\n\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\n\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\n\n\t\t\t} else if ( pass === 1 ) {\n\n\t\t\t\tear = cureLocalIntersections( filterPoints( ear ), triangles, dim );\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\n\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\n\n\t\t\t} else if ( pass === 2 ) {\n\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\n\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar( ear ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// now make sure we don't have other points inside the potential ear\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\tlet p = c.next;\n\twhile ( p !== a ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.next;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction isEarHashed( ear, minX, minY, invSize ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\tconst ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst x0 = ax < bx ? ( ax < cx ? ax : cx ) : ( bx < cx ? bx : cx ),\n\t\ty0 = ay < by ? ( ay < cy ? ay : cy ) : ( by < cy ? by : cy ),\n\t\tx1 = ax > bx ? ( ax > cx ? ax : cx ) : ( bx > cx ? bx : cx ),\n\t\ty1 = ay > by ? ( ay > cy ? ay : cy ) : ( by > cy ? by : cy );\n\n\t// z-order range for the current triangle bbox;\n\tconst minZ = zOrder( x0, y0, minX, minY, invSize ),\n\t\tmaxZ = zOrder( x1, y1, minX, minY, invSize );\n\n\tlet p = ear.prevZ,\n\t\tn = ear.nextZ;\n\n\t// look for points inside the triangle in both directions\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\t// look for remaining points in decreasing z-order\n\twhile ( p && p.z >= minZ ) {\n\n\t\tif ( p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, p.x, p.y ) && area( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t}\n\n\t// look for remaining points in increasing z-order\n\twhile ( n && n.z <= maxZ ) {\n\n\t\tif ( n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n\t\t\tpointInTriangle( ax, ay, bx, by, cx, cy, n.x, n.y ) && area( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\treturn true;\n\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections( start, triangles, dim ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tconst a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim | 0 );\n\t\t\ttriangles.push( p.i / dim | 0 );\n\t\t\ttriangles.push( b.i / dim | 0 );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn filterPoints( p );\n\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\n\n\t// look for a valid diagonal that divides the polygon into two\n\tlet a = start;\n\tdo {\n\n\t\tlet b = a.next.next;\n\t\twhile ( b !== a.prev ) {\n\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\n\n\t\t\t\t// split the polygon in two by the diagonal\n\t\t\t\tlet c = splitPolygon( a, b );\n\n\t\t\t\t// filter colinear points around the cuts\n\t\t\t\ta = filterPoints( a, a.next );\n\t\t\t\tc = filterPoints( c, c.next );\n\n\t\t\t\t// run earcut on each half\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize, 0 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tb = b.next;\n\n\t\t}\n\n\t\ta = a.next;\n\n\t} while ( a !== start );\n\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\n\n\tconst queue = [];\n\tlet i, len, start, end, list;\n\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\n\n\t\tstart = holeIndices[ i ] * dim;\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\n\t\tlist = linkedList( data, start, end, dim, false );\n\t\tif ( list === list.next ) list.steiner = true;\n\t\tqueue.push( getLeftmost( list ) );\n\n\t}\n\n\tqueue.sort( compareX );\n\n\t// process holes from left to right\n\tfor ( i = 0; i < queue.length; i ++ ) {\n\n\t\touterNode = eliminateHole( queue[ i ], outerNode );\n\n\t}\n\n\treturn outerNode;\n\n}\n\nfunction compareX( a, b ) {\n\n\treturn a.x - b.x;\n\n}\n\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction eliminateHole( hole, outerNode ) {\n\n\tconst bridge = findHoleBridge( hole, outerNode );\n\tif ( ! bridge ) {\n\n\t\treturn outerNode;\n\n\t}\n\n\tconst bridgeReverse = splitPolygon( bridge, hole );\n\n\t// filter collinear points around the cuts\n\tfilterPoints( bridgeReverse, bridgeReverse.next );\n\treturn filterPoints( bridge, bridge.next );\n\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge( hole, outerNode ) {\n\n\tlet p = outerNode,\n\t\tqx = - Infinity,\n\t\tm;\n\n\tconst hx = hole.x, hy = hole.y;\n\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\n\t// segment's endpoint with lesser x will be potential connection point\n\tdo {\n\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\n\n\t\t\tconst x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\n\t\t\tif ( x <= hx && x > qx ) {\n\n\t\t\t\tqx = x;\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\n\t\t\t\tif ( x === hx ) return m; // hole touches outer segment; pick leftmost endpoint\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== outerNode );\n\n\tif ( ! m ) return null;\n\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\n\t// if there are no points found, we have a valid connection;\n\t// otherwise choose the point of the minimum angle with the ray as connection point\n\n\tconst stop = m,\n\t\tmx = m.x,\n\t\tmy = m.y;\n\tlet tanMin = Infinity, tan;\n\n\tp = m;\n\n\tdo {\n\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\n\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\n\n\t\t\tif ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) {\n\n\t\t\t\tm = p;\n\t\t\t\ttanMin = tan;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== stop );\n\n\treturn m;\n\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector( m, p ) {\n\n\treturn area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0;\n\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve( start, minX, minY, invSize ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tif ( p.z === 0 ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\n\t\tp.prevZ = p.prev;\n\t\tp.nextZ = p.next;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\tp.prevZ.nextZ = null;\n\tp.prevZ = null;\n\n\tsortLinked( p );\n\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked( list ) {\n\n\tlet i, p, q, e, tail, numMerges, pSize, qSize,\n\t\tinSize = 1;\n\n\tdo {\n\n\t\tp = list;\n\t\tlist = null;\n\t\ttail = null;\n\t\tnumMerges = 0;\n\n\t\twhile ( p ) {\n\n\t\t\tnumMerges ++;\n\t\t\tq = p;\n\t\t\tpSize = 0;\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\n\n\t\t\t\tpSize ++;\n\t\t\t\tq = q.nextZ;\n\t\t\t\tif ( ! q ) break;\n\n\t\t\t}\n\n\t\t\tqSize = inSize;\n\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\n\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\n\n\t\t\t\t\te = p;\n\t\t\t\t\tp = p.nextZ;\n\t\t\t\t\tpSize --;\n\n\t\t\t\t} else {\n\n\t\t\t\t\te = q;\n\t\t\t\t\tq = q.nextZ;\n\t\t\t\t\tqSize --;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tail ) tail.nextZ = e;\n\t\t\t\telse list = e;\n\n\t\t\t\te.prevZ = tail;\n\t\t\t\ttail = e;\n\n\t\t\t}\n\n\t\t\tp = q;\n\n\t\t}\n\n\t\ttail.nextZ = null;\n\t\tinSize *= 2;\n\n\t} while ( numMerges > 1 );\n\n\treturn list;\n\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = ( x - minX ) * invSize | 0;\n\ty = ( y - minY ) * invSize | 0;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost( start ) {\n\n\tlet p = start,\n\t\tleftmost = start;\n\tdo {\n\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn leftmost;\n\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) >= ( ax - px ) * ( cy - py ) &&\n ( ax - px ) * ( by - py ) >= ( bx - px ) * ( ay - py ) &&\n ( bx - px ) * ( cy - py ) >= ( cx - px ) * ( by - py );\n\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal( a, b ) {\n\n\treturn a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges\n ( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible\n ( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors\n equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case\n\n}\n\n// signed area of a triangle\nfunction area( p, q, r ) {\n\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\n\n}\n\n// check if two points are equal\nfunction equals( p1, p2 ) {\n\n\treturn p1.x === p2.x && p1.y === p2.y;\n\n}\n\n// check if two segments intersect\nfunction intersects( p1, q1, p2, q2 ) {\n\n\tconst o1 = sign( area( p1, q1, p2 ) );\n\tconst o2 = sign( area( p1, q1, q2 ) );\n\tconst o3 = sign( area( p2, q2, p1 ) );\n\tconst o4 = sign( area( p2, q2, q1 ) );\n\n\tif ( o1 !== o2 && o3 !== o4 ) return true; // general case\n\n\tif ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n\tif ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n\tif ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n\tif ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n\treturn false;\n\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}\n\nfunction sign( num ) {\n\n\treturn num > 0 ? 1 : num < 0 ? - 1 : 0;\n\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon( a, b ) {\n\n\tlet p = a;\n\tdo {\n\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t\t\tintersects( p, p.next, a, b ) ) return true;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn false;\n\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside( a, b ) {\n\n\treturn area( a.prev, a, a.next ) < 0 ?\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\n\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside( a, b ) {\n\n\tlet p = a,\n\t\tinside = false;\n\tconst px = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon( a, b ) {\n\n\tconst a2 = new Node( a.i, a.x, a.y ),\n\t\tb2 = new Node( b.i, b.x, b.y ),\n\t\tan = a.next,\n\t\tbp = b.prev;\n\n\ta.next = b;\n\tb.prev = a;\n\n\ta2.next = an;\n\tan.prev = a2;\n\n\tb2.next = a2;\n\ta2.prev = b2;\n\n\tbp.next = b2;\n\tb2.prev = bp;\n\n\treturn b2;\n\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode( i, x, y, last ) {\n\n\tconst p = new Node( i, x, y );\n\n\tif ( ! last ) {\n\n\t\tp.prev = p;\n\t\tp.next = p;\n\n\t} else {\n\n\t\tp.next = last.next;\n\t\tp.prev = last;\n\t\tlast.next.prev = p;\n\t\tlast.next = p;\n\n\t}\n\n\treturn p;\n\n}\n\nfunction removeNode( p ) {\n\n\tp.next.prev = p.prev;\n\tp.prev.next = p.next;\n\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\n\n}\n\nfunction Node( i, x, y ) {\n\n\t// vertex index in coordinates array\n\tthis.i = i;\n\n\t// vertex coordinates\n\tthis.x = x;\n\tthis.y = y;\n\n\t// previous and next vertex nodes in a polygon ring\n\tthis.prev = null;\n\tthis.next = null;\n\n\t// z-order curve value\n\tthis.z = 0;\n\n\t// previous and next nodes in z-order\n\tthis.prevZ = null;\n\tthis.nextZ = null;\n\n\t// indicates whether this is a steiner point\n\tthis.steiner = false;\n\n}\n\nfunction signedArea( data, start, end, dim ) {\n\n\tlet sum = 0;\n\tfor ( let i = start, j = end - dim; i < end; i += dim ) {\n\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\n\t\tj = i;\n\n\t}\n\n\treturn sum;\n\n}\n\nexport { Earcut };\n", "import { Earcut } from './Earcut.js';\n\nclass ShapeUtils {\n\n\t// calculate area of the contour polygon\n\n\tstatic area( contour ) {\n\n\t\tconst n = contour.length;\n\t\tlet a = 0.0;\n\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t}\n\n\tstatic isClockWise( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t}\n\n\tstatic triangulateShape( contour, holes ) {\n\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tconst holeIndices = []; // array of hole indices\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tlet holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n}\n\nfunction removeDupEndPts( points ) {\n\n\tconst l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( let i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\nexport { ShapeUtils };\n", "/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */\n\nimport { BufferGeometry } from '../core/BufferGeometry.js';\nimport { Float32BufferAttribute } from '../core/BufferAttribute.js';\nimport * as Curves from '../extras/curves/Curves.js';\nimport { Vector2 } from '../math/Vector2.js';\nimport { Vector3 } from '../math/Vector3.js';\nimport { Shape } from '../extras/core/Shape.js';\nimport { ShapeUtils } from '../extras/ShapeUtils.js';\n\nclass ExtrudeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ExtrudeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\toptions: options\n\t\t};\n\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\t\tconst scope = this;\n\n\t\tconst verticesArray = [];\n\t\tconst uvArray = [];\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\t\t\taddShape( shape );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\t\tthis.computeVertexNormals();\n\n\t\t// functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst placeholder = [];\n\n\t\t\t// options\n\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\n\t\t\tconst depth = options.depth !== undefined ? options.depth : 1;\n\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\t\tconst extrudePath = options.extrudePath;\n\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t\t//\n\n\t\t\tlet extrudePts, extrudeByPath = false;\n\t\t\tlet splineTube, binormal, normal, position2;\n\n\t\t\tif ( extrudePath ) {\n\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\t\textrudeByPath = true;\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t\t// SETUP TNB variables\n\n\t\t\t\t// TODO1 - have a .isClosed in spline?\n\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\n\n\t\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\t\tbinormal = new Vector3();\n\t\t\t\tnormal = new Vector3();\n\t\t\t\tposition2 = new Vector3();\n\n\t\t\t}\n\n\t\t\t// Safeguards if bevels are not enabled\n\n\t\t\tif ( ! bevelEnabled ) {\n\n\t\t\t\tbevelSegments = 0;\n\t\t\t\tbevelThickness = 0;\n\t\t\t\tbevelSize = 0;\n\t\t\t\tbevelOffset = 0;\n\n\t\t\t}\n\n\t\t\t// Variables initialization\n\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\n\n\t\t\tlet vertices = shapePoints.shape;\n\t\t\tconst holes = shapePoints.holes;\n\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\t\tif ( reverse ) {\n\n\t\t\t\tvertices = vertices.reverse();\n\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( vertices, holes );\n\n\t\t\t/* Vertices */\n\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\tvertices = vertices.concat( ahole );\n\n\t\t\t}\n\n\n\t\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\t\tif ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );\n\n\t\t\t\treturn pt.clone().addScaledVector( vec, size );\n\n\t\t\t}\n\n\t\t\tconst vlen = vertices.length, flen = faces.length;\n\n\n\t\t\t// Find directions for point movement\n\n\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t\t//\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t\t// check for collinear edges\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not collinear\n\n\t\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t\t// but prevent crazy spikes\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\n\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\n\t\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t\t}\n\n\n\t\t\tconst contourMovements = [];\n\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t// console.log('i,j,k', i, j , k)\n\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t\t}\n\n\t\t\tconst holesMovements = [];\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\toneHoleMovements = [];\n\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t\t}\n\n\t\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t\t}\n\n\n\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst bs = bevelSize + bevelOffset;\n\n\t\t\t// Back facing vertices\n\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Add stepped vertices...\n\t\t\t// Including front facing vertices\n\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\n\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\t// Add bevel segments planes\n\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/* Faces */\n\n\t\t\t// Top and bottom faces\n\n\t\t\tbuildLidFaces();\n\n\t\t\t// Sides faces\n\n\t\t\tbuildSideFaces();\n\n\n\t\t\t///// Internal functions\n\n\t\t\tfunction buildLidFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\n\t\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\t\tlet layer = 0; // steps + 1\n\t\t\t\t\tlet offset = vlen * layer;\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t\t}\n\n\t\t\t// Create faces for the z-sides of the shape\n\n\t\t\tfunction buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}\n\n\t\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\t\tlet i = contour.length;\n\n\t\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\t\tconst j = i;\n\t\t\t\t\tlet k = i - 1;\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\n\n\t\t\t\t\t\tconst slen1 = vlen * s;\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfunction v( x, y, z ) {\n\n\t\t\t\tplaceholder.push( x );\n\t\t\t\tplaceholder.push( y );\n\t\t\t\tplaceholder.push( z );\n\n\t\t\t}\n\n\n\t\t\tfunction f3( a, b, c ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\n\t\t\t}\n\n\t\t\tfunction f4( a, b, c, d ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( d );\n\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\t\t\t\taddVertex( d );\n\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t}\n\n\t\t\tfunction addVertex( index ) {\n\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t\t}\n\n\n\t\t\tfunction addUV( vector2 ) {\n\n\t\t\t\tuvArray.push( vector2.x );\n\t\t\t\tuvArray.push( vector2.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\t\tconst options = this.parameters.options;\n\n\t\treturn toJSON( shapes, options, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\tconst extrudePath = data.options.extrudePath;\n\n\t\tif ( extrudePath !== undefined ) {\n\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t}\n\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\n\n\t}\n\n}\n\nconst WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\n\t\tconst d_x = vertices[ indexD * 3 ];\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n\n};\n\nfunction toJSON( shapes, options, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\tdata.options = Object.assign( {}, options );\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\n\nexport { ExtrudeGeometry };\n", "import { BufferGeometry } from '../core/BufferGeometry.js';\nimport { Float32BufferAttribute } from '../core/BufferAttribute.js';\nimport { Shape } from '../extras/core/Shape.js';\nimport { ShapeUtils } from '../extras/ShapeUtils.js';\nimport { Vector2 } from '../math/Vector2.js';\n\nclass ShapeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShapeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\tcurveSegments: curveSegments\n\t\t};\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet groupStart = 0;\n\t\tlet groupCount = 0;\n\n\t\t// allow single and array values for \"shapes\" parameter\n\n\t\tif ( Array.isArray( shapes ) === false ) {\n\n\t\t\taddShape( shapes );\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\n\n\t\t\t\taddShape( shapes[ i ] );\n\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\t\tgroupStart += groupCount;\n\t\t\t\tgroupCount = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t\t// helper functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst indexOffset = vertices.length / 3;\n\t\t\tconst points = shape.extractPoints( curveSegments );\n\n\t\t\tlet shapeVertices = points.shape;\n\t\t\tconst shapeHoles = points.holes;\n\n\t\t\t// check direction of vertices\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t\t// join vertices of inner and outer paths to a single array\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t\t}\n\n\t\t\t// vertices, normals, uvs\n\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\t\tconst vertex = shapeVertices[ i ];\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\t\tnormals.push( 0, 0, 1 );\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\t\tconst face = faces[ i ];\n\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\n\n\t\t\t\tindices.push( a, b, c );\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\n\t\treturn toJSON( shapes, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\n\n\t}\n\n}\n\nfunction toJSON( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\nexport { ShapeGeometry };\n", "import 'element-behaviors'\nimport {attribute} from '@lume/element'\nimport {Shape} from 'three/src/extras/core/Shape.js'\nimport {ExtrudeGeometry} from 'three/src/geometries/ExtrudeGeometry.js'\nimport {ShapeGeometry} from 'three/src/geometries/ShapeGeometry.js'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {GeometryBehavior} from './GeometryBehavior.js'\n\nimport type {BufferGeometry} from 'three/src/core/BufferGeometry.js'\n\nexport type RoundedRectangleGeometryBehaviorAttributes = 'cornerRadius' | 'thickness' | 'quadraticCorners'\n\nexport\n@behavior\nclass RoundedRectangleGeometryBehavior extends GeometryBehavior {\n\t@attribute({from: Number}) @receiver cornerRadius = 0\n\t@attribute({from: Number}) @receiver thickness = 0\n\n\t#quadraticCorners = false\n\n\t@attribute\n\t@receiver\n\tget quadraticCorners() {\n\t\treturn this.#quadraticCorners\n\t}\n\tset quadraticCorners(val: boolean) {\n\t\t// @ts-ignore handle incoming attribute values\n\t\tif (val === null || val === 'false') this.#quadraticCorners = false\n\t\telse this.#quadraticCorners = true\n\t}\n\n\toverride _createComponent() {\n\t\tlet thickness = this.thickness\n\t\tlet geom: BufferGeometry\n\n\t\tconst roundedRectShape = new RoundedRectShape(\n\t\t\t0,\n\t\t\t0,\n\t\t\tthis.element.calculatedSize.x,\n\t\t\tthis.element.calculatedSize.y,\n\t\t\tthis.cornerRadius,\n\t\t\tthis.quadraticCorners,\n\t\t)\n\n\t\tif (thickness > 0) {\n\t\t\tgeom = new ExtrudeGeometry(roundedRectShape, {\n\t\t\t\tbevelEnabled: true,\n\t\t\t\tsteps: 1,\n\t\t\t\tbevelSegments: 1,\n\t\t\t\tbevelSize: 0,\n\t\t\t\tbevelThickness: 0,\n\t\t\t\tdepth: thickness,\n\t\t\t})\n\t\t} else {\n\t\t\tgeom = new ShapeGeometry(roundedRectShape)\n\t\t}\n\n\t\tgeom.translate(-this.element.calculatedSize.x / 2, -this.element.calculatedSize.y / 2, -thickness / 2)\n\n\t\treturn geom\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('rounded-rectangle-geometry'))\n\telementBehaviors.define('rounded-rectangle-geometry', RoundedRectangleGeometryBehavior)\n\n// Based on Three.js example: https://github.com/mrdoob/three.js/blob/159a40648ee86755220491d4f0bae202235a341c/examples/webgl_geometry_shapes.html#L237\nclass RoundedRectShape extends Shape {\n\tconstructor(x: number, y: number, width: number, height: number, radius: number, quadraticCorners = false) {\n\t\tsuper()\n\n\t\tif (quadraticCorners) {\n\t\t\t// Quadratic corners (can look better, more bubbly)\n\t\t\tthis.moveTo(x, y + radius)\n\t\t\tthis.lineTo(x, y + height - radius)\n\t\t\tthis.quadraticCurveTo(x, y + height, x + radius, y + height)\n\t\t\tthis.lineTo(x + width - radius, y + height)\n\t\t\tthis.quadraticCurveTo(x + width, y + height, x + width, y + height - radius)\n\t\t\tthis.lineTo(x + width, y + radius)\n\t\t\tthis.quadraticCurveTo(x + width, y, x + width - radius, y)\n\t\t\tthis.lineTo(x + radius, y)\n\t\t\tthis.quadraticCurveTo(x, y, x, y + radius)\n\n\t\t\treturn\n\t\t}\n\n\t\t// Circular corners (matches DOM's rounded borders)\n\t\tthis.absarc(x + width - radius, y + radius, radius, -Math.PI / 2, 0, false)\n\t\tthis.absarc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2, false)\n\t\tthis.absarc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI, false)\n\t\tthis.absarc(x + radius, y + radius, radius, Math.PI, Math.PI + Math.PI / 2, false)\n\t\tthis.lineTo(x + width - radius, y) // complete the loop\n\t}\n}\n", "import type {BufferGeometry} from 'three'\n\n// Adapted from https://stackoverflow.com/questions/16824650. TODO This may not\n// work for all cases, see: https://discourse.threejs.org/t/37171\nexport function handleInvertedGeometry(geometry: BufferGeometry) {\n\tlet x = 0\n\tlet y = 0\n\tlet z = 0\n\n\tconst normals = geometry.attributes.normal.array\n\n\t// flip normals\n\tfor (let i = 0, l = normals.length / 9; i < l; i++) {\n\t\t// cache a coordinates\n\t\tx = normals[i * 9]\n\t\ty = normals[i * 9 + 1]\n\t\tz = normals[i * 9 + 2]\n\n\t\t// overwrite a with c\n\t\tnormals[i * 9] = normals[i * 9 + 6]\n\t\tnormals[i * 9 + 1] = normals[i * 9 + 7]\n\t\tnormals[i * 9 + 2] = normals[i * 9 + 8]\n\n\t\t// overwrite c with stored a values\n\t\tnormals[i * 9 + 6] = x\n\t\tnormals[i * 9 + 7] = y\n\t\tnormals[i * 9 + 8] = z\n\t}\n\n\tconst verts = geometry.attributes.position.array\n\n\t// change face winding order\n\tfor (let i = 0, l = verts.length / 9; i < l; i++) {\n\t\t// cache a coordinates\n\t\tx = verts[i * 9]\n\t\ty = verts[i * 9 + 1]\n\t\tz = verts[i * 9 + 2]\n\n\t\t// overwrite a with c\n\t\tverts[i * 9] = verts[i * 9 + 6]\n\t\tverts[i * 9 + 1] = verts[i * 9 + 7]\n\t\tverts[i * 9 + 2] = verts[i * 9 + 8]\n\n\t\t// overwrite c with stored a values\n\t\tverts[i * 9 + 6] = x\n\t\tverts[i * 9 + 7] = y\n\t\tverts[i * 9 + 8] = z\n\t}\n\n\tconst uvs = geometry.attributes.uv.array\n\n\t// flip UV coordinates\n\tfor (let i = 0, l = uvs.length / 6; i < l; i++) {\n\t\t// cache a coordinates\n\t\tx = uvs[i * 6]\n\t\ty = uvs[i * 6 + 1]\n\n\t\t// overwrite a with c\n\t\tuvs[i * 6] = uvs[i * 6 + 4]\n\t\tuvs[i * 6 + 1] = uvs[i * 6 + 5]\n\n\t\t// overwrite c with stored a values\n\t\tuvs[i * 6 + 4] = x\n\t\tuvs[i * 6 + 5] = y\n\t}\n\n\tgeometry.attributes.normal.needsUpdate = true\n\tgeometry.attributes.position.needsUpdate = true\n\tgeometry.attributes.uv.needsUpdate = true\n}\n", "import { Color } from '../../math/Color.js';\nimport { Path } from './Path.js';\nimport { Shape } from './Shape.js';\nimport { ShapeUtils } from '../ShapeUtils.js';\n\nclass ShapePath {\n\n\tconstructor() {\n\n\t\tthis.type = 'ShapePath';\n\n\t\tthis.color = new Color();\n\n\t\tthis.subPaths = [];\n\t\tthis.currentPath = null;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t}\n\n\ttoShapes( isCCW ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tconst shapes = [];\n\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\n\n\t\t\t\tconst tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tconst polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tlet inside = false;\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tconst isClockWise = ShapeUtils.isClockWise;\n\n\t\tconst subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tlet solid, tmpPath, tmpShape;\n\t\tconst shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// console.log(\"Holes first\", holesFirst);\n\n\t\tconst betterShapeHoles = [];\n\t\tconst newShapes = [];\n\t\tlet newShapeHoles = [];\n\t\tlet mainIdx = 0;\n\t\tlet tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//console.log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//console.log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tlet ambiguous = false;\n\t\t\tlet toChange = 0;\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tconst ho = sho[ hIdx ];\n\t\t\t\t\tlet hole_unassigned = true;\n\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange ++;\n\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( toChange > 0 && ambiguous === false ) {\n\n\t\t\t\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet tmpHoles;\n\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//console.log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n}\n\n\nexport { ShapePath };\n", "import {ShapePath} from 'three/src/extras/core/ShapePath.js'\nimport {Vector2} from 'three/src/math/Vector2.js'\n\n// Functions adapted from https://github.com/mrdoob/three.js/blob/c7d06c02e302ab9c20fe8b33eade4b61c6712654/examples/jsm/loaders/SVGLoader.js#L207\n\nexport function parseSvgPathElement(path: SVGPathElement) {\n\treturn parseSvgPathDAttribute(path.getAttribute('d'))\n}\n\nexport function parseSvgPathDAttribute(d: string | null) {\n\tconst path = new ShapePath()\n\n\tconst point = new Vector2()\n\tconst control = new Vector2()\n\n\tconst firstPoint = new Vector2()\n\tlet isFirstPoint = true\n\tlet doSetFirstPoint = false\n\n\tif (!d) {\n\t\tconsole.error('Path has not `d` attribute.')\n\t\treturn path\n\t}\n\n\tconst commands = d.match(/[a-df-z][^a-df-z]*/gi)\n\n\tif (!commands) {\n\t\tconsole.error('Empty or invalid path: ', d)\n\t\treturn path\n\t}\n\n\tfor (let i = 0, l = commands.length; i < l; i++) {\n\t\tconst command = commands[i]\n\n\t\tconst type = command.charAt(0)\n\t\tconst data = command.slice(1).trim()\n\n\t\tif (isFirstPoint === true) {\n\t\t\tdoSetFirstPoint = true\n\t\t\tisFirstPoint = false\n\t\t}\n\n\t\tlet numbers\n\n\t\tswitch (type) {\n\t\t\tcase 'M':\n\t\t\t\tnumbers = parseFloats(data)\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 2) {\n\t\t\t\t\tpoint.x = numbers[j + 0]\n\t\t\t\t\tpoint.y = numbers[j + 1]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\n\t\t\t\t\tif (j === 0) {\n\t\t\t\t\t\tpath.moveTo(point.x, point.y)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpath.lineTo(point.x, point.y)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (j === 0) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'H':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j++) {\n\t\t\t\t\tpoint.x = numbers[j]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\t\t\t\t\tpath.lineTo(point.x, point.y)\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'V':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j++) {\n\t\t\t\t\tpoint.y = numbers[j]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\t\t\t\t\tpath.lineTo(point.x, point.y)\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'L':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 2) {\n\t\t\t\t\tpoint.x = numbers[j + 0]\n\t\t\t\t\tpoint.y = numbers[j + 1]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\t\t\t\t\tpath.lineTo(point.x, point.y)\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'C':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 6) {\n\t\t\t\t\tpath.bezierCurveTo(\n\t\t\t\t\t\tnumbers[j + 0],\n\t\t\t\t\t\tnumbers[j + 1],\n\t\t\t\t\t\tnumbers[j + 2],\n\t\t\t\t\t\tnumbers[j + 3],\n\t\t\t\t\t\tnumbers[j + 4],\n\t\t\t\t\t\tnumbers[j + 5],\n\t\t\t\t\t)\n\t\t\t\t\tcontrol.x = numbers[j + 2]\n\t\t\t\t\tcontrol.y = numbers[j + 3]\n\t\t\t\t\tpoint.x = numbers[j + 4]\n\t\t\t\t\tpoint.y = numbers[j + 5]\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'S':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 4) {\n\t\t\t\t\tpath.bezierCurveTo(\n\t\t\t\t\t\tgetReflection(point.x, control.x),\n\t\t\t\t\t\tgetReflection(point.y, control.y),\n\t\t\t\t\t\tnumbers[j + 0],\n\t\t\t\t\t\tnumbers[j + 1],\n\t\t\t\t\t\tnumbers[j + 2],\n\t\t\t\t\t\tnumbers[j + 3],\n\t\t\t\t\t)\n\t\t\t\t\tcontrol.x = numbers[j + 0]\n\t\t\t\t\tcontrol.y = numbers[j + 1]\n\t\t\t\t\tpoint.x = numbers[j + 2]\n\t\t\t\t\tpoint.y = numbers[j + 3]\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'Q':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 4) {\n\t\t\t\t\tpath.quadraticCurveTo(numbers[j + 0], numbers[j + 1], numbers[j + 2], numbers[j + 3])\n\t\t\t\t\tcontrol.x = numbers[j + 0]\n\t\t\t\t\tcontrol.y = numbers[j + 1]\n\t\t\t\t\tpoint.x = numbers[j + 2]\n\t\t\t\t\tpoint.y = numbers[j + 3]\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'T':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 2) {\n\t\t\t\t\tconst rx = getReflection(point.x, control.x)\n\t\t\t\t\tconst ry = getReflection(point.y, control.y)\n\t\t\t\t\tpath.quadraticCurveTo(rx, ry, numbers[j + 0], numbers[j + 1])\n\t\t\t\t\tcontrol.x = rx\n\t\t\t\t\tcontrol.y = ry\n\t\t\t\t\tpoint.x = numbers[j + 0]\n\t\t\t\t\tpoint.y = numbers[j + 1]\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'A':\n\t\t\t\tnumbers = parseFloats(data, [3, 4], 7)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 7) {\n\t\t\t\t\t// skip command if start point == end point\n\t\t\t\t\tif (numbers[j + 5] == point.x && numbers[j + 6] == point.y) continue\n\n\t\t\t\t\tconst start = point.clone()\n\t\t\t\t\tpoint.x = numbers[j + 5]\n\t\t\t\t\tpoint.y = numbers[j + 6]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\t\t\t\t\tparseArcCommand(\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tnumbers[j],\n\t\t\t\t\t\tnumbers[j + 1],\n\t\t\t\t\t\tnumbers[j + 2],\n\t\t\t\t\t\tnumbers[j + 3],\n\t\t\t\t\t\tnumbers[j + 4],\n\t\t\t\t\t\tstart,\n\t\t\t\t\t\tpoint,\n\t\t\t\t\t)\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'm':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 2) {\n\t\t\t\t\tpoint.x += numbers[j + 0]\n\t\t\t\t\tpoint.y += numbers[j + 1]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\n\t\t\t\t\tif (j === 0) {\n\t\t\t\t\t\tpath.moveTo(point.x, point.y)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpath.lineTo(point.x, point.y)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (j === 0) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'h':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j++) {\n\t\t\t\t\tpoint.x += numbers[j]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\t\t\t\t\tpath.lineTo(point.x, point.y)\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'v':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j++) {\n\t\t\t\t\tpoint.y += numbers[j]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\t\t\t\t\tpath.lineTo(point.x, point.y)\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'l':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 2) {\n\t\t\t\t\tpoint.x += numbers[j + 0]\n\t\t\t\t\tpoint.y += numbers[j + 1]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\t\t\t\t\tpath.lineTo(point.x, point.y)\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'c':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 6) {\n\t\t\t\t\tpath.bezierCurveTo(\n\t\t\t\t\t\tpoint.x + numbers[j + 0],\n\t\t\t\t\t\tpoint.y + numbers[j + 1],\n\t\t\t\t\t\tpoint.x + numbers[j + 2],\n\t\t\t\t\t\tpoint.y + numbers[j + 3],\n\t\t\t\t\t\tpoint.x + numbers[j + 4],\n\t\t\t\t\t\tpoint.y + numbers[j + 5],\n\t\t\t\t\t)\n\t\t\t\t\tcontrol.x = point.x + numbers[j + 2]\n\t\t\t\t\tcontrol.y = point.y + numbers[j + 3]\n\t\t\t\t\tpoint.x += numbers[j + 4]\n\t\t\t\t\tpoint.y += numbers[j + 5]\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 's':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 4) {\n\t\t\t\t\tpath.bezierCurveTo(\n\t\t\t\t\t\tgetReflection(point.x, control.x),\n\t\t\t\t\t\tgetReflection(point.y, control.y),\n\t\t\t\t\t\tpoint.x + numbers[j + 0],\n\t\t\t\t\t\tpoint.y + numbers[j + 1],\n\t\t\t\t\t\tpoint.x + numbers[j + 2],\n\t\t\t\t\t\tpoint.y + numbers[j + 3],\n\t\t\t\t\t)\n\t\t\t\t\tcontrol.x = point.x + numbers[j + 0]\n\t\t\t\t\tcontrol.y = point.y + numbers[j + 1]\n\t\t\t\t\tpoint.x += numbers[j + 2]\n\t\t\t\t\tpoint.y += numbers[j + 3]\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'q':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 4) {\n\t\t\t\t\tpath.quadraticCurveTo(\n\t\t\t\t\t\tpoint.x + numbers[j + 0],\n\t\t\t\t\t\tpoint.y + numbers[j + 1],\n\t\t\t\t\t\tpoint.x + numbers[j + 2],\n\t\t\t\t\t\tpoint.y + numbers[j + 3],\n\t\t\t\t\t)\n\t\t\t\t\tcontrol.x = point.x + numbers[j + 0]\n\t\t\t\t\tcontrol.y = point.y + numbers[j + 1]\n\t\t\t\t\tpoint.x += numbers[j + 2]\n\t\t\t\t\tpoint.y += numbers[j + 3]\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 't':\n\t\t\t\tnumbers = parseFloats(data)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 2) {\n\t\t\t\t\tconst rx = getReflection(point.x, control.x)\n\t\t\t\t\tconst ry = getReflection(point.y, control.y)\n\t\t\t\t\tpath.quadraticCurveTo(rx, ry, point.x + numbers[j + 0], point.y + numbers[j + 1])\n\t\t\t\t\tcontrol.x = rx\n\t\t\t\t\tcontrol.y = ry\n\t\t\t\t\tpoint.x = point.x + numbers[j + 0]\n\t\t\t\t\tpoint.y = point.y + numbers[j + 1]\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'a':\n\t\t\t\tnumbers = parseFloats(data, [3, 4], 7)\n\n\t\t\t\tfor (let j = 0, jl = numbers.length; j < jl; j += 7) {\n\t\t\t\t\t// skip command if no displacement\n\t\t\t\t\tif (numbers[j + 5] == 0 && numbers[j + 6] == 0) continue\n\n\t\t\t\t\tconst start = point.clone()\n\t\t\t\t\tpoint.x += numbers[j + 5]\n\t\t\t\t\tpoint.y += numbers[j + 6]\n\t\t\t\t\tcontrol.x = point.x\n\t\t\t\t\tcontrol.y = point.y\n\t\t\t\t\tparseArcCommand(\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tnumbers[j],\n\t\t\t\t\t\tnumbers[j + 1],\n\t\t\t\t\t\tnumbers[j + 2],\n\t\t\t\t\t\tnumbers[j + 3],\n\t\t\t\t\t\tnumbers[j + 4],\n\t\t\t\t\t\tstart,\n\t\t\t\t\t\tpoint,\n\t\t\t\t\t)\n\n\t\t\t\t\tif (j === 0 && doSetFirstPoint === true) firstPoint.copy(point)\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'Z':\n\t\t\tcase 'z':\n\t\t\t\t// @ts-expect-error FIXME\n\t\t\t\tpath.currentPath.autoClose = true\n\n\t\t\t\t// @ts-expect-error FIXME\n\t\t\t\tif (path.currentPath.curves.length > 0) {\n\t\t\t\t\t// Reset point to beginning of Path\n\t\t\t\t\tpoint.copy(firstPoint)\n\t\t\t\t\t// @ts-expect-error FIXME\n\t\t\t\t\tpath.currentPath.currentPoint.copy(point)\n\t\t\t\t\tisFirstPoint = true\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tconsole.warn(command)\n\t\t}\n\n\t\tdoSetFirstPoint = false\n\t}\n\n\treturn path\n}\n\n// from https://github.com/ppvg/svg-numbers (MIT License)\n\nfunction parseFloats(input: string): number[]\nfunction parseFloats(input: string, flags: number[], stride: number): number[]\nfunction parseFloats(input: string, flags?: number[], stride?: number): number[] {\n\tif (typeof input !== 'string') {\n\t\tthrow new TypeError('Invalid input: ' + typeof input)\n\t}\n\n\t// Character groups\n\tconst RE = {\n\t\tSEPARATOR: /[ \\t\\r\\n\\,.\\-+]/,\n\t\tWHITESPACE: /[ \\t\\r\\n]/,\n\t\tDIGIT: /[\\d]/,\n\t\tSIGN: /[-+]/,\n\t\tPOINT: /\\./,\n\t\tCOMMA: /,/,\n\t\tEXP: /e/i,\n\t\tFLAGS: /[01]/,\n\t}\n\n\t// States\n\tconst SEP = 0\n\tconst INT = 1\n\tconst FLOAT = 2\n\tconst EXP = 3\n\n\tlet state = SEP\n\tlet seenComma = true\n\tlet number = '',\n\t\texponent = ''\n\tconst result: number[] = []\n\n\tclass NumberSyntaxError extends SyntaxError {\n\t\tpartial: any\n\t}\n\n\tfunction throwSyntaxError(current: string, i: number, partial: number[]) {\n\t\tconst error = new NumberSyntaxError('Unexpected character \"' + current + '\" at index ' + i + '.')\n\t\terror.partial = partial\n\t\tthrow error\n\t}\n\n\tfunction newNumber() {\n\t\tif (number !== '') {\n\t\t\tif (exponent === '') result.push(Number(number))\n\t\t\telse result.push(Number(number) * Math.pow(10, Number(exponent)))\n\t\t}\n\n\t\tnumber = ''\n\t\texponent = ''\n\t}\n\n\tlet current\n\tconst length = input.length\n\n\tfor (let i = 0; i < length; i++) {\n\t\tcurrent = input[i]\n\n\t\t// check for flags\n\t\tif (Array.isArray(flags) && flags.includes(result.length % stride!) && RE.FLAGS.test(current)) {\n\t\t\tstate = INT\n\t\t\tnumber = current\n\t\t\tnewNumber()\n\t\t\tcontinue\n\t\t}\n\n\t\t// parse until next number\n\t\tif (state === SEP) {\n\t\t\t// eat whitespace\n\t\t\tif (RE.WHITESPACE.test(current)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// start new number\n\t\t\tif (RE.DIGIT.test(current) || RE.SIGN.test(current)) {\n\t\t\t\tstate = INT\n\t\t\t\tnumber = current\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (RE.POINT.test(current)) {\n\t\t\t\tstate = FLOAT\n\t\t\t\tnumber = current\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// throw on double commas (e.g. \"1, , 2\")\n\t\t\tif (RE.COMMA.test(current)) {\n\t\t\t\tif (seenComma) {\n\t\t\t\t\tthrowSyntaxError(current, i, result)\n\t\t\t\t}\n\n\t\t\t\tseenComma = true\n\t\t\t}\n\t\t}\n\n\t\t// parse integer part\n\t\tif (state === INT) {\n\t\t\tif (RE.DIGIT.test(current)) {\n\t\t\t\tnumber += current\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (RE.POINT.test(current)) {\n\t\t\t\tnumber += current\n\t\t\t\tstate = FLOAT\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (RE.EXP.test(current)) {\n\t\t\t\tstate = EXP\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// throw on double signs (\"-+1\"), but not on sign as separator (\"-1-2\")\n\t\t\tif (RE.SIGN.test(current) && number.length === 1 && RE.SIGN.test(number[0])) {\n\t\t\t\tthrowSyntaxError(current, i, result)\n\t\t\t}\n\t\t}\n\n\t\t// parse decimal part\n\t\tif (state === FLOAT) {\n\t\t\tif (RE.DIGIT.test(current)) {\n\t\t\t\tnumber += current\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (RE.EXP.test(current)) {\n\t\t\t\tstate = EXP\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// throw on double decimal points (e.g. \"1..2\")\n\t\t\tif (RE.POINT.test(current) && number[number.length - 1] === '.') {\n\t\t\t\tthrowSyntaxError(current, i, result)\n\t\t\t}\n\t\t}\n\n\t\t// parse exponent part\n\t\tif (state === EXP) {\n\t\t\tif (RE.DIGIT.test(current)) {\n\t\t\t\texponent += current\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (RE.SIGN.test(current)) {\n\t\t\t\tif (exponent === '') {\n\t\t\t\t\texponent += current\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (exponent.length === 1 && RE.SIGN.test(exponent)) {\n\t\t\t\t\tthrowSyntaxError(current, i, result)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// end of number\n\t\tif (RE.WHITESPACE.test(current)) {\n\t\t\tnewNumber()\n\t\t\tstate = SEP\n\t\t\tseenComma = false\n\t\t} else if (RE.COMMA.test(current)) {\n\t\t\tnewNumber()\n\t\t\tstate = SEP\n\t\t\tseenComma = true\n\t\t} else if (RE.SIGN.test(current)) {\n\t\t\tnewNumber()\n\t\t\tstate = INT\n\t\t\tnumber = current\n\t\t} else if (RE.POINT.test(current)) {\n\t\t\tnewNumber()\n\t\t\tstate = FLOAT\n\t\t\tnumber = current\n\t\t} else {\n\t\t\tthrowSyntaxError(current, i, result)\n\t\t}\n\t}\n\n\t// add the last number found (if any)\n\tnewNumber()\n\n\treturn result\n}\n\n/**\n * https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes\n * https://mortoray.com/2017/02/16/rendering-an-svg-elliptical-arc-as-bezier-curves/ Appendix: Endpoint to center arc conversion\n * From\n * rx ry x-axis-rotation large-arc-flag sweep-flag x y\n * To\n * aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation\n */\n\nfunction parseArcCommand(\n\tpath: ShapePath,\n\trx: number,\n\try: number,\n\tx_axis_rotation: number,\n\tlarge_arc_flag: number,\n\tsweep_flag: number,\n\tstart: Vector2,\n\tend: Vector2,\n) {\n\tif (rx == 0 || ry == 0) {\n\t\t// draw a line if either of the radii == 0\n\t\tpath.lineTo(end.x, end.y)\n\t\treturn\n\t}\n\n\tx_axis_rotation = (x_axis_rotation * Math.PI) / 180\n\n\t// Ensure radii are positive\n\trx = Math.abs(rx)\n\try = Math.abs(ry)\n\n\t// Compute (x1', y1')\n\tconst dx2 = (start.x - end.x) / 2.0\n\tconst dy2 = (start.y - end.y) / 2.0\n\tconst x1p = Math.cos(x_axis_rotation) * dx2 + Math.sin(x_axis_rotation) * dy2\n\tconst y1p = -Math.sin(x_axis_rotation) * dx2 + Math.cos(x_axis_rotation) * dy2\n\n\t// Compute (cx', cy')\n\tlet rxs = rx * rx\n\tlet rys = ry * ry\n\tconst x1ps = x1p * x1p\n\tconst y1ps = y1p * y1p\n\n\t// Ensure radii are large enough\n\tconst cr = x1ps / rxs + y1ps / rys\n\n\tif (cr > 1) {\n\t\t// scale up rx,ry equally so cr == 1\n\t\tconst s = Math.sqrt(cr)\n\t\trx = s * rx\n\t\try = s * ry\n\t\trxs = rx * rx\n\t\trys = ry * ry\n\t}\n\n\tconst dq = rxs * y1ps + rys * x1ps\n\tconst pq = (rxs * rys - dq) / dq\n\tlet q = Math.sqrt(Math.max(0, pq))\n\tif (large_arc_flag === sweep_flag) q = -q\n\tconst cxp = (q * rx * y1p) / ry\n\tconst cyp = (-q * ry * x1p) / rx\n\n\t// Step 3: Compute (cx, cy) from (cx', cy')\n\tconst cx = Math.cos(x_axis_rotation) * cxp - Math.sin(x_axis_rotation) * cyp + (start.x + end.x) / 2\n\tconst cy = Math.sin(x_axis_rotation) * cxp + Math.cos(x_axis_rotation) * cyp + (start.y + end.y) / 2\n\n\t// Step 4: Compute \u03B81 and \u0394\u03B8\n\tconst theta = svgAngle(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry)\n\tconst delta = svgAngle((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry) % (Math.PI * 2)\n\n\t// @ts-expect-error FIXME\n\tpath.currentPath.absellipse(cx, cy, rx, ry, theta, theta + delta, sweep_flag === 0, x_axis_rotation)\n}\n\n// http://www.w3.org/TR/SVG11/implnote.html#PathElementImplementationNotes\n\nfunction getReflection(a: number, b: number) {\n\treturn a - (b - a)\n}\n\nfunction svgAngle(ux: number, uy: number, vx: number, vy: number) {\n\tconst dot = ux * vx + uy * vy\n\tconst len = Math.sqrt(ux * ux + uy * uy) * Math.sqrt(vx * vx + vy * vy)\n\tlet ang = Math.acos(Math.max(-1, Math.min(1, dot / len))) // floating point precision, slightly over values appear\n\tif (ux * vy - uy * vx < 0) ang = -ang\n\treturn ang\n}\n", "import {attribute, booleanAttribute, numberAttribute, stringAttribute} from '@lume/element'\nimport 'element-behaviors'\nimport {ExtrudeGeometry} from 'three/src/geometries/ExtrudeGeometry.js'\nimport {Shape} from 'three/src/extras/core/Shape.js'\nimport {ShapeGeometry} from 'three/src/geometries/ShapeGeometry.js'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {GeometryBehavior} from './GeometryBehavior.js'\nimport {stringToNumberArray} from '../../../meshes/utils.js'\nimport {handleInvertedGeometry} from './utils/handleInvertedGeometry.js'\nimport {parseSvgPathDAttribute} from './utils/svg.js'\n\n// Heart shape.\nconst defaultShape = new Shape()\n\ndefaultShape.moveTo(5, 5)\ndefaultShape.bezierCurveTo(5, 5, 4, 0, 0, 0)\ndefaultShape.bezierCurveTo(-6, 0, -6, 7, -6, 7)\ndefaultShape.bezierCurveTo(-6, 11, -3, 15.4, 5, 19)\ndefaultShape.bezierCurveTo(12, 15.4, 16, 11, 16, 7)\ndefaultShape.bezierCurveTo(16, 7, 16, 0, 10, 0)\ndefaultShape.bezierCurveTo(7, 0, 5, 5, 5, 5)\n\nconst emptyShape = new Shape()\n\nconst isPathStringRe = /^[mlhvcsqtaz][^a-z]/i\n\nexport type ShapeGeometryBehaviorAttributes =\n\t| 'shape'\n\t| 'curveSegments'\n\t| 'bevel'\n\t| 'bevelSegments'\n\t| 'bevelThickness'\n\t| 'centerGeometry'\n\t| 'fitment'\n\n/**\n * @class ShapeGeometryBehavior -\n *\n * Provides a 2D extrudable shape geometry for mesh\n * elements. The [``](../../../meshes/Shape.md) element has this behavior\n * on it by default.\n *\n * The shape defined by the [`shape`](#shape) attribute property will be centered within the\n * size space defined by the host element's `size` and `sizeMode` attribute\n * properties.\n *\n * To extrude the shape, set the host element's Z size to the amount of desired\n * extrusion. If the host element Z size is zero, the shape will be flat and 2D\n * only.\n *\n * \n * \n *\n * @extends GeometryBehavior\n */\nexport\n@behavior\nclass ShapeGeometryBehavior extends GeometryBehavior {\n\t#shape = new Shape().copy(defaultShape)\n\n\t/**\n\t * @property {string | number[] | THREE.Shape | null} shape - Defines the 2D shape to render.\n\t *\n\t * Reading the property always returns an underlying\n\t * [THREE.Shape](https://threejs.org/docs/index.html?q=shape#api/en/extras/core/Shape)\n\t * object.\n\t *\n\t * Setting the property accepts `string`, `number[]`, `null`, or\n\t * `THREE.Shape` values. All values are mapped to a single `THREE.Shape`\n\t * property (the one returned by the getter).\n\t *\n\t * While setting the property triggers reactivity, modifying the\n\t * `THREE.Shape` returned by the getter does not. In such a case, we can\n\t * execute `el.shape = el.shape` to trigger reactivity.\n\t * \n\t *\n\t * A string value should be a list of numbers separated by any amount of space\n\t * (commas are optional, for organizational use), every two numbers forming\n\t * one point in the 2D shape. Similar to the rest of LUME's coordinate\n\t * system, +X goes rightward, and +Y goes downward.\n\t *\n\t * A number array value is similar to the string value: every two numbers\n\t * form a point in the shape.\n\t * \n\t *\n\t * If the string or number array have no points, the default shape is rendered.\n\t *\n\t * A `THREE.Shape` value will have its data copied to the underlying\n\t * `THREE.Shape` returned by the getter, and does not replace the underlying\n\t * `THREE.Shape` object.\n\t * \n\t *\n\t * A value of `null` (or when the attribute is removed) causes the\n\t * default shape to be rendered.\n\t */\n\t@attribute\n\t@receiver\n\tget shape(): Shape {\n\t\treturn this.#shape\n\t}\n\tset shape(shape: string | number[] | Shape | null) {\n\t\tif (!shape) {\n\t\t\tthis.#shape.copy(defaultShape)\n\t\t} else if (\n\t\t\ttypeof shape === 'string' &&\n\t\t\t(shape = shape.trim()) && // skip empty string here\n\t\t\tshape.match(isPathStringRe)\n\t\t) {\n\t\t\tconst shapePath = parseSvgPathDAttribute(shape)\n\n\t\t\t// TODO This supports only one solid shape for now.\n\t\t\tthis.#shape.copy(shapePath.toShapes(true)[0] ?? defaultShape)\n\t\t} else if (typeof shape === 'string' && !shape.match(/^-?[0-9]/)) {\n\t\t\t// TODO query selector for element from which to get a `d` attribute.\n\t\t\tconsole.error('Unsupported shape path: ', shape)\n\t\t\tthis.#shape.copy(defaultShape)\n\t\t} else if (typeof shape === 'string' || Array.isArray(shape)) {\n\t\t\tconst points: number[] = typeof shape === 'string' ? stringToNumberArray(shape, 'shape') : shape\n\n\t\t\tif (!points.length) {\n\t\t\t\tthis.#shape.copy(defaultShape)\n\t\t\t} else {\n\t\t\t\tif (points.length % 2 !== 0)\n\t\t\t\t\tthrow new Error('shape path must have an even number of numbers, each pair of numbers being a point.')\n\n\t\t\t\tthis.#shape.copy(emptyShape)\n\t\t\t\tthis.#shape.moveTo(points[0], points[1])\n\n\t\t\t\tif (points.length > 2) for (let i = 2; i < points.length; i += 2) this.#shape.lineTo(points[i], points[i + 1])\n\t\t\t}\n\t\t} else {\n\t\t\t// Three.js bug: Copying a shape from itself breaks, causing\n\t\t\t// its `curves` array to be empty. Without this, `` will\n\t\t\t// not draw anything on screen initially until its `shape` is\n\t\t\t// modified.\n\t\t\tif (this.#shape !== shape) {\n\t\t\t\tthis.#shape.copy(shape)\n\t\t\t}\n\t\t}\n\n\t\tthis.#shape.updateArcLengths()\n\t}\n\n\t/**\n\t * @property {number} curveSegments - The number of lines per curve withing\n\t * the shape. The higher the number, the smoother the shape at the cost of\n\t * render time.\n\t * @default 8\n\t */\n\t@numberAttribute @receiver curveSegments = 8\n\t/**\n\t * @property {boolean} bevel - When the shape is extruded, enables rounding\n\t * of the shape edges.\n\t * @default false\n\t */\n\t@booleanAttribute @receiver bevel = false\n\t/**\n\t * @property {number} bevelSegments - When the shape is extruded, determines\n\t * the number of sections for the bevel. A higher number makes the model\n\t * look smoother, but cost more time to render.\n\t * @default 4\n\t */\n\t@numberAttribute @receiver bevelSegments = 4\n\t/**\n\t * @property {number} bevelThickness - When the shape is extruded,\n\t * determines the thickness of the bevel. Roughly like the amount of\n\t * radius for the rounded edges.\n\t * @default 4\n\t */\n\t@numberAttribute @receiver bevelThickness = 4\n\t/**\n\t * @property {boolean} centerGeometry - When true, centers the shape geometry\n\t * within the host element's size space.\n\t * @default true\n\t */\n\t@booleanAttribute @receiver centerGeometry = true\n\n\t/**\n\t * @property {string} fitment - Determines how to fit a shape within the\n\t * size area on X and Y. The Z size dictates the shape extrusion separately.\n\t * This takes the same values as the object-fit CSS property, except global\n\t * values. See https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit#values\n\t * for details.\n\t */\n\t@stringAttribute @receiver fitment: 'none' | 'contain' | 'cover' | 'fill' | 'scale-down' = 'none'\n\n\t// TODO attribute to apply smoothing to the geometry (calculate normals)?\n\n\toverride _createComponent() {\n\t\tlet geometry: ExtrudeGeometry | ShapeGeometry\n\n\t\tif (this.element.calculatedSize.z === 0) {\n\t\t\tgeometry = new ShapeGeometry(this.shape, this.curveSegments)\n\t\t} else {\n\t\t\tgeometry = new ExtrudeGeometry(this.shape, {\n\t\t\t\tcurveSegments: this.curveSegments,\n\t\t\t\tbevelSegments: this.bevelSegments,\n\t\t\t\tbevelThickness: this.bevelThickness,\n\t\t\t\tbevelEnabled: this.bevel,\n\t\t\t\tdepth: this.element.calculatedSize.z,\n\t\t\t})\n\t\t}\n\n\t\tif (this.centerGeometry) geometry.center()\n\n\t\t// Make a Shape's Y coordinates go downward to match with LUME's coordinate system.\n\t\t// Negative scale throws a lot of things off, causing lighting not to work due to normals going the wrong direction.\n\t\tgeometry.scale(1, -1, 1)\n\t\t// So we have to do the following to reverse the effects:\n\t\thandleInvertedGeometry(geometry)\n\n\t\tif (this.fitment === 'none') return geometry\n\n\t\tlet minX = Number.MAX_VALUE\n\t\tlet maxX = -Number.MAX_VALUE\n\t\tlet minY = Number.MAX_VALUE\n\t\tlet maxY = -Number.MAX_VALUE\n\n\t\tconst verts = geometry.attributes.position.array\n\t\tconst stride = 3\n\n\t\tfor (let i = 0, l = verts.length / stride; i < l; i++) {\n\t\t\tconst x = verts[i * stride + 0]\n\t\t\tconst y = verts[i * stride + 1]\n\t\t\tif (x < minX) minX = x\n\t\t\tif (x > maxX) maxX = x\n\t\t\tif (y < minY) minY = y\n\t\t\tif (y > maxY) maxY = y\n\t\t}\n\n\t\tconst shapeSizeX = maxX - minX\n\t\tconst shapeSizeY = maxY - minY\n\n\t\tconst scaleX = shapeSizeX / this.element.calculatedSize.x\n\t\tconst scaleY = shapeSizeY / this.element.calculatedSize.y\n\n\t\tif (this.fitment === 'fill') return geometry.scale(1 / scaleX, 1 / scaleY, 1)\n\n\t\tconst shapeAspect = shapeSizeX / shapeSizeY\n\t\tconst sizeAspect = this.element.calculatedSize.x / this.element.calculatedSize.y\n\n\t\tif (this.fitment === 'contain') {\n\t\t\t// tall\n\t\t\tif (shapeAspect < sizeAspect) geometry.scale(1 / scaleY, 1 / scaleY, 1)\n\t\t\t// wide (or equal)\n\t\t\telse geometry.scale(1 / scaleX, 1 / scaleX, 1)\n\t\t} else if (this.fitment === 'cover') {\n\t\t\t// tall\n\t\t\tif (shapeAspect < sizeAspect) geometry.scale(1 / scaleX, 1 / scaleX, 1)\n\t\t\t// wide (or equal)\n\t\t\telse geometry.scale(1 / scaleY, 1 / scaleY, 1)\n\t\t} else if (this.fitment === 'scale-down') {\n\t\t\tif (!(shapeSizeX <= this.element.calculatedSize.x && shapeSizeY <= this.element.calculatedSize.y)) {\n\t\t\t\t// tall\n\t\t\t\tif (shapeAspect < sizeAspect) geometry.scale(1 / scaleY, 1 / scaleY, 1)\n\t\t\t\t// wide (or equal)\n\t\t\t\telse geometry.scale(1 / scaleX, 1 / scaleX, 1)\n\t\t\t}\n\t\t}\n\n\t\treturn geometry\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('shape-geometry'))\n\telementBehaviors.define('shape-geometry', ShapeGeometryBehavior)\n", "import { BufferGeometry } from '../core/BufferGeometry.js';\nimport { Float32BufferAttribute } from '../core/BufferAttribute.js';\nimport { Vector3 } from '../math/Vector3.js';\n\nclass SphereGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SphereGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\n\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\t\tlet index = 0;\n\t\tconst grid = [];\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\t\tconst verticesRow = [];\n\n\t\t\tconst v = iy / heightSegments;\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy === 0 && thetaStart === 0 ) {\n\n\t\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t\t} else if ( iy === heightSegments && thetaEnd === Math.PI ) {\n\n\t\t\t\tuOffset = - 0.5 / widthSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / widthSegments;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.copy( vertex ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\t\tverticesRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\tgrid.push( verticesRow );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\n\t\t\t\tconst b = grid[ iy ][ ix ];\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nexport { SphereGeometry };\n", "import 'element-behaviors'\nimport {SphereGeometry} from 'three/src/geometries/SphereGeometry.js'\nimport {numberAttribute} from '@lume/element'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {GeometryBehavior} from './GeometryBehavior.js'\n\nexport type SphereGeometryBehaviorAttributes = 'horizontalSegments' | 'verticalSegments'\n\n/**\n * @class SphereGeometryBehavior -\n *\n * Behavior: `sphere-geometry`\n *\n * Makes a sphere-shaped geometry on a [``](../../../meshes/Mesh)\n * element. This is the default geometry behavior on\n * [``](../../../meshes/Sphere) elements.\n *\n * The diameter of the sphere is determined by the `x`\n * [`size`](../../../core/Sizeable#size) of the element.\n *\n * @extends GeometryBehavior\n * @behavior sphere-geometry TODO @behavior jsdoc tag\n */\nexport\n@behavior\nclass SphereGeometryBehavior extends GeometryBehavior {\n\t/**\n\t * @property {number} horizontalSegments -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `32`\n\t *\n\t * The number of divisions around the equator of the sphere. A sphere with 10\n\t * horizontal segments and 10 vertical segments is made up of 100 flat faces.\n\t */\n\t@numberAttribute @receiver horizontalSegments = 32\n\n\t/**\n\t * @property {number} verticalSegments -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `32`\n\t *\n\t * The number of divisions across the height of the plane. A plane with 10\n\t * width segments and 10 height segments is essentially made up of 100 cells\n\t * (or 10 rows and 10 columns of smaller planes)\n\t */\n\t@numberAttribute @receiver verticalSegments = 32\n\n\toverride _createComponent() {\n\t\treturn new SphereGeometry(this.element.calculatedSize.x / 2, this.horizontalSegments, this.verticalSegments)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('sphere-geometry'))\n\telementBehaviors.define('sphere-geometry', SphereGeometryBehavior)\n", "import { BufferGeometry } from '../core/BufferGeometry.js';\nimport { Float32BufferAttribute } from '../core/BufferAttribute.js';\nimport { Vector3 } from '../math/Vector3.js';\n\nclass TorusGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'TorusGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\tradialSegments: radialSegments,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tarc: arc\n\t\t};\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\ttubularSegments = Math.floor( tubularSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst center = new Vector3();\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tconst u = i / tubularSegments * arc;\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\n\n\t}\n\n}\n\nexport { TorusGeometry };\n", "import 'element-behaviors'\nimport {numberAttribute} from '@lume/element'\nimport {TorusGeometry} from 'three/src/geometries/TorusGeometry.js'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {GeometryBehavior} from './GeometryBehavior.js'\nimport {toRadians} from '../../../core/utils/index.js'\n\nexport type TorusGeometryBehaviorAttributes = 'tubeThickness' | 'radialSegments' | 'tubularSegments' | 'arc'\n\n/**\n * @class TorusGeometryBehavior\n *\n * Creates a donut-shaped geometry for [``](../../../meshes/Mesh)\n * elements. This is the geometry behavior of\n * [``](../../../meshes/Torus) elements by default.\n *\n * The outer diameter of the donut is determined by the element's\n * [`calculatedSize.x`](../../../core/Sizeable#calculatedsize). The inner diameter is\n * the element's `calculatedSize.x` minus the donut's\n * [`tubeThickness`](#tubethickness).\n *\n * @extends GeometryBehavior\n */\nexport\n@behavior\nclass TorusGeometryBehavior extends GeometryBehavior {\n\t// TODO tubeThicknessMode: literal or proportional\n\n\t/**\n\t * @property {number} tubeThickness -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `0.1`\n\t *\n\t * The thickness of the tube of the donut, as a fraction of the element's\n\t * `x` size (as a fraction of the overall diameter also determined by the\n\t * element's `x` size). The default `0.1` value means the donut's tube\n\t * thickness is 10% of the overall diameter.\n\t */\n\t@numberAttribute @receiver tubeThickness = 0.1\n\n\t/**\n\t * @property {number} radialSegments -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `16`\n\t *\n\t * The number of segments (or edges) of the circular cross section of the\n\t * donut tube.\n\t */\n\t@numberAttribute @receiver radialSegments = 16\n\n\t/**\n\t * @property {number} tubularSegments -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `32`\n\t *\n\t * The number of tube sections around the donut.\n\t */\n\t@numberAttribute @receiver tubularSegments = 32\n\n\t/**\n\t * @property {number} arc -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `360`\n\t *\n\t * The total angle in degrees around which the donut is constructed. The\n\t * default value of `360` means the tubular segments go all the way around\n\t * to form a whole donut. A value of `180` means we get a half of a donut\n\t * shape.\n\t */\n\t@numberAttribute @receiver arc = 360\n\n\toverride _createComponent() {\n\t\tconst outerDiameter = this.element.calculatedSize.x\n\t\tconst outerRadius = outerDiameter / 2\n\t\tconst {tubeThickness, radialSegments, tubularSegments, arc} = this\n\t\tconst literalThickness = tubeThickness * outerDiameter\n\t\tconst radius = outerRadius - literalThickness / 2\n\n\t\treturn new TorusGeometry(radius, literalThickness, radialSegments, tubularSegments, toRadians(arc))\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('torus-geometry'))\n\telementBehaviors.define('torus-geometry', TorusGeometryBehavior)\n", "const Cache = {\n\n\tenabled: false,\n\n\tfiles: {},\n\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\n\nexport { Cache };\n", "class LoadingManager {\n\n\tconstructor( onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet isLoading = false;\n\t\tlet itemsLoaded = 0;\n\t\tlet itemsTotal = 0;\n\t\tlet urlModifier = undefined;\n\t\tconst handlers = [];\n\n\t\t// Refer to #5689 for the reason why we don't set .onStart\n\t\t// in the constructor\n\n\t\tthis.onStart = undefined;\n\t\tthis.onLoad = onLoad;\n\t\tthis.onProgress = onProgress;\n\t\tthis.onError = onError;\n\n\t\tthis.itemStart = function ( url ) {\n\n\t\t\titemsTotal ++;\n\n\t\t\tif ( isLoading === false ) {\n\n\t\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tisLoading = true;\n\n\t\t};\n\n\t\tthis.itemEnd = function ( url ) {\n\n\t\t\titemsLoaded ++;\n\n\t\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\t\tisLoading = false;\n\n\t\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\t\tscope.onLoad();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.itemError = function ( url ) {\n\n\t\t\tif ( scope.onError !== undefined ) {\n\n\t\t\t\tscope.onError( url );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.resolveURL = function ( url ) {\n\n\t\t\tif ( urlModifier ) {\n\n\t\t\t\treturn urlModifier( url );\n\n\t\t\t}\n\n\t\t\treturn url;\n\n\t\t};\n\n\t\tthis.setURLModifier = function ( transform ) {\n\n\t\t\turlModifier = transform;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.addHandler = function ( regex, loader ) {\n\n\t\t\thandlers.push( regex, loader );\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.removeHandler = function ( regex ) {\n\n\t\t\tconst index = handlers.indexOf( regex );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\thandlers.splice( index, 2 );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.getHandler = function ( file ) {\n\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\t\tconst regex = handlers[ i ];\n\t\t\t\tconst loader = handlers[ i + 1 ];\n\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\t\treturn loader;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t};\n\n\t}\n\n}\n\nconst DefaultLoadingManager = /*@__PURE__*/ new LoadingManager();\n\nexport { DefaultLoadingManager, LoadingManager };\n", "import { DefaultLoadingManager } from './LoadingManager.js';\n\nclass Loader {\n\n\tconstructor( manager ) {\n\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\t\tthis.crossOrigin = 'anonymous';\n\t\tthis.withCredentials = false;\n\t\tthis.path = '';\n\t\tthis.resourcePath = '';\n\t\tthis.requestHeader = {};\n\n\t}\n\n\tload( /* url, onLoad, onProgress, onError */ ) {}\n\n\tloadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.load( url, resolve, onProgress, reject );\n\n\t\t} );\n\n\t}\n\n\tparse( /* data */ ) {}\n\n\tsetCrossOrigin( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t}\n\n\tsetWithCredentials( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t}\n\n\tsetPath( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t}\n\n\tsetResourcePath( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n\tsetRequestHeader( requestHeader ) {\n\n\t\tthis.requestHeader = requestHeader;\n\t\treturn this;\n\n\t}\n\n}\n\nLoader.DEFAULT_MATERIAL_NAME = '__DEFAULT';\n\nexport { Loader };\n", "import { Cache } from './Cache.js';\nimport { Loader } from './Loader.js';\nimport { createElementNS } from '../utils.js';\n\nclass ImageLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst image = createElementNS( 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tCache.add( url, this );\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction removeEventListeners() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.slice( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n}\n\n\nexport { ImageLoader };\n", "import { createElementNS } from '../utils.js';\nimport { SRGBToLinear } from '../math/ColorManagement.js';\n\nlet _canvas;\n\nclass ImageUtils {\n\n\tstatic getDataURL( image ) {\n\n\t\tif ( /^data:/i.test( image.src ) ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tif ( typeof HTMLCanvasElement === 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tlet canvas;\n\n\t\tif ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tconst context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );\n\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\n\n\t\t} else {\n\n\t\t\treturn canvas.toDataURL( 'image/png' );\n\n\t\t}\n\n\t}\n\n\tstatic sRGBToLinear( image ) {\n\n\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\tconst canvas = createElementNS( 'canvas' );\n\n\t\t\tcanvas.width = image.width;\n\t\t\tcanvas.height = image.height;\n\n\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\tconst imageData = context.getImageData( 0, 0, image.width, image.height );\n\t\t\tconst data = imageData.data;\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;\n\n\t\t\t}\n\n\t\t\tcontext.putImageData( imageData, 0, 0 );\n\n\t\t\treturn canvas;\n\n\t\t} else if ( image.data ) {\n\n\t\t\tconst data = image.data.slice( 0 );\n\n\t\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\t\tif ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {\n\n\t\t\t\t\tdata[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// assuming float\n\n\t\t\t\t\tdata[ i ] = SRGBToLinear( data[ i ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdata: data,\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );\n\t\t\treturn image;\n\n\t\t}\n\n\t}\n\n}\n\nexport { ImageUtils };\n", "import { ImageUtils } from '../extras/ImageUtils.js';\nimport * as MathUtils from '../math/MathUtils.js';\n\nlet _sourceId = 0;\n\nclass Source {\n\n\tconstructor( data = null ) {\n\n\t\tthis.isSource = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _sourceId ++ } );\n\n\t\tthis.uuid = MathUtils.generateUUID();\n\n\t\tthis.data = data;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.images[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.images[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\t\t\tuuid: this.uuid,\n\t\t\turl: ''\n\t\t};\n\n\t\tconst data = this.data;\n\n\t\tif ( data !== null ) {\n\n\t\t\tlet url;\n\n\t\t\tif ( Array.isArray( data ) ) {\n\n\t\t\t\t// cube texture\n\n\t\t\t\turl = [];\n\n\t\t\t\tfor ( let i = 0, l = data.length; i < l; i ++ ) {\n\n\t\t\t\t\tif ( data[ i ].isDataTexture ) {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ].image ) );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\turl.push( serializeImage( data[ i ] ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// texture\n\n\t\t\t\turl = serializeImage( data );\n\n\t\t\t}\n\n\t\t\toutput.url = url;\n\n\t\t}\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.images[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n}\n\nfunction serializeImage( image ) {\n\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t// default images\n\n\t\treturn ImageUtils.getDataURL( image );\n\n\t} else {\n\n\t\tif ( image.data ) {\n\n\t\t\t// images of DataTexture\n\n\t\t\treturn {\n\t\t\t\tdata: Array.from( image.data ),\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height,\n\t\t\t\ttype: image.data.constructor.name\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Texture: Unable to serialize Texture.' );\n\t\t\treturn {};\n\n\t\t}\n\n\t}\n\n}\n\nexport { Source };\n", "import { EventDispatcher } from '../core/EventDispatcher.js';\nimport {\n\tMirroredRepeatWrapping,\n\tClampToEdgeWrapping,\n\tRepeatWrapping,\n\tUnsignedByteType,\n\tRGBAFormat,\n\tLinearMipmapLinearFilter,\n\tLinearFilter,\n\tUVMapping,\n\tsRGBEncoding,\n\tSRGBColorSpace,\n\tNoColorSpace,\n\tLinearEncoding\n} from '../constants.js';\nimport * as MathUtils from '../math/MathUtils.js';\nimport { Vector2 } from '../math/Vector2.js';\nimport { Matrix3 } from '../math/Matrix3.js';\nimport { Source } from './Source.js';\nimport { warnOnce } from '../utils.js';\n\nlet _textureId = 0;\n\nclass Texture extends EventDispatcher {\n\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace ) {\n\n\t\tsuper();\n\n\t\tthis.isTexture = true;\n\n\t\tObject.defineProperty( this, 'id', { value: _textureId ++ } );\n\n\t\tthis.uuid = MathUtils.generateUUID();\n\n\t\tthis.name = '';\n\n\t\tthis.source = new Source( image );\n\t\tthis.mipmaps = [];\n\n\t\tthis.mapping = mapping;\n\t\tthis.channel = 0;\n\n\t\tthis.wrapS = wrapS;\n\t\tthis.wrapT = wrapT;\n\n\t\tthis.magFilter = magFilter;\n\t\tthis.minFilter = minFilter;\n\n\t\tthis.anisotropy = anisotropy;\n\n\t\tthis.format = format;\n\t\tthis.internalFormat = null;\n\t\tthis.type = type;\n\n\t\tthis.offset = new Vector2( 0, 0 );\n\t\tthis.repeat = new Vector2( 1, 1 );\n\t\tthis.center = new Vector2( 0, 0 );\n\t\tthis.rotation = 0;\n\n\t\tthis.matrixAutoUpdate = true;\n\t\tthis.matrix = new Matrix3();\n\n\t\tthis.generateMipmaps = true;\n\t\tthis.premultiplyAlpha = false;\n\t\tthis.flipY = true;\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t\tif ( typeof colorSpace === 'string' ) {\n\n\t\t\tthis.colorSpace = colorSpace;\n\n\t\t} else { // @deprecated, r152\n\n\t\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\t\tthis.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t\t}\n\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\t\tthis.onUpdate = null;\n\n\t\tthis.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n\t\tthis.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n\n\t}\n\n\tget image() {\n\n\t\treturn this.source.data;\n\n\t}\n\n\tset image( value = null ) {\n\n\t\tthis.source.data = value;\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.source = source.source;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\t\tthis.channel = source.channel;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.colorSpace = source.colorSpace;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tthis.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.6,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\timage: this.source.toJSON( meta ).uuid,\n\n\t\t\tmapping: this.mapping,\n\t\t\tchannel: this.channel,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\tinternalFormat: this.internalFormat,\n\t\t\ttype: this.type,\n\t\t\tcolorSpace: this.colorSpace,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tgenerateMipmaps: this.generateMipmaps,\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( Object.keys( this.userData ).length > 0 ) output.userData = this.userData;\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\ttransformUv( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) {\n\n\t\t\tthis.version ++;\n\t\t\tthis.source.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tget encoding() { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\treturn this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;\n\n\t}\n\n\tset encoding( encoding ) { // @deprecated, r152\n\n\t\twarnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );\n\t\tthis.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;\n\n\t}\n\n}\n\nTexture.DEFAULT_IMAGE = null;\nTexture.DEFAULT_MAPPING = UVMapping;\nTexture.DEFAULT_ANISOTROPY = 1;\n\nexport { Texture };\n", "import { ImageLoader } from './ImageLoader.js';\nimport { Texture } from '../textures/Texture.js';\nimport { Loader } from './Loader.js';\n\nclass TextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new Texture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n}\n\n\nexport { TextureLoader };\n", "// TODO material arrays are not handled. Any LUME elements have one material. If\n// a user makes a subclass or provides a custom three object with a material\n// array, we set properties onto each material, assuming they're all the same\n// type. Perhaps we need an HTML syntax for multiple materials on an element.\n\nimport {onCleanup} from 'solid-js'\nimport {TextureLoader} from 'three/src/loaders/TextureLoader.js'\nimport {Color} from 'three/src/math/Color.js'\nimport {DoubleSide, FrontSide, BackSide, type Side, SRGBColorSpace} from 'three/src/constants.js'\nimport {Material} from 'three/src/materials/Material.js'\nimport {booleanAttribute, stringAttribute, numberAttribute} from '@lume/element'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {GeometryOrMaterialBehavior} from '../GeometryOrMaterialBehavior.js'\n\nimport type {MeshComponentType} from '../MeshBehavior.js'\nimport type {Texture} from 'three'\n\nexport type MaterialBehaviorAttributes =\n\t| 'alphaTest'\n\t| 'colorWrite'\n\t| 'depthTest'\n\t| 'depthWrite'\n\t| 'dithering'\n\t| 'wireframe'\n\t| 'sidedness'\n\t| 'color'\n\t| 'materialOpacity'\n\n/**\n * @class MaterialBehavior -\n *\n * Base class for material behaviors.\n *\n * @extends GeometryOrMaterialBehavior\n */\nexport\n@behavior\nclass MaterialBehavior extends GeometryOrMaterialBehavior {\n\ttype: MeshComponentType = 'material'\n\n\t/**\n\t * @property {number} alphaTest -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `0`\n\t *\n\t * Sets the alpha value to be used when running an alpha test. The material\n\t * will not be rendered if the opacity is lower than this value.\n\t */\n\t@numberAttribute @receiver alphaTest = 0\n\n\t// located in ClipPlanesBehavior instead\n\t// @booleanAttribute @receiver clipIntersection = false\n\t// @booleanAttribute @receiver clipShadows = true\n\n\t/**\n\t * @property {boolean} colorWrite -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `true`\n\t *\n\t * Whether to render the material's color. This can be used in conjunction\n\t * with a mesh's renderOrder property to create invisible objects that\n\t * occlude other objects.\n\t */\n\t@booleanAttribute @receiver colorWrite = true\n\n\t// defines\n\t// depthFunc\n\n\t/**\n\t * @property {boolean} depthTest -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `true`\n\t *\n\t * Whether to have depth test enabled when rendering this material.\n\t */\n\t@booleanAttribute @receiver depthTest = true\n\n\t/**\n\t * @property {boolean} depthWrite -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `true`\n\t *\n\t * Whether rendering this material has any effect on the depth buffer.\n\t *\n\t * When drawing 2D overlays it can be useful to disable the depth writing in\n\t * order to layer several things together without creating z-index\n\t * artifacts.\n\t */\n\t@booleanAttribute @receiver depthWrite = true\n\n\t/**\n\t * @property {boolean} dithering -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `false`\n\t *\n\t * Whether to apply dithering to the color to remove the appearance of\n\t * banding.\n\t */\n\t@booleanAttribute @receiver dithering = false\n\n\t/**\n\t * @property {boolean} fog -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `true`\n\t *\n\t * Whether the material is affected by a [scene's fog](../../../core/Scene#fogMode).\n\t */\n\t@booleanAttribute @receiver fog = true\n\n\t// TODO wireframe works with -geometry behaviors, but not with obj-model\n\t// because obj-model doesn't inherit from geometry. We should share common\n\t// props like wireframe...\n\n\t/**\n\t * @property {boolean} wireframe -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `false`\n\t *\n\t * Whether to render geometry as wireframe, i.e. outlines of polygons. The\n\t * default of `false` renders geometries as smooth shaded.\n\t */\n\t@booleanAttribute @receiver wireframe = false\n\n\t/**\n\t * @property {'front' | 'back' | 'double'} sidedness -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `\"front\"`\n\t *\n\t * Whether to render one side or the other, or both sides, of any polygons\n\t * in the geometry. If the side that isn't rendered is facing towards the\n\t * camera, the polygon will be invisible. Use \"both\" if you want the\n\t * polygons to always be visible no matter which side faces the camera.\n\t */\n\t@stringAttribute @receiver sidedness: 'front' | 'back' | 'double' = 'front'\n\n\t/**\n\t * @property {number} materialOpacity -\n\t *\n\t * `attribute`\n\t *\n\t * Default: `1`\n\t *\n\t * Opacity of the material only.\n\t *\n\t * The value should be a number from 0 to 1, inclusive. 0 is fully transparent, and 1\n\t * is fully opaque.\n\t *\n\t * This is in addition to an element's\n\t * [`opacity`](../../../core/SharedAPI#opacity), both are multiplied\n\t * together. As an example, if this material's element's `opacity` is `0.5`,\n\t * and this material's `materialOpacity` is `0.5`, then the overall opacity\n\t * of the material will be 0.25 when rendered.\n\t *\n\t * This modifies the material's opacity without affecting CSS rendering,\n\t * whereas modifying an element's `opacity` affects CSS rendering including\n\t * the element's children.\n\t */\n\t@numberAttribute @receiver materialOpacity = 1\n\n\t__color: string | number = 'white'\n\n\t/**\n\t * @property {string | number | Color} color -\n\t *\n\t * Default: `THREE.Color(\"white\")`\n\t *\n\t * Color of the material.\n\t *\n\t * The property can be set with a CSS color value string (f.e. `\"#ff6600\"`\n\t * or `rgb(20, 40, 50)`), a\n\t * [`THREE.Color`](https://threejs.org/docs/index.html?q=material#api/en/math/Color),\n\t * or a number representing the color in hex (f.e. `0xff6600`).\n\t *\n\t * The property always returns the color normalized to a\n\t * [`THREE.Color`](https://threejs.org/docs/index.html?q=material#api/en/math/Color)\n\t * object.\n\t */\n\t@stringAttribute\n\t@receiver\n\tget color(): string | number {\n\t\treturn this.__color\n\t}\n\tset color(val: string | number | Color) {\n\t\tif (typeof val === 'object') this.__color = val.getStyle()\n\t\telse this.__color = val\n\t}\n\n\t/**\n\t * @property {} transparent -\n\t *\n\t * `reactive`\n\t *\n\t * Returns `true` when either the element's\n\t * [`opacity`](../../../core/SharedAPI#opacity) or this material's\n\t * [`materialOpacity`](#materialOpacity) are less than 1.\n\t */\n\tget transparent(): boolean {\n\t\tif (this.element.opacity < 1 || this.materialOpacity < 1) return true\n\t\telse return false\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!mat) return\n\n\t\t\tmat.alphaTest = this.alphaTest\n\t\t\tmat.colorWrite = this.colorWrite\n\t\t\tmat.depthTest = this.depthTest\n\t\t\tmat.depthWrite = this.depthWrite\n\t\t\tmat.dithering = this.dithering\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\t// TODO Better taxonomy organization, no any types, to avoid the below\n\t\t// conditional checks.\n\n\t\t// Only some materials have wireframe.\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!(mat && isWireframeMaterial(mat))) return\n\t\t\tmat.wireframe = this.wireframe\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!(mat && 'side' in mat)) return\n\n\t\t\tlet side: Side\n\n\t\t\tswitch (this.sidedness) {\n\t\t\t\tcase 'front':\n\t\t\t\t\tside = FrontSide\n\t\t\t\t\tbreak\n\t\t\t\tcase 'back':\n\t\t\t\t\tside = BackSide\n\t\t\t\t\tbreak\n\t\t\t\tcase 'double':\n\t\t\t\t\tside = DoubleSide\n\t\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tmat.side = side\n\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!(mat && isColoredMaterial(mat))) return\n\t\t\tmat.color.set(this.color)\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!mat) return\n\n\t\t\tmat.opacity = this.element.opacity * this.materialOpacity\n\t\t\tmat.transparent = this.transparent\n\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\t}\n\n\toverride _createComponent(): Material {\n\t\treturn new Material()\n\t}\n\n\t_handleTexture(\n\t\ttextureUrl: () => string,\n\t\tsetTexture: (mat: NonNullable, t: Texture | null) => void,\n\t\thasTexture: (mat: NonNullable) => boolean,\n\t\tonLoad?: () => void,\n\t\tisColor = false,\n\t) {\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!mat) return\n\n\t\t\tconst url = textureUrl() // this is a dependency of the effect\n\n\t\t\tif (!url) return\n\n\t\t\t// TODO The default material color (if not specified) when\n\t\t\t// there's a texture should be white\n\n\t\t\tlet cleaned = false\n\n\t\t\t// TODO onProgress and onError\n\t\t\tconst texture = new TextureLoader().load(url, () => {\n\t\t\t\tif (cleaned) return\n\n\t\t\t\t// We only need to re-compile the shader when we first\n\t\t\t\t// enable the texture (from null).\n\t\t\t\tif (!hasTexture(mat!)) mat.needsUpdate = true\n\n\t\t\t\tsetTexture(mat!, texture)\n\n\t\t\t\tthis.element.needsUpdate()\n\n\t\t\t\tonLoad?.()\n\n\t\t\t\tthis.element.dispatchEvent(new TextureLoadEvent(url))\n\t\t\t})\n\n\t\t\tif (isColor) texture.colorSpace = SRGBColorSpace\n\n\t\t\tmat.needsUpdate = true // Three.js needs to update the material in the GPU\n\t\t\tthis.element.needsUpdate() // LUME needs to re-render\n\n\t\t\tonCleanup(() => {\n\t\t\t\tcleaned = true\n\t\t\t\ttexture.dispose()\n\t\t\t\tsetTexture(mat!, null)\n\n\t\t\t\tmat.needsUpdate = true // Three.js needs to update the material in the GPU\n\t\t\t\tthis.element.needsUpdate() // LUME needs to re-render\n\t\t\t})\n\t\t})\n\t}\n}\n\nfunction isColoredMaterial(mat: Material): mat is Material & {color: Color} {\n\treturn 'color' in mat\n}\n\nfunction isWireframeMaterial(mat: Material): mat is Material & {wireframe: boolean} {\n\treturn 'wireframe' in mat\n}\n\n/** NOTE: Experimental */\nclass TextureLoadEvent extends Event {\n\toverride type = 'textureload'\n\n\t/** The URL of the loaded texture. */\n\tsrc = ''\n\n\tconstructor(src: string) {\n\t\tsuper('textureload', {bubbles: true, composed: true, cancelable: true})\n\n\t\tthis.src = src\n\t}\n}\n", "import 'element-behaviors'\nimport {stringAttribute} from '@lume/element'\nimport {MeshBasicMaterial} from 'three/src/materials/MeshBasicMaterial.js'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {MaterialBehavior, type MaterialBehaviorAttributes} from './MaterialBehavior.js'\n\nexport type BasicMaterialBehaviorAttributes = MaterialBehaviorAttributes | 'texture' | 'specularMap'\n\nexport\n@behavior\nclass BasicMaterialBehavior extends MaterialBehavior {\n\t@stringAttribute @receiver texture = ''\n\t@stringAttribute @receiver specularMap = ''\n\n\toverride _createComponent() {\n\t\treturn new MeshBasicMaterial()\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis._handleTexture(\n\t\t\t() => this.texture, // map\n\t\t\t(mat, tex) => (mat.map = tex),\n\t\t\tmat => !!mat.map,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.specularMap,\n\t\t\t(mat, tex) => (mat.specularMap = tex),\n\t\t\tmat => !!mat.specularMap,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('basic-material'))\n\telementBehaviors.define('basic-material', BasicMaterialBehavior)\n", "import { MultiplyOperation, TangentSpaceNormalMap } from '../constants.js';\nimport { Material } from './Material.js';\nimport { Vector2 } from '../math/Vector2.js';\nimport { Color } from '../math/Color.js';\n\nclass MeshLambertMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshLambertMaterial = true;\n\n\t\tthis.type = 'MeshLambertMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { MeshLambertMaterial };\n", "import {stringAttribute} from '@lume/element'\nimport 'element-behaviors'\nimport {MeshLambertMaterial} from 'three/src/materials/MeshLambertMaterial.js'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {MaterialBehavior, type MaterialBehaviorAttributes} from './MaterialBehavior.js'\n\nexport type LambertMaterialBehaviorAttributes = MaterialBehaviorAttributes | 'texture' | 'specularMap'\n\n/**\n * @behavior lambert-material\n * @class LambertMaterialBehavior -\n * The `lambert-material` behavior gives any mesh a [Lambertian lighting model](https://en.wikipedia.org/wiki/Lambertian_reflectance)\n * for its material. It uses a\n * [THREE.MeshLambertMaterial](https://threejs.org/docs/index.html?q=lambert#api/en/materials/MeshLambertMaterial) under the hood.\n *\n * ## Example\n *\n * \n * \n *\n * @extends MaterialBehavior\n */\nexport\n@behavior\nclass LambertMaterialBehavior extends MaterialBehavior {\n\t@stringAttribute @receiver texture = ''\n\t@stringAttribute @receiver specularMap = ''\n\n\toverride _createComponent() {\n\t\treturn new MeshLambertMaterial({color: 0x00ff00})\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis._handleTexture(\n\t\t\t() => this.texture,\n\t\t\t(mat, tex) => (mat.map = tex),\n\t\t\tmat => !!mat.map,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.specularMap,\n\t\t\t(mat, tex) => (mat.specularMap = tex),\n\t\t\tmat => !!mat.specularMap,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('lambert-material'))\n\telementBehaviors.define('lambert-material', LambertMaterialBehavior)\n", "import {stringAttribute} from '@lume/element'\nimport 'element-behaviors'\nimport {LineBasicMaterial} from 'three/src/materials/LineBasicMaterial.js'\nimport {MaterialBehavior, type MaterialBehaviorAttributes} from './MaterialBehavior.js'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\n\nexport type LineBasicMaterialBehaviorAttributes = MaterialBehaviorAttributes | 'texture'\n\n/**\n * @class LineBasicMaterialBehavior -\n *\n * Behavior: `line-material`\n *\n * This is the default material behavior for\n * [``](../../../meshes/Line.md) elements. It renders a series of\n * points as a simple colored line, optionally with a texture for coloring. It is\n * backed by Three.js `LineBasicMaterial` underneath. This is typically paired with\n * [`LineGeometryBehavior`](../geometries/LineGeometryBehavior.md).\n *\n * \n * \n *\n * @extends MaterialBehavior\n */\n@behavior\nexport class LineBasicMaterialBehavior extends MaterialBehavior {\n\t/**\n\t * @property {string} texture - A texture to set color along the line.\n\t * Useful when supplying UVs to the geometry being used along with this\n\t * material. Most likely you'll supply UVs by copying data from a modeling\n\t * program like Blender, probably not something you'd program manually.\n\t */\n\t@stringAttribute @receiver texture = ''\n\n\toverride _createComponent() {\n\t\treturn new LineBasicMaterial()\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis._handleTexture(\n\t\t\t() => this.texture,\n\t\t\t(mat, tex) => (mat.map = tex),\n\t\t\tmat => !!mat.map,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('line-material'))\n\telementBehaviors.define('line-material', LineBasicMaterialBehavior)\n", "import { TangentSpaceNormalMap } from '../constants.js';\nimport { Material } from './Material.js';\nimport { Vector2 } from '../math/Vector2.js';\nimport { Color } from '../math/Color.js';\n\nclass MeshStandardMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshStandardMaterial = true;\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.type = 'MeshStandardMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.roughness = 1.0;\n\t\tthis.metalness = 0.0;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.roughnessMap = null;\n\n\t\tthis.metalnessMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapIntensity = 1.0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.fog = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.color.copy( source.color );\n\t\tthis.roughness = source.roughness;\n\t\tthis.metalness = source.metalness;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.roughnessMap = source.roughnessMap;\n\n\t\tthis.metalnessMap = source.metalnessMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\tthis.fog = source.fog;\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { MeshStandardMaterial };\n", "import { Vector2 } from '../math/Vector2.js';\nimport { MeshStandardMaterial } from './MeshStandardMaterial.js';\nimport { Color } from '../math/Color.js';\nimport * as MathUtils from '../math/MathUtils.js';\n\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.isMeshPhysicalMaterial = true;\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.type = 'MeshPhysicalMaterial';\n\n\t\tthis.anisotropyRotation = 0;\n\t\tthis.anisotropyMap = null;\n\n\t\tthis.clearcoatMap = null;\n\t\tthis.clearcoatRoughness = 0.0;\n\t\tthis.clearcoatRoughnessMap = null;\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\t\tthis.clearcoatNormalMap = null;\n\n\t\tthis.ior = 1.5;\n\n\t\tObject.defineProperty( this, 'reflectivity', {\n\t\t\tget: function () {\n\n\t\t\t\treturn ( MathUtils.clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\n\n\t\t\t},\n\t\t\tset: function ( reflectivity ) {\n\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.iridescenceMap = null;\n\t\tthis.iridescenceIOR = 1.3;\n\t\tthis.iridescenceThicknessRange = [ 100, 400 ];\n\t\tthis.iridescenceThicknessMap = null;\n\n\t\tthis.sheenColor = new Color( 0x000000 );\n\t\tthis.sheenColorMap = null;\n\t\tthis.sheenRoughness = 1.0;\n\t\tthis.sheenRoughnessMap = null;\n\n\t\tthis.transmissionMap = null;\n\n\t\tthis.thickness = 0;\n\t\tthis.thicknessMap = null;\n\t\tthis.attenuationDistance = Infinity;\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\n\n\t\tthis.specularIntensity = 1.0;\n\t\tthis.specularIntensityMap = null;\n\t\tthis.specularColor = new Color( 1, 1, 1 );\n\t\tthis.specularColorMap = null;\n\n\t\tthis._anisotropy = 0;\n\t\tthis._clearcoat = 0;\n\t\tthis._iridescence = 0;\n\t\tthis._sheen = 0.0;\n\t\tthis._transmission = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget anisotropy() {\n\n\t\treturn this._anisotropy;\n\n\t}\n\n\tset anisotropy( value ) {\n\n\t\tif ( this._anisotropy > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._anisotropy = value;\n\n\t}\n\n\tget clearcoat() {\n\n\t\treturn this._clearcoat;\n\n\t}\n\n\tset clearcoat( value ) {\n\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._clearcoat = value;\n\n\t}\n\n\tget iridescence() {\n\n\t\treturn this._iridescence;\n\n\t}\n\n\tset iridescence( value ) {\n\n\t\tif ( this._iridescence > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._iridescence = value;\n\n\t}\n\n\tget sheen() {\n\n\t\treturn this._sheen;\n\n\t}\n\n\tset sheen( value ) {\n\n\t\tif ( this._sheen > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._sheen = value;\n\n\t}\n\n\tget transmission() {\n\n\t\treturn this._transmission;\n\n\t}\n\n\tset transmission( value ) {\n\n\t\tif ( this._transmission > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._transmission = value;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.anisotropy = source.anisotropy;\n\t\tthis.anisotropyRotation = source.anisotropyRotation;\n\t\tthis.anisotropyMap = source.anisotropyMap;\n\n\t\tthis.clearcoat = source.clearcoat;\n\t\tthis.clearcoatMap = source.clearcoatMap;\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\t\tthis.ior = source.ior;\n\n\t\tthis.iridescence = source.iridescence;\n\t\tthis.iridescenceMap = source.iridescenceMap;\n\t\tthis.iridescenceIOR = source.iridescenceIOR;\n\t\tthis.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];\n\t\tthis.iridescenceThicknessMap = source.iridescenceThicknessMap;\n\n\t\tthis.sheen = source.sheen;\n\t\tthis.sheenColor.copy( source.sheenColor );\n\t\tthis.sheenColorMap = source.sheenColorMap;\n\t\tthis.sheenRoughness = source.sheenRoughness;\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\n\n\t\tthis.transmission = source.transmission;\n\t\tthis.transmissionMap = source.transmissionMap;\n\n\t\tthis.thickness = source.thickness;\n\t\tthis.thicknessMap = source.thicknessMap;\n\t\tthis.attenuationDistance = source.attenuationDistance;\n\t\tthis.attenuationColor.copy( source.attenuationColor );\n\n\t\tthis.specularIntensity = source.specularIntensity;\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\n\t\tthis.specularColor.copy( source.specularColor );\n\t\tthis.specularColorMap = source.specularColorMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\nexport { MeshPhysicalMaterial };\n", "import 'element-behaviors'\nimport {MeshStandardMaterial} from 'three/src/materials/MeshStandardMaterial.js'\nimport {booleanAttribute, numberAttribute, stringAttribute} from '@lume/element'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {MaterialBehavior, type MaterialBehaviorAttributes} from './MaterialBehavior.js'\n\nexport type StandardMaterialBehaviorAttributes =\n\t| MaterialBehaviorAttributes\n\t| 'alphaMap'\n\t| 'aoMap'\n\t| 'aoMapIntensity'\n\t| 'bumpMap'\n\t| 'bumpScale'\n\t| 'displacementMap'\n\t| 'displacementScale'\n\t| 'displacementBias'\n\t| 'texture' // map\n\t| 'normalMap'\n\t| 'normalScale'\n\t| 'metalness'\n\t| 'metalnessMap'\n\t| 'morphNormals'\n\t| 'morphTargets'\n\t| 'roughness'\n\t| 'roughnessMap'\n\t| 'vertexTangents'\n\n/**\n * @class StandardMaterialBehavior -\n *\n * A standard physically based material, using Metallic-Roughness workflow.\n *\n * Backed by Three.js [`THREE.MeshStandardMaterial`](https://threejs.org/docs/index.html#api/en/materials/MeshStandardMaterial)\n *\n * @extends MaterialBehavior\n */\nexport\n@behavior\nclass StandardMaterialBehavior extends MaterialBehavior {\n\t@stringAttribute @receiver alphaMap = ''\n\t@stringAttribute @receiver aoMap = ''\n\t@numberAttribute @receiver aoMapIntensity = 1\n\t@stringAttribute @receiver bumpMap = ''\n\t@numberAttribute @receiver bumpScale = 1\n\t@stringAttribute @receiver displacementMap = ''\n\t@numberAttribute @receiver displacementScale = 1\n\t@numberAttribute @receiver displacementBias = 0\n\t// emissive?: Color | string | number;\n\t// envMap?: Texture | null;\n\t// @numberAttribute @receiver envMapIntensity?: number\n\t// @numberAttribute @receiver emissiveIntensity?: number\n\t// emissiveMap?: Texture | null;\n\t// lightMap?: Texture | null;\n\t// @numberAttribute @receiver lightMapIntensity?: number\n\t@stringAttribute @receiver texture = '' // map\n\t@stringAttribute @receiver normalMap = ''\n\t// normalMapType\n\t@numberAttribute @receiver normalScale = 1\n\t@numberAttribute @receiver metalness = 0\n\t@stringAttribute @receiver metalnessMap = ''\n\t// @numberAttribute @receiver refractionRatio?: number\n\t@numberAttribute @receiver roughness = 1\n\t@stringAttribute @receiver roughnessMap = ''\n\n\t// wireframe?: boolean\n\n\t// @numberAttribute @receiver wireframeLinewidth?: number // Not supported because the WebGL line width is always 1.\n\n\t// @booleanAttribute @receiver skinning: boolean = false\n\t@booleanAttribute @receiver vertexTangents: boolean = false\n\t@booleanAttribute @receiver morphTargets: boolean = false\n\t@booleanAttribute @receiver morphNormals: boolean = false\n\n\toverride _createComponent() {\n\t\treturn new MeshStandardMaterial()\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!mat) return\n\n\t\t\tmat.aoMapIntensity = this.aoMapIntensity\n\t\t\tmat.bumpScale = this.bumpScale\n\t\t\tmat.displacementScale = this.displacementScale\n\t\t\tmat.displacementBias = this.displacementBias\n\t\t\tmat.normalScale.set(this.normalScale, this.normalScale)\n\t\t\tmat.metalness = this.metalness\n\t\t\t// mat.morphNormals = this.morphNormals\n\t\t\t// mat.morphTargets = this.morphTargets\n\t\t\tmat.roughness = this.roughness\n\t\t\t// mat.vertexTangents = this.vertexTangents\n\n\t\t\t// TODO Needed?\n\t\t\t// mat.needsUpdate = true\n\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\tthis._handleTexture(\n\t\t\t() => this.alphaMap,\n\t\t\t(mat, tex) => (mat.alphaMap = tex),\n\t\t\tmat => !!mat.alphaMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.aoMap,\n\t\t\t(mat, tex) => (mat.aoMap = tex),\n\t\t\tmat => !!mat.aoMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.bumpMap,\n\t\t\t(mat, tex) => (mat.bumpMap = tex),\n\t\t\tmat => !!mat.bumpMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.displacementMap,\n\t\t\t(mat, tex) => (mat.displacementMap = tex),\n\t\t\tmat => !!mat.displacementMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.texture, // map\n\t\t\t(mat, tex) => (mat.map = tex),\n\t\t\tmat => !!mat.map,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.normalMap,\n\t\t\t(mat, tex) => (mat.normalMap = tex),\n\t\t\tmat => !!mat.normalMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.metalnessMap,\n\t\t\t(mat, tex) => (mat.metalnessMap = tex),\n\t\t\tmat => !!mat.metalnessMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.roughnessMap,\n\t\t\t(mat, tex) => (mat.roughnessMap = tex),\n\t\t\tmat => !!mat.roughnessMap,\n\t\t)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('standard-material'))\n\telementBehaviors.define('standard-material', StandardMaterialBehavior)\n\n// This prevents errors with mixins. https://discord.com/channels/508357248330760243/508357248330760249/954526657312604180\nexport type MixinBaseClass = T extends new (..._: any) => infer I\n\t? {[K in keyof T]: T[K]} & (new (...args: any[]) => I)\n\t: new (...args: any[]) => T\n", "import {numberAttribute, stringAttribute} from '@lume/element'\nimport 'element-behaviors'\nimport {MeshPhysicalMaterial} from 'three/src/materials/MeshPhysicalMaterial.js'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {StandardMaterialBehavior} from './StandardMaterialBehavior.js'\n\nimport type {StandardMaterialBehaviorAttributes} from './StandardMaterialBehavior.js'\n\nexport type PhysicalMaterialBehaviorAttributes =\n\t| StandardMaterialBehaviorAttributes\n\t| 'clearcoat'\n\t| 'clearcoatRoughness'\n\t| 'refractiveIndex'\n\t| 'reflectivity'\n\t| 'transmission'\n\t| 'transmissionMap'\n\n/**\n * @class PhysicalMaterialBehavior -\n *\n * An extension of the [`StandardMaterialBehavior`](./StandardMaterialBehavior), providing more advanced physically-based rendering properties.\n *\n * Backed by Three.js [`THREE.MeshPhysicalMaterial`](https://threejs.org/docs/index.html#api/en/materials/MeshPhysicalMaterial)\n *\n * @extends MaterialBehavior\n */\nexport\n@behavior\nclass PhysicalMaterialBehavior extends StandardMaterialBehavior {\n\t// WIP\n\t@numberAttribute @receiver clearcoat = 0\n\t// clearcoatMap\n\t// clearcoatNormalMap\n\t// clearcoatNormalScale\n\t@numberAttribute @receiver clearcoatRoughness = 0\n\t// clearcoatRoughnessMap\n\t// defines\n\t@numberAttribute @receiver refractiveIndex = 1.5\n\t@numberAttribute @receiver reflectivity = 0.5\n\t// @numberAttribute @receiver sheen = 0 // TODO update to latest three to enable this\n\t// @numberAttribute @receiver sheenRoughness = 0\n\t// sheenRoughnessMap\n\t// sheenColor\n\t// sheenColorMap\n\t// @numberAttribute @receiver specularIntensity = 0\n\t// specularIntensityMap\n\t// specularColor\n\t// specularColorMap\n\t@numberAttribute @receiver transmission = 0\n\t@stringAttribute @receiver transmissionMap = ''\n\n\toverride _createComponent() {\n\t\treturn new MeshPhysicalMaterial({})\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!mat) return\n\n\t\t\tmat.clearcoat = this.clearcoat\n\t\t\tmat.clearcoatRoughness = this.clearcoatRoughness\n\t\t\tmat.ior = this.refractiveIndex\n\t\t\tmat.reflectivity = this.reflectivity\n\t\t\tmat.transmission = this.transmission\n\n\t\t\t// TODO Needed?\n\t\t\t// mat.needsUpdate = true\n\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\tthis._handleTexture(\n\t\t\t() => this.transmissionMap,\n\t\t\t(mat, tex) => (mat.transmissionMap = tex),\n\t\t\tmat => !!mat.transmissionMap,\n\t\t)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('physical-material'))\n\telementBehaviors.define('physical-material', PhysicalMaterialBehavior)\n", "import 'element-behaviors'\nimport {MeshPhysicalMaterial} from 'three/src/materials/MeshPhysicalMaterial.js'\nimport {NoBlending /*, DoubleSide*/} from 'three/src/constants.js'\nimport {PhysicalMaterialBehavior} from './PhysicalMaterialBehavior.js'\nimport type {ElementWithBehaviors} from 'element-behaviors'\n\n/**\n * @class MixedPlaneMaterialBehavior -\n *\n * Used as the material for [``](../../../meshes/MixedPlane) elements.\n *\n * \n *\n * @extends PhysicalMaterialBehavior\n */\nexport class MixedPlaneMaterialBehavior extends PhysicalMaterialBehavior {\n\tconstructor(element: ElementWithBehaviors) {\n\t\tsuper(element)\n\n\t\t// TODO, these should be class field overrides instead of constructor\n\t\t// properties, so that they include new defaults for attribute removal\n\t\t// from the decorators. At the moment, it isn't easy to override color\n\t\t// because it is a getter/setter and we have to copy over the logic,\n\t\t// which fails because the getter is accessed in the super class before\n\t\t// this subclass has a chance to define its private fields.\n\n\t\t/**\n\t\t * @property {number} materialOpacity -\n\t\t *\n\t\t * `override` `attribute`\n\t\t *\n\t\t * Default: `0.3`\n\t\t *\n\t\t * Overrides\n\t\t * [`PhysicalMaterialBehavior.materialOpacity`](./PhysicalMaterialBehavior#materialOpacity)\n\t\t * to give mixed planes a nice default for viewing DOM content behind\n\t\t * the WebGL canvas, while allowing some light to be caught on the\n\t\t * partially opaque surface for effect. This may require tweaking\n\t\t * depending on lighting and colors.\n\t\t */\n\t\tthis.materialOpacity = 0.3\n\n\t\t/**\n\t\t * @property {number} materialOpacity -\n\t\t *\n\t\t * `override` `attribute`\n\t\t *\n\t\t * Default: `0.3`\n\t\t *\n\t\t * Overrides [`PhysicalMaterialBehavior.color`](./PhysicalMaterialBehavior#color) to\n\t\t * give mixed planes a default tinted transparent surface over regular\n\t\t * DOM content, on which light effects can be drawn.\n\t\t */\n\t\tthis.color = '#444'\n\t}\n\n\toverride _createComponent() {\n\t\treturn new MeshPhysicalMaterial({blending: NoBlending})\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('mixedplane-material'))\n\telementBehaviors.define('mixedplane-material', MixedPlaneMaterialBehavior)\n", "import 'element-behaviors'\nimport {Color} from 'three/src/math/Color.js'\nimport {MeshPhongMaterial} from 'three/src/materials/MeshPhongMaterial.js'\nimport {numberAttribute, stringAttribute, booleanAttribute} from '@lume/element'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {MaterialBehavior, type MaterialBehaviorAttributes} from './MaterialBehavior.js'\n\nexport type PhongMaterialBehaviorAttributes =\n\t| MaterialBehaviorAttributes\n\t| 'alphaMap'\n\t| 'aoMap'\n\t| 'aoMapIntensity'\n\t| 'bumpMap'\n\t| 'bumpScale'\n\t| 'displacementMap'\n\t| 'emissiveMap'\n\t| 'emissive'\n\t| 'emissiveIntensity'\n\t| 'envMap'\n\t| 'flatShading'\n\t| 'lightMap'\n\t| 'lightMapIntensity'\n\t| 'texture' // map\n\t| 'normalMap'\n\t| 'normalScale'\n\t| 'reflectivity'\n\t| 'specularMap'\n\t| 'specular'\n\t| 'shininess'\n\n/**\n * @class PhongMaterialBehavior -\n *\n * A cheaper type of material with less realism, based on older principles,\n * [named after computer graphics pioneer Bui Tuong\n * Phong](https://en.wikipedia.org/wiki/Phong_shading), not as realistic as\n * [`StandardMaterialBehavior`](./StandardMaterialBehavior) or\n * [`PhysicalMaterialBehavior`](./PhysicalMaterialBehavior) can be with their\n * \"physically-based rendering (PBR)\" algorithms.\n *\n * Backed by Three.js [`THREE.MeshPhongMaterial`](https://threejs.org/docs/index.html#api/en/materials/MeshPhongMaterial).\n *\n * @extends MaterialBehavior\n */\nexport\n@behavior\nclass PhongMaterialBehavior extends MaterialBehavior {\n\t@stringAttribute @receiver alphaMap = ''\n\t@stringAttribute @receiver aoMap = ''\n\t@numberAttribute @receiver aoMapIntensity = 1\n\t@stringAttribute @receiver bumpMap = ''\n\t@numberAttribute @receiver bumpScale = 1\n\t// combine\n\t@stringAttribute @receiver displacementMap = ''\n\t@numberAttribute @receiver displacementScale = 1\n\t@numberAttribute @receiver displacementBias = 0\n\t@stringAttribute @receiver emissiveMap = ''\n\n\t// TODO this is not DRY, similar to the .color and .specular properties, consolidate.\n\t@stringAttribute\n\t@receiver\n\tget emissive(): string | number {\n\t\treturn this.#emissive\n\t}\n\tset emissive(val: string | number | Color) {\n\t\tif (typeof val === 'object') this.#emissive = val.getStyle()\n\t\telse this.#emissive = val\n\t}\n\t#emissive: string | number = 'black'\n\n\t@numberAttribute @receiver emissiveIntensity = 1\n\t@stringAttribute @receiver envMap = ''\n\t@booleanAttribute @receiver flatShading = false\n\t@stringAttribute @receiver lightMap = ''\n\t@numberAttribute @receiver lightMapIntensity = 1\n\t@stringAttribute @receiver texture = '' // map\n\t@stringAttribute @receiver normalMap = ''\n\t// normalMapType\n\t@numberAttribute @receiver normalScale = 1\n\t@numberAttribute @receiver reflectivity = 1\n\t@stringAttribute @receiver specularMap = ''\n\n\t@stringAttribute\n\t@receiver\n\tget specular(): string | number {\n\t\treturn this.#specular\n\t}\n\tset specular(val: string | number | Color) {\n\t\tif (typeof val === 'object') this.#specular = val.getStyle()\n\t\telse this.#specular = val\n\t}\n\t#specular: string | number = '#111'\n\n\t@numberAttribute @receiver shininess = 30\n\n\toverride _createComponent() {\n\t\treturn new MeshPhongMaterial({\n\t\t\tcolor: 0x00ff00,\n\t\t})\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!mat) return\n\n\t\t\tmat.aoMapIntensity = this.aoMapIntensity\n\t\t\tmat.bumpScale = this.bumpScale\n\t\t\tmat.displacementScale = this.displacementScale\n\t\t\tmat.displacementBias = this.displacementBias\n\t\t\tmat.emissiveIntensity = this.emissiveIntensity\n\t\t\tmat.flatShading = this.flatShading\n\t\t\tmat.lightMapIntensity = this.lightMapIntensity\n\t\t\tmat.normalScale.set(this.normalScale, this.normalScale)\n\t\t\tmat.reflectivity = this.reflectivity\n\t\t\tmat.shininess = this.shininess\n\n\t\t\t// TODO Needed?\n\t\t\t// mat.needsUpdate = true\n\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.meshComponent?.emissive.set(this.emissive)\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\tthis.createEffect(() => {\n\t\t\tthis.meshComponent?.specular.set(this.specular)\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\tthis._handleTexture(\n\t\t\t() => this.alphaMap,\n\t\t\t(mat, tex) => (mat.alphaMap = tex),\n\t\t\tmat => !!mat.alphaMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.aoMap,\n\t\t\t(mat, tex) => (mat.aoMap = tex),\n\t\t\tmat => !!mat.aoMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.bumpMap,\n\t\t\t(mat, tex) => (mat.bumpMap = tex),\n\t\t\tmat => !!mat.bumpMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.displacementMap,\n\t\t\t(mat, tex) => (mat.displacementMap = tex),\n\t\t\tmat => !!mat.displacementMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.emissiveMap,\n\t\t\t(mat, tex) => (mat.emissiveMap = tex),\n\t\t\tmat => !!mat.emissiveMap,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.envMap,\n\t\t\t(mat, tex) => (mat.envMap = tex),\n\t\t\tmat => !!mat.envMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.lightMap,\n\t\t\t(mat, tex) => (mat.lightMap = tex),\n\t\t\tmat => !!mat.lightMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.texture, // map\n\t\t\t(mat, tex) => (mat.map = tex),\n\t\t\tmat => !!mat.map,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.normalMap,\n\t\t\t(mat, tex) => (mat.normalMap = tex),\n\t\t\tmat => !!mat.normalMap,\n\t\t)\n\t\tthis._handleTexture(\n\t\t\t() => this.specularMap,\n\t\t\t(mat, tex) => (mat.specularMap = tex),\n\t\t\tmat => !!mat.specularMap,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('phong-material'))\n\telementBehaviors.define('phong-material', PhongMaterialBehavior)\n", "import {booleanAttribute, numberAttribute, stringAttribute} from '@lume/element'\nimport 'element-behaviors'\nimport {PointsMaterial} from 'three/src/materials/PointsMaterial.js'\nimport {behavior} from '../../Behavior.js'\nimport {receiver} from '../../PropReceiver.js'\nimport {MaterialBehavior, type MaterialBehaviorAttributes} from './MaterialBehavior.js'\n\nexport type PointsMaterialBehaviorAttributes = MaterialBehaviorAttributes | 'texture' | 'sizeAttenuation' | 'pointSize'\n\nexport\n@behavior\nclass PointsMaterialBehavior extends MaterialBehavior {\n\t@stringAttribute @receiver texture = ''\n\t@booleanAttribute @receiver sizeAttenuation = true\n\t@numberAttribute @receiver pointSize = 1\n\n\toverride _createComponent() {\n\t\treturn new PointsMaterial({color: 0x00ff00})\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\tthis.createEffect(() => {\n\t\t\tconst mat = this.meshComponent\n\t\t\tif (!mat) return\n\n\t\t\tmat.sizeAttenuation = this.sizeAttenuation\n\t\t\tmat.size = this.pointSize\n\n\t\t\tthis.element.needsUpdate()\n\t\t})\n\n\t\tthis._handleTexture(\n\t\t\t() => this.texture,\n\t\t\t(mat, tex) => (mat.map = tex),\n\t\t\tmat => !!mat.map,\n\t\t\t() => {},\n\t\t\ttrue,\n\t\t)\n\t}\n}\n\nif (globalThis.window?.document && !elementBehaviors.has('points-material'))\n\telementBehaviors.define('points-material', PointsMaterialBehavior)\n", "import { WebGLCoordinateSystem } from '../constants.js';\nimport { Matrix4 } from '../math/Matrix4.js';\nimport { Object3D } from '../core/Object3D.js';\n\nclass Camera extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.isCamera = true;\n\n\t\tthis.type = 'Camera';\n\n\t\tthis.matrixWorldInverse = new Matrix4();\n\n\t\tthis.projectionMatrix = new Matrix4();\n\t\tthis.projectionMatrixInverse = new Matrix4();\n\n\t\tthis.coordinateSystem = WebGLCoordinateSystem;\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\tthis.coordinateSystem = source.coordinateSystem;\n\n\t\treturn this;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\treturn super.getWorldDirection( target ).negate();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nexport { Camera };\n", "import { Camera } from './Camera.js';\nimport * as MathUtils from '../math/MathUtils.js';\n\nclass PerspectiveCamera extends Camera {\n\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isPerspectiveCamera = true;\n\n\t\tthis.type = 'PerspectiveCamera';\n\n\t\tthis.fov = fov;\n\t\tthis.zoom = 1;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.focus = 10;\n\n\t\tthis.aspect = aspect;\n\t\tthis.view = null;\n\n\t\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\n\t\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength( focalLength ) {\n\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = MathUtils.RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */\n\tgetFocalLength() {\n\n\t\tconst vExtentSlope = Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t}\n\n\tgetEffectiveFOV() {\n\n\t\treturn MathUtils.RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t}\n\n\tgetFilmWidth() {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t}\n\n\tgetFilmHeight() {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst near = this.near;\n\t\tlet top = near * Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom;\n\t\tlet height = 2 * top;\n\t\tlet width = this.aspect * height;\n\t\tlet left = - 0.5 * width;\n\t\tconst view = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tconst skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n}\n\nexport { PerspectiveCamera };\n", "export function monkeyPatch(shader, { defines = {}, header = '', main = '', ...replacements }) {\n let patchedShader = shader;\n const replaceAll = (str, find, rep) => str.split(find).join(rep);\n Object.keys(replacements).forEach(key => {\n patchedShader = replaceAll(patchedShader, key, replacements[key]);\n });\n patchedShader = patchedShader.replace('void main() {', `\n\t\t\t${header}\n\t\t\tvoid main() {\n\t\t\t\t${main}\n\t\t`);\n const stringDefines = Object.keys(defines)\n .map(d => `#define ${d} ${defines[d]}`)\n .join('\\n');\n return `\n\t\t${stringDefines}\n\t\t${patchedShader}\n\t`;\n}\n// run the callback when the image will be loaded\nexport function addLoadListener(texture, callback) {\n // return if it's already loaded\n if (texture.image && texture.image.videoWidth !== 0 && texture.image.videoHeight !== 0) {\n return;\n }\n const interval = setInterval(() => {\n if (texture.image && texture.image.videoWidth !== 0 && texture.image.videoHeight !== 0) {\n clearInterval(interval);\n return callback(texture);\n }\n }, 16);\n}\n", "export const version = '0.3.1';\n", "import { MeshPhysicalMaterial } from 'three/src/materials/MeshPhysicalMaterial.js';\nimport { PerspectiveCamera } from 'three/src/cameras/PerspectiveCamera.js';\nimport { Texture } from 'three/src/textures/Texture.js';\nimport { Vector2 } from 'three/src/math/Vector2.js';\nimport { InstancedBufferAttribute } from 'three/src/core/InstancedBufferAttribute.js';\nimport { Matrix4 } from 'three/src/math/Matrix4.js';\nimport { Vector3 } from 'three/src/math/Vector3.js';\nimport { monkeyPatch, addLoadListener } from './three-utils.js';\nimport { version } from './version.js';\nexport class ProjectedMaterial extends MeshPhysicalMaterial {\n static version = version;\n // internal values... they are exposed via getters\n #camera = new PerspectiveCamera();\n #fitment = 'contain';\n #textureScale = 1;\n /**\n * The camera to be used for texture projection. Any time you change this,\n * also set `needsUpdate` to `true`.\n * TODO set needsUpdate automatically.\n */\n get camera() {\n return this.#camera;\n }\n set camera(camera) {\n if (!camera || !camera.isCamera) {\n throw new Error('Invalid camera set to the ProjectedMaterial');\n }\n this.#camera = camera;\n this.#saveDimensions();\n this.needsUpdate = true;\n // toggle between two onBeforeCompile functions in order to force\n // WebGLRenderer to make a new program when toggled, or else the\n // renderer will not call onBeforeCompile again if we change the\n // `camera` (the renderer detects the material have changed if it\n // detects a different onBeforeCompile function), which means the\n // material.defines.ORTHOGRAPHIC value will not change when we've\n // changed the `camera` without this trick.\n // Issue: https://discourse.threejs.org/t/38614\n this.onBeforeCompile = isPerspectiveCamera(this.#camera)\n ? this.#onBeforeCompilePerspective\n : this.#onBeforeCompileOrtho;\n }\n get texture() {\n return this.uniforms.projectedTexture.value;\n }\n set texture(texture) {\n if (!texture?.isTexture) {\n throw new Error('Invalid texture set to the ProjectedMaterial');\n }\n this.uniforms.projectedTexture.value = texture;\n this.uniforms.isTextureLoaded.value = Boolean(texture.image);\n if (!this.uniforms.isTextureLoaded.value) {\n addLoadListener(texture, () => {\n this.uniforms.isTextureLoaded.value = true;\n this.#saveDimensions();\n });\n }\n else {\n this.#saveDimensions();\n }\n }\n get textureScale() {\n return this.#textureScale;\n }\n set textureScale(textureScale) {\n this.#textureScale = textureScale;\n this.#saveDimensions();\n }\n get textureOffset() {\n return this.uniforms.textureOffset.value;\n }\n set textureOffset(textureOffset) {\n this.uniforms.textureOffset.value = textureOffset;\n }\n get fitment() {\n return this.#fitment;\n }\n set fitment(value) {\n this.#fitment = value;\n this.#saveDimensions();\n }\n get frontFacesOnly() {\n return this.uniforms.frontFacesOnly.value;\n }\n set frontFacesOnly(frontFacesOnly) {\n this.uniforms.frontFacesOnly.value = frontFacesOnly;\n }\n uniforms;\n isProjectedMaterial = true;\n constructor({ camera, texture = new Texture(), textureScale, textureOffset = new Vector2(), fitment, frontFacesOnly = true, ...options } = {}) {\n if (!texture.isTexture) {\n throw new Error('Invalid texture passed to the ProjectedMaterial');\n }\n if (camera && !camera.isCamera) {\n throw new Error('Invalid camera passed to the ProjectedMaterial');\n }\n super(options);\n Object.defineProperty(this, 'isProjectedMaterial', { value: this.isProjectedMaterial });\n this.#fitment = fitment ?? this.#fitment;\n this.#textureScale = textureScale ?? this.#textureScale;\n this.uniforms = {\n projectedTexture: { value: texture },\n // this avoids rendering black if the texture\n // hasn't loaded yet\n isTextureLoaded: { value: Boolean(texture.image) },\n // don't show the texture if we haven't called project()\n isTextureProjected: { value: false },\n // if we have multiple materials we want to show the\n // background only of the first material\n backgroundOpacity: { value: 1 },\n // these will be set on project()\n viewMatrixCamera: { value: new Matrix4() },\n projectionMatrixCamera: { value: new Matrix4() },\n projPosition: { value: new Vector3() },\n projDirection: { value: new Vector3(0, 0, -1) },\n // we will set this later when we will have positioned the object\n savedModelMatrix: { value: new Matrix4() },\n widthScaled: { value: 1 },\n heightScaled: { value: 1 },\n textureOffset: { value: textureOffset },\n frontFacesOnly: { value: frontFacesOnly },\n };\n if (camera)\n this.camera = camera;\n this.#saveDimensions();\n // If the image texture passed hasn't loaded yet,\n // wait for it to load and compute the correct proportions.\n // This avoids rendering black while the texture is loading\n addLoadListener(texture, () => {\n this.uniforms.isTextureLoaded.value = true;\n this.#saveDimensions();\n });\n }\n #onBeforeCompilePerspective = (shader, ...args) => {\n // @ts-expect-error material \u2728\n delete shader.defines.ORTHOGRAPHIC;\n this.#onBeforeCompileCommon(shader, ...args);\n };\n #onBeforeCompileOrtho = (shader, ...args) => {\n // @ts-expect-error material \u2728\n shader.defines.ORTHOGRAPHIC = '';\n this.#onBeforeCompileCommon(shader, ...args);\n };\n #onBeforeCompileCommon = shader => {\n // expose also the material's uniforms\n Object.assign(this.uniforms, shader.uniforms);\n shader.uniforms = this.uniforms;\n shader.vertexShader = monkeyPatch(shader.vertexShader, {\n header: /* glsl */ `\n\t\t\t\t\tuniform mat4 viewMatrixCamera;\n\t\t\t\t\tuniform mat4 projectionMatrixCamera;\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\t\t\t\t\tattribute vec4 savedModelMatrix0;\n\t\t\t\t\tattribute vec4 savedModelMatrix1;\n\t\t\t\t\tattribute vec4 savedModelMatrix2;\n\t\t\t\t\tattribute vec4 savedModelMatrix3;\n\t\t\t\t\t#else\n\t\t\t\t\tuniform mat4 savedModelMatrix;\n\t\t\t\t\t#endif\n\n\t\t\t\t\tvarying vec3 vSavedNormal;\n\t\t\t\t\tvarying vec4 vTexCoords;\n\t\t\t\t\t#ifndef ORTHOGRAPHIC\n\t\t\t\t\tvarying vec4 vWorldPosition;\n\t\t\t\t\t#endif\n\t\t\t\t`,\n main: /* glsl */ `\n\t\t\t\t\t#ifdef USE_INSTANCING\n\t\t\t\t\tmat4 savedModelMatrix = mat4(\n\t\t\t\t\t\tsavedModelMatrix0,\n\t\t\t\t\t\tsavedModelMatrix1,\n\t\t\t\t\t\tsavedModelMatrix2,\n\t\t\t\t\t\tsavedModelMatrix3\n\t\t\t\t\t);\n\t\t\t\t\t#endif\n\n\t\t\t\t\tvSavedNormal = mat3(savedModelMatrix) * normal;\n\t\t\t\t\tvTexCoords = projectionMatrixCamera * viewMatrixCamera * savedModelMatrix * vec4(position, 1.0);\n\t\t\t\t\t#ifndef ORTHOGRAPHIC\n\t\t\t\t\tvWorldPosition = savedModelMatrix * vec4(position, 1.0);\n\t\t\t\t\t#endif\n\t\t\t\t`,\n });\n shader.fragmentShader = monkeyPatch(shader.fragmentShader, {\n header: /* glsl */ `\n\t\t\t\t\tuniform sampler2D projectedTexture;\n\t\t\t\t\tuniform bool isTextureLoaded;\n\t\t\t\t\tuniform bool isTextureProjected;\n\t\t\t\t\tuniform float backgroundOpacity;\n\t\t\t\t\tuniform vec3 projPosition;\n\t\t\t\t\tuniform vec3 projDirection;\n\t\t\t\t\tuniform float widthScaled;\n\t\t\t\t\tuniform float heightScaled;\n\t\t\t\t\tuniform vec2 textureOffset;\n\t\t\t\t\tuniform bool frontFacesOnly;\n\n\t\t\t\t\tvarying vec3 vSavedNormal;\n\t\t\t\t\tvarying vec4 vTexCoords;\n\t\t\t\t\t#ifndef ORTHOGRAPHIC\n\t\t\t\t\tvarying vec4 vWorldPosition;\n\t\t\t\t\t#endif\n\n\t\t\t\t\tfloat mapRange(float value, float min1, float max1, float min2, float max2) {\n\t\t\t\t\t\treturn min2 + (value - min1) * (max2 - min2) / (max1 - min1);\n\t\t\t\t\t}\n\t\t\t\t`,\n 'vec4 diffuseColor = vec4( diffuse, opacity );': /* glsl */ `\n\t\t\t\t\t// clamp the w to make sure we don't project behind\n\t\t\t\t\tfloat w = max(vTexCoords.w, 0.0);\n\n\t\t\t\t\tvec2 uv = (vTexCoords.xy / w) * 0.5 + 0.5;\n\n\t\t\t\t\tuv += textureOffset;\n\n\t\t\t\t\t// apply the corrected width and height\n\t\t\t\t\tuv.x = mapRange(uv.x, 0.0, 1.0, 0.5 - widthScaled / 2.0, 0.5 + widthScaled / 2.0);\n\t\t\t\t\tuv.y = mapRange(uv.y, 0.0, 1.0, 0.5 - heightScaled / 2.0, 0.5 + heightScaled / 2.0);\n\n\t\t\t\t\t// this makes sure we don't sample out of the texture\n\t\t\t\t\tbool isInTexture = (max(uv.x, uv.y) <= 1.0 && min(uv.x, uv.y) >= 0.0);\n\n\t\t\t\t\t// this makes sure we don't render also the back of the object if frontFacesOnly is true\n\t\t\t\t\t// FIXME projection direction is wrong in some cases, namely\n\t\t\t\t\t// when the camera and the target are both a child and not at the\n\t\t\t\t\t// scene origin.\n\t\t\t\t\t#ifdef ORTHOGRAPHIC\n\t\t\t\t\tvec3 projectorDirection = projDirection;\n\t\t\t\t\t#else\n\t\t\t\t\tvec3 projectorDirection = normalize(projPosition - vWorldPosition.xyz);\n\t\t\t\t\t#endif\n\t\t\t\t\tfloat dotProduct = dot(vSavedNormal, projectorDirection);\n\t\t\t\t\tbool isFacingProjector = frontFacesOnly ? dotProduct > 0.0000001 : true;\n\n\n\t\t\t\t\tvec4 diffuseColor = vec4(diffuse, opacity * backgroundOpacity);\n\n\t\t\t\t\tif (isFacingProjector && isInTexture && isTextureLoaded && isTextureProjected) {\n\t\t\t\t\t\tvec4 textureColor = texture2D(projectedTexture, uv);\n\n\t\t\t\t\t\t// apply the material opacity\n\t\t\t\t\t\ttextureColor.a *= opacity;\n\n\t\t\t\t\t\t// https://learnopengl.com/Advanced-OpenGL/Blending\n\t\t\t\t\t\tdiffuseColor = textureColor * textureColor.a + diffuseColor * (1.0 - textureColor.a);\n\t\t\t\t\t}\n\t\t\t\t`,\n });\n };\n /**\n * Call this any time the camera-specific parameters have been updated\n * externally. Non-camera-specific changes are otherwise covered by the project()\n * method.\n */\n updateFromCamera() {\n this.uniforms.projectionMatrixCamera.value.copy(this.camera.projectionMatrix);\n this.#saveDimensions();\n }\n #saveDimensions() {\n // scale to keep the image proportions and apply textureScale\n computeScaledDimensions(this.texture, this.camera, this.textureScale, this.fitment, size);\n this.uniforms.widthScaled.value = size.x;\n this.uniforms.heightScaled.value = size.y;\n }\n #saveCameraMatrices(updateWorldMatrices = true) {\n // make sure the camera matrices are updated\n this.camera.updateProjectionMatrix(); // TODO move to updateFromCamera()\n if (updateWorldMatrices) {\n this.camera.updateMatrixWorld();\n this.camera.updateWorldMatrix(true, false);\n }\n // update the uniforms from the camera so they're\n // fixed in the camera's position at the projection time\n const viewMatrixCamera = this.camera.matrixWorldInverse;\n const projectionMatrixCamera = this.camera.projectionMatrix;\n const modelMatrixCamera = this.camera.matrixWorld;\n this.uniforms.viewMatrixCamera.value.copy(viewMatrixCamera); // TODO rename to cameraMatrixWorldInverse\n this.uniforms.projectionMatrixCamera.value.copy(projectionMatrixCamera); // TODO move to updateFromCamera()\n this.uniforms.projPosition.value.copy(this.camera.position);\n this.uniforms.projDirection.value.set(0, 0, 1).applyMatrix4(modelMatrixCamera);\n // tell the shader we've projected\n this.uniforms.isTextureProjected.value = true;\n }\n /**\n * Call this any time the projection camera or the object with the\n * ProjectedMaterial have been transformed.\n */\n project(mesh, updateWorldMatrices = true) {\n if (!isProjectedMaterial(mesh.material)) {\n throw new Error(`The mesh material must be a ProjectedMaterial`);\n }\n if (!(Array.isArray(mesh.material) ? mesh.material.some(m => m === this) : mesh.material === this)) {\n throw new Error(`The provided mesh doesn't have the same material as where project() has been called from`);\n }\n // make sure the matrix is updated\n if (updateWorldMatrices)\n mesh.updateWorldMatrix(true, false);\n // we save the object model matrix so it's projected relative\n // to that position, like a snapshot\n this.uniforms.savedModelMatrix.value.copy(mesh.matrixWorld);\n // if the material is not the first, output just the texture\n if (Array.isArray(mesh.material)) {\n const materialIndex = mesh.material.indexOf(this);\n if (!mesh.material[materialIndex].transparent) {\n throw new Error(`You have to pass \"transparent: true\" to the ProjectedMaterial if you're working with multiple materials.`);\n }\n if (materialIndex > 0) {\n this.uniforms.backgroundOpacity.value = 0;\n }\n }\n // persist also the current camera position and matrices\n this.#saveCameraMatrices(updateWorldMatrices);\n }\n projectInstanceAt(index, instancedMesh, matrixWorld, { forceCameraSave = false } = {}) {\n if (!instancedMesh.isInstancedMesh) {\n throw new Error(`The provided mesh is not an InstancedMesh`);\n }\n if (!isProjectedMaterial(instancedMesh.material)) {\n throw new Error(`The InstancedMesh material must be a ProjectedMaterial`);\n }\n if (!(Array.isArray(instancedMesh.material)\n ? instancedMesh.material.some(m => m === this)\n : instancedMesh.material === this)) {\n throw new Error(`The provided InstancedMeshhave't i samenclude thas e material where project() has been called from`);\n }\n if (!instancedMesh.geometry.attributes[`savedModelMatrix0`] ||\n !instancedMesh.geometry.attributes[`savedModelMatrix1`] ||\n !instancedMesh.geometry.attributes[`savedModelMatrix2`] ||\n !instancedMesh.geometry.attributes[`savedModelMatrix3`]) {\n throw new Error(`No allocated data found on the geometry, please call 'allocateProjectionData(geometry, instancesCount)'`);\n }\n instancedMesh.geometry.attributes[`savedModelMatrix0`].setXYZW(index, matrixWorld.elements[0], matrixWorld.elements[1], matrixWorld.elements[2], matrixWorld.elements[3]);\n instancedMesh.geometry.attributes[`savedModelMatrix1`].setXYZW(index, matrixWorld.elements[4], matrixWorld.elements[5], matrixWorld.elements[6], matrixWorld.elements[7]);\n instancedMesh.geometry.attributes[`savedModelMatrix2`].setXYZW(index, matrixWorld.elements[8], matrixWorld.elements[9], matrixWorld.elements[10], matrixWorld.elements[11]);\n instancedMesh.geometry.attributes[`savedModelMatrix3`].setXYZW(index, matrixWorld.elements[12], matrixWorld.elements[13], matrixWorld.elements[14], matrixWorld.elements[15]);\n // if the material is not the first, output just the texture\n if (Array.isArray(instancedMesh.material)) {\n const materialIndex = instancedMesh.material.indexOf(this);\n if (!instancedMesh.material[materialIndex].transparent) {\n throw new Error(`You have to pass \"transparent: true\" to the ProjectedMaterial if you're working with multiple materials.`);\n }\n if (materialIndex > 0) {\n this.uniforms.backgroundOpacity.value = 0;\n }\n }\n // persist the current camera position and matrices\n // only if it's the first instance since most surely\n // in all other instances the camera won't change\n if (index === 0 || forceCameraSave) {\n this.#saveCameraMatrices();\n }\n }\n copy(source) {\n super.copy(source);\n this.camera = source.camera;\n this.texture = source.texture;\n this.textureScale = source.textureScale;\n this.textureOffset = source.textureOffset;\n this.fitment = source.fitment;\n return this;\n }\n}\n// get camera ratio from different types of cameras\nfunction getCameraRatio(camera) {\n switch (camera.type) {\n case 'PerspectiveCamera': {\n camera = camera; // Cast because Three.js .type property regressed to plain `string` type\n return camera.aspect;\n }\n case 'OrthographicCamera': {\n camera = camera; // Cast because Three.js .type property regressed to plain `string` type\n const width = Math.abs(camera.right - camera.left);\n const height = Math.abs(camera.top - camera.bottom);\n return width / height;\n }\n default: {\n throw new Error(`The given type of camera is currently not supported in ProjectedMaterial`);\n }\n }\n}\nconst size = { x: 1, y: 1 };\n// scale to keep the image proportions and apply textureScale\nfunction computeScaledDimensions(texture, camera, textureScale, fitment, outputSize) {\n // return some default values if the image hasn't loaded yet\n if (!texture.image) {\n outputSize.x = 1;\n outputSize.y = 1;\n return;\n }\n // return if it's a video and if the video hasn't loaded yet\n if (texture.image.videoWidth === 0 && texture.image.videoHeight === 0) {\n outputSize.x = 1;\n outputSize.y = 1;\n return;\n }\n const sourceWidth = texture.image.naturalWidth || texture.image.videoWidth || texture.image.clientWidth;\n const sourceHeight = texture.image.naturalHeight || texture.image.videoHeight || texture.image.clientHeight;\n const cameraWidth = 1;\n const ratioCamera = getCameraRatio(camera);\n const cameraHeight = cameraWidth * (1 / ratioCamera);\n const ratio = sourceWidth / sourceHeight;\n if (fitment === 'cover' ? ratio > ratioCamera : ratio < ratioCamera) {\n const width = cameraHeight * ratio;\n outputSize.x = 1 / ((width / cameraWidth) * textureScale);\n outputSize.y = 1 / textureScale;\n }\n else {\n const height = cameraWidth * (1 / ratio);\n outputSize.x = 1 / textureScale;\n outputSize.y = 1 / ((height / cameraHeight) * textureScale);\n }\n}\nexport function allocateProjectionData(geometry, instancesCount) {\n geometry.setAttribute(`savedModelMatrix0`, new InstancedBufferAttribute(new Float32Array(instancesCount * 4), 4));\n geometry.setAttribute(`savedModelMatrix1`, new InstancedBufferAttribute(new Float32Array(instancesCount * 4), 4));\n geometry.setAttribute(`savedModelMatrix2`, new InstancedBufferAttribute(new Float32Array(instancesCount * 4), 4));\n geometry.setAttribute(`savedModelMatrix3`, new InstancedBufferAttribute(new Float32Array(instancesCount * 4), 4));\n}\nexport function isOrthographicCamera(cam) {\n return cam.isOrthographicCamera;\n}\nexport function isPerspectiveCamera(cam) {\n return cam.isPerspectiveCamera;\n}\nexport function isProjectedMaterial(mat) {\n const _mat = mat;\n return Array.isArray(_mat) ? _mat.every(m => m.isProjectedMaterial) : _mat.isProjectedMaterial;\n}\n", "import { Camera } from './Camera.js';\n\nclass OrthographicCamera extends Camera {\n\n\tconstructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.isOrthographicCamera = true;\n\n\t\tthis.type = 'OrthographicCamera';\n\n\t\tthis.zoom = 1;\n\t\tthis.view = null;\n\n\t\tthis.left = left;\n\t\tthis.right = right;\n\t\tthis.top = top;\n\t\tthis.bottom = bottom;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t}\n\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tconst cx = ( this.right + this.left ) / 2;\n\t\tconst cy = ( this.top + this.bottom ) / 2;\n\n\t\tlet left = cx - dx;\n\t\tlet right = cx + dx;\n\t\tlet top = cy + dy;\n\t\tlet bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n}\n\nexport { OrthographicCamera };\n", "// Useful info on THREE.Plane not covered in Three.js docs:\n// https://www.columbia.edu/~njn2118/journal/2019/2/18.html\n\nimport {signal} from 'classy-solid'\nimport {booleanAttribute, element, type ElementAttributes, stringAttribute} from '@lume/element'\nimport {createEffect} from 'solid-js'\nimport {OrthographicCamera} from 'three/src/cameras/OrthographicCamera.js'\nimport {Element3D, type Element3DAttributes} from '../core/Element3D.js'\nimport {autoDefineElements} from '../LumeConfig.js'\nimport type {Fitment} from '@lume/three-projected-material/dist/ProjectedMaterial.js'\nimport type {PerspectiveCamera} from 'three/src/cameras/PerspectiveCamera.js'\n\nexport type TextureProjectorAttributes = Element3DAttributes | 'src' | 'fitment'\n// | 'frontFacesOnly'\n\n/**\n * @class TextureProjector\n *\n * Element: ``\n *\n * An non-rendered plane that can be placed anywhere in 3D space to project a\n * texture onto mesh elements that have `projected-material` behaviors.\n *\n * For now only one `` can be associated to a mesh, and\n * only with an orthographic projection (perpendicular to the plane, i.e. along\n * the direction the plane is facing). Later on we'll support perspective\n * projection and multiple projections.\n *\n * To project a texture onto a mesh element, add a\n * [`projected-material`](../behaviors/mesh-behaviors/ProjectedMaterialBehavior)\n * behavior to the element using the `has=\"\"` attribute, then assign an array of\n * `` elements, or a string of comma-separated CSS\n * selectors, to the element's `projectedTextures` property. The equivalent\n * dash-case attribute accepts only the string of selectors. Only the first\n * texture is used, for now.\n *\n * \n * \n *\n * @extends Element3D\n */\nexport\n@element('lume-texture-projector', autoDefineElements)\nclass TextureProjector extends Element3D {\n\t// This element is only a data and camera container, and\n\t// ProjectedMaterialBehavior reacts to the properties.\n\n\t// TODO selector or ref to