@neurodyn/core-ar 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core-ar.chunk.27b4ab37.min.js +383 -0
- package/dist/core-ar.chunk.27b4ab37.min.js.LICENSE.txt +5 -0
- package/dist/core-ar.chunk.5d925ec9.min.js +61 -0
- package/dist/core-ar.chunk.66c7fd24.min.js +2 -0
- package/dist/core-ar.chunk.66c7fd24.min.js.LICENSE.txt +6 -0
- package/dist/core-ar.chunk.86e9b748.min.js +77 -0
- package/dist/core-ar.chunk.86e9b748.min.js.LICENSE.txt +63 -0
- package/dist/core-ar.chunk.87bc2890.min.js +1 -0
- package/dist/core-ar.chunk.b35bb825.min.js +12 -0
- package/dist/{core-ar.chunk.7a932efa.min.js → core-ar.chunk.df43e0ae.min.js} +7 -3
- package/dist/core-ar.chunk.e2e05712.min.js +983 -0
- package/dist/{core-ar.chunk.09fa4463.min.js.LICENSE.txt → core-ar.chunk.e2e05712.min.js.LICENSE.txt} +0 -30
- package/dist/core-ar.chunk.f136c05d.min.js +6 -0
- package/dist/core-ar.chunk.f136c05d.min.js.LICENSE.txt +36 -0
- package/dist/core-ar.chunk.f52e1e86.min.js +2 -0
- package/dist/core-ar.chunk.f52e1e86.min.js.LICENSE.txt +9 -0
- package/dist/core-ar.embed.min.js +2 -2
- package/dist/index.js +175 -13
- package/dist/static/svg/camera-intro.59d57f3d.svg +139 -0
- package/dist/static/svg/gesture-rotate.03dbf61b.svg +100 -0
- package/dist/static/svg/scan-floor.5dee2ec3.svg +66 -0
- package/dist/static/svg/scan-wall.23490063.svg +58 -0
- package/package.json +4 -2
- package/dist/core-ar.chunk.09fa4463.min.js +0 -987
|
@@ -0,0 +1,983 @@
|
|
|
1
|
+
/*! For license information please see core-ar.chunk.e2e05712.min.js.LICENSE.txt */
|
|
2
|
+
(self.webpackChunk_neurodyn_core_ar=self.webpackChunk_neurodyn_core_ar||[]).push([["872"],{4904(e){"use strict";var t={single_source_shortest_paths:function(e,i,r){var n,a,s,o,l,h,c,u={},d={};d[i]=0;var p=t.PriorityQueue.make();for(p.push(i,0);!p.empty();)for(s in a=(n=p.pop()).value,o=n.cost,l=e[a]||{})l.hasOwnProperty(s)&&(h=o+l[s],c=d[s],(void 0===d[s]||c>h)&&(d[s]=h,p.push(s,h),u[s]=a));if(void 0!==r&&void 0===d[r])throw Error("Could not find a path from "+i+" to "+r+".");return u},extract_shortest_path_from_predecessor_list:function(e,t){for(var i=[],r=t;r;)i.push(r),e[r],r=e[r];return i.reverse(),i},find_path:function(e,i,r){var n=t.single_source_shortest_paths(e,i,r);return t.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(e){var i,r=t.PriorityQueue,n={};for(i in e=e||{},r)r.hasOwnProperty(i)&&(n[i]=r[i]);return n.queue=[],n.sorter=e.sorter||r.default_sorter,n},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){this.queue.push({value:e,cost:t}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},8428(e,t,i){"use strict";i.d(t,{A:()=>r});let r=(0,i(8112).A)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},3946(e,t,i){let r=i(9972),n=i(9908),a=i(7782),s=i(4783);function o(e,t,i,a,s){let o=[].slice.call(arguments,1),l=o.length,h="function"==typeof o[l-1];if(!h&&!r())throw Error("Callback required as last argument");if(h){if(l<2)throw Error("Too few arguments provided");2===l?(s=i,i=t,t=a=void 0):3===l&&(t.getContext&&void 0===s?(s=a,a=void 0):(s=a,a=i,i=t,t=void 0))}else{if(l<1)throw Error("Too few arguments provided");return 1===l?(i=t,t=a=void 0):2!==l||t.getContext||(a=i,i=t,t=void 0),new Promise(function(r,s){try{let s=n.create(i,a);r(e(s,t,a))}catch(e){s(e)}})}try{let r=n.create(i,a);s(null,e(r,t,a))}catch(e){s(e)}}t.create=n.create,t.toCanvas=o.bind(null,a.render),t.toDataURL=o.bind(null,a.renderToDataURL),t.toString=o.bind(null,function(e,t,i){return s.render(e,i)})},9972(e){e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},5734(e,t,i){let r=i(4913).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];let t=Math.floor(e/7)+2,i=r(e),n=145===i?26:2*Math.ceil((i-13)/(2*t-2)),a=[i-7];for(let e=1;e<t-1;e++)a[e]=a[e-1]-n;return a.push(6),a.reverse()},t.getPositions=function(e){let i=[],r=t.getRowColCoords(e),n=r.length;for(let e=0;e<n;e++)for(let t=0;t<n;t++)(0!==e||0!==t)&&(0!==e||t!==n-1)&&(e!==n-1||0!==t)&&i.push([r[e],r[t]]);return i}},8682(e,t,i){let r=i(989),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function a(e){this.mode=r.ALPHANUMERIC,this.data=e}a.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=45*n.indexOf(this.data[t]);i+=n.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(n.indexOf(this.data[t]),6)},e.exports=a},3702(e){function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let i=0;i<t;i++)this.putBit((e>>>t-i-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},2165(e){function t(e){if(!e||e<1)throw Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,i,r){let n=e*this.size+t;this.data[n]=i,r&&(this.reservedBit[n]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,i){this.data[e*this.size+t]^=i},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},9481(e,t,i){let r=i(989);function n(e){this.mode=r.BYTE,"string"==typeof e?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}n.getBitsLength=function(e){return 8*e},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(e){for(let t=0,i=this.data.length;t<i;t++)e.put(this.data[t],8)},e.exports=n},6781(e,t,i){let r=i(4752),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],a=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case r.L:return n[(e-1)*4+0];case r.M:return n[(e-1)*4+1];case r.Q:return n[(e-1)*4+2];case r.H:return n[(e-1)*4+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case r.L:return a[(e-1)*4+0];case r.M:return a[(e-1)*4+1];case r.Q:return a[(e-1)*4+2];case r.H:return a[(e-1)*4+3];default:return}}},4752(e,t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,i){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw Error("Unknown EC Level: "+e)}}catch(e){return i}}},9261(e,t,i){let r=i(4913).getSymbolSize;t.getPositions=function(e){let t=r(e);return[[0,0],[t-7,0],[0,t-7]]}},6174(e,t,i){let r=i(4913),n=r.getBCHDigit(1335);t.getEncodedBits=function(e,t){let i=e.bit<<3|t,a=i<<10;for(;r.getBCHDigit(a)-n>=0;)a^=1335<<r.getBCHDigit(a)-n;return(i<<10|a)^21522}},8366(e,t){let i=new Uint8Array(512),r=new Uint8Array(256),n=1;for(let e=0;e<255;e++)i[e]=n,r[n]=e,256&(n<<=1)&&(n^=285);for(let e=255;e<512;e++)i[e]=i[e-255];t.log=function(e){if(e<1)throw Error("log("+e+")");return r[e]},t.exp=function(e){return i[e]},t.mul=function(e,t){return 0===e||0===t?0:i[r[e]+r[t]]}},9712(e,t,i){let r=i(989),n=i(4913);function a(e){this.mode=r.KANJI,this.data=e}a.getBitsLength=function(e){return 13*e},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let i=n.toSJIS(this.data[t]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");i=(i>>>8&255)*192+(255&i),e.put(i,13)}},e.exports=a},7281(e,t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){let t=e.size,i=0,r=0,n=0,a=null,s=null;for(let o=0;o<t;o++){r=n=0,a=s=null;for(let l=0;l<t;l++){let t=e.get(o,l);t===a?r++:(r>=5&&(i+=3+(r-5)),a=t,r=1),(t=e.get(l,o))===s?n++:(n>=5&&(i+=3+(n-5)),s=t,n=1)}r>=5&&(i+=3+(r-5)),n>=5&&(i+=3+(n-5))}return i},t.getPenaltyN2=function(e){let t=e.size,i=0;for(let r=0;r<t-1;r++)for(let n=0;n<t-1;n++){let t=e.get(r,n)+e.get(r,n+1)+e.get(r+1,n)+e.get(r+1,n+1);(4===t||0===t)&&i++}return 3*i},t.getPenaltyN3=function(e){let t=e.size,i=0,r=0,n=0;for(let a=0;a<t;a++){r=n=0;for(let s=0;s<t;s++)r=r<<1&2047|e.get(a,s),s>=10&&(1488===r||93===r)&&i++,n=n<<1&2047|e.get(s,a),s>=10&&(1488===n||93===n)&&i++}return 40*i},t.getPenaltyN4=function(e){let t=0,i=e.data.length;for(let r=0;r<i;r++)t+=e.data[r];return 10*Math.abs(Math.ceil(100*t/i/5)-10)},t.applyMask=function(e,i){let r=i.size;for(let n=0;n<r;n++)for(let a=0;a<r;a++)i.isReserved(a,n)||i.xor(a,n,function(e,i,r){switch(e){case t.Patterns.PATTERN000:return(i+r)%2==0;case t.Patterns.PATTERN001:return i%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(i+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return i*r%2+i*r%3==0;case t.Patterns.PATTERN110:return(i*r%2+i*r%3)%2==0;case t.Patterns.PATTERN111:return(i*r%3+(i+r)%2)%2==0;default:throw Error("bad maskPattern:"+e)}}(e,a,n))},t.getBestMask=function(e,i){let r=Object.keys(t.Patterns).length,n=0,a=1/0;for(let s=0;s<r;s++){i(s),t.applyMask(s,e);let r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(s,e),r<a&&(a=r,n=s)}return n}},989(e,t,i){let r=i(3673),n=i(863);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw Error("Invalid mode: "+e);if(!r.isValid(t))throw Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,i){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw Error("Unknown mode: "+e)}}catch(e){return i}}},1412(e,t,i){let r=i(989);function n(e){this.mode=r.NUMERIC,this.data=e.toString()}n.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(e){let t,i;for(t=0;t+3<=this.data.length;t+=3)i=parseInt(this.data.substr(t,3),10),e.put(i,10);let r=this.data.length-t;r>0&&(i=parseInt(this.data.substr(t),10),e.put(i,3*r+1))},e.exports=n},2576(e,t,i){let r=i(8366);t.mul=function(e,t){let i=new Uint8Array(e.length+t.length-1);for(let n=0;n<e.length;n++)for(let a=0;a<t.length;a++)i[n+a]^=r.mul(e[n],t[a]);return i},t.mod=function(e,t){let i=new Uint8Array(e);for(;i.length-t.length>=0;){let e=i[0];for(let n=0;n<t.length;n++)i[n]^=r.mul(t[n],e);let n=0;for(;n<i.length&&0===i[n];)n++;i=i.slice(n)}return i},t.generateECPolynomial=function(e){let i=new Uint8Array([1]);for(let n=0;n<e;n++)i=t.mul(i,new Uint8Array([1,r.exp(n)]));return i}},9908(e,t,i){let r=i(4913),n=i(4752),a=i(3702),s=i(2165),o=i(5734),l=i(9261),h=i(7281),c=i(6781),u=i(3025),d=i(3492),p=i(6174),A=i(989),f=i(8356);function g(e,t,i){let r,n,a=e.size,s=p.getEncodedBits(t,i);for(r=0;r<15;r++)n=(s>>r&1)==1,r<6?e.set(r,8,n,!0):r<8?e.set(r+1,8,n,!0):e.set(a-15+r,8,n,!0),r<8?e.set(8,a-r-1,n,!0):r<9?e.set(8,15-r-1+1,n,!0):e.set(8,15-r-1,n,!0);e.set(a-8,8,1,!0)}t.create=function(e,t){let i,p;if(void 0===e||""===e)throw Error("No input text");let m=n.M;return void 0!==t&&(m=n.from(t.errorCorrectionLevel,n.M),i=d.from(t.version),p=h.from(t.maskPattern),t.toSJISFunc&&r.setToSJISFunction(t.toSJISFunc)),function(e,t,i,n){let p;if(Array.isArray(e))p=f.fromArray(e);else if("string"==typeof e){let r=t;if(!r){let t=f.rawSplit(e);r=d.getBestVersionForData(t,i)}p=f.fromString(e,r||40)}else throw Error("Invalid data");let m=d.getBestVersionForData(p,i);if(!m)throw Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<m)throw Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+m+".\n")}else t=m;let v=function(e,t,i){let n=new a;i.forEach(function(t){n.put(t.mode.bit,4),n.put(t.getLength(),A.getCharCountIndicator(t.mode,e)),t.write(n)});let s=(r.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,t))*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);let o=(s-n.getLengthInBits())/8;for(let e=0;e<o;e++)n.put(e%2?17:236,8);return function(e,t,i){let n,a,s=r.getSymbolTotalCodewords(t),o=s-c.getTotalCodewordsCount(t,i),l=c.getBlocksCount(t,i),h=s%l,d=l-h,p=Math.floor(s/l),A=Math.floor(o/l),f=A+1,g=p-A,m=new u(g),v=0,b=Array(l),y=Array(l),x=0,_=new Uint8Array(e.buffer);for(let e=0;e<l;e++){let t=e<d?A:f;b[e]=_.slice(v,v+t),y[e]=m.encode(b[e]),v+=t,x=Math.max(x,t)}let E=new Uint8Array(s),S=0;for(n=0;n<x;n++)for(a=0;a<l;a++)n<b[a].length&&(E[S++]=b[a][n]);for(n=0;n<g;n++)for(a=0;a<l;a++)E[S++]=y[a][n];return E}(n,e,t)}(t,i,p),b=new s(r.getSymbolSize(t));!function(e,t){let i=e.size,r=l.getPositions(t);for(let t=0;t<r.length;t++){let n=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(n+t<=-1)&&!(i<=n+t))for(let r=-1;r<=7;r++)a+r<=-1||i<=a+r||(t>=0&&t<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===t||6===t)||t>=2&&t<=4&&r>=2&&r<=4?e.set(n+t,a+r,!0,!0):e.set(n+t,a+r,!1,!0))}}(b,t);let y=b.size;for(let e=8;e<y-8;e++){let t=e%2==0;b.set(e,6,t,!0),b.set(6,e,t,!0)}return!function(e,t){let i=o.getPositions(t);for(let t=0;t<i.length;t++){let r=i[t][0],n=i[t][1];for(let t=-2;t<=2;t++)for(let i=-2;i<=2;i++)-2===t||2===t||-2===i||2===i||0===t&&0===i?e.set(r+t,n+i,!0,!0):e.set(r+t,n+i,!1,!0)}}(b,t),g(b,i,0),t>=7&&function(e,t){let i,r,n,a=e.size,s=d.getEncodedBits(t);for(let t=0;t<18;t++)i=Math.floor(t/3),r=t%3+a-8-3,n=(s>>t&1)==1,e.set(i,r,n,!0),e.set(r,i,n,!0)}(b,t),!function(e,t){let i=e.size,r=-1,n=i-1,a=7,s=0;for(let o=i-1;o>0;o-=2)for(6===o&&o--;;){for(let i=0;i<2;i++)if(!e.isReserved(n,o-i)){let r=!1;s<t.length&&(r=(t[s]>>>a&1)==1),e.set(n,o-i,r),-1==--a&&(s++,a=7)}if((n+=r)<0||i<=n){n-=r,r=-r;break}}}(b,v),isNaN(n)&&(n=h.getBestMask(b,g.bind(null,b,i))),h.applyMask(n,b),g(b,i,n),{modules:b,version:t,errorCorrectionLevel:i,maskPattern:n,segments:p}}(e,i,m,p)}},3025(e,t,i){let r=i(2576);function n(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}n.prototype.initialize=function(e){this.degree=e,this.genPoly=r.generateECPolynomial(this.degree)},n.prototype.encode=function(e){if(!this.genPoly)throw Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let i=r.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){let e=new Uint8Array(this.degree);return e.set(i,n),e}return i},e.exports=n},863(e,t){let i="[0-9]+",r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",n="(?:(?![A-Z0-9 $%*+\\-./:]|"+(r=r.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";t.KANJI=RegExp(r,"g"),t.BYTE_KANJI=RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=RegExp(n,"g"),t.NUMERIC=RegExp(i,"g"),t.ALPHANUMERIC=RegExp("[A-Z $%*+\\-./:]+","g");let a=RegExp("^"+r+"$"),s=RegExp("^"+i+"$"),o=RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return a.test(e)},t.testNumeric=function(e){return s.test(e)},t.testAlphanumeric=function(e){return o.test(e)}},8356(e,t,i){let r=i(989),n=i(1412),a=i(8682),s=i(9481),o=i(9712),l=i(863),h=i(4913),c=i(4904);function u(e){return unescape(encodeURIComponent(e)).length}function d(e,t,i){let r,n=[];for(;null!==(r=e.exec(i));)n.push({data:r[0],index:r.index,mode:t,length:r[0].length});return n}function p(e){let t,i,n=d(l.NUMERIC,r.NUMERIC,e),a=d(l.ALPHANUMERIC,r.ALPHANUMERIC,e);return h.isKanjiModeEnabled()?(t=d(l.BYTE,r.BYTE,e),i=d(l.KANJI,r.KANJI,e)):(t=d(l.BYTE_KANJI,r.BYTE,e),i=[]),n.concat(a,t,i).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function A(e,t){switch(t){case r.NUMERIC:return n.getBitsLength(e);case r.ALPHANUMERIC:return a.getBitsLength(e);case r.KANJI:return o.getBitsLength(e);case r.BYTE:return s.getBitsLength(e)}}function f(e,t){let i,l=r.getBestModeForData(e);if((i=r.from(t,l))!==r.BYTE&&i.bit<l.bit)throw Error('"'+e+'" cannot be encoded with mode '+r.toString(i)+".\n Suggested mode is: "+r.toString(l));switch(i===r.KANJI&&!h.isKanjiModeEnabled()&&(i=r.BYTE),i){case r.NUMERIC:return new n(e);case r.ALPHANUMERIC:return new a(e);case r.KANJI:return new o(e);case r.BYTE:return new s(e)}}t.fromArray=function(e){return e.reduce(function(e,t){return"string"==typeof t?e.push(f(t,null)):t.data&&e.push(f(t.data,t.mode)),e},[])},t.fromString=function(e,i){let n=function(e,t){let i={},n={start:{}},a=["start"];for(let s=0;s<e.length;s++){let o=e[s],l=[];for(let e=0;e<o.length;e++){let h=o[e],c=""+s+e;l.push(c),i[c]={node:h,lastCount:0},n[c]={};for(let e=0;e<a.length;e++){let s=a[e];i[s]&&i[s].node.mode===h.mode?(n[s][c]=A(i[s].lastCount+h.length,h.mode)-A(i[s].lastCount,h.mode),i[s].lastCount+=h.length):(i[s]&&(i[s].lastCount=h.length),n[s][c]=A(h.length,h.mode)+4+r.getCharCountIndicator(h.mode,t))}}a=l}for(let e=0;e<a.length;e++)n[a[e]].end=0;return{map:n,table:i}}(function(e){let t=[];for(let i=0;i<e.length;i++){let n=e[i];switch(n.mode){case r.NUMERIC:t.push([n,{data:n.data,mode:r.ALPHANUMERIC,length:n.length},{data:n.data,mode:r.BYTE,length:n.length}]);break;case r.ALPHANUMERIC:t.push([n,{data:n.data,mode:r.BYTE,length:n.length}]);break;case r.KANJI:t.push([n,{data:n.data,mode:r.BYTE,length:u(n.data)}]);break;case r.BYTE:t.push([{data:n.data,mode:r.BYTE,length:u(n.data)}])}}return t}(p(e,h.isKanjiModeEnabled())),i),a=c.find_path(n.map,"start","end"),s=[];for(let e=1;e<a.length-1;e++)s.push(n.table[a[e]].node);return t.fromArray(s.reduce(function(e,t){let i=e.length-1>=0?e[e.length-1]:null;return i&&i.mode===t.mode?e[e.length-1].data+=t.data:e.push(t),e},[]))},t.rawSplit=function(e){return t.fromArray(p(e,h.isKanjiModeEnabled()))}},4913(e,t){let i,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw Error('"version" cannot be null or undefined');if(e<1||e>40)throw Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return r[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw Error('"toSJISFunc" is not a valid function.');i=e},t.isKanjiModeEnabled=function(){return void 0!==i},t.toSJIS=function(e){return i(e)}},3673(e,t){t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},3492(e,t,i){let r=i(4913),n=i(6781),a=i(4752),s=i(989),o=i(3673),l=r.getBCHDigit(7973);function h(e,t){return s.getCharCountIndicator(e,t)+4}t.from=function(e,t){return o.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,i){if(!o.isValid(e))throw Error("Invalid QR Code version");void 0===i&&(i=s.BYTE);let a=(r.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,t))*8;if(i===s.MIXED)return a;let l=a-h(i,e);switch(i){case s.NUMERIC:return Math.floor(l/10*3);case s.ALPHANUMERIC:return Math.floor(l/11*2);case s.KANJI:return Math.floor(l/13);case s.BYTE:default:return Math.floor(l/8)}},t.getBestVersionForData=function(e,i){let r,n=a.from(i,a.M);if(Array.isArray(e)){if(e.length>1){for(let i=1;i<=40;i++)if(function(e,t){let i=0;return e.forEach(function(e){let r=h(e.mode,t);i+=r+e.getBitsLength()}),i}(e,i)<=t.getCapacity(i,n,s.MIXED))return i;return}if(0===e.length)return 1;r=e[0]}else r=e;return function(e,i,r){for(let n=1;n<=40;n++)if(i<=t.getCapacity(n,r,e))return n}(r.mode,r.getLength(),n)},t.getEncodedBits=function(e){if(!o.isValid(e)||e<7)throw Error("Invalid QR Code version");let t=e<<12;for(;r.getBCHDigit(t)-l>=0;)t^=7973<<r.getBCHDigit(t)-l;return e<<12|t}},7782(e,t,i){let r=i(6277);t.render=function(e,t,i){var n;let a=i,s=t;void 0!==a||t&&t.getContext||(a=t,t=void 0),t||(s=function(){try{return document.createElement("canvas")}catch(e){throw Error("You need to specify a canvas element")}}()),a=r.getOptions(a);let o=r.getImageWidth(e.modules.size,a),l=s.getContext("2d"),h=l.createImageData(o,o);return r.qrToImageData(h.data,e,a),n=s,l.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=o,n.width=o,n.style.height=o+"px",n.style.width=o+"px",l.putImageData(h,0,0),s},t.renderToDataURL=function(e,i,r){let n=r;void 0!==n||i&&i.getContext||(n=i,i=void 0),n||(n={});let a=t.render(e,i,n),s=n.type||"image/png",o=n.rendererOpts||{};return a.toDataURL(s,o.quality)}},4783(e,t,i){let r=i(6277);function n(e,t){let i=e.a/255,r=t+'="'+e.hex+'"';return i<1?r+" "+t+'-opacity="'+i.toFixed(2).slice(1)+'"':r}function a(e,t,i){let r=e+t;return void 0!==i&&(r+=" "+i),r}t.render=function(e,t,i){let s=r.getOptions(t),o=e.modules.size,l=e.modules.data,h=o+2*s.margin,c=s.color.light.a?"<path "+n(s.color.light,"fill")+' d="M0 0h'+h+"v"+h+'H0z"/>':"",u="<path "+n(s.color.dark,"stroke")+' d="'+function(e,t,i){let r="",n=0,s=!1,o=0;for(let l=0;l<e.length;l++){let h=Math.floor(l%t),c=Math.floor(l/t);h||s||(s=!0),e[l]?(o++,l>0&&h>0&&e[l-1]||(r+=s?a("M",h+i,.5+c+i):a("m",n,0),n=0,s=!1),h+1<t&&e[l+1]||(r+=a("h",o),o=0)):n++}return r}(l,o,s.margin)+'"/>',d='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+('viewBox="0 0 '+h+" ")+h+'" shape-rendering="crispEdges">'+c+u+"</svg>\n";return"function"==typeof i&&i(null,d),d}},6277(e,t){function i(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw Error("Invalid hex color: "+e);(3===t.length||4===t.length)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");let i=parseInt(t.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:255&i,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,n=e.scale||4;return{width:r,scale:r?4:n,margin:t,color:{dark:i(e.color.dark||"#000000ff"),light:i(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,i){let r=t.getScale(e,i);return Math.floor((e+2*i.margin)*r)},t.qrToImageData=function(e,i,r){let n=i.modules.size,a=i.modules.data,s=t.getScale(n,r),o=Math.floor((n+2*r.margin)*s),l=r.margin*s,h=[r.color.light,r.color.dark];for(let t=0;t<o;t++)for(let i=0;i<o;i++){let c=(t*o+i)*4,u=r.color.light;t>=l&&i>=l&&t<o-l&&i<o-l&&(u=h[+!!a[Math.floor((t-l)/s)*n+Math.floor((i-l)/s)]]),e[c++]=u.r,e[c++]=u.g,e[c++]=u.b,e[c]=u.a}}},322(e,t,i){"use strict";let r;i.d(t,{U7:()=>n,UN:()=>f,WW:()=>a,Xq:()=>s,al:()=>l,k$:()=>o,oU:()=>p});let n=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,a=n&&null!=self.XRSession.prototype.requestHitTestSource,s=null!=self.ResizeObserver,o=null!=self.IntersectionObserver,l=a;r=navigator.userAgent||navigator.vendor||self.opera,/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(r)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(r.substr(0,4)),/\bCrOS\b/.test(navigator.userAgent);let h=/android/i.test(navigator.userAgent),c=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;/Safari\//.test(navigator.userAgent);let u=/firefox/i.test(navigator.userAgent),d=/OculusBrowser/.test(navigator.userAgent);c&&/CriOS\//.test(navigator.userAgent);let p=h&&!u&&!d,A=!!(window.webkit&&window.webkit.messageHandlers),f=(()=>{if(!c)return!1;if(A)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{let e=document.createElement("a");return!!(e.relList&&e.relList.supports&&e.relList.supports("ar"))}})()},6650(e,t,i){"use strict";i.d(t,{i:()=>x});var r,n,a,s,o=i(5978),l=i(1718);let h=Symbol("instances"),c=Symbol("activateListener"),u=Symbol("deactivateListener"),d=Symbol("notifyInstances"),p=Symbol("notify"),A=Symbol("callback");class f{static[d](){for(let e of f[h])e[p]()}static[(r=h,c)](){window.addEventListener("scroll",this[d],{passive:!0})}static[u](){window.removeEventListener("scroll",this[d])}constructor(e){this[A]=e}observe(){0===f[h].size&&f[c](),f[h].add(this)}disconnect(){f[h].delete(this),0===f[h].size&&f[u]()}[p](){this[A]()}}f[r]=new Set;let g=Symbol("computeStyleCallback"),m=Symbol("astWalker"),v=Symbol("dependencies"),b=Symbol("onScroll");class y{constructor(e){this[n]={},this[a]=new l.PV(["function"]),this[s]=()=>{this[g]({relatedState:"window-scroll"})},this[g]=e}observeEffectsFor(e){let t={},i=this[v];for(let r in this[m].walk(e,e=>{let{name:r}=e,n=e.arguments[0].terms[0];if("env"===r.value&&null!=n&&"ident"===n.type&&"window-scroll-y"===n.value&&null==t["window-scroll"]){let e="window-scroll"in i?i["window-scroll"]:new f(this[b]);e.observe(),delete i["window-scroll"],t["window-scroll"]=e}}),i)i[r].disconnect();this[v]=t}dispose(){for(let e in this[v])this[v][e].disconnect()}}n=v,a=m,s=b;let x=e=>{let t=e.observeEffects||!1,i=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(r,n)=>{let a=r.updated,s=r.connectedCallback,h=r.disconnectedCallback,c=Symbol(`${n}StyleEffector`),u=Symbol(`${n}StyleEvaluator`),d=Symbol(`${n}UpdateEvaluator`),p=Symbol(`${n}EvaluateAndSync`);Object.defineProperties(r,{[c]:{value:null,writable:!0},[u]:{value:null,writable:!0},[d]:{value:function(){let e=(0,l.$y)(this[n]);this[u]=new o.bk(e,i(this)),null==this[c]&&t&&(this[c]=new y(()=>this[p]())),null!=this[c]&&this[c].observeEffectsFor(e)}},[p]:{value:function(){if(null==this[u])return;let t=this[u].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(n)&&(this[d](),this[p]()),a.call(this,e)}},connectedCallback:{value:function(){s.call(this),this.requestUpdate(n,this[n])}},disconnectedCallback:{value:function(){h.call(this),null!=this[c]&&(this[c].dispose(),this[c]=null)}}})}}},7821(e,t,i){"use strict";i.d(t,{Q:()=>p});var r=i(8413),n=i(3520),a=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let s=Symbol("changeAnimation"),o=Symbol("appendAnimation"),l=Symbol("detachAnimation"),h=Symbol("paused"),c={repetitions:1/0,pingpong:!1},u={pingpong:!1,repetitions:null,weight:1,timeScale:1,fade:!1,warp:!1,relativeWarp:!0,time:null},d={fade:!0},p=e=>{var t;class i extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[n.lC].subscribeMixerEvent("loop",e=>{let t=e.action._loopCount,i=e.action._clip.name,r=e.action._clip.uuid,a=this[n.lC].markedAnimations.find(e=>e.name===i);if(a){this[n.lC].updateAnimationLoop(a.name,a.loopMode,a.repetitionCount);let e=this[n.lC].markedAnimations.filter(e=>e.name!==i);this[n.lC].markedAnimations=e}this.dispatchEvent(new CustomEvent("loop",{detail:{count:t,name:i,uuid:r}}))}),this[n.lC].subscribeMixerEvent("finished",e=>{if(this[n.lC].appendedAnimations.includes(e.action._clip.name)){let t=this[n.lC].appendedAnimations.filter(t=>t!==e.action._clip.name);this[n.lC].appendedAnimations=t}else this[h]=!0;this.dispatchEvent(new CustomEvent("finished"))})}get availableAnimations(){return this.loaded?this[n.lC].animationNames:[]}get duration(){return this[n.lC].duration}get paused(){return this[h]}get currentTime(){return this[n.lC].animationTime}get appendedAnimations(){return this[n.lC].appendedAnimations}set currentTime(e){this[n.lC].animationTime=e,this[n.ML]()}get timeScale(){return this[n.lC].animationTimeScale}set timeScale(e){this[n.lC].animationTimeScale=e}pause(){this[h]||(this[h]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[h]=!1,this[s](e),this.dispatchEvent(new CustomEvent("play")))}appendAnimation(e,t){this.availableAnimations.length>0&&(this[h]=!1,this[o](e,t),this.dispatchEvent(new CustomEvent("append-animation")))}detachAnimation(e,t){this.availableAnimations.length>0&&(this[h]=!1,this[l](e,t),this.dispatchEvent(new CustomEvent("detach-animation")))}[(t=h,n.vA)](){super[n.vA](),this[h]=!0,null!=this.animationName&&this[s](),this.autoplay&&this.play()}[n.Ei](e,t){super[n.Ei](e,t),!this[h]&&(this[n.gJ]()||this[n.m8].isPresenting)&&(this[n.lC].updateAnimation(t/1e3),this[n.ML]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[s]()}[s](e=c){var t;let i=null!=(t=e.repetitions)?t:1/0,r=e.pingpong?2202:1===i?2200:2201;this[n.lC].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,r,i),this[h]&&(this[n.lC].updateAnimation(0),this[n.ML]())}[o](e="",t=u){var i;let r=null!=(i=t.repetitions)?i:1/0,a=t.pingpong?2202:1===r?2200:2201,s=!!t.repetitions||"pingpong"in t;this[n.lC].appendAnimation(e||this.animationName,a,r,t.weight,t.timeScale,t.fade,t.warp,t.relativeWarp,t.time,s),this[h]&&(this[n.lC].updateAnimation(0),this[n.ML]())}[l](e="",t=d){this[n.lC].detachAnimation(e||this.animationName,t.fade),this[h]&&(this[n.lC].updateAnimation(0),this[n.ML]())}}return a([(0,r.MZ)({type:Boolean})],i.prototype,"autoplay",void 0),a([(0,r.MZ)({type:String,attribute:"animation-name"})],i.prototype,"animationName",void 0),a([(0,r.MZ)({type:Number,attribute:"animation-crossfade-duration"})],i.prototype,"animationCrossfadeDuration",void 0),i}},9130(e,t,i){"use strict";i.d(t,{j:()=>d});var r=i(874),n=i(3520),a=i(5112);let s=Symbol("hotspotMap"),o=Symbol("mutationCallback"),l=Symbol("observer"),h=Symbol("addHotspot"),c=Symbol("removeHotspot"),u=new r.kn4,d=e=>{var t,i,d;class p extends e{constructor(){super(...arguments),this[t]=new Map,this[i]=e=>{e.forEach(e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach(e=>{this[h](e)}),e.removedNodes.forEach(e=>{this[c](e)}),this[n.ML]())})},this[d]=new MutationObserver(this[o])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[h](this.children[e]);let{ShadyDOM:e}=self;null==e?this[l].observe(this,{childList:!0}):this[l]=e.observeChildren(this,this[o])}disconnectedCallback(){super.disconnectedCallback();let{ShadyDOM:e}=self;null==e?this[l].disconnect():e.unobserveChildren(this[l])}[(t=s,i=o,d=l,n.vA)](){super[n.vA]();let e=this[n.lC];e.forHotspots(t=>{e.updateSurfaceHotspot(t)})}[n.Ei](e,t){super[n.Ei](e,t);let i=this[n.lC],{annotationRenderer:r}=i,a=i.getCamera();i.shouldRender()&&(i.animateSurfaceHotspots(),i.updateHotspotsVisibility(a.position),r.domElement.style.display="",r.render(i,a))}updateHotspot(e){let t=this[s].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[n.lC].updateSurfaceHotspot(t),this[n.ML]())}queryHotspot(e){let t=this[s].get(e);if(null==t)return null;let i=(0,n.Gw)(t.position),a=(0,n.Gw)(t.normal),o=t.facingCamera,l=this[n.lC],h=l.getCamera(),c=new r.Pq0;c.setFromMatrixPosition(t.matrixWorld),c.project(h);let u=l.width/2,d=l.height/2;c.x=c.x*u+u,c.y=-(c.y*d)+d;let p=(0,n.Gw)(new r.Pq0(c.x,c.y,c.z));return Number.isFinite(p.x)&&Number.isFinite(p.y)?{position:i,normal:a,canvasPosition:p,facingCamera:o}:null}positionAndNormalFromPoint(e,t){let i=this[n.lC],r=i.getNDC(e,t),a=i.positionAndNormalFromPoint(r);if(null==a)return null;u.copy(i.target.matrixWorld).invert();let s=(0,n.Gw)(a.position.applyMatrix4(u)),o=(0,n.Gw)(a.normal.transformDirection(u)),l=null;return null!=a.uv&&(l=(0,n.hC)(a.uv)),{position:s,normal:o,uv:l}}surfaceFromPoint(e,t){let i=this[n.lC],r=i.getNDC(e,t);return i.surfaceFromPoint(r)}[h](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[s].get(e.slot);null!=t?t.increment():(t=new a.Y({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[s].set(e.slot,t),this[n.lC].addHotspot(t)),this[n.lC].queueRender()}[c](e){if(!(e instanceof HTMLElement))return;let t=this[s].get(e.slot);t&&(t.decrement()&&(this[n.lC].removeHotspot(t),this[s].delete(e.slot)),this[n.lC].queueRender())}}return p}},5001(e,t,i){"use strict";let r;i.d(t,{BX:()=>eO});var n=i(8413),a=i(874),s=Uint8Array,o=Uint16Array,l=Int32Array,h=new s([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]),c=new s([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]),u=new s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=function(e,t){for(var i=new o(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];for(var n=new l(i[30]),r=1;r<30;++r)for(var a=i[r];a<i[r+1];++a)n[a]=a-i[r]<<5|r;return{b:i,r:n}},p=d(h,2),A=p.b,f=p.r;A[28]=258,f[258]=28;for(var g=d(c,0),m=(g.b,g.r),v=new o(32768),b=0;b<32768;++b){var y=(43690&b)>>1|(21845&b)<<1;y=(61680&(y=(52428&y)>>2|(13107&y)<<2))>>4|(3855&y)<<4,v[b]=((65280&y)>>8|(255&y)<<8)>>1}for(var x=function(e,t,i){for(var r,n=e.length,a=0,s=new o(t);a<n;++a)e[a]&&++s[e[a]-1];var l=new o(t);for(a=1;a<t;++a)l[a]=l[a-1]+s[a-1]<<1;if(i){r=new o(1<<t);var h=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],d=l[e[a]-1]++<<u,p=d|(1<<u)-1;d<=p;++d)r[v[d]>>h]=c}else for(a=0,r=new o(n);a<n;++a)e[a]&&(r[a]=v[l[e[a]-1]++]>>15-e[a]);return r},_=new s(288),b=0;b<144;++b)_[b]=8;for(var b=144;b<256;++b)_[b]=9;for(var b=256;b<280;++b)_[b]=7;for(var b=280;b<288;++b)_[b]=8;for(var E=new s(32),b=0;b<32;++b)E[b]=5;var S=x(_,9,0),C=x(E,5,0),M=function(e){return(e+7)/8|0},w=function(e,t,i){return(null==t||t<0)&&(t=0),(null==i||i>e.length)&&(i=e.length),new s(e.subarray(t,i))},I=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],T=function(e,t,i){var r=Error(t||I[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,T),!i)throw r;return r},B=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8},R=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8,e[r+2]|=i>>16},D=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var n=i.length,a=i.slice();if(!n)return{t:k,l:0};if(1==n){var l=new s(i[0].s+1);return l[i[0].s]=1,{t:l,l:1}}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var h=i[0],c=i[1],u=0,d=1,p=2;for(i[0]={s:-1,f:h.f+c.f,l:h,r:c};d!=n-1;)h=i[i[u].f<i[p].f?u++:p++],c=i[u!=d&&i[u].f<i[p].f?u++:p++],i[d++]={s:-1,f:h.f+c.f,l:h,r:c};for(var A=a[0].s,r=1;r<n;++r)a[r].s>A&&(A=a[r].s);var f=new o(A+1),g=L(i[d-1],f,0);if(g>t){var r=0,m=0,v=g-t,b=1<<v;for(a.sort(function(e,t){return f[t.s]-f[e.s]||e.f-t.f});r<n;++r){var y=a[r].s;if(f[y]>t)m+=b-(1<<g-f[y]),f[y]=t;else break}for(m>>=v;m>0;){var x=a[r].s;f[x]<t?m-=1<<t-f[x]++-1:++r}for(;r>=0&&m;--r){var _=a[r].s;f[_]==t&&(--f[_],++m)}g=t}return{t:new s(f),l:g}},L=function(e,t,i){return -1==e.s?Math.max(L(e.l,t,i+1),L(e.r,t,i+1)):t[e.s]=i},P=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new o(++t),r=0,n=e[0],a=1,s=function(e){i[r++]=e},l=1;l<=t;++l)if(e[l]==n&&l!=t)++a;else{if(!n&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(n),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(n);a=1,n=e[l]}return{c:i.subarray(0,r),n:t}},U=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},F=function(e,t,i){var r=i.length,n=M(t+2);e[n]=255&r,e[n+1]=r>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var a=0;a<r;++a)e[n+a+4]=i[a];return(n+4+r)*8},N=function(e,t,i,r,n,a,s,l,d,p,A){B(t,A++,i),++n[256];for(var f,g,m,v,b=D(n,15),y=b.t,M=b.l,w=D(a,15),I=w.t,T=w.l,L=P(y),N=L.c,O=L.n,k=P(I),Q=k.c,G=k.n,H=new o(19),z=0;z<N.length;++z)++H[31&N[z]];for(var z=0;z<Q.length;++z)++H[31&Q[z]];for(var V=D(H,7),q=V.t,W=V.l,j=19;j>4&&!q[u[j-1]];--j);var X=p+5<<3,Y=U(n,_)+U(a,E)+s,J=U(n,y)+U(a,I)+s+14+3*j+U(H,q)+2*H[16]+3*H[17]+7*H[18];if(d>=0&&X<=Y&&X<=J)return F(t,A,e.subarray(d,d+p));if(B(t,A,1+(J<Y)),A+=2,J<Y){f=x(y,M,0),g=y,m=x(I,T,0),v=I;var K=x(q,W,0);B(t,A,O-257),B(t,A+5,G-1),B(t,A+10,j-4),A+=14;for(var z=0;z<j;++z)B(t,A+3*z,q[u[z]]);A+=3*j;for(var $=[N,Q],Z=0;Z<2;++Z)for(var ee=$[Z],z=0;z<ee.length;++z){var et=31&ee[z];B(t,A,K[et]),A+=q[et],et>15&&(B(t,A,ee[z]>>5&127),A+=ee[z]>>12)}}else f=S,g=_,m=C,v=E;for(var z=0;z<l;++z){var ei=r[z];if(ei>255){var et=ei>>18&31;R(t,A,f[et+257]),A+=g[et+257],et>7&&(B(t,A,ei>>23&31),A+=h[et]);var er=31&ei;R(t,A,m[er]),A+=v[er],er>3&&(R(t,A,ei>>5&8191),A+=c[er])}else R(t,A,f[ei]),A+=g[ei]}return R(t,A,f[256]),A+g[256]},O=new l([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),k=new s(0),Q=function(e,t,i,r,n,a){var u=a.z||e.length,d=new s(r+u+5*(1+Math.ceil(u/7e3))+n),p=d.subarray(r,d.length-n),A=a.l,g=7&(a.r||0);if(t){g&&(p[0]=a.r>>3);for(var v=O[t-1],b=v>>13,y=8191&v,x=(1<<i)-1,_=a.p||new o(32768),E=a.h||new o(x+1),S=Math.ceil(i/3),C=2*S,I=function(t){return(e[t]^e[t+1]<<S^e[t+2]<<C)&x},T=new l(25e3),B=new o(288),R=new o(32),D=0,L=0,P=a.i||0,U=0,k=a.w||0,Q=0;P+2<u;++P){var G=I(P),H=32767&P,z=E[G];if(_[H]=z,E[G]=H,k<=P){var V=u-P;if((D>7e3||U>24576)&&(V>423||!A)){g=N(e,p,0,T,B,R,L,U,Q,P-Q,g),U=D=L=0,Q=P;for(var q=0;q<286;++q)B[q]=0;for(var q=0;q<30;++q)R[q]=0}var W=2,j=0,X=y,Y=H-z&32767;if(V>2&&G==I(P-Y))for(var J=Math.min(b,V)-1,K=Math.min(32767,P),$=Math.min(258,V);Y<=K&&--X&&H!=z;){if(e[P+W]==e[P+W-Y]){for(var Z=0;Z<$&&e[P+Z]==e[P+Z-Y];++Z);if(Z>W){if(W=Z,j=Y,Z>J)break;for(var ee=Math.min(Y,Z-2),et=0,q=0;q<ee;++q){var ei=P-Y+q&32767,er=_[ei],en=ei-er&32767;en>et&&(et=en,z=ei)}}}z=_[H=z],Y+=H-z&32767}if(j){T[U++]=0x10000000|f[W]<<18|m[j];var ea=31&f[W],es=31&m[j];L+=h[ea]+c[es],++B[257+ea],++R[es],k=P+W,++D}else T[U++]=e[P],++B[e[P]]}}for(P=Math.max(P,k);P<u;++P)T[U++]=e[P],++B[e[P]];g=N(e,p,A,T,B,R,L,U,Q,P-Q,g),A||(a.r=7&g|p[g/8|0]<<3,g-=7,a.h=E,a.p=_,a.i=P,a.w=k)}else{for(var P=a.w||0;P<u+A;P+=65535){var eo=P+65535;eo>=u&&(p[g/8|0]=A,eo=u),g=F(p,g+1,e.subarray(P,eo))}a.i=u}return w(d,0,r+M(g)+n)},G=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&-0x12477ce0)^i>>>1;e[t]=i}return e}(),H=function(){var e=-1;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=G[255&i^t[r]]^i>>>8;e=i},d:function(){return~e}}},z=function(e,t,i,r,n){if(!n&&(n={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new s(a.length+e.length);o.set(a),o.set(e,a.length),e=o,n.w=a.length}return Q(e,null==t.level?6:t.level,null==t.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,r,n)},V=function(e,t){var i={};for(var r in e)i[r]=e[r];for(var r in t)i[r]=t[r];return i},q=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},W=function(e,t,i,r){for(var n in e){var a=e[n],o=t+n,l=r;Array.isArray(a)&&(l=V(r,a[1]),a=a[0]),a instanceof s?i[o]=[a,l]:(i[o+="/"]=[new s(0),l],W(a,o,i,r))}},j="u">typeof TextEncoder&&new TextEncoder,X="u">typeof TextDecoder&&new TextDecoder;try{X.decode(k,{stream:!0})}catch(e){}function Y(e,t){if(t){for(var i=new s(e.length),r=0;r<e.length;++r)i[r]=e.charCodeAt(r);return i}if(j)return j.encode(e);for(var n=e.length,a=new s(e.length+(e.length>>1)),o=0,l=function(e){a[o++]=e},r=0;r<n;++r){if(o+5>a.length){var h=new s(o+8+(n-r<<1));h.set(a),a=h}var c=e.charCodeAt(r);c<128||t?l(c):(c<2048?l(192|c>>6):(c>55295&&c<57344?(l(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++r))>>18),l(128|c>>12&63)):l(224|c>>12),l(128|c>>6&63)),l(128|63&c))}return w(a,0,o)}var J=function(e){var t=0;if(e)for(var i in e){var r=e[i].length;r>65535&&T(9),t+=r+4}return t},K=function(e,t,i,r,n,a,s,o){var l=r.length,h=i.extra,c=o&&o.length,u=J(h);q(e,t,null!=s?0x2014b50:0x4034b50),t+=4,null!=s&&(e[t++]=20,e[t++]=i.os),e[t]=20,t+=2,e[t++]=i.flag<<1|(a<0&&8),e[t++]=n&&8,e[t++]=255&i.compression,e[t++]=i.compression>>8;var d=new Date(null==i.mtime?Date.now():i.mtime),p=d.getFullYear()-1980;if((p<0||p>119)&&T(10),q(e,t,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,-1!=a&&(q(e,t,i.crc),q(e,t+4,a<0?-a-2:a),q(e,t+8,i.size)),q(e,t+12,l),q(e,t+14,u),t+=16,null!=s&&(q(e,t,c),q(e,t+6,i.attrs),q(e,t+10,s),t+=14),e.set(r,t),t+=l,u)for(var A in h){var f=h[A],g=f.length;q(e,t,+A),q(e,t+2,g),e.set(f,t+4),t+=4+g}return c&&(e.set(o,t),t+=c),t},$=function(e,t,i,r,n){q(e,t,0x6054b50),q(e,t+8,i),q(e,t+10,i),q(e,t+12,r),q(e,t+16,n)};"function"==typeof queueMicrotask&&queueMicrotask;class Z{constructor(e,t="",i=[],r=[]){this.name=e,this.type=t,this.metadata=i,this.properties=r,this.children=[]}addMetadata(e,t){this.metadata.push({key:e,value:t})}addProperty(e,t=[]){this.properties.push({property:e,metadata:t})}addChild(e){this.children.push(e)}toString(e=0){let t=" ".repeat(e),i=this.metadata.map(e=>{let i=e.key,r=e.value;if(!Array.isArray(r))return`${i} = ${r}`;{let e=[];return e.push(`${i} = {`),r.forEach(i=>{e.push(`${t} ${i}`)}),e.push(`${t} }`),e.join("\n")}}),r=i.length?` (
|
|
3
|
+
${i.map(e=>`${t} ${e}`).join("\n")}
|
|
4
|
+
${t})`:"",n=this.properties.map(e=>{let i=e.property,r=e.metadata.length?` (
|
|
5
|
+
${e.metadata.map(e=>`${t} ${e}`).join("\n")}
|
|
6
|
+
${t} )`:"";return`${t} ${i}${r}`}),a=this.children.map(t=>t.toString(e+1)),s=[];if(n.length>0&&s.push(...n),a.length>0){n.length>0&&s.push("");for(let e=0;e<a.length;e++)s.push(a[e]),e<a.length-1&&s.push("")}let o=s.join("\n"),l=this.type?this.type+" ":"";return`${t}def ${l}"${this.name}"${r}
|
|
7
|
+
${t}{
|
|
8
|
+
${o}
|
|
9
|
+
${t}}`}}class ee{constructor(){this.textureUtils=null}setTextureUtils(e){this.textureUtils=e}parse(e,t,i,r){this.parseAsync(e,r).then(t).catch(i)}async parseAsync(e,t={}){let i;t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},includeAnchoringProperties:!0,onlyVisible:!0,quickLookCompatible:!1,maxTextureSize:1024},t);let r=new Set,n={},o="model.usda";n[o]=null;let l=new Z("Root","Xform"),h=new Z("Scenes","Scope");h.addMetadata("kind",'"sceneLibrary"'),l.addChild(h);let c="Scene",u=new Z(c,"Xform");u.addMetadata("customData",["bool preliminary_collidesWithEnvironment = 0",`string sceneName = "${c}"`]),u.addMetadata("sceneName",`"${c}"`),t.includeAnchoringProperties&&(u.addProperty(`token preliminary:anchoring:type = "${t.ar.anchoring.type}"`),u.addProperty(`token preliminary:planeAnchoring:alignment = "${t.ar.planeAnchoring.alignment}"`)),h.addChild(u);let d={},p={};!function e(t,i,r,n,a,s){for(let o=0,l=t.children.length;o<l;o++){let l,h=t.children[o];if(!1!==h.visible||!0!==s.onlyVisible){if(h.isMesh){let e=h.geometry,t=h.material;if(t.isMeshStandardMaterial){let i="geometries/Geometry_"+e.id+".usda";if(!(i in a)){let t=function(e){let t=new Z("Geometry"),i=function(e){var t;let i=e.attributes,r=i.position.count,n=new Z("Geometry","Mesh");n.addProperty(`int[] faceVertexCounts = [${Array((null!==(t=e).index?t.index.count:t.attributes.position.count)/3).fill(3).join(", ")}]`),n.addProperty(`int[] faceVertexIndices = [${function(e){let t=e.index,i=[];if(null!==t)for(let e=0;e<t.count;e++)i.push(t.getX(e));else{let t=e.attributes.position.count;for(let e=0;e<t;e++)i.push(e)}return i.join(", ")}(e)}]`),n.addProperty(`normal3f[] normals = [${es(i.normal,r)}]`,['interpolation = "vertex"']),n.addProperty(`point3f[] points = [${es(i.position,r)}]`);for(let e=0;e<4;e++){let t=e>0?e:"",r=i["uv"+t];void 0!==r&&n.addProperty(`texCoord2f[] primvars:st${t} = [${function(e){let t=[];for(let i=0;i<e.count;i++){let r=e.getX(i),n=e.getY(i);t.push(`(${r.toPrecision(7)}, ${1-n.toPrecision(7)})`)}return t.join(", ")}(r)}]`,['interpolation = "vertex"'])}let a=i.color;return void 0!==a&&n.addProperty(`color3f[] primvars:displayColor = [${es(a,r)}]`,['interpolation = "vertex"']),n.addProperty('uniform token subdivisionScheme = "none"'),n}(e);return t.addChild(i),t}(e);a[i]=Y(ei()+"\n"+t.toString())}t.uuid in r||(r[t.uuid]=t),l=function(e,t,i,r){let n=er(e,r);return n.addMetadata("prepend references",`@./geometries/Geometry_${t.id}.usda@</Geometry>`),n.addMetadata("prepend apiSchemas",'["MaterialBindingAPI"]'),n.addProperty(`rel material:binding = </Materials/Material_${i.id}>`),n}(h,e,r[t.uuid],n)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",h)}else l=h.isCamera?function(e,t){let i,r,n=et(e,t),a=en(e.matrix);0>e.matrix.determinant()&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e);let s=new Z(n,"Camera");s.addProperty(`matrix4d xformOp:transform = ${a}`),s.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');let o=e.isOrthographicCamera?"orthographic":"perspective";s.addProperty(`token projection = "${o}"`);let l=`(${e.near.toPrecision(7)}, ${e.far.toPrecision(7)})`;if(s.addProperty(`float2 clippingRange = ${l}`),i=e.isOrthographicCamera?((Math.abs(e.left)+Math.abs(e.right))*10).toPrecision(7):e.getFilmWidth().toPrecision(7),s.addProperty(`float horizontalAperture = ${i}`),r=e.isOrthographicCamera?((Math.abs(e.top)+Math.abs(e.bottom))*10).toPrecision(7):e.getFilmHeight().toPrecision(7),s.addProperty(`float verticalAperture = ${r}`),e.isPerspectiveCamera){let t=e.getFocalLength().toPrecision(7);s.addProperty(`float focalLength = ${t}`);let i=e.focus.toPrecision(7);s.addProperty(`float focusDistance = ${i}`)}return s}(h,n):er(h,n);l&&(i.addChild(l),e(h,l,r,n,a,s))}}}(e,u,d,r,n,t);let A=function(e,t,i=!1){let r=new Z("Materials");for(let n in e){let s=e[n];r.addChild(function(e,t,i=!1){let r=new Z(`Material_${e.id}`,"Material");function n(r,n,a){var s;let o=r.source.id+"_"+r.flipY;t[o]=r;let l=r.channel>0?"st"+r.channel:"st",h={1e3:"repeat",1001:"clamp",1002:"mirror"},c=r.repeat.clone(),u=r.offset.clone(),d=r.rotation,p=Math.sin(d),A=Math.cos(d);u.y=1-u.y-c.y,i?(u.x=u.x/c.x,u.y=u.y/c.y,u.x+=p/c.x,u.y+=A-1):(u.x+=p*c.x,u.y+=(1-A)*c.y);let f=new Z(`PrimvarReader_${n}`,"Shader");f.addProperty('uniform token info:id = "UsdPrimvarReader_float2"'),f.addProperty("float2 inputs:fallback = (0.0, 0.0)"),f.addProperty(`string inputs:varname = "${l}"`),f.addProperty("float2 outputs:result");let g=new Z(`Transform2d_${n}`,"Shader");g.addProperty('uniform token info:id = "UsdTransform2d"'),g.addProperty(`float2 inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${n}.outputs:result>`),g.addProperty(`float inputs:rotation = ${(180/Math.PI*d).toFixed(7)}`),g.addProperty(`float2 inputs:scale = ${el(c)}`),g.addProperty(`float2 inputs:translation = ${el(u)}`),g.addProperty("float2 outputs:result");let m=new Z(`Texture_${r.id}_${n}`,"Shader");return m.addProperty('uniform token info:id = "UsdUVTexture"'),m.addProperty(`asset inputs:file = @textures/Texture_${o}.png@`),m.addProperty(`float2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${n}.outputs:result>`),void 0!==a&&m.addProperty(`float4 inputs:scale = ${(s=a,`(${s.r}, ${s.g}, ${s.b}, 1.0)`)}`),"normal"===n&&(m.addProperty("float4 inputs:scale = (2, 2, 2, 1)"),m.addProperty("float4 inputs:bias = (-1, -1, -1, 0)")),m.addProperty(`token inputs:sourceColorSpace = "${""===r.colorSpace?"raw":"sRGB"}"`),m.addProperty(`token inputs:wrapS = "${h[r.wrapS]}"`),m.addProperty(`token inputs:wrapT = "${h[r.wrapT]}"`),m.addProperty("float outputs:r"),m.addProperty("float outputs:g"),m.addProperty("float outputs:b"),m.addProperty("float3 outputs:rgb"),(e.transparent||e.alphaTest>0)&&m.addProperty("float outputs:a"),[f,g,m]}2===e.side&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",e);let s=new Z("PreviewSurface","Shader");if(s.addProperty('uniform token info:id = "UsdPreviewSurface"'),null!==e.map?(s.addProperty(`color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?s.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(s.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),s.addProperty(`float inputs:opacityThreshold = ${e.alphaTest}`)),n(e.map,"diffuse",e.color).forEach(e=>r.addChild(e))):s.addProperty(`color3f inputs:diffuseColor = ${eo(e.color)}`),null!==e.emissiveMap){s.addProperty(`color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`);let t=new a.Q1f(e.emissive.r*e.emissiveIntensity,e.emissive.g*e.emissiveIntensity,e.emissive.b*e.emissiveIntensity);n(e.emissiveMap,"emissive",t).forEach(e=>r.addChild(e))}else e.emissive.getHex()>0&&s.addProperty(`color3f inputs:emissiveColor = ${eo(e.emissive)}`);if(null!==e.normalMap&&(s.addProperty(`normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),n(e.normalMap,"normal").forEach(e=>r.addChild(e))),null!==e.aoMap){s.addProperty(`float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`);let t=new a.Q1f(e.aoMapIntensity,e.aoMapIntensity,e.aoMapIntensity);n(e.aoMap,"occlusion",t).forEach(e=>r.addChild(e))}if(null!==e.roughnessMap){s.addProperty(`float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`);let t=new a.Q1f(e.roughness,e.roughness,e.roughness);n(e.roughnessMap,"roughness",t).forEach(e=>r.addChild(e))}else s.addProperty(`float inputs:roughness = ${e.roughness}`);if(null!==e.metalnessMap){s.addProperty(`float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`);let t=new a.Q1f(e.metalness,e.metalness,e.metalness);n(e.metalnessMap,"metallic",t).forEach(e=>r.addChild(e))}else s.addProperty(`float inputs:metallic = ${e.metalness}`);if(null!==e.alphaMap?(s.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),s.addProperty("float inputs:opacityThreshold = 0.0001"),n(e.alphaMap,"opacity").forEach(e=>r.addChild(e))):s.addProperty(`float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial){if(null!==e.clearcoatMap){s.addProperty(`float inputs:clearcoat.connect = </Materials/Material_${e.id}/Texture_${e.clearcoatMap.id}_clearcoat.outputs:r>`);let t=new a.Q1f(e.clearcoat,e.clearcoat,e.clearcoat);n(e.clearcoatMap,"clearcoat",t).forEach(e=>r.addChild(e))}else s.addProperty(`float inputs:clearcoat = ${e.clearcoat}`);if(null!==e.clearcoatRoughnessMap){s.addProperty(`float inputs:clearcoatRoughness.connect = </Materials/Material_${e.id}/Texture_${e.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`);let t=new a.Q1f(e.clearcoatRoughness,e.clearcoatRoughness,e.clearcoatRoughness);n(e.clearcoatRoughnessMap,"clearcoatRoughness",t).forEach(e=>r.addChild(e))}else s.addProperty(`float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`);s.addProperty(`float inputs:ior = ${e.ior}`)}return s.addProperty("int inputs:useSpecularWorkflow = 0"),s.addProperty("token outputs:surface"),r.addChild(s),r.addProperty(`token outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>`),r}(s,t,i))}return r}(d,p,t.quickLookCompatible);for(let e in i=ei()+"\n"+l.toString()+"\n\n"+A.toString(),n[o]=Y(i),i=null,p){let i=p[e];if(!0===i.isCompressedTexture)if(null===this.textureUtils)throw Error("THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.");else i=await this.textureUtils.decompress(i);let r=function(e,t,i){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let r=i/Math.max(e.width,e.height),n=document.createElement("canvas");n.width=e.width*Math.min(1,r),n.height=e.height*Math.min(1,r);let a=n.getContext("2d");return!0===t&&(a.translate(0,n.height),a.scale(1,-1)),a.drawImage(e,0,0,n.width,n.height),n}throw Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}(i.image,i.flipY,t.maxTextureSize),a=await new Promise(e=>r.toBlob(e,"image/png",1));n[`textures/Texture_${e}.png`]=new Uint8Array(await a.arrayBuffer())}let f=0;for(let e in n){let t=n[e],i=63&(f+=34+e.length);if(4!==i){let r=new Uint8Array(64-i);n[e]=[t,{extra:{12345:r}}]}f=t.length}return function(e,t){t||(t={});var i={},r=[];W(e,"",i,t);var n=0,a=0;for(var o in i){var l=i[o],h=l[0],c=l[1],u=8*(0!=c.level),d=Y(o),p=d.length,A=c.comment,f=A&&Y(A),g=f&&f.length,m=J(c.extra);p>65535&&T(11);var v=u?z(h,c||{},0,0):h,b=v.length,y=H();y.p(h),r.push(V(c,{size:h.length,crc:y.d(),c:v,f:d,m:f,u:p!=o.length||f&&A.length!=g,o:n,compression:u})),n+=30+p+m+b,a+=76+2*(p+m)+(g||0)+b}for(var x=new s(a+22),_=n,E=a-n,S=0;S<r.length;++S){var d=r[S];K(x,d.o,d,d.f,d.u,d.c.length);var C=30+d.f.length+J(d.extra);x.set(d.c,d.o+C),K(x,n,d,d.f,d.u,d.c.length,d.o,d.m),n+=16+C+(d.m?d.m.length:0)}return $(x,n,r.length,E,_),x}(n,{level:0})}}function et(e,t){let i=e.name;return i=i.replace(/[^A-Za-z0-9_]/g,""),/^[0-9]/.test(i)&&(i="_"+i),""===i&&(i=e.isCamera?"Camera":"Object"),t.has(i)&&(i=i+"_"+e.id),t.add(i),i}function ei(){return`#usda 1.0
|
|
10
|
+
(
|
|
11
|
+
customLayerData = {
|
|
12
|
+
string creator = "Three.js USDZExporter"
|
|
13
|
+
}
|
|
14
|
+
defaultPrim = "Root"
|
|
15
|
+
metersPerUnit = 1
|
|
16
|
+
upAxis = "Y"
|
|
17
|
+
)
|
|
18
|
+
`}function er(e,t){let i=et(e,t),r=en(e.matrix);0>e.matrix.determinant()&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e);let n=new Z(i,"Xform");return n.addProperty(`matrix4d xformOp:transform = ${r}`),n.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]'),n}function en(e){let t=e.elements;return`( ${ea(t,0)}, ${ea(t,4)}, ${ea(t,8)}, ${ea(t,12)} )`}function ea(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function es(e,t){if(void 0===e)return console.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");let i=[];for(let t=0;t<e.count;t++){let r=e.getX(t),n=e.getY(t),a=e.getZ(t);i.push(`(${r.toPrecision(7)}, ${n.toPrecision(7)}, ${a.toPrecision(7)})`)}return i.join(", ")}function eo(e){return`(${e.r}, ${e.g}, ${e.b})`}function el(e){return`(${e.x}, ${e.y})`}var eh=i(322),ec=i(3520),eu=i(1718),ed=i(3418),ep=i(1535),eA=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let ef=!1,eg=!1,em="#model-viewer-no-ar-fallback",ev=(r=["quick-look","scene-viewer","webxr","none"],e=>{try{let t=(0,eu.$y)(e),i=(t.length?t[0].terms:[]).filter(e=>e&&"ident"===e.type).map(e=>e.value).filter(e=>r.indexOf(e)>-1);return new Set(i)}catch(e){}return new Set}),eb="quick-look",ey="scene-viewer",ex="webxr",e_="none",eE=Symbol("arButtonContainer"),eS=Symbol("enterARWithWebXR"),eC=Symbol("openSceneViewer"),eM=Symbol("openIOSARQuickLook"),ew=Symbol("canActivateAR"),eI=Symbol("arMode"),eT=Symbol("arModes"),eB=Symbol("arAnchor"),eR=Symbol("preload"),eD=Symbol("onARButtonContainerClick"),eL=Symbol("onARStatus"),eP=Symbol("onARTracking"),eU=Symbol("onARTap"),eF=Symbol("selectARMode"),eN=Symbol("triggerLoad"),eO=e=>{var t,i,r,a,s,o,l,h,c,u;class d extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arUsdzMaxTextureSize="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[i]=this.shadowRoot.querySelector(".ar-button"),this[r]=document.createElement("a"),this[a]=new Set,this[s]=e_,this[o]=!1,this[l]=e=>{e.preventDefault(),this.activateAR()},this[h]=({status:e})=>{(e===ed.sF.NOT_PRESENTING||this[ec.m8].arRenderer.presentedScene===this[ec.lC])&&(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===ed.sF.NOT_PRESENTING?this.removeAttribute("ar-tracking"):e===ed.sF.SESSION_STARTED&&this.setAttribute("ar-tracking",ed.pH.TRACKING))},this[c]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[u]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[eI]!==e_}connectedCallback(){super.connectedCallback(),null!=this[ec.m8].arRenderer&&(this[ec.m8].arRenderer.addEventListener("status",this[eL]),this.setAttribute("ar-status",ed.sF.NOT_PRESENTING),this[ec.m8].arRenderer.addEventListener("tracking",this[eP])),this[eB].addEventListener("message",this[eU])}disconnectedCallback(){super.disconnectedCallback(),null!=this[ec.m8].arRenderer&&(this[ec.m8].arRenderer.removeEventListener("status",this[eL]),this[ec.m8].arRenderer.removeEventListener("tracking",this[eP])),this[eB].removeEventListener("message",this[eU])}update(e){super.update(e),e.has("arScale")&&(this[ec.lC].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[ec.lC].updateShadow(),this[ec.ML]()),e.has("arModes")&&(this[eT]=ev(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc")||e.has("arUsdzMaxTextureSize"))&&this[eF]()}async activateAR(){switch(this[eI]){case eb:await this[eM]();break;case ex:await this[eS]();break;case ey:this[eC]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async [(t=ew,i=eE,r=eB,a=eT,s=eI,o=eR,l=eD,h=eL,c=eP,u=eU,eF)](){var e;let t=e_;if(this.ar){if(null!=this.src)for(let i of this[eT]){if("webxr"===i&&eh.al&&!ef&&await this[ec.m8].arRenderer.supportsPresentation()){t=ex;break}if("scene-viewer"===i&&!eg&&(eh.oU||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null==(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)?void 0:e.includes("XR")))){t=ey;break}if("quick-look"===i&&eh.UN){t=eb;break}}t===e_&&null!=this.iosSrc&&eh.UN&&(t=eb)}if(t!==e_)this[eE].classList.add("enabled"),this[eE].addEventListener("click",this[eD]);else if(this[eE].classList.contains("enabled")){this[eE].removeEventListener("click",this[eD]),this[eE].classList.remove("enabled");let e=ed.sF.FAILED;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[eI]=t}async [eS](){console.log("Attempting to present in AR with WebXR..."),await this[eN]();try{this[eE].removeEventListener("click",this[eD]);let{arRenderer:e}=this[ec.m8];e.placeOnWall="wall"===this.arPlacement,await e.present(this[ec.lC],this.xrEnvironment)}catch(e){console.warn("Error while trying to present in AR with WebXR"),console.error(e),await this[ec.m8].arRenderer.stopPresenting(),ef=!0,console.warn("Falling back to next ar-mode"),await this[eF](),this.activateAR()}finally{this[eF]()}}async [eN](){this.loaded||(this[eR]=!0,this[ec.Hc](),await (0,ep.lA)(this,"load"),this[eR]=!1)}[ec.sM](){return super[ec.sM]()||this[eR]}[eC](){let e=self.location.toString(),t=new URL(e),i=new URL(this.src,e);i.hash&&(i.hash="");let r=new URLSearchParams(i.search);if(t.hash=em,r.set("mode","ar_preferred"),r.has("disable_occlusion")||r.set("disable_occlusion","true"),"fixed"===this.arScale&&r.set("resizable","false"),"wall"===this.arPlacement&&r.set("enable_vertical_placement","true"),r.has("sound")){let t=new URL(r.get("sound"),e);r.set("sound",t.toString())}if(r.has("link")){let t=new URL(r.get("link"),e);r.set("link",t.toString())}let n=`intent://arvr.google.com/scene-viewer/1.2?${r.toString()+"&file="+encodeURIComponent(i.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`,a=()=>{self.location.hash===em&&(eg=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[eF]())};self.addEventListener("hashchange",a,{once:!0}),this[eB].setAttribute("href",n),console.log("Attempting to present in AR with Scene Viewer..."),this[eB].click()}async [eM](){let e=!this.iosSrc;this[eE].classList.remove("enabled");let t=e?await this.prepareUSDZ():this.iosSrc,i=new URL(t,self.location.toString());if(e){let e=new URL(self.location.toString()),t=new URL(this.src,e);t.hash&&(i.hash=t.hash)}"fixed"===this.arScale&&(i.hash&&(i.hash+="&"),i.hash+="allowsContentScaling=0");let r=this[eB];r.setAttribute("rel","ar");let n=document.createElement("img");r.appendChild(n),r.setAttribute("href",i.toString()),e&&r.setAttribute("download","model.usdz"),r.style.display="none",r.isConnected||this.shadowRoot.appendChild(r),console.log("Attempting to present in AR with Quick Look..."),r.click(),r.removeChild(n),e&&URL.revokeObjectURL(t),this[eE].classList.add("enabled")}async prepareUSDZ(){let e=this[ec.OS].beginActivity("usdz-conversion");await this[eN]();let{model:t,shadow:i,target:r}=this[ec.lC];if(null==t)return"";let n=!1;null!=i&&(n=i.visible,i.visible=!1),e(.2);let a=new ee;r.remove(t),t.position.copy(r.position),t.updateWorldMatrix(!1,!0);let s=await a.parseAsync(t,{maxTextureSize:isNaN(this.arUsdzMaxTextureSize)?1/0:Math.max(parseInt(this.arUsdzMaxTextureSize),16)});t.position.set(0,0,0),r.add(t);let o=new Blob([s],{type:"model/vnd.usdz+zip"}),l=URL.createObjectURL(o);return e(1),null!=i&&(i.visible=n),l}}return eA([(0,n.MZ)({type:Boolean,attribute:"ar"})],d.prototype,"ar",void 0),eA([(0,n.MZ)({type:String,attribute:"ar-scale"})],d.prototype,"arScale",void 0),eA([(0,n.MZ)({type:String,attribute:"ar-usdz-max-texture-size"})],d.prototype,"arUsdzMaxTextureSize",void 0),eA([(0,n.MZ)({type:String,attribute:"ar-placement"})],d.prototype,"arPlacement",void 0),eA([(0,n.MZ)({type:String,attribute:"ar-modes"})],d.prototype,"arModes",void 0),eA([(0,n.MZ)({type:String,attribute:"ios-src"})],d.prototype,"iosSrc",void 0),eA([(0,n.MZ)({type:Boolean,attribute:"xr-environment"})],d.prototype,"xrEnvironment",void 0),d}},9051(e,t,i){"use strict";let r,n,a;i.d(t,{av:()=>O,Qg:()=>S,uG:()=>ed});var s=i(8413),o=i(874),l=i(6650),h=i(3520),c=i(3935),u=i(5978),d=i(1718),p=i(119),A=i(1535);let f=e=>e<.5?2*e*e:-1+(4-2*e)*e,g=(e,t,i=f)=>r=>e+(t-e)*i(r),m=e=>{let t,i,r=[],n=[],a=e.initialValue;for(let t=0;t<e.keyframes.length;++t){let i=e.keyframes[t],{value:s,frames:o}=i,l=g(a,s,i.ease||f);r.push(l),n.push(o),a=s}return i=n.map((t=0,e=>t+=e)),e=>{e=(0,A.qE)(e,0,1)*i[i.length-1];let t=i.findIndex(t=>t>=e),n=t<1?0:i[t-1],a=i[t];return r[t]((e-n)/(a-n))}};var v=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let b=m({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),y=m({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),x="0deg 75deg 105%",_=["front","right","back","left"],E=["upper-","","lower-"],S=". Use mouse, touch or arrow keys to move.",C="auto",M="wiggle",w=()=>({basis:[(0,c.tR)((0,d.sJ)(30,"deg"))],keywords:{auto:[null]}}),I=()=>({basis:[(0,c.tR)((0,d.sJ)(12,"deg"))],keywords:{auto:[null]}}),T=(r=(0,d.$y)(x)[0].terms,n=(0,c.cg)(r[0]),a=(0,c.cg)(r[1]),e=>{let t=e[h.lC].idealCameraDistance();return{basis:[n,a,(0,d.sJ)(t,"m")],keywords:{auto:[null,null,(0,d.sJ)(105,"%")]}}}),B=e=>{let t=2.2*e[h.lC].boundingSphere.radius;return{basis:[(0,d.sJ)(-1/0,"rad"),(0,d.sJ)(0,"rad"),(0,d.sJ)(t,"m")],keywords:{auto:[null,null,null]}}},R=e=>{let t=T(e),i=new u.bk([],t).evaluate()[2];return{basis:[(0,d.sJ)(1/0,"rad"),(0,d.sJ)(Math.PI,"rad"),(0,d.sJ)(i,"m")],keywords:{auto:[null,null,null]}}},D=e=>{let t=e[h.lC].boundingBox.getCenter(new o.Pq0);return{basis:[(0,d.sJ)(t.x,"m"),(0,d.sJ)(t.y,"m"),(0,d.sJ)(t.z,"m")],keywords:{auto:[null,null,null]}}},L=Math.PI/2,P=Math.PI/3,U=L/2,F=2*Math.PI,N=Symbol("controls"),O=Symbol("panElement"),k=Symbol("promptElement"),Q=Symbol("promptAnimatedContainer"),G=Symbol("fingerAnimatedContainers"),H=Symbol("deferInteractionPrompt"),z=Symbol("updateAria"),V=Symbol("a11y"),q=Symbol("updateA11y"),W=Symbol("updateCameraForRadius"),j=Symbol("cancelPrompts"),X=Symbol("onChange"),Y=Symbol("onPointerChange"),J=Symbol("waitingToPromptUser"),K=Symbol("userHasInteracted"),$=Symbol("promptElementVisibleTime"),Z=Symbol("lastPromptOffset"),ee=Symbol("cancellationSource"),et=Symbol("lastSpherical"),ei=Symbol("jumpCamera"),er=Symbol("initialized"),en=Symbol("maintainThetaPhi"),ea=Symbol("syncCameraOrbit"),es=Symbol("syncFieldOfView"),eo=Symbol("syncCameraTarget"),el=Symbol("syncMinCameraOrbit"),eh=Symbol("syncMaxCameraOrbit"),ec=Symbol("syncMinFieldOfView"),eu=Symbol("syncMaxFieldOfView"),ed=e=>{var t,i,r,n,a,c,u,d,A,f,g,ed,ep,eA,ef,eg,em,ev;class eb extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=x,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=C,this.interactionPromptStyle=M,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction="none",this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[i]=this.shadowRoot.querySelector("#prompt"),this[r]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[n]=this.shadowRoot.querySelector(".pan-target"),this[a]=0,this[c]=1/0,this[u]=!1,this[d]=!1,this[A]=p.iC.AUTOMATIC,this[f]=new p.zJ(this[h.lC].camera,this[h.yc],this[h.lC]),this[g]=new o.YHV,this[ed]=!1,this[ep]=!1,this[eA]=!1,this[ef]={},this[eg]=()=>{let e=this[N].changeSource;this[ee]=e,e===p.iC.USER_INTERACTION&&(this[K]=!0,this[H]())},this[em]=()=>{this[z](),this[h.ML]();let e=this[N].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[ev]=e=>{this[h.SD].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[N].inputSensitivity}set inputSensitivity(e){this[N].inputSensitivity=e}getCameraOrbit(){let{theta:e,phi:t,radius:i}=this[et];return{theta:e,phi:t,radius:i,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return(0,h.Gw)(this[h.m8].isPresenting?this[h.m8].arRenderer.target:this[h.lC].getDynamicTarget())}getFieldOfView(){return this[N].getFieldOfView()}getMinimumFieldOfView(){return this[N].options.minimumFieldOfView}getMaximumFieldOfView(){return this[N].options.maximumFieldOfView}getIdealAspect(){return this[h.lC].idealAspect}jumpCameraToGoal(){this[ei]=!0,this.requestUpdate(ei,!1)}resetInteractionPrompt(){this[Z]=0,this[$]=1/0,this[K]=!1,this[J]=this.interactionPrompt===C&&this.cameraControls}zoom(e){let t=new WheelEvent("wheel",{deltaY:-30*e});this[h.yc].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[N].addEventListener("user-interaction",this[j]),this[N].addEventListener("pointer-change-start",this[Y]),this[N].addEventListener("pointer-change-end",this[Y])}disconnectedCallback(){super.disconnectedCallback(),this[N].removeEventListener("user-interaction",this[j]),this[N].removeEventListener("pointer-change-start",this[Y]),this[N].removeEventListener("pointer-change-end",this[Y])}updated(e){super.updated(e);let t=this[N],i=this[h.lC];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===C&&(this[J]=!0)):(t.disableInteraction(),this[H]()),this[h.yc].setAttribute("aria-label",this[h.Sw])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===C&&this.cameraControls&&!this[K]?this[J]=!0:this[H]()),e.has("interactionPromptStyle")&&(this[Q].style.opacity="basic"==this.interactionPromptStyle?"1":"0"),e.has("touchAction")){let e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),i.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[q](),!0===this[ei]&&Promise.resolve().then(()=>{t.jumpToGoal(),i.jumpToGoal(),this[X](),this[ei]=!1})}async updateFraming(){let e=this[h.lC],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();let i=e.adjustedFoV(e.framedFoVDeg),r=this[N].getFieldOfView()/t;this[N].setFieldOfView(i*r),this[en]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,i){let r=this[h.yc],n=this[G];if("1"===n[0].style.opacity)return void console.warn("interact() failed because an existing interaction is running.");let a=[];a.push({x:m(t.x),y:m(t.y)});let s=[{x:a[0].x(0),y:a[0].y(0)}];null!=i&&(a.push({x:m(i.x),y:m(i.y)}),s.push({x:a[1].x(0),y:a[1].y(0)}));let o=performance.now(),{width:l,height:c}=this[h.lC],u=this.getBoundingClientRect(),d=e=>{for(let[t,i]of s.entries()){let{style:a}=n[t];a.transform=`translateX(${l*i.x}px) translateY(${c*i.y}px)`,"pointerdown"===e?a.opacity="1":"pointerup"===e&&(a.opacity="0");let s={pointerId:t-5678,pointerType:"touch",target:r,clientX:l*i.x+u.x,clientY:c*i.y+u.y,altKey:!0};r.dispatchEvent(new PointerEvent(e,s))}},A=()=>{let t=this[ee];if(t!==p.iC.AUTOMATIC||!r.isConnected){for(let e of this[G])e.style.opacity="0";d("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),document.removeEventListener("visibilitychange",f);return}let i=Math.min(1,(performance.now()-o)/e);for(let[e,t]of s.entries())t.x=a[e].x(i),t.y=a[e].y(i);d("pointermove"),i<1?requestAnimationFrame(A):(d("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:p.iC.AUTOMATIC}})),document.removeEventListener("visibilitychange",f))},f=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-o:o=performance.now()-e};document.addEventListener("visibilitychange",f),d("pointerdown"),this[ee]=p.iC.AUTOMATIC,requestAnimationFrame(A)}[(t=k,i=Q,r=G,n=O,a=Z,c=$,u=K,d=J,A=ee,f=N,g=et,ed=ei,ep=er,eA=en,ef=V,es)](e){let t=this[N],i=this[h.lC];i.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=p.iC.NONE,t.setFieldOfView(i.adjustedFoV(i.framedFoVDeg)),this[j]()}[ea](e){let t=this[N];if(this[en]){let{theta:t,phi:i}=this.getCameraOrbit();e[0]=t,e[1]=i,this[en]=!1}t.changeSource=p.iC.NONE,t.setOrbit(e[0],e[1],e[2]),this[j]()}[el](e){this[N].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[eh](e){this[N].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[W](e[2]),this.jumpCameraToGoal()}[ec](e){this[N].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[eu](e){let t=this[h.lC].adjustedFoV(180*e[0]/Math.PI);this[N].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[eo](e){let[t,i,r]=e;this[h.m8].arRenderer.isPresenting||this[h.lC].setTarget(t,i,r),this[N].changeSource=p.iC.NONE,this[h.m8].arRenderer.updateTarget(),this[j]()}[h.Ei](e,t){if(super[h.Ei](e,t),this[h.m8].isPresenting||!this[h.gJ]())return;let i=this[N],r=this[h.lC],n=performance.now();if(this[J]&&this.loaded&&n>this[h.$M]+this.interactionPromptThreshold&&(this[J]=!1,this[$]=n,this[k].classList.add("visible")),isFinite(this[$])&&this.interactionPromptStyle===M){let e=(n-this[$])/5e3%1,t=b(e),a=y(e);if(this[Q].style.opacity=`${a}`,t!==this[Z]){let e=t*r.width*.05,n=(t-this[Z])*Math.PI/16;this[Q].style.transform=`translateX(${e}px)`,i.changeSource=p.iC.AUTOMATIC,i.adjustOrbit(n,0,0),this[Z]=t}}let a=i.update(e,t),s=r.updateTarget(t);(a||s)&&this[X]()}[H](){this[J]=!1,this[k].classList.remove("visible"),this[$]=1/0}[W](e){let t=Math.abs(2*Math.max(this[h.lC].farRadius(),e));this[N].updateNearFar(0,t)}[z](){let{theta:e,phi:t}=this[N].getCameraSpherical(this[et]),i=Math.floor(t/P),r=_[(4+Math.floor((e%F+U)/L))%4],n=E[i],a=`${n}${r}`;a in this[V]?this[h.Yl](this[V][a]):this[h.Yl](`View from stage ${a}`)}get[h.Sw](){let e=S;return"interaction-prompt"in this[V]&&(e=`. ${this[V]["interaction-prompt"]}`),super[$ariaLabel].replace(/\.$/,"")+(this.cameraControls?e:"")}async [h.if](e){let t=this[N],i=this[h.lC],r=i.adjustedFoV(i.framedFoVDeg);super[h.if](e);let n=i.adjustedFoV(i.framedFoVDeg)/r,a=t.getFieldOfView()*(isFinite(n)?n:1);t.updateAspect(this[h.lC].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[N].setFieldOfView(a),this.jumpCameraToGoal()}[h.vA](){super[h.vA](),this[er]?this[en]=!0:this[er]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(eg=j,em=X,ev=Y,q)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[V]=JSON.parse(this.a11y)}catch(e){console.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?console.warn("Error not supported format, should be a JSON string:",this.a11y):this[V]={};else"object"==typeof this.a11y&&null!=this.a11y?this[V]=Object.assign({},this.a11y):this[V]={};this[h.yc].setAttribute("aria-label",this[h.Sw])}}return v([(0,s.MZ)({type:Boolean,attribute:"camera-controls"})],eb.prototype,"cameraControls",void 0),v([(0,l.i)({intrinsics:T,observeEffects:!0,updateHandler:ea}),(0,s.MZ)({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],eb.prototype,"cameraOrbit",void 0),v([(0,l.i)({intrinsics:D,observeEffects:!0,updateHandler:eo}),(0,s.MZ)({type:String,attribute:"camera-target",hasChanged:()=>!0})],eb.prototype,"cameraTarget",void 0),v([(0,l.i)({intrinsics:w,observeEffects:!0,updateHandler:es}),(0,s.MZ)({type:String,attribute:"field-of-view",hasChanged:()=>!0})],eb.prototype,"fieldOfView",void 0),v([(0,l.i)({intrinsics:B,updateHandler:el}),(0,s.MZ)({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],eb.prototype,"minCameraOrbit",void 0),v([(0,l.i)({intrinsics:R,updateHandler:eh}),(0,s.MZ)({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],eb.prototype,"maxCameraOrbit",void 0),v([(0,l.i)({intrinsics:I,updateHandler:ec}),(0,s.MZ)({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],eb.prototype,"minFieldOfView",void 0),v([(0,l.i)({intrinsics:w,updateHandler:eu}),(0,s.MZ)({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],eb.prototype,"maxFieldOfView",void 0),v([(0,s.MZ)({type:Number,attribute:"interaction-prompt-threshold"})],eb.prototype,"interactionPromptThreshold",void 0),v([(0,s.MZ)({type:String,attribute:"interaction-prompt"})],eb.prototype,"interactionPrompt",void 0),v([(0,s.MZ)({type:String,attribute:"interaction-prompt-style"})],eb.prototype,"interactionPromptStyle",void 0),v([(0,s.MZ)({type:Number,attribute:"orbit-sensitivity"})],eb.prototype,"orbitSensitivity",void 0),v([(0,s.MZ)({type:Number,attribute:"zoom-sensitivity"})],eb.prototype,"zoomSensitivity",void 0),v([(0,s.MZ)({type:Number,attribute:"pan-sensitivity"})],eb.prototype,"panSensitivity",void 0),v([(0,s.MZ)({type:String,attribute:"touch-action"})],eb.prototype,"touchAction",void 0),v([(0,s.MZ)({type:Boolean,attribute:"disable-zoom"})],eb.prototype,"disableZoom",void 0),v([(0,s.MZ)({type:Boolean,attribute:"disable-pan"})],eb.prototype,"disablePan",void 0),v([(0,s.MZ)({type:Boolean,attribute:"disable-tap"})],eb.prototype,"disableTap",void 0),v([(0,s.MZ)({type:Number,attribute:"interpolation-decay"})],eb.prototype,"interpolationDecay",void 0),v([(0,s.MZ)()],eb.prototype,"a11y",void 0),eb}},6526(e,t,i){"use strict";i.d(t,{fr:()=>o,hj:()=>h,kT:()=>l,xh:()=>u});var r=i(8413),n=i(3520),a=i(1535),s=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let o=Symbol("currentEnvironmentMap"),l=Symbol("currentBackground"),h=Symbol("updateEnvironment"),c=Symbol("cancelEnvironmentUpdate"),u=e=>{var t,i,u;class d extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[i]=null,this[u]=null}updated(e){var t;if(super.updated(e),e.has("shadowIntensity")&&(this[n.lC].setShadowIntensity(.5*this.shadowIntensity),this[n.ML]()),e.has("shadowSoftness")&&(this[n.lC].setShadowSoftness(this.shadowSoftness),this[n.ML]()),e.has("exposure")&&(this[n.lC].exposure=this.exposure,this[n.ML]()),e.has("toneMapping")){let e=new Map([["aces",4],["agx",6],["reinhard",2],["cineon",3],["linear",1],["none",0]]);this[n.lC].toneMapping=null!=(t=e.get(this.toneMapping))?t:7,this[n.ML]()}(e.has("environmentImage")||e.has("skyboxImage"))&&this[n.sM]()&&this[h](),e.has("skyboxHeight")&&(this[n.lC].setGroundedSkybox(),this[n.ML]())}hasBakedShadow(){return this[n.lC].bakedShadows.size>0}async [(t=o,i=l,u=c,h)](){let{skyboxImage:e,environmentImage:t}=this;null!=this[c]&&(this[c](),this[c]=null);let{textureUtils:i}=this[n.m8];if(null==i)return;let r=this[n.OS].beginActivity("environment-update");try{let{environmentMap:s,skybox:h}=await i.generateEnvironmentMapAndSkybox((0,a.pE)(e),t,e=>r((0,a.qE)(e,0,1)),this.withCredentials);this[o]!==s&&(this[o]=s,this.dispatchEvent(new CustomEvent("environment-change"))),null!=h?this[l]=h.name===s.name?s:h:this[l]=null,this[n.lC].setEnvironmentAndSkybox(this[o],this[l])}catch(e){if(e instanceof Error)throw this[n.lC].setEnvironmentAndSkybox(null,null),e}finally{r(1)}}}return s([(0,r.MZ)({type:String,attribute:"environment-image"})],d.prototype,"environmentImage",void 0),s([(0,r.MZ)({type:String,attribute:"skybox-image"})],d.prototype,"skyboxImage",void 0),s([(0,r.MZ)({type:Number,attribute:"shadow-intensity"})],d.prototype,"shadowIntensity",void 0),s([(0,r.MZ)({type:Number,attribute:"shadow-softness"})],d.prototype,"shadowSoftness",void 0),s([(0,r.MZ)({type:Number})],d.prototype,"exposure",void 0),s([(0,r.MZ)({type:String,attribute:"tone-mapping"})],d.prototype,"toneMapping",void 0),s([(0,r.MZ)({type:String,attribute:"skybox-height"})],d.prototype,"skyboxHeight",void 0),d}},1735(e,t,i){"use strict";i.d(t,{CK:()=>y});var r=i(8413),n=i(874),a=i(3520),s=i(4515),o=i(5827),l=i(1535),h=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let c="auto",u=Symbol("defaultProgressBarElement"),d=Symbol("posterContainerElement"),p=Symbol("defaultPosterElement"),A=Symbol("shouldDismissPoster"),f=Symbol("hidePoster"),g=Symbol("modelIsRevealed"),m=Symbol("updateProgressBar"),v=Symbol("ariaLabelCallToAction"),b=Symbol("onProgress"),y=e=>{var t,i,y,x,_,E,S,C;class M extends e{static set dracoDecoderLocation(e){s.IZ.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return s.IZ.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){s.IZ.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return s.IZ.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){s.IZ.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return s.IZ.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){o.A.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return o.A.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){o.A.singleton.loader[s.q4].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[f]():(this[A]=!0,this[a.Hc]())}showPoster(){let e=this[d];if(e.classList.contains("show"))return;e.classList.add("show"),this[a.yc].classList.remove("show");let t=this[p];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");let i=this.modelIsVisible;this[g]=!1,this[a.T5](i)}getDimensions(){return(0,a.Gw)(this[a.lC].size)}getBoundingBoxCenter(){return(0,a.Gw)(this[a.lC].boundingBox.getCenter(new n.Pq0))}constructor(...e){super(...e),this.poster=null,this.reveal=c,this.loading="auto",this[t]=!1,this[i]=!1,this[y]=this.shadowRoot.querySelector(".slot.poster"),this[x]=this.shadowRoot.querySelector("#default-poster"),this[_]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[E]=this[p].getAttribute("aria-label"),this[S]=(0,l.nF)(e=>{let t=this[u].parentNode;requestAnimationFrame(()=>{this[u].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[u]),t.appendChild(this[u])),this[u].classList.toggle("hide",1===e)})},100),this[C]=e=>{let t=e.detail.totalProgress,i=e.detail.reason;1===t&&(this[m].flush(),this.loaded&&(this[A]||this.reveal===c)&&this[f]()),this[m](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:i}}))};const r=self.ModelViewerElement||{},n=r.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";s.IZ.setDRACODecoderLocation(n);const a=r.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";s.IZ.setKTX2TranscoderLocation(a),r.meshoptDecoderLocation&&s.IZ.setMeshoptDecoderLocation(r.meshoptDecoderLocation);const h=r.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";null!=o.A.singleton.textureUtils&&(o.A.singleton.textureUtils.lottieLoaderUrl=h)}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[a.OS].addEventListener("progress",this[b])}disconnectedCallback(){super.disconnectedCallback(),this[a.OS].removeEventListener("progress",this[b])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[p].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[p].setAttribute("aria-label",this[a.cM]),(e.has("reveal")||e.has("loading"))&&this[a.Hc]()}[(t=g,i=A,y=d,x=p,_=u,E=v,S=m,C=b,a.sM)](){return!!this.src&&(this[A]||"eager"===this.loading||this.reveal===c&&this[a.cJ])}[f](){this[A]=!1;let e=this[d];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[a.yc].classList.add("show");let t=this.modelIsVisible;this[g]=!0,this[a.T5](t);let i=this.getRootNode();i&&i.activeElement===this&&this[a.yc].focus();let r=this[p];r.setAttribute("aria-hidden","true"),r.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[a.gJ](){return super[a.gJ]()&&this[g]}}return h([(0,r.MZ)({type:String})],M.prototype,"poster",void 0),h([(0,r.MZ)({type:String})],M.prototype,"reveal",void 0),h([(0,r.MZ)({type:String})],M.prototype,"loading",void 0),M}},387(e,t,i){"use strict";i.d(t,{BI:()=>N,o7:()=>k,Z7:()=>O,E_:()=>H});var r=i(8413),n=i(874);let a={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class s{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register(function(e){return new g(e)}),this.register(function(e){return new m(e)}),this.register(function(e){return new x(e)}),this.register(function(e){return new _(e)}),this.register(function(e){return new E(e)}),this.register(function(e){return new S(e)}),this.register(function(e){return new v(e)}),this.register(function(e){return new b(e)}),this.register(function(e){return new y(e)}),this.register(function(e){return new C(e)}),this.register(function(e){return new M(e)}),this.register(function(e){return new w(e)}),this.register(function(e){return new I(e)}),this.register(function(e){return new T(e)})}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}setTextureUtils(e){return this.textureUtils=e,this}parse(e,t,i,r){let n=new f,a=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)a.push(this.pluginCallbacks[e](n));n.setPlugins(a),n.setTextureUtils(this.textureUtils),n.writeAsync(e,t,r).catch(i)}parseAsync(e,t){let i=this;return new Promise(function(r,n){i.parse(e,r,n,t)})}}let o="KHR_mesh_quantization",l={};l[1003]=9728,l[1004]=9984,l[1005]=9986,l[1006]=9729,l[1007]=9985,l[1008]=9987,l[1001]=33071,l[1e3]=10497,l[1002]=33648;let h={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},c=new n.Q1f;function u(e,t){return e.length===t.length&&e.every(function(e,i){return e===t[i]})}function d(e){return 4*Math.ceil(e/4)}function p(e,t=0){let i=d(e.byteLength);if(i!==e.byteLength){let r=new Uint8Array(i);if(r.set(new Uint8Array(e)),0!==t)for(let n=e.byteLength;n<i;n++)r[n]=t;return r.buffer}return e}function A(){return"u"<typeof document&&"u">typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}class f{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r182"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.textureUtils=null}setPlugins(e){this.plugins=e}setTextureUtils(e){this.textureUtils=e}async writeAsync(e,t,i={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},i),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);let r=this.buffers,n=this.json;i=this.options;let a=this.extensionsUsed,s=this.extensionsRequired,o=new Blob(r,{type:"application/octet-stream"}),l=Object.keys(a),h=Object.keys(s);if(l.length>0&&(n.extensionsUsed=l),h.length>0&&(n.extensionsRequired=h),n.buffers&&n.buffers.length>0&&(n.buffers[0].byteLength=o.size),!0===i.binary){let e=new FileReader;e.readAsArrayBuffer(o),e.onloadend=function(){var i;let r=p(e.result),a=new DataView(new ArrayBuffer(8));a.setUint32(0,r.byteLength,!0),a.setUint32(4,5130562,!0);let s=p((i=JSON.stringify(n),new TextEncoder().encode(i).buffer),32),o=new DataView(new ArrayBuffer(8));o.setUint32(0,s.byteLength,!0),o.setUint32(4,0x4e4f534a,!0);let l=new ArrayBuffer(12),h=new DataView(l);h.setUint32(0,0x46546c67,!0),h.setUint32(4,2,!0);let c=12+o.byteLength+s.byteLength+a.byteLength+r.byteLength;h.setUint32(8,c,!0);let u=new Blob([l,o,s,a,r],{type:"application/octet-stream"}),d=new FileReader;d.readAsArrayBuffer(u),d.onloadend=function(){t(d.result)}}}else if(n.buffers&&n.buffers.length>0){let e=new FileReader;e.readAsDataURL(o),e.onloadend=function(){let i=e.result;n.buffers[0].uri=i,t(n)}}else t(n)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;let i=this.options,r=this.extensionsUsed;try{let n=JSON.parse(JSON.stringify(e.userData));if(i.includeCustomExtensions&&n.gltfExtensions){for(let e in void 0===t.extensions&&(t.extensions={}),n.gltfExtensions)t.extensions[e]=n.gltfExtensions[e],r[e]=!0;delete n.gltfExtensions}Object.keys(n).length>0&&(t.extras=n)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){let t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let t=new n.Pq0;for(let i=0,r=e.count;i<r;i++)if(Math.abs(t.fromBufferAttribute(e,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);let i=e.clone(),r=new n.Pq0;for(let e=0,t=i.count;e<t;e++)r.fromBufferAttribute(i,e),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),i.setXYZ(e,r.x,r.y,r.z);return t.attributesNormalized.set(e,i),i}applyTextureTransform(e,t){let i=!1,r={};(0!==t.offset.x||0!==t.offset.y)&&(r.offset=t.offset.toArray(),i=!0),0!==t.rotation&&(r.rotation=t.rotation,i=!0),(1!==t.repeat.x||1!==t.repeat.y)&&(r.scale=t.repeat.toArray(),i=!0),i&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(e,t){if(e===t)return e;function i(e){return"srgb"===e.colorSpace?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}e instanceof n.FvD&&(e=await this.decompressTextureAsync(e)),t instanceof n.FvD&&(t=await this.decompressTextureAsync(t));let r=e?e.image:null,a=t?t.image:null,s=Math.max(r?r.width:0,a?a.width:0),o=Math.max(r?r.height:0,a?a.height:0),l=A();l.width=s,l.height=o;let h=l.getContext("2d",{willReadFrequently:!0});h.fillStyle="#00ffff",h.fillRect(0,0,s,o);let c=h.getImageData(0,0,s,o);if(r){h.drawImage(r,0,0,s,o);let t=i(e),n=h.getImageData(0,0,s,o).data;for(let e=2;e<n.length;e+=4)c.data[e]=256*t(n[e]/256)}if(a){h.drawImage(a,0,0,s,o);let e=i(t),r=h.getImageData(0,0,s,o).data;for(let t=1;t<r.length;t+=4)c.data[t]=256*e(r[t]/256)}h.putImageData(c,0,0);let u=(e||t).clone();return u.source=new n.kLi(l),u.colorSpace="",u.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),u}async decompressTextureAsync(e,t=1/0){if(null===this.textureUtils)throw Error("THREE.GLTFExporter: setTextureUtils() must be called to process compressed textures.");return await this.textureUtils.decompress(e,t)}processBuffer(e){let t=this.json,i=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),i.push(e),0}processBufferView(e,t,i,r,a){let s,o=this.json;switch(!o.bufferViews&&(o.bufferViews=[]),t){case 5120:case 5121:s=1;break;case 5122:case 5123:s=2;break;default:s=4}let l=e.itemSize*s;34962===a&&(l=4*Math.ceil(l/4));let h=d(r*l),c=new DataView(new ArrayBuffer(h)),u=0;for(let a=i;a<i+r;a++){for(let i=0;i<e.itemSize;i++){let r;e.itemSize>4?r=e.array[a*e.itemSize+i]:(0===i?r=e.getX(a):1===i?r=e.getY(a):2===i?r=e.getZ(a):3===i&&(r=e.getW(a)),!0===e.normalized&&(r=n.cj9.normalize(r,e.array))),5126===t?c.setFloat32(u,r,!0):5124===t?c.setInt32(u,r,!0):5125===t?c.setUint32(u,r,!0):5122===t?c.setInt16(u,r,!0):5123===t?c.setUint16(u,r,!0):5120===t?c.setInt8(u,r):5121===t&&c.setUint8(u,r),u+=s}u%l!=0&&(u+=l-u%l)}let p={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:h};return void 0!==a&&(p.target=a),34962===a&&(p.byteStride=l),this.byteOffset+=h,o.bufferViews.push(p),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,i=t.json;return i.bufferViews||(i.bufferViews=[]),new Promise(function(r){let n=new FileReader;n.readAsArrayBuffer(e),n.onloadend=function(){let e=p(n.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(i.bufferViews.push(a)-1)}})}processAccessor(e,t,i,r){let a,s,o=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=5122;else if(e.array.constructor===Uint16Array)a=5123;else if(e.array.constructor===Int8Array)a=5120;else if(e.array.constructor===Uint8Array)a=5121;else throw Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(void 0===i&&(i=0),(void 0===r||r===1/0)&&(r=e.count),0===r)return null;let l=function(e,t,i){let r={min:Array(e.itemSize).fill(1/0),max:Array(e.itemSize).fill(-1/0)};for(let a=t;a<t+i;a++)for(let t=0;t<e.itemSize;t++){let i;e.itemSize>4?i=e.array[a*e.itemSize+t]:(0===t?i=e.getX(a):1===t?i=e.getY(a):2===t?i=e.getZ(a):3===t&&(i=e.getW(a)),!0===e.normalized&&(i=n.cj9.normalize(i,e.array))),r.min[t]=Math.min(r.min[t],i),r.max[t]=Math.max(r.max[t],i)}return r}(e,i,r);void 0!==t&&(s=e===t.index?34963:34962);let h=this.processBufferView(e,a,i,r,s),c={bufferView:h.id,byteOffset:h.byteOffset,componentType:a,count:r,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(c.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(c)-1}processImage(e,t,i,r="image/png"){if(null!==e){let a=this,s=a.cache,o=a.json,l=a.options,h=a.pending;s.images.has(e)||s.images.set(e,{});let c=s.images.get(e),u=r+":flipY/"+i.toString();if(void 0!==c[u])return c[u];o.images||(o.images=[]);let d={mimeType:r},p=A();p.width=Math.min(e.width,l.maxTextureSize),p.height=Math.min(e.height,l.maxTextureSize);let f=p.getContext("2d",{willReadFrequently:!0});if(!0===i&&(f.translate(0,p.height),f.scale(1,-1)),void 0!==e.data){1023!==t&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let i=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<i.length;t+=4)i[t+0]=e.data[t+0],i[t+1]=e.data[t+1],i[t+2]=e.data[t+2],i[t+3]=e.data[t+3];f.putImageData(new ImageData(i,e.width,e.height),0,0)}else if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas)f.drawImage(e,0,0,p.width,p.height);else throw Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");!0===l.binary?h.push((function(e,t){if(!("u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas))return new Promise(i=>e.toBlob(i,t));{let i;return"image/jpeg"===t?i=.92:"image/webp"===t&&(i=.8),e.convertToBlob({type:t,quality:i})}})(p,r).then(e=>a.processBufferViewImage(e)).then(e=>{d.bufferView=e})):d.uri=n.HgN.getDataURL(p,r);let g=o.images.push(d)-1;return c[u]=g,g}throw Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){let t=this.json;t.samplers||(t.samplers=[]);let i={magFilter:l[e.magFilter],minFilter:l[e.minFilter],wrapS:l[e.wrapS],wrapT:l[e.wrapT]};return t.samplers.push(i)-1}async processTextureAsync(e){let t=this.options,i=this.cache,r=this.json;if(i.textures.has(e))return i.textures.get(e);r.textures||(r.textures=[]),e instanceof n.FvD&&(e=await this.decompressTextureAsync(e,t.maxTextureSize));let a=e.userData.mimeType;"image/webp"===a&&(a="image/png");let s={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)};e.name&&(s.name=e.name),await this._invokeAllAsync(async function(t){t.writeTexture&&await t.writeTexture(e,s)});let o=r.textures.push(s)-1;return i.textures.set(e,o),o}async processMaterialAsync(e){let t=this.cache,i=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;i.materials||(i.materials=[]);let r={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let n=e.color.toArray().concat([e.opacity]);if(u(n,[1,1,1,1])||(r.pbrMetallicRoughness.baseColorFactor=n),e.isMeshStandardMaterial?(r.pbrMetallicRoughness.metallicFactor=e.metalness,r.pbrMetallicRoughness.roughnessFactor=e.roughness):(r.pbrMetallicRoughness.metallicFactor=0,r.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){let t=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),i={index:await this.processTextureAsync(t),texCoord:t.channel};this.applyTextureTransform(i,t),r.pbrMetallicRoughness.metallicRoughnessTexture=i}if(e.map){let t={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),r.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){let t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(r.emissiveFactor=e.emissive.toArray()),e.emissiveMap){let t={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),r.emissiveTexture=t}}if(e.normalMap){let t={index:await this.processTextureAsync(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),r.normalTexture=t}if(e.aoMap){let t={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),r.occlusionTexture=t}e.transparent?r.alphaMode="BLEND":e.alphaTest>0&&(r.alphaMode="MASK",r.alphaCutoff=e.alphaTest),2===e.side&&(r.doubleSided=!0),""!==e.name&&(r.name=e.name),this.serializeUserData(e,r),await this._invokeAllAsync(async function(t){t.writeMaterialAsync&&await t.writeMaterialAsync(e,r)});let a=i.materials.push(r)-1;return t.materials.set(e,a),a}async processMeshAsync(e){let t,i=this.cache,r=this.json,a=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,i=e.material.length;t<i;t++)a.push(e.material[t].uuid);else a.push(e.material.uuid);let o=a.join(":");if(i.meshes.has(o))return i.meshes.get(o);let l=e.geometry;t=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;let h={},c={},u=[],d=[],p={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},A=l.getAttribute("normal");void 0===A||this.isNormalizedNormalAttribute(A)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(A)));let f=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;let t=l.attributes[e];if(e=p[e]||e.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),i.attributes.has(this.getUID(t))){c[e]=i.attributes.get(this.getUID(t));continue}f=null;let r=t.array;"JOINTS_0"!==e||r instanceof Uint16Array||r instanceof Uint8Array?(r instanceof Uint32Array||r instanceof Int32Array)&&!e.startsWith("_")&&(console.warn(`GLTFExporter: Attribute "${e}" converted to type FLOAT.`),f=s.Utils.toFloat32BufferAttribute(t)):(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),f=new n.THS(new Uint16Array(r),t.itemSize,t.normalized));let a=this.processAccessor(f||t,l);null!==a&&(e.startsWith("_")||this.detectMeshQuantization(e,t),c[e]=a,i.attributes.set(this.getUID(t),a))}if(void 0!==A&&l.setAttribute("normal",A),0===Object.keys(c).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){let t=[],r=[],n={};if(void 0!==e.morphTargetDictionary)for(let t in e.morphTargetDictionary)n[e.morphTargetDictionary[t]]=t;for(let a=0;a<e.morphTargetInfluences.length;++a){let s={},o=!1;for(let e in l.morphAttributes){if("position"!==e&&"normal"!==e){o||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),o=!0);continue}let t=l.morphAttributes[e][a],r=e.toUpperCase(),n=l.attributes[e];if(i.attributes.has(this.getUID(t,!0))){s[r]=i.attributes.get(this.getUID(t,!0));continue}let h=t.clone();if(!l.morphTargetsRelative)for(let e=0,i=t.count;e<i;e++)for(let i=0;i<t.itemSize;i++)0===i&&h.setX(e,t.getX(e)-n.getX(e)),1===i&&h.setY(e,t.getY(e)-n.getY(e)),2===i&&h.setZ(e,t.getZ(e)-n.getZ(e)),3===i&&h.setW(e,t.getW(e)-n.getW(e));s[r]=this.processAccessor(h,l),i.attributes.set(this.getUID(n,!0),s[r])}d.push(s),t.push(e.morphTargetInfluences[a]),void 0!==e.morphTargetDictionary&&r.push(n[a])}h.weights=t,r.length>0&&(h.extras={},h.extras.targetNames=r)}let g=Array.isArray(e.material);if(g&&0===l.groups.length)return null;let m=!1;if(g&&null===l.index){let e=[];for(let t=0,i=l.attributes.position.count;t<i;t++)e[t]=t;l.setIndex(e),m=!0}let v=g?e.material:[e.material],b=g?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,r=b.length;e<r;e++){let r={mode:t,attributes:c};if(this.serializeUserData(l,r),d.length>0&&(r.targets=d),null!==l.index){let t=this.getUID(l.index);(void 0!==b[e].start||void 0!==b[e].count)&&(t+=":"+b[e].start+":"+b[e].count),i.attributes.has(t)?r.indices=i.attributes.get(t):(r.indices=this.processAccessor(l.index,l,b[e].start,b[e].count),i.attributes.set(t,r.indices)),null===r.indices&&delete r.indices}let n=await this.processMaterialAsync(v[b[e].materialIndex]);null!==n&&(r.material=n),u.push(r)}!0===m&&l.setIndex(null),h.primitives=u,r.meshes||(r.meshes=[]),await this._invokeAllAsync(function(t){t.writeMesh&&t.writeMesh(e,h)});let y=r.meshes.push(h)-1;return i.meshes.set(o,y),y}detectMeshQuantization(e,t){let i;if(this.extensionsUsed[o])return;switch(t.array.constructor){case Int8Array:i="byte";break;case Uint8Array:i="unsigned byte";break;case Int16Array:i="short";break;case Uint16Array:i="unsigned short";break;default:return}t.normalized&&(i+=" normalized");let r=e.split("_",1)[0];a[r]&&a[r].includes(i)&&(this.extensionsUsed[o]=!0,this.extensionsRequired[o]=!0)}processCamera(e){let t=this.json;t.cameras||(t.cameras=[]);let i=e.isOrthographicCamera,r={type:i?"orthographic":"perspective"};return i?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:n.cj9.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(r.name=e.type),t.cameras.push(r)-1}processAnimation(e,t){let i=this.json,r=this.nodeMap;i.animations||(i.animations=[]);let a=(e=s.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,o=[],l=[];for(let e=0;e<a.length;++e){let i,s=a[e],c=n.Nwf.parseTrackName(s.name),u=n.Nwf.findNode(t,c.nodeName),d=h[c.propertyName];if("bones"===c.objectName&&(u=!0===u.isSkinnedMesh?u.skeleton.getBoneByName(c.objectIndex):void 0),!u||!d){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',s.name);continue}let p=s.values.length/s.times.length;d===h.morphTargetInfluences&&(p/=u.morphTargetInfluences.length),!0===s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(i="CUBICSPLINE",p/=3):i=2300===s.getInterpolation()?"STEP":"LINEAR",l.push({input:this.processAccessor(new n.THS(s.times,1)),output:this.processAccessor(new n.THS(s.values,p)),interpolation:i}),o.push({sampler:l.length-1,target:{node:r.get(u),path:d}})}let c={name:e.name||"clip_"+i.animations.length,samplers:l,channels:o};return this.serializeUserData(e,c),i.animations.push(c),i.animations.length-1}processSkin(e){let t=this.json,i=this.nodeMap,r=t.nodes[i.get(e)],a=e.skeleton;if(void 0===a)return null;let s=e.skeleton.bones[0];if(void 0===s)return null;let o=[],l=new Float32Array(16*a.bones.length),h=new n.kn4;for(let t=0;t<a.bones.length;++t)o.push(i.get(a.bones[t])),h.copy(a.boneInverses[t]),h.multiply(e.bindMatrix).toArray(l,16*t);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new n.THS(l,16)),joints:o,skeleton:i.get(s)}),r.skin=t.skins.length-1}async processNodeAsync(e){let t=this.json,i=this.options,r=this.nodeMap;t.nodes||(t.nodes=[]);let n={};if(i.trs){let t=e.quaternion.toArray(),i=e.position.toArray(),r=e.scale.toArray();u(t,[0,0,0,1])||(n.rotation=t),u(i,[0,0,0])||(n.translation=i),u(r,[1,1,1])||(n.scale=r)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===u(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(n.matrix=e.matrix.elements);if(""!==e.name&&(n.name=String(e.name)),this.serializeUserData(e,n),e.isMesh||e.isLine||e.isPoints){let t=await this.processMeshAsync(e);null!==t&&(n.mesh=t)}else e.isCamera&&(n.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);let a=t.nodes.push(n)-1;if(r.set(e,a),e.children.length>0){let t=[];for(let r=0,n=e.children.length;r<n;r++){let n=e.children[r];if(n.visible||!1===i.onlyVisible){let e=await this.processNodeAsync(n);null!==e&&t.push(e)}}t.length>0&&(n.children=t)}return await this._invokeAllAsync(function(t){t.writeNode&&t.writeNode(e,n)}),a}async processSceneAsync(e){let t=this.json,i=this.options;t.scenes||(t.scenes=[],t.scene=0);let r={};""!==e.name&&(r.name=e.name),t.scenes.push(r);let n=[];for(let t=0,r=e.children.length;t<r;t++){let r=e.children[t];if(r.visible||!1===i.onlyVisible){let e=await this.processNodeAsync(r);null!==e&&n.push(e)}}n.length>0&&(r.nodes=n),this.serializeUserData(e,r)}async processObjectsAsync(e){let t=new n.Z58;t.name="AuxScene";for(let i=0;i<e.length;i++)t.children.push(e[i]);await this.processSceneAsync(t)}async processInputAsync(e){let t=this.options;e=e instanceof Array?e:[e],await this._invokeAllAsync(function(t){t.beforeParse&&t.beforeParse(e)});let i=[];for(let t=0;t<e.length;t++)e[t]instanceof n.Z58?await this.processSceneAsync(e[t]):i.push(e[t]);i.length>0&&await this.processObjectsAsync(i);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);await this._invokeAllAsync(function(t){t.afterParse&&t.afterParse(e)})}async _invokeAllAsync(e){for(let t=0,i=this.plugins.length;t<i;t++)await e(this.plugins[t])}}class g{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);let i=this.writer,r=i.json,n=i.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type="directional":e.isPointLight?(a.type="point",e.distance>0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(1-e.penumbra)*e.angle,a.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||0!==e.target.position.x||0!==e.target.position.y||-1!==e.target.position.z)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),n[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},n[this.name]=!0);let s=r.extensions[this.name].lights;s.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:s.length-1}}}class m{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,t){if(!e.isMeshBasicMaterial)return;let i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class v{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;let i=this.writer,r=i.extensionsUsed,n={};if(n.clearcoatFactor=e.clearcoat,e.clearcoatMap){let t={index:await i.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};i.applyTextureTransform(t,e.clearcoatMap),n.clearcoatTexture=t}if(n.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){let t={index:await i.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};i.applyTextureTransform(t,e.clearcoatRoughnessMap),n.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){let t={index:await i.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};1!==e.clearcoatNormalScale.x&&(t.scale=e.clearcoatNormalScale.x),i.applyTextureTransform(t,e.clearcoatNormalMap),n.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class b{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.dispersion)return;let i=this.writer.extensionsUsed,r={};r.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=r,i[this.name]=!0}}class y{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;let i=this.writer,r=i.extensionsUsed,n={};if(n.iridescenceFactor=e.iridescence,e.iridescenceMap){let t={index:await i.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};i.applyTextureTransform(t,e.iridescenceMap),n.iridescenceTexture=t}if(n.iridescenceIor=e.iridescenceIOR,n.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],n.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){let t={index:await i.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};i.applyTextureTransform(t,e.iridescenceThicknessMap),n.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class x{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;let i=this.writer,r=i.extensionsUsed,n={};if(n.transmissionFactor=e.transmission,e.transmissionMap){let t={index:await i.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};i.applyTextureTransform(t,e.transmissionMap),n.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class _{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;let i=this.writer,r=i.extensionsUsed,n={};if(n.thicknessFactor=e.thickness,e.thicknessMap){let t={index:await i.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};i.applyTextureTransform(t,e.thicknessMap),n.thicknessTexture=t}e.attenuationDistance!==1/0&&(n.attenuationDistance=e.attenuationDistance),n.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class E{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;let i=this.writer.extensionsUsed,r={};r.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,i[this.name]=!0}}class S{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(c)&&!e.specularIntensityMap&&!e.specularColorMap)return;let i=this.writer,r=i.extensionsUsed,n={};if(e.specularIntensityMap){let t={index:await i.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};i.applyTextureTransform(t,e.specularIntensityMap),n.specularTexture=t}if(e.specularColorMap){let t={index:await i.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};i.applyTextureTransform(t,e.specularColorMap),n.specularColorTexture=t}n.specularFactor=e.specularIntensity,n.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class C{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;let i=this.writer,r=i.extensionsUsed,n={};if(e.sheenRoughnessMap){let t={index:await i.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};i.applyTextureTransform(t,e.sheenRoughnessMap),n.sheenRoughnessTexture=t}if(e.sheenColorMap){let t={index:await i.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};i.applyTextureTransform(t,e.sheenColorMap),n.sheenColorTexture=t}n.sheenRoughnessFactor=e.sheenRoughness,n.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class M{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;let i=this.writer,r=i.extensionsUsed,n={};if(e.anisotropyMap){let t={index:await i.processTextureAsync(e.anisotropyMap)};i.applyTextureTransform(t,e.anisotropyMap),n.anisotropyTexture=t}n.anisotropyStrength=e.anisotropy,n.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class w{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;let i=this.writer.extensionsUsed,r={};r.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,i[this.name]=!0}}class I{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;let i=this.writer,r=i.extensionsUsed,n={};if(e.bumpMap){let t={index:await i.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};i.applyTextureTransform(t,e.bumpMap),n.bumpTexture=t}n.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class T{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;let i=this.writer,r=new Float32Array(3*e.count),a=new Float32Array(4*e.count),s=new Float32Array(3*e.count),o=new n.kn4,l=new n.Pq0,h=new n.PTz,c=new n.Pq0;for(let t=0;t<e.count;t++)e.getMatrixAt(t,o),o.decompose(l,h,c),l.toArray(r,3*t),h.toArray(a,4*t),c.toArray(s,3*t);let u={TRANSLATION:i.processAccessor(new n.THS(r,3)),ROTATION:i.processAccessor(new n.THS(a,4)),SCALE:i.processAccessor(new n.THS(s,3))};e.instanceColor&&(u._COLOR_0=i.processAccessor(e.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:u},i.extensionsUsed[this.name]=!0,i.extensionsRequired[this.name]=!0}}s.Utils={insertKeyframe:function(e,t){let i,r=e.getValueSize(),n=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),s=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){n[0]=t;for(let e=0;e<r;e++)a[e]=0;i=0}else if(t<e.times[0]){if(.001>Math.abs(e.times[0]-t))return 0;n[0]=t,n.set(e.times,1),a.set(s.evaluate(t),0),a.set(e.values,r),i=0}else if(t>e.times[e.times.length-1]){if(.001>Math.abs(e.times[e.times.length-1]-t))return e.times.length-1;n[n.length-1]=t,n.set(e.times,0),a.set(e.values,0),a.set(s.evaluate(t),e.values.length),i=n.length-1}else for(let o=0;o<e.times.length;o++){if(.001>Math.abs(e.times[o]-t))return o;if(e.times[o]<t&&e.times[o+1]>t){n.set(e.times.slice(0,o+1),0),n[o+1]=t,n.set(e.times.slice(o+1),o+2),a.set(e.values.slice(0,(o+1)*r),0),a.set(s.evaluate(t),(o+1)*r),a.set(e.values.slice((o+1)*r),(o+2)*r),i=o+1;break}}return e.times=n,e.values=a,i},mergeMorphTargetTracks:function(e,t){let i=[],r={},a=e.tracks;for(let e=0;e<a.length;++e){let s,o=a[e],l=n.Nwf.parseTrackName(o.name),h=n.Nwf.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex){i.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(2301)}let c=h.morphTargetInfluences.length,u=h.morphTargetDictionary[l.propertyIndex];if(void 0===u)throw Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);if(void 0===r[h.uuid]){let e=new(s=o.clone()).ValueBufferType(c*s.times.length);for(let t=0;t<s.times.length;t++)e[t*c+u]=s.values[t];s.name=(l.nodeName||"")+".morphTargetInfluences",s.values=e,r[h.uuid]=s,i.push(s);continue}let d=o.createInterpolant(new o.ValueBufferType(1));s=r[h.uuid];for(let e=0;e<s.times.length;e++)s.values[e*c+u]=d.evaluate(s.times[e]);for(let e=0;e<o.times.length;e++){let t=this.insertKeyframe(s,o.times[e]);s.values[t*c+u]=o.values[e]}}return e.tracks=i,e},toFloat32BufferAttribute:function(e){let t=new n.THS(new Float32Array(e.count*e.itemSize),e.itemSize,!1);if(!e.normalized&&!e.isInterleavedBufferAttribute)return t.array.set(e.array),t;for(let i=0,r=e.count;i<r;i++)for(let r=0;r<e.itemSize;r++)t.setComponent(i,r,e.getComponent(i,r));return t}};var B=i(3520);let R=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter(e=>D(e.material)),D=e=>e&&e.isMaterial&&!Array.isArray(e);class L{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){let t=new Set,i=e=>{if(!R(e))return;let i=e.userData.variantMaterials;for(let[r,n]of e.userData.variantData){let e=i.get(n.index);e&&D(e.material)&&t.add(r)}};if(Array.isArray(e))for(let t of e)t.traverse(i);else e.traverse(i);t.forEach(e=>this.variantNames.push(e))}async writeMesh(e,t){if(!R(e))return;let i=e.userData,r=i.variantMaterials,n=i.variantData,a=new Map,s=new Map;for(let[e,t]of Array.from(n.values()).sort((e,t)=>e.index-t.index).entries())s.set(t.index,e);for(let e of n.values()){let t=r.get(e.index);if(!t||!D(t.material))continue;let i=await this.writer.processMaterialAsync(t.material);a.has(i)||a.set(i,{material:i,variants:[]}),a.get(i).variants.push(s.get(e.index))}let o=Array.from(a.values()).map(e=>e.variants.sort((e,t)=>e-t)&&e).sort((e,t)=>e.material-t.material);if(0===o.length)return;let l=D(i.originalMaterial)?await this.writer.processMaterialAsync(i.originalMaterial):-1;for(let e of t.primitives)l>=0&&(e.material=l),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:o}}afterParse(){if(0===this.variantNames.length)return;let e=this.writer.json;e.extensions=e.extensions||{};let t=this.variantNames.map(e=>({name:e}));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}var P=i(6201),U=i(6886),F=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let N=Symbol("currentGLTF"),O=Symbol("originalGltfJson"),k=Symbol("model"),Q=Symbol("getOnUpdateMethod"),G=Symbol("buildTexture"),H=e=>{var t,i,a;class o extends e{constructor(){super(...arguments),this[t]=void 0,this[i]=null,this[a]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[k]}get availableVariants(){return this.model?this.model[P.W8]():[]}get originalGltfJson(){return this[O]}[(t=k,i=N,a=O,Q)](){return()=>{this[B.ML]()}}[G](e){return e.colorSpace="srgb",e.wrapS=1e3,e.wrapT=1e3,new U.g(this[Q](),e)}async createTexture(e,t="image/png"){let{textureUtils:i}=this[B.m8],r=await i.loadImage(e,this.withCredentials);return r.userData.mimeType=t,this[G](r)}async createLottieTexture(e,t=1){let{textureUtils:i}=this[B.m8],r=await i.loadLottie(e,t,this.withCredentials);return this[G](r)}createVideoTexture(e){let t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();let i=new n.Nv2(t);return this[G](i)}createCanvasTexture(){let e=document.createElement("canvas"),t=new n.GOR(e);return this[G](t)}async updated(e){if(super.updated(e),e.has("variantName")){let e=this[B.OS].beginActivity("variant-update");e(.1);let t=this[k],{variantName:i}=this;null!=t&&(await t[P.qA](i),this[B.ML](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;let e=this[B.lC];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[B.m8].arRenderer.onUpdateScene(),this[B.ML]()}}[B.vA](){super[B.vA]();let{currentGLTF:e}=this[B.lC];if(null!=e){let{correlatedSceneGraph:t}=e;null!=t&&e!==this[N]&&(this[k]=new P.Kx(t,this[Q]()),this[O]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[N]=e}async exportScene(e){let t=this[B.lC];return new Promise(async(i,r)=>{let n={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(n,e),n.animations=t.animations,n.truncateDrawRange=!0;let a=t.shadow,o=!1;null!=a&&(o=a.visible,a.visible=!1),await this[k][P.Zm](),new s().register(e=>new L(e)).parse(t.model,e=>i(new Blob([n.binary?e:JSON.stringify(e)],{type:n.binary?"application/octet-stream":"application/json"})),()=>r("glTF export failed"),n),null!=a&&(a.visible=o)})}materialFromPoint(e,t){let i=this[k];if(null==i)return null;let r=this[B.lC],n=r.getNDC(e,t),a=r.hitFromPoint(n);return null==a||null==a.face?null:i[P.eI](a)}}return F([(0,r.MZ)({type:String,attribute:"variant-name"})],o.prototype,"variantName",void 0),F([(0,r.MZ)({type:String,attribute:"orientation"})],o.prototype,"orientation",void 0),F([(0,r.MZ)({type:String,attribute:"scale"})],o.prototype,"scale",void 0),o}},6580(e,t,i){"use strict";i.d(t,{OC:()=>c,_V:()=>d});var r=i(874),n=i(3520),a=i(5827),s=i(3333);let o=new r.V9B,l=new r.bdM(2,2),h=0,c=Symbol("threeTexture"),u=Symbol("threeTextures");Symbol("applyTexture");class d extends s.vc{get[c](){var e;return null==(e=this[s.oj])?void 0:e.values().next().value}get[u](){return this[s.oj]}constructor(e,t){super(e,new Set(t?[t]:[]));const i=this[c].image;i.src||(i.src=t.name?t.name:"adhoc_image"+h++),i.name||(i.name=t&&i&&i.src?i.src.split("/").pop():"adhoc_image")}get name(){return this[c].image.name||""}get uri(){return this[c].image.src}get bufferView(){return this[c].image.bufferView}get element(){let e=this[c];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){let e=this[c];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(let t of this[u])t.image.name=e}update(){let e=this[c];e&&e.isCanvasTexture&&!e.animation&&(this[c].needsUpdate=!0,this[s.VH]())}async createThumbnail(e,t){let i=new r.Z58;o.map=this[c];let s=new r.eaF(l,o);i.add(s);let h=new r.qUd(-1,1,1,-1,0,1),{threeRenderer:u}=a.A.singleton,d=new r.nWS(e,t);u.setRenderTarget(d),u.render(i,h),u.setRenderTarget(null);let p=new Uint8Array(e*t*4);u.readRenderTargetPixels(d,0,0,e,t,p),n.uz.width=e,n.uz.height=t;let A=n.uz.getContext("2d"),f=A.createImageData(e,t);return f.data.set(p),A.putImageData(f,0,0),new Promise(async(e,t)=>{n.uz.toBlob(i=>{if(!i)return t("Failed to capture thumbnail.");e(URL.createObjectURL(i))},"image/png")})}}},6201(e,t,i){"use strict";i.d(t,{Tt:()=>eo,Kx:()=>ep,eI:()=>ea,jQ:()=>es,Zm:()=>er,W8:()=>eh,qA:()=>en});var r,n,a,s,o,l,h,c,u,d,p,A,f,g=i(874),m=i(6580),v=i(6886);let b=Symbol("texture"),y=Symbol("transform"),x=Symbol("materials"),_=Symbol("usage"),E=Symbol("onUpdate"),S=Symbol("activeVideo");(r=o||(o={}))[r.Base=0]="Base",r[r.MetallicRoughness=1]="MetallicRoughness",r[r.Normal=2]="Normal",r[r.Occlusion=3]="Occlusion",r[r.Emissive=4]="Emissive",r[r.Clearcoat=5]="Clearcoat",r[r.ClearcoatRoughness=6]="ClearcoatRoughness",r[r.ClearcoatNormal=7]="ClearcoatNormal",r[r.SheenColor=8]="SheenColor",r[r.SheenRoughness=9]="SheenRoughness",r[r.Transmission=10]="Transmission",r[r.Thickness=11]="Thickness",r[r.Specular=12]="Specular",r[r.SpecularColor=13]="SpecularColor",r[r.Iridescence=14]="Iridescence",r[r.IridescenceThickness=15]="IridescenceThickness",r[r.Anisotropy=16]="Anisotropy";class C{constructor(e,t,i,r){this[n]=null,this[a]={rotation:0,scale:new g.I9Y(1,1),offset:new g.I9Y(0,0)},this[s]=!1,i&&(this[y].rotation=i.rotation,this[y].scale.copy(i.repeat),this[y].offset.copy(i.offset),this[b]=new v.g(e,i)),this[E]=e,this[x]=r,this[_]=t}get texture(){return this[b]}setTexture(e){var t,i;let r=null!=e?e.source[m.OC]:null,n=null==(t=this[b])?void 0:t.source[m.OC];if(null!=n&&n.isVideoTexture?this[S]=!1:(null==(i=this[b])?void 0:i.source.animation)&&this[b].source.animation.removeEventListener("enterFrame",this[E]),this[b]=e,null!=r&&r.isVideoTexture){let e=r.image;if(this[S]=!0,null!=e.requestVideoFrameCallback){let t=()=>{this[S]&&(this[E](),e.requestVideoFrameCallback(t))};e.requestVideoFrameCallback(t)}else{let e=()=>{this[S]&&(this[E](),requestAnimationFrame(e))};requestAnimationFrame(e)}}else(null==e?void 0:e.source.animation)!=null&&e.source.animation.addEventListener("enterFrame",this[E]);let a="srgb";if(this[x])for(let e of this[x]){switch(this[_]){case o.Base:e.map=r;break;case o.MetallicRoughness:a=g.Zr2,e.metalnessMap=r,e.roughnessMap=r;break;case o.Normal:a=g.Zr2,e.normalMap=r;break;case o.Occlusion:a=g.Zr2,e.aoMap=r;break;case o.Emissive:e.emissiveMap=r;break;case o.Clearcoat:e.clearcoatMap=r;break;case o.ClearcoatRoughness:e.clearcoatRoughnessMap=r;break;case o.ClearcoatNormal:e.clearcoatNormalMap=r;break;case o.SheenColor:e.sheenColorMap=r;break;case o.SheenRoughness:e.sheenRoughnessMap=r;break;case o.Transmission:e.transmissionMap=r;break;case o.Thickness:e.thicknessMap=r;break;case o.Specular:e.specularIntensityMap=r;break;case o.SpecularColor:e.specularColorMap=r;break;case o.Iridescence:e.iridescenceMap=r;break;case o.IridescenceThickness:e.iridescenceThicknessMap=r;break;case o.Anisotropy:e.anisotropyMap=r}e.needsUpdate=!0}r&&(r.colorSpace=a,r.rotation=this[y].rotation,r.repeat=this[y].scale,r.offset=this[y].offset),this[E]()}}n=b,a=y,s=S;var M=i(3333);let w=Symbol("threeMaterial"),I=Symbol("threeMaterials"),T=Symbol("baseColorTexture"),B=Symbol("metallicRoughnessTexture");class R extends M.vc{get[I](){return this[M.oj]}get[w](){var e;return null==(e=this[M.oj])?void 0:e.values().next().value}constructor(e,t){super(e,t);const{map:i,metalnessMap:r}=t.values().next().value;this[T]=new C(e,o.Base,i,t),this[B]=new C(e,o.MetallicRoughness,r,t)}get baseColorFactor(){let e=[0,0,0,this[w].opacity];return this[w].color.toArray(e),e}get metallicFactor(){return this[w].metalness}get roughnessFactor(){return this[w].roughness}get baseColorTexture(){return this[T]}get metallicRoughnessTexture(){return this[B]}setBaseColorFactor(e){let t=new g.Q1f;for(let i of(e instanceof Array?t.fromArray(e):t.set(e),this[I]))i.color.set(t),e instanceof Array&&e.length>3?i.opacity=e[3]:(e=[0,0,0,i.opacity],t.toArray(e));this[M.VH]()}setMetallicFactor(e){for(let t of this[I])t.metalness=e;this[M.VH]()}setRoughnessFactor(e){for(let t of this[I])t.roughness=e;this[M.VH]()}}let D=Symbol("pbrMetallicRoughness"),L=Symbol("normalTexture"),P=Symbol("occlusionTexture"),U=Symbol("emissiveTexture"),F=Symbol("backingThreeMaterial"),N=Symbol("applyAlphaCutoff"),O=Symbol("getAlphaMode"),k=Symbol("lazyLoadGLTFInfo"),Q=Symbol("initialize"),G=Symbol("getLoadedMaterial"),H=Symbol("ensureMaterialIsLoaded"),z=Symbol("gltfIndex"),V=Symbol("setActive"),q=Symbol("variantIndices"),W=Symbol("isActive"),j=Symbol("modelVariants"),X=Symbol("name"),Y=Symbol("pbrTextures");class J extends M.vc{get[(l=q,h=Y,F)](){return this[M.oj].values().next().value}constructor(e,t,i,r,n,a,s){super(e,n),this[l]=new Set,this[h]=new Map,this[z]=t,this[W]=i,this[j]=r,this[X]=a,null==s?this[Q]():this[k]=s}[Q](){let e=this[M.VH],t=this[M.oj];this[D]=new R(e,t);let{normalMap:i,aoMap:r,emissiveMap:n}=t.values().next().value;this[L]=new C(e,o.Normal,i,t),this[P]=new C(e,o.Occlusion,r,t),this[U]=new C(e,o.Emissive,n,t);let a=i=>{this[Y].set(i,new C(e,i,null,t))};a(o.Clearcoat),a(o.ClearcoatRoughness),a(o.ClearcoatNormal),a(o.SheenColor),a(o.SheenRoughness),a(o.Transmission),a(o.Thickness),a(o.Specular),a(o.SpecularColor),a(o.Iridescence),a(o.IridescenceThickness),a(o.Anisotropy)}async [G](){if(null!=this[k]){let e=await this[k].doLazyLoad();return this[Q](),this[k]=void 0,this.ensureLoaded=async()=>{},e}return null}colorFromRgb(e){let t=new g.Q1f;return e instanceof Array?t.fromArray(e):t.set(e),t}[H](){if(null!=this[k])throw Error(`Material "${this.name}" has not been loaded, call 'await
|
|
19
|
+
myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[G]()}get isLoaded(){return null==this[k]}get isActive(){return this[W]}[V](e){this[W]=e}get name(){return this[X]||""}set name(e){if(this[X]=e,null!=this[M.oj])for(let t of this[M.oj])t.name=e}get pbrMetallicRoughness(){return this[H](),this[D]}get normalTexture(){return this[H](),this[L]}get occlusionTexture(){return this[H](),this[P]}get emissiveTexture(){return this[H](),this[U]}get emissiveFactor(){return this[H](),this[F].emissive.toArray()}get index(){return this[z]}hasVariant(e){let t=this[j].get(e);return null!=t&&this[q].has(t.index)}setEmissiveFactor(e){this[H]();let t=this.colorFromRgb(e);for(let e of this[M.oj])e.emissive.set(t);this[M.VH]()}[O](){return this[F].transparent?"BLEND":this[F].alphaTest>0?"MASK":"OPAQUE"}[N](){for(let e of(this[H](),this[M.oj]))"MASK"===this[O]()?void 0==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){for(let t of(this[H](),this[M.oj]))t.alphaTest=e,t.needsUpdate=!0;this[N](),this[M.VH]()}getAlphaCutoff(){return this[H](),this[F].alphaTest}setDoubleSided(e){for(let t of(this[H](),this[M.oj]))t.side=2*!!e,t.needsUpdate=!0;this[M.VH]()}getDoubleSided(){return this[H](),2==this[F].side}setAlphaMode(e){this[H]();let t=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(let i of this[M.oj])t(i,"BLEND"===e),"MASK"===e?i.alphaTest=.5:i.alphaTest=void 0,i.needsUpdate=!0;this[M.VH]()}getAlphaMode(){return this[H](),this[O]()}get emissiveStrength(){return this[H](),this[F].emissiveIntensity}setEmissiveStrength(e){for(let t of(this[H](),this[M.oj]))t.emissiveIntensity=e;this[M.VH]()}get clearcoatFactor(){return this[H](),this[F].clearcoat}get clearcoatRoughnessFactor(){return this[H](),this[F].clearcoatRoughness}get clearcoatTexture(){return this[H](),this[Y].get(o.Clearcoat)}get clearcoatRoughnessTexture(){return this[H](),this[Y].get(o.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[H](),this[Y].get(o.ClearcoatNormal)}get clearcoatNormalScale(){return this[H](),this[F].clearcoatNormalScale.x}setClearcoatFactor(e){for(let t of(this[H](),this[M.oj]))t.clearcoat=e;this[M.VH]()}setClearcoatRoughnessFactor(e){for(let t of(this[H](),this[M.oj]))t.clearcoatRoughness=e;this[M.VH]()}setClearcoatNormalScale(e){for(let t of(this[H](),this[M.oj]))t.clearcoatNormalScale=new g.I9Y(e,e);this[M.VH]()}get ior(){return this[H](),this[F].ior}setIor(e){for(let t of(this[H](),this[M.oj]))t.ior=e;this[M.VH]()}get sheenColorFactor(){return this[H](),this[F].sheenColor.toArray()}get sheenColorTexture(){return this[H](),this[Y].get(o.SheenColor)}get sheenRoughnessFactor(){return this[H](),this[F].sheenRoughness}get sheenRoughnessTexture(){return this[H](),this[Y].get(o.SheenRoughness)}setSheenColorFactor(e){this[H]();let t=this.colorFromRgb(e);for(let e of this[M.oj])e.sheenColor.set(t),e.sheen=1;this[M.VH]()}setSheenRoughnessFactor(e){for(let t of(this[H](),this[M.oj]))t.sheenRoughness=e,t.sheen=1;this[M.VH]()}get transmissionFactor(){return this[H](),this[F].transmission}get transmissionTexture(){return this[H](),this[Y].get(o.Transmission)}setTransmissionFactor(e){for(let t of(this[H](),this[M.oj]))t.transmission=e;this[M.VH]()}get thicknessFactor(){return this[H](),this[F].thickness}get thicknessTexture(){return this[H](),this[Y].get(o.Thickness)}get attenuationDistance(){return this[H](),this[F].attenuationDistance}get attenuationColor(){return this[H](),this[F].attenuationColor.toArray()}setThicknessFactor(e){for(let t of(this[H](),this[M.oj]))t.thickness=e;this[M.VH]()}setAttenuationDistance(e){for(let t of(this[H](),this[M.oj]))t.attenuationDistance=e;this[M.VH]()}setAttenuationColor(e){this[H]();let t=this.colorFromRgb(e);for(let e of this[M.oj])e.attenuationColor.set(t);this[M.VH]()}get specularFactor(){return this[H](),this[F].specularIntensity}get specularTexture(){return this[H](),this[Y].get(o.Specular)}get specularColorFactor(){return this[H](),this[F].specularColor.toArray()}get specularColorTexture(){return this[H](),this[Y].get(o.SheenColor)}setSpecularFactor(e){for(let t of(this[H](),this[M.oj]))t.specularIntensity=e;this[M.VH]()}setSpecularColorFactor(e){this[H]();let t=this.colorFromRgb(e);for(let e of this[M.oj])e.specularColor.set(t);this[M.VH]()}get iridescenceFactor(){return this[H](),this[F].iridescence}get iridescenceTexture(){return this[H](),this[Y].get(o.Iridescence)}get iridescenceIor(){return this[H](),this[F].iridescenceIOR}get iridescenceThicknessMinimum(){return this[H](),this[F].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[H](),this[F].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[H](),this[Y].get(o.IridescenceThickness)}setIridescenceFactor(e){for(let t of(this[H](),this[M.oj]))t.iridescence=e;this[M.VH]()}setIridescenceIor(e){for(let t of(this[H](),this[M.oj]))t.iridescenceIOR=e;this[M.VH]()}setIridescenceThicknessMinimum(e){for(let t of(this[H](),this[M.oj]))t.iridescenceThicknessRange[0]=e;this[M.VH]()}setIridescenceThicknessMaximum(e){for(let t of(this[H](),this[M.oj]))t.iridescenceThicknessRange[1]=e;this[M.VH]()}get anisotropyStrength(){return this[H](),this[F].anisotropy}get anisotropyRotation(){return this[H](),this[F].anisotropyRotation}get anisotropyTexture(){return this[H](),this[Y].get(o.Anisotropy)}setAnisotropyStrength(e){for(let t of(this[H](),this[M.oj]))t.anisotropy=e;this[M.VH]()}setAnisotropyRotation(e){for(let t of(this[H](),this[M.oj]))t.anisotropyRotation=e;this[M.VH]()}}class K{constructor(e){this.name="",this.children=[],this.name=e}}class $ extends K{constructor(e,t,i,r){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:n,threeGLTF:a,threeObjectMap:s}=r;this.parser=a.parser,this.modelVariants=i,this.mesh.userData.variantData=i;const o=s.get(e.material);null!=o.materials?this.initialMaterialIdx=this.activeMaterialIdx=o.materials:console.error(`Primitive (${e.name}) missing initial material reference.`);const l=e.userData.associations||{};if(null==l.meshes)return void console.error("Mesh is missing primitive index association");const h=((n.meshes||[])[l.meshes].primitives||[])[l.primitives];if(null==h)return void console.error("Mesh primitive definition is missing.");if(null!=h.material)this.materials.set(h.material,t[h.material]);else{const e=t.findIndex(e=>"Default"===e.name);e>=0?this.materials.set(e,t[e]):console.warn("gltfPrimitive has no material!")}if(h.extensions&&h.extensions.KHR_materials_variants){const e=h.extensions.KHR_materials_variants,r=a.parser.json.extensions.KHR_materials_variants.variants;for(const n of e.mappings){const e=t[n.material];for(const t of(this.materials.set(n.material,e),n.variants)){const{name:n}=r[t];this.variantToMaterialMap.set(t,e),e[q].add(t),i.has(n)||i.set(n,{name:n,index:t})}}}}async setActiveMaterial(e){let t=this.materials.get(e);if(e!==this.activeMaterialIdx){let i=t[M.oj],r=await t[G]();null!=r?this.mesh.material=r:this.mesh.material=i.values().next().value,this.parser.assignFinalMaterial(this.mesh),i.add(this.mesh.material),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){let t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){let t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(let e of this.variantToMaterialMap.keys()){let t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;let i=await this.enableVariantHelper(e);null!=i&&(t.material=i)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});let i=this.modelVariants.get(t).index;return e[q].add(i),this.variantToMaterialMap.set(i,e),this.materials.set(e.index,e),this.updateVariantUserData(i,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);let t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[q].add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map,this.mesh.userData.variantMaterials.set(e,{material:t[M.oj].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){let t=this.modelVariants.get(e);return!(null!=t&&this.variantInfo.has(t.index))||(console.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}let Z=Symbol("materials"),ee=Symbol("hierarchy"),et=Symbol("roots"),ei=Symbol("primitives");Symbol("loadVariant");let er=Symbol("prepareVariantsForExport"),en=Symbol("switchVariant"),ea=Symbol("materialFromPoint"),es=Symbol("nodeFromPoint"),eo=Symbol("nodeFromIndex"),el=Symbol("variantData"),eh=Symbol("availableVariants"),ec=Symbol("modelOnUpdate"),eu=Symbol("cloneMaterial");class ed{constructor(e,t,i,r){this.gltf=e,this.gltfElementMap=t,this.mapKey=i,this.doLazyLoad=r}}class ep{constructor(e,t=()=>{}){this[c]=[],this[u]=[],this[d]=[],this[p]=[],this[A]=()=>{},this[f]=new Map,this[ec]=t;const{gltf:i,threeGLTF:r,gltfElementMap:n}=e;for(const[e,a]of i.materials.entries()){const s=n.get(a);if(null!=s)this[Z].push(new J(t,e,!0,this[el],s,a.name));else{const s=(i.materials||[])[e],o=new Set;n.set(s,o);const l=async()=>{let t=await r.parser.getDependency("material",e);return o.add(t),t};this[Z].push(new J(t,e,!1,this[el],o,a.name,new ed(i,n,s,l)))}}const a=new Map,s=[];for(const e of r.scene.children)s.push(e);for(;s.length>0;){const t=s.pop();let i=null;t instanceof g.eaF?(i=new $(t,this.materials,this[el],e),this[ei].push(i)):i=new K(t.name);const r=a.get(t);for(const e of(null!=r?r.children.push(i):this[et].push(i),this[ee].push(i),t.children))s.push(e),a.set(t,i)}}get materials(){return this[Z]}[(c=Z,u=ee,d=et,p=ei,A=ec,f=el,eh)](){let e=Array.from(this[el].values());return e.sort((e,t)=>e.index-t.index),e.map(e=>e.name)}getMaterialByName(e){let t=this[Z].filter(t=>t.name===e);return t.length>0?t[0]:null}[eo](e,t){let i=this[ee].find(i=>{if(i instanceof $){let{meshes:r,primitives:n}=i.mesh.userData.associations;if(r==e&&n==t)return!0}return!1});return null==i?null:i}[es](e){return this[ee].find(t=>t instanceof $&&t.mesh===e.object||!1)}[ea](e){return this[es](e).getActiveMaterial()}async [en](e){for(let t of this[ei])await t.enableVariant(e);for(let e of this.materials)e[V](!1);for(let e of this[ei])this.materials[e.getActiveMaterial().index][V](!0)}async [er](){let e=[];for(let t of this[ei])e.push(t.instantiateVariants());await Promise.all(e)}[eu](e,t){let i=this.materials[e];i.isLoaded||console.error(`Cloning an unloaded material,
|
|
20
|
+
call 'material.ensureLoaded() before cloning the material.`);let r=i[M.oj],n=new Set;for(let[e,i]of r.entries()){let a=i.clone();a.name=t+(r.size>1?"_inst"+e:""),n.add(a)}let a=new J(this[ec],this[Z].length,!1,this[el],n,t);return this[Z].push(a),a}createMaterialInstanceForVariant(e,t,i,r=!0){let n=null;for(let r of this[ei]){let a=this[el].get(i);null!=a&&r.variantInfo.has(a.index)||null!=r.getMaterial(e)&&(this.hasVariant(i)||this.createVariant(i),null==n&&(n=this[eu](e,t)),r.addVariant(n,i))}if(r&&null!=n)for(let t of(n[V](!0),this.materials[e][V](!1),this[ei]))t.enableVariant(i);return n}createVariant(e){this[el].has(e)?console.warn(`Variant '${e}'' already exists`):this[el].set(e,{name:e,index:this[el].size})}hasVariant(e){return this[el].has(e)}setMaterialToVariant(e,t){if(null==this[eh]().find(e=>e===t))return void console.warn(`Can't add material to '${t}', the variant does not exist.'`);if(e<0||e>=this.materials.length)return void console.error("setMaterialToVariant(): materialIndex is out of bounds.");for(let i of this[ei]){let r=i.getMaterial(e);null!=r&&i.addVariant(r,t)}}updateVariantName(e,t){let i=this[el].get(e);null!=i&&(i.name=t,this[el].set(t,i),this[el].delete(e))}deleteVariant(e){let t=this[el].get(e);if(null!=t){for(let i of this.materials)i.hasVariant(e)&&i[q].delete(t.index);for(let e of this[ei])e.deleteVariant(t.index);this[el].delete(e)}}}},6886(e,t,i){"use strict";i.d(t,{g:()=>S});var r,n,a,s,o=i(6580),l=i(874),h=i(3520);(r=a||(a={}))[r.Nearest=9728]="Nearest",r[r.Linear=9729]="Linear",r[r.NearestMipmapNearest=9984]="NearestMipmapNearest",r[r.LinearMipmapNearest=9985]="LinearMipmapNearest",r[r.NearestMipmapLinear=9986]="NearestMipmapLinear",r[r.LinearMipmapLinear=9987]="LinearMipmapLinear",(n=s||(s={}))[n.ClampToEdge=33071]="ClampToEdge",n[n.MirroredRepeat=33648]="MirroredRepeat",n[n.Repeat=10497]="Repeat";var c=i(3333);let u=new Map([[s.Repeat,1e3],[s.ClampToEdge,1001],[s.MirroredRepeat,1002]]),d=new Map([[1e3,s.Repeat],[1001,s.ClampToEdge],[1002,s.MirroredRepeat]]),p=new Map([[a.Nearest,1003],[a.Linear,1006],[a.NearestMipmapNearest,1004],[a.LinearMipmapNearest,1007],[a.NearestMipmapLinear,1005],[a.LinearMipmapLinear,1008]]),A=new Map([[1003,a.Nearest],[1006,a.Linear],[1004,a.NearestMipmapNearest],[1007,a.LinearMipmapNearest],[1005,a.NearestMipmapLinear],[1008,a.LinearMipmapLinear]]),f=new Map([[a.Nearest,1003],[a.Linear,1006]]),g=new Map([[1003,a.Nearest],[1006,a.Linear]]),m=Symbol("threeTexture"),v=Symbol("threeTextures"),b=Symbol("setProperty");class y extends c.vc{get[m](){var e;return null==(e=this[c.oj])?void 0:e.values().next().value}get[v](){return this[c.oj]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[m].name||""}get minFilter(){return A.get(this[m].minFilter)}get magFilter(){return g.get(this[m].magFilter)}get wrapS(){return d.get(this[m].wrapS)}get wrapT(){return d.get(this[m].wrapT)}get rotation(){return this[m].rotation}get scale(){return(0,h.hC)(this[m].repeat)}get offset(){return(0,h.hC)(this[m].offset)}setMinFilter(e){this[b]("minFilter",p.get(e))}setMagFilter(e){this[b]("magFilter",f.get(e))}setWrapS(e){this[b]("wrapS",u.get(e))}setWrapT(e){this[b]("wrapT",u.get(e))}setRotation(e){null==e&&(e=0),this[b]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[b]("repeat",new l.I9Y(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[b]("offset",new l.I9Y(e.u,e.v))}[b](e,t){if(((e,t)=>{switch(e){case"minFilter":let i;return i=t,A.has(i);case"magFilter":let r;return r=t,g.has(r);case"wrapS":case"wrapT":let n;return n=t,d.has(n);case"rotation":case"repeat":case"offset":return!0;default:throw Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(let i of this[v])i[e]=t,i.needsUpdate=!0;this[c.VH]()}}let x=Symbol("image"),_=Symbol("sampler"),E=Symbol("threeTexture");class S extends c.vc{get[E](){var e;return null==(e=this[c.oj])?void 0:e.values().next().value}constructor(e,t){super(e,new Set(t?[t]:[])),this[_]=new y(e,t),this[x]=new o._V(e,t)}get name(){return this[E].name||""}set name(e){for(let t of this[c.oj])t.name=e}get sampler(){return this[_]}get source(){return this[x]}}},3333(e,t,i){"use strict";i.d(t,{VH:()=>n,oj:()=>r,vc:()=>a});let r=Symbol("correlatedObjects"),n=Symbol("onUpdate");class a{constructor(e,t){this[n]=e,this[r]=t}}},6726(e,t,i){"use strict";i.d(t,{V:()=>f});var r=i(8413),n=i(6650),a=i(3520),s=i(3935),o=i(1718),l=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let h=Math.PI/32,c={basis:[(0,s.tR)((0,o.sJ)(h,"rad"))],keywords:{auto:[null]}},u=Symbol("autoRotateStartTime"),d=Symbol("radiansPerSecond"),p=Symbol("syncRotationRate"),A=Symbol("onCameraChange"),f=e=>{var t,i,s;class o extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[i]=0,this[s]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[u]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[A]),this[u]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[A]),this[u]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[u]=performance.now())}[(t=u,i=d,p)](e){this[d]=e[0]}[a.Ei](e,t){if(super[a.Ei](e,t),!this.autoRotate||!this[a.gJ]()||this[a.m8].isPresenting)return;let i=Math.min(t,e-this[u]-this.autoRotateDelay);i>0&&(this[a.lC].yaw=this.turntableRotation+this[d]*i*.001)}get turntableRotation(){return this[a.lC].yaw}resetTurntableRotation(e=0){this[a.lC].yaw=e}}return s=A,l([(0,r.MZ)({type:Boolean,attribute:"auto-rotate"})],o.prototype,"autoRotate",void 0),l([(0,r.MZ)({type:Number,attribute:"auto-rotate-delay"})],o.prototype,"autoRotateDelay",void 0),l([(0,n.i)({intrinsics:c,updateHandler:p}),(0,r.MZ)({type:String,attribute:"rotation-per-second"})],o.prototype,"rotationPerSecond",void 0),o}},3520(e,t,i){"use strict";i.d(t,{yc:()=>e4,cJ:()=>eX,vA:()=>e7,if:()=>te,gJ:()=>tn,T5:()=>eY,$M:()=>e0,uz:()=>eF,hr:()=>e5,Ay:()=>tl,Gw:()=>ts,m8:()=>tt,cM:()=>eK,Yl:()=>eZ,vk:()=>eW,Sw:()=>eJ,ML:()=>e9,Ei:()=>e6,Hc:()=>e1,OS:()=>ti,sM:()=>ta,hC:()=>to,SD:()=>e3,lC:()=>e8});var r,n,a,s,o,l,h,c,u,d,p,A,f,g=i(3035);let m=globalThis,v=e=>e,b=m.trustedTypes,y=b?b.createPolicy("lit-html",{createHTML:e=>e}):void 0,x="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,E="?"+_,S=`<${E}>`,C=document,M=()=>C.createComment(""),w=e=>null===e||"object"!=typeof e&&"function"!=typeof e,I=Array.isArray,T="[ \n\f\r]",B=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,D=/>/g,L=RegExp(`>|${T}(?:([^\\s"'>=/]+)(${T}*=${T}*(?:[^
|
|
21
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),P=/'/g,U=/"/g,F=/^(?:script|style|textarea|title)$/i,N=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),O=N(1),k=(N(2),N(3),Symbol.for("lit-noChange")),Q=Symbol.for("lit-nothing"),G=new WeakMap,H=C.createTreeWalker(C,129);function z(e,t){if(!I(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==y?y.createHTML(t):t}class V{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,a=0;const s=e.length-1,o=this.parts,[l,h]=((e,t)=>{let i=e.length-1,r=[],n,a=2===t?"<svg>":3===t?"<math>":"",s=B;for(let t=0;t<i;t++){let i=e[t],o,l,h=-1,c=0;for(;c<i.length&&(s.lastIndex=c,null!==(l=s.exec(i)));)c=s.lastIndex,s===B?"!--"===l[1]?s=R:void 0!==l[1]?s=D:void 0!==l[2]?(F.test(l[2])&&(n=RegExp("</"+l[2],"g")),s=L):void 0!==l[3]&&(s=L):s===L?">"===l[0]?(s=n??B,h=-1):void 0===l[1]?h=-2:(h=s.lastIndex-l[2].length,o=l[1],s=void 0===l[3]?L:'"'===l[3]?U:P):s===U||s===P?s=L:s===R||s===D?s=B:(s=L,n=void 0);let u=s===L&&e[t+1].startsWith("/>")?" ":"";a+=s===B?i+S:h>=0?(r.push(o),i.slice(0,h)+x+i.slice(h)+_+u):i+_+(-2===h?t:u)}return[z(e,a+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]})(e,t);if(this.el=V.createElement(l,i),H.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(r=H.nextNode())&&o.length<s;){if(1===r.nodeType){if(r.hasAttributes())for(const e of r.getAttributeNames())if(e.endsWith(x)){const t=h[a++],i=r.getAttribute(e).split(_),s=/([.?@])?(.*)/.exec(t);o.push({type:1,index:n,name:s[2],strings:i,ctor:"."===s[1]?Y:"?"===s[1]?J:"@"===s[1]?K:X}),r.removeAttribute(e)}else e.startsWith(_)&&(o.push({type:6,index:n}),r.removeAttribute(e));if(F.test(r.tagName)){const e=r.textContent.split(_),t=e.length-1;if(t>0){r.textContent=b?b.emptyScript:"";for(let i=0;i<t;i++)r.append(e[i],M()),H.nextNode(),o.push({type:2,index:++n});r.append(e[t],M())}}}else if(8===r.nodeType)if(r.data===E)o.push({type:2,index:n});else{let e=-1;for(;-1!==(e=r.data.indexOf(_,e+1));)o.push({type:7,index:n}),e+=_.length-1}n++}}static createElement(e,t){let i=C.createElement("template");return i.innerHTML=e,i}}function q(e,t,i=e,r){if(t===k)return t;let n=void 0!==r?i._$Co?.[r]:i._$Cl,a=w(t)?void 0:t._$litDirective$;return n?.constructor!==a&&(n?._$AO?.(!1),void 0===a?n=void 0:(n=new a(e))._$AT(e,i,r),void 0!==r?(i._$Co??=[])[r]=n:i._$Cl=n),void 0!==n&&(t=q(e,n._$AS(e,t.values),n,r)),t}class W{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:i}=this._$AD,r=(e?.creationScope??C).importNode(t,!0);H.currentNode=r;let n=H.nextNode(),a=0,s=0,o=i[0];for(;void 0!==o;){if(a===o.index){let t;2===o.type?t=new j(n,n.nextSibling,this,e):1===o.type?t=new o.ctor(n,o.name,o.strings,this,e):6===o.type&&(t=new $(n,this,e)),this._$AV.push(t),o=i[++s]}a!==o?.index&&(n=H.nextNode(),a++)}return H.currentNode=C,r}p(e){let t=0;for(let i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class j{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=Q,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){let i;w(e=q(this,e,t))?e===Q||null==e||""===e?(this._$AH!==Q&&this._$AR(),this._$AH=Q):e!==this._$AH&&e!==k&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):I(i=e)||"function"==typeof i?.[Symbol.iterator]?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Q&&w(this._$AH)?this._$AA.nextSibling.data=e:this.T(C.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:i}=e,r="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=V.createElement(z(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new W(r,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=G.get(e.strings);return void 0===t&&G.set(e.strings,t=new V(e)),t}k(e){I(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,r=0;for(let n of e)r===t.length?t.push(i=new j(this.O(M()),this.O(M()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=v(e).nextSibling;v(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class X{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=Q,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Q}_$AI(e,t=this,i,r){let n=this.strings,a=!1;if(void 0===n)(a=!w(e=q(this,e,t,0))||e!==this._$AH&&e!==k)&&(this._$AH=e);else{let r,s,o=e;for(e=n[0],r=0;r<n.length-1;r++)(s=q(this,o[i+r],t,r))===k&&(s=this._$AH[r]),a||=!w(s)||s!==this._$AH[r],s===Q?e=Q:e!==Q&&(e+=(s??"")+n[r+1]),this._$AH[r]=s}a&&!r&&this.j(e)}j(e){e===Q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Y extends X{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Q?void 0:e}}class J extends X{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Q)}}class K extends X{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??Q)===k)return;let i=this._$AH,r=e===Q&&i!==Q||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Q&&(i===Q||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ${constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}}let Z=m.litHtmlPolyfillSupport;Z?.(V,j),(m.litHtmlVersions??=[]).push("3.3.2");let ee=(e,t,i)=>{let r=i?.renderBefore??t,n=r._$litPart$;if(void 0===n){let e=i?.renderBefore??null;r._$litPart$=n=new j(t.insertBefore(M(),e),e,void 0,i??{})}return n._$AI(e),n},et=globalThis;class ei extends g.mN{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ee(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return k}}ei._$litElement$=!0,ei.finalized=!0,et.litElementHydrateSupport?.({LitElement:ei});let er=et.litElementPolyfillSupport;er?.({LitElement:ei}),(et.litElementVersions??=[]).push("4.2.2");var en=i(8413),ea=i(322),es=i(6526);let eo=O`
|
|
22
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
|
|
23
|
+
<!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
|
|
24
|
+
support for dynamic re-coloring of UI components -->
|
|
25
|
+
<defs>
|
|
26
|
+
<filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
|
|
27
|
+
<feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
|
|
28
|
+
<feOffset dx="0" dy="0" result="offsetblur"/>
|
|
29
|
+
<feFlood flood-color="#000000"/>
|
|
30
|
+
<feComposite in2="offsetblur" operator="in"/>
|
|
31
|
+
<feMerge>
|
|
32
|
+
<feMergeNode/>
|
|
33
|
+
<feMergeNode in="SourceGraphic"/>
|
|
34
|
+
</feMerge>
|
|
35
|
+
</filter>
|
|
36
|
+
</defs>
|
|
37
|
+
<path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
38
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
39
|
+
</svg>`,el=O`
|
|
40
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
|
|
41
|
+
<defs>
|
|
42
|
+
<path id="A" d="M.001.232h24.997V36H.001z" />
|
|
43
|
+
</defs>
|
|
44
|
+
<g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
|
|
45
|
+
<path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
|
|
46
|
+
<g transform="translate(11 3)">
|
|
47
|
+
<path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />
|
|
48
|
+
<path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />
|
|
49
|
+
<path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />
|
|
50
|
+
<g transform="translate(0 .769)">
|
|
51
|
+
<mask id="B" fill="#fff">
|
|
52
|
+
<use xlink:href="#A" />
|
|
53
|
+
</mask>
|
|
54
|
+
<path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />
|
|
55
|
+
</g>
|
|
56
|
+
</g>
|
|
57
|
+
</g>
|
|
58
|
+
</svg>`,eh=O`
|
|
59
|
+
<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
|
|
60
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
|
|
61
|
+
viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
|
|
62
|
+
<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
|
|
63
|
+
<g id="Art_layer">
|
|
64
|
+
<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
|
|
65
|
+
<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
|
|
66
|
+
<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
|
|
67
|
+
<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
|
|
68
|
+
<g>
|
|
69
|
+
<path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3
|
|
70
|
+
l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62
|
|
71
|
+
l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>
|
|
72
|
+
</g>
|
|
73
|
+
</g>
|
|
74
|
+
</svg>`,ec=O`
|
|
75
|
+
<style>
|
|
76
|
+
:host {
|
|
77
|
+
display: block;
|
|
78
|
+
position: relative;
|
|
79
|
+
contain: strict;
|
|
80
|
+
width: 300px;
|
|
81
|
+
height: 150px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.container {
|
|
85
|
+
position: relative;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.userInput {
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100%;
|
|
92
|
+
display: none;
|
|
93
|
+
position: relative;
|
|
94
|
+
outline-offset: -1px;
|
|
95
|
+
outline-width: 1px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
canvas {
|
|
99
|
+
position: absolute;
|
|
100
|
+
display: none;
|
|
101
|
+
pointer-events: none;
|
|
102
|
+
/* NOTE(cdata): Chrome 76 and below apparently have a bug
|
|
103
|
+
* that causes our canvas not to display pixels unless it is
|
|
104
|
+
* on its own render layer
|
|
105
|
+
* @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893
|
|
106
|
+
*/
|
|
107
|
+
transform: translateZ(0);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.show {
|
|
111
|
+
display: block;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Adapted from HTML5 Boilerplate
|
|
115
|
+
*
|
|
116
|
+
* @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */
|
|
117
|
+
.screen-reader-only {
|
|
118
|
+
border: 0;
|
|
119
|
+
left: 0;
|
|
120
|
+
top: 0;
|
|
121
|
+
clip: rect(0, 0, 0, 0);
|
|
122
|
+
height: 1px;
|
|
123
|
+
margin: -1px;
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
padding: 0;
|
|
126
|
+
position: absolute;
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
width: 1px;
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.slot {
|
|
133
|
+
position: absolute;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
top: 0;
|
|
136
|
+
left: 0;
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: 100%;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.slot > * {
|
|
142
|
+
pointer-events: initial;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.annotation-wrapper ::slotted(*) {
|
|
146
|
+
opacity: var(--max-hotspot-opacity, 1);
|
|
147
|
+
transition: opacity 0.3s;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.pointer-tumbling .annotation-wrapper ::slotted(*) {
|
|
151
|
+
pointer-events: none;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.annotation-wrapper ::slotted(*) {
|
|
155
|
+
pointer-events: initial;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.annotation-wrapper.hide ::slotted(*) {
|
|
159
|
+
opacity: var(--min-hotspot-opacity, 0.25);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.slot.poster {
|
|
163
|
+
display: none;
|
|
164
|
+
background-color: inherit;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.slot.poster.show {
|
|
168
|
+
display: inherit;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.slot.poster > * {
|
|
172
|
+
pointer-events: initial;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.slot.poster:not(.show) > * {
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#default-poster {
|
|
180
|
+
width: 100%;
|
|
181
|
+
height: 100%;
|
|
182
|
+
/* The default poster is a <button> so we need to set display
|
|
183
|
+
* to prevent it from being affected by text-align: */
|
|
184
|
+
display: block;
|
|
185
|
+
position: absolute;
|
|
186
|
+
border: none;
|
|
187
|
+
padding: 0;
|
|
188
|
+
background-size: contain;
|
|
189
|
+
background-repeat: no-repeat;
|
|
190
|
+
background-position: center;
|
|
191
|
+
background-color: #fff0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
#default-progress-bar {
|
|
195
|
+
display: block;
|
|
196
|
+
position: relative;
|
|
197
|
+
width: 100%;
|
|
198
|
+
height: 100%;
|
|
199
|
+
pointer-events: none;
|
|
200
|
+
overflow: hidden;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
#default-progress-bar > .bar {
|
|
204
|
+
position: absolute;
|
|
205
|
+
top: 0;
|
|
206
|
+
left: 0;
|
|
207
|
+
width: 100%;
|
|
208
|
+
height: var(--progress-bar-height, 5px);
|
|
209
|
+
background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));
|
|
210
|
+
transition: transform 0.09s;
|
|
211
|
+
transform-origin: top left;
|
|
212
|
+
transform: scaleX(0);
|
|
213
|
+
overflow: hidden;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
#default-progress-bar > .bar.hide {
|
|
217
|
+
transition: opacity 0.3s 1s;
|
|
218
|
+
opacity: 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.centered {
|
|
222
|
+
align-items: center;
|
|
223
|
+
justify-content: center;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.cover {
|
|
227
|
+
position: absolute;
|
|
228
|
+
top: 0;
|
|
229
|
+
left: 0;
|
|
230
|
+
width: 100%;
|
|
231
|
+
height: 100%;
|
|
232
|
+
pointer-events: none;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.slot.interaction-prompt {
|
|
236
|
+
display: var(--interaction-prompt-display, flex);
|
|
237
|
+
overflow: hidden;
|
|
238
|
+
opacity: 0;
|
|
239
|
+
will-change: opacity;
|
|
240
|
+
transition: opacity 0.3s;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.slot.interaction-prompt.visible {
|
|
244
|
+
opacity: 1;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.animated-container {
|
|
248
|
+
will-change: transform, opacity;
|
|
249
|
+
opacity: 0;
|
|
250
|
+
transition: opacity 0.3s;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.slot.interaction-prompt > * {
|
|
254
|
+
pointer-events: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.slot.ar-button {
|
|
258
|
+
-moz-user-select: none;
|
|
259
|
+
-webkit-tap-highlight-color: transparent;
|
|
260
|
+
user-select: none;
|
|
261
|
+
|
|
262
|
+
display: var(--ar-button-display, block);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.slot.ar-button:not(.enabled) {
|
|
266
|
+
display: none;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.fab {
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
justify-content: center;
|
|
273
|
+
box-sizing: border-box;
|
|
274
|
+
width: 40px;
|
|
275
|
+
height: 40px;
|
|
276
|
+
cursor: pointer;
|
|
277
|
+
background-color: #fff;
|
|
278
|
+
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);
|
|
279
|
+
border-radius: 100px;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.fab > * {
|
|
283
|
+
opacity: 0.87;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
#default-ar-button {
|
|
287
|
+
position: absolute;
|
|
288
|
+
bottom: 16px;
|
|
289
|
+
right: 16px;
|
|
290
|
+
transform: scale(var(--ar-button-scale, 1));
|
|
291
|
+
transform-origin: bottom right;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.slot.pan-target {
|
|
295
|
+
display: block;
|
|
296
|
+
position: absolute;
|
|
297
|
+
width: 0;
|
|
298
|
+
height: 0;
|
|
299
|
+
left: 50%;
|
|
300
|
+
top: 50%;
|
|
301
|
+
transform: translate3d(-50%, -50%, 0);
|
|
302
|
+
background-color: transparent;
|
|
303
|
+
opacity: 0;
|
|
304
|
+
transition: opacity 0.3s;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
#default-pan-target {
|
|
308
|
+
width: 6px;
|
|
309
|
+
height: 6px;
|
|
310
|
+
border-radius: 6px;
|
|
311
|
+
border: 1px solid white;
|
|
312
|
+
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.slot.default {
|
|
316
|
+
pointer-events: none;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.slot.progress-bar {
|
|
320
|
+
pointer-events: none;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.slot.exit-webxr-ar-button {
|
|
324
|
+
pointer-events: none;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.slot.exit-webxr-ar-button:not(.enabled) {
|
|
328
|
+
display: none;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
#default-exit-webxr-ar-button {
|
|
332
|
+
display: flex;
|
|
333
|
+
align-items: center;
|
|
334
|
+
justify-content: center;
|
|
335
|
+
position: absolute;
|
|
336
|
+
top: env(safe-area-inset-top, 16px);
|
|
337
|
+
right: 16px;
|
|
338
|
+
width: 40px;
|
|
339
|
+
height: 40px;
|
|
340
|
+
box-sizing: border-box;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
#default-exit-webxr-ar-button > svg {
|
|
344
|
+
fill: #fff;
|
|
345
|
+
}
|
|
346
|
+
</style>
|
|
347
|
+
<div class="container">
|
|
348
|
+
<div class="userInput" tabindex="0" role="img"
|
|
349
|
+
aria-label="3D model">
|
|
350
|
+
<div class="slot canvas">
|
|
351
|
+
<slot name="canvas">
|
|
352
|
+
<canvas></canvas>
|
|
353
|
+
</slot>
|
|
354
|
+
</div>
|
|
355
|
+
|
|
356
|
+
</div>
|
|
357
|
+
|
|
358
|
+
<!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM
|
|
359
|
+
will have their <slot> elements removed by ShadyCSS -->
|
|
360
|
+
<div class="slot poster">
|
|
361
|
+
<slot name="poster">
|
|
362
|
+
<button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>
|
|
363
|
+
</slot>
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
<div class="slot ar-button">
|
|
367
|
+
<slot name="ar-button">
|
|
368
|
+
<a id="default-ar-button" part="default-ar-button" class="fab"
|
|
369
|
+
tabindex="2"
|
|
370
|
+
role="button"
|
|
371
|
+
href="javascript:void(0);"
|
|
372
|
+
aria-label="View in your space">
|
|
373
|
+
${eh}
|
|
374
|
+
</a>
|
|
375
|
+
</slot>
|
|
376
|
+
</div>
|
|
377
|
+
|
|
378
|
+
<div class="slot pan-target">
|
|
379
|
+
<slot name="pan-target">
|
|
380
|
+
<div id="default-pan-target">
|
|
381
|
+
</div>
|
|
382
|
+
</slot>
|
|
383
|
+
</div>
|
|
384
|
+
|
|
385
|
+
<div class="slot interaction-prompt cover centered">
|
|
386
|
+
<div id="prompt" class="animated-container">
|
|
387
|
+
<slot name="interaction-prompt" aria-hidden="true">
|
|
388
|
+
${el}
|
|
389
|
+
</slot>
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
|
|
393
|
+
<div id="finger0" class="animated-container cover">
|
|
394
|
+
<slot name="finger0" aria-hidden="true">
|
|
395
|
+
</slot>
|
|
396
|
+
</div>
|
|
397
|
+
<div id="finger1" class="animated-container cover">
|
|
398
|
+
<slot name="finger1" aria-hidden="true">
|
|
399
|
+
</slot>
|
|
400
|
+
</div>
|
|
401
|
+
|
|
402
|
+
<div class="slot default">
|
|
403
|
+
<slot></slot>
|
|
404
|
+
|
|
405
|
+
<div class="slot progress-bar">
|
|
406
|
+
<slot name="progress-bar">
|
|
407
|
+
<div id="default-progress-bar" aria-hidden="true">
|
|
408
|
+
<div class="bar" part="default-progress-bar"></div>
|
|
409
|
+
</div>
|
|
410
|
+
</slot>
|
|
411
|
+
</div>
|
|
412
|
+
|
|
413
|
+
<div class="slot exit-webxr-ar-button">
|
|
414
|
+
<slot name="exit-webxr-ar-button">
|
|
415
|
+
<a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
|
|
416
|
+
tabindex="3"
|
|
417
|
+
aria-label="Exit AR"
|
|
418
|
+
aria-hidden="true">
|
|
419
|
+
${eo}
|
|
420
|
+
</a>
|
|
421
|
+
</slot>
|
|
422
|
+
</div>
|
|
423
|
+
</div>
|
|
424
|
+
</div>
|
|
425
|
+
<div class="screen-reader-only" role="region" aria-label="Live announcements">
|
|
426
|
+
<span id="status" role="status"></span>
|
|
427
|
+
</div>`;var eu=i(4515),ed=i(874),ep=i(3770);function eA(e,t,i){let r=i,n=new ed.Pq0;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{let{geometry:i}=e;if(void 0!==i){let{position:a}=i.attributes;if(void 0!==a)for(let i=0,s=a.count;i<s;i++)e.isMesh?e.getVertexPosition(i,n):n.fromBufferAttribute(a,i),e.isSkinnedMesh||n.applyMatrix4(e.matrixWorld),r=t(r,n)}}),r}var ef=i(387),eg=i(6201),em=i(3935),ev=i(1718),eb=i(8150);class ey extends ed.eaF{constructor(){super(void 0,new ed.V9B({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,i=128){(e!=this.height||t!=this.radius||i!=this.resolution)&&(this.height=e,this.radius=t,this.resolution=i,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function(e,t,i){let r=new ed.Gu$(t,2*i,i);r.scale(1,1,-1);let n=r.getAttribute("position"),a=new ed.Pq0;for(let t=0;t<n.count;++t)if(a.fromBufferAttribute(n,t),a.y<0){let i=-(3*e)/2,r=a.y<i?-e/a.y:1-a.y*a.y/(3*i*i);a.multiplyScalar(r),a.toArray(n.array,3*t)}return n.needsUpdate=!0,r}(e,t,i)))}}var ex=i(5112);let e_={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
428
|
+
|
|
429
|
+
varying vec2 vUv;
|
|
430
|
+
|
|
431
|
+
void main() {
|
|
432
|
+
|
|
433
|
+
vUv = uv;
|
|
434
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
435
|
+
|
|
436
|
+
}`,fragmentShader:`
|
|
437
|
+
|
|
438
|
+
uniform sampler2D tDiffuse;
|
|
439
|
+
uniform float h;
|
|
440
|
+
|
|
441
|
+
varying vec2 vUv;
|
|
442
|
+
|
|
443
|
+
void main() {
|
|
444
|
+
|
|
445
|
+
vec4 sum = vec4( 0.0 );
|
|
446
|
+
|
|
447
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
|
|
448
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
|
|
449
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
|
|
450
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
|
|
451
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
452
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
|
|
453
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
|
|
454
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
|
|
455
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
|
|
456
|
+
|
|
457
|
+
gl_FragColor = sum;
|
|
458
|
+
|
|
459
|
+
}`},eE={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
|
|
460
|
+
|
|
461
|
+
varying vec2 vUv;
|
|
462
|
+
|
|
463
|
+
void main() {
|
|
464
|
+
|
|
465
|
+
vUv = uv;
|
|
466
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
467
|
+
|
|
468
|
+
}`,fragmentShader:`
|
|
469
|
+
|
|
470
|
+
uniform sampler2D tDiffuse;
|
|
471
|
+
uniform float v;
|
|
472
|
+
|
|
473
|
+
varying vec2 vUv;
|
|
474
|
+
|
|
475
|
+
void main() {
|
|
476
|
+
|
|
477
|
+
vec4 sum = vec4( 0.0 );
|
|
478
|
+
|
|
479
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
|
|
480
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
|
|
481
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
|
|
482
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
|
|
483
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
484
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
|
|
485
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
|
|
486
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
|
|
487
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
|
|
488
|
+
|
|
489
|
+
gl_FragColor = sum;
|
|
490
|
+
|
|
491
|
+
}`};class eS extends ed.B69{constructor(e,t,i){super(),this.camera=new ed.qUd,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new ed.CSG,this.horizontalBlurMaterial=new ed.BKk(e_),this.verticalBlurMaterial=new ed.BKk(eE),this.intensity=0,this.softness=1,this.boundingBox=new ed.NRn,this.size=new ed.Pq0,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:r}=this;r.rotation.x=Math.PI/2,r.left=-.5,r.right=.5,r.bottom=-.5,r.top=.5,this.add(r);const n=new ed.bdM,a=new ed.V9B({opacity:1,transparent:!0,side:1});this.floor=new ed.eaF(n,a),this.floor.userData.noHit=!0,r.add(this.floor),this.blurPlane=new ed.eaF(n),this.blurPlane.visible=!1,r.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.depthMaterial.side=2,this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,i)}setScene(e,t,i){let{boundingBox:r,size:n,rotation:a,position:s}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(n.x,n.y,n.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(s),"back"===i){let{min:e,max:t}=r;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[n.y,n.z]=[n.z,n.y],a.x=Math.PI/2,a.y=Math.PI}else a.x=0,a.y=0;if(this.isAnimated){let e=r.min.y,t=r.max.y;n.y=this.maxDimension,r.expandByVector(n.subScalar(this.maxDimension).multiplyScalar(-.5)),r.min.y=e,r.max.y=t,n.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===i?s.y=r.min.y:s.z=r.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;let{size:t,camera:i}=this,r=this.isAnimated?2:1,n=r*Math.pow(2,9-3*e);this.setMapSize(n);let a=t.y/2,s=t.y*r;i.near=0,i.far=(1-e)*s+e*a,this.depthMaterial.opacity=1/e,i.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){let{size:t}=this;this.isAnimated&&(e*=2);let i=Math.floor(t.x>t.z?e:e*t.x/t.z),r=Math.floor(t.x>t.z?e*t.z/t.x:e),n=10+i,a=10+r;if(null!=this.renderTarget&&(this.renderTarget.width!==n||this.renderTarget.height!==a)&&(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){let e={format:1023};this.renderTarget=new ed.nWS(n,a,e),this.renderTargetBlur=new ed.nWS(n,a,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/i),t.z*(1+10/r),1),this.needsUpdate=!0}setIntensity(e){if(this.intensity=e,e>0){var t;this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*((1-(t=this.softness*this.softness))*.3+ +t)}else this.visible=!1,this.floor.visible=!1}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return .001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;let i=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;let r=e.xr.enabled;e.xr.enabled=!1;let n=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=r,e.setRenderTarget(n),e.setClearAlpha(i)}blurShadow(e){let{camera:t,horizontalBlurMaterial:i,verticalBlurMaterial:r,renderTarget:n,renderTargetBlur:a,blurPlane:s}=this;s.visible=!0,s.material=i,i.uniforms.h.value=1/this.renderTarget.width,i.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(a),e.render(s,t),s.material=r,r.uniforms.v.value=1/this.renderTarget.height,r.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(n),e.render(s,t),s.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}let eC=new ed.Pq0,eM=new ed.Pq0,ew=new ed.Pq0,eI=new ed.tBo,eT=new ed.Pq0,eB=new ed.I9Y;class eR extends ed.Z58{constructor({canvas:e,element:t,width:i,height:r}){super(),this.annotationRenderer=new ep.B,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.appendedAnimations=[],this.markedAnimations=[],this.camera=new ed.ubm(45,1,.1,100),this.xrCamera=null,this.url=null,this.pivot=new ed.B69,this.target=new ed.B69,this.animationNames=[],this.boundingBox=new ed.NRn,this.boundingSphere=new ed.iyt,this.size=new ed.Pq0,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=7,this.canScale=!0,this.isDirty=!1,this.goalTarget=new ed.Pq0,this.targetDamperX=new eb.A,this.targetDamperY=new eb.A,this.targetDamperZ=new eb.A,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new ey,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new ed.ubm(45,1,.1,100),this.camera.name="MainCamera",this.add(this.pivot),this.pivot.name="Pivot",this.pivot.add(this.target),this.setSize(i,r),this.target.name="Target",this.mixer=new ed.Iw4(this.target);const{domElement:n}=this.annotationRenderer,{style:a}=n;a.display="none",a.pointerEvents="none",a.position="absolute",a.top="0",this.element.shadowRoot.querySelector(".default").appendChild(n),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){let i;if(!e||e===this.url)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){let e=await this.externalRenderer.load(t);this.boundingSphere.radius=e.framedRadius,this.idealAspect=e.fieldOfViewAspect;return}null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{i=await new Promise((i,r)=>{this.cancelPendingSourceChange=()=>r(),(async()=>{try{let r=await this.element[tt].loader.load(e,this.element,t);i(r)}catch(e){r(e)}})()})}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=i,null!=i&&(this._model=i.scene,this.target.add(i.scene));let{animations:r}=i,n=new Map,a=[];for(let e of r)n.set(e.name,e),a.push(e.name);this.animations=r,this.animationsByName=n,this.animationNames=a,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();let{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);let t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[ef.BI]=null,this.element[ef.Z7]=null,this.element[ef.o7]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){let i=window.devicePixelRatio;this.externalRenderer.resize(e*i,t*i)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){let t=new ed.NRn;e.traverse(e=>{if(!e.material||!e.material.transparent)return;t.setFromObject(e);let i=t.getSize(eT),r=Math.min(i.x,i.y,i.z);Math.max(i.x,i.y,i.z)<100*r||this.markBakedShadow(e)})}checkBakedShadows(){let{min:e,max:t}=this.boundingBox,i=new ed.NRn;for(let r of(this.boundingBox.getSize(this.size),this.bakedShadows))i.setFromObject(r),(!(i.min.y<e.y+this.size.y/100)||!(i.min.x<=e.x)||!(i.max.x>=t.x)||!(i.min.z<=e.z)||!(i.max.z>=t.z))&&(i.min.z<e.z+this.size.z/100&&i.min.x<=e.x&&i.max.x>=t.x&&i.min.y<=e.y&&i.max.y>=t.y||this.unmarkBakedShadow(r))}applyTransform(){let{model:e}=this;if(null==e)return;let t=(0,ev.$y)(this.element.orientation)[0].terms,i=(0,em.cg)(t[0]).number,r=(0,em.cg)(t[1]).number,n=(0,em.cg)(t[2]).number;e.quaternion.setFromEuler(new ed.O9p(r,n,i,"YXZ"));let a=(0,ev.$y)(this.element.scale)[0].terms;e.scale.set(a[0].number,a[1].number,a[2].number)}updateBoundingBox(){let{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);let t=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=eA(e,t,new ed.NRn),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(e=>this.unmarkBakedShadow(e)),this.boundingBox=eA(e,t,new ed.NRn)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){let{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);let{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget()),this.boundingSphere.radius=Math.sqrt(eA(e,(e,i)=>Math.max(e,t.distanceToSquared(i)),0));let i=(e,i)=>(i.sub(t),Math.max(e,Math.sqrt(i.x*i.x+i.z*i.z)/(this.idealCameraDistance()-Math.abs(i.y))));this.idealAspect=eA(e,i,0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(let t of this.bakedShadows)t.visible=e}idealCameraDistance(){let e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){return 2*Math.atan(Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect))*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)eB.set(e/window.screen.width,t/window.screen.height);else{let i=this.element.getBoundingClientRect();eB.set((e-i.x)/this.width,(t-i.y)/this.height)}return eB.multiplyScalar(2).subScalar(1),eB.y*=-1,eB}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[tt].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){let e=(0,ev.$y)(this.element.skyboxHeight)[0].terms[0],t=(0,em.cg)(e).number,i=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,i),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,i){this.goalTarget.set(-e,-t,-i)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}getDynamicTarget(){return this.target.position.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){let t=this.goalTarget,i=this.target.position;if(t.equals(i))return!1;{let r=this.boundingSphere.radius/10,{x:n,y:a,z:s}=i;return n=this.targetDamperX.update(n,t.x,e,r),a=this.targetDamperY.update(a,t.y,e,r),s=this.targetDamperZ.update(s,t.z,e,r),this.groundedSkybox.position.x=-n,this.groundedSkybox.position.z=-s,this.target.position.set(n,a,s),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){let{x:i,z:r}=this.position;this.yaw=Math.atan2(e-i,t-r)}get model(){return this._model}set yaw(e){this.pivot.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.pivot.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){let e=Math.max(this.currentAnimationAction._loopCount,0);return 2202===this.currentAnimationAction.loop&&(1&e)==1?this.duration-this.currentAnimationAction.time:this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,i=2201,r=1/0){if(null==this._currentGLTF)return;let{animations:n}=this;if(null==n||0===n.length)return;let a=null;if(null!=e&&null==(a=this.animationsByName.get(e))){let t=parseInt(e);!isNaN(t)&&t>=0&&t<n.length&&(a=n[t])}null==a&&(a=n[0]);try{let{currentAnimationAction:e}=this,n=this.mixer.clipAction(a,this);this.currentAnimationAction=n,this.element.paused?this.mixer.stopAllAction():(n.paused=!1,null!=e&&n!==e?n.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),n.setLoop(i,r),n.enabled=!0,n.clampWhenFinished=!0,n.play()}catch(e){console.error(e)}}appendAnimation(e="",t=2201,i=1/0,r=1,n=1,a=!1,s=!1,o=!0,l=null,h=!1){if(null==this._currentGLTF||e===this.element.animationName)return;let{animations:c}=this;if(null==c||0===c.length)return;let u=e?this.animationsByName.get(e):null;if(null==u)return;if("string"==typeof i?isNaN(parseFloat(i))?(i=1/0,console.warn(`Invalid repetitionCount value: ${i}. Using default: Infinity`)):(1>parseInt(i)&&console.warn(`Invalid repetitionCount value: ${i}. Using 1 as minimum.`),i=Math.max(parseInt(i),1)):"number"==typeof i&&i<1?(i=1,console.warn(`Invalid repetitionCount value: ${i}. Using 1 value as minimum.`)):console.warn(`Invalid repetitionCount value: ${i}. Using default: Infinity`),1===i&&2200!==t&&(t=2200),"string"==typeof r){let e=parseFloat(r);isNaN(e)||e<0||e>1?(r=1,console.warn(`Invalid weight value: ${r}. Using default: 1`)):r=e}if("string"==typeof n){let e=parseFloat(n);isNaN(e)||e<0?(n=1,console.warn(`Invalid timeScale value: ${n}. Using default: 1`)):n=e}if("string"==typeof l){let e=parseFloat(l);isNaN(e)?(l=null,console.warn(`Invalid time value: ${l}. Using default: 0 or previous time`)):l=e}let{shouldFade:d,duration:p}=this.parseFadeValue(a,!1,1.25),A=!1,f=0;"boolean"==typeof s?(A=s,f=1.25*!!s):"number"==typeof s?(A=s>0,f=Math.max(s,0),s<0&&console.warn(`Invalid warp value: ${s}. Using default: false`)):"string"==typeof s&&("true"===s.toLowerCase().trim()?(A=!0,f=1.25):"false"===s.toLowerCase().trim()?A=!1:isNaN(parseFloat(s))?console.warn(`Invalid warp value: ${s}. Using default: false`):(A=(f=Math.max(parseFloat(s),0))>0,f<=0&&console.warn(`Invalid warp value: ${s}. Using default: false`)));try{let a=this.mixer.existingAction(u)||this.mixer.clipAction(u,this),s=a.timeScale;h&&this.appendedAnimations.includes(e)&&!this.markedAnimations.map(e=>e.name).includes(e)&&this.markedAnimations.push({name:e,loopMode:t,repetitionCount:i}),"number"==typeof l&&(a.time=Math.min(Math.max(l,0),u.duration)),d?a.fadeIn(p):r>=0&&(a.weight=Math.min(Math.max(r,0),1)),A?a.warp(o?s:0,n,f):a.timeScale=n,a.isRunning()||(a.time==u.duration&&a.stop(),a.setLoop(t,i),a.paused=!1,a.enabled=!0,a.clampWhenFinished=!0,a.play()),this.appendedAnimations.includes(e)||this.element[e8].appendedAnimations.push(e)}catch(e){console.error(e)}}parseFadeValue(e,t=!0,i=1.5){if("boolean"==typeof e)return{shouldFade:e,duration:e?i:0};if("number"==typeof e){let t=Math.max(e,0);return{shouldFade:t>0,duration:t}}if("string"==typeof e){let t=e.toLowerCase().trim();if("true"===t)return{shouldFade:!0,duration:i};if("false"===t)return{shouldFade:!1,duration:0};let r=parseFloat(t);if(!isNaN(r)){let e=Math.max(r,0);return{shouldFade:e>0,duration:e}}}return console.warn(`Invalid fade value: ${e}. Using default: ${t}`),{shouldFade:t,duration:t?i:0}}detachAnimation(e="",t=!0){if(null==this._currentGLTF||e===this.element.animationName)return;let{animations:i}=this;if(null==i||0===i.length)return;let r=e?this.animationsByName.get(e):null;if(null==r)return;let{shouldFade:n,duration:a}=this.parseFadeValue(t,!0,1.5);try{let t=this.mixer.existingAction(r)||this.mixer.clipAction(r,this);n?t.fadeOut(a):t.stop(),this.element[e8].appendedAnimations=this.element[e8].appendedAnimations.filter(t=>t!==e)}catch(e){console.error(e)}}updateAnimationLoop(e="",t=2201,i=1/0){if(null==this._currentGLTF||e===this.element.animationName)return;let{animations:r}=this;if(null==r||0===r.length)return;let n=null;if(e&&(n=this.animationsByName.get(e)),null!=n)try{let e=this.mixer.existingAction(n)||this.mixer.clipAction(n,this);e.stop(),e.setLoop(t,i),e.play()}catch(e){console.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){let e=this.shadow;if(null!=e){let t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){let t=this.shadow;null!=t&&!0==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if((this.shadowIntensity=e,null!=this._currentGLTF)&&(this.setBakedShadowVisibility(),!(e<=0)||null!=this.shadow)){if(null==this.shadow){let e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new eS(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;let t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){let t=this.shadow;null!=t&&t.setOffset(e)}getHit(e=this){return eI.intersectObject(e,!0).find(e=>e.object.visible&&!e.object.userData.noHit)}hitFromController(e,t=this){return eI.setFromXRController(e),this.getHit(t)}hitFromPoint(e,t=this){return eI.setFromCamera(e,this.getCamera()),this.getHit(t)}positionAndNormalFromPoint(e,t=this){var i;let r=this.hitFromPoint(e,t);if(null==r)return null;let n=r.point;return{position:n,normal:null!=r.face?r.face.normal.clone().applyNormalMatrix(new ed.dwI().getNormalMatrix(r.object.matrixWorld)):eI.ray.direction.clone().multiplyScalar(-1),uv:null!=(i=r.uv)?i:null}}surfaceFromPoint(e,t=this){let i=this.element.model;if(null==i)return null;let r=this.hitFromPoint(e,t);if(null==r||null==r.face)return null;let{meshes:n,primitives:a}=i[eg.jQ](r).mesh.userData.associations,s=new ed.Pq0,o=new ed.Pq0,l=new ed.Pq0,{a:h,b:c,c:u}=r.face,d=r.object;d.getVertexPosition(h,s),d.getVertexPosition(c,o),d.getVertexPosition(u,l);let p=new ed.lMl(s,o,l),A=new ed.Pq0;return p.getBarycoord(d.worldToLocal(r.point),A),`${n} ${a} ${h} ${c} ${u} ${A.x.toFixed(3)} ${A.y.toFixed(3)} ${A.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element),this.updateSurfaceHotspot(e)}removeHotspot(e){this.target.remove(e)}forHotspots(e){let{children:t}=this.target;for(let i=0,r=t.length;i<r;i++){let r=t[i];r instanceof ex.Y&&e(r)}}updateSurfaceHotspot(e){if(null==e.surface||null==this.element.model)return;let t=(0,ev.$y)(e.surface)[0].terms;if(8!=t.length)return void console.warn(e.surface+" does not have exactly 8 numbers.");let i=this.element.model[eg.Tt](t[0].number,t[1].number);if(null==i)return void console.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");let r=i.mesh.geometry.attributes.position.count,n=new ed.Pq0(t[2].number,t[3].number,t[4].number);if(n.x>=r||n.y>=r||n.z>=r)return void console.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");let a=new ed.Pq0(t[5].number,t[6].number,t[7].number);e.mesh=i.mesh,e.tri=n,e.bary=a,e.updateSurface()}animateSurfaceHotspots(){this.element.paused||this.forHotspots(e=>{e.updateSurface()})}updateHotspotsVisibility(e){this.forHotspots(t=>{eC.copy(e),eM.setFromMatrixPosition(t.matrixWorld),eC.sub(eM),ew.copy(t.normal).transformDirection(this.target.matrixWorld),0>eC.dot(ew)?t.hide():t.show()})}orientHotspots(e){this.forHotspots(t=>{t.orient(e)})}setHotspotsVisibility(e){this.forHotspots(t=>{t.visible=e})}updateSchema(e){var t;let{schemaElement:i,element:r}=this,{alt:n,poster:a,iosSrc:s}=r;if(null!=e){let r=[{"@type":"MediaObject",contentUrl:e,encodingFormat:(null==(t=e.split(".").pop())?void 0:t.toLowerCase())==="gltf"?"model/gltf+json":"model/gltf-binary"}];s&&r.push({"@type":"MediaObject",contentUrl:s,encodingFormat:"model/vnd.usdz+zip"}),i.textContent=JSON.stringify({"@context":"http://schema.org/","@type":"3DModel",image:null!=a?a:void 0,name:null!=n?n:void 0,encoding:r}),document.head.appendChild(i)}else null!=i.parentElement&&i.parentElement.removeChild(i)}}var eD=i(5827),eL=i(1535);class eP extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){let t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),i=>{let r;return(r=Math.max((0,eL.qE)(i,0,1),t.progress))!==t.progress&&this.announceTotalProgress(t,r,e),t.progress}}announceTotalProgress(e,t,i){let r=0,n=0;for(let i of(1==t&&(e.completed=!0),this.ongoingActivities)){let{progress:e}=i;r+=1-e,i.completed&&n++}let a=e.progress;e.progress=t,this.totalProgress+=(t-a)*(1-this.totalProgress)/r;let s=n===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:s,reason:i}})),n===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var eU=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let eF=document.createElement("canvas"),eN=Symbol("fallbackResizeHandler"),eO=Symbol("defaultAriaLabel"),ek=Symbol("resizeObserver"),eQ=Symbol("clearModelTimeout"),eG=Symbol("onContextLost"),eH=Symbol("loaded"),ez=Symbol("status"),eV=Symbol("onFocus"),eq=Symbol("onBlur"),eW=Symbol("updateSize"),ej=Symbol("intersectionObserver"),eX=Symbol("isElementInViewport"),eY=Symbol("announceModelVisibility"),eJ=Symbol("ariaLabel"),eK=Symbol("altDefaulted"),e$=Symbol("statusElement"),eZ=Symbol("updateStatus"),e0=Symbol("loadedTime"),e1=Symbol("updateSource"),e2=Symbol("markLoaded"),e3=Symbol("container"),e4=Symbol("input"),e5=Symbol("canvas"),e8=Symbol("scene"),e9=Symbol("needsRender"),e6=Symbol("tick"),e7=Symbol("onModelLoad"),te=Symbol("onResize"),tt=Symbol("renderer"),ti=Symbol("progressTracker"),tr=Symbol("getLoaded"),tn=Symbol("getModelIsVisible"),ta=Symbol("shouldAttemptPreload"),ts=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),to=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class tl extends g.mN{static get is(){return"model-viewer"}static set modelCacheSize(e){eu.IZ[eu.UV].evictionThreshold=e}static get modelCacheSize(){return eu.IZ[eu.UV].evictionThreshold}static set minimumRenderScale(e){e>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),eD.A.singleton.minScale=e}static get minimumRenderScale(){return eD.A.singleton.minScale}get loaded(){return this[tr]()}get[(r=eX,n=eH,a=e0,s=ez,o=eQ,l=eN,h=eY,c=ek,u=ej,d=ti,tt)](){return eD.A.singleton}get modelIsVisible(){return this[tn]()}constructor(){let e,t;super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[r]=!1,this[n]=!1,this[a]=0,this[s]="",this[o]=null,this[l]=(0,eL.sg)(()=>{let e=this.getBoundingClientRect();this[eW](e)},50),this[h]=(0,eL.sg)(e=>{let t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))},0),this[c]=null,this[u]=null,this[d]=new eP,this[p]=()=>{this[e$].textContent=this[ez]},this[A]=()=>{this[e$].textContent=""},this[f]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const i=this.shadowRoot;if((e=>{ee(ec,e)})(i),this[e3]=i.querySelector(".container"),this[e4]=i.querySelector(".userInput"),this[e5]=i.querySelector("canvas"),this[e$]=i.querySelector("#status"),this[eO]=this[e4].getAttribute("aria-label"),this.isConnected){const i=this.getBoundingClientRect();e=i.width,t=i.height}else e=300,t=150;this[e8]=new eR({canvas:this[e5],element:this,width:e,height:t}),Promise.resolve().then(()=>{this[eW](this.getBoundingClientRect())}),ea.Xq&&(this[ek]=new ResizeObserver(e=>{if(!this[tt].isPresenting)for(let t of e)t.target===this&&this[eW](t.contentRect)})),ea.k$?this[ej]=new IntersectionObserver(e=>{for(let t of e)if(t.target===this){let e=this.modelIsVisible;this[eX]=t.isIntersecting,this[eY](e),this[eX]&&!this.loaded&&this[e1]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[eX]=!0}connectedCallback(){super.connectedCallback&&super.connectedCallback(),ea.Xq?this[ek].observe(this):self.addEventListener("resize",this[eN]),ea.k$&&this[ej].observe(this),this.addEventListener("focus",this[eV]),this.addEventListener("blur",this[eq]);let e=this[tt];e.addEventListener("contextlost",this[eG]),e.registerScene(this[e8]),null!=this[eQ]&&(self.clearTimeout(this[eQ]),this[eQ]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),ea.Xq?this[ek].unobserve(this):self.removeEventListener("resize",this[eN]),ea.k$&&this[ej].unobserve(this),this.removeEventListener("focus",this[eV]),this.removeEventListener("blur",this[eq]);let e=this[tt];e.removeEventListener("contextlost",this[eG]),e.unregisterScene(this[e8]),this[eQ]=self.setTimeout(()=>{this[e8].dispose(),this[eQ]=null},10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[eH]=!1,this[e0]=0,this[e8].reset()):this.src!==this[e8].url&&(this[eH]=!1,this[e0]=0,this[e1]())),e.has("alt")&&this[e4].setAttribute("aria-label",this[eJ]),e.has("generateSchema")&&(this.generateSchema?this[e8].updateSchema(this.src):this[e8].updateSchema(null))}toDataURL(e,t){return this[tt].displayCanvas(this[e8]).toDataURL(e,t)}async toBlob(e){let t=e?e.mimeType:void 0,i=e?e.qualityArgument:void 0,r=e?e.idealAspect:void 0,{width:n,height:a,idealAspect:s,aspect:o}=this[e8],{dpr:l,scaleFactor:h}=this[tt],c=n*h*l,u=a*h*l,d=0,p=0;!0===r&&(s>o?p=(u-(u=Math.round(c/s)))/2:d=(c-(c=Math.round(u*s)))/2),eF.width=c,eF.height=u;try{return new Promise(async(e,r)=>{eF.getContext("2d").drawImage(this[tt].displayCanvas(this[e8]),d,p,c,u,0,0,c,u),eF.toBlob(t=>{if(!t)return r(Error("Unable to retrieve canvas blob"));e(t)},t,i)})}finally{this[eW]({width:n,height:a})}}registerEffectComposer(e){e.setRenderer(this[tt].threeRenderer),e.setMainCamera(this[e8].getCamera()),e.setMainScene(this[e8]),this[e8].effectRenderer=e}unregisterEffectComposer(){this[e8].effectRenderer=null}registerRenderer(e){this[e8].externalRenderer=e}unregisterRenderer(){this[e8].externalRenderer=null}get[eJ](){return this[eK]}get[eK](){return null==this.alt||"null"===this.alt?this[eO]:this.alt}[tr](){return this[eH]}[tn](){return this.loaded&&this[eX]}[ta](){return!!this.src&&this[eX]}[eW]({width:e,height:t}){0!==e&&0!==t&&(this[e3].style.width=`${e}px`,this[e3].style.height=`${t}px`,this[te]({width:e,height:t}))}[e6](e,t){var i;null==(i=this[e8].effectRenderer)||i.beforeRender(e,t)}[e2](){this[eH]||(this[eH]=!0,this[e0]=performance.now())}[e9](){this[e8].queueRender()}[e7](){}[eZ](e){this[ez]=e;let t=this.getRootNode();null!=t&&t.activeElement===this&&this[e$].textContent!=e&&(this[e$].textContent=e)}[(p=eV,A=eq,te)](e){this[e8].setSize(e.width,e.height)}async [(f=eG,e1)](){let e=this[e8];if(this.loaded||!this[ta]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[eZ]("Loading"),e.stopAnimation();let t=this[ti].beginActivity("model-load"),i=this.src;try{let r=e.setSource(i,e=>t(.95*(0,eL.qE)(e,0,1))),n=this[es.hj]();await Promise.all([r,n]),this[e2](),this[e7](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(e=>{let t=setTimeout(()=>{console.warn("rAF timed out in updateSource"),e()},500);requestAnimationFrame(()=>{requestAnimationFrame(()=>{clearTimeout(t),e()})})}),this.dispatchEvent(new CustomEvent("load",{detail:{url:i}}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}eU([(0,en.MZ)({type:String})],tl.prototype,"alt",void 0),eU([(0,en.MZ)({type:String})],tl.prototype,"src",void 0),eU([(0,en.MZ)({type:Boolean,attribute:"with-credentials"})],tl.prototype,"withCredentials",void 0),eU([(0,en.MZ)({type:Boolean,attribute:"generate-schema"})],tl.prototype,"generateSchema",void 0)},3935(e,t,i){"use strict";let r,n;i.d(t,{cg:()=>l,tR:()=>s});var a=i(1718);let s=(e,t=0)=>{let{number:i,unit:r}=e;if(isFinite(i)){if("rad"===e.unit||null==e.unit)return e}else i=t,r="rad";return{type:"number",number:("deg"===r&&null!=i?i:0)*Math.PI/180,unit:"rad"}},o=(e,t=0)=>{let i,{number:r,unit:n}=e;if(isFinite(r)){if("m"===e.unit)return e}else r=t,n="m";switch(n){default:i=1;break;case"cm":i=.01;break;case"mm":i=.001}return{type:"number",number:i*r,unit:"m"}},l=(n={rad:r=e=>e,deg:s,m:r,mm:o,cm:o},(e,t=a.f2)=>{isFinite(e.number)||(e.number=t.number,e.unit=t.unit);let{unit:i}=e;if(null==i)return e;let r=n[i];return null==r?t:r(e)})},5978(e,t,i){"use strict";i.d(t,{bk:()=>C});var r,n,a,s=i(3935),o=i(1718);let l=Symbol("evaluate"),h=Symbol("lastValue");class c{constructor(){this[r]=null}static evaluatableFor(e,t=o.f2){if(e instanceof c)return e;if("number"===e.type)return"%"===e.unit?new p(e,t):e;switch(e.name.value){case"calc":return new v(e,t);case"env":return new f(e)}return o.f2}static evaluate(e){return e instanceof c?e.evaluate():e}static isConstant(e){return!(e instanceof c)||e.isConstant}static applyIntrinsics(e,t){let{basis:i,keywords:r}=t,{auto:n}=r;return i.map((t,i)=>{let a=null==n[i]?t:n[i],l=e[i]?e[i]:a;if("ident"===l.type){let e=l.value;e in r&&(l=r[e][i])}return((null==l||"ident"===l.type)&&(l=a),"%"===l.unit)?(0,o.sJ)(l.number/100*t.number,t.unit):(l=(0,s.cg)(l,t)).unit!==t.unit?t:l})}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[h]||(this[h]=this[l]()),this[h]}}r=h;let u=Symbol("percentage"),d=Symbol("basis");class p extends c{constructor(e,t){super(),this[u]=e,this[d]=t}get isConstant(){return!0}[l](){return(0,o.sJ)(this[u].number/100*this[d].number,this[d].unit)}}let A=Symbol("identNode");class f extends c{constructor(e){super(),this[n]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[A]=t)}get isConstant(){return!1}[(n=A,l)](){return null!=this[A]&&"window-scroll-y"===this[A].value?{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}:o.f2}}let g=/[\*\/]/,m=Symbol("evaluator");class v extends c{constructor(e,t=o.f2){if(super(),this[a]=null,1!==e.arguments.length)return;const i=e.arguments[0].terms.slice(),r=[];for(;i.length;){const e=i.shift();if(r.length>0){const i=r[r.length-1];if("operator"===i.type&&g.test(i.value)){const i=r.pop(),n=r.pop();if(null==n)return;r.push(new _(i,c.evaluatableFor(n,t),c.evaluatableFor(e,t)));continue}}r.push("operator"===e.type?e:c.evaluatableFor(e,t))}for(;r.length>2;){const[e,i,n]=r.splice(0,3);if("operator"!==i.type)return;r.unshift(new _(i,c.evaluatableFor(e,t),c.evaluatableFor(n,t)))}1===r.length&&(this[m]=r[0])}get isConstant(){return null==this[m]||c.isConstant(this[m])}[(a=m,l)](){return null!=this[m]?c.evaluate(this[m]):o.f2}}let b=Symbol("operator"),y=Symbol("left"),x=Symbol("right");class _ extends c{constructor(e,t,i){super(),this[b]=e,this[y]=t,this[x]=i}get isConstant(){return c.isConstant(this[y])&&c.isConstant(this[x])}[l](){let e,t=(0,s.cg)(c.evaluate(this[y])),i=(0,s.cg)(c.evaluate(this[x])),{number:r,unit:n}=t,{number:a,unit:l}=i;if(null!=l&&null!=n&&l!=n)return o.f2;switch(this[b].value){case"+":e=r+a;break;case"-":e=r-a;break;case"/":e=r/a;break;case"*":e=r*a;break;default:return o.f2}return{type:"number",number:e,unit:n||l}}}let E=Symbol("evaluatables"),S=Symbol("intrinsics");class C extends c{constructor(e,t){super(),this[S]=t;const i=e[0],r=null!=i?i.terms:[];this[E]=t.basis.map((e,t)=>{let i=r[t];return null==i?{type:"ident",value:"auto"}:"ident"===i.type?i:c.evaluatableFor(i,e)})}get isConstant(){for(let e of this[E])if(!c.isConstant(e))return!1;return!0}[l](){let e=this[E].map(e=>c.evaluate(e));return c.applyIntrinsics(e,this[S]).map(e=>e.number)}}},1718(e,t,i){"use strict";let r,n,a,s,o,l,h,c,u;i.d(t,{$y:()=>p,PV:()=>y,f2:()=>x,sJ:()=>d});let d=(e,t)=>({type:"number",number:e,unit:t}),p=(r={},e=>{let t=e;if(t in r)return r[t];let i=[],n=0;for(;e;){if(++n>1e3){e="";break}let t=A(e),r=t.nodes[0];if(null==r||0===r.terms.length)break;i.push(r),e=t.remainingInput}return r[t]=i}),A=(n=/^(\-\-|[a-z\u0240-\uffff])/i,a=/^([\*\+\/]|[\-]\s)/i,s=/^[\),]/,e=>{let t=[];for(;e.length&&(e=e.trim(),!s.test(e));)if("("===e[0]){let{nodes:i,remainingInput:r}=v(e);e=r,t.push({type:"function",name:{type:"ident",value:"calc"},arguments:i})}else if(n.test(e)){let i=f(e),r=i.nodes[0];if("("===(e=i.remainingInput)[0]){let{nodes:i,remainingInput:n}=v(e);t.push({type:"function",name:r,arguments:i}),e=n}else t.push(r)}else if(a.test(e))t.push({type:"operator",value:e[0]}),e=e.slice(1);else{let{nodes:i,remainingInput:r}="#"===e[0]?m(e):g(e);if(0===i.length)break;t.push(i[0]),e=r}return{nodes:[{type:"expression",terms:t}],remainingInput:e}}),f=(o=/[^a-z0-9_\-\u0240-\uffff]/i,e=>{let t=e.match(o);return{nodes:[{type:"ident",value:null==t?e:e.substr(0,t.index)}],remainingInput:null==t?"":e.substr(t.index)}}),g=(l=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,h=/^[a-z%]+/i,c=/^(m|mm|cm|rad|deg|[%])$/,e=>{let t=e.match(l),i=null==t?"0":t[0],r=(e=null==i?e:e.slice(i.length)).match(h),n=null!=r&&""!==r[0]?r[0]:null,a=null==r?e:e.slice(n.length);return null==n||c.test(n)||(n=null),{nodes:[{type:"number",number:parseFloat(i)||0,unit:n}],remainingInput:a}}),m=(u=/^[a-f0-9]*/i,e=>{let t=(e=e.slice(1).trim()).match(u);return{nodes:null==t?[]:[{type:"hex",value:t[0]}],remainingInput:null==t?e:e.slice(t[0].length)}}),v=e=>{let t=[];for(e=e.slice(1).trim();e.length;){let i=A(e);if(t.push(i.nodes[0]),","===(e=i.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},b=Symbol("visitedTypes");class y{constructor(e){this[b]=e}walk(e,t){let i=e.slice();for(;i.length;){let e=i.shift();switch(this[b].indexOf(e.type)>-1&&t(e),e.type){case"expression":i.unshift(...e.terms);break;case"function":i.unshift(e.name,...e.arguments)}}}}let x=Object.freeze({type:"number",number:0,unit:null})},3418(e,t,i){"use strict";i.d(t,{sF:()=>y,tu:()=>B,pH:()=>x});var r=i(874);class n{constructor(e,t,i,n,a){this.xrLight=e,this.renderer=t,this.lightProbe=i,this.xrWebGLBinding=null,this.estimationStartCallback=a,this.frameCallback=this.onXRFrame.bind(this);const s=t.xr.getSession();if(n&&"XRWebGLBinding"in window){e.environment=new r.o6l(16).texture;const i=t.getContext();switch(s.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(s,i),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}s.requestAnimationFrame(this.frameCallback)}updateReflection(){let e=this.renderer.properties.get(this.xrLight.environment);if(e){let t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);let i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;let e=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/e,i.primaryLightIntensity.y/e,i.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class a extends r.YJl{constructor(e,t=!0){super(),this.lightProbe=new r.FZo,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new r.ZyN,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let i=null,a=!1;e.xr.addEventListener("sessionstart",()=>{let r=e.xr.getSession();"requestLightProbe"in r&&r.requestLightProbe({reflectionFormat:r.preferredReflectionFormat}).then(r=>{i=new n(this,e,r,t,()=>{a=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{i&&(i.dispose(),i=null),a&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{i&&(i.dispose(),i=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}var s=i(6526),o=i(1535),l=i(8150);let h={MIN_TOUCH_AREA:.05,BASE_RADIUS:.15,LINE_WIDTH:.02,SEGMENTS:16,DELTA_PHI:Math.PI/32,COLORS:{EDGE_FALLOFF:new r.Q1f(.98,.98,.98),EDGE_CUTOFF:new r.Q1f(.8,.8,.8),FILL_FALLOFF:new r.Q1f(.4,.4,.4),FILL_CUTOFF:new r.Q1f(.4,.4,.4),ACTIVE_EDGE:new r.Q1f(1,1,1),ACTIVE_FILL:new r.Q1f(.6,.6,.6)},MAX_OPACITY:.75,ACTIVE_OPACITY:.9,FILL_OPACITY_MULTIPLIER:.5,INTERACTIVE_OPACITY_MULTIPLIER:1.2,MIN_DISTANCE:.5,MAX_DISTANCE:10,BASE_SCALE:1,DISTANCE_SCALE_FACTOR:.3,FADE_IN_DURATION:.12,FADE_OUT_DURATION:.12,SIZE_UPDATE_DURATION:.05,COLOR_LERP_FACTOR:.15,SCREEN_SPACE_SCALE:1.2,SIZE_UPDATE_THRESHOLD:.001,GEOMETRY_UPDATE_DEBOUNCE:100},c=new r.I9Y,u=(e,t,i,r,n)=>{let a=t>0?i>0?0:-Math.PI/2:i>0?Math.PI/2:Math.PI;for(let s=0;s<=h.SEGMENTS;++s)e.push(t+(r-n)*Math.cos(a),i+(r-n)*Math.sin(a),0,t+r*Math.cos(a),i+r*Math.sin(a),0),a+=h.DELTA_PHI};class d extends r.eaF{constructor(e,t){super(new r.LoY),this.shadowHeight=0,this.isActive=!1,this.isHovered=!1,this.lastGeometryUpdateTime=0,this.needsGeometryUpdate=!1,this.scene=e,this.side=t,this.currentSize=new r.Pq0,this.goalSize=new r.Pq0,this.sizeDamper=new l.A,this.updateSizeFromScene(),this.edgeMaterial=new r.V9B({color:h.COLORS.EDGE_FALLOFF,transparent:!0,opacity:0,side:2,depthWrite:!1,blending:2}),this.fillMaterial=new r.V9B({color:h.COLORS.FILL_FALLOFF,transparent:!0,opacity:0,side:2,depthWrite:!1,blending:1}),this.material=this.edgeMaterial,this.goalOpacity=0,this.opacityDamper=new l.A,this.createHitMeshes(),this.updatePositionFromScene(),e.target.add(this),e.target.add(this.hitBox),this.offsetHeight=0}updateSizeFromScene(){let{size:e}=this.scene;this.goalSize.copy(e);let t=Math.sqrt(e.x*e.x+e.z*e.z),i=Math.max(h.MIN_TOUCH_AREA,.4*t);this.goalSize.x<i&&(this.goalSize.x=i),this.goalSize.z<i&&(this.goalSize.z=i),this.updateGeometry()}updateGeometry(){let e=this.geometry,t=[],i=[],n=this.goalSize.x/2,a=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,s=Math.min(n,a),o=Math.max(.7*h.BASE_RADIUS,.2*s),l=Math.max(.7*h.LINE_WIDTH,.025*s);u(i,n,a,o,l),u(i,-n,a,o,l),u(i,-n,-a,o,l),u(i,n,-a,o,l);let c=i.length/3;for(let e=0;e<c-2;e+=2)t.push(e,e+1,e+3,e,e+3,e+2);let d=c-2;t.push(d,d+1,1,d,1,0),e.setAttribute("position",new r.qtW(i,3)),e.setIndex(t),e.computeBoundingSphere()}createHitMeshes(){let e=this.goalSize.x/2,t=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,i=Math.min(e,t),n=Math.max(.7*h.BASE_RADIUS,.2*i);this.hitPlane=new r.eaF(new r.bdM(2*(e+n),2*(t+n))),this.hitPlane.visible=!1,this.hitPlane.material.side=2,this.add(this.hitPlane),this.hitBox=new r.eaF(new r.iNn(this.goalSize.x+2*n,this.goalSize.y+n,this.goalSize.z+2*n)),this.hitBox.visible=!1,this.hitBox.material.side=2,this.add(this.hitBox)}updatePositionFromScene(){let{boundingBox:e}=this.scene;switch(e.getCenter(this.position),this.rotation.set(0,0,0),this.side){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=e.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=e.min.z,this.position.z=this.shadowHeight}if(this.hitBox){let t=(this.side,(this.goalSize.y+h.BASE_RADIUS)/2);this.hitBox.position.y=t+e.min.y}}updateFromModelChanges(){this.updateSizeFromScene(),this.updatePositionFromScene(),this.updateGeometry(),this.updateHitMeshes(),this.ensureProperOrientation(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=performance.now()}ensureProperOrientation(){"bottom"===this.side?(this.rotation.x=-Math.PI/2,this.rotation.y=0,this.rotation.z=0):"back"===this.side&&(this.rotation.x=0,this.rotation.y=0,this.rotation.z=0)}setScreenSpaceMode(e){e?this.scale.set(h.SCREEN_SPACE_SCALE,h.SCREEN_SPACE_SCALE,h.SCREEN_SPACE_SCALE):this.scale.set(1,1,1)}updateHitMeshes(){if(this.hitPlane&&this.hitBox){let e=this.goalSize.x/2,t=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,i=Math.min(e,t),n=Math.max(.7*h.BASE_RADIUS,.2*i),a=new r.bdM(2*(e+n),2*(t+n));this.hitPlane.geometry.dispose(),this.hitPlane.geometry=a;let s=new r.iNn(this.goalSize.x+2*n,this.goalSize.y+n,this.goalSize.z+2*n);this.hitBox.geometry.dispose(),this.hitBox.geometry=s}}setInteractionState(e,t=!1){this.isActive=e,this.isHovered=t,this.updateVisualState()}updateVisualState(){let e,t;this.isActive?(e=h.COLORS.ACTIVE_EDGE,t=h.COLORS.ACTIVE_FILL):this.isHovered?(e=h.COLORS.EDGE_FALLOFF,t=h.COLORS.FILL_FALLOFF):(e=h.COLORS.EDGE_CUTOFF,t=h.COLORS.FILL_CUTOFF),this.edgeMaterial.color.lerp(e,h.COLOR_LERP_FACTOR),this.fillMaterial.color.lerp(t,h.COLOR_LERP_FACTOR)}applyDistanceScaling(e){let t=e.distanceTo(this.position),i=Math.max(h.MIN_DISTANCE,Math.min(h.MAX_DISTANCE,t)),r=h.BASE_SCALE+(i-h.MIN_DISTANCE)*h.DISTANCE_SCALE_FACTOR;this.scale.set(r,r,r)}getHit(e,t,i){c.set(t,-i),this.hitPlane.visible=!0;let r=e.positionAndNormalFromPoint(c,this.hitPlane);return this.hitPlane.visible=!1,null==r?null:r.position}getExpandedHit(e,t,i){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();let r=this.getHit(e,t,i);return this.hitPlane.scale.set(1,1,1),r}controllerIntersection(e,t){this.hitBox.visible=!0;let i=e.hitFromController(t,this.hitBox);return this.hitBox.visible=!1,i}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?h.MAX_OPACITY:0}updateOpacity(e){let t=this.material,i=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1);this.edgeMaterial.opacity=i,this.fillMaterial.opacity=i*h.FILL_OPACITY_MULTIPLIER,(this.isActive||this.isHovered)&&(this.edgeMaterial.opacity=i*h.INTERACTIVE_OPACITY_MULTIPLIER),this.visible=i>0}update(e,t){if(this.updateOpacity(e),!this.currentSize.equals(this.goalSize)){let t=new r.Pq0;t.x=this.sizeDamper.update(this.currentSize.x,this.goalSize.x,e,1),t.y=this.sizeDamper.update(this.currentSize.y,this.goalSize.y,e,1),t.z=this.sizeDamper.update(this.currentSize.z,this.goalSize.z,e,1),t.distanceTo(this.currentSize)>h.SIZE_UPDATE_THRESHOLD&&(this.currentSize.copy(t),this.needsGeometryUpdate=!0)}let i=performance.now();this.needsGeometryUpdate&&i-this.lastGeometryUpdateTime>h.GEOMETRY_UPDATE_DEBOUNCE&&(this.updateGeometry(),this.updateHitMeshes(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=i),t&&this.applyDistanceScaling(t),this.updateVisualState()}getSize(){return this.goalSize.clone()}dispose(){let{geometry:e,material:t}=this.hitPlane;e.dispose(),t.dispose(),this.hitBox.geometry.dispose(),this.hitBox.material.dispose(),this.geometry.dispose(),this.edgeMaterial.dispose(),this.fillMaterial.dispose(),this.hitBox.removeFromParent(),this.removeFromParent()}}var p=i(119);let A=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">
|
|
492
|
+
<path d="M6.4,19L5,17.6L10.6,12L5,6.4L6.4,5L12,10.6L17.6,5L19,6.4L13.4,12L19,17.6L17.6,19L12,13.4L6.4,19Z"/>
|
|
493
|
+
</svg>`,f=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">
|
|
494
|
+
<path d="M7,17V9H5V7H9V17H7ZM11,17V15H13V17H11ZM16,17V9H14V7H18V17H16ZM11,13V11H13V13H11Z"/>
|
|
495
|
+
</svg>`,g=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#E1E2E8">
|
|
496
|
+
<defs>
|
|
497
|
+
<clipPath id="clip0">
|
|
498
|
+
<path d="M0,0h24v24h-24z"/>
|
|
499
|
+
</clipPath>
|
|
500
|
+
</defs>
|
|
501
|
+
<g clip-path="url(#clip0)">
|
|
502
|
+
<path d="M12,22C10.75,22 9.575,21.767 8.475,21.3C7.392,20.817 6.442,20.175 5.625,19.375C4.825,18.558 4.183,17.608 3.7,16.525C3.233,15.425 3,14.25 3,13H5C5,14.95 5.675,16.608 7.025,17.975C8.392,19.325 10.05,20 12,20C13.95,20 15.6,19.325 16.95,17.975C18.317,16.608 19,14.95 19,13C19,11.05 18.317,9.4 16.95,8.05C15.6,6.683 13.95,6 12,6H11.85L13.4,7.55L12,9L8,5L12,1L13.4,2.45L11.85,4H12C13.25,4 14.417,4.242 15.5,4.725C16.6,5.192 17.55,5.833 18.35,6.65C19.167,7.45 19.808,8.4 20.275,9.5C20.758,10.583 21,11.75 21,13C21,14.25 20.758,15.425 20.275,16.525C19.808,17.608 19.167,18.558 18.35,19.375C17.55,20.175 16.6,20.817 15.5,21.3C14.417,21.767 13.25,22 12,22Z"/>
|
|
503
|
+
</g>
|
|
504
|
+
</svg>`,m={width:.16,height:.07,cornerRadius:.03,opacity:1,color:0,minDistance:.5,maxDistance:10,baseScale:1,distanceScaleFactor:.3};class v extends r.B69{constructor(){super(),this.isActualSize=!1,this.preRenderIcons(),this.createPanel(),this.createButtons(),this.opacityDamper=new l.A,this.goalOpacity=m.opacity}createPanel(){let e=this.createPanelShape(),t=new r.MSw(e),i=new r.V9B({color:m.color,opacity:m.opacity,transparent:!0});this.panelMesh=new r.eaF(t,i),this.panelMesh.name="MenuPanel",this.add(this.panelMesh)}createButtons(){this.exitButton=this.createButton("close"),this.exitButton.name="ExitButton",this.exitButton.position.set(.035,0,.01),this.add(this.exitButton),this.toggleButton=this.createButton("view-real-size"),this.toggleButton.name="ToggleButton",this.toggleButton.position.set(-.035,0,.01),this.add(this.toggleButton)}createPanelShape(){let e=new r.ypk,{width:t,height:i,cornerRadius:n}=m;return e.moveTo(-t/2+n,-i/2),e.lineTo(t/2-n,-i/2),e.quadraticCurveTo(t/2,-i/2,t/2,-i/2+n),e.lineTo(t/2,i/2-n),e.quadraticCurveTo(t/2,i/2,t/2-n,i/2),e.lineTo(-t/2+n,i/2),e.quadraticCurveTo(-t/2,i/2,-t/2,i/2-n),e.lineTo(-t/2,-i/2+n),e.quadraticCurveTo(-t/2,-i/2,-t/2+n,-i/2),e}preRenderIcons(){[{key:"close",svg:A},{key:"view-real-size",svg:f},{key:"replay",svg:g}].forEach(({key:e,svg:t})=>{v.iconTextures.has(e)||this.createTextureFromSvg(t,e)})}createTextureFromSvg(e,t){let i=document.createElement("canvas");i.width=128,i.height=128;let n=i.getContext("2d"),a=new Image,s=new Blob([e],{type:"image/svg+xml"}),o=URL.createObjectURL(s);a.onload=()=>{n.drawImage(a,0,0,128,128);let e=new r.GOR(i);e.needsUpdate=!0,e.minFilter=1006,v.iconTextures.set(t,e),URL.revokeObjectURL(o)},a.src=o}createButton(e){let t=new r.V9B({transparent:!0}),i=new r.bdM(.05,.05),n=new r.eaF(i,t),a=v.iconTextures.get(e);if(a)n.material.map=a,n.material.needsUpdate=!0;else{this.createTextureFromSvg("close"===e?A:"view-real-size"===e?f:g,e);let t=()=>{let i=v.iconTextures.get(e);i?(n.material.map=i,n.material.needsUpdate=!0):setTimeout(t,10)};t()}return n}exitButtonControllerIntersection(e,t){return e.hitFromController(t,this.exitButton)}scaleModeButtonControllerIntersection(e,t){return e.hitFromController(t,this.toggleButton)}handleScaleToggle(e,t,i,r){if(!e)return null;this.isActualSize=!this.isActualSize;let n=this.isActualSize?"replay":"view-real-size";return this.updateScaleModeButtonLabel(n),Math.max(i,Math.min(r,this.isActualSize?1:t))}updateScaleModeButtonLabel(e){let t=v.iconTextures.get(e);t&&(this.toggleButton.material.map=t,this.toggleButton.material.needsUpdate=!0)}updatePosition(e,t){if(!t)return;let i=new r.Pq0;t.getWorldPosition(i);let n=t.getSize(),a=Math.max(.5,Math.min(2,Math.min(n.x,n.z)/1)),s=new r.Pq0().copy(e.position).sub(i);s.y=0,s.normalize();let o=new r.Pq0().copy(i).add(new r.Pq0(0,-.2*a,0)).add(s.multiplyScalar(.9*a));this.position.copy(o);let l=e.position.distanceTo(o),h=Math.max(m.minDistance,Math.min(m.maxDistance,l)),c=m.baseScale+(h-m.minDistance)*m.distanceScaleFactor;this.scale.set(c,c,c),this.lookAt(e.position)}set show(e){this.goalOpacity=e?m.opacity:0}updateOpacity(e){let t=this.panelMesh.material.opacity,i=this.opacityDamper.update(t,this.goalOpacity,e,1);this.traverse(e=>{if(e instanceof r.eaF){let t=e.material;t.transparent&&(t.opacity=i)}}),this.visible=i>0}dispose(){var e;this.children.forEach(e=>{e instanceof r.eaF&&(e.geometry&&e.geometry.dispose(),(Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{e&&("map"in e&&e.map instanceof r.GOR&&e.map.dispose(),e.dispose())}))}),null==(e=this.parent)||e.remove(this)}}v.iconTextures=new Map;let b=new r.Pq0(0,1,0),y={NOT_PRESENTING:"not-presenting",SESSION_STARTED:"session-started",OBJECT_PLACED:"object-placed",FAILED:"failed"},x={TRACKING:"tracking",NOT_TRACKING:"not-tracking"},_=new r.Pq0,E=new r.PTz,S=new r.kn4,C=new r.Pq0,M=new r.ubm(45,1,.1,100),w=new r.LoY().setFromPoints([new r.Pq0(0,0,0),new r.Pq0(0,0,-1)]),I="screen-space",T="world-space";class B extends r.Qev{isWorldSpaceReady(){return this.xrMode===T&&this.worldSpaceInitialPlacementDone}constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.menuPanel=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.xrMode=null,this.xrController1=null,this.xrController2=null,this.selectedXRController=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new r.Pq0,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastDragPosition=new r.Pq0,this.deltaRotation=new r.PTz,this.scaleLine=new r.N1A(w),this.firstRatio=0,this.lastAngle=0,this.goalPosition=new r.Pq0,this.goalYaw=0,this.goalScale=1,this.xDamper=new l.A,this.yDamper=new l.A,this.zDamper=new l.A,this.yawDamper=new l.A,this.pitchDamper=new l.A,this.rollDamper=new l.A,this.scaleDamper=new l.A,this.wasTwoFingering=!1,this.worldSpaceInitialPlacementDone=!1,this.initialModelScale=1,this.minScale=1,this.maxScale=1,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onControllerSelectStart=e=>{var t,i,n;let a=this.presentedScene,s=e.target,o=this.menuPanel;if(null!=this.menuPanel.exitButtonControllerIntersection(a,s)){null==(t=this.menuPanel)||t.dispose(),this.stopPresenting();return}if(null!=this.menuPanel.scaleModeButtonControllerIntersection(a,s)){let e=this.menuPanel.handleScaleToggle(this.worldSpaceInitialPlacementDone,this.initialModelScale,this.minScale,this.maxScale);null!==e&&(this.goalScale=e);return}o&&(o.show=!1);let l=this.placementBox.controllerIntersection(a,s);if(null!=l){let e=new r.NRn().setFromObject(a.pivot).min.y+.2;if(l.point.y<=e)null!=this.selectedXRController?(this.selectedXRController.userData.line.visible=!1,a.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/a.pivot.scale.x,this.scaleLine.visible=!0)):s.attach(a.pivot),this.selectedXRController=s,a.setShadowIntensity(.01);else if(s==this.xrController1?this.xrController1.userData.isSelected=!0:s==this.xrController2&&(this.xrController2.userData.isSelected=!0),(null==(i=this.xrController1)?void 0:i.userData.isSelected)&&(null==(n=this.xrController2)?void 0:n.userData.isSelected))a.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/a.pivot.scale.x,this.scaleLine.visible=!0);else{let e=s===this.xrController1?this.xrController2:this.xrController1;s.userData.initialX=s.position.x,e.userData.turning=!1,s.userData.turning=!0,s.userData.line.visible=!1}}},this.onControllerSelectEnd=e=>{let t=e.target;if(t.userData.turning=!1,t.userData.line.visible=!0,this.isTwoHandInteraction=!1,this.scaleLine.visible=!1,t==this.xrController1?this.xrController1.userData.isSelected=!1:t==this.xrController2&&(this.xrController2.userData.isSelected=!1),null!=this.selectedXRController&&this.selectedXRController!=t)return;let i=this.presentedScene;i.attach(i.pivot),this.selectedXRController=null,this.goalYaw=Math.atan2(i.pivot.matrix.elements[8],i.pivot.matrix.elements[10]),this.goalPosition.x=i.pivot.position.x,this.goalPosition.z=i.pivot.position.z,this.isWorldSpaceReady()&&(this.goalPosition.y=i.pivot.position.y),this.menuPanel.show=!0},this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.updateFromModelChanges(),this.placementBox.setScreenSpaceMode(this.xrMode===I)),this.xrMode!==I&&(this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),this.menuPanel=new v,this.presentedScene.add(this.menuPanel),this.menuPanel.updatePosition(this.presentedScene.getCamera(),this.placementBox))},this.onSelectStart=e=>{let t=this.transientHitTestSource;if(null==t)return;let i=this.frame.getHitTestResultsForTransientInput(t),r=this.presentedScene,n=this.placementBox;if(1===i.length){this.inputSource=e.inputSource;let{axes:t}=this.inputSource.gamepad,i=n.getHit(this.presentedScene,t[0],t[1]);n.show=!0,null!=i?(this.isTranslating=!0,this.lastDragPosition.copy(i)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===i.length){n.show=!0,this.isTwoHandInteraction=!0;let{separation:e,angle:t}=this.fingerPolar(i);this.lastAngle=t,0===this.firstRatio&&(this.firstRatio=e/r.pivot.scale.x),r.canScale&&this.setScale(e);return}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){(0,o.f3)();let e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:[],optionalFeatures:["hit-test","dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return(0,o.f3)(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return console.warn("Request to present in WebXR denied:"),console.warn(e),console.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let i=new Promise((e,t)=>{requestAnimationFrame(()=>e())});e.setHotspotsVisibility(!1),e.queueRender(),await i,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new a(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||null==this.xrLight)return;let e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment}));let r=await this.resolveARSession();r.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});let n=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");n.classList.add("enabled"),n.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=n;let s=await r.requestReferenceSpace("viewer");this.xrMode=r.interactionMode,this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);let o=20*Math.PI/180,l=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(o),z:-Math.cos(o)});r.requestHitTestSource({space:s,offsetRay:l}).then(e=>{this.initialHitSource=e}),this.xrMode!==I&&(this.setupXRControllers(),this.xDamper.setDecayTime(150),this.yDamper.setDecayTime(150),this.zDamper.setDecayTime(150),this.yawDamper.setDecayTime(150),this.pitchDamper.setDecayTime(150),this.rollDamper.setDecayTime(150),this.scaleDamper.setDecayTime(150)),this.currentSession=r,this.placementBox=new d(e,this.placeOnWall?"back":"bottom"),this.placementBox&&this.placementBox.setScreenSpaceMode(this.xrMode===I),this.placementComplete=!1,this.xrMode!==I&&(this.menuPanel=new v,e.add(this.menuPanel),this.menuPanel.updatePosition(e.getCamera(),this.placementBox)),this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:y.SESSION_STARTED})}setupXRControllerLine(e){if(!e.userData.line){let t=new r.N1A(w);t.name="line",t.scale.z=5,e.userData.turning=!1,e.userData.line=t,e.add(t)}}setupController(e){this.setupXRControllerLine(e),e.addEventListener("selectstart",this.onControllerSelectStart),e.addEventListener("selectend",this.onControllerSelectEnd)}setupXRControllers(){this.xrController1=this.threeRenderer.xr.getController(0),this.xrController2=this.threeRenderer.xr.getController(1),this.setupController(this.xrController1),this.setupController(this.xrController2),this.scaleLine.name="scale line",this.scaleLine.visible=!1,this.xrController1.add(this.scaleLine);let e=this.presentedScene;e.add(this.xrController1),e.add(this.xrController2)}hover(e){if(this.xrMode===I||this.selectedXRController==e)return!1;let t=this.presentedScene,i=this.placementBox.controllerIntersection(t,e);return e.userData.line.scale.z=null==i?5:i.distance,null!=i}controllerSeparation(){return this.xrController1.position.distanceTo(this.xrController2.position)}async stopPresenting(){if(!this.isPresenting)return;let e=new Promise(e=>{this.resolveCleanup=e});try{await this.currentSession.end(),await e}catch(e){console.warn("Error while trying to end WebXR AR session"),console.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){let e=this.presentedScene;if(null!=e){let t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}cleanupXRController(e){e.userData.turning=!1,e.userData.line.visible=!0,e.removeEventListener("selectstart",this.onControllerSelectStart),e.removeEventListener("selectend",this.onControllerSelectEnd),e.removeFromParent()}postSessionCleanup(){let e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);let t=this.presentedScene;if(this._presentedScene=null,null!=t){let{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),null!=this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),t.add(t.pivot),t.pivot.quaternion.set(0,0,0,1),t.pivot.position.set(0,0,0),t.pivot.scale.set(1,1,1),t.setShadowOffset(0);let i=this.turntableRotation;null!=i&&(t.yaw=i);let r=this.oldShadowIntensity;null!=r&&t.setShadowIntensity(r),t.setEnvironmentAndSkybox(e[s.fr],e[s.kT]);let n=this.oldTarget;t.setTarget(n.x,n.y,n.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0);let{width:a,height:o}=e.getBoundingClientRect();t.setSize(a,o),requestAnimationFrame(()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:p.iC.NONE}}))})}this.renderer.height=0;let i=this.exitWebXRButtonContainer;null!=i&&(i.classList.remove("enabled"),i.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);let r=this.transientHitTestSource;null!=r&&(r.cancel(),this.transientHitTestSource=null);let n=this.initialHitSource;null!=n&&(n.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.xrMode!==I&&(null!=this.xrController1&&(this.cleanupXRController(this.xrController1),this.xrController1=null),null!=this.xrController2&&(this.cleanupXRController(this.xrController2),this.xrController2=null),this.selectedXRController=null,this.scaleLine.visible=!1),this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,this.worldSpaceInitialPlacementDone=!1,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:y.NOT_PRESENTING})}updateView(e){let t=this.presentedScene,i=this.threeRenderer.xr;i.updateCamera(M),t.xrCamera=i.getCamera();let{elements:r}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(r[1],r[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){let t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}let n=i.getBaseLayer();if(null!=n){let t=n instanceof XRWebGLLayer?n.getViewport(e):i.getBinding().getViewSubImage(n,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){let e=this.presentedScene,{pivot:t,element:i}=e,{position:r}=t,n=e.getCamera(),{width:a,height:s}=this.overlay.getBoundingClientRect();e.setSize(a,s),n.projectionMatrixInverse.copy(n.projectionMatrix).invert();let{theta:o}=i.getCameraOrbit(),l=n.getWorldDirection(_);if(e.yaw=Math.atan2(-l.x,-l.z)-o,this.goalYaw=e.yaw,this.xrMode!==T||this.worldSpaceInitialPlacementDone){if(this.xrMode===I){let t=Math.max(1,2*e.boundingSphere.radius);r.copy(n.position).add(l.multiplyScalar(t)),this.updateTarget();let i=e.getTarget();r.add(i).sub(this.oldTarget),this.goalPosition.copy(r)}}else{let{position:i,scale:a}=this.calculateWorldSpaceOptimalPlacement(e,n);this.goalPosition.copy(i),this.goalScale=a,this.initialModelScale=a,r.copy(i),t.scale.set(a,a,a),this.worldSpaceInitialPlacementDone=!0,this.calculateWorldSpaceScaleLimits(e),this.enableWorldSpaceUserInteraction()}if(e.setHotspotsVisibility(!0),this.xrMode===I){let{session:e}=this.frame;e.addEventListener("selectstart",this.onSelectStart),e.addEventListener("selectend",this.onSelectEnd),e.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(e=>{this.transientHitTestSource=e})}}getTouchLocation(){let{axes:e}=this.inputSource.gamepad,t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(_.copy(t).sub(this.presentedScene.getCamera().position),_.length()>10)?null:t}getHitPoint(e){let t=this.threeRenderer.xr.getReferenceSpace(),i=e.getPose(t);if(null==i)return null;let r=S.fromArray(i.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(r.elements[4],r.elements[6])),r.elements[5]>.75!==this.placeOnWall?C.setFromMatrixPosition(r):null}moveToFloor(e){if(this.xrMode===T&&!this.worldSpaceInitialPlacementDone){this.placementBox.show=!1,this.dispatchEvent({type:"status",status:y.OBJECT_PLACED});return}let t=this.initialHitSource;if(null==t)return;let i=e.getHitTestResults(t);if(0==i.length)return;let r=i[0],n=this.getHitPoint(r);null!=n&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(n):this.goalPosition.y=n.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:y.OBJECT_PLACED}))}fingerPolar(e){let t=e[0].inputSource.gamepad.axes,i=e[1].inputSource.gamepad.axes,r=i[0]-t[0],n=i[1]-t[1],a=Math.atan2(n,r),s=this.lastAngle-a;return s>Math.PI?s-=2*Math.PI:s<-Math.PI&&(s+=2*Math.PI),{separation:Math.sqrt(r*r+n*n),deltaYaw:s,angle:a}}setScale(e){let t=e/this.firstRatio;t=.2>Math.abs(t-1)?1:t,this.isWorldSpaceReady()&&(t=Math.max(this.minScale,Math.min(this.maxScale,t))),this.goalScale=t}processInput(e){let t=this.transientHitTestSource;if(null==t)return;let i=e.getHitTestResultsForTransientInput(t),r=this.presentedScene,n=r.pivot.scale.x;if(2===i.length){if(!this.wasTwoFingering){let{separation:e,angle:t}=this.fingerPolar(i);this.firstRatio=e/n,this.lastAngle=t,this.wasTwoFingering=!0,this.isTwoHandInteraction=!0;return}let{separation:e,deltaYaw:t,angle:a}=this.fingerPolar(i);this.goalYaw+=t,this.lastAngle=a,r.canScale&&this.setScale(e),this.isTwoHandInteraction=!0;return}if(this.wasTwoFingering&&(this.wasTwoFingering=!1,this.isTwoHandInteraction=!1,this.firstRatio=0),this.isTranslating||this.isTwoHandInteraction||this.isRotating)if(this.isRotating){let e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&i.forEach(e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),this.isWorldSpaceReady())console.log("[processInput] Setting goalPosition.y to hit.y:",t.y),this.goalPosition.add(t);else if(!1===this.placeOnWall){let e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/n,this.presentedScene.setShadowOffset(e);let i=_.copy(r.getCamera().position),a=-e/(i.y-t.y);i.multiplyScalar(a),t.multiplyScalar(1-a).add(i)}this.goalPosition.add(t)}else this.goalPosition.add(t);this.lastDragPosition.copy(t)}})}applyXRControllerRotation(e,t){if(!e.userData.turning)return;let i=(e.position.x-e.userData.initialX)*.3;this.deltaRotation.setFromAxisAngle(b,i),t.quaternion.multiplyQuaternions(this.deltaRotation,t.quaternion)}handleScalingInXR(e,t){if(this.xrMode===T&&!this.worldSpaceInitialPlacementDone)return;if(this.xrController1&&this.xrController2&&this.isTwoHandInteraction){let e=this.controllerSeparation();this.setScale(e),this.scaleLine.scale.z=-e,this.scaleLine.lookAt(this.xrController2.position)}let i=e.pivot.scale.x;if(this.goalScale!==i){let r=this.scaleDamper.update(i,this.goalScale,t,1);e.pivot.scale.set(r,r,r)}}updatePivotPosition(e,t){let{pivot:i}=e,r=this.placementBox,n=e.boundingSphere.radius,a=this.goalPosition,s=i.position,o=p.iC.NONE;if(!a.equals(s)){o=p.iC.USER_INTERACTION;let{x:i,y:l,z:h}=s;if(i=this.xDamper.update(i,a.x,t,n),l=this.yDamper.update(l,a.y,t,n),h=this.zDamper.update(h,a.z,t,n),s.set(i,l,h),this.xrMode===I&&!this.isTranslating){let t=a.y-l;this.placementComplete&&!1===this.placeOnWall?(r.offsetHeight=t/e.pivot.scale.x,e.setShadowOffset(t)):0===t&&(this.placementComplete=!0,r.show=!1,e.setShadowIntensity(.8))}this.xrMode!==I&&a.equals(s)&&e.setShadowIntensity(.8),this.isWorldSpaceReady()&&e.setShadowIntensity(.8)}if(this.xrMode===T&&!this.worldSpaceInitialPlacementDone&&this.goalScale!==i.scale.x){let e=this.scaleDamper.update(i.scale.x,this.goalScale,t,1);i.scale.set(e,e,e)}return e.updateTarget(t),o}updateYaw(e,t){E.setFromAxisAngle(_.set(0,1,0),this.goalYaw);let i=e.pivot.quaternion.angleTo(E),r=i-this.yawDamper.update(i,0,t,Math.PI);e.pivot.quaternion.rotateTowards(E,r)}updateMenuPanel(e,t,i){this.menuPanel&&(this.menuPanel.updateOpacity(i),this.menuPanel.updatePosition(e.getCamera(),t))}applyXRInputToScene(e){let t=this.presentedScene,i=t.pivot,r=this.placementBox;if(this.updatePlacementBoxOpacity(r,e),this.updateTwoHandInteractionState(),this.applyXRControllerRotations(i),this.handleScalingInXR(t,e),i.parent!==t)return void this.updateMenuPanel(t,r,e);let n=this.updatePivotPosition(t,e);this.updateYaw(t,e),this.dispatchCameraChangeEvent(t,n),this.updateMenuPanel(t,r,e)}updatePlacementBoxOpacity(e,t){let i=this.presentedScene.getCamera();e.update(t,i.position);let r=this.hover(this.xrController1),n=this.hover(this.xrController2),a=(r||n)&&!this.isTwoHandInteraction;e.setInteractionState(this.isTranslating||this.isRotating,a)}updateTwoHandInteractionState(){var e,t;let i=(null==(e=this.xrController1)?void 0:e.userData.isSelected)&&(null==(t=this.xrController2)?void 0:t.userData.isSelected);this.isTwoHandInteraction=!!i}applyXRControllerRotations(e){!this.isTwoHandInteraction&&(this.xrController1&&this.applyXRControllerRotation(this.xrController1,e),this.xrController2&&this.applyXRControllerRotation(this.xrController2,e))}dispatchCameraChangeEvent(e,t){e.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))}updateXRControllerHover(){let e=this.hover(this.xrController1),t=this.hover(this.xrController2),i=(e||t)&&!this.isTwoHandInteraction;this.placementBox&&(this.placementBox.setInteractionState(this.isTranslating||this.isRotating,i),this.placementBox.show=i)}enableWorldSpaceUserInteraction(){this.placementBox&&(this.placementBox.show=!0),this.presentedScene&&this.presentedScene.setShadowIntensity(.8)}handleFirstView(e,t){this.xrMode===T&&this.worldSpaceInitialPlacementDone||this.moveToFloor(e),this.processInput(e);let i=t-this.lastTick;this.applyXRInputToScene(i),this.renderer.preRender(this.presentedScene,t,i),this.lastTick=t,this.presentedScene.renderShadow(this.threeRenderer)}onWebXRFrame(e,t){this.xrMode!==I&&this.updateXRControllerHover(),this.frame=t,++this.frames;let i=this.threeRenderer.xr.getReferenceSpace(),r=t.getViewerPose(i);null==r&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:x.NOT_TRACKING}));let n=this.presentedScene;if(null==r||null==n||!n.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:x.TRACKING}));let a=!0;for(let i of r.views)this.updateView(i),a&&(this.handleFirstView(t,e),a=!1),this.threeRenderer.render(n,n.getCamera())}calculateWorldSpaceOptimalPlacement(e,t){let i=e.boundingBox,n={x:(i.max.x-i.min.x)/2,y:(i.max.y-i.min.y)/2,z:(i.max.z-i.min.z)/2},a=Math.max(1.65,2*Math.max(n.x,n.z)+.15),s=15*Math.PI/180,o=new r.Pq0(0,-a*Math.sin(s),-a*Math.cos(s)),l=t.matrixWorld,h=o.clone().applyMatrix4(l),c=Math.max(n.x,n.z)+.15,u=Math.min(.3*a/Math.max(n.y,.01),.3*a/Math.max(c,.01));return{position:h.clone().sub(new r.Pq0(0,u*n.y,0)),scale:u}}calculateWorldSpaceScaleLimits(e){let t=e.size,i=Math.max(t.x,t.y,t.z),r=Math.max(Math.min(t.x,t.y,t.z),.001),n=.01/Math.max(i,.001),a=70/Math.max(r,.001);this.minScale=Math.min(n,a,this.goalScale),this.maxScale=Math.max(n,a,this.goalScale)}}},4515(e,t,i){"use strict";let r,n,a,s,o,l,h,c;i.d(t,{IZ:()=>eG,UV:()=>ek,q4:()=>eO});var u,d,p,A,f=i(874),g=function(){var e,t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var r=WebAssembly.validate(t)?a("b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q:6dkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq:p9sqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:N8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhlaicefhodnaeTmbadTmbalc;WFbGglcjdalcjd6EhwcbhDinawaeaD9RaDawfae6Egqcsfglc9WGgkci2hxakcethmalcl4cifcd4hPabaDad2fhsakc;ab6hzcbhHincbhOaohAdndninaraA9RaP6meavcj;cbfaOak2fhCaAaPfhocbhidnazmbarao9Rc;Gb6mbcbhlinaCalfhidndndndndnaAalco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklbaoczfhokdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklzaoczfhokdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklaaoczfhokdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaoclfaYpQbfaXc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaocwfaYpQbfaXc:q:yjjbfRbbfhoxekaiaopbbbpkl8Waoczfhokalc;abfhialcjefak0meaihlarao9Rc;Fb0mbkkdnaiak9pmbaici4hlinarao9RcK6miaCaifhXdndndndndnaAaico4fRbbalcoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpkbbxikaXaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaXaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaXaopbbbpkbbaoczfhokalcdfhlaiczfgiak6mbkkaoTmeaohAaOcefgOclSmdxbkkc9:hoxlkdnakTmbavcjdfaHfhiavaHfpbdbhYcbhXinaiavcj;cbfaXfglpblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLalakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEalamfpblbg3cep9Ta3aQp9op9Hp9rg3alaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfhiaXczfgXak6mbkkaHclfgHad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfgDae6mbkkcbc99arao9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk::seHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb"):a("b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q:Odkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq;w8Wqdbk;esezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9Uc;WFbGgocjdaocjd6EhDaicefhocbhqdnindndndnaeaq9nmbaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxalc9WGgmTmecbhPawcjdfhsaohzinaraz9Rax6mvarazaxfgo9RcK6mvczhlcbhHinalgic9WfgOawcj;cbffhldndndndndnazaOco4fRbbaHcoG4ciGPlbedibkal9cb83ibalcwf9cb83ibxikalaoRblaoRbbgOco4gAaAciSgAE86bbawcj;cbfaifglcGfaoclfaAfgARbbaOcl4ciGgCaCciSgCE86bbalcVfaAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc7faAaCfgARbbaOciGgOaOciSgOE86bbalctfaAaOfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkalaoRbwaoRbbgOcl4gAaAcsSgAE86bbawcj;cbfaifglcGfaocwfaAfgARbbaOcsGgOaOcsSgOE86bbalcVfaAaOfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekalao8Pbb83bbalcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaHcdfhHaiczfhlarao9RcL0mekkaiam6mvaoTmvdnakTmbawaPfRbbhHawcj;cbfhlashiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkkascefhsaohzaPcefgPad9hmbxikkcbc99arao9Radcaadca0ESEhoxlkaoaxad2fhCdnakmbadhlinaoTmlarao9Rax6mlaoaxfhoalcufglmbkaChoxekcbhmawcjdfhAinarao9Rax6miawamfRbbhHawcj;cbfhlaAhiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkaAcefhAaoaxfhoamcefgmad9hmbkaChokabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekc9:hokavcj;ebf8Kjjjjbaok;cseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;oiliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabaiavcefciGfcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavciGfgkcd7cetfaD87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavcufciGfcetfaD87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohvxekcjjjj94hvkabakcetfav87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklzNbb"),n=WebAssembly.instantiate(r,{}).then(function(t){(e=t.instance).exports.__wasm_call_ctors()});function a(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;++r){var n=e.charCodeAt(r);t[r]=n>96?n-97:n>64?n-39:n+4}for(var a=0,r=0;r<e.length;++r)t[a++]=t[r]<60?i[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,a)}function s(e,t,i,r,n,a,s){var o=e.exports.sbrk,l=r+3&-4,h=o(l*n),c=o(a.length),u=new Uint8Array(e.exports.memory.buffer);u.set(a,c);var d=t(h,r,n,c,a.length);if(0==d&&s&&s(h,l,n),i.set(u.subarray(h,h+r*n)),o(h-o(0)),0!=d)throw Error("Malformed buffer data: "+d)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},h=[],c=0;function u(e){var t=e.data;if(!t.id)return self.close();self.ready.then(function(e){try{var i=new Uint8Array(t.count*t.size);s(e,e.exports[t.mode],i,t.count,t.size,t.source,e.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:i},[i.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:"reject",value:e})}})}return{ready:n,supported:!0,useWorkers:function(e){for(var t=new Blob(["self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(r)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+u.name+";"+s.toString()+u.toString()],{type:"text/javascript"}),i=URL.createObjectURL(t),n=h.length;n<e;++n)h[n]=function(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var i=e.data;t.pending-=i.count,t.requests[i.id][i.action](i.value),delete t.requests[i.id]},t}(i);for(var n=e;n<h.length;++n)h[n].object.postMessage({});h.length=e,URL.revokeObjectURL(i)},decodeVertexBuffer:function(t,i,r,n,a){s(e,e.exports.meshopt_decodeVertexBuffer,t,i,r,n,e.exports[o[a]])},decodeIndexBuffer:function(t,i,r,n){s(e,e.exports.meshopt_decodeIndexBuffer,t,i,r,n)},decodeIndexSequence:function(t,i,r,n){s(e,e.exports.meshopt_decodeIndexSequence,t,i,r,n)},decodeGltfBuffer:function(t,i,r,n,a,h){s(e,e.exports[l[a]],t,i,r,n,e.exports[o[h]])},decodeGltfBufferAsync:function(t,i,r,a,u){return h.length>0?function(e,t,i,r,n){for(var a=h[0],s=1;s<h.length;++s)h[s].pending<a.pending&&(a=h[s]);return new Promise(function(s,o){var l=new Uint8Array(i),h=++c;a.pending+=e,a.requests[h]={resolve:s,reject:o},a.object.postMessage({id:h,count:e,size:t,source:l,mode:r,filter:n},[l.buffer])})}(t,i,r,l[a],o[u]):n.then(function(){var n=new Uint8Array(t*i);return s(e,e.exports[l[a]],n,t,i,r,e.exports[o[u]]),n})}}}();let m=new WeakMap;class v extends f.aHM{constructor(e){super(e),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:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){let n=new f.Y9S(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,e=>{this.parse(e,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,"srgb",i).catch(i)}decodeDracoFile(e,t,i,r,n=f.Zr2,a=()=>{}){let s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:n};return this.decodeGeometry(e,s).then(t).catch(a)}decodeGeometry(e,t){let i,r=JSON.stringify(t);if(m.has(e)){let t=m.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(n,a).then(r=>(i=r,new Promise((r,a)=>{i._callbacks[n]={resolve:r,reject:a},i.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return s.catch(()=>!0).then(()=>{i&&n&&this._releaseTask(i,n)}),m.set(e,{key:r,promise:s}),s}_createGeometry(e){let t=new f.LoY;e.index&&t.setIndex(new f.THS(e.index.array,1));for(let i=0;i<e.attributes.length;i++){let r,{name:n,array:a,itemSize:s,stride:o,vertexColorSpace:l}=e.attributes[i];if(s===o)r=new f.THS(a,s);else{let e=new f.eB$(a,o);r=new f.eHs(e,s,0)}"color"===n&&(this._assignVertexColorSpace(r,l),r.normalized=a instanceof Float32Array==!1),t.setAttribute(n,r)}return t}_assignVertexColorSpace(e,t){if("srgb"!==t)return;let i=new f.Q1f;for(let t=0,r=e.count;t<r;t++)i.fromBufferAttribute(e,t),f.ppV.colorSpaceToWorking(i,"srgb"),e.setXYZ(t,i.r,i.g,i.b)}_loadLibrary(e,t){let i=new f.Y9S(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((t,r)=>{i.load(e,t,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let i=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let r=b.toString(),n=["/* draco decoder */",i,"\n/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let i=t.data;switch(i.type){case"decode":e._callbacks[i.id].resolve(i);break;case"error":e._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function b(){let e,t;onmessage=function(i){let r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let n=r.buffer,a=r.taskConfig;t.then(e=>{let t=e.draco,i=new t.Decoder;try{let e=function(e,t,i,r){var n,a,s;let o,l,h,c,u,d,p=r.attributeIDs,A=r.attributeTypes,f=t.GetEncodedGeometryType(i);if(f===e.TRIANGULAR_MESH)u=new e.Mesh,d=t.DecodeArrayToMesh(i,i.byteLength,u);else if(f===e.POINT_CLOUD)u=new e.PointCloud,d=t.DecodeArrayToPointCloud(i,i.byteLength,u);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||0===u.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let g={index:null,attributes:[]};for(let i in p){let n,a,s=self[A[i]];if(r.useUniqueIDs)a=p[i],n=t.GetAttributeByUniqueId(u,a);else{if(-1===(a=t.GetAttributeId(u,e[p[i]])))continue;n=t.GetAttribute(u,a)}let o=function(e,t,i,r,n,a){let s,o=i.num_points(),l=a.num_components(),h=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,n),c=l*n.BYTES_PER_ELEMENT,u=4*Math.ceil(c/4),d=u/n.BYTES_PER_ELEMENT,p=o*c,A=e._malloc(p);t.GetAttributeDataArrayForAllPoints(i,a,h,p,A);let f=new n(e.HEAPF32.buffer,A,p/n.BYTES_PER_ELEMENT);if(c===u)s=f.slice();else{s=new n(o*u/n.BYTES_PER_ELEMENT);let e=0;for(let t=0,i=f.length;t<i;t++){for(let i=0;i<l;i++)s[e+i]=f[t*l+i];e+=d}}return e._free(A),{name:r,count:o,itemSize:l,array:s,stride:d}}(e,t,u,i,s,n);"color"===i&&(o.vertexColorSpace=r.vertexColorSpace),g.attributes.push(o)}return f===e.TRIANGULAR_MESH&&(n=e,a=t,s=u,o=3*s.num_faces(),l=4*o,h=n._malloc(l),a.GetTrianglesUInt32Array(s,l,h),c=new Uint32Array(n.HEAPF32.buffer,h,o).slice(),n._free(h),g.index={array:c,itemSize:1}),e.destroy(u),g}(t,i,new Int8Array(n),a),s=e.attributes.map(e=>e.array.buffer);e.index&&s.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},s)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(i)}})}}}function y(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2!==t&&1!==t)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let i=e.getIndex();if(null===i){let t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),i=e.getIndex()}let r=i.count-2,n=[];if(2===t)for(let e=1;e<=r;e++)n.push(i.getX(0)),n.push(i.getX(e)),n.push(i.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(n.push(i.getX(e)),n.push(i.getX(e+1)),n.push(i.getX(e+2))):(n.push(i.getX(e+2)),n.push(i.getX(e+1)),n.push(i.getX(e)));n.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let a=e.clone();return a.setIndex(n),a.clearGroups(),a}}class x extends f.aHM{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new w(e)}),this.register(function(e){return new I(e)}),this.register(function(e){return new N(e)}),this.register(function(e){return new O(e)}),this.register(function(e){return new k(e)}),this.register(function(e){return new B(e)}),this.register(function(e){return new R(e)}),this.register(function(e){return new D(e)}),this.register(function(e){return new L(e)}),this.register(function(e){return new M(e)}),this.register(function(e){return new P(e)}),this.register(function(e){return new T(e)}),this.register(function(e){return new F(e)}),this.register(function(e){return new U(e)}),this.register(function(e){return new S(e)}),this.register(function(e){return new Q(e)}),this.register(function(e){return new G(e)})}load(e,t,i,r){let n,a=this;if(""!==this.resourcePath)n=this.resourcePath;else if(""!==this.path){let t=f.r6x.extractUrlBase(e);n=f.r6x.resolveURL(t,this.path)}else n=f.r6x.extractUrlBase(e);this.manager.itemStart(e);let s=function(t){r?r(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},o=new f.Y9S(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(i){try{a.parse(i,n,function(i){t(i),a.manager.itemEnd(e)},s)}catch(e){s(e)}},i,s)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let n,a={},s={},o=new TextDecoder;if("string"==typeof e)n=JSON.parse(e);else if(e instanceof ArrayBuffer)if(o.decode(new Uint8Array(e,0,4))===H){try{a[E.KHR_BINARY_GLTF]=new z(e)}catch(e){r&&r(e);return}n=JSON.parse(a[E.KHR_BINARY_GLTF].content)}else n=JSON.parse(o.decode(e));else n=e;if(void 0===n.asset||n.asset.version[0]<2){r&&r(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new eh(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[t.name]=t,a[t.name]=!0}if(n.extensionsUsed)for(let e=0;e<n.extensionsUsed.length;++e){let t=n.extensionsUsed[e],i=n.extensionsRequired||[];switch(t){case E.KHR_MATERIALS_UNLIT:a[t]=new C;break;case E.KHR_DRACO_MESH_COMPRESSION:a[t]=new V(n,this.dracoLoader);break;case E.KHR_TEXTURE_TRANSFORM:a[t]=new q;break;case E.KHR_MESH_QUANTIZATION:a[t]=new W;break;default:i.indexOf(t)>=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(i,r)}parseAsync(e,t){let i=this;return new Promise(function(r,n){i.parse(e,t,r,n)})}}function _(){let e={};return{get:function(t){return e[t]},add:function(t,i){e[t]=i},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let E={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class S{constructor(e){this.parser=e,this.name=E.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){let r=t[i];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t,i=this.parser,r="light:"+e,n=i.cache.get(r);if(n)return n;let a=i.json,s=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],o=new f.Q1f(0xffffff);void 0!==s.color&&o.setRGB(s.color[0],s.color[1],s.color[2],f.Zr2);let l=void 0!==s.range?s.range:0;switch(s.type){case"directional":(t=new f.ZyN(o)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new f.HiM(o)).distance=l;break;case"spot":(t=new f.nCl(o)).distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,t.angle=s.spot.outerConeAngle,t.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return t.position.set(0,0,0),ea(t,s),void 0!==s.intensity&&(t.intensity=s.intensity),t.name=i.createUniqueName(s.name||"light_"+e),n=Promise.resolve(t),i.cache.add(r,n),n}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,i=this.parser,r=i.json.nodes[e],n=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return i._getNodeRef(t.cache,n,e)})}}class C{constructor(){this.name=E.KHR_MATERIALS_UNLIT}getMaterialType(){return f.V9B}extendParams(e,t,i){let r=[];e.color=new f.Q1f(1,1,1),e.opacity=1;let n=t.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){let t=n.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],f.Zr2),e.opacity=t[3]}void 0!==n.baseColorTexture&&r.push(i.assignTexture(e,"map",n.baseColorTexture,"srgb"))}return Promise.all(r)}}class M{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=i.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}class w{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&n.push(i.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&n.push(i.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(n.push(i.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){let e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new f.I9Y(e,e)}return Promise.all(n)}}class I{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_DISPERSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=i.extensions[this.name];return t.dispersion=void 0!==r.dispersion?r.dispersion:0,Promise.resolve()}}class T{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&n.push(i.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&n.push(i.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(n)}}class B{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[];t.sheenColor=new f.Q1f(0,0,0),t.sheenRoughness=0,t.sheen=1;let a=r.extensions[this.name];if(void 0!==a.sheenColorFactor){let e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],f.Zr2)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&n.push(i.assignTexture(t,"sheenColorMap",a.sheenColorTexture,"srgb")),void 0!==a.sheenRoughnessTexture&&n.push(i.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(n)}}class R{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(i.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)}}class D{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&n.push(i.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;let s=a.attenuationColor||[1,1,1];return t.attenuationColor=new f.Q1f().setRGB(s[0],s[1],s[2],f.Zr2),Promise.all(n)}}class L{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=i.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class P{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&n.push(i.assignTexture(t,"specularIntensityMap",a.specularTexture));let s=a.specularColorFactor||[1,1,1];return t.specularColor=new f.Q1f().setRGB(s[0],s[1],s[2],f.Zr2),void 0!==a.specularColorTexture&&n.push(i.assignTexture(t,"specularColorMap",a.specularColorTexture,"srgb")),Promise.all(n)}}class U{constructor(e){this.parser=e,this.name=E.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&n.push(i.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(n)}}class F{constructor(e){this.parser=e,this.name=E.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?f.uSd:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&n.push(i.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(n)}}class N{constructor(e){this.parser=e,this.name=E.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let n=r.extensions[this.name],a=t.options.ktx2Loader;if(!a)if(!(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,n.source,a)}}class O{constructor(e){this.parser=e,this.name=E.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,i=this.parser,r=i.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;let a=n.extensions[t],s=r.images[a.source],o=i.textureLoader;if(s.uri){let e=i.options.manager.getHandler(s.uri);null!==e&&(o=e)}return i.loadTextureImage(e,a.source,o)}}class k{constructor(e){this.parser=e,this.name=E.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,i=this.parser,r=i.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;let a=n.extensions[t],s=r.images[a.source],o=i.textureLoader;if(s.uri){let e=i.options.manager.getHandler(s.uri);null!==e&&(o=e)}return i.loadTextureImage(e,a.source,o)}}class Q{constructor(e){this.name=E.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,i=t.bufferViews[e];if(!i.extensions||!i.extensions[this.name])return null;{let e=i.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return r.then(function(t){let i=e.byteOffset||0,r=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,i,r);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):n.ready.then(function(){let t=new ArrayBuffer(a*s);return n.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}}}class G{constructor(e){this.name=E.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;for(let e of t.meshes[i.mesh].primitives)if(e.mode!==J.TRIANGLES&&e.mode!==J.TRIANGLE_STRIP&&e.mode!==J.TRIANGLE_FAN&&void 0!==e.mode)return null;let r=i.extensions[this.name].attributes,n=[],a={};for(let e in r)n.push(this.parser.getDependency("accessor",r[e]).then(t=>(a[e]=t,a[e])));return n.length<1?null:(n.push(this.parser.createNodeMesh(e)),Promise.all(n).then(e=>{let t=e.pop(),i=t.isGroup?t.children:[t],r=e[0].count,n=[];for(let e of i){let t=new f.kn4,i=new f.Pq0,s=new f.PTz,o=new f.Pq0(1,1,1),l=new f.ZLX(e.geometry,e.material,r);for(let e=0;e<r;e++)a.TRANSLATION&&i.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,e),a.SCALE&&o.fromBufferAttribute(a.SCALE,e),l.setMatrixAt(e,t.compose(i,s,o));for(let t in a)if("_COLOR_0"===t){let e=a[t];l.instanceColor=new f.uWO(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,a[t]);f.B69.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),n.push(l)}return t.isGroup?(t.clear(),t.add(...n),t):n[0]}))}}let H="glTF";class z{constructor(e){this.name=E.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==H)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,n=new DataView(e,12);let a=0;for(;a<r;){const t=n.getUint32(a,!0);a+=4;const r=n.getUint32(a,!0);if(a+=4,0x4e4f534a===r){const r=new Uint8Array(e,12+a,t);this.content=i.decode(r)}else if(5130562===r){const i=12+a;this.body=e.slice(i,i+t)}a+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class V{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=E.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let i=this.json,r=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(let e in a)s[et[e]||e.toLowerCase()]=a[e];for(let t in e.attributes){let r=et[t]||t.toLowerCase();if(void 0!==a[t]){let n=i.accessors[e.attributes[t]],a=K[n.componentType];l[r]=a.name,o[r]=!0===n.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t,i){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let i=e.attributes[t],r=o[t];void 0!==r&&(i.normalized=r)}t(e)},s,l,f.Zr2,i)})})}}class q{constructor(){this.name=E.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class W{constructor(){this.name=E.KHR_MESH_QUANTIZATION}}class j extends f.lGw{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r*3+r;for(let e=0;e!==r;e++)t[e]=i[n+e];return t}interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,h=r-t,c=(i-t)/h,u=c*c,d=u*c,p=e*l,A=p-l,f=-2*d+3*u,g=d-u,m=1-f,v=g-u+c;for(let e=0;e!==s;e++){let t=a[A+e+s],i=a[A+e+o]*h,r=a[p+e+s],l=a[p+e]*h;n[e]=m*t+v*i+f*r+g*l}return n}}let X=new f.PTz;class Y extends j{interpolate_(e,t,i,r){let n=super.interpolate_(e,t,i,r);return X.fromArray(n).normalize().toArray(n),n}}let J={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},K={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},Z={33071:1001,33648:1002,10497:1e3},ee={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},et={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},ei={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},er={CUBICSPLINE:void 0,LINEAR:2301,STEP:2300};function en(e,t,i){for(let r in i.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=i.extensions[r])}function ea(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function es(e){let t="",i=Object.keys(e).sort();for(let r=0,n=i.length;r<n;r++)t+=i[r]+":"+e[i[r]]+";";return t}function eo(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let el=new f.kn4;class eh{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new _,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 i=!1,r=-1,n=!1,a=-1;if("u">typeof navigator){const e=navigator.userAgent;i=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);r=i&&t?parseInt(t[1],10):-1,a=(n=e.indexOf("Firefox")>-1)?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"u"<typeof createImageBitmap||i&&r<17||n&&a<98?this.textureLoader=new f.Tap(this.options.manager):this.textureLoader=new f.Kzg(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new f.Y9S(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let i=this,r=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:i,userData:{}};return en(n,a,r),ea(a,r),Promise.all(i._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){let r=t[i].joints;for(let t=0,i=r.length;t<i;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(i[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;let r=i.clone(),n=(e,t)=>{let i=this.associations.get(e);for(let[r,a]of(null!=i&&this.associations.set(t,i),e.children.entries()))n(a,t.children[r])};return n(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){let r=e(t[i]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let i=[];for(let r=0;r<t.length;r++){let n=e(t[r]);n&&i.push(n)}return i}getDependency(e,t){let i=e+":"+t,r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(!(r=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let i=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,r){return i.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],i=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[E.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,n){i.load(f.r6x.resolveURL(t.uri,r.path),e,void 0,function(){n(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let i=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+i)})}loadAccessor(e){let t=this,i=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){let e=ee[r.type],t=K[r.componentType],i=!0===r.normalized,n=new t(r.count*e);return Promise.resolve(new f.THS(n,e,i))}let n=[];return void 0!==r.bufferView?n.push(this.getDependency("bufferView",r.bufferView)):n.push(null),void 0!==r.sparse&&(n.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(n).then(function(e){let n,a,s=e[0],o=ee[r.type],l=K[r.componentType],h=l.BYTES_PER_ELEMENT,c=h*o,u=r.byteOffset||0,d=void 0!==r.bufferView?i.bufferViews[r.bufferView].byteStride:void 0,p=!0===r.normalized;if(d&&d!==c){let e=Math.floor(u/d),i="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+e+":"+r.count,c=t.cache.get(i);c||(n=new l(s,e*d,r.count*d/h),c=new f.eB$(n,d/h),t.cache.add(i,c)),a=new f.eHs(c,o,u%d/h,p)}else n=null===s?new l(r.count*o):new l(s,u,r.count*o),a=new f.THS(n,o,p);if(void 0!==r.sparse){let t=ee.SCALAR,i=K[r.sparse.indices.componentType],n=r.sparse.indices.byteOffset||0,h=r.sparse.values.byteOffset||0,c=new i(e[1],n,r.sparse.count*t),u=new l(e[2],h,r.sparse.count*o);null!==s&&(a=new f.THS(a.array.slice(),a.itemSize,a.normalized)),a.normalized=!1;for(let e=0,t=c.length;e<t;e++){let t=c[e];if(a.setX(t,u[e*o]),o>=2&&a.setY(t,u[e*o+1]),o>=3&&a.setZ(t,u[e*o+2]),o>=4&&a.setW(t,u[e*o+3]),o>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}a.normalized=p}return a})}loadTexture(e){let t=this.json,i=this.options,r=t.textures[e].source,n=t.images[r],a=this.textureLoader;if(n.uri){let e=i.manager.getHandler(n.uri);null!==e&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,i){let r=this,n=this.json,a=n.textures[e],s=n.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,i).then(function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);let i=(n.samplers||{})[a.sampler]||{};return t.magFilter=$[i.magFilter]||1006,t.minFilter=$[i.minFilter]||1008,t.wrapS=Z[i.wrapS]||1e3,t.wrapT=Z[i.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&1003!==t.minFilter&&1006!==t.minFilter,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let i=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let n=i.images[e],a=self.URL||self.webkitURL,s=n.uri||"",o=!1;if(void 0!==n.bufferView)s=this.getDependency("bufferView",n.bufferView).then(function(e){o=!0;let t=new Blob([e],{type:n.mimeType});return s=a.createObjectURL(t)});else if(void 0===n.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(s).then(function(e){return new Promise(function(i,n){let a=i;!0===t.isImageBitmapLoader&&(a=function(e){let t=new f.gPd(e);t.needsUpdate=!0,i(t)}),t.load(f.r6x.resolveURL(e,r.path),a,void 0,n)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),ea(e,n),e.userData.mimeType=n.mimeType||((t=n.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,i,r){let n=this;return this.getDependency("texture",i.index).then(function(a){if(!a)return null;if(void 0!==i.texCoord&&i.texCoord>0&&((a=a.clone()).channel=i.texCoord),n.extensions[E.KHR_TEXTURE_TRANSFORM]){let e=void 0!==i.extensions?i.extensions[E.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=n.associations.get(a);a=n.extensions[E.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),n.associations.set(a,t)}}return void 0!==r&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,i=e.material,r=void 0===t.attributes.tangent,n=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+i.uuid,t=this.cache.get(e);t||(t=new f.BH$,f.imn.prototype.copy.call(t,i),t.color.copy(i.color),t.map=i.map,t.sizeAttenuation=!1,this.cache.add(e,t)),i=t}else if(e.isLine){let e="LineBasicMaterial:"+i.uuid,t=this.cache.get(e);t||(t=new f.mrM,f.imn.prototype.copy.call(t,i),t.color.copy(i.color),t.map=i.map,this.cache.add(e,t)),i=t}if(r||n||a){let e="ClonedMaterial:"+i.uuid+":";r&&(e+="derivative-tangents:"),n&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=i.clone(),n&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(i))),i=t}e.material=i}getMaterialType(){return f._4j}loadMaterial(e){let t,i=this,r=this.json,n=this.extensions,a=r.materials[e],s={},o=a.extensions||{},l=[];if(o[E.KHR_MATERIALS_UNLIT]){let e=n[E.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(s,a,i))}else{let r=a.pbrMetallicRoughness||{};if(s.color=new f.Q1f(1,1,1),s.opacity=1,Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],f.Zr2),s.opacity=e[3]}void 0!==r.baseColorTexture&&l.push(i.assignTexture(s,"map",r.baseColorTexture,"srgb")),s.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,s.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(l.push(i.assignTexture(s,"metalnessMap",r.metallicRoughnessTexture)),l.push(i.assignTexture(s,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===a.doubleSided&&(s.side=2);let h=a.alphaMode||"OPAQUE";if("BLEND"===h?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===h&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==f.V9B&&(l.push(i.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new f.I9Y(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==f.V9B&&(l.push(i.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==f.V9B){let e=a.emissiveFactor;s.emissive=new f.Q1f().setRGB(e[0],e[1],e[2],f.Zr2)}return void 0!==a.emissiveTexture&&t!==f.V9B&&l.push(i.assignTexture(s,"emissiveMap",a.emissiveTexture,"srgb")),Promise.all(l).then(function(){let r=new t(s);return a.name&&(r.name=a.name),ea(r,a),i.associations.set(r,{materials:e}),a.extensions&&en(n,r,a),r})}createUniqueName(e){let t=f.Nwf.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,i=this.extensions,r=this.primitiveCache,n=[];for(let a=0,s=e.length;a<s;a++){let s=e[a],o=function(e){let t,i=e.extensions&&e.extensions[E.KHR_DRACO_MESH_COMPRESSION];if(t=i?"draco:"+i.bufferView+":"+i.indices+":"+es(i.attributes):e.indices+":"+es(e.attributes)+":"+e.mode,void 0!==e.targets)for(let i=0,r=e.targets.length;i<r;i++)t+=":"+es(e.targets[i]);return t}(s),l=r[o];if(l)n.push(l.promise);else{let e;e=s.extensions&&s.extensions[E.KHR_DRACO_MESH_COMPRESSION]?function(e){return i[E.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(i){return ec(i,e,t)})}(s):ec(new f.LoY,s,t),r[o]={primitive:s,promise:e},n.push(e)}}return Promise.all(n)}loadMesh(e){let t=this,i=this.json,r=this.extensions,n=i.meshes[e],a=n.primitives,s=[];for(let e=0,t=a.length;e<t;e++){var o;let t=void 0===a[e].material?(void 0===(o=this.cache).DefaultMaterial&&(o.DefaultMaterial=new f._4j({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),o.DefaultMaterial):this.getDependency("material",a[e].material);s.push(t)}return s.push(t.loadGeometries(a)),Promise.all(s).then(function(i){let s=i.slice(0,i.length-1),o=i[i.length-1],l=[];for(let i=0,h=o.length;i<h;i++){let h,c=o[i],u=a[i],d=s[i];if(u.mode===J.TRIANGLES||u.mode===J.TRIANGLE_STRIP||u.mode===J.TRIANGLE_FAN||void 0===u.mode)!0===(h=!0===n.isSkinnedMesh?new f.I46(c,d):new f.eaF(c,d)).isSkinnedMesh&&h.normalizeSkinWeights(),u.mode===J.TRIANGLE_STRIP?h.geometry=y(h.geometry,1):u.mode===J.TRIANGLE_FAN&&(h.geometry=y(h.geometry,2));else if(u.mode===J.LINES)h=new f.DXC(c,d);else if(u.mode===J.LINE_STRIP)h=new f.N1A(c,d);else if(u.mode===J.LINE_LOOP)h=new f.FCc(c,d);else if(u.mode===J.POINTS)h=new f.ONl(c,d);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+u.mode);Object.keys(h.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let i=0,r=t.weights.length;i<r;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){let i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(let t=0,r=i.length;t<r;t++)e.morphTargetDictionary[i[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(h,n),h.name=t.createUniqueName(n.name||"mesh_"+e),ea(h,n),u.extensions&&en(r,h,u),t.assignFinalMaterial(h),l.push(h)}for(let i=0,r=l.length;i<r;i++)t.associations.set(l[i],{meshes:e,primitives:i});if(1===l.length)return n.extensions&&en(r,l[0],n),l[0];let h=new f.YJl;n.extensions&&en(r,h,n),t.associations.set(h,{meshes:e});for(let e=0,t=l.length;e<t;e++)h.add(l[e]);return h})}loadCamera(e){let t,i=this.json.cameras[e],r=i[i.type];return r?("perspective"===i.type?t=new f.ubm(f.cj9.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===i.type&&(t=new f.qUd(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),ea(t,i),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){let t=this.json.skins[e],i=[];for(let e=0,r=t.joints.length;e<r;e++)i.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(e){let i=e.pop(),r=[],n=[];for(let a=0,s=e.length;a<s;a++){let s=e[a];if(s){r.push(s);let e=new f.kn4;null!==i&&e.fromArray(i.array,16*a),n.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new f.EAD(r,n)})}loadAnimation(e){let t=this.json,i=this,r=t.animations[e],n=r.name?r.name:"animation_"+e,a=[],s=[],o=[],l=[],h=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],i=r.samplers[t.sampler],n=t.target,c=n.node,u=void 0!==r.parameters?r.parameters[i.input]:i.input,d=void 0!==r.parameters?r.parameters[i.output]:i.output;void 0!==n.node&&(a.push(this.getDependency("node",c)),s.push(this.getDependency("accessor",u)),o.push(this.getDependency("accessor",d)),l.push(i),h.push(n))}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(o),Promise.all(l),Promise.all(h)]).then(function(e){let t=e[0],a=e[1],s=e[2],o=e[3],l=e[4],h=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],n=a[e],c=s[e],u=o[e],d=l[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();let p=i._createAnimationTracks(r,n,c,u,d);if(p)for(let e=0;e<p.length;e++)h.push(p[e])}let c=new f.tz3(n,void 0,h);return ea(c,r),c})}createNodeMesh(e){let t=this.json,i=this,r=t.nodes[e];return void 0===r.mesh?null:i.getDependency("mesh",r.mesh).then(function(e){let t=i._getNodeRef(i.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,i=r.weights.length;t<i;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],i=this._loadNodeShallow(e),r=[],n=t.children||[];for(let e=0,t=n.length;e<t;e++)r.push(this.getDependency("node",n[e]));let a=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),a]).then(function(e){let t=e[0],i=e[1],r=e[2];null!==r&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,el)});for(let e=0,r=i.length;e<r;e++)t.add(i[e]);return t})}_loadNodeShallow(e){let t=this.json,i=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let n=t.nodes[e],a=n.name?r.createUniqueName(n.name):"",s=[],o=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return o&&s.push(o),void 0!==n.camera&&s.push(r.getDependency("camera",n.camera).then(function(e){return r._getNodeRef(r.cameraCache,n.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){s.push(e)}),this.nodeCache[e]=Promise.all(s).then(function(t){let s;if((s=!0===n.isBone?new f.$Kf:t.length>1?new f.YJl:1===t.length?t[0]:new f.B69)!==t[0])for(let e=0,i=t.length;e<i;e++)s.add(t[e]);if(n.name&&(s.userData.name=n.name,s.name=a),ea(s,n),n.extensions&&en(i,s,n),void 0!==n.matrix){let e=new f.kn4;e.fromArray(n.matrix),s.applyMatrix4(e)}else void 0!==n.translation&&s.position.fromArray(n.translation),void 0!==n.rotation&&s.quaternion.fromArray(n.rotation),void 0!==n.scale&&s.scale.fromArray(n.scale);if(r.associations.has(s)){if(void 0!==n.mesh&&r.meshCache.refs[n.mesh]>1){let e=r.associations.get(s);r.associations.set(s,{...e})}}else r.associations.set(s,{});return r.associations.get(s).nodes=e,s}),this.nodeCache[e]}loadScene(e){let t=this.extensions,i=this.json.scenes[e],r=this,n=new f.YJl;i.name&&(n.name=r.createUniqueName(i.name)),ea(n,i),i.extensions&&en(t,n,i);let a=i.nodes||[],s=[];for(let e=0,t=a.length;e<t;e++)s.push(r.getDependency("node",a[e]));return Promise.all(s).then(function(e){for(let t=0,i=e.length;t<i;t++)n.add(e[t]);return r.associations=(e=>{let t=new Map;for(let[e,i]of r.associations)(e instanceof f.imn||e instanceof f.gPd)&&t.set(e,i);return e.traverse(e=>{let i=r.associations.get(e);null!=i&&t.set(e,i)}),t})(n),n})}_createAnimationTracks(e,t,i,r,n){let a,s=[],o=e.name?e.name:e.uuid,l=[];switch(ei[n.path]===ei.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(o),ei[n.path]){case ei.weights:a=f.Hit;break;case ei.rotation:a=f.MBL;break;case ei.translation:case ei.scale:a=f.RiT;break;default:a=1===i.itemSize?f.Hit:f.RiT}let h=void 0!==r.interpolation?er[r.interpolation]:2301,c=this._getArrayFromAccessor(i);for(let e=0,i=l.length;e<i;e++){let i=new a(l[e]+"."+ei[n.path],t.array,c,h);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(i),s.push(i)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=eo(t.constructor),i=new Float32Array(t.length);for(let r=0,n=t.length;r<n;r++)i[r]=t[r]*e;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof f.MBL?Y:j)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function ec(e,t,i){let r=t.attributes,n=[];for(let t in r){let a=et[t]||t.toLowerCase();a in e.attributes||n.push(function(t,r){return i.getDependency("accessor",t).then(function(t){e.setAttribute(r,t)})}(r[t],a))}if(void 0!==t.indices&&!e.index){let r=i.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});n.push(r)}return f.ppV.workingColorSpace!==f.Zr2&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${f.ppV.workingColorSpace}" not supported.`),ea(e,t),!function(e,t,i){let r=t.attributes,n=new f.NRn;if(void 0===r.POSITION)return;{let e=i.json.accessors[r.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(n.set(new f.Pq0(t[0],t[1],t[2]),new f.Pq0(a[0],a[1],a[2])),e.normalized){let t=eo(K[e.componentType]);n.min.multiplyScalar(t),n.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new f.Pq0,t=new f.Pq0;for(let r=0,n=a.length;r<n;r++){let n=a[r];if(void 0!==n.POSITION){let r=i.json.accessors[n.POSITION],a=r.min,s=r.max;if(void 0!==a&&void 0!==s){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(s[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(s[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(s[2]))),r.normalized){let e=eo(K[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(e)}e.boundingBox=n;let s=new f.iyt;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,e.boundingSphere=s}(e,t,i),Promise.all(n).then(function(){return void 0!==t.targets?function(e,t,i){let r=!1,n=!1,a=!1;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(void 0!==i.POSITION&&(r=!0),void 0!==i.NORMAL&&(n=!0),void 0!==i.COLOR_0&&(a=!0),r&&n&&a)break}if(!r&&!n&&!a)return Promise.resolve(e);let s=[],o=[],l=[];for(let h=0,c=t.length;h<c;h++){let c=t[h];if(r){let t=void 0!==c.POSITION?i.getDependency("accessor",c.POSITION):e.attributes.position;s.push(t)}if(n){let t=void 0!==c.NORMAL?i.getDependency("accessor",c.NORMAL):e.attributes.normal;o.push(t)}if(a){let t=void 0!==c.COLOR_0?i.getDependency("accessor",c.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(l)]).then(function(t){let i=t[0],s=t[1],o=t[2];return r&&(e.morphAttributes.position=i),n&&(e.morphAttributes.normal=s),a&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,t.targets,i):e})}class eu{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){let t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return -1}_onMessage(e,t){let i=this.workersResolve[e];if(i&&i(t),this.queue.length){let{resolve:t,msg:i,transfer:r}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(i,r)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{let r=this._getIdleWorker();-1!==r?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=i,this.workers[r].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}class ed{constructor(e,t,i,r){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,i),this._littleEndian=r,this._offset=0}_nextUint8(){let e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){let e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){let e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){let e=this._dataView.getUint32(this._offset,this._littleEndian)+0x100000000*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){let e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){let t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){let i=this._offset,r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,r)}}new Uint8Array([0]);let ep=[171,75,84,88,32,50,48,187,13,10,26,10];function eA(e){return(new TextDecoder).decode(e)}let ef={env:{emscripten_notify_memory_growth:function(e){a=new Uint8Array(n.exports.memory.buffer)}}};class eg{init(){return r||(r="u">typeof fetch?fetch("data:application/wasm;base64,"+em).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,ef)).then(this._init):WebAssembly.instantiate(Buffer.from(em,"base64"),ef).then(this._init))}_init(e){n=e.instance,ef.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!n)throw Error("ZSTDDecoder: Await .init() before decoding.");let i=e.byteLength,r=n.exports.malloc(i);a.set(e,r),t=t||Number(n.exports.ZSTD_findDecompressedSize(r,i));let s=n.exports.malloc(t),o=n.exports.ZSTD_decompress(s,t,r,i),l=a.slice(s,s+o);return n.exports.free(r),n.exports.free(s),l}}let em="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";({...f.ppV.spaces.srgb,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb",toneMappingMode:"extended"}});let ev=new WeakMap,eb=0;class ey extends f.aHM{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new eu,this.workerSourceURL="",this.workerConfig=null,"u">typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await e.init(),this.detectSupport(e)}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-s3tc"),bptcSupported:e.hasFeature("texture-compression-bc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},"u">typeof navigator&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Firefox")>=0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){let e=new f.Y9S(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);let t=e.loadAsync("basis_transcoder.js"),i=new f.Y9S(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);let r=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,r]).then(([e,t])=>{let i=ey.BasisWorker.toString(),r=["/* constants */","let _EngineFormat = "+JSON.stringify(ey.EngineFormat),"let _EngineType = "+JSON.stringify(ey.EngineType),"let _TranscoderFormat = "+JSON.stringify(ey.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(ey.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{let e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),eb>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),eb++}return this.transcoderPending}load(e,t,i,r){if(null===this.workerConfig)throw Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");let n=new f.Y9S(this.manager);n.setPath(this.path),n.setCrossOrigin(this.crossOrigin),n.setWithCredentials(this.withCredentials),n.setRequestHeader(this.requestHeader),n.setResponseType("arraybuffer"),n.load(e,e=>{this.parse(e,t,r)},i,r)}parse(e,t,i){if(null===this.workerConfig)throw Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(ev.has(e))return ev.get(e).promise.then(t).catch(i);this._createTexture(e).then(e=>t?t(e):null).catch(i)}_createTextureFrom(e,t){let i,{type:r,error:n,data:{faces:a,width:s,height:o,format:l,type:h,dfdFlags:c}}=e;if("error"===r)return Promise.reject(n);if(6===t.faceCount)i=new f.c5h(a,l,h);else{let e=a[0].mipmaps;i=t.layerCount>1?new f.iOZ(e,s,o,t.layerCount,l,h):new f.FvD(e,s,o,l,h)}return i.minFilter=1===a[0].mipmaps.length?1006:1008,i.magFilter=1006,i.generateMipmaps=!1,i.needsUpdate=!0,i.colorSpace=eC(t),i.premultiplyAlpha=!!(1&c),i}async _createTexture(e,t={}){let i=function(e){let t=new Uint8Array(e.buffer,e.byteOffset,ep.length);if(t[0]!==ep[0]||t[1]!==ep[1]||t[2]!==ep[2]||t[3]!==ep[3]||t[4]!==ep[4]||t[5]!==ep[5]||t[6]!==ep[6]||t[7]!==ep[7]||t[8]!==ep[8]||t[9]!==ep[9]||t[10]!==ep[10]||t[11]!==ep[11])throw Error("Missing KTX 2.0 identifier.");let i={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},r=17*Uint32Array.BYTES_PER_ELEMENT,n=new ed(e,ep.length,r,!0);i.vkFormat=n._nextUint32(),i.typeSize=n._nextUint32(),i.pixelWidth=n._nextUint32(),i.pixelHeight=n._nextUint32(),i.pixelDepth=n._nextUint32(),i.layerCount=n._nextUint32(),i.faceCount=n._nextUint32(),i.levelCount=n._nextUint32(),i.supercompressionScheme=n._nextUint32();let a=n._nextUint32(),s=n._nextUint32(),o=n._nextUint32(),l=n._nextUint32(),h=n._nextUint64(),c=n._nextUint64(),u=3*Math.max(i.levelCount,1)*8,d=new ed(e,ep.length+r,u,!0);for(let t=0,r=Math.max(i.levelCount,1);t<r;t++)i.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});let p=new ed(e,a,s,!0);p._skip(4);let A=p._nextUint16(),f=p._nextUint16(),g=p._nextUint16(),m=p._nextUint16(),v={vendorId:A,descriptorType:f,versionNumber:g,colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},b=(m/4-6)/4;for(let e=0;e<b;e++){let t={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=p._nextInt32(),t.sampleUpper=p._nextInt32()):(t.sampleLower=p._nextUint32(),t.sampleUpper=p._nextUint32()),v.samples[e]=t}i.dataFormatDescriptor.length=0,i.dataFormatDescriptor.push(v);let y=new ed(e,o,l,!0);for(;y._offset<l;){let e=y._nextUint32(),t=y._scan(e),r=eA(t);if(i.keyValue[r]=y._nextUint8Array(e-t.byteLength-1),r.match(/^ktx/i)){let e=eA(i.keyValue[r]);i.keyValue[r]=e.substring(0,e.lastIndexOf("\0"))}y._skip(e%4?4-e%4:0)}if(c<=0)return i;let x=new ed(e,h,c,!0),_=x._nextUint16(),E=x._nextUint16(),S=x._nextUint32(),C=x._nextUint32(),M=x._nextUint32(),w=x._nextUint32(),I=[];for(let e=0,t=Math.max(i.levelCount,1);e<t;e++)I.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});let T=h+x._offset,B=T+S,R=B+C,D=R+M;return i.globalData={endpointCount:_,selectorCount:E,imageDescs:I,endpointsData:new Uint8Array(e.buffer,e.byteOffset+T,S),selectorsData:new Uint8Array(e.buffer,e.byteOffset+B,C),tablesData:new Uint8Array(e.buffer,e.byteOffset+R,M),extendedData:new Uint8Array(e.buffer,e.byteOffset+D,w)},i}(new Uint8Array(e)),r=1000066e3===i.vkFormat&&167===i.dataFormatDescriptor[0].colorModel;if(!(0===i.vkFormat||r&&!this.workerConfig.astcHDRSupported))return eS(i);let n=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:t},[e])).then(e=>this._createTextureFrom(e.data,i));return ev.set(e,{promise:n}),n}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),eb--}}ey.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},ey.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},ey.EngineFormat={RGBAFormat:1023,RGBA_ASTC_4x4_Format:37808,RGB_BPTC_UNSIGNED_Format:36495,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT5_Format:33779,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_4BPPV1_Format:35840,RGBA_S3TC_DXT1_Format:33777},ey.EngineType={UnsignedByteType:1009,HalfFloatType:1016,FloatType:1015},ey.BasisWorker=function(){let e,t,i,r=_EngineFormat,n=_EngineType,a=_TranscoderFormat,s=_BasisFormat;self.addEventListener("message",function(r){let a=r.data;switch(a.type){case"init":var o;e=a.config,o=a.transcoderBinary,t=new Promise(e=>{BASIS(i={wasmBinary:o,onRuntimeInitialized:e})}).then(()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{let{faces:t,buffers:r,width:o,height:c,hasAlpha:u,format:d,type:p,dfdFlags:A}=function(t){let r,a=new i.KTX2File(new Uint8Array(t));function o(){a.close(),a.delete()}if(!a.isValid())throw o(),Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");if(a.isUASTC())r=s.UASTC;else if(a.isETC1S())r=s.ETC1S;else if(a.isHDR())r=s.UASTC_HDR;else throw Error("THREE.KTX2Loader: Unknown Basis encoding");let c=a.getWidth(),u=a.getHeight(),d=a.getLayers()||1,p=a.getLevels(),A=a.getFaces(),f=a.getHasAlpha(),g=a.getDFDFlags(),{transcoderFormat:m,engineFormat:v,engineType:b}=function(t,i,r,n){let a=l[t];for(let s=0;s<a.length;s++){let o=a[s];if(o.if&&!e[o.if]||!o.basisFormat.includes(t)||n&&o.transcoderFormat.length<2||o.needsPowerOfTwo&&!(h(i)&&h(r)))continue;let l=o.transcoderFormat[+!!n],c=o.engineFormat[+!!n];return{transcoderFormat:l,engineFormat:c,engineType:o.engineType[0]}}throw Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(r,c,u,f);if(!c||!u||!p)throw o(),Error("THREE.KTX2Loader: Invalid texture");if(!a.startTranscoding())throw o(),Error("THREE.KTX2Loader: .startTranscoding failed");let y=[],x=[];for(let e=0;e<A;e++){let t=[];for(let i=0;i<p;i++){let r,s,l=[];for(let t=0;t<d;t++){let h=a.getImageLevelInfo(i,t,e);0===e&&0===i&&0===t&&(h.origWidth%4!=0||h.origHeight%4!=0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),p>1?(r=h.origWidth,s=h.origHeight):(r=h.width,s=h.height);let c=new Uint8Array(a.getImageTranscodedSizeInBytes(i,t,0,m)),u=a.transcodeImage(c,i,t,e,m,0,-1,-1);if(b===n.HalfFloatType&&(c=new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!u)throw o(),Error("THREE.KTX2Loader: .transcodeImage failed.");l.push(c)}let h=function(e){if(1===e.length)return e[0];let t=0;for(let i=0;i<e.length;i++)t+=e[i].byteLength;let i=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,r),r+=n.byteLength}return i}(l);t.push({data:h,width:r,height:s}),x.push(h.buffer)}y.push({mipmaps:t,width:c,height:u,format:v,type:b})}return o(),{faces:y,buffers:x,width:c,height:u,hasAlpha:f,dfdFlags:g,format:v,type:b}}(a.buffer);self.postMessage({type:"transcode",id:a.id,data:{faces:t,width:o,height:c,hasAlpha:u,format:d,type:p,dfdFlags:A}},r)}catch(e){console.error(e),self.postMessage({type:"error",id:a.id,error:e.message})}})}});let o=[{if:"astcSupported",basisFormat:[s.UASTC],transcoderFormat:[a.ASTC_4x4,a.ASTC_4x4],engineFormat:[r.RGBA_ASTC_4x4_Format,r.RGBA_ASTC_4x4_Format],engineType:[n.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.BC7_M5,a.BC7_M5],engineFormat:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],engineType:[n.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.BC1,a.BC3],engineFormat:[r.RGBA_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],engineType:[n.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.ETC1,a.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],engineType:[n.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.ETC1],engineFormat:[r.RGB_ETC1_Format],engineType:[n.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.PVRTC1_4_RGB,a.PVRTC1_4_RGBA],engineFormat:[r.RGB_PVRTC_4BPPV1_Format,r.RGBA_PVRTC_4BPPV1_Format],engineType:[n.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[s.UASTC_HDR],transcoderFormat:[a.BC6H],engineFormat:[r.RGB_BPTC_UNSIGNED_Format],engineType:[n.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.RGBA32,a.RGBA32],engineFormat:[r.RGBAFormat,r.RGBAFormat],engineType:[n.UnsignedByteType,n.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[s.UASTC_HDR],transcoderFormat:[a.RGBA_HALF],engineFormat:[r.RGBAFormat],engineType:[n.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[s.ETC1S]:o.filter(e=>e.basisFormat.includes(s.ETC1S)).sort((e,t)=>e.priorityETC1S-t.priorityETC1S),[s.UASTC]:o.filter(e=>e.basisFormat.includes(s.UASTC)).sort((e,t)=>e.priorityUASTC-t.priorityUASTC),[s.UASTC_HDR]:o.filter(e=>e.basisFormat.includes(s.UASTC_HDR)).sort((e,t)=>e.priorityHDR-t.priorityHDR)};function h(e){return e<=2||(e&e-1)==0&&0!==e}};let ex=new Set([1023,1022,1030,1028]),e_={109:1023,103:1030,100:1028,97:1023,83:1030,76:1028,43:1023,37:1023,22:1030,16:1030,15:1028,9:1028,123:1022,122:1022,152:37496,148:37492,153:37488,154:37489,155:37490,156:37491,1000066e3:37808,158:37808,157:37808,0x3b9bcbd4:37812,166:37812,165:37812,134:33777,133:33777,132:33776,131:33776,138:33778,137:33778,140:36284,139:36283,142:36286,141:36285,146:36492,145:36492,0x3b9b9cf5:35842,0x3b9b9cf1:35842,0x3b9b9cf4:35843,1000054e3:35843},eE={109:1015,103:1015,100:1015,97:1016,83:1016,76:1016,43:1009,37:1009,22:1009,16:1009,15:1009,9:1009,123:35902,122:35899,152:1009,148:1009,153:1009,153:1009,155:1009,155:1009,1000066e3:1016,158:1009,157:1009,0x3b9bcbd4:1016,166:1009,165:1009,134:1009,133:1009,132:1009,131:1009,138:1009,137:1009,140:1009,139:1009,142:1009,141:1009,146:1009,145:1009,0x3b9b9cf5:1009,0x3b9b9cf1:1009,0x3b9b9cf4:1009,1000054e3:1009};async function eS(e){let t,i,{vkFormat:r}=e;if(void 0===e_[r])throw Error("THREE.KTX2Loader: Unsupported vkFormat: "+r);void 0===eE[r]&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+r),2===e.supercompressionScheme&&(s||(s=new Promise(async e=>{let t=new eg;await t.init(),e(t)})),t=await s);let n=[];for(let i=0;i<e.levels.length;i++){let a,s,o=Math.max(1,e.pixelWidth>>i),l=Math.max(1,e.pixelHeight>>i),h=e.pixelDepth?Math.max(1,e.pixelDepth>>i):0,c=e.levels[i];if(0===e.supercompressionScheme)a=c.levelData;else if(2===e.supercompressionScheme)a=t.decode(c.levelData,c.uncompressedByteLength);else throw Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");s=1015===eE[r]?new Float32Array(a.buffer,a.byteOffset,a.byteLength/Float32Array.BYTES_PER_ELEMENT):1016===eE[r]?new Uint16Array(a.buffer,a.byteOffset,a.byteLength/Uint16Array.BYTES_PER_ELEMENT):35902===eE[r]||35899===eE[r]?new Uint32Array(a.buffer,a.byteOffset,a.byteLength/Uint32Array.BYTES_PER_ELEMENT):a,n.push({data:s,width:o,height:l,depth:h})}let a=0===e.levelCount||n.length>1;if(ex.has(e_[r]))(i=0===e.pixelDepth?new f.GYF(n[0].data,e.pixelWidth,e.pixelHeight):new f.dYF(n[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth)).minFilter=a?1004:1003,i.magFilter=1003,i.generateMipmaps=0===e.levelCount;else{if(e.pixelDepth>0)throw Error("THREE.KTX2Loader: Unsupported pixelDepth.");(i=new f.FvD(n,e.pixelWidth,e.pixelHeight)).minFilter=a?1008:1006,i.magFilter=1006}return i.mipmaps=n,i.type=eE[r],i.format=e_[r],i.colorSpace=eC(e),i.needsUpdate=!0,Promise.resolve(i)}function eC(e){let t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?"srgb":f.Zr2:10===t.colorPrimaries?2===t.transferFunction?"display-p3":"display-p3-linear":(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),"")}let eM=Symbol("retainerCount"),ew=Symbol("recentlyUsed"),eI=Symbol("evict"),eT=Symbol("evictionThreshold"),eB=Symbol("cache");class eR{constructor(e,t=5){this[u]=new Map,this[d]=[],this[eB]=e,this[eT]=t}set evictionThreshold(e){this[eT]=e,this[eI]()}get evictionThreshold(){return this[eT]}get cache(){return this[eB]}retainerCount(e){return this[eM].get(e)||0}reset(){this[eM].clear(),this[ew]=[]}retain(e){this[eM].has(e)||this[eM].set(e,0),this[eM].set(e,this[eM].get(e)+1);let t=this[ew].indexOf(e);-1!==t&&this[ew].splice(t,1),this[ew].unshift(e),this[eI]()}release(e){this[eM].has(e)&&this[eM].set(e,Math.max(this[eM].get(e)-1,0)),this[eI]()}[(u=eM,d=ew,eI)](){if(!(this[ew].length<this[eT]))for(let e=this[ew].length-1;e>=this[eT];--e){let t=this[ew][e];0===this[eM].get(t)&&(this[eB].delete(t),this[ew].splice(e,1))}}}let eD=e=>{let t=new Map;for(let i of e.mappings)for(let e of i.variants)t.set(e,{material:null,gltfMaterialIndex:i.material});return t};class eL{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){let t=this.parser,i=t.json;if(void 0===i.extensions||void 0===i.extensions[this.name])return null;let r=(e=>{let t=[],i=new Set;for(let r of e){let e=r,n=0;for(;i.has(e);)e=r+"."+ ++n;i.add(e),t.push(e)}return t})((i.extensions[this.name].variants||[]).map(e=>e.name));for(let r of e.scenes)r.traverse(e=>{if(!e.material)return;let r=t.associations.get(e);if(null==r||null==r.meshes||null==r.primitives)return;let n=i.meshes[r.meshes].primitives[r.primitives].extensions;n&&n[this.name]&&(e.userData.variantMaterials=eD(n[this.name]))});return e.userData.variants=r,Promise.resolve()}}f.gPd.DEFAULT_ANISOTROPY=4;let eP=new Map,eU=new Map,eF=new v,eN=new ey,eO=Symbol("loader"),ek=Symbol("evictionPolicy"),eQ=Symbol("GLTFInstance");class eG extends f.Qev{static setDRACODecoderLocation(e){o=e,eF.setDecoderPath(e)}static getDRACODecoderLocation(){return o}static setKTX2TranscoderLocation(e){l=e,eN.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return l}static setMeshoptDecoderLocation(e){h!==e&&(h=e,c=new Promise((t,i)=>{let r=document.createElement("script");document.body.appendChild(r),r.onload=t,r.onerror=i,r.async=!0,r.src=e}).then(()=>g.ready).then(()=>g))}static getMeshoptDecoderLocation(){return h}static initializeKTX2Loader(e){eN.detectSupport(e)}static get cache(){return eP}static clearCache(){eP.forEach((e,t)=>{this.delete(t)}),this[ek].reset()}static has(e){return eP.has(e)}static async delete(e){if(!this.has(e))return;let t=eP.get(e);eU.delete(e),eP.delete(e),(await t).dispose()}static hasFinishedLoading(e){return!!eU.get(e)}constructor(e){super(),this[A]=new x().register(e=>new eL(e)),this[eQ]=e,this[eO].setDRACOLoader(eF),this[eO].setKTX2Loader(eN)}get[(p=ek,A=eO,ek)](){return this.constructor[ek]}async preload(e,t,i=()=>{}){if(this[eO].setWithCredentials(t.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!eP.has(e)){null!=c&&this[eO].setMeshoptDecoder(await c);let t=((e,t,i=()=>{})=>{let r=e=>{let t=e.loaded/e.total;i(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise((i,n)=>{t.load(e,i,r,n)})})(e,this[eO],e=>{i(.8*e)}),r=this[eQ],n=t.then(e=>r.prepare(e)).then(e=>(i(.9),new r(e))).catch(e=>(console.error(e),new r));eP.set(e,n)}await eP.get(e),eU.set(e,!0),i&&i(1)}async load(e,t,i=()=>{}){await this.preload(e,t,i);let r=await eP.get(e),n=await r.clone();return this[ek].retain(e),n.dispose=()=>{this[ek].release(e)},n}}eG[p]=new eR(eG)},8150(e,t,i){"use strict";i.d(t,{A:()=>r});class r{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,i,r){let n=2e-4*this.naturalFrequency;if(null==e||0===r||e===t&&0===this.velocity)return t;if(i<0)return e;let a=e-t,s=this.velocity+this.naturalFrequency*a,o=a+i*s,l=Math.exp(-this.naturalFrequency*i),h=(s-this.naturalFrequency*o)*l,c=-this.naturalFrequency*(h+s*l);return Math.abs(h)<n*Math.abs(r)&&c*a>=0?(this.velocity=0,t):(this.velocity=h,t+o*l)}}},5112(e,t,i){"use strict";i.d(t,{Y:()=>p});var r=i(874),n=i(3770),a=i(3935),s=i(1718);let o=new r.Pq0,l=new r.Pq0,h=new r.Pq0,c=new r.dwI,u=new r.lMl,d=new r.PTz;class p extends n.v{constructor(e){super(document.createElement("div")),this.normal=new r.Pq0(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){(this.facingCamera||!this.initialized)&&this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;let t=(0,s.$y)(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,(0,a.cg)(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;let t=(0,s.$y)(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(){let{mesh:e,tri:t,bary:i}=this;if(null==e||null==t||null==i)return;e.getVertexPosition(t.x,o),e.getVertexPosition(t.y,l),e.getVertexPosition(t.z,h),o.toArray(c.elements,0),l.toArray(c.elements,3),h.toArray(c.elements,6),this.position.copy(i).applyMatrix3(c);let r=this.parent;r.worldToLocal(e.localToWorld(this.position)),u.set(o,l,h),u.getNormal(this.normal).transformDirection(e.matrixWorld);let n=r.parent;d.setFromAxisAngle(o.set(0,1,0),-n.rotation.y),this.normal.applyQuaternion(d)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach(t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;let i=t.dataset.visibilityAttribute;if(null!=i){let r=`data-${i}`;t.toggleAttribute(r,e)}t.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}),this.initialized=!0}}},5827(e,t,i){"use strict";let r;i.d(t,{A:()=>iE});var n=i(874);function a(){let e=null,t=!1,i=null,r=null;function n(t,a){i(t,a),r=e.requestAnimationFrame(n)}return{start:function(){!0===t||null!==i&&(r=e.requestAnimationFrame(n),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function s(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);let r=t.get(i);r&&(e.deleteBuffer(r.buffer),t.delete(i))},update:function(i,r){if(i.isInterleavedBufferAttribute&&(i=i.data),i.isGLBufferAttribute){let e=t.get(i);(!e||e.version<i.version)&&t.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version});return}let n=t.get(i);if(void 0===n)t.set(i,function(t,i){let r,n=t.array,a=t.usage,s=n.byteLength,o=e.createBuffer();if(e.bindBuffer(i,o),e.bufferData(i,n,a),t.onUploadCallback(),n instanceof Float32Array)r=e.FLOAT;else if("u">typeof Float16Array&&n instanceof Float16Array)r=e.HALF_FLOAT;else if(n instanceof Uint16Array)r=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(n instanceof Int16Array)r=e.SHORT;else if(n instanceof Uint32Array)r=e.UNSIGNED_INT;else if(n instanceof Int32Array)r=e.INT;else if(n instanceof Int8Array)r=e.BYTE;else if(n instanceof Uint8Array)r=e.UNSIGNED_BYTE;else if(n instanceof Uint8ClampedArray)r=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+n);return{buffer:o,type:r,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version,size:s}}(i,r));else if(n.version<i.version){if(n.size!==i.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,i,r){let n=i.array,a=i.updateRanges;if(e.bindBuffer(r,t),0===a.length)e.bufferSubData(r,0,n);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let i=a[t],r=a[e];r.start<=i.start+i.count+1?i.count=Math.max(i.count,r.start+r.count-i.start):a[++t]=r}a.length=t+1;for(let t=0,i=a.length;t<i;t++){let i=a[t];e.bufferSubData(r,i.start*n.BYTES_PER_ELEMENT,n,i.start,i.count)}i.clearUpdateRanges()}i.onUploadCallback()}(n.buffer,i,r),n.version=i.version}}}}let o={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return 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 vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.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 xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",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 const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float 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 float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 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 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float 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 float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #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 float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n 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 ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return 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 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return 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 vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return 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 float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void 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 vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\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 float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",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 geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",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 );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return 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 return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, dp );\n #else\n shadow = step( dp, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",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 return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n 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 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},l={common:{diffuse:{value:new n.Q1f(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new n.dwI},alphaMap:{value:null},alphaMapTransform:{value:new n.dwI},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new n.dwI}},envmap:{envMap:{value:null},envMapRotation:{value:new n.dwI},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new n.dwI}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new n.dwI}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new n.dwI},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new n.dwI},normalScale:{value:new n.I9Y(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new n.dwI},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new n.dwI}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new n.dwI}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new n.dwI}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new n.Q1f(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new n.Q1f(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new n.dwI},alphaTest:{value:0},uvTransform:{value:new n.dwI}},sprite:{diffuse:{value:new n.Q1f(0xffffff)},opacity:{value:1},center:{value:new n.I9Y(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new n.dwI},alphaMap:{value:null},alphaMapTransform:{value:new n.dwI},alphaTest:{value:0}}},h={basic:{uniforms:(0,n.Iit)([l.common,l.specularmap,l.envmap,l.aomap,l.lightmap,l.fog]),vertexShader:o.meshbasic_vert,fragmentShader:o.meshbasic_frag},lambert:{uniforms:(0,n.Iit)([l.common,l.specularmap,l.envmap,l.aomap,l.lightmap,l.emissivemap,l.bumpmap,l.normalmap,l.displacementmap,l.fog,l.lights,{emissive:{value:new n.Q1f(0)}}]),vertexShader:o.meshlambert_vert,fragmentShader:o.meshlambert_frag},phong:{uniforms:(0,n.Iit)([l.common,l.specularmap,l.envmap,l.aomap,l.lightmap,l.emissivemap,l.bumpmap,l.normalmap,l.displacementmap,l.fog,l.lights,{emissive:{value:new n.Q1f(0)},specular:{value:new n.Q1f(1118481)},shininess:{value:30}}]),vertexShader:o.meshphong_vert,fragmentShader:o.meshphong_frag},standard:{uniforms:(0,n.Iit)([l.common,l.envmap,l.aomap,l.lightmap,l.emissivemap,l.bumpmap,l.normalmap,l.displacementmap,l.roughnessmap,l.metalnessmap,l.fog,l.lights,{emissive:{value:new n.Q1f(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:o.meshphysical_vert,fragmentShader:o.meshphysical_frag},toon:{uniforms:(0,n.Iit)([l.common,l.aomap,l.lightmap,l.emissivemap,l.bumpmap,l.normalmap,l.displacementmap,l.gradientmap,l.fog,l.lights,{emissive:{value:new n.Q1f(0)}}]),vertexShader:o.meshtoon_vert,fragmentShader:o.meshtoon_frag},matcap:{uniforms:(0,n.Iit)([l.common,l.bumpmap,l.normalmap,l.displacementmap,l.fog,{matcap:{value:null}}]),vertexShader:o.meshmatcap_vert,fragmentShader:o.meshmatcap_frag},points:{uniforms:(0,n.Iit)([l.points,l.fog]),vertexShader:o.points_vert,fragmentShader:o.points_frag},dashed:{uniforms:(0,n.Iit)([l.common,l.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:o.linedashed_vert,fragmentShader:o.linedashed_frag},depth:{uniforms:(0,n.Iit)([l.common,l.displacementmap]),vertexShader:o.depth_vert,fragmentShader:o.depth_frag},normal:{uniforms:(0,n.Iit)([l.common,l.bumpmap,l.normalmap,l.displacementmap,{opacity:{value:1}}]),vertexShader:o.meshnormal_vert,fragmentShader:o.meshnormal_frag},sprite:{uniforms:(0,n.Iit)([l.sprite,l.fog]),vertexShader:o.sprite_vert,fragmentShader:o.sprite_frag},background:{uniforms:{uvTransform:{value:new n.dwI},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:o.background_vert,fragmentShader:o.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new n.dwI}},vertexShader:o.backgroundCube_vert,fragmentShader:o.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:o.cube_vert,fragmentShader:o.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:o.equirect_vert,fragmentShader:o.equirect_frag},distance:{uniforms:(0,n.Iit)([l.common,l.displacementmap,{referencePosition:{value:new n.Pq0},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:o.distance_vert,fragmentShader:o.distance_frag},shadow:{uniforms:(0,n.Iit)([l.lights,l.fog,{color:{value:new n.Q1f(0)},opacity:{value:1}}]),vertexShader:o.shadow_vert,fragmentShader:o.shadow_frag}};h.physical={uniforms:(0,n.Iit)([h.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new n.dwI},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new n.dwI},clearcoatNormalScale:{value:new n.I9Y(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new n.dwI},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new n.dwI},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new n.dwI},sheen:{value:0},sheenColor:{value:new n.Q1f(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new n.dwI},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new n.dwI},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new n.dwI},transmissionSamplerSize:{value:new n.I9Y},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new n.dwI},attenuationDistance:{value:0},attenuationColor:{value:new n.Q1f(0)},specularColor:{value:new n.Q1f(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new n.dwI},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new n.dwI},anisotropyVector:{value:new n.I9Y},anisotropyMap:{value:null},anisotropyMapTransform:{value:new n.dwI}}]),vertexShader:o.meshphysical_vert,fragmentShader:o.meshphysical_frag};let c={r:0,b:0,g:0},u=new n.O9p,d=new n.kn4;function p(e,t,i,r,a,s,o){let l,p,A=new n.Q1f(0),f=+(!0!==s),g=null,m=0,v=null;function b(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?i:t).get(r)),r}function y(t,i){t.getRGB(c,(0,n._Ut)(e)),r.buffers.color.setClear(c.r,c.g,c.b,i,o)}return{getClearColor:function(){return A},setClearColor:function(e,t=1){A.set(e),y(A,f=t)},getClearAlpha:function(){return f},setClearAlpha:function(e){y(A,f=e)},render:function(t){let i=!1,n=b(t);null===n?y(A,f):n&&n.isColor&&(y(n,1),i=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?r.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===a&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||i)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,i){let r=b(i);r&&(r.isCubeTexture||306===r.mapping)?(void 0===p&&((p=new n.eaF(new n.iNn(1,1,1),new n.BKk({name:"BackgroundCubeMaterial",uniforms:(0,n.lxW)(h.backgroundCube.uniforms),vertexShader:h.backgroundCube.vertexShader,fragmentShader:h.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(p)),u.copy(i.backgroundRotation),u.x*=-1,u.y*=-1,u.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(u.y*=-1,u.z*=-1),p.material.uniforms.envMap.value=r,p.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,p.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(d.makeRotationFromEuler(u)),p.material.toneMapped="srgb"!==n.ppV.getTransfer(r.colorSpace),(g!==r||m!==r.version||v!==e.toneMapping)&&(p.material.needsUpdate=!0,g=r,m=r.version,v=e.toneMapping),p.layers.enableAll(),t.unshift(p,p.geometry,p.material,0,0,null)):r&&r.isTexture&&(void 0===l&&((l=new n.eaF(new n.bdM(2,2),new n.BKk({name:"BackgroundMaterial",uniforms:(0,n.lxW)(h.background.uniforms),vertexShader:h.background.vertexShader,fragmentShader:h.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,l.material.toneMapped="srgb"!==n.ppV.getTransfer(r.colorSpace),!0===r.matrixAutoUpdate&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(g!==r||m!==r.version||v!==e.toneMapping)&&(l.material.needsUpdate=!0,g=r,m=r.version,v=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==p&&(p.geometry.dispose(),p.material.dispose(),p=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function A(e,t){let i=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},n=h(null),a=n,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function h(e){let t=[],r=[],n=[];for(let e=0;e<i;e++)t[e]=0,r[e]=0,n[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:n,object:e,attributes:{},index:null}}function c(){let e=a.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function u(e){d(e,0)}function d(t,i){let r=a.newAttributes,n=a.enabledAttributes,s=a.attributeDivisors;r[t]=1,0===n[t]&&(e.enableVertexAttribArray(t),n[t]=1),s[t]!==i&&(e.vertexAttribDivisor(t,i),s[t]=i)}function p(){let t=a.newAttributes,i=a.enabledAttributes;for(let r=0,n=i.length;r<n;r++)i[r]!==t[r]&&(e.disableVertexAttribArray(r),i[r]=0)}function A(t,i,r,n,a,s,o){!0===o?e.vertexAttribIPointer(t,i,r,a,s):e.vertexAttribPointer(t,i,r,n,a,s)}function f(){g(),s=!0,a!==n&&o((a=n).object)}function g(){n.geometry=null,n.program=null,n.wireframe=!1}return{setup:function(i,n,l,f,g){var m,v;let b,y,x,_,E=!1,S=(m=f,v=l,b=!0===n.wireframe,void 0===(y=r[m.id])&&(y={},r[m.id]=y),void 0===(x=y[v.id])&&(x={},y[v.id]=x),void 0===(_=x[b])&&(_=h(e.createVertexArray()),x[b]=_),_);a!==S&&o((a=S).object),(E=function(e,t,i,r){let n=a.attributes,s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=n[t],r=s[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===i||i.attribute!==r||r&&i.data!==r.data)return!0;o++}return a.attributesNum!==o||a.index!==r}(i,f,l,g))&&function(e,t,i,r){let n={},s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=s[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let r={};r.attribute=i,i&&i.data&&(r.data=i.data),n[t]=r,o++}a.attributes=n,a.attributesNum=o,a.index=r}(i,f,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(E||s)&&(s=!1,function(i,r,n,a){c();let s=a.attributes,o=n.getAttributes(),l=r.defaultAttributeValues;for(let r in o){let n=o[r];if(n.location>=0){let o=s[r];if(void 0===o&&("instanceMatrix"===r&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===r&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){let r=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let h=l.buffer,c=l.type,p=l.bytesPerElement,f=c===e.INT||c===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<n.locationSize;e++)d(n.location+e,t.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<n.locationSize;e++)u(n.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<n.locationSize;e++)A(n.location+e,s/n.locationSize,c,r,l*p,(g+s/n.locationSize*e)*p,f)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<n.locationSize;e++)d(n.location+e,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<n.locationSize;e++)u(n.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<n.locationSize;e++)A(n.location+e,s/n.locationSize,c,r,s*p,s/n.locationSize*e*p,f)}}else if(void 0!==l){let t=l[r];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(n.location,t);break;case 3:e.vertexAttrib3fv(n.location,t);break;case 4:e.vertexAttrib4fv(n.location,t);break;default:e.vertexAttrib1fv(n.location,t)}}}}p()}(i,n,l,f),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){for(let e in f(),r){let t=r[e];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete r[e]}},releaseStatesOfGeometry:function(e){if(void 0===r[e.id])return;let t=r[e.id];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete r[e.id]},releaseStatesOfProgram:function(e){for(let t in r){let i=r[t];if(void 0===i[e.id])continue;let n=i[e.id];for(let e in n)l(n[e].object),delete n[e];delete i[e.id]}},initAttributes:c,enableAttribute:u,disableUnusedAttributes:p}}function f(e,t,i){let r;function n(t,n,a){0!==a&&(e.drawArraysInstanced(r,t,n,a),i.update(n,r,a))}this.setMode=function(e){r=e},this.render=function(t,n){e.drawArrays(r,t,n),i.update(n,r,1)},this.renderInstances=n,this.renderMultiDraw=function(e,n,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,e,0,n,0,a);let s=0;for(let e=0;e<a;e++)s+=n[e];i.update(s,r,1)},this.renderMultiDrawInstances=function(e,a,s,o){if(0===s)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)n(e[t],a[t],o[t]);else{l.multiDrawArraysInstancedWEBGL(r,e,0,a,0,o,0,s);let t=0;for(let e=0;e<s;e++)t+=a[e]*o[e];i.update(t,r,1)}}}function g(e,t,i,r){let a;function s(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==i.precision?i.precision:"highp",l=s(o);return l!==o&&((0,n.R8M)("WebGLRenderer:",o,"not supported, using",l,"instead."),o=l),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==a)return a;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");a=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a},getMaxPrecision:s,textureFormatReadable:function(t){return 1023===t||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){let n=1016===i&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return 1009===i||r.convert(i)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||1015===i||!!n},precision:o,logarithmicDepthBuffer:!0===i.logarithmicDepthBuffer,reversedDepthBuffer:!0===i.reversedDepthBuffer&&t.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function m(e){let t=this,i=null,r=0,a=!1,s=!1,o=new n.Zcv,l=new n.dwI,h={value:null,needsUpdate:!1};function c(e,i,r,n){let a=null!==e?e.length:0,s=null;if(0!==a){if(s=h.value,!0!==n||null===s){let t=r+4*a,n=i.matrixWorldInverse;l.getNormalMatrix(n),(null===s||s.length<t)&&(s=new Float32Array(t));for(let t=0,i=r;t!==a;++t,i+=4)o.copy(e[t]).applyMatrix4(n,l),o.normal.toArray(s,i),s[i+3]=o.constant}h.value=s,h.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,s}this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let i=0!==e.length||t||0!==r||a;return a=t,r=e.length,i},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(e,t){i=c(e,t,0)},this.setState=function(n,o,l){let u=n.clippingPlanes,d=n.clipIntersection,p=n.clipShadows,A=e.get(n);if(a&&null!==u&&0!==u.length&&(!s||p)){let e=s?0:r,t=4*e,n=A.clippingState||null;h.value=n,n=c(u,o,t,l);for(let e=0;e!==t;++e)n[e]=i[e];A.clippingState=n,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}else s?c(null):(h.value!==i&&(h.value=i,h.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0)}}function v(e){let t=new WeakMap;function i(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function r(e){let i=e.target;i.removeEventListener("dispose",r);let n=t.get(i);void 0!==n&&(t.delete(i),n.dispose())}return{get:function(a){if(a&&a.isTexture){let s=a.mapping;if(303===s||304===s)if(t.has(a))return i(t.get(a).texture,a.mapping);else{let s=a.image;if(!s||!(s.height>0))return null;{let o=new n.o6l(s.height);return o.fromEquirectangularTexture(e,a),t.set(a,o),a.addEventListener("dispose",r),i(o.texture,a.mapping)}}}return a},dispose:function(){t=new WeakMap}}}let b=[.125,.215,.35,.446,.526,.582],y=new n.qUd,x=new n.Q1f,_=null,E=0,S=0,C=!1,M=new n.Pq0;class w{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,r=100,n={}){let{size:a=256,position:s=M}=n;_=this._renderer.getRenderTarget(),E=this._renderer.getActiveCubeFace(),S=this._renderer.getActiveMipmapLevel(),C=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,i,r,o,s),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=R(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=B(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(_,E,S),this._renderer.xr.enabled=C,e.scissorTest=!1,T(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),_=this._renderer.getRenderTarget(),E=this._renderer.getActiveCubeFace(),S=this._renderer.getActiveMipmapLevel(),C=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:n.Zr2,depthBuffer:!1},r=I(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){var a,s,o,l,h,c;let r,u;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=I(e,t,i);let{_lodMax:d}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=function(e){let t=[],i=[],r=[],a=e,s=e-4+1+b.length;for(let o=0;o<s;o++){let s=Math.pow(2,a);t.push(s);let l=1/s;o>e-4?l=b[o-e+4-1]:0===o&&(l=0),i.push(l);let h=1/(s-2),c=-h,u=1+h,d=[c,c,u,c,u,u,c,c,u,u,c,u],p=new Float32Array(108),A=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,r=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];p.set(r,18*e),A.set(d,12*e);let n=[e,e,e,e,e,e];f.set(n,6*e)}let g=new n.LoY;g.setAttribute("position",new n.THS(p,3)),g.setAttribute("uv",new n.THS(A,2)),g.setAttribute("faceIndex",new n.THS(f,1)),r.push(new n.eaF(g,null)),a>4&&a--}return{lodMeshes:r,sizeLods:t,sigmas:i}}(d)),this._blurMaterial=(a=d,s=e,o=t,r=new Float32Array(20),u=new n.Pq0(0,1,0),new n.BKk({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/s,CUBEUV_TEXEL_HEIGHT:1/o,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:u}},vertexShader:D(),fragmentShader:`
|
|
505
|
+
|
|
506
|
+
precision mediump float;
|
|
507
|
+
precision mediump int;
|
|
508
|
+
|
|
509
|
+
varying vec3 vOutputDirection;
|
|
510
|
+
|
|
511
|
+
uniform sampler2D envMap;
|
|
512
|
+
uniform int samples;
|
|
513
|
+
uniform float weights[ n ];
|
|
514
|
+
uniform bool latitudinal;
|
|
515
|
+
uniform float dTheta;
|
|
516
|
+
uniform float mipInt;
|
|
517
|
+
uniform vec3 poleAxis;
|
|
518
|
+
|
|
519
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
520
|
+
#include <cube_uv_reflection_fragment>
|
|
521
|
+
|
|
522
|
+
vec3 getSample( float theta, vec3 axis ) {
|
|
523
|
+
|
|
524
|
+
float cosTheta = cos( theta );
|
|
525
|
+
// Rodrigues' axis-angle rotation
|
|
526
|
+
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
527
|
+
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
528
|
+
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
529
|
+
|
|
530
|
+
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
531
|
+
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
void main() {
|
|
535
|
+
|
|
536
|
+
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
537
|
+
|
|
538
|
+
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
539
|
+
|
|
540
|
+
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
541
|
+
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
axis = normalize( axis );
|
|
545
|
+
|
|
546
|
+
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
547
|
+
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
548
|
+
|
|
549
|
+
for ( int i = 1; i < n; i++ ) {
|
|
550
|
+
|
|
551
|
+
if ( i >= samples ) {
|
|
552
|
+
|
|
553
|
+
break;
|
|
554
|
+
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
float theta = dTheta * float( i );
|
|
558
|
+
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
559
|
+
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
560
|
+
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
}
|
|
564
|
+
`,blending:0,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(l=d,h=e,c=t,new n.BKk({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/h,CUBEUV_TEXEL_HEIGHT:1/c,CUBEUV_MAX_MIP:`${l}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:D(),fragmentShader:`
|
|
565
|
+
|
|
566
|
+
precision highp float;
|
|
567
|
+
precision highp int;
|
|
568
|
+
|
|
569
|
+
varying vec3 vOutputDirection;
|
|
570
|
+
|
|
571
|
+
uniform sampler2D envMap;
|
|
572
|
+
uniform float roughness;
|
|
573
|
+
uniform float mipInt;
|
|
574
|
+
|
|
575
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
576
|
+
#include <cube_uv_reflection_fragment>
|
|
577
|
+
|
|
578
|
+
#define PI 3.14159265359
|
|
579
|
+
|
|
580
|
+
// Van der Corput radical inverse
|
|
581
|
+
float radicalInverse_VdC(uint bits) {
|
|
582
|
+
bits = (bits << 16u) | (bits >> 16u);
|
|
583
|
+
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
584
|
+
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
585
|
+
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
586
|
+
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
587
|
+
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// Hammersley sequence
|
|
591
|
+
vec2 hammersley(uint i, uint N) {
|
|
592
|
+
return vec2(float(i) / float(N), radicalInverse_VdC(i));
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// GGX VNDF importance sampling (Eric Heitz 2018)
|
|
596
|
+
// "Sampling the GGX Distribution of Visible Normals"
|
|
597
|
+
// https://jcgt.org/published/0007/04/01/
|
|
598
|
+
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
|
599
|
+
float alpha = roughness * roughness;
|
|
600
|
+
|
|
601
|
+
// Section 3.2: Transform view direction to hemisphere configuration
|
|
602
|
+
vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
|
|
603
|
+
|
|
604
|
+
// Section 4.1: Orthonormal basis
|
|
605
|
+
float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
|
|
606
|
+
vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
|
|
607
|
+
vec3 T2 = cross(Vh, T1);
|
|
608
|
+
|
|
609
|
+
// Section 4.2: Parameterization of projected area
|
|
610
|
+
float r = sqrt(Xi.x);
|
|
611
|
+
float phi = 2.0 * PI * Xi.y;
|
|
612
|
+
float t1 = r * cos(phi);
|
|
613
|
+
float t2 = r * sin(phi);
|
|
614
|
+
float s = 0.5 * (1.0 + Vh.z);
|
|
615
|
+
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
|
616
|
+
|
|
617
|
+
// Section 4.3: Reprojection onto hemisphere
|
|
618
|
+
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
|
|
619
|
+
|
|
620
|
+
// Section 3.4: Transform back to ellipsoid configuration
|
|
621
|
+
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
void main() {
|
|
625
|
+
vec3 N = normalize(vOutputDirection);
|
|
626
|
+
vec3 V = N; // Assume view direction equals normal for pre-filtering
|
|
627
|
+
|
|
628
|
+
vec3 prefilteredColor = vec3(0.0);
|
|
629
|
+
float totalWeight = 0.0;
|
|
630
|
+
|
|
631
|
+
// For very low roughness, just sample the environment directly
|
|
632
|
+
if (roughness < 0.001) {
|
|
633
|
+
gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// Tangent space basis for VNDF sampling
|
|
638
|
+
vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
639
|
+
vec3 tangent = normalize(cross(up, N));
|
|
640
|
+
vec3 bitangent = cross(N, tangent);
|
|
641
|
+
|
|
642
|
+
for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
|
|
643
|
+
vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
|
|
644
|
+
|
|
645
|
+
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
|
|
646
|
+
vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
|
|
647
|
+
|
|
648
|
+
// Transform H back to world space
|
|
649
|
+
vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
|
|
650
|
+
vec3 L = normalize(2.0 * dot(V, H) * H - V);
|
|
651
|
+
|
|
652
|
+
float NdotL = max(dot(N, L), 0.0);
|
|
653
|
+
|
|
654
|
+
if(NdotL > 0.0) {
|
|
655
|
+
// Sample environment at fixed mip level
|
|
656
|
+
// VNDF importance sampling handles the distribution filtering
|
|
657
|
+
vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
|
|
658
|
+
|
|
659
|
+
// Weight by NdotL for the split-sum approximation
|
|
660
|
+
// VNDF PDF naturally accounts for the visible microfacet distribution
|
|
661
|
+
prefilteredColor += sampleColor * NdotL;
|
|
662
|
+
totalWeight += NdotL;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
if (totalWeight > 0.0) {
|
|
667
|
+
prefilteredColor = prefilteredColor / totalWeight;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
671
|
+
}
|
|
672
|
+
`,blending:0,depthTest:!1,depthWrite:!1}))}return r}_compileMaterial(e){let t=new n.eaF(new n.LoY,e);this._renderer.compile(t,y)}_sceneToCubeUV(e,t,i,r,a){let s=new n.ubm(90,1,t,i),o=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],h=this._renderer,c=h.autoClear,u=h.toneMapping;h.getClearColor(x),h.toneMapping=0,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(r),h.clearDepth(),h.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new n.eaF(new n.iNn,new n.V9B({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));let d=this._backgroundBox,p=d.material,A=!1,f=e.background;f?f.isColor&&(p.color.copy(f),e.background=null,A=!0):(p.color.copy(x),A=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(s.up.set(0,o[t],0),s.position.set(a.x,a.y,a.z),s.lookAt(a.x+l[t],a.y,a.z)):1===i?(s.up.set(0,0,o[t]),s.position.set(a.x,a.y,a.z),s.lookAt(a.x,a.y+l[t],a.z)):(s.up.set(0,o[t],0),s.position.set(a.x,a.y,a.z),s.lookAt(a.x,a.y,a.z+l[t]));let n=this._cubeSize;T(r,i*n,t>2?n:0,n,n),h.setRenderTarget(r),A&&h.render(d,s),h.render(e,s)}h.toneMapping=u,h.autoClear=c,e.background=f}_textureToCubeUV(e,t){let i=this._renderer,r=301===e.mapping||302===e.mapping;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=R()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=B());let n=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=n,n.uniforms.envMap.value=e;let s=this._cubeSize;T(t,0,0,3*s,2*s),i.setRenderTarget(t),i.render(a,y)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;t<r;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=i}_applyGGXFilter(e,t,i){let r=this._renderer,n=this._pingPongRenderTarget,a=this._ggxMaterial,s=this._lodMeshes[i];s.material=a;let o=a.uniforms,l=i/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),c=Math.sqrt(l*l-h*h),{_lodMax:u}=this,d=this._sizeLods[i],p=3*d*(i>u-4?i-u+4:0),A=4*(this._cubeSize-d);o.envMap.value=e.texture,o.roughness.value=c*(0+1.25*l),o.mipInt.value=u-t,T(n,p,A,3*d,2*d),r.setRenderTarget(n),r.render(s,y),o.envMap.value=n.texture,o.roughness.value=0,o.mipInt.value=u-i,T(e,p,A,3*d,2*d),r.setRenderTarget(e),r.render(s,y)}_blur(e,t,i,r,n){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",n),this._halfBlur(a,e,i,i,r,"longitudinal",n)}_halfBlur(e,t,i,r,a,s,o){let l=this._renderer,h=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&(0,n.z3S)("blur direction must be either latitudinal or longitudinal!");let c=this._lodMeshes[r];c.material=h;let u=h.uniforms,d=this._sizeLods[i]-1,p=isFinite(a)?Math.PI/(2*d):2*Math.PI/39,A=a/p,f=isFinite(a)?1+Math.floor(3*A):20;f>20&&(0,n.R8M)(`sigmaRadians, ${a}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let g=[],m=0;for(let e=0;e<20;++e){let t=e/A,i=Math.exp(-t*t/2);g.push(i),0===e?m+=i:e<f&&(m+=2*i)}for(let e=0;e<g.length;e++)g[e]=g[e]/m;u.envMap.value=e.texture,u.samples.value=f,u.weights.value=g,u.latitudinal.value="latitudinal"===s,o&&(u.poleAxis.value=o);let{_lodMax:v}=this;u.dTheta.value=p,u.mipInt.value=v-i;let b=this._sizeLods[r],x=4*(this._cubeSize-b);T(t,3*b*(r>v-4?r-v+4:0),x,3*b,2*b),l.setRenderTarget(t),l.render(c,y)}}function I(e,t,i){let r=new n.nWS(e,t,i);return r.texture.mapping=306,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function T(e,t,i,r,n){e.viewport.set(t,i,r,n),e.scissor.set(t,i,r,n)}function B(){return new n.BKk({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:D(),fragmentShader:`
|
|
673
|
+
|
|
674
|
+
precision mediump float;
|
|
675
|
+
precision mediump int;
|
|
676
|
+
|
|
677
|
+
varying vec3 vOutputDirection;
|
|
678
|
+
|
|
679
|
+
uniform sampler2D envMap;
|
|
680
|
+
|
|
681
|
+
#include <common>
|
|
682
|
+
|
|
683
|
+
void main() {
|
|
684
|
+
|
|
685
|
+
vec3 outputDirection = normalize( vOutputDirection );
|
|
686
|
+
vec2 uv = equirectUv( outputDirection );
|
|
687
|
+
|
|
688
|
+
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
689
|
+
|
|
690
|
+
}
|
|
691
|
+
`,blending:0,depthTest:!1,depthWrite:!1})}function R(){return new n.BKk({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:D(),fragmentShader:`
|
|
692
|
+
|
|
693
|
+
precision mediump float;
|
|
694
|
+
precision mediump int;
|
|
695
|
+
|
|
696
|
+
uniform float flipEnvMap;
|
|
697
|
+
|
|
698
|
+
varying vec3 vOutputDirection;
|
|
699
|
+
|
|
700
|
+
uniform samplerCube envMap;
|
|
701
|
+
|
|
702
|
+
void main() {
|
|
703
|
+
|
|
704
|
+
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
705
|
+
|
|
706
|
+
}
|
|
707
|
+
`,blending:0,depthTest:!1,depthWrite:!1})}function D(){return`
|
|
708
|
+
|
|
709
|
+
precision mediump float;
|
|
710
|
+
precision mediump int;
|
|
711
|
+
|
|
712
|
+
attribute float faceIndex;
|
|
713
|
+
|
|
714
|
+
varying vec3 vOutputDirection;
|
|
715
|
+
|
|
716
|
+
// RH coordinate system; PMREM face-indexing convention
|
|
717
|
+
vec3 getDirection( vec2 uv, float face ) {
|
|
718
|
+
|
|
719
|
+
uv = 2.0 * uv - 1.0;
|
|
720
|
+
|
|
721
|
+
vec3 direction = vec3( uv, 1.0 );
|
|
722
|
+
|
|
723
|
+
if ( face == 0.0 ) {
|
|
724
|
+
|
|
725
|
+
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
726
|
+
|
|
727
|
+
} else if ( face == 1.0 ) {
|
|
728
|
+
|
|
729
|
+
direction = direction.xzy;
|
|
730
|
+
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
731
|
+
|
|
732
|
+
} else if ( face == 2.0 ) {
|
|
733
|
+
|
|
734
|
+
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
735
|
+
|
|
736
|
+
} else if ( face == 3.0 ) {
|
|
737
|
+
|
|
738
|
+
direction = direction.zyx;
|
|
739
|
+
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
740
|
+
|
|
741
|
+
} else if ( face == 4.0 ) {
|
|
742
|
+
|
|
743
|
+
direction = direction.xzy;
|
|
744
|
+
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
745
|
+
|
|
746
|
+
} else if ( face == 5.0 ) {
|
|
747
|
+
|
|
748
|
+
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
749
|
+
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
return direction;
|
|
753
|
+
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
void main() {
|
|
757
|
+
|
|
758
|
+
vOutputDirection = getDirection( uv, faceIndex );
|
|
759
|
+
gl_Position = vec4( position, 1.0 );
|
|
760
|
+
|
|
761
|
+
}
|
|
762
|
+
`}function L(e){let t=new WeakMap,i=null;function r(e){let i=e.target;i.removeEventListener("dispose",r);let n=t.get(i);void 0!==n&&(t.delete(i),n.dispose())}return{get:function(n){if(n&&n.isTexture){let a=n.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){let a=t.get(n),l=void 0!==a?a.texture.pmremVersion:0;if(n.isRenderTargetTexture&&n.pmremVersion!==l)return null===i&&(i=new w(e)),(a=s?i.fromEquirectangular(n,a):i.fromCubemap(n,a)).texture.pmremVersion=n.pmremVersion,t.set(n,a),a.texture;{if(void 0!==a)return a.texture;let l=n.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(l)?(null===i&&(i=new w(e)),(a=s?i.fromEquirectangular(n):i.fromCubemap(n)).texture.pmremVersion=n.pmremVersion,t.set(n,a),n.addEventListener("dispose",r),a.texture):null}}}return n},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function P(e){let t={};function i(i){if(void 0!==t[i])return t[i];let r=e.getExtension(i);return t[i]=r,r}return{has:function(e){return null!==i(e)},init:function(){i("EXT_color_buffer_float"),i("WEBGL_clip_cull_distance"),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture"),i("WEBGL_render_shared_exponent")},get:function(e){let t=i(e);return null===t&&(0,n.mcG)("WebGLRenderer: "+e+" extension not supported."),t}}}function U(e,t,i,r){let a={},s=new WeakMap;function o(e){let n=e.target;for(let e in null!==n.index&&t.remove(n.index),n.attributes)t.remove(n.attributes[e]);n.removeEventListener("dispose",o),delete a[n.id];let l=s.get(n);l&&(t.remove(l),s.delete(n)),r.releaseStatesOfGeometry(n),!0===n.isInstancedBufferGeometry&&delete n._maxInstanceCount,i.memory.geometries--}function l(e){let i=[],r=e.index,a=e.attributes.position,o=0;if(null!==r){let e=r.array;o=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],n=e[t+1],a=e[t+2];i.push(r,n,n,a,a,r)}}else{if(void 0===a)return;let e=a.array;o=a.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,n=t+2;i.push(e,r,r,n,n,e)}}let l=new((0,n.AQS)(i)?n.MW4:n.A$4)(i,1);l.version=o;let h=s.get(e);h&&t.remove(h),s.set(e,l)}return{get:function(e,t){return!0===a[t.id]||(t.addEventListener("dispose",o),a[t.id]=!0,i.memory.geometries++),t},update:function(i){let r=i.attributes;for(let i in r)t.update(r[i],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){let t=s.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&l(e)}else l(e);return s.get(e)}}}function F(e,t,i){let r,n,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(r,s,n,t*a,o),i.update(s,r,o))}this.setMode=function(e){r=e},this.setIndex=function(e){n=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(r,s,n,t*a),i.update(s,r,1)},this.renderInstances=s,this.renderMultiDraw=function(e,a,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,a,0,n,e,0,s);let o=0;for(let e=0;e<s;e++)o+=a[e];i.update(o,r,1)},this.renderMultiDrawInstances=function(e,o,l,h){if(0===l)return;let c=t.get("WEBGL_multi_draw");if(null===c)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],h[t]);else{c.multiDrawElementsInstancedWEBGL(r,o,0,n,e,0,h,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e]*h[e];i.update(t,r,1)}}}function N(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(i,r,a){switch(t.calls++,r){case e.TRIANGLES:t.triangles+=i/3*a;break;case e.LINES:t.lines+=i/2*a;break;case e.LINE_STRIP:t.lines+=a*(i-1);break;case e.LINE_LOOP:t.lines+=a*i;break;case e.POINTS:t.points+=a*i;break;default:(0,n.z3S)("WebGLInfo: Unknown draw mode:",r)}}}}function O(e,t,i){let r=new WeakMap,a=new n.IUQ;return{update:function(s,o,l){let h=s.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=void 0!==c?c.length:0,d=r.get(o);if(void 0===d||d.count!==u){void 0!==d&&d.texture.dispose();let e=void 0!==o.morphAttributes.position,i=void 0!==o.morphAttributes.normal,s=void 0!==o.morphAttributes.color,l=o.morphAttributes.position||[],h=o.morphAttributes.normal||[],c=o.morphAttributes.color||[],p=0;!0===e&&(p=1),!0===i&&(p=2),!0===s&&(p=3);let A=o.attributes.position.count*p,f=1;A>t.maxTextureSize&&(f=Math.ceil(A/t.maxTextureSize),A=t.maxTextureSize);let g=new Float32Array(A*f*4*u),m=new n.rFo(g,A,f,u);m.type=1015,m.needsUpdate=!0;let v=4*p;for(let t=0;t<u;t++){let r=l[t],n=h[t],o=c[t],u=A*f*4*t;for(let t=0;t<r.count;t++){let l=t*v;!0===e&&(a.fromBufferAttribute(r,t),g[u+l+0]=a.x,g[u+l+1]=a.y,g[u+l+2]=a.z,g[u+l+3]=0),!0===i&&(a.fromBufferAttribute(n,t),g[u+l+4]=a.x,g[u+l+5]=a.y,g[u+l+6]=a.z,g[u+l+7]=0),!0===s&&(a.fromBufferAttribute(o,t),g[u+l+8]=a.x,g[u+l+9]=a.y,g[u+l+10]=a.z,g[u+l+11]=4===o.itemSize?a.w:1)}}d={count:u,texture:m,size:new n.I9Y(A,f)},r.set(o,d),o.addEventListener("dispose",function e(){m.dispose(),r.delete(o),o.removeEventListener("dispose",e)})}if(!0===s.isInstancedMesh&&null!==s.morphTexture)l.getUniforms().setValue(e,"morphTexture",s.morphTexture,i);else{let t=0;for(let e=0;e<h.length;e++)t+=h[e];let i=o.morphTargetsRelative?1:1-t;l.getUniforms().setValue(e,"morphTargetBaseInfluence",i),l.getUniforms().setValue(e,"morphTargetInfluences",h)}l.getUniforms().setValue(e,"morphTargetsTexture",d.texture,i),l.getUniforms().setValue(e,"morphTargetsTextureSize",d.size)}}}function k(e,t,i,r){let n=new WeakMap;function a(e){let t=e.target;t.removeEventListener("dispose",a),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(s){let o=r.render.frame,l=s.geometry,h=t.get(s,l);if(n.get(h)!==o&&(t.update(h),n.set(h,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),n.get(s)!==o&&(i.update(s.instanceMatrix,e.ARRAY_BUFFER),null!==s.instanceColor&&i.update(s.instanceColor,e.ARRAY_BUFFER),n.set(s,o))),s.isSkinnedMesh){let e=s.skeleton;n.get(e)!==o&&(e.update(),n.set(e,o))}return h},dispose:function(){n=new WeakMap}}}let Q={1:"LINEAR_TONE_MAPPING",2:"REINHARD_TONE_MAPPING",3:"CINEON_TONE_MAPPING",4:"ACES_FILMIC_TONE_MAPPING",6:"AGX_TONE_MAPPING",7:"NEUTRAL_TONE_MAPPING",5:"CUSTOM_TONE_MAPPING"};function G(e,t,i,r,a){let s,o=new n.nWS(t,i,{type:e,depthBuffer:r,stencilBuffer:a}),l=new n.nWS(t,i,{type:1016,depthBuffer:!1,stencilBuffer:!1}),h=new n.LoY;h.setAttribute("position",new n.qtW([-1,3,0,-1,-1,0,3,-1,0],3)),h.setAttribute("uv",new n.qtW([0,2,0,0,2,0],2));let c=new n.D$Q({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
763
|
+
precision highp float;
|
|
764
|
+
|
|
765
|
+
uniform mat4 modelViewMatrix;
|
|
766
|
+
uniform mat4 projectionMatrix;
|
|
767
|
+
|
|
768
|
+
attribute vec3 position;
|
|
769
|
+
attribute vec2 uv;
|
|
770
|
+
|
|
771
|
+
varying vec2 vUv;
|
|
772
|
+
|
|
773
|
+
void main() {
|
|
774
|
+
vUv = uv;
|
|
775
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
776
|
+
}`,fragmentShader:`
|
|
777
|
+
precision highp float;
|
|
778
|
+
|
|
779
|
+
uniform sampler2D tDiffuse;
|
|
780
|
+
|
|
781
|
+
varying vec2 vUv;
|
|
782
|
+
|
|
783
|
+
#include <tonemapping_pars_fragment>
|
|
784
|
+
#include <colorspace_pars_fragment>
|
|
785
|
+
|
|
786
|
+
void main() {
|
|
787
|
+
gl_FragColor = texture2D( tDiffuse, vUv );
|
|
788
|
+
|
|
789
|
+
#ifdef LINEAR_TONE_MAPPING
|
|
790
|
+
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
|
|
791
|
+
#elif defined( REINHARD_TONE_MAPPING )
|
|
792
|
+
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
|
|
793
|
+
#elif defined( CINEON_TONE_MAPPING )
|
|
794
|
+
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
|
|
795
|
+
#elif defined( ACES_FILMIC_TONE_MAPPING )
|
|
796
|
+
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
|
|
797
|
+
#elif defined( AGX_TONE_MAPPING )
|
|
798
|
+
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
|
|
799
|
+
#elif defined( NEUTRAL_TONE_MAPPING )
|
|
800
|
+
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
|
801
|
+
#elif defined( CUSTOM_TONE_MAPPING )
|
|
802
|
+
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
|
|
803
|
+
#endif
|
|
804
|
+
|
|
805
|
+
#ifdef SRGB_TRANSFER
|
|
806
|
+
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
807
|
+
#endif
|
|
808
|
+
}`,depthTest:!1,depthWrite:!1}),u=new n.eaF(h,c),d=new n.qUd(-1,1,1,-1,0,1),p=null,A=null,f=!1,g=null,m=[],v=!1;this.setSize=function(e,t){o.setSize(e,t),l.setSize(e,t);for(let i=0;i<m.length;i++){let r=m[i];r.setSize&&r.setSize(e,t)}},this.setEffects=function(e){v=(m=e).length>0&&!0===m[0].isRenderPass;let t=o.width,i=o.height;for(let e=0;e<m.length;e++){let r=m[e];r.setSize&&r.setSize(t,i)}},this.begin=function(e,t){if(f||0===e.toneMapping&&0===m.length)return!1;if(g=t,null!==t){let e=t.width,i=t.height;(o.width!==e||o.height!==i)&&this.setSize(e,i)}return!1===v&&e.setRenderTarget(o),s=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return v},this.end=function(e,t){e.toneMapping=s,f=!0;let i=o,r=l;for(let n=0;n<m.length;n++){let a=m[n];if(!1!==a.enabled&&(a.render(e,r,i,t),!1!==a.needsSwap)){let e=i;i=r,r=e}}if(p!==e.outputColorSpace||A!==e.toneMapping){p=e.outputColorSpace,A=e.toneMapping,c.defines={},"srgb"===n.ppV.getTransfer(p)&&(c.defines.SRGB_TRANSFER="");let t=Q[A];t&&(c.defines[t]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=i.texture,e.setRenderTarget(g),e.render(u,d),g=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){o.dispose(),l.dispose(),h.dispose(),c.dispose()}}let H=new n.gPd,z=new n.VCu(1,1),V=new n.rFo,q=new n.dYF,W=new n.b4q,j=[],X=[],Y=new Float32Array(16),J=new Float32Array(9),K=new Float32Array(4);function $(e,t,i){let r=e[0];if(r<=0||r>0)return e;let n=t*i,a=j[n];if(void 0===a&&(a=new Float32Array(n),j[n]=a),0!==t){r.toArray(a,0);for(let r=1,n=0;r!==t;++r)n+=i,e[r].toArray(a,n)}return a}function Z(e,t){if(e.length!==t.length)return!1;for(let i=0,r=e.length;i<r;i++)if(e[i]!==t[i])return!1;return!0}function ee(e,t){for(let i=0,r=t.length;i<r;i++)e[i]=t[i]}function et(e,t){let i=X[t];void 0===i&&(i=new Int32Array(t),X[t]=i);for(let r=0;r!==t;++r)i[r]=e.allocateTextureUnit();return i}function ei(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function er(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(Z(i,t))return;e.uniform2fv(this.addr,t),ee(i,t)}}function en(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(Z(i,t))return;e.uniform3fv(this.addr,t),ee(i,t)}}function ea(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(Z(i,t))return;e.uniform4fv(this.addr,t),ee(i,t)}}function es(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(Z(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),ee(i,t)}else{if(Z(i,r))return;K.set(r),e.uniformMatrix2fv(this.addr,!1,K),ee(i,r)}}function eo(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(Z(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),ee(i,t)}else{if(Z(i,r))return;J.set(r),e.uniformMatrix3fv(this.addr,!1,J),ee(i,r)}}function el(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(Z(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),ee(i,t)}else{if(Z(i,r))return;Y.set(r),e.uniformMatrix4fv(this.addr,!1,Y),ee(i,r)}}function eh(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function ec(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(Z(i,t))return;e.uniform2iv(this.addr,t),ee(i,t)}}function eu(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(Z(i,t))return;e.uniform3iv(this.addr,t),ee(i,t)}}function ed(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(Z(i,t))return;e.uniform4iv(this.addr,t),ee(i,t)}}function ep(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function eA(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(Z(i,t))return;e.uniform2uiv(this.addr,t),ee(i,t)}}function ef(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(Z(i,t))return;e.uniform3uiv(this.addr,t),ee(i,t)}}function eg(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(Z(i,t))return;e.uniform4uiv(this.addr,t),ee(i,t)}}function em(e,t,i){let r,n=this.cache,a=i.allocateTextureUnit();n[0]!==a&&(e.uniform1i(this.addr,a),n[0]=a),this.type===e.SAMPLER_2D_SHADOW?(z.compareFunction=i.isReversedDepthBuffer()?518:515,r=z):r=H,i.setTexture2D(t||r,a)}function ev(e,t,i){let r=this.cache,n=i.allocateTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTexture3D(t||q,n)}function eb(e,t,i){let r=this.cache,n=i.allocateTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTextureCube(t||W,n)}function ey(e,t,i){let r=this.cache,n=i.allocateTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTexture2DArray(t||V,n)}function ex(e,t){e.uniform1fv(this.addr,t)}function e_(e,t){let i=$(t,this.size,2);e.uniform2fv(this.addr,i)}function eE(e,t){let i=$(t,this.size,3);e.uniform3fv(this.addr,i)}function eS(e,t){let i=$(t,this.size,4);e.uniform4fv(this.addr,i)}function eC(e,t){let i=$(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function eM(e,t){let i=$(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function ew(e,t){let i=$(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function eI(e,t){e.uniform1iv(this.addr,t)}function eT(e,t){e.uniform2iv(this.addr,t)}function eB(e,t){e.uniform3iv(this.addr,t)}function eR(e,t){e.uniform4iv(this.addr,t)}function eD(e,t){e.uniform1uiv(this.addr,t)}function eL(e,t){e.uniform2uiv(this.addr,t)}function eP(e,t){e.uniform3uiv(this.addr,t)}function eU(e,t){e.uniform4uiv(this.addr,t)}function eF(e,t,i){let r,n=this.cache,a=t.length,s=et(i,a);Z(n,s)||(e.uniform1iv(this.addr,s),ee(n,s)),r=this.type===e.SAMPLER_2D_SHADOW?z:H;for(let e=0;e!==a;++e)i.setTexture2D(t[e]||r,s[e])}function eN(e,t,i){let r=this.cache,n=t.length,a=et(i,n);Z(r,a)||(e.uniform1iv(this.addr,a),ee(r,a));for(let e=0;e!==n;++e)i.setTexture3D(t[e]||q,a[e])}function eO(e,t,i){let r=this.cache,n=t.length,a=et(i,n);Z(r,a)||(e.uniform1iv(this.addr,a),ee(r,a));for(let e=0;e!==n;++e)i.setTextureCube(t[e]||W,a[e])}function ek(e,t,i){let r=this.cache,n=t.length,a=et(i,n);Z(r,a)||(e.uniform1iv(this.addr,a),ee(r,a));for(let e=0;e!==n;++e)i.setTexture2DArray(t[e]||V,a[e])}class eQ{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return ei;case 35664:return er;case 35665:return en;case 35666:return ea;case 35674:return es;case 35675:return eo;case 35676:return el;case 5124:case 35670:return eh;case 35667:case 35671:return ec;case 35668:case 35672:return eu;case 35669:case 35673:return ed;case 5125:return ep;case 36294:return eA;case 36295:return ef;case 36296:return eg;case 35678:case 36198:case 36298:case 36306:case 35682:return em;case 35679:case 36299:case 36307:return ev;case 35680:case 36300:case 36308:case 36293:return eb;case 36289:case 36303:case 36311:case 36292:return ey}}(t.type)}}class eG{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return ex;case 35664:return e_;case 35665:return eE;case 35666:return eS;case 35674:return eC;case 35675:return eM;case 35676:return ew;case 5124:case 35670:return eI;case 35667:case 35671:return eT;case 35668:case 35672:return eB;case 35669:case 35673:return eR;case 5125:return eD;case 36294:return eL;case 36295:return eP;case 36296:return eU;case 35678:case 36198:case 36298:case 36306:case 35682:return eF;case 35679:case 36299:case 36307:return eN;case 35680:case 36300:case 36308:case 36293:return eO;case 36289:case 36303:case 36311:case 36292:return ek}}(t.type)}}class eH{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let r=this.seq;for(let n=0,a=r.length;n!==a;++n){let a=r[n];a.setValue(e,t[a.id],i)}}}let ez=/(\w+)(\])?(\[|\.)?/g;function eV(e,t){e.seq.push(t),e.map[t.id]=t}class eq{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const i=e.getActiveUniform(t,r),n=e.getUniformLocation(t,i.name);!function(e,t,i){let r=e.name,n=r.length;for(ez.lastIndex=0;;){let a=ez.exec(r),s=ez.lastIndex,o=a[1],l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===n){eV(i,void 0===h?new eQ(o,e,t):new eG(o,e,t));break}{let e=i.map[o];void 0===e&&eV(i,e=new eH(o)),i=e}}}(i,n,this)}const r=[],n=[];for(const t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(t):n.push(t);r.length>0&&(this.seq=r.concat(n))}setValue(e,t,i,r){let n=this.map[t];void 0!==n&&n.setValue(e,i,r)}setOptional(e,t,i){let r=t[i];void 0!==r&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let n=0,a=t.length;n!==a;++n){let a=t[n],s=i[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,r)}}static seqWithValue(e,t){let i=[];for(let r=0,n=e.length;r!==n;++r){let n=e[r];n.id in t&&i.push(n)}return i}}function eW(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}let ej=0,eX=new n.dwI;function eY(e,t,i){let r=e.getShaderParameter(t,e.COMPILE_STATUS),n=(e.getShaderInfoLog(t)||"").trim();if(r&&""===n)return"";let a=/ERROR: 0:(\d+)/.exec(n);if(!a)return n;{let r=parseInt(a[1]);return i.toUpperCase()+"\n\n"+n+"\n\n"+function(e,t){let i=e.split("\n"),r=[],n=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let e=n;e<a;e++){let n=e+1;r.push(`${n===t?">":" "} ${n}: ${i[e]}`)}return r.join("\n")}(e.getShaderSource(t),r)}}let eJ={1:"Linear",2:"Reinhard",3:"Cineon",4:"ACESFilmic",6:"AgX",7:"Neutral",5:"Custom"},eK=new n.Pq0;function e$(e){return""!==e}function eZ(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function e0(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let e1=/^[ \t]*#include +<([\w\d./]+)>/gm;function e2(e){return e.replace(e1,e4)}let e3=new Map;function e4(e,t){let i=o[t];if(void 0===i){let e=e3.get(t);if(void 0!==e)i=o[e],(0,n.R8M)('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return e2(i)}let e5=/#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 e8(e){return e.replace(e5,e9)}function e9(e,t,i,r){let n="";for(let e=parseInt(t);e<parseInt(i);e++)n+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return n}function e6(e){let t=`precision ${e.precision} float;
|
|
809
|
+
precision ${e.precision} int;
|
|
810
|
+
precision ${e.precision} sampler2D;
|
|
811
|
+
precision ${e.precision} samplerCube;
|
|
812
|
+
precision ${e.precision} sampler3D;
|
|
813
|
+
precision ${e.precision} sampler2DArray;
|
|
814
|
+
precision ${e.precision} sampler2DShadow;
|
|
815
|
+
precision ${e.precision} samplerCubeShadow;
|
|
816
|
+
precision ${e.precision} sampler2DArrayShadow;
|
|
817
|
+
precision ${e.precision} isampler2D;
|
|
818
|
+
precision ${e.precision} isampler3D;
|
|
819
|
+
precision ${e.precision} isamplerCube;
|
|
820
|
+
precision ${e.precision} isampler2DArray;
|
|
821
|
+
precision ${e.precision} usampler2D;
|
|
822
|
+
precision ${e.precision} usampler3D;
|
|
823
|
+
precision ${e.precision} usamplerCube;
|
|
824
|
+
precision ${e.precision} usampler2DArray;
|
|
825
|
+
`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}let e7={1:"SHADOWMAP_TYPE_PCF",3:"SHADOWMAP_TYPE_VSM"},te={301:"ENVMAP_TYPE_CUBE",302:"ENVMAP_TYPE_CUBE",306:"ENVMAP_TYPE_CUBE_UV"},tt={302:"ENVMAP_MODE_REFRACTION"},ti={0:"ENVMAP_BLENDING_MULTIPLY",1:"ENVMAP_BLENDING_MIX",2:"ENVMAP_BLENDING_ADD"};function tr(e,t,i,r){var a,s;let l,h,c,u,d=e.getContext(),p=i.defines,A=i.vertexShader,f=i.fragmentShader,g=e7[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC",m=!1===i.envMap?"ENVMAP_TYPE_CUBE":te[i.envMapMode]||"ENVMAP_TYPE_CUBE",v=!1===i.envMap?"ENVMAP_MODE_REFLECTION":tt[i.envMapMode]||"ENVMAP_MODE_REFLECTION",b=!1===i.envMap?"ENVMAP_BLENDING_NONE":ti[i.combine]||"ENVMAP_BLENDING_NONE",y=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}(i),x=[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(e$).join("\n"),_=function(e){let t=[];for(let i in e){let r=e[i];!1!==r&&t.push("#define "+i+" "+r)}return t.join("\n")}(p),E=d.createProgram(),S=i.glslVersion?"#version "+i.glslVersion+"\n":"";if(i.isRawShaderMaterial)(l=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,_].filter(e$).join("\n")).length>0&&(l+="\n"),(h=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,_].filter(e$).join("\n")).length>0&&(h+="\n");else{let e,t,r,c,u;l=[e6(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,_,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+v:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+g:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",i.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute 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","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(e$).join("\n"),h=[e6(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,_,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+m:"",i.envMap?"#define "+v:"",i.envMap?"#define "+b:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor||i.batchingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+g:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",i.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",i.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?o.tonemapping_pars_fragment:"",0!==i.toneMapping?(a="toneMapping",void 0===(e=eJ[s=i.toneMapping])?((0,n.R8M)("WebGLProgram: Unsupported toneMapping:",s),"vec3 "+a+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+a+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",o.colorspace_pars_fragment,(t=function(e){n.ppV._getMatrix(eX,n.ppV.workingColorSpace,e);let t=`mat3( ${eX.elements.map(e=>e.toFixed(4))} )`;switch(n.ppV.getTransfer(e)){case"linear":return[t,"LinearTransferOETF"];case"srgb":return[t,"sRGBTransferOETF"];default:return(0,n.R8M)("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(i.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) {
|
|
826
|
+
return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );
|
|
827
|
+
}`),(n.ppV.getLuminanceCoefficients(eK),r=eK.x.toFixed(4),c=eK.y.toFixed(4),u=eK.z.toFixed(4),`float luminance( const in vec3 rgb ) {
|
|
828
|
+
const vec3 weights = vec3( ${r}, ${c}, ${u} );
|
|
829
|
+
return dot( weights, rgb );
|
|
830
|
+
}`),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(e$).join("\n")}A=e0(A=eZ(A=e2(A),i),i),f=e0(f=eZ(f=e2(f),i),i),A=e8(A),f=e8(f),!0!==i.isRawShaderMaterial&&(S="#version 300 es\n",l=[x,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+l,h=["#define varying in","300 es"===i.glslVersion?"":"layout(location = 0) out highp vec4 pc_fragColor;","300 es"===i.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+h);let C=S+l+A,M=S+h+f,w=eW(d,d.VERTEX_SHADER,C),I=eW(d,d.FRAGMENT_SHADER,M);function T(t){if(e.debug.checkShaderErrors){let i=d.getProgramInfoLog(E)||"",r=d.getShaderInfoLog(w)||"",a=d.getShaderInfoLog(I)||"",s=i.trim(),o=r.trim(),c=a.trim(),u=!0,p=!0;if(!1===d.getProgramParameter(E,d.LINK_STATUS))if(u=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(d,E,w,I);else{let e=eY(d,w,"vertex"),i=eY(d,I,"fragment");(0,n.z3S)("THREE.WebGLProgram: Shader Error "+d.getError()+" - VALIDATE_STATUS "+d.getProgramParameter(E,d.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+s+"\n"+e+"\n"+i)}else""!==s?(0,n.R8M)("WebGLProgram: Program Info Log:",s):(""===o||""===c)&&(p=!1);p&&(t.diagnostics={runnable:u,programLog:s,vertexShader:{log:o,prefix:l},fragmentShader:{log:c,prefix:h}})}d.deleteShader(w),d.deleteShader(I),c=new eq(d,E),u=function(e,t){let i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let n=0;n<r;n++){let r=e.getActiveAttrib(t,n),a=r.name,s=1;r.type===e.FLOAT_MAT2&&(s=2),r.type===e.FLOAT_MAT3&&(s=3),r.type===e.FLOAT_MAT4&&(s=4),i[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:s}}return i}(d,E)}d.attachShader(E,w),d.attachShader(E,I),void 0!==i.index0AttributeName?d.bindAttribLocation(E,0,i.index0AttributeName):!0===i.morphTargets&&d.bindAttribLocation(E,0,"position"),d.linkProgram(E),this.getUniforms=function(){return void 0===c&&T(this),c},this.getAttributes=function(){return void 0===u&&T(this),u};let B=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===B&&(B=d.getProgramParameter(E,37297)),B},this.destroy=function(){r.releaseStatesOfProgram(this),d.deleteProgram(E),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=ej++,this.cacheKey=t,this.usedTimes=1,this.program=E,this.vertexShader=w,this.fragmentShader=I,this}let tn=0;class ta{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),n=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(n)&&(a.add(n),n.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return void 0===i&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return void 0===i&&(i=new ts(e),t.set(e,i)),i}}class ts{constructor(e){this.id=tn++,this.code=e,this.usedTimes=0}}function to(e,t,i,r,a,s,o){let l=new n.zgK,c=new ta,u=new Set,d=[],p=new Map,A=a.logarithmicDepthBuffer,f=a.precision,g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(e){return(u.add(e),0===e)?"uv":`uv${e}`}return{getParameters:function(s,l,d,p,v){let b,y,x,_,E=p.fog,S=v.geometry,C=s.isMeshStandardMaterial?p.environment:null,M=(s.isMeshStandardMaterial?i:t).get(s.envMap||C),w=M&&306===M.mapping?M.image.height:null,I=g[s.type];null!==s.precision&&(f=a.getMaxPrecision(s.precision))!==s.precision&&(0,n.R8M)("WebGLProgram.getParameters:",s.precision,"not supported, using",f,"instead.");let T=S.morphAttributes.position||S.morphAttributes.normal||S.morphAttributes.color,B=void 0!==T?T.length:0,R=0;if(void 0!==S.morphAttributes.position&&(R=1),void 0!==S.morphAttributes.normal&&(R=2),void 0!==S.morphAttributes.color&&(R=3),I){let e=h[I];b=e.vertexShader,y=e.fragmentShader}else b=s.vertexShader,y=s.fragmentShader,c.update(s),x=c.getVertexShaderID(s),_=c.getFragmentShaderID(s);let D=e.getRenderTarget(),L=e.state.buffers.depth.getReversed(),P=!0===v.isInstancedMesh,U=!0===v.isBatchedMesh,F=!!s.map,N=!!s.matcap,O=!!M,k=!!s.aoMap,Q=!!s.lightMap,G=!!s.bumpMap,H=!!s.normalMap,z=!!s.displacementMap,V=!!s.emissiveMap,q=!!s.metalnessMap,W=!!s.roughnessMap,j=s.anisotropy>0,X=s.clearcoat>0,Y=s.dispersion>0,J=s.iridescence>0,K=s.sheen>0,$=s.transmission>0,Z=j&&!!s.anisotropyMap,ee=X&&!!s.clearcoatMap,et=X&&!!s.clearcoatNormalMap,ei=X&&!!s.clearcoatRoughnessMap,er=J&&!!s.iridescenceMap,en=J&&!!s.iridescenceThicknessMap,ea=K&&!!s.sheenColorMap,es=K&&!!s.sheenRoughnessMap,eo=!!s.specularMap,el=!!s.specularColorMap,eh=!!s.specularIntensityMap,ec=$&&!!s.transmissionMap,eu=$&&!!s.thicknessMap,ed=!!s.gradientMap,ep=!!s.alphaMap,eA=s.alphaTest>0,ef=!!s.alphaHash,eg=!!s.extensions,em=0;s.toneMapped&&(null===D||!0===D.isXRRenderTarget)&&(em=e.toneMapping);let ev={shaderID:I,shaderType:s.type,shaderName:s.name,vertexShader:b,fragmentShader:y,defines:s.defines,customVertexShaderID:x,customFragmentShaderID:_,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:f,batching:U,batchingColor:U&&null!==v._colorsTexture,instancing:P,instancingColor:P&&null!==v.instanceColor,instancingMorph:P&&null!==v.morphTexture,outputColorSpace:null===D?e.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:n.Zr2,alphaToCoverage:!!s.alphaToCoverage,map:F,matcap:N,envMap:O,envMapMode:O&&M.mapping,envMapCubeUVHeight:w,aoMap:k,lightMap:Q,bumpMap:G,normalMap:H,displacementMap:z,emissiveMap:V,normalMapObjectSpace:H&&1===s.normalMapType,normalMapTangentSpace:H&&0===s.normalMapType,metalnessMap:q,roughnessMap:W,anisotropy:j,anisotropyMap:Z,clearcoat:X,clearcoatMap:ee,clearcoatNormalMap:et,clearcoatRoughnessMap:ei,dispersion:Y,iridescence:J,iridescenceMap:er,iridescenceThicknessMap:en,sheen:K,sheenColorMap:ea,sheenRoughnessMap:es,specularMap:eo,specularColorMap:el,specularIntensityMap:eh,transmission:$,transmissionMap:ec,thicknessMap:eu,gradientMap:ed,opaque:!1===s.transparent&&1===s.blending&&!1===s.alphaToCoverage,alphaMap:ep,alphaTest:eA,alphaHash:ef,combine:s.combine,mapUv:F&&m(s.map.channel),aoMapUv:k&&m(s.aoMap.channel),lightMapUv:Q&&m(s.lightMap.channel),bumpMapUv:G&&m(s.bumpMap.channel),normalMapUv:H&&m(s.normalMap.channel),displacementMapUv:z&&m(s.displacementMap.channel),emissiveMapUv:V&&m(s.emissiveMap.channel),metalnessMapUv:q&&m(s.metalnessMap.channel),roughnessMapUv:W&&m(s.roughnessMap.channel),anisotropyMapUv:Z&&m(s.anisotropyMap.channel),clearcoatMapUv:ee&&m(s.clearcoatMap.channel),clearcoatNormalMapUv:et&&m(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ei&&m(s.clearcoatRoughnessMap.channel),iridescenceMapUv:er&&m(s.iridescenceMap.channel),iridescenceThicknessMapUv:en&&m(s.iridescenceThicknessMap.channel),sheenColorMapUv:ea&&m(s.sheenColorMap.channel),sheenRoughnessMapUv:es&&m(s.sheenRoughnessMap.channel),specularMapUv:eo&&m(s.specularMap.channel),specularColorMapUv:el&&m(s.specularColorMap.channel),specularIntensityMapUv:eh&&m(s.specularIntensityMap.channel),transmissionMapUv:ec&&m(s.transmissionMap.channel),thicknessMapUv:eu&&m(s.thicknessMap.channel),alphaMapUv:ep&&m(s.alphaMap.channel),vertexTangents:!!S.attributes.tangent&&(H||j),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!S.attributes.color&&4===S.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!S.attributes.uv&&(F||ep),fog:!!E,useFog:!0===s.fog,fogExp2:!!E&&E.isFogExp2,flatShading:!0===s.flatShading&&!1===s.wireframe,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:A,reversedDepthBuffer:L,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==S.morphAttributes.position,morphNormals:void 0!==S.morphAttributes.normal,morphColors:void 0!==S.morphAttributes.color,morphTargetsCount:B,morphTextureStride:R,numDirLights:l.directional.length,numPointLights:l.point.length,numSpotLights:l.spot.length,numSpotLightMaps:l.spotLightMap.length,numRectAreaLights:l.rectArea.length,numHemiLights:l.hemi.length,numDirLightShadows:l.directionalShadowMap.length,numPointLightShadows:l.pointShadowMap.length,numSpotLightShadows:l.spotShadowMap.length,numSpotLightShadowsWithMaps:l.numSpotLightShadowsWithMaps,numLightProbes:l.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:em,decodeVideoTexture:F&&!0===s.map.isVideoTexture&&"srgb"===n.ppV.getTransfer(s.map.colorSpace),decodeVideoTextureEmissive:V&&!0===s.emissiveMap.isVideoTexture&&"srgb"===n.ppV.getTransfer(s.emissiveMap.colorSpace),premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:eg&&!0===s.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(eg&&!0===s.extensions.multiDraw||U)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return ev.vertexUv1s=u.has(1),ev.vertexUv2s=u.has(2),ev.vertexUv3s=u.has(3),u.clear(),ev},getProgramCacheKey:function(t){var i,r,n,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)s.push(e),s.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i=s,r=t,i.push(r.precision),i.push(r.outputColorSpace),i.push(r.envMapMode),i.push(r.envMapCubeUVHeight),i.push(r.mapUv),i.push(r.alphaMapUv),i.push(r.lightMapUv),i.push(r.aoMapUv),i.push(r.bumpMapUv),i.push(r.normalMapUv),i.push(r.displacementMapUv),i.push(r.emissiveMapUv),i.push(r.metalnessMapUv),i.push(r.roughnessMapUv),i.push(r.anisotropyMapUv),i.push(r.clearcoatMapUv),i.push(r.clearcoatNormalMapUv),i.push(r.clearcoatRoughnessMapUv),i.push(r.iridescenceMapUv),i.push(r.iridescenceThicknessMapUv),i.push(r.sheenColorMapUv),i.push(r.sheenRoughnessMapUv),i.push(r.specularMapUv),i.push(r.specularColorMapUv),i.push(r.specularIntensityMapUv),i.push(r.transmissionMapUv),i.push(r.thicknessMapUv),i.push(r.combine),i.push(r.fogExp2),i.push(r.sizeAttenuation),i.push(r.morphTargetsCount),i.push(r.morphAttributeCount),i.push(r.numDirLights),i.push(r.numPointLights),i.push(r.numSpotLights),i.push(r.numSpotLightMaps),i.push(r.numHemiLights),i.push(r.numRectAreaLights),i.push(r.numDirLightShadows),i.push(r.numPointLightShadows),i.push(r.numSpotLightShadows),i.push(r.numSpotLightShadowsWithMaps),i.push(r.numLightProbes),i.push(r.shadowMapType),i.push(r.toneMapping),i.push(r.numClippingPlanes),i.push(r.numClipIntersection),i.push(r.depthPacking),n=s,a=t,l.disableAll(),a.instancing&&l.enable(0),a.instancingColor&&l.enable(1),a.instancingMorph&&l.enable(2),a.matcap&&l.enable(3),a.envMap&&l.enable(4),a.normalMapObjectSpace&&l.enable(5),a.normalMapTangentSpace&&l.enable(6),a.clearcoat&&l.enable(7),a.iridescence&&l.enable(8),a.alphaTest&&l.enable(9),a.vertexColors&&l.enable(10),a.vertexAlphas&&l.enable(11),a.vertexUv1s&&l.enable(12),a.vertexUv2s&&l.enable(13),a.vertexUv3s&&l.enable(14),a.vertexTangents&&l.enable(15),a.anisotropy&&l.enable(16),a.alphaHash&&l.enable(17),a.batching&&l.enable(18),a.dispersion&&l.enable(19),a.batchingColor&&l.enable(20),a.gradientMap&&l.enable(21),n.push(l.mask),l.disableAll(),a.fog&&l.enable(0),a.useFog&&l.enable(1),a.flatShading&&l.enable(2),a.logarithmicDepthBuffer&&l.enable(3),a.reversedDepthBuffer&&l.enable(4),a.skinning&&l.enable(5),a.morphTargets&&l.enable(6),a.morphNormals&&l.enable(7),a.morphColors&&l.enable(8),a.premultipliedAlpha&&l.enable(9),a.shadowMapEnabled&&l.enable(10),a.doubleSided&&l.enable(11),a.flipSided&&l.enable(12),a.useDepthPacking&&l.enable(13),a.dithering&&l.enable(14),a.transmission&&l.enable(15),a.sheen&&l.enable(16),a.opaque&&l.enable(17),a.pointsUvs&&l.enable(18),a.decodeVideoTexture&&l.enable(19),a.decodeVideoTextureEmissive&&l.enable(20),a.alphaToCoverage&&l.enable(21),n.push(l.mask),s.push(e.outputColorSpace)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t,i=g[e.type];if(i){let e=h[i];t=n.LlO.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,i){let r=p.get(i);return void 0!==r?++r.usedTimes:(r=new tr(e,i,t,s),d.push(r),p.set(i,r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let t=d.indexOf(e);d[t]=d[d.length-1],d.pop(),p.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){c.remove(e)},programs:d,dispose:function(){c.dispose()}}}function tl(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,r){e.get(t)[i]=r},dispose:function(){e=new WeakMap}}}function th(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function tc(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function tu(){let e=[],t=0,i=[],r=[],n=[];function a(i,r,n,a,s,o){let l=e[t];return void 0===l?(l={id:i.id,object:i,geometry:r,material:n,groupOrder:a,renderOrder:i.renderOrder,z:s,group:o},e[t]=l):(l.id=i.id,l.object=i,l.geometry=r,l.material=n,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:i,transmissive:r,transparent:n,init:function(){t=0,i.length=0,r.length=0,n.length=0},push:function(e,t,s,o,l,h){let c=a(e,t,s,o,l,h);s.transmission>0?r.push(c):!0===s.transparent?n.push(c):i.push(c)},unshift:function(e,t,s,o,l,h){let c=a(e,t,s,o,l,h);s.transmission>0?r.unshift(c):!0===s.transparent?n.unshift(c):i.unshift(c)},finish:function(){for(let i=t,r=e.length;i<r;i++){let t=e[i];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){i.length>1&&i.sort(e||th),r.length>1&&r.sort(t||tc),n.length>1&&n.sort(t||tc)}}}function td(){let e=new WeakMap;return{get:function(t,i){let r,n=e.get(t);return void 0===n?(r=new tu,e.set(t,[r])):i>=n.length?(r=new tu,n.push(r)):r=n[i],r},dispose:function(){e=new WeakMap}}}function tp(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new n.Pq0,color:new n.Q1f};break;case"SpotLight":i={position:new n.Pq0,direction:new n.Pq0,color:new n.Q1f,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new n.Pq0,color:new n.Q1f,distance:0,decay:0};break;case"HemisphereLight":i={direction:new n.Pq0,skyColor:new n.Q1f,groundColor:new n.Q1f};break;case"RectAreaLight":i={color:new n.Q1f,position:new n.Pq0,halfWidth:new n.Pq0,halfHeight:new n.Pq0}}return e[t.id]=i,i}}}let tA=0;function tf(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function tg(e){let t,i=new tp,r=(t={},{get:function(e){let i;if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new n.I9Y};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new n.I9Y,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}),a={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 e=0;e<9;e++)a.probe.push(new n.Pq0);let s=new n.Pq0,o=new n.kn4,h=new n.kn4;return{setup:function(t){let n=0,s=0,o=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let h=0,c=0,u=0,d=0,p=0,A=0,f=0,g=0,m=0,v=0,b=0;t.sort(tf);for(let e=0,l=t.length;e<l;e++){let l=t[e],y=l.color,x=l.intensity,_=l.distance,E=null;if(l.shadow&&l.shadow.map&&(E=1030===l.shadow.map.texture.format?l.shadow.map.texture:l.shadow.map.depthTexture||l.shadow.map.texture),l.isAmbientLight)n+=y.r*x,s+=y.g*x,o+=y.b*x;else if(l.isLightProbe){for(let e=0;e<9;e++)a.probe[e].addScaledVector(l.sh.coefficients[e],x);b++}else if(l.isDirectionalLight){let e=i.get(l);if(e.color.copy(l.color).multiplyScalar(l.intensity),l.castShadow){let e=l.shadow,t=r.get(l);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,a.directionalShadow[h]=t,a.directionalShadowMap[h]=E,a.directionalShadowMatrix[h]=l.shadow.matrix,A++}a.directional[h]=e,h++}else if(l.isSpotLight){let e=i.get(l);e.position.setFromMatrixPosition(l.matrixWorld),e.color.copy(y).multiplyScalar(x),e.distance=_,e.coneCos=Math.cos(l.angle),e.penumbraCos=Math.cos(l.angle*(1-l.penumbra)),e.decay=l.decay,a.spot[u]=e;let t=l.shadow;if(l.map&&(a.spotLightMap[m]=l.map,m++,t.updateMatrices(l),l.castShadow&&v++),a.spotLightMatrix[u]=t.matrix,l.castShadow){let e=r.get(l);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,a.spotShadow[u]=e,a.spotShadowMap[u]=E,g++}u++}else if(l.isRectAreaLight){let e=i.get(l);e.color.copy(y).multiplyScalar(x),e.halfWidth.set(.5*l.width,0,0),e.halfHeight.set(0,.5*l.height,0),a.rectArea[d]=e,d++}else if(l.isPointLight){let e=i.get(l);if(e.color.copy(l.color).multiplyScalar(l.intensity),e.distance=l.distance,e.decay=l.decay,l.castShadow){let e=l.shadow,t=r.get(l);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,a.pointShadow[c]=t,a.pointShadowMap[c]=E,a.pointShadowMatrix[c]=l.shadow.matrix,f++}a.point[c]=e,c++}else if(l.isHemisphereLight){let e=i.get(l);e.skyColor.copy(l.color).multiplyScalar(x),e.groundColor.copy(l.groundColor).multiplyScalar(x),a.hemi[p]=e,p++}}d>0&&(!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=l.LTC_FLOAT_1,a.rectAreaLTC2=l.LTC_FLOAT_2):(a.rectAreaLTC1=l.LTC_HALF_1,a.rectAreaLTC2=l.LTC_HALF_2)),a.ambient[0]=n,a.ambient[1]=s,a.ambient[2]=o;let y=a.hash;(y.directionalLength!==h||y.pointLength!==c||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==p||y.numDirectionalShadows!==A||y.numPointShadows!==f||y.numSpotShadows!==g||y.numSpotMaps!==m||y.numLightProbes!==b)&&(a.directional.length=h,a.spot.length=u,a.rectArea.length=d,a.point.length=c,a.hemi.length=p,a.directionalShadow.length=A,a.directionalShadowMap.length=A,a.pointShadow.length=f,a.pointShadowMap.length=f,a.spotShadow.length=g,a.spotShadowMap.length=g,a.directionalShadowMatrix.length=A,a.pointShadowMatrix.length=f,a.spotLightMatrix.length=g+m-v,a.spotLightMap.length=m,a.numSpotLightShadowsWithMaps=v,a.numLightProbes=b,y.directionalLength=h,y.pointLength=c,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=p,y.numDirectionalShadows=A,y.numPointShadows=f,y.numSpotShadows=g,y.numSpotMaps=m,y.numLightProbes=b,a.version=tA++)},setupView:function(e,t){let i=0,r=0,n=0,l=0,c=0,u=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=a.directional[i];e.direction.setFromMatrixPosition(d.matrixWorld),s.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(s),e.direction.transformDirection(u),i++}else if(d.isSpotLight){let e=a.spot[n];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),e.direction.setFromMatrixPosition(d.matrixWorld),s.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(s),e.direction.transformDirection(u),n++}else if(d.isRectAreaLight){let e=a.rectArea[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),h.identity(),o.copy(d.matrixWorld),o.premultiply(u),h.extractRotation(o),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(h),e.halfHeight.applyMatrix4(h),l++}else if(d.isPointLight){let e=a.point[r];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),r++}else if(d.isHemisphereLight){let e=a.hemi[c];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(u),c++}}},state:a}}function tm(e){let t=new tg(e),i=[],r=[],n={lightsArray:i,shadowsArray:r,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){n.camera=e,i.length=0,r.length=0},state:n,setupLights:function(){t.setup(i)},setupLightsView:function(e){t.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){r.push(e)}}}function tv(e){let t=new WeakMap;return{get:function(i,r=0){let n,a=t.get(i);return void 0===a?(n=new tm(e),t.set(i,[n])):r>=a.length?(n=new tm(e),a.push(n)):n=a[r],n},dispose:function(){t=new WeakMap}}}let tb=[new n.Pq0(1,0,0),new n.Pq0(-1,0,0),new n.Pq0(0,1,0),new n.Pq0(0,-1,0),new n.Pq0(0,0,1),new n.Pq0(0,0,-1)],ty=[new n.Pq0(0,-1,0),new n.Pq0(0,-1,0),new n.Pq0(0,0,1),new n.Pq0(0,0,-1),new n.Pq0(0,-1,0),new n.Pq0(0,-1,0)],tx=new n.kn4,t_=new n.Pq0,tE=new n.Pq0;function tS(e,t,i){let r=new n.PPD,a=new n.I9Y,s=new n.I9Y,o=new n.IUQ,l=new n.CSG,h=new n.aVO,c={},u=i.maxTextureSize,d={0:1,1:0,2:2},p=new n.BKk({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new n.I9Y},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),A=p.clone();A.defines.HORIZONTAL_PASS=1;let f=new n.LoY;f.setAttribute("position",new n.THS(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new n.eaF(f,p),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let v=this.type;function b(t,i,r,n){let a=null,s=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===r.isPointLight?h:l,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0||!0===i.alphaToCoverage){let e=a.uuid,t=i.uuid,r=c[e];void 0===r&&(r={},c[e]=r);let n=r[t];void 0===n&&(n=a.clone(),r[t]=n,i.addEventListener("dispose",y)),a=n}return a.visible=i.visible,a.wireframe=i.wireframe,3===n?a.side=null!==i.shadowSide?i.shadowSide:i.side:a.side=null!==i.shadowSide?i.shadowSide:d[i.side],a.alphaMap=i.alphaMap,a.alphaTest=!0===i.alphaToCoverage?.5:i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=r),a}function y(e){for(let t in e.target.removeEventListener("dispose",y),c){let i=c[t],r=e.target.uuid;r in i&&(i[r].dispose(),delete i[r])}}this.render=function(i,l,h){if(!1===m.enabled||!1===m.autoUpdate&&!1===m.needsUpdate||0===i.length)return;2===i.type&&((0,n.R8M)("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),i.type=1);let c=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),y=e.state;y.setBlending(0),!0===y.buffers.depth.getReversed()?y.buffers.color.setClear(0,0,0,0):y.buffers.color.setClear(1,1,1,1),y.buffers.depth.setTest(!0),y.setScissorTest(!1);let x=v!==this.type;x&&l.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let c=0,d=i.length;c<d;c++){let d=i[c],f=d.shadow;if(void 0===f){(0,n.R8M)("WebGLShadowMap:",d,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;a.copy(f.mapSize);let m=f.getFrameExtents();if(a.multiply(m),s.copy(f.mapSize),(a.x>u||a.y>u)&&(a.x>u&&(s.x=Math.floor(u/m.x),a.x=s.x*m.x,f.mapSize.x=s.x),a.y>u&&(s.y=Math.floor(u/m.y),a.y=s.y*m.y,f.mapSize.y=s.y)),null===f.map||!0===x){if(null!==f.map&&(null!==f.map.depthTexture&&(f.map.depthTexture.dispose(),f.map.depthTexture=null),f.map.dispose()),3===this.type){if(d.isPointLight){(0,n.R8M)("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}f.map=new n.nWS(a.x,a.y,{format:1030,type:1016,minFilter:1006,magFilter:1006,generateMipmaps:!1}),f.map.texture.name=d.name+".shadowMap",f.map.depthTexture=new n.VCu(a.x,a.y,1015),f.map.depthTexture.name=d.name+".shadowMapDepth",f.map.depthTexture.format=1026,f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003}else{d.isPointLight?(f.map=new n.o6l(a.x),f.map.depthTexture=new n.Gc6(a.x,1014)):(f.map=new n.nWS(a.x,a.y),f.map.depthTexture=new n.VCu(a.x,a.y,1014)),f.map.depthTexture.name=d.name+".shadowMap",f.map.depthTexture.format=1026;let t=e.state.buffers.depth.getReversed();1===this.type?(f.map.depthTexture.compareFunction=t?518:515,f.map.depthTexture.minFilter=1006,f.map.depthTexture.magFilter=1006):(f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003)}f.camera.updateProjectionMatrix()}let v=f.map.isWebGLCubeRenderTarget?6:1;for(let i=0;i<v;i++){if(f.map.isWebGLCubeRenderTarget)e.setRenderTarget(f.map,i),e.clear();else{0===i&&(e.setRenderTarget(f.map),e.clear());let t=f.getViewport(i);o.set(s.x*t.x,s.y*t.y,s.x*t.z,s.y*t.w),y.viewport(o)}if(d.isPointLight){let e=f.camera,t=f.matrix,r=d.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),t_.setFromMatrixPosition(d.matrixWorld),e.position.copy(t_),tE.copy(e.position),tE.add(tb[i]),e.up.copy(ty[i]),e.lookAt(tE),e.updateMatrixWorld(),t.makeTranslation(-t_.x,-t_.y,-t_.z),tx.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),f._frustum.setFromProjectionMatrix(tx,e.coordinateSystem,e.reversedDepth)}else f.updateMatrices(d);r=f.getFrustum(),function i(n,a,s,o,l){if(!1===n.visible)return;if(n.layers.test(a.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===l)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);let i=t.update(n),r=n.material;if(Array.isArray(r)){let t=i.groups;for(let h=0,c=t.length;h<c;h++){let c=t[h],u=r[c.materialIndex];if(u&&u.visible){let t=b(n,u,o,l);n.onBeforeShadow(e,n,a,s,i,t,c),e.renderBufferDirect(s,null,i,t,n,c),n.onAfterShadow(e,n,a,s,i,t,c)}}}else if(r.visible){let t=b(n,r,o,l);n.onBeforeShadow(e,n,a,s,i,t,null),e.renderBufferDirect(s,null,i,t,n,null),n.onAfterShadow(e,n,a,s,i,t,null)}}let h=n.children;for(let e=0,t=h.length;e<t;e++)i(h[e],a,s,o,l)}(l,h,f.camera,d,this.type)}!0!==f.isPointLightShadow&&3===this.type&&function(i,r){let s=t.update(g);p.defines.VSM_SAMPLES!==i.blurSamples&&(p.defines.VSM_SAMPLES=i.blurSamples,A.defines.VSM_SAMPLES=i.blurSamples,p.needsUpdate=!0,A.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new n.nWS(a.x,a.y,{format:1030,type:1016})),p.uniforms.shadow_pass.value=i.map.depthTexture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(r,null,s,p,g,null),A.uniforms.shadow_pass.value=i.mapPass.texture,A.uniforms.resolution.value=i.mapSize,A.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(r,null,s,A,g,null)}(f,h),f.needsUpdate=!1}v=this.type,m.needsUpdate=!1,e.setRenderTarget(c,d,f)}}let tC={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3};function tM(e,t){let i=new function(){let t=!1,i=new n.IUQ,r=null,a=new n.IUQ(0,0,0,0);return{setMask:function(i){r===i||t||(e.colorMask(i,i,i,i),r=i)},setLocked:function(e){t=e},setClear:function(t,r,n,s,o){!0===o&&(t*=s,r*=s,n*=s),i.set(t,r,n,s),!1===a.equals(i)&&(e.clearColor(t,r,n,s),a.copy(i))},reset:function(){t=!1,r=null,a.set(-1,0,0,0)}}},r=new function(){let i=!1,r=!1,n=null,a=null,s=null;return{setReversed:function(e){if(r!==e){let i=t.get("EXT_clip_control");e?i.clipControlEXT(i.LOWER_LEFT_EXT,i.ZERO_TO_ONE_EXT):i.clipControlEXT(i.LOWER_LEFT_EXT,i.NEGATIVE_ONE_TO_ONE_EXT),r=e;let n=s;s=null,this.setClear(n)}},getReversed:function(){return r},setTest:function(t){t?Q(e.DEPTH_TEST):G(e.DEPTH_TEST)},setMask:function(t){n===t||i||(e.depthMask(t),n=t)},setFunc:function(t){if(r&&(t=tC[t]),a!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}a=t}},setLocked:function(e){i=e},setClear:function(t){s!==t&&(r&&(t=1-t),e.clearDepth(t),s=t)},reset:function(){i=!1,n=null,a=null,s=null,r=!1}}},a=new function(){let t=!1,i=null,r=null,n=null,a=null,s=null,o=null,l=null,h=null;return{setTest:function(i){t||(i?Q(e.STENCIL_TEST):G(e.STENCIL_TEST))},setMask:function(r){i===r||t||(e.stencilMask(r),i=r)},setFunc:function(t,i,s){(r!==t||n!==i||a!==s)&&(e.stencilFunc(t,i,s),r=t,n=i,a=s)},setOp:function(t,i,r){(s!==t||o!==i||l!==r)&&(e.stencilOp(t,i,r),s=t,o=i,l=r)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,i=null,r=null,n=null,a=null,s=null,o=null,l=null,h=null}}},s=new WeakMap,o=new WeakMap,l={},h={},c=new WeakMap,u=[],d=null,p=!1,A=null,f=null,g=null,m=null,v=null,b=null,y=null,x=new n.Q1f(0,0,0),_=0,E=!1,S=null,C=null,M=null,w=null,I=null,T=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),B=!1,R=e.getParameter(e.VERSION);-1!==R.indexOf("WebGL")?B=parseFloat(/^WebGL (\d)/.exec(R)[1])>=1:-1!==R.indexOf("OpenGL ES")&&(B=parseFloat(/^OpenGL ES (\d)/.exec(R)[1])>=2);let D=null,L={},P=e.getParameter(e.SCISSOR_BOX),U=e.getParameter(e.VIEWPORT),F=new n.IUQ().fromArray(P),N=new n.IUQ().fromArray(U);function O(t,i,r,n){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<r;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(i,0,e.RGBA,1,1,n,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(i+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let k={};function Q(t){!0!==l[t]&&(e.enable(t),l[t]=!0)}function G(t){!1!==l[t]&&(e.disable(t),l[t]=!1)}k[e.TEXTURE_2D]=O(e.TEXTURE_2D,e.TEXTURE_2D,1),k[e.TEXTURE_CUBE_MAP]=O(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),k[e.TEXTURE_2D_ARRAY]=O(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),k[e.TEXTURE_3D]=O(e.TEXTURE_3D,e.TEXTURE_3D,1,1),i.setClear(0,0,0,1),r.setClear(1),a.setClear(0),Q(e.DEPTH_TEST),r.setFunc(3),q(!1),W(1),Q(e.CULL_FACE),V(0);let H={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};H[103]=e.MIN,H[104]=e.MAX;let z={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function V(t,i,r,a,s,o,l,h,c,u){if(0===t){!0===p&&(G(e.BLEND),p=!1);return}if(!1===p&&(Q(e.BLEND),p=!0),5!==t){if(t!==A||u!==E){if((100!==f||100!==v)&&(e.blendEquation(e.FUNC_ADD),f=100,v=100),u)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:(0,n.z3S)("WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 3:(0,n.z3S)("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:(0,n.z3S)("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:(0,n.z3S)("WebGLState: Invalid blending: ",t)}g=null,m=null,b=null,y=null,x.set(0,0,0),_=0,A=t,E=u}return}s=s||i,o=o||r,l=l||a,(i!==f||s!==v)&&(e.blendEquationSeparate(H[i],H[s]),f=i,v=s),(r!==g||a!==m||o!==b||l!==y)&&(e.blendFuncSeparate(z[r],z[a],z[o],z[l]),g=r,m=a,b=o,y=l),(!1===h.equals(x)||c!==_)&&(e.blendColor(h.r,h.g,h.b,c),x.copy(h),_=c),A=t,E=!1}function q(t){S!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),S=t)}function W(t){0!==t?(Q(e.CULL_FACE),t!==C&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):G(e.CULL_FACE),C=t}function j(t,i,r){t?(Q(e.POLYGON_OFFSET_FILL),(w!==i||I!==r)&&(e.polygonOffset(i,r),w=i,I=r)):G(e.POLYGON_OFFSET_FILL)}return{buffers:{color:i,depth:r,stencil:a},enable:Q,disable:G,bindFramebuffer:function(t,i){return h[t]!==i&&(e.bindFramebuffer(t,i),h[t]=i,t===e.DRAW_FRAMEBUFFER&&(h[e.FRAMEBUFFER]=i),t===e.FRAMEBUFFER&&(h[e.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(t,i){let r=u,n=!1;if(t){void 0===(r=c.get(i))&&(r=[],c.set(i,r));let a=t.textures;if(r.length!==a.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,i=a.length;t<i;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=a.length,n=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,n=!0);n&&e.drawBuffers(r)},useProgram:function(t){return d!==t&&(e.useProgram(t),d=t,!0)},setBlending:V,setMaterial:function(t,n){2===t.side?G(e.CULL_FACE):Q(e.CULL_FACE);let s=1===t.side;n&&(s=!s),q(s),1===t.blending&&!1===t.transparent?V(0):V(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),r.setFunc(t.depthFunc),r.setTest(t.depthTest),r.setMask(t.depthWrite),i.setMask(t.colorWrite);let o=t.stencilWrite;a.setTest(o),o&&(a.setMask(t.stencilWriteMask),a.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),a.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),j(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?Q(e.SAMPLE_ALPHA_TO_COVERAGE):G(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:q,setCullFace:W,setLineWidth:function(t){t!==M&&(B&&e.lineWidth(t),M=t)},setPolygonOffset:j,setScissorTest:function(t){t?Q(e.SCISSOR_TEST):G(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+T-1),D!==t&&(e.activeTexture(t),D=t)},bindTexture:function(t,i,r){void 0===r&&(r=null===D?e.TEXTURE0+T-1:D);let n=L[r];void 0===n&&(n={type:void 0,texture:void 0},L[r]=n),(n.type!==t||n.texture!==i)&&(D!==r&&(e.activeTexture(r),D=r),e.bindTexture(t,i||k[t]),n.type=t,n.texture=i)},unbindTexture:function(){let t=L[D];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},updateUBOMapping:function(t,i){let r=o.get(i);void 0===r&&(r=new WeakMap,o.set(i,r));let n=r.get(t);void 0===n&&(n=e.getUniformBlockIndex(i,t.name),r.set(t,n))},uniformBlockBinding:function(t,i){let r=o.get(i).get(t);s.get(i)!==r&&(e.uniformBlockBinding(i,r,t.__bindingPointIndex),s.set(i,r))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(e){(0,n.z3S)("WebGLState:",e)}},scissor:function(t){!1===F.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),F.copy(t))},viewport:function(t){!1===N.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),N.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),r.setReversed(!1),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),l={},D=null,L={},h={},c=new WeakMap,u=[],d=null,p=!1,A=null,f=null,g=null,m=null,v=null,b=null,y=null,x=new n.Q1f(0,0,0),_=0,E=!1,S=null,C=null,M=null,w=null,I=null,F.set(0,0,e.canvas.width,e.canvas.height),N.set(0,0,e.canvas.width,e.canvas.height),i.reset(),r.reset(),a.reset()}}}function tw(e,t,i,r,a,s,o){let l,h=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,c="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),u=new n.I9Y,d=new WeakMap,p=new WeakMap,A=!1;try{A="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function f(e,t){return A?new OffscreenCanvas(e,t):(0,n.qq$)("canvas")}function g(e,t,i){let r=1,a=z(e);if((a.width>i||a.height>i)&&(r=i/Math.max(a.width,a.height)),r<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let i=Math.floor(r*a.width),s=Math.floor(r*a.height);void 0===l&&(l=f(i,s));let o=t?f(i,s):l;return o.width=i,o.height=s,o.getContext("2d").drawImage(e,0,0,i,s),(0,n.R8M)("WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+i+"x"+s+")."),o}else"data"in e&&(0,n.R8M)("WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").");return e}function m(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}function b(i,r,a,s,o=!1){if(null!==i){if(void 0!==e[i])return e[i];(0,n.R8M)("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let l=r;if(r===e.RED&&(a===e.FLOAT&&(l=e.R32F),a===e.HALF_FLOAT&&(l=e.R16F),a===e.UNSIGNED_BYTE&&(l=e.R8)),r===e.RED_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.R8UI),a===e.UNSIGNED_SHORT&&(l=e.R16UI),a===e.UNSIGNED_INT&&(l=e.R32UI),a===e.BYTE&&(l=e.R8I),a===e.SHORT&&(l=e.R16I),a===e.INT&&(l=e.R32I)),r===e.RG&&(a===e.FLOAT&&(l=e.RG32F),a===e.HALF_FLOAT&&(l=e.RG16F),a===e.UNSIGNED_BYTE&&(l=e.RG8)),r===e.RG_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RG8UI),a===e.UNSIGNED_SHORT&&(l=e.RG16UI),a===e.UNSIGNED_INT&&(l=e.RG32UI),a===e.BYTE&&(l=e.RG8I),a===e.SHORT&&(l=e.RG16I),a===e.INT&&(l=e.RG32I)),r===e.RGB_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RGB8UI),a===e.UNSIGNED_SHORT&&(l=e.RGB16UI),a===e.UNSIGNED_INT&&(l=e.RGB32UI),a===e.BYTE&&(l=e.RGB8I),a===e.SHORT&&(l=e.RGB16I),a===e.INT&&(l=e.RGB32I)),r===e.RGBA_INTEGER&&(a===e.UNSIGNED_BYTE&&(l=e.RGBA8UI),a===e.UNSIGNED_SHORT&&(l=e.RGBA16UI),a===e.UNSIGNED_INT&&(l=e.RGBA32UI),a===e.BYTE&&(l=e.RGBA8I),a===e.SHORT&&(l=e.RGBA16I),a===e.INT&&(l=e.RGBA32I)),r===e.RGB&&(a===e.UNSIGNED_INT_5_9_9_9_REV&&(l=e.RGB9_E5),a===e.UNSIGNED_INT_10F_11F_11F_REV&&(l=e.R11F_G11F_B10F)),r===e.RGBA){let t=o?"linear":n.ppV.getTransfer(s);a===e.FLOAT&&(l=e.RGBA32F),a===e.HALF_FLOAT&&(l=e.RGBA16F),a===e.UNSIGNED_BYTE&&(l="srgb"===t?e.SRGB8_ALPHA8:e.RGBA8),a===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),a===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)}return(l===e.R16F||l===e.R32F||l===e.RG16F||l===e.RG32F||l===e.RGBA16F||l===e.RGBA32F)&&t.get("EXT_color_buffer_float"),l}function y(t,i){let r;return t?null===i||1014===i||1020===i?r=e.DEPTH24_STENCIL8:1015===i?r=e.DEPTH32F_STENCIL8:1012===i&&(r=e.DEPTH24_STENCIL8,(0,n.R8M)("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||1014===i||1020===i?r=e.DEPTH_COMPONENT24:1015===i?r=e.DEPTH_COMPONENT32F:1012===i&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return!0===m(e)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function _(e){let t=e.target;t.removeEventListener("dispose",_),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let i=e.source,n=p.get(i);if(n){let r=n[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&S(e),0===Object.keys(n).length&&p.delete(i)}r.remove(e)}(t),t.isVideoTexture&&d.delete(t)}function E(t){let i=t.target;i.removeEventListener("dispose",E),function(t){let i=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(i.__webglFramebuffer[t]))for(let r=0;r<i.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(i.__webglFramebuffer[t][r]);else e.deleteFramebuffer(i.__webglFramebuffer[t]);i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t])}else{if(Array.isArray(i.__webglFramebuffer))for(let t=0;t<i.__webglFramebuffer.length;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]);else e.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let t=0;t<i.__webglColorRenderbuffer.length;t++)i.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[t]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}let n=t.textures;for(let t=0,i=n.length;t<i;t++){let i=r.get(n[t]);i.__webglTexture&&(e.deleteTexture(i.__webglTexture),o.memory.textures--),r.remove(n[t])}r.remove(t)}(i)}function S(t){let i=r.get(t);e.deleteTexture(i.__webglTexture);let n=t.source,a=p.get(n);delete a[i.__cacheKey],o.memory.textures--}let C=0;function M(t,a){var s;let l,h=r.get(t);if(t.isVideoTexture&&(s=t,l=o.render.frame,d.get(s)!==l&&(d.set(s,l),s.update())),!1===t.isRenderTargetTexture&&!0!==t.isExternalTexture&&t.version>0&&h.__version!==t.version){let e=t.image;if(null===e)(0,n.R8M)("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(h,t,a);(0,n.R8M)("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(h.__webglTexture=t.sourceTexture?t.sourceTexture:null);i.bindTexture(e.TEXTURE_2D,h.__webglTexture,e.TEXTURE0+a)}let w={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},I={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},T={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function B(i,s){if((1015===s.type&&!1===t.has("OES_texture_float_linear")&&(1006===s.magFilter||1007===s.magFilter||1005===s.magFilter||1008===s.magFilter||1006===s.minFilter||1007===s.minFilter||1005===s.minFilter||1008===s.minFilter)&&(0,n.R8M)("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(i,e.TEXTURE_WRAP_S,w[s.wrapS]),e.texParameteri(i,e.TEXTURE_WRAP_T,w[s.wrapT]),(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY)&&e.texParameteri(i,e.TEXTURE_WRAP_R,w[s.wrapR]),e.texParameteri(i,e.TEXTURE_MAG_FILTER,I[s.magFilter]),e.texParameteri(i,e.TEXTURE_MIN_FILTER,I[s.minFilter]),s.compareFunction&&(e.texParameteri(i,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(i,e.TEXTURE_COMPARE_FUNC,T[s.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&1003!==s.magFilter&&(1005===s.minFilter||1008===s.minFilter)&&(1015!==s.type||!1!==t.has("OES_texture_float_linear"))&&(s.anisotropy>1||r.get(s).__currentAnisotropy)){let n=t.get("EXT_texture_filter_anisotropic");e.texParameterf(i,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,a.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy}}function R(t,i){let r,n=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",_));let a=i.source,s=p.get(a);void 0===s&&(s={},p.set(a,s));let l=((r=[]).push(i.wrapS),r.push(i.wrapT),r.push(i.wrapR||0),r.push(i.magFilter),r.push(i.minFilter),r.push(i.anisotropy),r.push(i.internalFormat),r.push(i.format),r.push(i.type),r.push(i.generateMipmaps),r.push(i.premultiplyAlpha),r.push(i.flipY),r.push(i.unpackAlignment),r.push(i.colorSpace),r.join());if(l!==t.__cacheKey){void 0===s[l]&&(s[l]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,n=!0),s[l].usedTimes++;let r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&S(i)),t.__cacheKey=l,t.__webglTexture=s[l].texture}return n}function D(e,t,i){return Math.floor(Math.floor(e/i)/t)}function L(t,o,l){let h=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(h=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(h=e.TEXTURE_3D);let c=R(t,o),u=o.source;i.bindTexture(h,t.__webglTexture,e.TEXTURE0+l);let d=r.get(u);if(u.version!==d.__version||!0===c){let t;i.activeTexture(e.TEXTURE0+l);let r=n.ppV.getPrimaries(n.ppV.workingColorSpace),p=""===o.colorSpace?null:n.ppV.getPrimaries(o.colorSpace),A=""===o.colorSpace||r===p?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,A);let f=g(o.image,!1,a.maxTextureSize);f=H(o,f);let _=s.convert(o.format,o.colorSpace),E=s.convert(o.type),S=b(o.internalFormat,_,E,o.colorSpace,o.isVideoTexture);B(h,o);let C=o.mipmaps,M=!0!==o.isVideoTexture,w=void 0===d.__version||!0===c,I=u.dataReady,T=x(o,f);if(o.isDepthTexture)S=y(1027===o.format,o.type),w&&(M?i.texStorage2D(e.TEXTURE_2D,1,S,f.width,f.height):i.texImage2D(e.TEXTURE_2D,0,S,f.width,f.height,0,_,E,null));else if(o.isDataTexture)if(C.length>0){M&&w&&i.texStorage2D(e.TEXTURE_2D,T,S,C[0].width,C[0].height);for(let r=0,n=C.length;r<n;r++)t=C[r],M?I&&i.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,_,E,t.data):i.texImage2D(e.TEXTURE_2D,r,S,t.width,t.height,0,_,E,t.data);o.generateMipmaps=!1}else M?(w&&i.texStorage2D(e.TEXTURE_2D,T,S,f.width,f.height),I&&function(t,r,n,a){let s=t.updateRanges;if(0===s.length)i.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,n,a,r.data);else{s.sort((e,t)=>e.start-t.start);let o=0;for(let e=1;e<s.length;e++){let t=s[o],i=s[e],n=t.start+t.count,a=D(i.start,r.width,4),l=D(t.start,r.width,4);i.start<=n+1&&a===l&&D(i.start+i.count-1,r.width,4)===a?t.count=Math.max(t.count,i.start+i.count-t.start):s[++o]=i}s.length=o+1;let l=e.getParameter(e.UNPACK_ROW_LENGTH),h=e.getParameter(e.UNPACK_SKIP_PIXELS),c=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let t=0,o=s.length;t<o;t++){let o=s[t],l=Math.floor(o.start/4),h=Math.ceil(o.count/4),c=l%r.width,u=Math.floor(l/r.width);e.pixelStorei(e.UNPACK_SKIP_PIXELS,c),e.pixelStorei(e.UNPACK_SKIP_ROWS,u),i.texSubImage2D(e.TEXTURE_2D,0,c,u,h,1,n,a,r.data)}t.clearUpdateRanges(),e.pixelStorei(e.UNPACK_ROW_LENGTH,l),e.pixelStorei(e.UNPACK_SKIP_PIXELS,h),e.pixelStorei(e.UNPACK_SKIP_ROWS,c)}}(o,f,_,E)):i.texImage2D(e.TEXTURE_2D,0,S,f.width,f.height,0,_,E,f.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){M&&w&&i.texStorage3D(e.TEXTURE_2D_ARRAY,T,S,C[0].width,C[0].height,f.depth);for(let r=0,a=C.length;r<a;r++)if(t=C[r],1023!==o.format)if(null!==_)if(M){if(I)if(o.layerUpdates.size>0){let a=(0,n.Nex)(t.width,t.height,o.format,o.type);for(let n of o.layerUpdates){let s=t.data.subarray(n*a/t.data.BYTES_PER_ELEMENT,(n+1)*a/t.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,n,t.width,t.height,1,_,s)}o.clearLayerUpdates()}else i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,_,t.data)}else i.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,S,t.width,t.height,f.depth,0,t.data,0,0);else(0,n.R8M)("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else M?I&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,f.depth,_,E,t.data):i.texImage3D(e.TEXTURE_2D_ARRAY,r,S,t.width,t.height,f.depth,0,_,E,t.data)}else{M&&w&&i.texStorage2D(e.TEXTURE_2D,T,S,C[0].width,C[0].height);for(let r=0,a=C.length;r<a;r++)t=C[r],1023!==o.format?null!==_?M?I&&i.compressedTexSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,_,t.data):i.compressedTexImage2D(e.TEXTURE_2D,r,S,t.width,t.height,0,t.data):(0,n.R8M)("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?I&&i.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,_,E,t.data):i.texImage2D(e.TEXTURE_2D,r,S,t.width,t.height,0,_,E,t.data)}else if(o.isDataArrayTexture)if(M){if(w&&i.texStorage3D(e.TEXTURE_2D_ARRAY,T,S,f.width,f.height,f.depth),I)if(o.layerUpdates.size>0){let t=(0,n.Nex)(f.width,f.height,o.format,o.type);for(let r of o.layerUpdates){let n=f.data.subarray(r*t/f.data.BYTES_PER_ELEMENT,(r+1)*t/f.data.BYTES_PER_ELEMENT);i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,f.width,f.height,1,_,E,n)}o.clearLayerUpdates()}else i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,_,E,f.data)}else i.texImage3D(e.TEXTURE_2D_ARRAY,0,S,f.width,f.height,f.depth,0,_,E,f.data);else if(o.isData3DTexture)M?(w&&i.texStorage3D(e.TEXTURE_3D,T,S,f.width,f.height,f.depth),I&&i.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,_,E,f.data)):i.texImage3D(e.TEXTURE_3D,0,S,f.width,f.height,f.depth,0,_,E,f.data);else if(o.isFramebufferTexture){if(w)if(M)i.texStorage2D(e.TEXTURE_2D,T,S,f.width,f.height);else{let t=f.width,r=f.height;for(let n=0;n<T;n++)i.texImage2D(e.TEXTURE_2D,n,S,t,r,0,_,E,null),t>>=1,r>>=1}}else if(C.length>0){if(M&&w){let t=z(C[0]);i.texStorage2D(e.TEXTURE_2D,T,S,t.width,t.height)}for(let r=0,n=C.length;r<n;r++)t=C[r],M?I&&i.texSubImage2D(e.TEXTURE_2D,r,0,0,_,E,t):i.texImage2D(e.TEXTURE_2D,r,S,_,E,t);o.generateMipmaps=!1}else if(M){if(w){let t=z(f);i.texStorage2D(e.TEXTURE_2D,T,S,t.width,t.height)}I&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,_,E,f)}else i.texImage2D(e.TEXTURE_2D,0,S,_,E,f);m(o)&&v(h),d.__version=u.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function P(t,n,a,o,l,c){let u=s.convert(a.format,a.colorSpace),d=s.convert(a.type),p=b(a.internalFormat,u,d,a.colorSpace),A=r.get(n),f=r.get(a);if(f.__renderTarget=n,!A.__hasExternalTextures){let t=Math.max(1,n.width>>c),r=Math.max(1,n.height>>c);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?i.texImage3D(l,c,p,t,r,n.depth,0,u,d,null):i.texImage2D(l,c,p,t,r,0,u,d,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),G(n)?h.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,l,f.__webglTexture,0,Q(n)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,l,f.__webglTexture,c),i.bindFramebuffer(e.FRAMEBUFFER,null)}function U(t,i,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer){let n=i.depthTexture,a=n&&n.isDepthTexture?n.type:null,s=y(i.stencilBuffer,a),o=i.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;G(i)?h.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Q(i),s,i.width,i.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,Q(i),s,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,s,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=i.textures;for(let n=0;n<t.length;n++){let a=t[n],o=s.convert(a.format,a.colorSpace),l=s.convert(a.type),c=b(a.internalFormat,o,l,a.colorSpace);G(i)?h.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,Q(i),c,i.width,i.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,Q(i),c,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,c,i.width,i.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function F(t,n,a){let o=!0===n.isWebGLCubeRenderTarget;if(i.bindFramebuffer(e.FRAMEBUFFER,t),!(n.depthTexture&&n.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let l=r.get(n.depthTexture);if(l.__renderTarget=n,l.__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),o){if(void 0===l.__webglInit&&(l.__webglInit=!0,n.depthTexture.addEventListener("dispose",_)),void 0===l.__webglTexture){let t;l.__webglTexture=e.createTexture(),i.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),B(e.TEXTURE_CUBE_MAP,n.depthTexture);let r=s.convert(n.depthTexture.format),a=s.convert(n.depthTexture.type);1026===n.depthTexture.format?t=e.DEPTH_COMPONENT24:1027===n.depthTexture.format&&(t=e.DEPTH24_STENCIL8);for(let i=0;i<6;i++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t,n.width,n.height,0,r,a,null)}}else M(n.depthTexture,0);let c=l.__webglTexture,u=Q(n),d=o?e.TEXTURE_CUBE_MAP_POSITIVE_X+a:e.TEXTURE_2D,p=1027===n.depthTexture.format?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(1026===n.depthTexture.format)G(n)?h.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,d,c,0,u):e.framebufferTexture2D(e.FRAMEBUFFER,p,d,c,0);else if(1027===n.depthTexture.format)G(n)?h.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,d,c,0,u):e.framebufferTexture2D(e.FRAMEBUFFER,p,d,c,0);else throw Error("Unknown depthTexture format")}function N(t){let n=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(n.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(n.__depthDisposeCallback&&n.__depthDisposeCallback(),e){let t=()=>{delete n.__boundDepthTexture,delete n.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),n.__depthDisposeCallback=t}n.__boundDepthTexture=e}if(t.depthTexture&&!n.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)F(n.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?F(n.__webglFramebuffer[0],t,0):F(n.__webglFramebuffer,t,0)}else if(a){n.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[r]),void 0===n.__webglDepthbuffer[r])n.__webglDepthbuffer[r]=e.createRenderbuffer(),U(n.__webglDepthbuffer[r],t,!1);else{let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=n.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[0]):i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),void 0===n.__webglDepthbuffer)n.__webglDepthbuffer=e.createRenderbuffer(),U(n.__webglDepthbuffer,t,!1);else{let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=n.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,r)}}i.bindFramebuffer(e.FRAMEBUFFER,null)}let O=[],k=[];function Q(e){return Math.min(a.maxSamples,e.samples)}function G(e){let i=r.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function H(e,t){let i=e.colorSpace,r=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||i!==n.Zr2&&""!==i&&("srgb"===n.ppV.getTransfer(i)?(1023!==r||1009!==a)&&(0,n.R8M)("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):(0,n.z3S)("WebGLTextures: Unsupported texture color space:",i)),t}function z(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(u.width=e.naturalWidth||e.width,u.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(u.width=e.displayWidth,u.height=e.displayHeight):(u.width=e.width,u.height=e.height),u}this.allocateTextureUnit=function(){let e=C;return e>=a.maxTextures&&(0,n.R8M)("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+a.maxTextures),C+=1,e},this.resetTextureUnits=function(){C=0},this.setTexture2D=M,this.setTexture2DArray=function(t,n){let a=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?L(a,t,n):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),i.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+n))},this.setTexture3D=function(t,n){let a=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?L(a,t,n):i.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+n)},this.setTextureCube=function(t,o){let l=r.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&l.__version!==t.version?function(t,o,l){if(6!==o.image.length)return;let h=R(t,o),c=o.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+l);let u=r.get(c);if(c.version!==u.__version||!0===h){let t;i.activeTexture(e.TEXTURE0+l);let r=n.ppV.getPrimaries(n.ppV.workingColorSpace),d=""===o.colorSpace?null:n.ppV.getPrimaries(o.colorSpace),p=""===o.colorSpace||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let A=o.isCompressedTexture||o.image[0].isCompressedTexture,f=o.image[0]&&o.image[0].isDataTexture,y=[];for(let e=0;e<6;e++)A||f?y[e]=f?o.image[e].image:o.image[e]:y[e]=g(o.image[e],!0,a.maxCubemapSize),y[e]=H(o,y[e]);let _=y[0],E=s.convert(o.format,o.colorSpace),S=s.convert(o.type),C=b(o.internalFormat,E,S,o.colorSpace),M=!0!==o.isVideoTexture,w=void 0===u.__version||!0===h,I=c.dataReady,T=x(o,_);if(B(e.TEXTURE_CUBE_MAP,o),A){M&&w&&i.texStorage2D(e.TEXTURE_CUBE_MAP,T,C,_.width,_.height);for(let r=0;r<6;r++){t=y[r].mipmaps;for(let a=0;a<t.length;a++){let s=t[a];1023!==o.format?null!==E?M?I&&i.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a,0,0,s.width,s.height,E,s.data):i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a,C,s.width,s.height,0,s.data):(0,n.R8M)("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):M?I&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a,0,0,s.width,s.height,E,S,s.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a,C,s.width,s.height,0,E,S,s.data)}}}else{if(t=o.mipmaps,M&&w){t.length>0&&T++;let r=z(y[0]);i.texStorage2D(e.TEXTURE_CUBE_MAP,T,C,r.width,r.height)}for(let r=0;r<6;r++)if(f){M?I&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,y[r].width,y[r].height,E,S,y[r].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,C,y[r].width,y[r].height,0,E,S,y[r].data);for(let n=0;n<t.length;n++){let a=t[n].image[r].image;M?I&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,0,0,a.width,a.height,E,S,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,C,a.width,a.height,0,E,S,a.data)}}else{M?I&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,E,S,y[r]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,C,E,S,y[r]);for(let n=0;n<t.length;n++){let a=t[n];M?I&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,0,0,E,S,a.image[r]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,C,E,S,a.image[r])}}}m(o)&&v(e.TEXTURE_CUBE_MAP),u.__version=c.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}(l,t,o):i.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture,e.TEXTURE0+o)},this.rebindTextures=function(t,i,n){let a=r.get(t);void 0!==i&&P(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==n&&N(t)},this.setupRenderTarget=function(t){let n=t.texture,a=r.get(t),l=r.get(n);t.addEventListener("dispose",E);let h=t.textures,c=!0===t.isWebGLCubeRenderTarget,u=h.length>1;if(!u&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=n.version,o.memory.textures++),c){a.__webglFramebuffer=[];for(let t=0;t<6;t++)if(n.mipmaps&&n.mipmaps.length>0){a.__webglFramebuffer[t]=[];for(let i=0;i<n.mipmaps.length;i++)a.__webglFramebuffer[t][i]=e.createFramebuffer()}else a.__webglFramebuffer[t]=e.createFramebuffer()}else{if(n.mipmaps&&n.mipmaps.length>0){a.__webglFramebuffer=[];for(let t=0;t<n.mipmaps.length;t++)a.__webglFramebuffer[t]=e.createFramebuffer()}else a.__webglFramebuffer=e.createFramebuffer();if(u)for(let t=0,i=h.length;t<i;t++){let i=r.get(h[t]);void 0===i.__webglTexture&&(i.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&!1===G(t)){a.__webglMultisampledFramebuffer=e.createFramebuffer(),a.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let i=0;i<h.length;i++){let r=h[i];a.__webglColorRenderbuffer[i]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,a.__webglColorRenderbuffer[i]);let n=s.convert(r.format,r.colorSpace),o=s.convert(r.type),l=b(r.internalFormat,n,o,r.colorSpace,!0===t.isXRRenderTarget),c=Q(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,c,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+i,e.RENDERBUFFER,a.__webglColorRenderbuffer[i])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(a.__webglDepthRenderbuffer=e.createRenderbuffer(),U(a.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){i.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),B(e.TEXTURE_CUBE_MAP,n);for(let i=0;i<6;i++)if(n.mipmaps&&n.mipmaps.length>0)for(let r=0;r<n.mipmaps.length;r++)P(a.__webglFramebuffer[i][r],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r);else P(a.__webglFramebuffer[i],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);m(n)&&v(e.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){for(let n=0,s=h.length;n<s;n++){let s=h[n],o=r.get(s),l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(l,o.__webglTexture),B(l,s),P(a.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0+n,l,0),m(s)&&v(l)}i.unbindTexture()}else{let r=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(r=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(r,l.__webglTexture),B(r,n),n.mipmaps&&n.mipmaps.length>0)for(let i=0;i<n.mipmaps.length;i++)P(a.__webglFramebuffer[i],t,n,e.COLOR_ATTACHMENT0,r,i);else P(a.__webglFramebuffer,t,n,e.COLOR_ATTACHMENT0,r,0);m(n)&&v(r),i.unbindTexture()}t.depthBuffer&&N(t)},this.updateRenderTargetMipmap=function(t){let n=t.textures;for(let a=0,s=n.length;a<s;a++){let s=n[a];if(m(s)){let n=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D,a=r.get(s).__webglTexture;i.bindTexture(n,a),v(n),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===G(t)){let n=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=r.get(t),u=n.length>1;if(u)for(let t=0;t<n.length;t++)i.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),i.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);i.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer);let d=t.texture.mipmaps;d&&d.length>0?i.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer[0]):i.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let i=0;i<n.length;i++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),u){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[i]);let t=r.get(n[i]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===c&&(O.length=0,k.length=0,O.push(e.COLOR_ATTACHMENT0+i),t.depthBuffer&&!1===t.resolveDepthBuffer&&(O.push(l),k.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,k)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,O))}if(i.bindFramebuffer(e.READ_FRAMEBUFFER,null),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),u)for(let t=0;t<n.length;t++){i.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);let a=r.get(n[t]).__webglTexture;i.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}i.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&c){let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[i])}}},this.setupDepthRenderbuffer=N,this.setupFrameBufferTexture=P,this.useMultisampledRTT=G,this.isReversedDepthBuffer=function(){return i.buffers.depth.getReversed()}}function tI(e,t){return{convert:function(i,r=""){let a,s=n.ppV.getTransfer(r);if(1009===i)return e.UNSIGNED_BYTE;if(1017===i)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===i)return e.UNSIGNED_INT_5_9_9_9_REV;if(35899===i)return e.UNSIGNED_INT_10F_11F_11F_REV;if(1010===i)return e.BYTE;if(1011===i)return e.SHORT;if(1012===i)return e.UNSIGNED_SHORT;if(1013===i)return e.INT;if(1014===i)return e.UNSIGNED_INT;if(1015===i)return e.FLOAT;if(1016===i)return e.HALF_FLOAT;if(1021===i)return e.ALPHA;if(1022===i)return e.RGB;if(1023===i)return e.RGBA;if(1026===i)return e.DEPTH_COMPONENT;if(1027===i)return e.DEPTH_STENCIL;if(1028===i)return e.RED;if(1029===i)return e.RED_INTEGER;if(1030===i)return e.RG;if(1031===i)return e.RG_INTEGER;if(1033===i)return e.RGBA_INTEGER;if(33776===i||33777===i||33778===i||33779===i)if("srgb"===s){if(null===(a=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===i)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(a=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===i)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(null===(a=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===i)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i||37492===i||37496===i||37488===i||37489===i||37490===i||37491===i){if(null===(a=t.get("WEBGL_compressed_texture_etc")))return null;if(36196===i||37492===i)return"srgb"===s?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC;if(37488===i)return a.COMPRESSED_R11_EAC;if(37489===i)return a.COMPRESSED_SIGNED_R11_EAC;if(37490===i)return a.COMPRESSED_RG11_EAC;if(37491===i)return a.COMPRESSED_SIGNED_RG11_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(null===(a=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return"srgb"===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i||36494===i||36495===i){if(null===(a=t.get("EXT_texture_compression_bptc")))return null;if(36492===i)return"srgb"===s?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===i)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===i)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===i||36284===i||36285===i||36286===i){if(null===(a=t.get("EXT_texture_compression_rgtc")))return null;if(36283===i)return a.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===i?e.UNSIGNED_INT_24_8:void 0!==e[i]?e[i]:null}}}let tT=`
|
|
831
|
+
void main() {
|
|
832
|
+
|
|
833
|
+
gl_Position = vec4( position, 1.0 );
|
|
834
|
+
|
|
835
|
+
}`,tB=`
|
|
836
|
+
uniform sampler2DArray depthColor;
|
|
837
|
+
uniform float depthWidth;
|
|
838
|
+
uniform float depthHeight;
|
|
839
|
+
|
|
840
|
+
void main() {
|
|
841
|
+
|
|
842
|
+
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
|
|
843
|
+
|
|
844
|
+
if ( coord.x >= 1.0 ) {
|
|
845
|
+
|
|
846
|
+
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
|
|
847
|
+
|
|
848
|
+
} else {
|
|
849
|
+
|
|
850
|
+
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
|
|
851
|
+
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
}`;class tR{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){let i=new n.rjZ(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,i=new n.BKk({vertexShader:tT,fragmentShader:tB,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new n.eaF(new n.bdM(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class tD extends n.Qev{constructor(e,t){super();const i=this;let r=null,s=1,o=null,l="local-floor",h=1,c=null,u=null,d=null,p=null,A=null,f=null;const g="u">typeof XRWebGLBinding,m=new tR,v={},b=t.getContextAttributes();let y=null,x=null;const _=[],E=[],S=new n.I9Y;let C=null;const M=new n.ubm;M.viewport=new n.IUQ;const w=new n.ubm;w.viewport=new n.IUQ;const I=[M,w],T=new n.nZQ;let B=null,R=null;function D(e){let t=E.indexOf(e.inputSource);if(-1===t)return;let i=_[t];void 0!==i&&(i.update(e.inputSource,e.frame,c||o),i.dispatchEvent({type:e.type,data:e.inputSource}))}function L(){r.removeEventListener("select",D),r.removeEventListener("selectstart",D),r.removeEventListener("selectend",D),r.removeEventListener("squeeze",D),r.removeEventListener("squeezestart",D),r.removeEventListener("squeezeend",D),r.removeEventListener("end",L),r.removeEventListener("inputsourceschange",P);for(let e=0;e<_.length;e++){let t=E[e];null!==t&&(E[e]=null,_[e].disconnect(t))}for(let e in B=null,R=null,m.reset(),v)delete v[e];e.setRenderTarget(y),A=null,p=null,d=null,r=null,x=null,k.stop(),i.isPresenting=!1,e.setPixelRatio(C),e.setSize(S.width,S.height,!1),i.dispatchEvent({type:"sessionend"})}function P(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],r=E.indexOf(i);r>=0&&(E[r]=null,_[r].disconnect(i))}for(let t=0;t<e.added.length;t++){let i=e.added[t],r=E.indexOf(i);if(-1===r){for(let e=0;e<_.length;e++)if(e>=E.length){E.push(i),r=e;break}else if(null===E[e]){E[e]=i,r=e;break}if(-1===r)break}let n=_[r];n&&n.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=_[e];return void 0===t&&(t=new n.R3r,_[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=_[e];return void 0===t&&(t=new n.R3r,_[e]=t),t.getGripSpace()},this.getHand=function(e){let t=_[e];return void 0===t&&(t=new n.R3r,_[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){s=e,!0===i.isPresenting&&(0,n.R8M)("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){l=e,!0===i.isPresenting&&(0,n.R8M)("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return null!==p?p:A},this.getBinding=function(){return null===d&&g&&(d=new XRWebGLBinding(r,t)),d},this.getFrame=function(){return f},this.getSession=function(){return r},this.setSession=async function(a){if(null!==(r=a)){if(y=e.getRenderTarget(),r.addEventListener("select",D),r.addEventListener("selectstart",D),r.addEventListener("selectend",D),r.addEventListener("squeeze",D),r.addEventListener("squeezestart",D),r.addEventListener("squeezeend",D),r.addEventListener("end",L),r.addEventListener("inputsourceschange",P),!0!==b.xrCompatible&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(S),g&&"createProjectionLayer"in XRWebGLBinding.prototype){let i=null,a=null,o=null;b.depth&&(o=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,i=b.stencil?1027:1026,a=b.stencil?1020:1014);let l={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:s};p=(d=this.getBinding()).createProjectionLayer(l),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),x=new n.nWS(p.textureWidth,p.textureHeight,{format:1023,type:1009,depthTexture:new n.VCu(p.textureWidth,p.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:4*!!b.antialias,resolveDepthBuffer:!1===p.ignoreDepthValues,resolveStencilBuffer:!1===p.ignoreDepthValues})}else{let i={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};A=new XRWebGLLayer(r,t,i),r.updateRenderState({baseLayer:A}),e.setPixelRatio(1),e.setSize(A.framebufferWidth,A.framebufferHeight,!1),x=new n.nWS(A.framebufferWidth,A.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:!1===A.ignoreDepthValues,resolveStencilBuffer:!1===A.ignoreDepthValues})}x.isXRRenderTarget=!0,this.setFoveation(h),c=null,o=await r.requestReferenceSpace(l),k.setContext(r),k.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const U=new n.Pq0,F=new n.Pq0;function N(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,i,a;if(null===r)return;let s=e.near,o=e.far;null!==m.texture&&(m.depthNear>0&&(s=m.depthNear),m.depthFar>0&&(o=m.depthFar)),T.near=w.near=M.near=s,T.far=w.far=M.far=o,(B!==T.near||R!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),B=T.near,R=T.far),T.layers.mask=6|e.layers.mask,M.layers.mask=3&T.layers.mask,w.layers.mask=5&T.layers.mask;let l=e.parent,h=T.cameras;N(T,l);for(let e=0;e<h.length;e++)N(h[e],l);2===h.length?function(e,t,i){U.setFromMatrixPosition(t.matrixWorld),F.setFromMatrixPosition(i.matrixWorld);let r=U.distanceTo(F),n=t.projectionMatrix.elements,a=i.projectionMatrix.elements,s=n[14]/(n[10]-1),o=n[14]/(n[10]+1),l=(n[9]+1)/n[5],h=(n[9]-1)/n[5],c=(n[8]-1)/n[0],u=(a[8]+1)/a[0],d=r/(-c+u),p=-(d*c);if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===n[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=s+d,i=o+d;e.projectionMatrix.makePerspective(s*c-p,s*u+(r-p),l*o/i*t,h*o/i*t,t,i),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(T,M,w):T.projectionMatrix.copy(M.projectionMatrix),t=e,i=T,null===(a=l)?t.matrix.copy(i.matrixWorld):(t.matrix.copy(a.matrixWorld),t.matrix.invert(),t.matrix.multiply(i.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(i.projectionMatrix),t.projectionMatrixInverse.copy(i.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*n.a55*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return T},this.getFoveation=function(){if(null!==p||null!==A)return h},this.setFoveation=function(e){h=e,null!==p&&(p.fixedFoveation=e),null!==A&&void 0!==A.fixedFoveation&&(A.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(T)},this.getCameraTexture=function(e){return v[e]};let O=null;const k=new a;k.setAnimationLoop(function(t,a){if(u=a.getViewerPose(c||o),f=a,null!==u){let t=u.views;null!==A&&(e.setRenderTargetFramebuffer(x,A.framebuffer),e.setRenderTarget(x));let a=!1;t.length!==T.cameras.length&&(T.cameras.length=0,a=!0);for(let i=0;i<t.length;i++){let r=t[i],s=null;if(null!==A)s=A.getViewport(r);else{let t=d.getViewSubImage(p,r);s=t.viewport,0===i&&(e.setRenderTargetTextures(x,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(x))}let o=I[i];void 0===o&&((o=new n.ubm).layers.enable(i),o.viewport=new n.IUQ,I[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(s.x,s.y,s.width,s.height),0===i&&(T.matrix.copy(o.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),!0===a&&T.cameras.push(o)}let s=r.enabledFeatures;if(s&&s.includes("depth-sensing")&&"gpu-optimized"==r.depthUsage&&g){let e=(d=i.getBinding()).getDepthInformation(t[0]);e&&e.isValid&&e.texture&&m.init(e,r.renderState)}if(s&&s.includes("camera-access")&&g){e.state.unbindTexture(),d=i.getBinding();for(let e=0;e<t.length;e++){let i=t[e].camera;if(i){let e=v[i];e||(e=new n.rjZ,v[i]=e);let t=d.getCameraImage(i);e.sourceTexture=t}}}}for(let e=0;e<_.length;e++){let t=E[e],i=_[e];null!==t&&void 0!==i&&i.update(t,a,c||o)}O&&O(t,a),a.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:a}),f=null}),this.setAnimationLoop=function(e){O=e},this.dispose=function(){}}}let tL=new n.O9p,tP=new n.kn4;function tU(e,t){function i(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function r(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,i(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,i(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,i(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,1===r.side&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,i(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),1===r.side&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,i(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,i(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,i(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let n=t.get(r),a=n.envMap,s=n.envMapRotation;a&&(e.envMap.value=a,tL.copy(s),tL.x*=-1,tL.y*=-1,tL.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(tL.y*=-1,tL.z*=-1),e.envMapRotation.value.setFromMatrix4(tP.makeRotationFromEuler(tL)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,i(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,i(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,(0,n._Ut)(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,n,a,s,o){var l,h,c,u,d,p,A,f,g,m,v,b,y,x,_,E,S,C,M,w,I,T,B;let R;n.isMeshBasicMaterial||n.isMeshLambertMaterial?r(e,n):n.isMeshToonMaterial?(r(e,n),l=e,(h=n).gradientMap&&(l.gradientMap.value=h.gradientMap)):n.isMeshPhongMaterial?(r(e,n),c=e,u=n,c.specular.value.copy(u.specular),c.shininess.value=Math.max(u.shininess,1e-4)):n.isMeshStandardMaterial?(r(e,n),d=e,p=n,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,i(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,i(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),n.isMeshPhysicalMaterial&&(A=e,f=n,g=o,A.ior.value=f.ior,f.sheen>0&&(A.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),A.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(A.sheenColorMap.value=f.sheenColorMap,i(f.sheenColorMap,A.sheenColorMapTransform)),f.sheenRoughnessMap&&(A.sheenRoughnessMap.value=f.sheenRoughnessMap,i(f.sheenRoughnessMap,A.sheenRoughnessMapTransform))),f.clearcoat>0&&(A.clearcoat.value=f.clearcoat,A.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(A.clearcoatMap.value=f.clearcoatMap,i(f.clearcoatMap,A.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(A.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,i(f.clearcoatRoughnessMap,A.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(A.clearcoatNormalMap.value=f.clearcoatNormalMap,i(f.clearcoatNormalMap,A.clearcoatNormalMapTransform),A.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),1===f.side&&A.clearcoatNormalScale.value.negate())),f.dispersion>0&&(A.dispersion.value=f.dispersion),f.iridescence>0&&(A.iridescence.value=f.iridescence,A.iridescenceIOR.value=f.iridescenceIOR,A.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],A.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(A.iridescenceMap.value=f.iridescenceMap,i(f.iridescenceMap,A.iridescenceMapTransform)),f.iridescenceThicknessMap&&(A.iridescenceThicknessMap.value=f.iridescenceThicknessMap,i(f.iridescenceThicknessMap,A.iridescenceThicknessMapTransform))),f.transmission>0&&(A.transmission.value=f.transmission,A.transmissionSamplerMap.value=g.texture,A.transmissionSamplerSize.value.set(g.width,g.height),f.transmissionMap&&(A.transmissionMap.value=f.transmissionMap,i(f.transmissionMap,A.transmissionMapTransform)),A.thickness.value=f.thickness,f.thicknessMap&&(A.thicknessMap.value=f.thicknessMap,i(f.thicknessMap,A.thicknessMapTransform)),A.attenuationDistance.value=f.attenuationDistance,A.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(A.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(A.anisotropyMap.value=f.anisotropyMap,i(f.anisotropyMap,A.anisotropyMapTransform))),A.specularIntensity.value=f.specularIntensity,A.specularColor.value.copy(f.specularColor),f.specularColorMap&&(A.specularColorMap.value=f.specularColorMap,i(f.specularColorMap,A.specularColorMapTransform)),f.specularIntensityMap&&(A.specularIntensityMap.value=f.specularIntensityMap,i(f.specularIntensityMap,A.specularIntensityMapTransform)))):n.isMeshMatcapMaterial?(r(e,n),m=e,(v=n).matcap&&(m.matcap.value=v.matcap)):n.isMeshDepthMaterial?r(e,n):n.isMeshDistanceMaterial?(r(e,n),b=e,y=n,R=t.get(y).light,b.referencePosition.value.setFromMatrixPosition(R.matrixWorld),b.nearDistance.value=R.shadow.camera.near,b.farDistance.value=R.shadow.camera.far):n.isMeshNormalMaterial?r(e,n):n.isLineBasicMaterial?(x=e,_=n,x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,_.map&&(x.map.value=_.map,i(_.map,x.mapTransform)),n.isLineDashedMaterial&&(E=e,S=n,E.dashSize.value=S.dashSize,E.totalSize.value=S.dashSize+S.gapSize,E.scale.value=S.scale)):n.isPointsMaterial?(C=e,M=n,w=a,I=s,C.diffuse.value.copy(M.color),C.opacity.value=M.opacity,C.size.value=M.size*w,C.scale.value=.5*I,M.map&&(C.map.value=M.map,i(M.map,C.uvTransform)),M.alphaMap&&(C.alphaMap.value=M.alphaMap,i(M.alphaMap,C.alphaMapTransform)),M.alphaTest>0&&(C.alphaTest.value=M.alphaTest)):n.isSpriteMaterial?(T=e,B=n,T.diffuse.value.copy(B.color),T.opacity.value=B.opacity,T.rotation.value=B.rotation,B.map&&(T.map.value=B.map,i(B.map,T.mapTransform)),B.alphaMap&&(T.alphaMap.value=B.alphaMap,i(B.alphaMap,T.alphaMapTransform)),B.alphaTest>0&&(T.alphaTest.value=B.alphaTest)):n.isShadowMaterial?(e.color.value.copy(n.color),e.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function tF(e,t,i,r){let a={},s={},o=[],l=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function h(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?(0,n.R8M)("WebGLRenderer: Texture samplers can not be part of an uniforms group."):(0,n.R8M)("WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){let i=t.target;i.removeEventListener("dispose",c);let r=o.indexOf(i.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(a[i.id]),delete a[i.id],delete s[i.id]}return{bind:function(e,t){let i=t.program;r.uniformBlockBinding(e,i)},update:function(i,u){var d;let p,A,f,g,m=a[i.id];void 0===m&&(function(e){let t=e.uniforms,i=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=n.length;e<r;e++){let r=h(n[e]),a=i%16,s=a%r.boundary,o=a+s;i+=s,0!==o&&16-o<r.storage&&(i+=16-o),t.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=i,i+=r.storage}}}let r=i%16;r>0&&(i+=16-r),e.__size=i,e.__cache={}}(i),(d=i).__bindingPointIndex=p=function(){for(let e=0;e<l;e++)if(-1===o.indexOf(e))return o.push(e),e;return(0,n.z3S)("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),A=e.createBuffer(),f=d.__size,g=d.usage,e.bindBuffer(e.UNIFORM_BUFFER,A),e.bufferData(e.UNIFORM_BUFFER,f,g),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,p,A),m=A,a[i.id]=m,i.addEventListener("dispose",c));let v=u.program;r.updateUBOMapping(i,v);let b=t.render.frame;s[i.id]!==b&&(function(t){let i=a[t.id],r=t.uniforms,n=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,i);for(let t=0,i=r.length;t<i;t++){let i=Array.isArray(r[t])?r[t]:[r[t]];for(let r=0,a=i.length;r<a;r++){let a=i[r];if(!0===function(e,t,i,r){let n=e.value,a=t+"_"+i;if(void 0===r[a])return"number"==typeof n||"boolean"==typeof n?r[a]=n:r[a]=n.clone(),!0;{let e=r[a];if("number"==typeof n||"boolean"==typeof n){if(e!==n)return r[a]=n,!0}else if(!1===e.equals(n))return e.copy(n),!0}return!1}(a,t,r,n)){let t=a.__offset,i=Array.isArray(a.value)?a.value:[a.value],r=0;for(let n=0;n<i.length;n++){let s=i[n],o=h(s);"number"==typeof s||"boolean"==typeof s?(a.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+r,a.__data)):s.isMatrix3?(a.__data[0]=s.elements[0],a.__data[1]=s.elements[1],a.__data[2]=s.elements[2],a.__data[3]=0,a.__data[4]=s.elements[3],a.__data[5]=s.elements[4],a.__data[6]=s.elements[5],a.__data[7]=0,a.__data[8]=s.elements[6],a.__data[9]=s.elements[7],a.__data[10]=s.elements[8],a.__data[11]=0):(s.toArray(a.__data,r),r+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,a.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(i),s[i.id]=b)},dispose:function(){for(let t in a)e.deleteBuffer(a[t]);o=[],a={},s={}}}}let tN=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),tO=null;class tk{constructor(e={}){let t,i,r,o,l,h,c,u,d,b,y,x,_,E,S,C,M,w,I,T,B,R,D,Q,H;const{canvas:z=(0,n.lPF)(),context:V=null,depth:q=!0,stencil:W=!1,alpha:j=!1,antialias:X=!1,premultipliedAlpha:Y=!0,preserveDrawingBuffer:J=!1,powerPreference:K="default",failIfMajorPerformanceCaveat:$=!1,reversedDepthBuffer:Z=!1,outputBufferType:ee=1009}=e;if(this.isWebGLRenderer=!0,null!==V){if("u">typeof WebGLRenderingContext&&V instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=V.getContextAttributes().alpha}else t=j;const et=new Set([1033,1031,1029]),ei=new Set([1009,1014,1012,1020,1017,1018]),er=new Uint32Array(4),en=new Int32Array(4);let ea=null,es=null;const eo=[],el=[];let eh=null;this.domElement=z,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const ec=this;let eu=!1;this._outputColorSpace="srgb";let ed=0,ep=0,eA=null,ef=-1,eg=null;const em=new n.IUQ,ev=new n.IUQ;let eb=null;const ey=new n.Q1f(0);let ex=0,e_=z.width,eE=z.height,eS=1,eC=null,eM=null;const ew=new n.IUQ(0,0,e_,eE),eI=new n.IUQ(0,0,e_,eE);let eT=!1;const eB=new n.PPD;let eR=!1,eD=!1;const eL=new n.kn4,eP=new n.Pq0,eU=new n.IUQ,eF={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let eN=!1;function eO(){return null===eA?eS:1}let ek=V;function eQ(e,t){return z.getContext(e,t)}try{if("setAttribute"in z&&z.setAttribute("data-engine","three.js r182"),z.addEventListener("webglcontextlost",ez,!1),z.addEventListener("webglcontextrestored",eV,!1),z.addEventListener("webglcontextcreationerror",eW,!1),null===ek){const e="webgl2";if(ek=eQ(e,{alpha:!0,depth:q,stencil:W,antialias:X,premultipliedAlpha:Y,preserveDrawingBuffer:J,powerPreference:K,failIfMajorPerformanceCaveat:$}),null===ek)if(eQ(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw(0,n.z3S)("WebGLRenderer: "+e.message),e}function eG(){(i=new P(ek)).init(),D=new tI(ek,i),r=new g(ek,i,e,D),o=new tM(ek,i),r.reversedDepthBuffer&&Z&&o.buffers.depth.setReversed(!0),l=new N(ek),h=new tl,c=new tw(ek,i,o,h,r,D,l),u=new v(ec),d=new L(ec),b=new s(ek),Q=new A(ek,b),y=new U(ek,b,l,Q),x=new k(ek,y,b,l),T=new O(ek,r,c),M=new m(h),_=new to(ec,u,d,i,r,Q,M),E=new tU(ec,h),S=new td,C=new tv(i),I=new p(ec,u,d,o,x,t,Y),w=new tS(ec,x,r),H=new tF(ek,l,r,o),B=new f(ek,i,l),R=new F(ek,i,l),l.programs=_.programs,ec.capabilities=r,ec.extensions=i,ec.properties=h,ec.renderLists=S,ec.shadowMap=w,ec.state=o,ec.info=l}eG(),1009!==ee&&(eh=new G(ee,z.width,z.height,q,W));const eH=new tD(ec,ek);function ez(e){e.preventDefault(),(0,n.Rm2)("WebGLRenderer: Context Lost."),eu=!0}function eV(){(0,n.Rm2)("WebGLRenderer: Context Restored."),eu=!1;let e=l.autoReset,t=w.enabled,i=w.autoUpdate,r=w.needsUpdate,a=w.type;eG(),l.autoReset=e,w.enabled=t,w.autoUpdate=i,w.needsUpdate=r,w.type=a}function eW(e){(0,n.z3S)("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function ej(e){var t,i;let r,n=e.target;n.removeEventListener("dispose",ej),i=t=n,void 0!==(r=h.get(i).programs)&&(r.forEach(function(e){_.releaseProgram(e)}),i.isShaderMaterial&&_.releaseShaderCache(i)),h.remove(t)}function eX(e,t,i){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,e4(e,t,i),e.side=0,e.needsUpdate=!0,e4(e,t,i),e.side=2):e4(e,t,i)}this.xr=eH,this.getContext=function(){return ek},this.getContextAttributes=function(){return ek.getContextAttributes()},this.forceContextLoss=function(){let e=i.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=i.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return eS},this.setPixelRatio=function(e){void 0!==e&&(eS=e,this.setSize(e_,eE,!1))},this.getSize=function(e){return e.set(e_,eE)},this.setSize=function(e,t,i=!0){eH.isPresenting?(0,n.R8M)("WebGLRenderer: Can't change size while VR device is presenting."):(e_=e,eE=t,z.width=Math.floor(e*eS),z.height=Math.floor(t*eS),!0===i&&(z.style.width=e+"px",z.style.height=t+"px"),null!==eh&&eh.setSize(z.width,z.height),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(e_*eS,eE*eS).floor()},this.setDrawingBufferSize=function(e,t,i){e_=e,eE=t,eS=i,z.width=Math.floor(e*i),z.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(1009===ee)return void console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(e){for(let t=0;t<e.length;t++)if(!0===e[t].isOutputPass){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}eh.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(em)},this.getViewport=function(e){return e.copy(ew)},this.setViewport=function(e,t,i,r){e.isVector4?ew.set(e.x,e.y,e.z,e.w):ew.set(e,t,i,r),o.viewport(em.copy(ew).multiplyScalar(eS).round())},this.getScissor=function(e){return e.copy(eI)},this.setScissor=function(e,t,i,r){e.isVector4?eI.set(e.x,e.y,e.z,e.w):eI.set(e,t,i,r),o.scissor(ev.copy(eI).multiplyScalar(eS).round())},this.getScissorTest=function(){return eT},this.setScissorTest=function(e){o.setScissorTest(eT=e)},this.setOpaqueSort=function(e){eC=e},this.setTransparentSort=function(e){eM=e},this.getClearColor=function(e){return e.copy(I.getClearColor())},this.setClearColor=function(){I.setClearColor(...arguments)},this.getClearAlpha=function(){return I.getClearAlpha()},this.setClearAlpha=function(){I.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,i=!0){let r=0;if(e){let e=!1;if(null!==eA){let t=eA.texture.format;e=et.has(t)}if(e){let e=eA.texture.type,t=ei.has(e),i=I.getClearColor(),r=I.getClearAlpha(),n=i.r,a=i.g,s=i.b;t?(er[0]=n,er[1]=a,er[2]=s,er[3]=r,ek.clearBufferuiv(ek.COLOR,0,er)):(en[0]=n,en[1]=a,en[2]=s,en[3]=r,ek.clearBufferiv(ek.COLOR,0,en))}else r|=ek.COLOR_BUFFER_BIT}t&&(r|=ek.DEPTH_BUFFER_BIT),i&&(r|=ek.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),ek.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){z.removeEventListener("webglcontextlost",ez,!1),z.removeEventListener("webglcontextrestored",eV,!1),z.removeEventListener("webglcontextcreationerror",eW,!1),I.dispose(),S.dispose(),C.dispose(),h.dispose(),u.dispose(),d.dispose(),x.dispose(),Q.dispose(),H.dispose(),_.dispose(),eH.dispose(),eH.removeEventListener("sessionstart",eJ),eH.removeEventListener("sessionend",eK),e$.stop()},this.renderBufferDirect=function(e,t,a,s,l,p){let A;null===t&&(t=eF);let f=l.isMesh&&0>l.matrixWorld.determinant(),g=function(e,t,i,a,s){var l,p;!0!==t.isScene&&(t=eF),c.resetTextureUnits();let A=t.fog,f=a.isMeshStandardMaterial?t.environment:null,g=null===eA?ec.outputColorSpace:!0===eA.isXRRenderTarget?eA.texture.colorSpace:n.Zr2,m=(a.isMeshStandardMaterial?d:u).get(a.envMap||f),v=!0===a.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,b=!!i.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),y=!!i.morphAttributes.position,x=!!i.morphAttributes.normal,_=!!i.morphAttributes.color,S=0;a.toneMapped&&(null===eA||!0===eA.isXRRenderTarget)&&(S=ec.toneMapping);let C=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,w=void 0!==C?C.length:0,I=h.get(a),B=es.state.lights;if(!0===eR&&(!0===eD||e!==eg)){let t=e===eg&&a.id===ef;M.setState(a,e,t)}let R=!1;a.version===I.__version?I.needsLights&&I.lightsStateVersion!==B.state.version||I.outputColorSpace!==g||s.isBatchedMesh&&!1===I.batching?R=!0:s.isBatchedMesh||!0!==I.batching?s.isBatchedMesh&&!0===I.batchingColor&&null===s.colorTexture||s.isBatchedMesh&&!1===I.batchingColor&&null!==s.colorTexture||s.isInstancedMesh&&!1===I.instancing?R=!0:s.isInstancedMesh||!0!==I.instancing?s.isSkinnedMesh&&!1===I.skinning?R=!0:s.isSkinnedMesh||!0!==I.skinning?s.isInstancedMesh&&!0===I.instancingColor&&null===s.instanceColor||s.isInstancedMesh&&!1===I.instancingColor&&null!==s.instanceColor||s.isInstancedMesh&&!0===I.instancingMorph&&null===s.morphTexture||s.isInstancedMesh&&!1===I.instancingMorph&&null!==s.morphTexture||I.envMap!==m||!0===a.fog&&I.fog!==A||void 0!==I.numClippingPlanes&&(I.numClippingPlanes!==M.numPlanes||I.numIntersection!==M.numIntersection)||I.vertexAlphas!==v||I.vertexTangents!==b||I.morphTargets!==y||I.morphNormals!==x||I.morphColors!==_||I.toneMapping!==S?R=!0:I.morphTargetsCount!==w&&(R=!0):R=!0:R=!0:R=!0:(R=!0,I.__version=a.version);let D=I.currentProgram;!0===R&&(D=e4(a,t,s));let L=!1,P=!1,U=!1,F=D.getUniforms(),N=I.uniforms;if(o.useProgram(D.program)&&(L=!0,P=!0,U=!0),a.id!==ef&&(ef=a.id,P=!0),L||eg!==e){o.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),F.setValue(ek,"projectionMatrix",e.projectionMatrix),F.setValue(ek,"viewMatrix",e.matrixWorldInverse);let t=F.map.cameraPosition;void 0!==t&&t.setValue(ek,eP.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&F.setValue(ek,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&F.setValue(ek,"isOrthographic",!0===e.isOrthographicCamera),eg!==e&&(eg=e,P=!0,U=!0)}if(I.needsLights&&(B.state.directionalShadowMap.length>0&&F.setValue(ek,"directionalShadowMap",B.state.directionalShadowMap,c),B.state.spotShadowMap.length>0&&F.setValue(ek,"spotShadowMap",B.state.spotShadowMap,c),B.state.pointShadowMap.length>0&&F.setValue(ek,"pointShadowMap",B.state.pointShadowMap,c)),s.isSkinnedMesh){F.setOptional(ek,s,"bindMatrix"),F.setOptional(ek,s,"bindMatrixInverse");let e=s.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),F.setValue(ek,"boneTexture",e.boneTexture,c))}s.isBatchedMesh&&(F.setOptional(ek,s,"batchingTexture"),F.setValue(ek,"batchingTexture",s._matricesTexture,c),F.setOptional(ek,s,"batchingIdTexture"),F.setValue(ek,"batchingIdTexture",s._indirectTexture,c),F.setOptional(ek,s,"batchingColorTexture"),null!==s._colorsTexture&&F.setValue(ek,"batchingColorTexture",s._colorsTexture,c));let O=i.morphAttributes;if((void 0!==O.position||void 0!==O.normal||void 0!==O.color)&&T.update(s,i,D),(P||I.receiveShadow!==s.receiveShadow)&&(I.receiveShadow=s.receiveShadow,F.setValue(ek,"receiveShadow",s.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(N.envMap.value=m,N.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(N.envMapIntensity.value=t.environmentIntensity),void 0!==N.dfgLUT&&(N.dfgLUT.value=(null===tO&&((tO=new n.GYF(tN,16,16,1030,1016)).name="DFG_LUT",tO.minFilter=1006,tO.magFilter=1006,tO.wrapS=1001,tO.wrapT=1001,tO.generateMipmaps=!1,tO.needsUpdate=!0),tO)),P&&(F.setValue(ek,"toneMappingExposure",ec.toneMappingExposure),I.needsLights&&(l=N,p=U,l.ambientLightColor.needsUpdate=p,l.lightProbe.needsUpdate=p,l.directionalLights.needsUpdate=p,l.directionalLightShadows.needsUpdate=p,l.pointLights.needsUpdate=p,l.pointLightShadows.needsUpdate=p,l.spotLights.needsUpdate=p,l.spotLightShadows.needsUpdate=p,l.rectAreaLights.needsUpdate=p,l.hemisphereLights.needsUpdate=p),A&&!0===a.fog&&E.refreshFogUniforms(N,A),E.refreshMaterialUniforms(N,a,eS,eE,es.state.transmissionRenderTarget[e.id]),eq.upload(ek,e5(I),N,c)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(eq.upload(ek,e5(I),N,c),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&F.setValue(ek,"center",s.center),F.setValue(ek,"modelViewMatrix",s.modelViewMatrix),F.setValue(ek,"normalMatrix",s.normalMatrix),F.setValue(ek,"modelMatrix",s.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,i=e.length;t<i;t++){let i=e[t];H.update(i,D),H.bind(i,D)}}return D}(e,t,a,s,l);o.setMaterial(s,f);let m=a.index,v=1;if(!0===s.wireframe){if(void 0===(m=y.getWireframeAttribute(a)))return;v=2}let x=a.drawRange,_=a.attributes.position,S=x.start*v,C=(x.start+x.count)*v;null!==p&&(S=Math.max(S,p.start*v),C=Math.min(C,(p.start+p.count)*v)),null!==m?(S=Math.max(S,0),C=Math.min(C,m.count)):null!=_&&(S=Math.max(S,0),C=Math.min(C,_.count));let w=C-S;if(w<0||w===1/0)return;Q.setup(l,s,g,a,m);let I=B;if(null!==m&&(A=b.get(m),(I=R).setIndex(A)),l.isMesh)!0===s.wireframe?(o.setLineWidth(s.wireframeLinewidth*eO()),I.setMode(ek.LINES)):I.setMode(ek.TRIANGLES);else if(l.isLine){let e=s.linewidth;void 0===e&&(e=1),o.setLineWidth(e*eO()),l.isLineSegments?I.setMode(ek.LINES):l.isLineLoop?I.setMode(ek.LINE_LOOP):I.setMode(ek.LINE_STRIP)}else l.isPoints?I.setMode(ek.POINTS):l.isSprite&&I.setMode(ek.TRIANGLES);if(l.isBatchedMesh)if(null!==l._multiDrawInstances)(0,n.mcG)("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),I.renderMultiDrawInstances(l._multiDrawStarts,l._multiDrawCounts,l._multiDrawCount,l._multiDrawInstances);else if(i.get("WEBGL_multi_draw"))I.renderMultiDraw(l._multiDrawStarts,l._multiDrawCounts,l._multiDrawCount);else{let e=l._multiDrawStarts,t=l._multiDrawCounts,i=l._multiDrawCount,r=m?b.get(m).bytesPerElement:1,n=h.get(s).currentProgram.getUniforms();for(let a=0;a<i;a++)n.setValue(ek,"_gl_DrawID",a),I.render(e[a]/r,t[a])}else if(l.isInstancedMesh)I.renderInstances(S,w,l.count);else if(a.isInstancedBufferGeometry){let e=void 0!==a._maxInstanceCount?a._maxInstanceCount:1/0,t=Math.min(a.instanceCount,e);I.renderInstances(S,w,t)}else I.render(S,w)},this.compile=function(e,t,i=null){null===i&&(i=e),(es=C.get(i)).init(t),el.push(es),i.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(es.pushLight(e),e.castShadow&&es.pushShadow(e))}),e!==i&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(es.pushLight(e),e.castShadow&&es.pushShadow(e))}),es.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let n=0;n<t.length;n++){let a=t[n];eX(a,i,e),r.add(a)}else eX(t,i,e),r.add(t)}),es=el.pop(),r},this.compileAsync=function(e,t,r=null){let n=this.compile(e,t,r);return new Promise(t=>{function r(){(n.forEach(function(e){h.get(e).currentProgram.isReady()&&n.delete(e)}),0===n.size)?t(e):setTimeout(r,10)}null!==i.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eY=null;function eJ(){e$.stop()}function eK(){e$.start()}const e$=new a;function eZ(e,t,i,r){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)es.pushLight(e),e.castShadow&&es.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||eB.intersectsSprite(e)){r&&eU.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eL);let t=x.update(e),n=e.material;n.visible&&ea.push(e,t,n,i,eU.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||eB.intersectsObject(e))){let t=x.update(e),n=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eU.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),eU.copy(t.boundingSphere.center)),eU.applyMatrix4(e.matrixWorld).applyMatrix4(eL)),Array.isArray(n)){let r=t.groups;for(let a=0,s=r.length;a<s;a++){let s=r[a],o=n[s.materialIndex];o&&o.visible&&ea.push(e,t,o,i,eU.z,s)}}else n.visible&&ea.push(e,t,n,i,eU.z,null)}}let n=e.children;for(let e=0,a=n.length;e<a;e++)eZ(n[e],t,i,r)}function e0(e,t,i,r){let{opaque:n,transmissive:a,transparent:s}=e;es.setupLightsView(i),!0===eR&&M.setGlobalState(ec.clippingPlanes,i),r&&o.viewport(em.copy(r)),n.length>0&&e2(n,t,i),a.length>0&&e2(a,t,i),s.length>0&&e2(s,t,i),o.buffers.depth.setTest(!0),o.buffers.depth.setMask(!0),o.buffers.color.setMask(!0),o.setPolygonOffset(!1)}function e1(e,t,a,s){if(null!==(!0===a.isScene?a.overrideMaterial:null))return;if(void 0===es.state.transmissionRenderTarget[s.id]){let e=i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float");es.state.transmissionRenderTarget[s.id]=new n.nWS(1,1,{generateMipmaps:!0,type:e?1016:1009,minFilter:1008,samples:r.samples,stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:n.ppV.workingColorSpace})}let o=es.state.transmissionRenderTarget[s.id],l=s.viewport||em;o.setSize(l.z*ec.transmissionResolutionScale,l.w*ec.transmissionResolutionScale);let h=ec.getRenderTarget(),u=ec.getActiveCubeFace(),d=ec.getActiveMipmapLevel();ec.setRenderTarget(o),ec.getClearColor(ey),(ex=ec.getClearAlpha())<1&&ec.setClearColor(0xffffff,.5),ec.clear(),eN&&I.render(a);let p=ec.toneMapping;ec.toneMapping=0;let A=s.viewport;if(void 0!==s.viewport&&(s.viewport=void 0),es.setupLightsView(s),!0===eR&&M.setGlobalState(ec.clippingPlanes,s),e2(e,a,s),c.updateMultisampleRenderTarget(o),c.updateRenderTargetMipmap(o),!1===i.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let i=0,r=t.length;i<r;i++){let{object:r,geometry:n,material:o,group:l}=t[i];if(2===o.side&&r.layers.test(s.layers)){let t=o.side;o.side=1,o.needsUpdate=!0,e3(r,a,s,n,o,l),o.side=t,o.needsUpdate=!0,e=!0}}!0===e&&(c.updateMultisampleRenderTarget(o),c.updateRenderTargetMipmap(o))}ec.setRenderTarget(h,u,d),ec.setClearColor(ey,ex),void 0!==A&&(s.viewport=A),ec.toneMapping=p}function e2(e,t,i){let r=!0===t.isScene?t.overrideMaterial:null;for(let n=0,a=e.length;n<a;n++){let a=e[n],{object:s,geometry:o,group:l}=a,h=a.material;!0===h.allowOverride&&null!==r&&(h=r),s.layers.test(i.layers)&&e3(s,t,i,o,h,l)}}function e3(e,t,i,r,n,a){e.onBeforeRender(ec,t,i,r,n,a),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),n.onBeforeRender(ec,t,i,r,e,a),!0===n.transparent&&2===n.side&&!1===n.forceSinglePass?(n.side=1,n.needsUpdate=!0,ec.renderBufferDirect(i,t,r,n,e,a),n.side=0,n.needsUpdate=!0,ec.renderBufferDirect(i,t,r,n,e,a),n.side=2):ec.renderBufferDirect(i,t,r,n,e,a),e.onAfterRender(ec,t,i,r,n,a)}function e4(e,t,i){var r;!0!==t.isScene&&(t=eF);let n=h.get(e),a=es.state.lights,s=es.state.shadowsArray,o=a.state.version,l=_.getParameters(e,a.state,s,t,i),c=_.getProgramCacheKey(l),p=n.programs;n.environment=e.isMeshStandardMaterial?t.environment:null,n.fog=t.fog,n.envMap=(e.isMeshStandardMaterial?d:u).get(e.envMap||n.environment),n.envMapRotation=null!==n.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===p&&(e.addEventListener("dispose",ej),n.programs=p=new Map);let A=p.get(c);if(void 0!==A){if(n.currentProgram===A&&n.lightsStateVersion===o)return e8(e,l),A}else l.uniforms=_.getUniforms(e),e.onBeforeCompile(l,ec),A=_.acquireProgram(l,c),p.set(c,A),n.uniforms=l.uniforms;let f=n.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(f.clippingPlanes=M.uniform),e8(e,l),n.needsLights=(r=e).isMeshLambertMaterial||r.isMeshToonMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isShadowMaterial||r.isShaderMaterial&&!0===r.lights,n.lightsStateVersion=o,n.needsLights&&(f.ambientLightColor.value=a.state.ambient,f.lightProbe.value=a.state.probe,f.directionalLights.value=a.state.directional,f.directionalLightShadows.value=a.state.directionalShadow,f.spotLights.value=a.state.spot,f.spotLightShadows.value=a.state.spotShadow,f.rectAreaLights.value=a.state.rectArea,f.ltc_1.value=a.state.rectAreaLTC1,f.ltc_2.value=a.state.rectAreaLTC2,f.pointLights.value=a.state.point,f.pointLightShadows.value=a.state.pointShadow,f.hemisphereLights.value=a.state.hemi,f.directionalShadowMap.value=a.state.directionalShadowMap,f.directionalShadowMatrix.value=a.state.directionalShadowMatrix,f.spotShadowMap.value=a.state.spotShadowMap,f.spotLightMatrix.value=a.state.spotLightMatrix,f.spotLightMap.value=a.state.spotLightMap,f.pointShadowMap.value=a.state.pointShadowMap,f.pointShadowMatrix.value=a.state.pointShadowMatrix),n.currentProgram=A,n.uniformsList=null,A}function e5(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=eq.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function e8(e,t){let i=h.get(e);i.outputColorSpace=t.outputColorSpace,i.batching=t.batching,i.batchingColor=t.batchingColor,i.instancing=t.instancing,i.instancingColor=t.instancingColor,i.instancingMorph=t.instancingMorph,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}e$.setAnimationLoop(function(e){eY&&eY(e)}),"u">typeof self&&e$.setContext(self),this.setAnimationLoop=function(e){eY=e,eH.setAnimationLoop(e),null===e?e$.stop():e$.start()},eH.addEventListener("sessionstart",eJ),eH.addEventListener("sessionend",eK),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void(0,n.z3S)("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===eu)return;let i=!0===eH.enabled&&!0===eH.isPresenting,r=null!==eh&&(null===eA||i)&&eh.begin(ec,eA);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===eH.enabled&&!0===eH.isPresenting&&(null===eh||!1===eh.isCompositing())&&(!0===eH.cameraAutoUpdate&&eH.updateCamera(t),t=eH.getCamera()),!0===e.isScene&&e.onBeforeRender(ec,e,t,eA),(es=C.get(e,el.length)).init(t),el.push(es),eL.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),eB.setFromProjectionMatrix(eL,2e3,t.reversedDepth),eD=this.localClippingEnabled,eR=M.init(this.clippingPlanes,eD),(ea=S.get(e,eo.length)).init(),eo.push(ea),!0===eH.enabled&&!0===eH.isPresenting){let e=ec.xr.getDepthSensingMesh();null!==e&&eZ(e,t,-1/0,ec.sortObjects)}eZ(e,t,0,ec.sortObjects),ea.finish(),!0===ec.sortObjects&&ea.sort(eC,eM),(eN=!1===eH.enabled||!1===eH.isPresenting||!1===eH.hasDepthSensing())&&I.addToRenderList(ea,e),this.info.render.frame++,!0===eR&&M.beginShadows();let a=es.state.shadowsArray;if(w.render(a,e,t),!0===eR&&M.endShadows(),!0===this.info.autoReset&&this.info.reset(),!1===(r&&eh.hasRenderPass())){let i=ea.opaque,r=ea.transmissive;if(es.setupLights(),t.isArrayCamera){let n=t.cameras;if(r.length>0)for(let t=0,a=n.length;t<a;t++)e1(i,r,e,n[t]);eN&&I.render(e);for(let t=0,i=n.length;t<i;t++){let i=n[t];e0(ea,e,i,i.viewport)}}else r.length>0&&e1(i,r,e,t),eN&&I.render(e),e0(ea,e,t)}null!==eA&&0===ep&&(c.updateMultisampleRenderTarget(eA),c.updateRenderTargetMipmap(eA)),r&&eh.end(ec),!0===e.isScene&&e.onAfterRender(ec,e,t),Q.resetDefaultState(),ef=-1,eg=null,el.pop(),el.length>0?(es=el[el.length-1],!0===eR&&M.setGlobalState(ec.clippingPlanes,es.state.camera)):es=null,eo.pop(),ea=eo.length>0?eo[eo.length-1]:null},this.getActiveCubeFace=function(){return ed},this.getActiveMipmapLevel=function(){return ep},this.getRenderTarget=function(){return eA},this.setRenderTargetTextures=function(e,t,i){let r=h.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),h.get(e.texture).__webglTexture=t,h.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:i,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let i=h.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t};const e9=ek.createFramebuffer();this.setRenderTarget=function(e,t=0,i=0){eA=e,ed=t,ep=i;let r=null,n=!1,a=!1;if(e){let s=h.get(e);if(void 0!==s.__useDefaultFramebuffer){o.bindFramebuffer(ek.FRAMEBUFFER,s.__webglFramebuffer),em.copy(e.viewport),ev.copy(e.scissor),eb=e.scissorTest,o.viewport(em),o.scissor(ev),o.setScissorTest(eb),ef=-1;return}if(void 0===s.__webglFramebuffer)c.setupRenderTarget(e);else if(s.__hasExternalTextures)c.rebindTextures(e,h.get(e.texture).__webglTexture,h.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(s.__boundDepthTexture!==t){if(null!==t&&h.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");c.setupDepthRenderbuffer(e)}}let l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);let u=h.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(u[t])?u[t][i]:u[t],n=!0):r=e.samples>0&&!1===c.useMultisampledRTT(e)?h.get(e).__webglMultisampledFramebuffer:Array.isArray(u)?u[i]:u,em.copy(e.viewport),ev.copy(e.scissor),eb=e.scissorTest}else em.copy(ew).multiplyScalar(eS).floor(),ev.copy(eI).multiplyScalar(eS).floor(),eb=eT;if(0!==i&&(r=e9),o.bindFramebuffer(ek.FRAMEBUFFER,r)&&o.drawBuffers(e,r),o.viewport(em),o.scissor(ev),o.setScissorTest(eb),n){let r=h.get(e.texture);ek.framebufferTexture2D(ek.FRAMEBUFFER,ek.COLOR_ATTACHMENT0,ek.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,i)}else if(a)for(let r=0;r<e.textures.length;r++){let n=h.get(e.textures[r]);ek.framebufferTextureLayer(ek.FRAMEBUFFER,ek.COLOR_ATTACHMENT0+r,n.__webglTexture,i,t)}else if(null!==e&&0!==i){let t=h.get(e.texture);ek.framebufferTexture2D(ek.FRAMEBUFFER,ek.COLOR_ATTACHMENT0,ek.TEXTURE_2D,t.__webglTexture,i)}ef=-1},this.readRenderTargetPixels=function(e,t,i,a,s,l,c,u=0){if(!(e&&e.isWebGLRenderTarget))return void(0,n.z3S)("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=h.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==c&&(d=d[c]),d){o.bindFramebuffer(ek.FRAMEBUFFER,d);try{let o=e.textures[u],h=o.format,c=o.type;if(!r.textureFormatReadable(h))return void(0,n.z3S)("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(c))return void(0,n.z3S)("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&i>=0&&i<=e.height-s&&(e.textures.length>1&&ek.readBuffer(ek.COLOR_ATTACHMENT0+u),ek.readPixels(t,i,a,s,D.convert(h),D.convert(c),l))}finally{let e=null!==eA?h.get(eA).__webglFramebuffer:null;o.bindFramebuffer(ek.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,i,a,s,l,c,u=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=h.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==c&&(d=d[c]),d)if(t>=0&&t<=e.width-a&&i>=0&&i<=e.height-s){o.bindFramebuffer(ek.FRAMEBUFFER,d);let c=e.textures[u],p=c.format,A=c.type;if(!r.textureFormatReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(A))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let f=ek.createBuffer();ek.bindBuffer(ek.PIXEL_PACK_BUFFER,f),ek.bufferData(ek.PIXEL_PACK_BUFFER,l.byteLength,ek.STREAM_READ),e.textures.length>1&&ek.readBuffer(ek.COLOR_ATTACHMENT0+u),ek.readPixels(t,i,a,s,D.convert(p),D.convert(A),0);let g=null!==eA?h.get(eA).__webglFramebuffer:null;o.bindFramebuffer(ek.FRAMEBUFFER,g);let m=ek.fenceSync(ek.SYNC_GPU_COMMANDS_COMPLETE,0);return ek.flush(),await (0,n.jej)(ek,m,4),ek.bindBuffer(ek.PIXEL_PACK_BUFFER,f),ek.getBufferSubData(ek.PIXEL_PACK_BUFFER,0,l),ek.deleteBuffer(f),ek.deleteSync(m),l}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,t=null,i=0){let r=Math.pow(2,-i),n=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),s=null!==t?t.x:0,l=null!==t?t.y:0;c.setTexture2D(e,0),ek.copyTexSubImage2D(ek.TEXTURE_2D,i,0,0,s,l,n,a),o.unbindTexture()};const e6=ek.createFramebuffer(),e7=ek.createFramebuffer();this.copyTextureToTexture=function(e,t,i=null,r=null,a=0,s=null){let l,u,d,p,A,f,g,m,v,b;null===s&&(0!==a?((0,n.mcG)("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=a,a=0):s=0);let y=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==i)l=i.max.x-i.min.x,u=i.max.y-i.min.y,d=i.isBox3?i.max.z-i.min.z:1,p=i.min.x,A=i.min.y,f=i.isBox3?i.min.z:0;else{let t=Math.pow(2,-a);l=Math.floor(y.width*t),u=Math.floor(y.height*t),d=e.isDataArrayTexture?y.depth:e.isData3DTexture?Math.floor(y.depth*t):1,p=0,A=0,f=0}null!==r?(g=r.x,m=r.y,v=r.z):(g=0,m=0,v=0);let x=D.convert(t.format),_=D.convert(t.type);t.isData3DTexture?(c.setTexture3D(t,0),b=ek.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(c.setTexture2DArray(t,0),b=ek.TEXTURE_2D_ARRAY):(c.setTexture2D(t,0),b=ek.TEXTURE_2D),ek.pixelStorei(ek.UNPACK_FLIP_Y_WEBGL,t.flipY),ek.pixelStorei(ek.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ek.pixelStorei(ek.UNPACK_ALIGNMENT,t.unpackAlignment);let E=ek.getParameter(ek.UNPACK_ROW_LENGTH),S=ek.getParameter(ek.UNPACK_IMAGE_HEIGHT),C=ek.getParameter(ek.UNPACK_SKIP_PIXELS),M=ek.getParameter(ek.UNPACK_SKIP_ROWS),w=ek.getParameter(ek.UNPACK_SKIP_IMAGES);ek.pixelStorei(ek.UNPACK_ROW_LENGTH,y.width),ek.pixelStorei(ek.UNPACK_IMAGE_HEIGHT,y.height),ek.pixelStorei(ek.UNPACK_SKIP_PIXELS,p),ek.pixelStorei(ek.UNPACK_SKIP_ROWS,A),ek.pixelStorei(ek.UNPACK_SKIP_IMAGES,f);let I=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let i=h.get(e),r=h.get(t),n=h.get(i.__renderTarget),c=h.get(r.__renderTarget);o.bindFramebuffer(ek.READ_FRAMEBUFFER,n.__webglFramebuffer),o.bindFramebuffer(ek.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let i=0;i<d;i++)I&&(ek.framebufferTextureLayer(ek.READ_FRAMEBUFFER,ek.COLOR_ATTACHMENT0,h.get(e).__webglTexture,a,f+i),ek.framebufferTextureLayer(ek.DRAW_FRAMEBUFFER,ek.COLOR_ATTACHMENT0,h.get(t).__webglTexture,s,v+i)),ek.blitFramebuffer(p,A,l,u,g,m,l,u,ek.DEPTH_BUFFER_BIT,ek.NEAREST);o.bindFramebuffer(ek.READ_FRAMEBUFFER,null),o.bindFramebuffer(ek.DRAW_FRAMEBUFFER,null)}else if(0!==a||e.isRenderTargetTexture||h.has(e)){let i=h.get(e),r=h.get(t);o.bindFramebuffer(ek.READ_FRAMEBUFFER,e6),o.bindFramebuffer(ek.DRAW_FRAMEBUFFER,e7);for(let e=0;e<d;e++)I?ek.framebufferTextureLayer(ek.READ_FRAMEBUFFER,ek.COLOR_ATTACHMENT0,i.__webglTexture,a,f+e):ek.framebufferTexture2D(ek.READ_FRAMEBUFFER,ek.COLOR_ATTACHMENT0,ek.TEXTURE_2D,i.__webglTexture,a),T?ek.framebufferTextureLayer(ek.DRAW_FRAMEBUFFER,ek.COLOR_ATTACHMENT0,r.__webglTexture,s,v+e):ek.framebufferTexture2D(ek.DRAW_FRAMEBUFFER,ek.COLOR_ATTACHMENT0,ek.TEXTURE_2D,r.__webglTexture,s),0!==a?ek.blitFramebuffer(p,A,l,u,g,m,l,u,ek.COLOR_BUFFER_BIT,ek.NEAREST):T?ek.copyTexSubImage3D(b,s,g,m,v+e,p,A,l,u):ek.copyTexSubImage2D(b,s,g,m,p,A,l,u);o.bindFramebuffer(ek.READ_FRAMEBUFFER,null),o.bindFramebuffer(ek.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?ek.texSubImage3D(b,s,g,m,v,l,u,d,x,_,y.data):t.isCompressedArrayTexture?ek.compressedTexSubImage3D(b,s,g,m,v,l,u,d,x,y.data):ek.texSubImage3D(b,s,g,m,v,l,u,d,x,_,y):e.isDataTexture?ek.texSubImage2D(ek.TEXTURE_2D,s,g,m,l,u,x,_,y.data):e.isCompressedTexture?ek.compressedTexSubImage2D(ek.TEXTURE_2D,s,g,m,y.width,y.height,x,y.data):ek.texSubImage2D(ek.TEXTURE_2D,s,g,m,l,u,x,_,y);ek.pixelStorei(ek.UNPACK_ROW_LENGTH,E),ek.pixelStorei(ek.UNPACK_IMAGE_HEIGHT,S),ek.pixelStorei(ek.UNPACK_SKIP_PIXELS,C),ek.pixelStorei(ek.UNPACK_SKIP_ROWS,M),ek.pixelStorei(ek.UNPACK_SKIP_IMAGES,w),0===s&&t.generateMipmaps&&ek.generateMipmap(b),o.unbindTexture()},this.initRenderTarget=function(e){void 0===h.get(e).__webglFramebuffer&&c.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?c.setTextureCube(e,0):e.isData3DTexture?c.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?c.setTexture2DArray(e,0):c.setTexture2D(e,0),o.unbindTexture()},this.resetState=function(){ed=0,ep=0,eA=null,o.reset(),Q.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=n.ppV._getDrawingBufferColorSpace(e),t.unpackColorSpace=n.ppV._getUnpackColorSpace()}}var tQ=i(6526),tG=i(3520),tH=i(1535),tz=i(3418),tV=i(4515);let tq=Symbol("prepared"),tW=Symbol("prepare"),tj=Symbol("preparedGLTF"),tX=Symbol("clone");class tY{static prepare(e){if(null==e.scene)throw Error("Model does not have a scene");if(e[tq])return e;let t=this[tW](e);return t[tq]=!0,t}static[tW](e){let{scene:t}=e,i=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:i})}get parser(){return this[tj].parser}get animations(){return this[tj].animations}get scene(){return this[tj].scene}get scenes(){return this[tj].scenes}get cameras(){return this[tj].cameras}get asset(){return this[tj].asset}get userData(){return this[tj].userData}constructor(e){this[tj]=e}clone(){return new this.constructor(this[tX]())}dispose(){this.scenes.forEach(e=>{e.traverse(e=>{e.material&&((Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{for(let t in e){let i=e[t];if(i instanceof n.gPd){let e=i.source.data;null!=e.close&&e.close(),i.dispose()}}e.dispose()}),e.geometry.dispose())})})}[tX](){var e;let t,i,r,n=this[tj],a=(e=this.scene,t=new Map,i=new Map,r=e.clone(),function e(t,i,r){r(t,i);for(let n=0;n<t.children.length;n++)e(t.children[n],i.children[n],r)}(e,r,function(e,r){t.set(r,e),i.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=t.get(e),n=r.skeleton.bones;e.skeleton=r.skeleton.clone(),e.bindMatrix.copy(r.bindMatrix),e.skeleton.bones=n.map(function(e){return i.get(e)}),e.bind(e.skeleton,e.bindMatrix)}),r);tJ(a,this.scene);let s=[a],o=n.userData?Object.assign({},n.userData):{};return Object.assign(Object.assign({},n),{scene:a,scenes:s,userData:o})}}let tJ=(e,t)=>{tK(e,t,(e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)})},tK=(e,t,i)=>{i(e,t);for(let r=0;r<e.children.length;r++)tK(e.children[r],t.children[r],i)},t$=Symbol("threeGLTF"),tZ=Symbol("gltf"),t0=Symbol("gltfElementMap"),t1=Symbol("threeObjectMap"),t2=Symbol("parallelTraverseThreeScene"),t3=Symbol("correlateOriginalThreeGLTF"),t4=Symbol("correlateCloneThreeGLTF");class t5{static from(e,t){return null!=t?this[t4](e,t):this[t3](e)}static[t3](e){let t=e.parser.json,i=e.parser.associations,r=new Map,a={name:"Default"},s={index:-1};for(let e of i.keys())e instanceof n.imn&&null==i.get(e)&&(s.index<0&&(null==t.materials&&(t.materials=[]),s.index=t.materials.length,t.materials.push(a)),e.name=a.name,i.set(e,{materials:s.index}));for(let[e,n]of i)for(let i in n&&(e.userData=e.userData||{},e.userData.associations=n),n)if(null!=i&&"primitives"!==i){let a=(t[i]||[])[n[i]];if(null==a)continue;let s=r.get(a);null==s&&(s=new Set,r.set(a,s)),s.add(e)}return new t5(e,t,i,r)}static[t4](e,t){let i=t.threeGLTF,r=JSON.parse(JSON.stringify(t.gltf)),n=new Map,a=new Map;for(let s=0;s<i.scenes.length;s++)this[t2](i.scenes[s],e.scenes[s],(e,i)=>{let s=t.threeObjectMap.get(e);if(null!=s){for(let e in s)if(null!=e&&"primitives"!==e){let t=s[e],o=r[e][t],l=n.get(i)||{};l[e]=t,n.set(i,l);let h=a.get(o)||new Set;h.add(i),a.set(o,h)}}});return new t5(e,r,n,a)}static[t2](e,t,i){let r=(e,t)=>{if(i(e,t),e.isObject3D){if(e.material)if(Array.isArray(e.material))for(let r=0;r<e.material.length;++r)i(e.material[r],t.material[r]);else i(e.material,t.material);for(let i=0;i<e.children.length;++i)r(e.children[i],t.children[i])}};r(e,t)}get threeGLTF(){return this[t$]}get gltf(){return this[tZ]}get gltfElementMap(){return this[t0]}get threeObjectMap(){return this[t1]}constructor(e,t,i,r){this[t$]=e,this[tZ]=t,this[t0]=r,this[t1]=i}}let t8=Symbol("correlatedSceneGraph");class t9 extends tY{static[tW](e){let t=super[tW](e);null==t[t8]&&(t[t8]=t5.from(t));let{scene:i}=t,r=new n.iyt(void 0,1/0);return i.traverse(e=>{if(e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid),e.material){let{geometry:i}=e;e.castShadow=!0,e.isSkinnedMesh&&(i.boundingSphere=r,i.boundingBox=null);let n=e.material;if(!0===n.isMeshBasicMaterial&&(n.toneMapped=!1),n.shadowSide=0,n.aoMap){let{gltf:e,threeObjectMap:r}=t[t8],a=r.get(n);if(null!=e.materials&&null!=a&&null!=a.materials){let t=e.materials[a.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv)}}}}),t}get correlatedSceneGraph(){return this[tj][t8]}[tX](){let e=super[tX](),t=new Map;return e.scene.traverse(e=>{if(e.material){let i=e.material;if(null!=i){if(t.has(i.uuid)){e.material=t.get(i.uuid);return}e.material=i.clone(),t.set(i.uuid,e.material)}}void 0!==e.target&&e.add(e.target)}),e[t8]=t5.from(e,this.correlatedSceneGraph),e}}let t6=(e,t,i)=>{let r;switch(e){case 1009:r=new Uint8ClampedArray(t*i*4);break;case 1016:r=new Uint16Array(t*i*4);break;case 1014:r=new Uint32Array(t*i*4);break;case 1010:r=new Int8Array(t*i*4);break;case 1011:r=new Int16Array(t*i*4);break;case 1013:r=new Int32Array(t*i*4);break;case 1015:r=new Float32Array(t*i*4);break;default:throw Error("Unsupported data type")}return r};class t7{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:1023,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0&&e.renderTargetOptions?.generateMipmaps,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:1006,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:1006,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:1001,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:1001};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=t7.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new n.Z58,this._camera=new n.qUd,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,i,a)=>{if(void 0!==r)return r;let s=new n.nWS(1,1,a);t.setRenderTarget(s);let o=new n.eaF(new n.bdM,new n.V9B({color:0xffffff}));t.render(o,i),t.setRenderTarget(null);let l=t6(e,s.width,s.height);return t.readRenderTargetPixels(s,0,0,s.width,s.height,l),s.dispose(),o.geometry.dispose(),o.material.dispose(),r=0!==l[0]})(this._type,this._renderer,this._camera,t)){let e;1016===this._type&&(e=this._renderer.extensions.has("EXT_color_buffer_float")?1015:void 0),void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to 1015`),this._type=e):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new n.eaF(new n.bdM,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new n.nWS(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:300}static instantiateRenderer(){let e=new tk;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw Error("Can't read pixels in this browser");let e=t6(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){let t=new n.GYF(this.toArray(),this.width,this.height,1023,this._type,e?.mapping||300,e?.wrapS||1001,e?.wrapT||1001,e?.magFilter||1006,e?.minFilter||1006,e?.anisotropy||1,n.Zr2);return t.generateMipmaps=e?.generateMipmaps!==void 0&&e?.generateMipmaps,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof n.BKk&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof n.gPd&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof n.gPd&&e.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class ie extends Error{}class it extends Error{}let ii=(e,t,i)=>{let r=RegExp(`${t}="([^"]*)"`,"i").exec(e);if(r)return r[1];let n=RegExp(`<${t}[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(n){let e=n[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):n[1].trim()}if(void 0!==i)return i;throw Error(`Can't find ${t} in gainmap metadata`)};class ir{options;constructor(e){this.options={debug:!!e&&void 0!==e.debug&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise((t,i)=>{let r,n=this.options.debug,a=new DataView(e.buffer);if(65496!==a.getUint16(0))return void i(Error("Not a valid jpeg"));let s=a.byteLength,o=2,l=0;for(;o<s;){if(++l>250)return void i(Error(`Found no marker after ${l} loops 😵`));if(255!==a.getUint8(o))return void i(Error(`Not a valid marker at offset 0x${o.toString(16)}, found: 0x${a.getUint8(o).toString(16)}`));if(r=a.getUint8(o+1),n&&console.log(`Marker: ${r.toString(16)}`),226===r){n&&console.log("Found APP2 marker (0xffe2)");let e=o+4;if(0x4d504600===a.getUint32(e)){let r,n=e+4;if(18761===a.getUint16(n))r=!1;else{if(19789!==a.getUint16(n))return void i(Error("No valid endianness marker found in TIFF header"));r=!0}if(42!==a.getUint16(n+2,!r))return void i(Error("Not valid TIFF data! (no 0x002A marker)"));let s=a.getUint32(n+4,!r);if(s<8)return void i(Error("Not valid TIFF data! (First offset less than 8)"));let o=n+s,l=a.getUint16(o,!r),h=o+2,c=0;for(let e=h;e<h+12*l;e+=12)45057===a.getUint16(e,!r)&&(c=a.getUint32(e+8,!r));let u=o+2+12*l+4,d=[];for(let e=u;e<u+16*c;e+=16){let t={MPType:a.getUint32(e,!r),size:a.getUint32(e+4,!r),dataOffset:a.getUint32(e+8,!r),dependantImages:a.getUint32(e+12,!r),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=n+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,d.push(t)}if(this.options.extractNonFII&&d.length){let e=new Blob([a]),i=[];for(let t of d){if(t.isFII&&!this.options.extractFII)continue;let r=e.slice(t.start,t.end+1,"image/jpeg");i.push(r)}t(i)}}}o+=2+a.getUint16(o+2)}})}}let ia=async e=>{let t=(e=>{let t,i=(t="u">typeof TextDecoder?new TextDecoder().decode(e):e.toString()).indexOf("<x:xmpmeta");for(;-1!==i;){let e=t.indexOf("x:xmpmeta>",i),r=t.slice(i,e+10);try{let e=ii(r,"hdrgm:GainMapMin","0"),t=ii(r,"hdrgm:GainMapMax"),i=ii(r,"hdrgm:Gamma","1"),n=ii(r,"hdrgm:OffsetSDR","0.015625"),a=ii(r,"hdrgm:OffsetHDR","0.015625"),s=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),o=s?s[1]:"0",l=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!l)throw Error("Incomplete gainmap metadata");let h=l[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(i)?i.map(e=>parseFloat(e)):[parseFloat(i),parseFloat(i),parseFloat(i)],offsetSdr:Array.isArray(n)?n.map(e=>parseFloat(e)):[parseFloat(n),parseFloat(n),parseFloat(n)],offsetHdr:Array.isArray(a)?a.map(e=>parseFloat(e)):[parseFloat(a),parseFloat(a),parseFloat(a)],hdrCapacityMin:parseFloat(o),hdrCapacityMax:parseFloat(h)}}catch(e){}i=t.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new it("Gain map XMP metadata not found");let i=new ir({extractFII:!0,extractNonFII:!0}),r=await i.extract(e);if(2!==r.length)throw new ie("Gain map recovery image not found");return{sdr:new Uint8Array(await r[0].arrayBuffer()),gainMap:new Uint8Array(await r[1].arrayBuffer()),metadata:t}},is=e=>new Promise((t,i)=>{let r=document.createElement("img");r.onload=()=>{t(r)},r.onerror=e=>{i(e)},r.src=URL.createObjectURL(e)});class io extends n.aHM{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new n.KPJ}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");let e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new n.gPd,sdr:new n.gPd});return this._config.createQuadRenderer({width:16,height:16,type:1016,colorSpace:n.Zr2,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,i){let r,n,a=t?new Blob([t],{type:"image/jpeg"}):void 0,s=new Blob([e],{type:"image/jpeg"}),o=!1;if("u"<typeof createImageBitmap){let e=await Promise.all([a?is(a):Promise.resolve(void 0),is(s)]);n=e[0],r=e[1],o="flipY"===i}else{let e=await Promise.all([a?createImageBitmap(a,{imageOrientation:i||"flipY"}):Promise.resolve(void 0),createImageBitmap(s,{imageOrientation:i||"flipY"})]);n=e[0],r=e[1]}return{sdrImage:r,gainMapImage:n,needsFlip:o}}createTextures(e,t,i){let r=new n.gPd(t||new ImageData(2,2),300,1001,1001,1006,1008,1023,1009,1,n.Zr2);r.flipY=i,r.needsUpdate=!0;let a=new n.gPd(e,300,1001,1001,1006,1008,1023,1009,1,"srgb");return a.flipY=i,a.needsUpdate=!0,{gainMap:r,sdr:a}}updateQuadRenderer(e,t,i,r,n){e.width=t.width,e.height=t.height,e.material.gainMap=i,e.material.sdr=r,e.material.gainMapMin=n.gainMapMin,e.material.gainMapMax=n.gainMapMax,e.material.offsetHdr=n.offsetHdr,e.material.offsetSdr=n.offsetSdr,e.material.gamma=n.gamma,e.material.hdrCapacityMin=n.hdrCapacityMin,e.material.hdrCapacityMax=n.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,n.hdrCapacityMax),e.material.needsUpdate=!0}}let il=`
|
|
855
|
+
varying vec2 vUv;
|
|
856
|
+
|
|
857
|
+
void main() {
|
|
858
|
+
vUv = uv;
|
|
859
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
860
|
+
}
|
|
861
|
+
`,ih=`
|
|
862
|
+
// min half float value
|
|
863
|
+
#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )
|
|
864
|
+
// max half float value
|
|
865
|
+
#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )
|
|
866
|
+
|
|
867
|
+
uniform sampler2D sdr;
|
|
868
|
+
uniform sampler2D gainMap;
|
|
869
|
+
uniform vec3 gamma;
|
|
870
|
+
uniform vec3 offsetHdr;
|
|
871
|
+
uniform vec3 offsetSdr;
|
|
872
|
+
uniform vec3 gainMapMin;
|
|
873
|
+
uniform vec3 gainMapMax;
|
|
874
|
+
uniform float weightFactor;
|
|
875
|
+
|
|
876
|
+
varying vec2 vUv;
|
|
877
|
+
|
|
878
|
+
void main() {
|
|
879
|
+
vec3 rgb = texture2D( sdr, vUv ).rgb;
|
|
880
|
+
vec3 recovery = texture2D( gainMap, vUv ).rgb;
|
|
881
|
+
vec3 logRecovery = pow( recovery, gamma );
|
|
882
|
+
vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;
|
|
883
|
+
vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;
|
|
884
|
+
vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
|
|
885
|
+
gl_FragColor = vec4( clampedHdrColor , 1.0 );
|
|
886
|
+
}
|
|
887
|
+
`;class ic extends n.BKk{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:i,gainMapMin:r,gainMapMax:a,maxDisplayBoost:s,hdrCapacityMin:o,hdrCapacityMax:l,sdr:h,gainMap:c}){super({name:"GainMapDecoderMaterial",vertexShader:il,fragmentShader:ih,uniforms:{sdr:{value:h},gainMap:{value:c},gamma:{value:new n.Pq0(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new n.Pq0().fromArray(t)},offsetSdr:{value:new n.Pq0().fromArray(i)},gainMapMin:{value:new n.Pq0().fromArray(r)},gainMapMax:{value:new n.Pq0().fromArray(a)},weightFactor:{value:(Math.log2(s)-o)/(l-o)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=s,this._hdrCapacityMin=o,this._hdrCapacityMax=l,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class iu extends io{constructor(e,t){super({renderer:e,createMaterial:e=>new ic(e),createQuadRenderer:e=>new t7(e)},t)}async render(e,t,i,r){let{sdrImage:n,gainMapImage:a,needsFlip:s}=await this.processImages(i,r,"flipY"),{gainMap:o,sdr:l}=this.createTextures(n,a,s);this.updateQuadRenderer(e,n,o,l,t),e.render()}}class id extends iu{load(e,t,i,r){let a=this.prepareQuadRenderer(),s=new n.Y9S(this._internalLoadingManager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(this.withCredentials),this.manager.itemStart(e),s.load(e,async i=>{let n,s,o;if("string"==typeof i)throw Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");let l=new Uint8Array(i);try{let e=await ia(l);n=e.sdr,s=e.gainMap,o=e.metadata}catch(t){if(t instanceof it||t instanceof ie)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),o={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},n=l;else throw t}try{await this.render(a,o,n.buffer,s?.buffer)}catch(t){this.manager.itemError(e),"function"==typeof r&&r(t),a.disposeOnDemandRenderer();return}"function"==typeof t&&t(a),this.manager.itemEnd(e),a.disposeOnDemandRenderer()},i,t=>{this.manager.itemError(e),"function"==typeof r&&r(t)}),a}}class ip extends n.BRH{constructor(e){super(e),this.type=1016}parse(e){let t,i,r,a=function(e,t){switch(e){case 1:throw Error("THREE.HDRLoader: Read Error: "+(t||""));case 2:throw Error("THREE.HDRLoader: Write Error: "+(t||""));case 3:throw Error("THREE.HDRLoader: Bad File Format: "+(t||""));default:throw Error("THREE.HDRLoader: Memory Error: "+(t||""))}},s=function(e,t,i){t=t||1024;let r=e.pos,n=-1,a=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));for(;0>(n=o.indexOf("\n"))&&a<t&&r<e.byteLength;)s+=o,a+=o.length,r+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return -1<n&&(!1!==i&&(e.pos+=a+n+1),s+o.slice(0,n))},o=new Uint8Array(e);o.pos=0;let l=function(e){let t,i,r=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,h={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for(!(e.pos>=e.byteLength)&&(t=s(e))||a(1,"no header found"),(i=t.match(/^#\?(\S+)/))||a(3,"bad initial token"),h.valid|=1,h.programtype=i[1],h.string+=t+"\n";!1!==(t=s(e));){if(h.string+=t+"\n","#"===t.charAt(0)){h.comments+=t+"\n";continue}if((i=t.match(r))&&(h.gamma=parseFloat(i[1])),(i=t.match(n))&&(h.exposure=parseFloat(i[1])),(i=t.match(o))&&(h.valid|=2,h.format=i[1]),(i=t.match(l))&&(h.valid|=4,h.height=parseInt(i[1],10),h.width=parseInt(i[2],10)),2&h.valid&&4&h.valid)break}return 2&h.valid||a(3,"missing format specifier"),4&h.valid||a(3,"missing image size specifier"),h}(o),h=l.width,c=l.height,u=function(e,t,i){if(t<8||t>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);t!==(e[2]<<8|e[3])&&a(3,"wrong scanline width");let r=new Uint8Array(4*t*i);r.length||a(4,"unable to allocate buffer space");let n=0,s=0,o=4*t,l=new Uint8Array(4),h=new Uint8Array(o),c=i;for(;c>0&&s<e.byteLength;){s+4>e.byteLength&&a(1),l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],(2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=t)&&a(3,"bad rgbe scanline format");let i=0,u;for(;i<o&&s<e.byteLength;){let t=(u=e[s++])>128;if(t&&(u-=128),(0===u||i+u>o)&&a(3,"bad scanline data"),t){let t=e[s++];for(let e=0;e<u;e++)h[i++]=t}else h.set(e.subarray(s,s+u),i),i+=u,s+=u}for(let e=0;e<t;e++){let i=0;r[n]=h[e+i],i+=t,r[n+1]=h[e+i],i+=t,r[n+2]=h[e+i],i+=t,r[n+3]=h[e+i],n+=4}c--}return r}(o.subarray(o.pos),h,c);switch(this.type){case 1015:let d=new Float32Array(4*(r=u.length/4));for(let e=0;e<r;e++)!function(e,t,i,r){let n=Math.pow(2,e[t+3]-128)/255;i[r+0]=e[t+0]*n,i[r+1]=e[t+1]*n,i[r+2]=e[t+2]*n,i[r+3]=1}(u,4*e,d,4*e);t=d,i=1015;break;case 1016:let p=new Uint16Array(4*(r=u.length/4));for(let e=0;e<r;e++)!function(e,t,i,r){let a=Math.pow(2,e[t+3]-128)/255;i[r+0]=n.GxU.toHalfFloat(Math.min(e[t+0]*a,65504)),i[r+1]=n.GxU.toHalfFloat(Math.min(e[t+1]*a,65504)),i[r+2]=n.GxU.toHalfFloat(Math.min(e[t+2]*a,65504)),i[r+3]=n.GxU.toHalfFloat(1)}(u,4*e,p,4*e);t=p,i=1016;break;default:throw Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:c,data:t,header:l.string,gamma:l.gamma,exposure:l.exposure,type:i}}setDataType(e){return this.type=e,this}load(e,t,i,r){return super.load(e,function(e,i){switch(e.type){case 1015:case 1016:e.colorSpace=n.Zr2,e.minFilter=1006,e.magFilter=1006,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,i)},i,r)}}class iA extends ip{constructor(e){console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."),super(e)}}let ig={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},im={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class iv extends n.Z58{constructor(e){super(),this.position.y=-3.5;const t=new n.iNn;t.deleteAttribute("uv");const i=new n._4j({metalness:0,side:1}),r=new n._4j({metalness:0}),a="legacy"==e?ig:im,s=new n.HiM(0xffffff,a.topLight.intensity,28,2);s.position.set(...a.topLight.position),this.add(s);const o=new n.eaF(t,i);for(const e of(o.position.set(...a.room.position),o.scale.set(...a.room.scale),this.add(o),a.boxes)){const i=new n.eaF(t,r);i.position.set(...e.position),i.rotation.set(0,e.rotation,0),i.scale.set(...e.scale),this.add(i)}for(const e of a.lights){const i=new n.eaF(t,this.createAreaLightMaterial(e.intensity));i.position.set(...e.position),i.scale.set(...e.scale),this.add(i)}}createAreaLightMaterial(e){let t=new n.V9B;return t.color.setScalar(e),t}}let ib=/\.hdr(\.js)?$/;class iy{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}ldrLoader(e){return null==this._ldrLoader&&(this._ldrLoader=new n.Tap),this._ldrLoader.setWithCredentials(e),this._ldrLoader}imageLoader(e){return null==this._imageLoader&&(this._imageLoader=new id(this.threeRenderer)),this._imageLoader.setWithCredentials(e),this._imageLoader}hdrLoader(e){return null==this._hdrLoader&&(this._hdrLoader=new iA,this._hdrLoader.setDataType(1016)),this._hdrLoader.setWithCredentials(e),this._hdrLoader}async getLottieLoader(e){if(null==this._lottieLoader){let{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(e),this._lottieLoader}async loadImage(e,t){let i=await new Promise((i,r)=>this.ldrLoader(t).load(e,i,()=>{},r));return i.name=e,i.flipY=!1,i}async loadLottie(e,t,i){let r=await this.getLottieLoader(i);r.setQuality(t);let n=await new Promise((t,i)=>r.load(e,t,()=>{},i));return n.name=e,n}async loadEquirect(e,t=!1,i=()=>{}){try{let r=ib.test(e),n=r?this.hdrLoader(t):this.imageLoader(t),a=await new Promise((t,r)=>n.load(e,e=>{let{renderTarget:i}=e;if(null!=i){let{texture:r}=i;e.dispose(!1),t(r)}else t(e)},e=>{i(e.loaded/e.total*.9)},r));return i(1),a.name=e,a.mapping=303,r||(a.colorSpace="srgb"),a}finally{i&&i(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,i=()=>{},r=!1){let n,a="legacy"!==t;("legacy"===t||"neutral"===t)&&(t=null),t=(0,tH.pE)(t);let s=Promise.resolve(null);e&&(s=this.loadEquirectFromUrl(e,r,i)),n=t?this.loadEquirectFromUrl(t,r,i):e?this.loadEquirectFromUrl(e,r,i):a?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();let[o,l]=await Promise.all([n,s]);if(null==o)throw Error("Failed to load environment map.");return{environmentMap:o,skybox:l}}async loadEquirectFromUrl(e,t,i){if(!this.skyboxCache.has(e)){let r=this.loadEquirect(e,t,i);this.skyboxCache.set(e,r)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await (0,tH.lu)();let i=this.threeRenderer,r=new n.o6l(256,{generateMipmaps:!1,type:1016,format:1023,colorSpace:n.Zr2,depthBuffer:!0}),a=new n.F1T(.1,100,r),s=a.renderTarget.texture;s.name=t;let o=i.outputColorSpace,l=i.toneMapping;return i.toneMapping=0,i.outputColorSpace=n.Zr2,a.update(i,e),this.blurCubemap(r,.04),i.toneMapping=l,i.outputColorSpace=o,s}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new iv("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new iv("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(20);let e=new n.iNn,t=new n.eaF(e,this.blurMaterial);this.blurScene=new n.Z58,this.blurScene.add(t)}let i=e.clone();this.halfblur(e,i,t,"latitudinal"),this.halfblur(i,e,t,"longitudinal")}halfblur(e,t,i,r){let a=e.width,s=isFinite(i)?Math.PI/(2*a):2*Math.PI/39,o=i/s,l=isFinite(i)?1+Math.floor(3*o):20;l>20&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${l} samples when the maximum is set to 20`);let h=[],c=0;for(let e=0;e<20;++e){let t=e/o,i=Math.exp(-t*t/2);h.push(i),0==e?c+=i:e<l&&(c+=2*i)}for(let e=0;e<h.length;e++)h[e]=h[e]/c;let u=this.blurMaterial.uniforms;u.envMap.value=e.texture,u.samples.value=l,u.weights.value=h,u.latitudinal.value="latitudinal"===r,u.dTheta.value=s,new n.F1T(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){let t=new Float32Array(e),i=new n.Pq0(0,1,0);return new n.BKk({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:i}},vertexShader:`
|
|
888
|
+
|
|
889
|
+
varying vec3 vOutputDirection;
|
|
890
|
+
|
|
891
|
+
void main() {
|
|
892
|
+
|
|
893
|
+
vOutputDirection = vec3( position );
|
|
894
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
895
|
+
|
|
896
|
+
}
|
|
897
|
+
`,fragmentShader:`
|
|
898
|
+
varying vec3 vOutputDirection;
|
|
899
|
+
|
|
900
|
+
uniform samplerCube envMap;
|
|
901
|
+
uniform int samples;
|
|
902
|
+
uniform float weights[ n ];
|
|
903
|
+
uniform bool latitudinal;
|
|
904
|
+
uniform float dTheta;
|
|
905
|
+
uniform vec3 poleAxis;
|
|
906
|
+
|
|
907
|
+
vec3 getSample( float theta, vec3 axis ) {
|
|
908
|
+
|
|
909
|
+
float cosTheta = cos( theta );
|
|
910
|
+
// Rodrigues' axis-angle rotation
|
|
911
|
+
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
912
|
+
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
913
|
+
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
914
|
+
|
|
915
|
+
return vec3( textureCube( envMap, sampleDirection ) );
|
|
916
|
+
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
void main() {
|
|
920
|
+
|
|
921
|
+
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
922
|
+
|
|
923
|
+
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
924
|
+
|
|
925
|
+
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
926
|
+
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
axis = normalize( axis );
|
|
930
|
+
|
|
931
|
+
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
932
|
+
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
933
|
+
|
|
934
|
+
for ( int i = 1; i < n; i++ ) {
|
|
935
|
+
|
|
936
|
+
if ( i >= samples ) {
|
|
937
|
+
|
|
938
|
+
break;
|
|
939
|
+
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
float theta = dTheta * float( i );
|
|
943
|
+
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
944
|
+
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
945
|
+
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
`,blending:0,depthTest:!1,depthWrite:!1,side:1})}async dispose(){for(let[,e]of this.skyboxCache)(await e).dispose();null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}let ix=[1,.79,.62,.5,.4,.31,.25],i_="high-performance";class iE extends n.Qev{static get singleton(){return this._singleton||(this._singleton=new iE({powerPreference:(self.ModelViewerElement||{}).powerPreference||i_,debug:(0,tH.Bb)()})),this._singleton}static resetSingleton(){let e=this._singleton.dispose();for(let t of e)t.disconnectedCallback();for(let t of(this._singleton=new iE({powerPreference:(self.ModelViewerElement||{}).powerPreference||i_,debug:(0,tH.Bb)()}),e))t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return ix[this.scaleStep]}set minScale(e){let t=1;for(;t<ix.length&&!(ix[t]<e);)++t;this.lastStep=t-1}constructor(e){super(),this.loader=new tV.IZ(t9),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;for(let t of(null==(e=this.textureUtils)||e.dispose(),this.textureUtils=this.canRender?new iy(this.threeRenderer):null,this.scenes))t.element[tQ.hj]()},this.dpr=window.devicePixelRatio,this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new tk({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=7}catch(e){console.warn(e)}this.arRenderer=this.canRender?new tz.tu(this):null,this.textureUtils=this.canRender?new iy(this.threeRenderer):null,this.canRender&&tV.IZ.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}registerScene(e){if(this.scenes.add(e),e.forceRescale(),this.canRender){let t=new n.I9Y;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.scenes.size>0&&this.threeRenderer.setAnimationLoop((e,t)=>this.render(e,t))}}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[tG.hr]}countVisibleScenes(){let{canvas3D:e}=this,t=0,i=null;for(let r of this.scenes){let{element:n}=r;n.modelIsVisible&&null==r.externalRenderer&&++t,e.parentElement===r.canvas.parentElement&&(i=r)}let r=t>1;if(null!=i){let t=r&&!this.multipleScenesVisible,n=!i.element.modelIsVisible;if(t||n){let{width:t,height:r}=this.sceneSize(i);this.copyPixels(i,t,r),e.parentElement.removeChild(e)}}this.multipleScenesVisible=r}updateRendererSize(){var e;let t=window.devicePixelRatio;if(t!==this.dpr)for(let e of this.scenes){let{element:t}=e;t[tG.vk](t.getBoundingClientRect())}let i=0,r=0;for(let e of this.scenes)i=Math.max(i,e.width),r=Math.max(r,e.height);if(i!==this.width||r!==this.height||t!==this.dpr)for(let n of(this.width=i,this.height=r,this.dpr=t,i=Math.ceil(i*t),r=Math.ceil(r*t),this.canRender&&this.threeRenderer.setSize(i,r,!1),this.scenes)){let{canvas:t}=n;t.width=i,t.height=r,n.forceRescale(),null==(e=n.effectRenderer)||e.setSize(i,r)}}updateRendererScale(e){let t=this.scaleStep;this.avgFrameDuration+=(0,tH.qE)(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){let t=ix[e.scaleStep],i=Math.ceil(this.width/t),r=Math.ceil(this.height/t),{style:n}=e.canvas;n.width=`${i}px`,n.height=`${r}px`,this.canvas3D.style.width=`${i}px`,this.canvas3D.style.height=`${r}px`;let a=this.dpr*t,s=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:a,minimumDpr:this.dpr*ix[this.lastStep],pixelWidth:Math.ceil(e.width*a),pixelHeight:Math.ceil(e.height*a),reason:s}}))}sceneSize(e){let{dpr:t}=this,i=ix[e.scaleStep];return{width:Math.min(Math.ceil(e.width*i*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*i*t),this.canvas3D.height)}}copyPixels(e,t,i){let r=e.context;null==r?console.log("could not acquire 2d context"):(r.clearRect(0,0,t,i),r.drawImage(this.canvas3D,0,0,t,i,0,0,t,i),e.canvas.classList.add("show"))}orderedScenes(){let e=[];for(let t of[!1,!0])for(let i of this.scenes)i.element.modelIsVisible===t&&e.push(i);return e}get isPresenting(){var e;return(null==(e=this.arRenderer)?void 0:e.isPresenting)===!0}preRender(e,t,i){let{element:r,exposure:n,toneMapping:a}=e;r[tG.Ei](t,i);let s="number"==typeof n&&!Number.isNaN(n),o=r.environmentImage,l=r.skyboxImage;this.threeRenderer.toneMappingExposure=(s?n:1)*(7!==a||"neutral"!==o&&"legacy"!==o&&(o||l)?1:1.3)}render(e,t){if(null!=t){null!=this.arRenderer&&this.arRenderer.onWebXRFrame(e,t);return}let i=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(i),this.renderedLastFrame=!1);let{canvas3D:r}=this;for(let t of this.orderedScenes()){let{element:n}=t;if(!n.loaded||!n.modelIsVisible&&t.renderCount>0||(this.preRender(t,e,i),!this.shouldRender(t)))continue;if(null!=t.externalRenderer){let e=t.getCamera();e.updateMatrix();let{matrix:i,projectionMatrix:r}=e,n=i.elements.slice(),a=t.getTarget();n[12]+=a.x,n[13]+=a.y,n[14]+=a.z,t.externalRenderer.render({viewMatrix:n,projectionMatrix:r.elements});continue}if(!n.modelIsVisible&&!this.multipleScenesVisible)for(let e of this.scenes)e.element.modelIsVisible&&e.queueRender();let{width:a,height:s}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-s,a,s),null!=t.effectRenderer?t.effectRenderer.render(i):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,a,s):r.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(r),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;let e=[];for(let t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}},119(e,t,i){"use strict";i.d(t,{iC:()=>u,zJ:()=>d});var r=i(874),n=i(9051),a=i(1535),s=i(8150);let o=new r.I9Y,l=new r.Pq0,h=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:0,maximumPolarAngle:Math.PI,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),c=Math.PI/8,u={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class d extends r.Qev{constructor(e,t,i){super(),this.camera=e,this.element=t,this.scene=i,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=u.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new r.dwI,this.panPerPixel=0,this.spherical=new r.YHV,this.goalSpherical=new r.YHV,this.thetaDamper=new s.A,this.phiDamper=new s.A,this.radiusDamper=new s.A,this.logFov=Math.log(h.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new s.A,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(let e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){let e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=.04*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{let{touchAction:i}=this._options;if(!this.touchDecided&&"none"!==i){this.touchDecided=!0;let r=Math.abs(e),n=Math.abs(t);if(this.changeSource===u.USER_INTERACTION&&("pan-y"===i&&n>r||"pan-x"===i&&r>n)){this.touchMode=null;return}this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;let{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?u.AUTOMATIC:u.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=u.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===u.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{let t=this.pointers.find(t=>t.id===e.pointerId);if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);let i=this.pointers.length,r=(e.clientX-t.clientX)/i,n=(e.clientY-t.clientY)/i;(0!==r||0!==n)&&(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?u.AUTOMATIC:u.USER_INTERACTION,null!==this.touchMode&&this.touchMode(r,n)):(this.changeSource=u.USER_INTERACTION,this.panPerPixel>0?this.movePan(r,n):this.handleSinglePointerMove(r,n)))},this.onPointerUp=e=>{let{element:t}=this,i=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==i&&this.pointers.splice(i,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[n.av].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=u.USER_INTERACTION;let t=e.deltaY*(1==e.deltaMode?18:1)*.04*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{let{changeSource:t}=this;this.changeSource=u.USER_INTERACTION,(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},h),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){let{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",()=>{},{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){let{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new r.YHV){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,i=this.goalSpherical.radius){let{minimumAzimuthalAngle:r,maximumAzimuthalAngle:n,minimumPolarAngle:s,maximumPolarAngle:o,minimumRadius:l,maximumRadius:h}=this._options,{theta:c,phi:u,radius:d}=this.goalSpherical,p=(0,a.qE)(e,r,n);isFinite(r)||isFinite(n)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-p)+p);let A=(0,a.qE)(t,s,o),f=(0,a.qE)(i,l,h);return(p!==c||A!==u||f!==d)&&!!isFinite(p)&&!!isFinite(A)&&!!isFinite(f)&&(this.goalSpherical.theta=p,this.goalSpherical.phi=A,this.goalSpherical.radius=f,this.goalSpherical.makeSafe(),!0)}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){let{minimumFieldOfView:t,maximumFieldOfView:i}=this._options;e=(0,a.qE)(e,t,i),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,i){let{theta:r,phi:n,radius:s}=this.goalSpherical,{minimumRadius:o,maximumRadius:l,minimumFieldOfView:h,maximumFieldOfView:c}=this._options,u=this.spherical.theta-r,d=Math.PI-.001,p=r-(0,a.qE)(e,-d-u,d-u),A=0===i?0:((i>0?l:o)-s)/(Math.log(i>0?c:h)-this.goalLogFov),f=s+i*(isFinite(A)?A:(l-o)*2);if(this.setOrbit(p,n-t,f),0!==i){let e=this.goalLogFov+i;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;let{maximumPolarAngle:i,maximumRadius:r}=this._options,n=this.spherical.theta-this.goalSpherical.theta;return!(Math.abs(n)>Math.PI)||isFinite(this._options.minimumAzimuthalAngle)||isFinite(this._options.maximumAzimuthalAngle)||(this.spherical.theta-=2*Math.sign(n)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,i),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,r),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){let{style:e}=this.element;if(this._interactionEnabled){let{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new r.O9p(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,i){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,i*this.inputSensitivity)}wrapAngle(e){let t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){let{clientX:i,clientY:r}=e,{clientX:n,clientY:a}=t,s=n-i,o=a-r;return Math.sqrt(s*s+o*o)}handleSinglePointerMove(e,t){let i=this.pixelLengthToSphericalAngle(e),r=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(i,r,0)}initializePan(){let{theta:e,phi:t}=this.spherical,i=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(i),-Math.cos(t)*Math.sin(i),0,0,Math.sin(t),0,Math.sin(i),-Math.cos(t)*Math.cos(i),0)}movePan(e,t){let{scene:i}=this,r=l.set(e,t,0).multiplyScalar(this.inputSensitivity),n=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;r.multiplyScalar(n);let a=i.getTarget();a.add(r.applyMatrix3(this.panProjection)),i.boundingSphere.clampPoint(a,a),i.setTarget(a.x,a.y,a.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;let{scene:t}=this,i=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==i){let{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(i.position),t.setTarget(i.position.x,i.position.y,i.position.z)}resetRadius(){let{scene:e}=this,t=e.positionAndNormalFromPoint(o.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);let i=e.getTarget(),{theta:r,phi:n}=this.spherical,a=r-e.yaw,s=l.set(Math.sin(n)*Math.sin(a),Math.cos(n),Math.sin(n)*Math.cos(a)),h=s.dot(t.position.sub(i));i.add(s.multiplyScalar(h)),e.setTarget(i.x,i.y,i.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-h)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom){this.touchMode=null,this.element.removeEventListener("touchmove",this.disableScroll);return}this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[n.av].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[n.av].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,.04*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-c,0);break;case"ArrowDown":this.userAdjustOrbit(0,c,0);break;case"ArrowLeft":this.userAdjustOrbit(-c,0,0);break;case"ArrowRight":this.userAdjustOrbit(c,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}},1535(e,t,i){"use strict";let r;i.d(t,{Bb:()=>u,f3:()=>s,lA:()=>p,lu:()=>d,nF:()=>l,pE:()=>a,qE:()=>c,sg:()=>h});var n=i(322);let a=e=>e&&"null"!==e?o(e):null,s=()=>{if(n.al)return;let e=[];throw n.U7||e.push("WebXR Device API"),n.WW||e.push("WebXR Hit Test API"),Error(`The following APIs are required for AR, but are missing in this browser: ${e.join(", ")}`)},o=e=>new URL(e,window.location.toString()).toString(),l=(e,t)=>{let i=null,r=(...r)=>{null==i&&(e(...r),i=self.setTimeout(()=>i=null,t))};return r.flush=()=>{null!=i&&(self.clearTimeout(i),i=null)},r},h=(e,t)=>{let i=null;return(...r)=>{null!=i&&self.clearTimeout(i),i=self.setTimeout(()=>{i=null,e(...r)},t)}},c=(e,t,i)=>Math.max(t,Math.min(i,e)),u=(r=RegExp("[?&]model-viewer-debug-mode(&|$)"),()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(r)),d=(e=0)=>new Promise(t=>setTimeout(t,e)),p=(e,t,i=null)=>new Promise(r=>{e.addEventListener(t,function n(a){(!i||i(a))&&(r(a),e.removeEventListener(t,n))})})},3035(e,t,i){"use strict";i.d(t,{Ec:()=>y,W3:()=>b,mN:()=>_});let r=globalThis,n=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),s=new WeakMap;class o{constructor(e,t,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(n&&void 0===e){let i=void 0!==t&&1===t.length;i&&(e=s.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(t,e))}return e}toString(){return this.cssText}}let l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t,i="";for(let t of e.cssRules)i+=t.cssText;return new o("string"==typeof(t=i)?t:t+"",void 0,a)})(e):e,{is:h,defineProperty:c,getOwnPropertyDescriptor:u,getOwnPropertyNames:d,getOwnPropertySymbols:p,getPrototypeOf:A}=Object,f=globalThis,g=f.trustedTypes,m=g?g.emptyScript:"",v=f.reactiveElementPolyfillSupport,b={toAttribute(e,t){switch(t){case Boolean:e=e?m:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},y=(e,t)=>!h(e,t),x={attribute:!0,type:String,converter:b,reflect:!1,useDefault:!1,hasChanged:y};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class _ extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=x){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let i=Symbol(),r=this.getPropertyDescriptor(e,i,t);void 0!==r&&c(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){let{get:r,set:n}=u(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);n?.call(this,t),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??x}static _$Ei(){if(this.hasOwnProperty("elementProperties"))return;let e=A(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty("finalized"))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty("properties")){let e=this.properties;for(let t of[...d(e),...p(e)])this.createProperty(t,e[t])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,i]of t)this.elementProperties.set(e,i)}for(let[e,t]of(this._$Eh=new Map,this.elementProperties)){let i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e))for(let i of new Set(e.flat(1/0).reverse()))t.unshift(l(i));else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){let i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map;for(let t of this.constructor.elementProperties.keys())this.hasOwnProperty(t)&&(e.set(t,this[t]),delete this[t]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(n)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let i of t){let t=document.createElement("style"),n=r.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){let i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(void 0!==r&&!0===i.reflect){let n=(void 0!==i.converter?.toAttribute?i.converter:b).toAttribute(t,i.type);this._$Em=e,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){let i=this.constructor,r=i._$Eh.get(e);if(void 0!==r&&this._$Em!==r){let e=i.getPropertyOptions(r),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:b;this._$Em=r;let a=n.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,i,r=!1,n){if(void 0!==e){let a=this.constructor;if(!1===r&&(n=this[e]),!(((i??=a.getPropertyOptions(e)).hasChanged??y)(n,t)||i.useDefault&&i.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:r,wrapped:n},a){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==n||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,i]of e){let{wrapped:e}=i,r=this[t];!0!==e||this._$AL.has(t)||void 0===r||this.C(t,void 0,i,r)}}let e=!1,t=this._$AL;try{(e=this.shouldUpdate(t))?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}}_.elementStyles=[],_.shadowRootOptions={mode:"open"},_.elementProperties=new Map,_.finalized=new Map,v?.({ReactiveElement:_}),(f.reactiveElementVersions??=[]).push("2.1.2")},4525(e,t,i){"use strict";i.d(t,{b:()=>o});var r=i(9081),n=i(4253),a=i(8525),s=r.forwardRef((e,t)=>(0,a.jsx)(n.sG.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label";var o=s},1104(e,t,i){"use strict";i.d(t,{C1:()=>ei,bL:()=>ee,q7:()=>et});var r=i(9081),n=i(6478),a=i(3577),s=i(7463),o=i(4253),l=i(2849),h=i(8525),c=i(4798),u=i(2274),d=i(8794),p=i(5422),A="rovingFocusGroup.onEntryFocus",f={bubbles:!1,cancelable:!0},g="RovingFocusGroup",[m,v,b]=function(e){let t=e+"CollectionProvider",[i,n]=(0,s.A)(t),[o,c]=i(t,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:t,children:i}=e,n=r.useRef(null),a=r.useRef(new Map).current;return(0,h.jsx)(o,{scope:t,itemMap:a,collectionRef:n,children:i})};u.displayName=t;let d=e+"CollectionSlot",p=(0,l.TL)(d),A=r.forwardRef((e,t)=>{let{scope:i,children:r}=e,n=c(d,i),s=(0,a.s)(t,n.collectionRef);return(0,h.jsx)(p,{ref:s,children:r})});A.displayName=d;let f=e+"CollectionItemSlot",g="data-radix-collection-item",m=(0,l.TL)(f),v=r.forwardRef((e,t)=>{let{scope:i,children:n,...s}=e,o=r.useRef(null),l=(0,a.s)(t,o),u=c(f,i);return r.useEffect(()=>(u.itemMap.set(o,{ref:o,...s}),()=>void u.itemMap.delete(o))),(0,h.jsx)(m,{...{[g]:""},ref:l,children:n})});return v.displayName=f,[{Provider:u,Slot:A,ItemSlot:v},function(t){let i=c(e+"CollectionConsumer",t);return r.useCallback(()=>{let e=i.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(i.itemMap.values()).sort((e,i)=>t.indexOf(e.ref.current)-t.indexOf(i.ref.current))},[i.collectionRef,i.itemMap])},n]}(g),[y,x]=(0,s.A)(g,[b]),[_,E]=y(g),S=r.forwardRef((e,t)=>(0,h.jsx)(m.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(m.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(C,{...e,ref:t})})}));S.displayName=g;var C=r.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:i,orientation:s,loop:l=!1,dir:c,currentTabStopId:m,defaultCurrentTabStopId:b,onCurrentTabStopIdChange:y,onEntryFocus:x,preventScrollOnEntryFocus:E=!1,...S}=e,C=r.useRef(null),M=(0,a.s)(t,C),w=(0,p.jH)(c),[I,B]=(0,d.i)({prop:m,defaultProp:b??null,onChange:y,caller:g}),[R,D]=r.useState(!1),L=(0,u.c)(x),P=v(i),U=r.useRef(!1),[F,N]=r.useState(0);return r.useEffect(()=>{let e=C.current;if(e)return e.addEventListener(A,L),()=>e.removeEventListener(A,L)},[L]),(0,h.jsx)(_,{scope:i,orientation:s,dir:w,loop:l,currentTabStopId:I,onItemFocus:r.useCallback(e=>B(e),[B]),onItemShiftTab:r.useCallback(()=>D(!0),[]),onFocusableItemAdd:r.useCallback(()=>N(e=>e+1),[]),onFocusableItemRemove:r.useCallback(()=>N(e=>e-1),[]),children:(0,h.jsx)(o.sG.div,{tabIndex:R||0===F?-1:0,"data-orientation":s,...S,ref:M,style:{outline:"none",...e.style},onMouseDown:(0,n.mK)(e.onMouseDown,()=>{U.current=!0}),onFocus:(0,n.mK)(e.onFocus,e=>{let t=!U.current;if(e.target===e.currentTarget&&t&&!R){let t=new CustomEvent(A,f);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=P().filter(e=>e.focusable);T([e.find(e=>e.active),e.find(e=>e.id===I),...e].filter(Boolean).map(e=>e.ref.current),E)}}U.current=!1}),onBlur:(0,n.mK)(e.onBlur,()=>D(!1))})})}),M="RovingFocusGroupItem",w=r.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:i,focusable:a=!0,active:s=!1,tabStopId:l,children:u,...d}=e,p=(0,c.B)(),A=l||p,f=E(M,i),g=f.currentTabStopId===A,b=v(i),{onFocusableItemAdd:y,onFocusableItemRemove:x,currentTabStopId:_}=f;return r.useEffect(()=>{if(a)return y(),()=>x()},[a,y,x]),(0,h.jsx)(m.ItemSlot,{scope:i,id:A,focusable:a,active:s,children:(0,h.jsx)(o.sG.span,{tabIndex:g?0:-1,"data-orientation":f.orientation,...d,ref:t,onMouseDown:(0,n.mK)(e.onMouseDown,e=>{a?f.onItemFocus(A):e.preventDefault()}),onFocus:(0,n.mK)(e.onFocus,()=>f.onItemFocus(A)),onKeyDown:(0,n.mK)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,i){var r;let n=(r=e.key,"rtl"!==i?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return I[n]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=b().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)n.reverse();else if("prev"===t||"next"===t){var i,r;"prev"===t&&n.reverse();let a=n.indexOf(e.currentTarget);n=f.loop?(i=n,r=a+1,i.map((e,t)=>i[(r+t)%i.length])):n.slice(a+1)}setTimeout(()=>T(n))}}),children:"function"==typeof u?u({isCurrentTabStop:g,hasTabStop:null!=_}):u})})});w.displayName=M;var I={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function T(e,t=!1){let i=document.activeElement;for(let r of e)if(r===i||(r.focus({preventScroll:t}),document.activeElement!==i))return}var B=i(6026),R=i(7537),D="Radio",[L,P]=(0,s.A)(D),[U,F]=L(D),N=r.forwardRef((e,t)=>{let{__scopeRadio:i,name:s,checked:l=!1,required:c,disabled:u,value:d="on",onCheck:p,form:A,...f}=e,[g,m]=r.useState(null),v=(0,a.s)(t,e=>m(e)),b=r.useRef(!1),y=!g||A||!!g.closest("form");return(0,h.jsxs)(U,{scope:i,checked:l,disabled:u,children:[(0,h.jsx)(o.sG.button,{type:"button",role:"radio","aria-checked":l,"data-state":G(l),"data-disabled":u?"":void 0,disabled:u,value:d,...f,ref:v,onClick:(0,n.mK)(e.onClick,e=>{l||p?.(),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&(0,h.jsx)(Q,{control:g,bubbles:!b.current,name:s,value:d,checked:l,required:c,disabled:u,form:A,style:{transform:"translateX(-100%)"}})]})});N.displayName=D;var O="RadioIndicator",k=r.forwardRef((e,t)=>{let{__scopeRadio:i,forceMount:r,...n}=e,a=F(O,i);return(0,h.jsx)(R.C,{present:r||a.checked,children:(0,h.jsx)(o.sG.span,{"data-state":G(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})})});k.displayName=O;var Q=r.forwardRef(({__scopeRadio:e,control:t,checked:i,bubbles:n=!0,...s},l)=>{let c,u=r.useRef(null),d=(0,a.s)(u,l),p=(c=r.useRef({value:i,previous:i}),r.useMemo(()=>(c.current.value!==i&&(c.current.previous=c.current.value,c.current.value=i),c.current.previous),[i])),A=function(e){let[t,i]=r.useState(void 0);return(0,B.N)(()=>{if(e){i({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,n;if(!Array.isArray(t)||!t.length)return;let a=t[0];if("borderBoxSize"in a){let e=a.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,n=t.blockSize}else r=e.offsetWidth,n=e.offsetHeight;i({width:r,height:n})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}i(void 0)},[e]),t}(t);return r.useEffect(()=>{let e=u.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(p!==i&&t){let r=new Event("click",{bubbles:n});t.call(e,i),e.dispatchEvent(r)}},[p,i,n]),(0,h.jsx)(o.sG.input,{type:"radio","aria-hidden":!0,defaultChecked:i,...s,tabIndex:-1,ref:d,style:{...s.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function G(e){return e?"checked":"unchecked"}Q.displayName="RadioBubbleInput";var H=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],z="RadioGroup",[V,q]=(0,s.A)(z,[x,P]),W=x(),j=P(),[X,Y]=V(z),J=r.forwardRef((e,t)=>{let{__scopeRadioGroup:i,name:r,defaultValue:n,value:a,required:s=!1,disabled:l=!1,orientation:c,dir:u,loop:A=!0,onValueChange:f,...g}=e,m=W(i),v=(0,p.jH)(u),[b,y]=(0,d.i)({prop:a,defaultProp:n??null,onChange:f,caller:z});return(0,h.jsx)(X,{scope:i,name:r,required:s,disabled:l,value:b,onValueChange:y,children:(0,h.jsx)(S,{asChild:!0,...m,orientation:c,dir:v,loop:A,children:(0,h.jsx)(o.sG.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":l?"":void 0,dir:v,...g,ref:t})})})});J.displayName=z;var K="RadioGroupItem",$=r.forwardRef((e,t)=>{let{__scopeRadioGroup:i,disabled:s,...o}=e,l=Y(K,i),c=l.disabled||s,u=W(i),d=j(i),p=r.useRef(null),A=(0,a.s)(t,p),f=l.value===o.value,g=r.useRef(!1);return r.useEffect(()=>{let e=e=>{H.includes(e.key)&&(g.current=!0)},t=()=>g.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),(0,h.jsx)(w,{asChild:!0,...u,focusable:!c,active:f,children:(0,h.jsx)(N,{disabled:c,required:l.required,checked:f,...d,...o,name:l.name,ref:A,onCheck:()=>l.onValueChange(o.value),onKeyDown:(0,n.mK)(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:(0,n.mK)(o.onFocus,()=>{g.current&&p.current?.click()})})})});$.displayName=K;var Z=r.forwardRef((e,t)=>{let{__scopeRadioGroup:i,...r}=e,n=j(i);return(0,h.jsx)(k,{...n,...r,ref:t})});Z.displayName="RadioGroupIndicator";var ee=J,et=$,ei=Z},2608(e,t,i){"use strict";let r,n,a,s;i.d(t,{NNP:()=>tY,yLC:()=>tJ});let o=(e,t)=>{if("number"==typeof e){if(3===t)return{mode:"rgb",r:(e>>8&15|e>>4&240)/255,g:(e>>4&15|240&e)/255,b:(15&e|e<<4&240)/255};if(4===t)return{mode:"rgb",r:(e>>12&15|e>>8&240)/255,g:(e>>8&15|e>>4&240)/255,b:(e>>4&15|240&e)/255,alpha:(15&e|e<<4&240)/255};if(6===t)return{mode:"rgb",r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255};if(8===t)return{mode:"rgb",r:(e>>24&255)/255,g:(e>>16&255)/255,b:(e>>8&255)/255,alpha:(255&e)/255}}},l={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},h=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,c="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",u=`${c}%`,d=`(?:${c}%|${c})`,p=`(?:${c}%|${c}|none)`,A=`(?:${c}(deg|grad|rad|turn)|${c})`,f="\\s*,\\s*";RegExp("^"+p+"$");let g=RegExp(`^rgba?\\(\\s*${c}${f}${c}${f}${c}\\s*(?:,\\s*${d}\\s*)?\\)$`),m=RegExp(`^rgba?\\(\\s*${u}${f}${u}${f}${u}\\s*(?:,\\s*${d}\\s*)?\\)$`),v=(e="rgb")=>t=>{let i;return void 0!==(t=void 0===(i=t)?void 0:"object"!=typeof i?H(i):void 0!==i.mode?i:e?{...i,mode:e}:void 0)?t.mode===e?t:b[t.mode][e]?b[t.mode][e](t):"rgb"===e?b[t.mode].rgb(t):b.rgb[e](b[t.mode].rgb(t)):void 0},b={},y={},x=[],_={},E=e=>e,S=e=>(b[e.mode]={...b[e.mode],...e.toMode},Object.keys(e.fromMode||{}).forEach(t=>{b[t]||(b[t]={}),b[t][e.mode]=e.fromMode[t]}),e.ranges||(e.ranges={}),e.difference||(e.difference={}),e.channels.forEach(t=>{if(void 0===e.ranges[t]&&(e.ranges[t]=[0,1]),!e.interpolate[t])throw Error(`Missing interpolator for: ${t}`);"function"==typeof e.interpolate[t]&&(e.interpolate[t]={use:e.interpolate[t]}),e.interpolate[t].fixup||(e.interpolate[t].fixup=E)}),y[e.mode]=e,(e.parse||[]).forEach(t=>{C(t,e.mode)}),v(e.mode)),C=(e,t)=>{if("string"==typeof e){if(!t)throw Error("'mode' required when 'parser' is a string");_[e]=t}else"function"==typeof e&&0>x.indexOf(e)&&x.push(e)},M=/[^\x00-\x7F]|[a-zA-Z_]/,w=/[^\x00-\x7F]|[-\w]/,I="function",T="ident",B="number",R="percentage",D="none",L="alpha",P=0;function U(e){let t=e[P],i=e[P+1];return"-"===t||"+"===t?/\d/.test(i)||"."===i&&/\d/.test(e[P+2]):"."===t?/\d/.test(i):/\d/.test(t)}function F(e){if(P>=e.length)return!1;let t=e[P];if(M.test(t))return!0;if("-"===t){if(e.length-P<2)return!1;let t=e[P+1];if("-"===t||M.test(t))return!0}return!1}let N={deg:1,rad:180/Math.PI,grad:.9,turn:360};function O(e){let t="";if(("-"===e[P]||"+"===e[P])&&(t+=e[P++]),t+=k(e),"."===e[P]&&/\d/.test(e[P+1])&&(t+=e[P++]+k(e)),("e"===e[P]||"E"===e[P])&&(("-"===e[P+1]||"+"===e[P+1])&&/\d/.test(e[P+2])?t+=e[P++]+e[P++]+k(e):/\d/.test(e[P+1])&&(t+=e[P++]+k(e))),F(e)){let i=Q(e);return"deg"===i||"rad"===i||"turn"===i||"grad"===i?{type:"hue",value:t*N[i]}:void 0}return"%"===e[P]?(P++,{type:R,value:+t}):{type:B,value:+t}}function k(e){let t="";for(;/\d/.test(e[P]);)t+=e[P++];return t}function Q(e){let t="";for(;P<e.length&&w.test(e[P]);)t+=e[P++];return t}function G(e,t){let i,r=[];for(;e._i<e.length;){if((i=e[e._i++]).type===D||i.type===B||i.type===L||i.type===R||t&&"hue"===i.type){r.push(i);continue}if(")"===i.type){if(e._i<e.length)return;continue}return}if(!(r.length<3)&&!(r.length>4)){if(4===r.length){if(r[3].type!==L)return;r[3]=r[3].value}return 3===r.length&&r.push({type:D,value:void 0}),r.every(e=>e.type!==L)?r:void 0}}let H=e=>{let t;if("string"!=typeof e)return;let i=function(e=""){let t,i=e.trim(),r=[];for(P=0;P<i.length;){if("\n"===(t=i[P++])||" "===t||" "===t){for(;P<i.length&&("\n"===i[P]||" "===i[P]||" "===i[P]);)P++;continue}if(","===t)return;if(")"===t){r.push({type:")"});continue}if("+"===t){if(P--,U(i)){r.push(O(i));continue}return}if("-"===t){if(P--,U(i)){r.push(O(i));continue}if(F(i)){r.push({type:T,value:Q(i)});continue}return}if("."===t){if(P--,U(i)){r.push(O(i));continue}return}if("/"===t){let e;for(;P<i.length&&("\n"===i[P]||" "===i[P]||" "===i[P]);)P++;if(U(i)&&"hue"!==(e=O(i)).type){r.push({type:L,value:e});continue}if(F(i)&&"none"===Q(i)){r.push({type:L,value:{type:D,value:void 0}});continue}return}if(/\d/.test(t)){P--,r.push(O(i));continue}if(M.test(t)){P--,r.push(function(e){let t=Q(e);return"("===e[P]?(P++,{type:I,value:t}):"none"===t?{type:D,value:void 0}:{type:T,value:t}}(i));continue}return}return r}(e),r=i?function(e,t){e._i=0;let i=e[e._i++];if(!i||i.type!==I)return;let r=G(e,t);if(r)return r.unshift(i.value),r}(i,!0):void 0,n=0,a=x.length;for(;n<a;)if(void 0!==(t=x[n++](e,r)))return t;return i?function(e){e._i=0;let t=e[e._i++];if(!t||t.type!==I||"color"!==t.value||(t=e[e._i++]).type!==T)return;let i=_[t.value];if(!i)return;let r={mode:i},n=G(e,!1);if(!n)return;let a=y[i].channels;for(let e=0,t,i;e<a.length;e++)t=n[e],i=a[e],t.type!==D&&(r[i]=t.type===B?t.value:t.value/100,"alpha"===i&&(r[i]=Math.max(0,Math.min(1,r[i]))));return r}(i):void 0},z=(r=(e,t,i)=>e+i*(t-e),e=>{let t=(e=>{let t=[];for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1];void 0===r&&void 0===n?t.push(void 0):void 0!==r&&void 0!==n?t.push([r,n]):t.push(void 0!==r?[r,r]:[n,n])}return t})(e);return e=>{let i=e*t.length,n=e>=1?t.length-1:Math.max(Math.floor(i),0),a=t[n];return void 0===a?void 0:r(a[0],a[1],i-n)}}),V=e=>{let t=!1,i=e.map(e=>void 0!==e?(t=!0,e):1);return t?i:e},q={mode:"rgb",channels:["r","g","b","alpha"],parse:[function(e,t){if(!t||"rgb"!==t[0]&&"rgba"!==t[0])return;let i={mode:"rgb"},[,r,n,a,s]=t;if("hue"!==r.type&&"hue"!==n.type&&"hue"!==a.type)return r.type!==D&&(i.r=r.type===B?r.value/255:r.value/100),n.type!==D&&(i.g=n.type===B?n.value/255:n.value/100),a.type!==D&&(i.b=a.type===B?a.value/255:a.value/100),s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i},e=>{let t;return(t=e.match(h))?o(parseInt(t[1],16),t[1].length):void 0},e=>{let t,i={mode:"rgb"};if(t=e.match(g))void 0!==t[1]&&(i.r=t[1]/255),void 0!==t[2]&&(i.g=t[2]/255),void 0!==t[3]&&(i.b=t[3]/255);else{if(!(t=e.match(m)))return;void 0!==t[1]&&(i.r=t[1]/100),void 0!==t[2]&&(i.g=t[2]/100),void 0!==t[3]&&(i.b=t[3]/100)}return void 0!==t[4]?i.alpha=Math.max(0,Math.min(1,t[4]/100)):void 0!==t[5]&&(i.alpha=Math.max(0,Math.min(1,+t[5]))),i},e=>o(l[e.toLowerCase()],6),e=>"transparent"===e?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,"srgb"],serialize:"srgb",interpolate:{r:z,g:z,b:z,alpha:{use:z,fixup:V}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},W=(e=0)=>Math.pow(Math.abs(e),563/256)*Math.sign(e),j=e=>{let t=W(e.r),i=W(e.g),r=W(e.b),n={mode:"xyz65",x:.5766690429101305*t+.1855582379065463*i+.1882286462349947*r,y:.297344975250536*t+.6273635662554661*i+.0752914584939979*r,z:.0270313613864123*t+.0706888525358272*i+.9913375368376386*r};return void 0!==e.alpha&&(n.alpha=e.alpha),n},X=e=>Math.pow(Math.abs(e),256/563)*Math.sign(e),Y=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"a98",r:X(2.0415879038107465*e-.5650069742788597*t-.3447313507783297*i),g:X(-.9692436362808798*e+1.8759675015077206*t+.0415550574071756*i),b:X(.0134442806320312*e-.1183623922310184*t+1.0151749943912058*i)};return void 0!==r&&(n.alpha=r),n},J=(e=0)=>{let t=Math.abs(e);return t<=.04045?e/12.92:(Math.sign(e)||1)*Math.pow((t+.055)/1.055,2.4)},K=({r:e,g:t,b:i,alpha:r})=>{let n={mode:"lrgb",r:J(e),g:J(t),b:J(i)};return void 0!==r&&(n.alpha=r),n},$=e=>{let{r:t,g:i,b:r,alpha:n}=K(e),a={mode:"xyz65",x:.4123907992659593*t+.357584339383878*i+.1804807884018343*r,y:.2126390058715102*t+.715168678767756*i+.0721923153607337*r,z:.0193308187155918*t+.119194779794626*i+.9505321522496607*r};return void 0!==n&&(a.alpha=n),a},Z=(e=0)=>{let t=Math.abs(e);return t>.0031308?(Math.sign(e)||1)*(1.055*Math.pow(t,1/2.4)-.055):12.92*e},ee=({r:e,g:t,b:i,alpha:r},n="rgb")=>{let a={mode:n,r:Z(e),g:Z(t),b:Z(i)};return void 0!==r&&(a.alpha=r),a},et=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=ee({r:3.2409699419045226*e-1.537383177570094*t-.4986107602930034*i,g:-.9692436362808796*e+1.8759675015077204*t+.0415550574071756*i,b:.0556300796969936*e-.2039769588889765*t+1.0569715142428784*i});return void 0!==r&&(n.alpha=r),n},ei={...q,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:e=>Y($(e)),xyz65:Y},toMode:{rgb:e=>et(j(e)),xyz65:j}},er=e=>(e%=360)<0?e+360:e,en=e=>{let t;return t=e=>180>=Math.abs(e)?e:e-360*Math.sign(e),e.map((i,r,n)=>{if(void 0===i)return i;let a=er(i);return 0===r||void 0===e[r-1]?a:t(a-er(n[r-1]))}).reduce((e,t)=>(e.length&&void 0!==t&&void 0!==e[e.length-1]?e.push(t+e[e.length-1]):e.push(t),e),[])},ea=[-.14861,1.78277,-.29227,-.90649,1.97294,0],es=Math.PI/180,eo=180/Math.PI,el=ea["3"]*ea["4"],eh=ea["1"]*ea["4"],ec=ea["1"]*ea["2"]-ea["0"]*ea["3"],eu=(e,t)=>{if(void 0===e.h||void 0===t.h||!e.s||!t.s)return 0;let i=er(e.h),r=Math.sin((er(t.h)-i+360)/2*Math.PI/180);return 2*Math.sqrt(e.s*t.s)*r},ed=(e,t)=>{if(void 0===e.h||void 0===t.h||!e.c||!t.c)return 0;let i=er(e.h),r=Math.sin((er(t.h)-i+360)/2*Math.PI/180);return 2*Math.sqrt(e.c*t.c)*r},ep=e=>{let t=e.reduce((e,t)=>{if(void 0!==t){let i=t*Math.PI/180;e.sin+=Math.sin(i),e.cos+=Math.cos(i)}return e},{sin:0,cos:0}),i=180*Math.atan2(t.sin,t.cos)/Math.PI;return i<0?360+i:i},eA={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:({r:e,g:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=(ec*i+e*el-t*eh)/(ec+el-eh),a=i-n,s=(ea["4"]*(t-n)-ea["2"]*a)/ea["3"],o={mode:"cubehelix",l:n,s:0===n||1===n?void 0:Math.sqrt(a*a+s*s)/(ea["4"]*n*(1-n))};return o.s&&(o.h=Math.atan2(s,a)*eo-120),void 0!==r&&(o.alpha=r),o}},toMode:{rgb:({h:e,s:t,l:i,alpha:r})=>{let n={mode:"rgb"};void 0===i&&(i=0);let a=void 0===t?0:t*i*(1-i),s=Math.cos(e=(void 0===e?0:e+120)*es),o=Math.sin(e);return n.r=i+a*(ea["0"]*s+ea["1"]*o),n.g=i+a*(ea["2"]*s+ea["3"]*o),n.b=i+a*(ea["4"]*s+ea["5"]*o),void 0!==r&&(n.alpha=r),n}},interpolate:{h:{use:z,fixup:en},s:z,l:z,alpha:{use:z,fixup:V}},difference:{h:eu},average:{h:ep}},ef=({l:e,a:t,b:i,alpha:r},n="lch")=>{void 0===t&&(t=0),void 0===i&&(i=0);let a=Math.sqrt(t*t+i*i),s={mode:n,l:e,c:a};return a&&(s.h=er(180*Math.atan2(i,t)/Math.PI)),void 0!==r&&(s.alpha=r),s},eg=({l:e,c:t,h:i,alpha:r},n="lab")=>{void 0===i&&(i=0);let a={mode:n,l:e,a:t?t*Math.cos(i/180*Math.PI):0,b:t?t*Math.sin(i/180*Math.PI):0};return void 0!==r&&(a.alpha=r),a},em={X:.3457/.3585,Y:1,Z:.8251046025104602},ev={X:.3127/.329,Y:1,Z:1.0890577507598784},eb=e=>Math.pow(e,3)>.008856451679035631?Math.pow(e,3):(116*e-16)/903.2962962962963,ey=({l:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=(e+16)/116,a=t/500+n,s=n-i/200,o={mode:"xyz65",x:eb(a)*ev.X,y:eb(n)*ev.Y,z:eb(s)*ev.Z};return void 0!==r&&(o.alpha=r),o},ex=e=>et(ey(e)),e_=e=>e>.008856451679035631?Math.cbrt(e):(903.2962962962963*e+16)/116,eE=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=e_(e/ev.X),a=e_(t/ev.Y),s={mode:"lab65",l:116*a-16,a:500*(n-a),b:200*(a-e_(i/ev.Z))};return void 0!==r&&(s.alpha=r),s},eS=e=>{let t=eE($(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},eC=26/180*Math.PI,eM=Math.cos(eC),ew=Math.sin(eC),eI=100/Math.log(1.39),eT=({l:e,c:t,h:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"lab65",l:(Math.exp(e/eI)-1)/.0039},a=(Math.exp(.0435*t*1)-1)/.075,s=a*Math.cos(i/180*Math.PI-eC),o=a*Math.sin(i/180*Math.PI-eC);return n.a=s*eM-o/.83*ew,n.b=s*ew+o/.83*eM,void 0!==r&&(n.alpha=r),n},eB=({l:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=t*eM+i*ew,a=.83*(i*eM-t*ew),s={mode:"dlch",l:eI/1*Math.log(1+.0039*e),c:Math.log(1+.075*Math.sqrt(n*n+a*a))/.0435};return s.c&&(s.h=er((Math.atan2(a,n)+eC)/Math.PI*180)),void 0!==r&&(s.alpha=r),s},eR=e=>eT(ef(e,"dlch")),eD=e=>eg(eB(e),"dlab"),eL=RegExp(`^hsla?\\(\\s*${A}${f}${u}${f}${u}\\s*(?:,\\s*${d}\\s*)?\\)$`),eP={mode:"hsl",toMode:{rgb:function({h:e,s:t,l:i,alpha:r}){let n;e=er(void 0!==e?e:0),void 0===t&&(t=0),void 0===i&&(i=0);let a=i+t*(i<.5?i:1-i),s=a-(a-i)*2*Math.abs(e/60%2-1);switch(Math.floor(e/60)){case 0:n={r:a,g:s,b:2*i-a};break;case 1:n={r:s,g:a,b:2*i-a};break;case 2:n={r:2*i-a,g:a,b:s};break;case 3:n={r:2*i-a,g:s,b:a};break;case 4:n={r:s,g:2*i-a,b:a};break;case 5:n={r:a,g:2*i-a,b:s};break;default:n={r:2*i-a,g:2*i-a,b:2*i-a}}return n.mode="rgb",void 0!==r&&(n.alpha=r),n}},fromMode:{rgb:function({r:e,g:t,b:i,alpha:r}){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.max(e,t,i),a=Math.min(e,t,i),s={mode:"hsl",s:n===a?0:(n-a)/(1-Math.abs(n+a-1)),l:.5*(n+a)};return n-a!=0&&(s.h=(n===e?(t-i)/(n-a)+(t<i)*6:n===t?(i-e)/(n-a)+2:(e-t)/(n-a)+4)*60),void 0!==r&&(s.alpha=r),s}},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[function(e,t){if(!t||"hsl"!==t[0]&&"hsla"!==t[0])return;let i={mode:"hsl"},[,r,n,a,s]=t;if(r.type!==D){if(r.type===R)return;i.h=r.value}if(n.type!==D){if("hue"===n.type)return;i.s=n.value/100}if(a.type!==D){if("hue"===a.type)return;i.l=a.value/100}return s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i},e=>{let t=e.match(eL);if(!t)return;let i={mode:"hsl"};return void 0!==t[3]?i.h=+t[3]:void 0!==t[1]&&void 0!==t[2]&&(i.h=((e,t)=>{switch(t){case"deg":return+e;case"rad":return e/Math.PI*180;case"grad":return e/10*9;case"turn":return 360*e}})(t[1],t[2])),void 0!==t[4]&&(i.s=Math.min(Math.max(0,t[4]/100),1)),void 0!==t[5]&&(i.l=Math.min(Math.max(0,t[5]/100),1)),void 0!==t[6]?i.alpha=Math.max(0,Math.min(1,t[6]/100)):void 0!==t[7]&&(i.alpha=Math.max(0,Math.min(1,+t[7]))),i}],serialize:e=>`hsl(${void 0!==e.h?e.h:"none"} ${void 0!==e.s?100*e.s+"%":"none"} ${void 0!==e.l?100*e.l+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:z,fixup:en},s:z,l:z,alpha:{use:z,fixup:V}},difference:{h:eu},average:{h:ep}};function eU({h:e,s:t,v:i,alpha:r}){let n;e=er(void 0!==e?e:0),void 0===t&&(t=0),void 0===i&&(i=0);let a=Math.abs(e/60%2-1);switch(Math.floor(e/60)){case 0:n={r:i,g:i*(1-t*a),b:i*(1-t)};break;case 1:n={r:i*(1-t*a),g:i,b:i*(1-t)};break;case 2:n={r:i*(1-t),g:i,b:i*(1-t*a)};break;case 3:n={r:i*(1-t),g:i*(1-t*a),b:i};break;case 4:n={r:i*(1-t*a),g:i*(1-t),b:i};break;case 5:n={r:i,g:i*(1-t),b:i*(1-t*a)};break;default:n={r:i*(1-t),g:i*(1-t),b:i*(1-t)}}return n.mode="rgb",void 0!==r&&(n.alpha=r),n}function eF({r:e,g:t,b:i,alpha:r}){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.max(e,t,i),a=Math.min(e,t,i),s={mode:"hsv",s:0===n?0:1-a/n,v:n};return n-a!=0&&(s.h=(n===e?(t-i)/(n-a)+(t<i)*6:n===t?(i-e)/(n-a)+2:(e-t)/(n-a)+4)*60),void 0!==r&&(s.alpha=r),s}let eN={mode:"hsv",toMode:{rgb:eU},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:eF},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:z,fixup:en},s:z,v:z,alpha:{use:z,fixup:V}},difference:{h:eu},average:{h:ep}};function eO(e){if(e<0)return 0;let t=Math.pow(e,.012683313515655966);return 1e4*Math.pow(Math.max(0,t-.8359375)/(18.8515625-18.6875*t),6.277394636015326)}function ek(e){if(e<0)return 0;let t=Math.pow(e/1e4,.1593017578125);return Math.pow((.8359375+18.8515625*t)/(1+18.6875*t),78.84375)}let eQ=e=>Math.max(e/203,0),eG=({i:e,t,p:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=eO(e+.008609037037932761*t+.11102962500302593*i),a=eO(e-.00860903703793275*t-.11102962500302599*i),s=eO(e+.5600313357106791*t-.32062717498731885*i),o={mode:"xyz65",x:eQ(2.070152218389422*n-1.3263473389671556*a+.2066510476294051*s),y:eQ(.3647385209748074*n+.680566024947227*a-.0453045459220346*s),z:eQ(-.049747207535812*n-.0492609666966138*a+1.1880659249923042*s)};return void 0!==r&&(o.alpha=r),o},eH=(e=0)=>Math.max(203*e,0),ez=({x:e,y:t,z:i,alpha:r})=>{let n=eH(e),a=eH(t),s=eH(i),o=ek(.3592832590121217*n+.6976051147779502*a-.0358915932320289*s),l=ek(-.1920808463704995*n+1.1004767970374323*a+.0753748658519118*s),h=ek(.0070797844607477*n+.0748396662186366*a+.8433265453898765*s),c={mode:"itp",i:.5*o+.5*l,t:1.61376953125*o-3.323486328125*l+1.709716796875*h,p:4.378173828125*o-4.24560546875*l-.132568359375*h};return void 0!==r&&(c.alpha=r),c},eV=e=>{if(e<0)return 0;let t=Math.pow(e/1e4,.1593017578125);return Math.pow((.8359375+18.8515625*t)/(1+18.6875*t),134.03437499999998)},eq=(e=0)=>Math.max(203*e,0),eW=({x:e,y:t,z:i,alpha:r})=>{e=eq(e),t=eq(t);let n=1.15*e-.15*(i=eq(i)),a=.66*t+.34*e,s=eV(.41478972*n+.579999*a+.014648*i),o=eV(-.20151*n+1.120649*a+.0531008*i),l=eV(-.0166008*n+.2648*a+.6684799*i),h=(s+o)/2,c={mode:"jab",j:.44*h/(1-.56*h)-16295499532821565e-27,a:3.524*s-4.066708*o+.542708*l,b:.199076*s+1.096799*o-1.295875*l};return void 0!==r&&(c.alpha=r),c},ej=e=>{if(e<0)return 0;let t=Math.pow(e,.007460772656268216);return 1e4*Math.pow((.8359375-t)/(18.6875*t-18.8515625),6.277394636015326)},eX=({j:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=(e+16295499532821565e-27)/(.44+.56*(e+16295499532821565e-27)),a=ej(n+.13860504*t+.058047316*i),s=ej(n-.13860504*t-.058047316*i),o=ej(n-.096019242*t-.8118919*i),l={mode:"xyz65",x:(1.661373024652174*a-.914523081304348*s+.23136208173913045*o)/203,y:(-.3250758611844533*a+1.571847026732543*s-.21825383453227928*o)/203,z:(-.090982811*a-.31272829*s+1.5227666*o)/203};return void 0!==r&&(l.alpha=r),l},eY=e=>{let t=eW($(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},eJ=e=>et(eX(e)),eK=({j:e,a:t,b:i,alpha:r})=>{void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.sqrt(t*t+i*i),a={mode:"jch",j:e,c:n};return n&&(a.h=er(180*Math.atan2(i,t)/Math.PI)),void 0!==r&&(a.alpha=r),a},e$=({j:e,c:t,h:i,alpha:r})=>{void 0===i&&(i=0);let n={mode:"jab",j:e,a:t?t*Math.cos(i/180*Math.PI):0,b:t?t*Math.sin(i/180*Math.PI):0};return void 0!==r&&(n.alpha=r),n},eZ=e=>Math.pow(e,3)>.008856451679035631?Math.pow(e,3):(116*e-16)/903.2962962962963,e0=({l:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=(e+16)/116,a=t/500+n,s=n-i/200,o={mode:"xyz50",x:eZ(a)*em.X,y:eZ(n)*em.Y,z:eZ(s)*em.Z};return void 0!==r&&(o.alpha=r),o},e1=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=ee({r:3.1341359569958707*e-1.6173863321612538*t-.4906619460083532*i,g:-.978795502912089*e+1.916254567259524*t+.03344273116131949*i,b:.07195537988411677*e-.2289768264158322*t+1.405386058324125*i});return void 0!==r&&(n.alpha=r),n},e2=e=>e1(e0(e)),e3=e=>{let{r:t,g:i,b:r,alpha:n}=K(e),a={mode:"xyz50",x:.436065742824811*t+.3851514688337912*i+.14307845442264197*r,y:.22249319175623702*t+.7168870538238823*i+.06061979053616537*r,z:.013923904500943465*t+.09708128566574634*i+.7140993584005155*r};return void 0!==n&&(a.alpha=n),a},e4=e=>e>.008856451679035631?Math.cbrt(e):(903.2962962962963*e+16)/116,e5=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=e4(e/em.X),a=e4(t/em.Y),s={mode:"lab",l:116*a-16,a:500*(n-a),b:200*(a-e4(i/em.Z))};return void 0!==r&&(s.alpha=r),s},e8=e=>{let t=e5(e3(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},e9={mode:"lab",toMode:{xyz50:e0,rgb:e2},fromMode:{xyz50:e5,rgb:e8},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[function(e,t){if(!t||"lab"!==t[0])return;let i={mode:"lab"},[,r,n,a,s]=t;if("hue"!==r.type&&"hue"!==n.type&&"hue"!==a.type)return r.type!==D&&(i.l=Math.min(Math.max(0,r.value),100)),n.type!==D&&(i.a=n.type===B?n.value:125*n.value/100),a.type!==D&&(i.b=a.type===B?a.value:125*a.value/100),s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`lab(${void 0!==e.l?e.l:"none"} ${void 0!==e.a?e.a:"none"} ${void 0!==e.b?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{l:z,a:z,b:z,alpha:{use:z,fixup:V}}},e6={...e9,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:ey,rgb:ex},fromMode:{xyz65:eE,rgb:eS},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}},e7={mode:"lch",toMode:{lab:eg,rgb:e=>e2(eg(e))},fromMode:{rgb:e=>ef(e8(e)),lab:ef},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[function(e,t){if(!t||"lch"!==t[0])return;let i={mode:"lch"},[,r,n,a,s]=t;if(r.type!==D){if("hue"===r.type)return;i.l=Math.min(Math.max(0,r.value),100)}if(n.type!==D&&(i.c=Math.max(0,n.type===B?n.value:150*n.value/100)),a.type!==D){if(a.type===R)return;i.h=a.value}return s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`lch(${void 0!==e.l?e.l:"none"} ${void 0!==e.c?e.c:"none"} ${void 0!==e.h?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:z,fixup:en},c:z,l:z,alpha:{use:z,fixup:V}},difference:{h:ed},average:{h:ep}},te={...e7,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:e=>eg(e,"lab65"),rgb:e=>ex(eg(e,"lab65"))},fromMode:{rgb:e=>ef(eS(e),"lch65"),lab65:e=>ef(e,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},tt=({l:e,u:t,v:i,alpha:r})=>{void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.sqrt(t*t+i*i),a={mode:"lchuv",l:e,c:n};return n&&(a.h=er(180*Math.atan2(i,t)/Math.PI)),void 0!==r&&(a.alpha=r),a},ti=({l:e,c:t,h:i,alpha:r})=>{void 0===i&&(i=0);let n={mode:"luv",l:e,u:t?t*Math.cos(i/180*Math.PI):0,v:t?t*Math.sin(i/180*Math.PI):0};return void 0!==r&&(n.alpha=r),n},tr=(e,t,i)=>4*e/(e+15*t+3*i),tn=(e,t,i)=>9*t/(e+15*t+3*i),ta=tr(em.X,em.Y,em.Z),ts=tn(em.X,em.Y,em.Z),to=({x:e,y:t,z:i,alpha:r})=>{let n;void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let a=(n=t/em.Y)<=.008856451679035631?903.2962962962963*n:116*Math.cbrt(n)-16,s=tr(e,t,i),o=tn(e,t,i);isFinite(s)&&isFinite(o)?(s=13*a*(s-ta),o=13*a*(o-ts)):a=s=o=0;let l={mode:"luv",l:a,u:s,v:o};return void 0!==r&&(l.alpha=r),l},tl=(n=em.X,4*n/(n+15*em.Y+3*em.Z)),th=(a=em.X,9*(s=em.Y)/(a+15*s+3*em.Z)),tc=({l:e,u:t,v:i,alpha:r})=>{if(void 0===e&&(e=0),0===e)return{mode:"xyz50",x:0,y:0,z:0};void 0===t&&(t=0),void 0===i&&(i=0);let n=t/(13*e)+tl,a=i/(13*e)+th,s=em.Y*(e<=8?e/903.2962962962963:Math.pow((e+16)/116,3)),o={mode:"xyz50",x:9*n*s/(4*a),y:s,z:s*(12-3*n-20*a)/(4*a)};return void 0!==r&&(o.alpha=r),o},tu={...q,mode:"lrgb",toMode:{rgb:ee},fromMode:{rgb:K},parse:["srgb-linear"],serialize:"srgb-linear"},td=({r:e,g:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.cbrt(.412221469470763*e+.5363325372617348*t+.0514459932675022*i),a=Math.cbrt(.2119034958178252*e+.6806995506452344*t+.1073969535369406*i),s=Math.cbrt(.0883024591900564*e+.2817188391361215*t+.6299787016738222*i),o={mode:"oklab",l:.210454268309314*n+.7936177747023054*a-.0040720430116193*s,a:1.9779985324311684*n-2.42859224204858*a+.450593709617411*s,b:.0259040424655478*n+.7827717124575296*a-.8086757549230774*s};return void 0!==r&&(o.alpha=r),o},tp=e=>{let t=td(K(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},tA=({l:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.pow(e+.3963377773761749*t+.2158037573099136*i,3),a=Math.pow(e-.1055613458156586*t-.0638541728258133*i,3),s=Math.pow(e-.0894841775298119*t-1.2914855480194092*i,3),o={mode:"lrgb",r:4.076741636075957*n-3.3077115392580616*a+.2309699031821044*s,g:-1.2684379732850317*n+2.6097573492876887*a-.3413193760026573*s,b:-.0041960761386756*n-.7034186179359362*a+1.7076146940746117*s};return void 0!==r&&(o.alpha=r),o},tf=e=>ee(tA(e));function tg(e){return .5*(1.206/1.03*e-.206+Math.sqrt((1.206/1.03*e-.206)*(1.206/1.03*e-.206)+1.206/1.03*.12*e))}function tm(e){return(e*e+.206*e)/(1.206/1.03*(e+.03))}function tv(e,t){let i,r,n,a,s,o,l,h,c,u,d,p,A,f,g,m,v,b=(-1.88170328*e-.80936493*t>1?(i=1.19086277,r=1.76576728,n=.59662641,a=.75515197,s=.56771245,o=4.0767416621,l=-3.3077115913,h=.2309699292):1.81444104*e-1.19445276*t>1?(i=.73956515,r=-.45954404,n=.08285427,a=.1254107,s=.14503204,o=-1.2684380046,l=2.6097574011,h=-.3413193965):(i=1.35733652,r=-.00915799,n=-1.1513021,a=-.50559606,s=.00692167,o=-.0041960863,l=-.7034186147,h=1.707614701),c=i+r*e+n*t+a*e*e+s*e*t,u=.3963377774*e+.2158037573*t,d=-.1055613458*e-.0638541728*t,p=-.0894841775*e-1.291485548*t,m=o*((A=1+c*u)*A*A)+l*((f=1+c*d)*f*f)+h*((g=1+c*p)*g*g),c-=m*(v=3*u*A*A*o+3*d*f*f*l+3*p*g*g*h)/(v*v-.5*m*(6*u*u*A*o+6*d*d*f*l+6*p*p*g*h))),y=tA({l:1,a:b*e,b:b*t}),x=Math.cbrt(1/Math.max(y.r,y.g,y.b));return[x,x*b]}function tb(e,t,i=null){i||(i=tv(e,t));let r=i[0],n=i[1];return[n/r,n/(1-r)]}function ty(e,t,i){let r=tv(t,i),n=function(e,t,i,r,n,a=null){let s;if(a||(a=tv(e,t)),(i-n)*a[1]-(a[0]-n)*1<=0)s=a[1]*n/(+a[0]+a[1]*(n-i));else{s=a[1]*(n-1)/(+(a[0]-1)+a[1]*(n-i));{let r=i-n,a=.3963377774*e+.2158037573*t,o=-.1055613458*e-.0638541728*t,l=-.0894841775*e-1.291485548*t,h=r+ +a,c=r+ +o,u=r+ +l;{let e=n*(1-s)+s*i,t=+s,r=e+t*a,d=e+t*o,p=e+t*l,A=r*r*r,f=d*d*d,g=p*p*p,m=3*h*r*r,v=3*c*d*d,b=3*u*p*p,y=6*h*h*r,x=6*c*c*d,_=6*u*u*p,E=4.0767416621*A-3.3077115913*f+.2309699292*g-1,S=4.0767416621*m-3.3077115913*v+.2309699292*b,C=S/(S*S-.5*E*(4.0767416621*y-3.3077115913*x+.2309699292*_)),M=-E*C,w=-1.2684380046*A+2.6097574011*f-.3413193965*g-1,I=-1.2684380046*m+2.6097574011*v-.3413193965*b,T=I/(I*I-.5*w*(-1.2684380046*y+2.6097574011*x-.3413193965*_)),B=-w*T,R=-.0041960863*A-.7034186147*f+1.707614701*g-1,D=-.0041960863*m-.7034186147*v+1.707614701*b,L=D/(D*D-.5*R*(-.0041960863*y-.7034186147*x+1.707614701*_)),P=-R*L;s+=Math.min(M=C>=0?M:1e6,Math.min(B=T>=0?B:1e6,P=L>=0?P:1e6))}}}return s}(t,i,e,0,e,r),a=tb(t,i,r),s=.11516993+1/(7.4477897+4.1590124*i+t*(-2.19557347+1.75198401*i+t*(-2.13704948-10.02301043*i+t*(-4.24894561+5.38770819*i+4.69891013*t)))),o=.11239642+1/(1.6132032-.68124379*i+t*(.40370612+.90148123*i+t*(-.27087943+.6122399*i+t*(.00299215-.45399568*i-.14661872*t)))),l=n/Math.min(e*a[0],(1-e)*a[1]),h=e*s,c=(1-e)*o,u=.9*l*Math.sqrt(Math.sqrt(1/(1/(h*h*h*h)+1/(c*c*c*c))));return[Math.sqrt(1/(1/((h=.4*e)*h)+1/((c=(1-e)*.8)*c))),u,n]}function tx(e){let t,i=void 0!==e.l?e.l:0,r=void 0!==e.a?e.a:0,n=void 0!==e.b?e.b:0,a={mode:"okhsl",l:tg(i)};void 0!==e.alpha&&(a.alpha=e.alpha);let s=Math.sqrt(r*r+n*n);if(!s)return a.s=0,a;let[o,l,h]=ty(i,r/s,n/s);if(s<l){let e=.8*o;t=(s-0)/(e+(1-e/l)*(s-0))*.8}else{let e=.2*l*l*1.5625/o;t=.8+.2*((s-l)/(e+(1-e/(h-l))*(s-l)))}return t&&(a.s=t,a.h=er(180*Math.atan2(n,r)/Math.PI)),a}function t_(e){let t,i,r,n,a=void 0!==e.h?e.h:0,s=void 0!==e.s?e.s:0,o=void 0!==e.l?e.l:0,l={mode:"oklab",l:tm(o)};if(void 0!==e.alpha&&(l.alpha=e.alpha),!s||1===o)return l.a=l.b=0,l;let h=Math.cos(a/180*Math.PI),c=Math.sin(a/180*Math.PI),[u,d,p]=ty(l.l,h,c);s<.8?(t=1.25*s,i=0,n=1-(r=.8*u)/d):(t=5*(s-.8),i=d,n=1-(r=.2*d*d*1.5625/u)/(p-d));let A=i+t*r/(1-n*t);return l.a=A*h,l.b=A*c,l}let tE={...eP,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:tx,rgb:e=>tx(tp(e))},toMode:{oklab:t_,rgb:e=>tf(t_(e))}};function tS(e){let t=void 0!==e.l?e.l:0,i=void 0!==e.a?e.a:0,r=void 0!==e.b?e.b:0,n=Math.sqrt(i*i+r*r),a=n?i/n:1,s=n?r/n:1,[o,l]=tb(a,s),h=l/(n+t*l),c=h*t,u=h*n,d=tm(c),p=u*d/c,A=tA({l:d,a:a*p,b:s*p}),f=Math.cbrt(1/Math.max(A.r,A.g,A.b,0));t/=f;let g={mode:"okhsv",s:(n=n/f*tg(t)/t)?(.5+l)*u/(.5*l+l*(1-.5/o)*u):0,v:(t=tg(t))?t/c:0};return g.s&&(g.h=er(180*Math.atan2(r,i)/Math.PI)),void 0!==e.alpha&&(g.alpha=e.alpha),g}function tC(e){let t={mode:"oklab"};void 0!==e.alpha&&(t.alpha=e.alpha);let i=void 0!==e.h?e.h:0,r=void 0!==e.s?e.s:0,n=void 0!==e.v?e.v:0,a=Math.cos(i/180*Math.PI),s=Math.sin(i/180*Math.PI),[o,l]=tb(a,s),h=1-.5/o,c=1-.5*r/(.5+l-l*h*r),u=r*l*.5/(.5+l-l*h*r),d=tm(c),p=u*d/c,A=tA({l:d,a:a*p,b:s*p}),f=Math.cbrt(1/Math.max(A.r,A.g,A.b,0)),g=tm(n*c),m=u*g/c;return t.l=g*f,t.a=m*a*f,t.b=m*s*f,t}let tM={...eN,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:tS,rgb:e=>tS(tp(e))},toMode:{oklab:tC,rgb:e=>tf(tC(e))}},tw={...e9,mode:"oklab",toMode:{lrgb:tA,rgb:tf},fromMode:{lrgb:td,rgb:tp},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[function(e,t){if(!t||"oklab"!==t[0])return;let i={mode:"oklab"},[,r,n,a,s]=t;if("hue"!==r.type&&"hue"!==n.type&&"hue"!==a.type)return r.type!==D&&(i.l=Math.min(Math.max(0,r.type===B?r.value:r.value/100),1)),n.type!==D&&(i.a=n.type===B?n.value:.4*n.value/100),a.type!==D&&(i.b=a.type===B?a.value:.4*a.value/100),s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`oklab(${void 0!==e.l?e.l:"none"} ${void 0!==e.a?e.a:"none"} ${void 0!==e.b?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`},tI={...e7,mode:"oklch",toMode:{oklab:e=>eg(e,"oklab"),rgb:e=>tf(eg(e,"oklab"))},fromMode:{rgb:e=>ef(tp(e),"oklch"),oklab:e=>ef(e,"oklch")},parse:[function(e,t){if(!t||"oklch"!==t[0])return;let i={mode:"oklch"},[,r,n,a,s]=t;if(r.type!==D){if("hue"===r.type)return;i.l=Math.min(Math.max(0,r.type===B?r.value:r.value/100),1)}if(n.type!==D&&(i.c=Math.max(0,n.type===B?n.value:.4*n.value/100)),a.type!==D){if(a.type===R)return;i.h=a.value}return s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`oklch(${void 0!==e.l?e.l:"none"} ${void 0!==e.c?e.c:"none"} ${void 0!==e.h?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},tT=e=>{let{r:t,g:i,b:r,alpha:n}=K(e),a={mode:"xyz65",x:.486570948648216*t+.265667693169093*i+.1982172852343625*r,y:.2289745640697487*t+.6917385218365062*i+.079286914093745*r,z:0*t+.0451133818589026*i+1.043944368900976*r};return void 0!==n&&(a.alpha=n),a},tB=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=ee({r:2.4934969119414263*e-.9313836179191242*t-.402710784450717*i,g:-.8294889695615749*e+1.7626640603183465*t+.0236246858419436*i,b:.0358458302437845*e-.0761723892680418*t+.9568845240076871*i},"p3");return void 0!==r&&(n.alpha=r),n},tR={...q,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:e=>tB($(e)),xyz65:tB},toMode:{rgb:e=>et(tT(e)),xyz65:tT}},tD=e=>{let t=Math.abs(e);return t>=1/512?Math.sign(e)*Math.pow(t,1/1.8):16*e},tL=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"prophoto",r:tD(1.3457868816471585*e-.2555720873797946*t-.0511018649755453*i),g:tD(-.5446307051249019*e+1.5082477428451466*t+.0205274474364214*i),b:tD(0*e+0*t+1.2119675456389452*i)};return void 0!==r&&(n.alpha=r),n},tP=(e=0)=>{let t=Math.abs(e);return t>=16/512?Math.sign(e)*Math.pow(t,1.8):e/16},tU=e=>{let t=tP(e.r),i=tP(e.g),r=tP(e.b),n={mode:"xyz50",x:.7977666449006423*t+.1351812974005331*i+.0313477341283922*r,y:.2880748288194013*t+.7118352342418731*i+899369387256e-16*r,z:0*t+0*i+.8251046025104602*r};return void 0!==e.alpha&&(n.alpha=e.alpha),n},tF={...q,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:tL,rgb:e=>tL(e3(e))},toMode:{xyz50:tU,rgb:e=>e1(tU(e))}},tN=e=>{let t=Math.abs(e);return t>.018053968510807?(Math.sign(e)||1)*(1.09929682680944*Math.pow(t,.45)-(1.09929682680944-1)):4.5*e},tO=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"rec2020",r:tN(1.7166511879712683*e-.3556707837763925*t-.2533662813736599*i),g:tN(-.6666843518324893*e+1.6164812366349395*t+.0157685458139111*i),b:tN(.0176398574453108*e-.0427706132578085*t+.9421031212354739*i)};return void 0!==r&&(n.alpha=r),n},tk=(e=0)=>{let t=Math.abs(e);return t<.08124285829863151?e/4.5:(Math.sign(e)||1)*Math.pow((t+1.09929682680944-1)/1.09929682680944,1/.45)},tQ=e=>{let t=tk(e.r),i=tk(e.g),r=tk(e.b),n={mode:"xyz65",x:.6369580483012911*t+.1446169035862083*i+.1688809751641721*r,y:.262700212011267*t+.6779980715188708*i+.059301716469862*r,z:0*t+.0280726930490874*i+1.0609850577107909*r};return void 0!==e.alpha&&(n.alpha=e.alpha),n},tG={...q,mode:"rec2020",fromMode:{xyz65:tO,rgb:e=>tO($(e))},toMode:{xyz65:tQ,rgb:e=>et(tQ(e))},parse:["rec2020"],serialize:"rec2020"},tH=Math.cbrt(.0037930732552754493),tz=e=>Math.cbrt(e)-tH,tV=e=>Math.pow(e+tH,3),tq={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:({x:e,y:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=tV(e+t)-.0037930732552754493,a=tV(t-e)-.0037930732552754493,s=tV(i+t)-.0037930732552754493,o=ee({r:11.031566904639861*n-9.866943908131562*a-.16462299650829934*s,g:-3.2541473810744237*n+4.418770377582723*a-.16462299650829934*s,b:-3.6588512867136815*n+2.7129230459360922*a+1.9459282407775895*s});return void 0!==r&&(o.alpha=r),o}},fromMode:{rgb:e=>{let{r:t,g:i,b:r,alpha:n}=K(e),a=tz(.3*t+.622*i+.078*r+.0037930732552754493),s=tz(.23*t+.692*i+.078*r+.0037930732552754493),o={mode:"xyb",x:(a-s)/2,y:(a+s)/2,b:tz(.2434226892454782*t+.2047674442449682*i+.5518098665095535*r+.0037930732552754493)-(a+s)/2};return void 0!==n&&(o.alpha=n),o}},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:z,y:z,b:z,alpha:{use:z,fixup:V}}},tW={mode:"yiq",toMode:{rgb:({y:e,i:t,q:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"rgb",r:e+.95608445*t+.6208885*i,g:e-.27137664*t-.6486059*i,b:e-1.10561724*t+1.70250126*i};return void 0!==r&&(n.alpha=r),n}},fromMode:{rgb:({r:e,g:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"yiq",y:.29889531*e+.58662247*t+.11448223*i,i:.59597799*e-.2741761*t-.32180189*i,q:.21147017*e-.52261711*t+.31114694*i};return void 0!==r&&(n.alpha=r),n}},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:z,i:z,q:z,alpha:{use:z,fixup:V}}};((e=4)=>t=>{let i;return"number"==typeof t?Math.round(t*(i=Math.pow(10,i=e)))/i:t})(2);let tj=e=>Math.round(255*Math.max(0,Math.min(1,e||0))),tX=v("rgb");v("hsl");let tY=e=>(e=>{if(void 0!==e)return"#"+(0x1000000|tj(e.r)<<16|tj(e.g)<<8|tj(e.b)).toString(16).slice(1)})(tX(e));S(ei),S(eA),S({mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:eR,rgb:e=>ex(eR(e))},fromMode:{lab65:eD,rgb:e=>eD(eS(e))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:z,a:z,b:z,alpha:{use:z,fixup:V}}}),S({mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:eT,dlab:e=>eg(e,"dlab"),rgb:e=>ex(eT(e))},fromMode:{lab65:eB,dlab:e=>ef(e,"dlch"),rgb:e=>eB(eS(e))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:z,c:z,h:{use:z,fixup:en},alpha:{use:z,fixup:V}},difference:{h:ed},average:{h:ep}}),S({mode:"hsi",toMode:{rgb:function({h:e,s:t,i,alpha:r}){let n;e=er(void 0!==e?e:0),void 0===t&&(t=0),void 0===i&&(i=0);let a=Math.abs(e/60%2-1);switch(Math.floor(e/60)){case 0:n={r:i*(1+t*(3/(2-a)-1)),g:i*(1+t*(3*(1-a)/(2-a)-1)),b:i*(1-t)};break;case 1:n={r:i*(1+t*(3*(1-a)/(2-a)-1)),g:i*(1+t*(3/(2-a)-1)),b:i*(1-t)};break;case 2:n={r:i*(1-t),g:i*(1+t*(3/(2-a)-1)),b:i*(1+t*(3*(1-a)/(2-a)-1))};break;case 3:n={r:i*(1-t),g:i*(1+t*(3*(1-a)/(2-a)-1)),b:i*(1+t*(3/(2-a)-1))};break;case 4:n={r:i*(1+t*(3*(1-a)/(2-a)-1)),g:i*(1-t),b:i*(1+t*(3/(2-a)-1))};break;case 5:n={r:i*(1+t*(3/(2-a)-1)),g:i*(1-t),b:i*(1+t*(3*(1-a)/(2-a)-1))};break;default:n={r:i*(1-t),g:i*(1-t),b:i*(1-t)}}return n.mode="rgb",void 0!==r&&(n.alpha=r),n}},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:function({r:e,g:t,b:i,alpha:r}){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.max(e,t,i),a=Math.min(e,t,i),s={mode:"hsi",s:e+t+i===0?0:1-3*a/(e+t+i),i:(e+t+i)/3};return n-a!=0&&(s.h=(n===e?(t-i)/(n-a)+(t<i)*6:n===t?(i-e)/(n-a)+2:(e-t)/(n-a)+4)*60),void 0!==r&&(s.alpha=r),s}},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:z,fixup:en},s:z,i:z,alpha:{use:z,fixup:V}},difference:{h:eu},average:{h:ep}}),S(eP),S(eN),S({mode:"hwb",toMode:{rgb:function({h:e,w:t,b:i,alpha:r}){if(void 0===t&&(t=0),void 0===i&&(i=0),t+i>1){let e=t+i;t/=e,i/=e}return eU({h:e,s:1===i?1:1-t/(1-i),v:1-i,alpha:r})}},fromMode:{rgb:function(e){let t=eF(e);if(void 0===t)return;let i=void 0!==t.s?t.s:0,r=void 0!==t.v?t.v:0,n={mode:"hwb",w:(1-i)*r,b:1-r};return void 0!==t.h&&(n.h=t.h),void 0!==t.alpha&&(n.alpha=t.alpha),n}},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[function(e,t){if(!t||"hwb"!==t[0])return;let i={mode:"hwb"},[,r,n,a,s]=t;if(r.type!==D){if(r.type===R)return;i.h=r.value}if(n.type!==D){if("hue"===n.type)return;i.w=n.value/100}if(a.type!==D){if("hue"===a.type)return;i.b=a.value/100}return s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`hwb(${void 0!==e.h?e.h:"none"} ${void 0!==e.w?100*e.w+"%":"none"} ${void 0!==e.b?100*e.b+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:z,fixup:en},w:z,b:z,alpha:{use:z,fixup:V}},difference:{h:(e,t)=>{if(void 0===e.h||void 0===t.h)return 0;let i=er(e.h),r=er(t.h);return Math.abs(r-i)>180?i-(r-360*Math.sign(r-i)):r-i}},average:{h:ep}}),S({mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:eG,rgb:e=>et(eG(e))},fromMode:{xyz65:ez,rgb:e=>ez($(e))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:z,t:z,p:z,alpha:{use:z,fixup:V}}}),S({mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:eY,xyz65:eW},toMode:{rgb:eJ,xyz65:eX},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:z,a:z,b:z,alpha:{use:z,fixup:V}}}),S({mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:e$,rgb:e=>eJ(e$(e))},fromMode:{rgb:e=>eK(eY(e)),jab:eK},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:z,fixup:en},c:z,j:z,alpha:{use:z,fixup:V}},difference:{h:ed},average:{h:ep}}),S(e9),S(e6),S(e7),S(te),S({mode:"lchuv",toMode:{luv:ti,rgb:e=>e1(tc(ti(e)))},fromMode:{rgb:e=>tt(to(e3(e))),luv:tt},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:z,fixup:en},c:z,l:z,alpha:{use:z,fixup:V}},difference:{h:ed},average:{h:ep}}),S(tu),S({mode:"luv",toMode:{xyz50:tc,rgb:e=>e1(tc(e))},fromMode:{xyz50:to,rgb:e=>to(e3(e))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:z,u:z,v:z,alpha:{use:z,fixup:V}}}),S(tE),S(tM),S(tw);let tJ=S(tI);S(tR),S(tF),S(tG),S(q),S(tq),S({mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:e1,lab:e5},fromMode:{rgb:e3,lab:e0},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:z,y:z,z:z,alpha:{use:z,fixup:V}}}),S({mode:"xyz65",toMode:{rgb:et,xyz50:e=>{let{x:t,y:i,z:r,alpha:n}=e;void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=0);let a={mode:"xyz50",x:1.0479298208405488*t+.0229467933410191*i-.0501922295431356*r,y:.0296278156881593*t+.990434484573249*i-.0170738250293851*r,z:-.0092430581525912*t+.0150551448965779*i+.7518742899580008*r};return void 0!==n&&(a.alpha=n),a}},fromMode:{rgb:$,xyz50:e=>{let{x:t,y:i,z:r,alpha:n}=e;void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=0);let a={mode:"xyz65",x:.9554734527042182*t-.0230985368742614*i+.0632593086610217*r,y:-.0283697069632081*t+1.0099954580058226*i+.021041398966943*r,z:.0123140016883199*t-.0205076964334779*i+1.3303659366080753*r};return void 0!==n&&(a.alpha=n),a}},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:z,y:z,z:z,alpha:{use:z,fixup:V}}}),S(tW)},8413(e,t,i){"use strict";i.d(t,{MZ:()=>a});var r=i(3035);let n={attribute:!0,type:String,converter:r.W3,reflect:!1,hasChanged:r.Ec};function a(e){return(t,i)=>{let r;return"object"==typeof i?((e=n,t,i)=>{let{kind:r,metadata:a}=i,s=globalThis.litPropertyMetadata.get(a);if(void 0===s&&globalThis.litPropertyMetadata.set(a,s=new Map),"setter"===r&&((e=Object.create(e)).wrapped=!0),s.set(i.name,e),"accessor"===r){let{name:r}=i;return{set(i){let n=t.get.call(this);t.set.call(this,i),this.requestUpdate(r,n,e,!0,i)},init(t){return void 0!==t&&this.C(r,void 0,e,t),t}}}if("setter"===r){let{name:r}=i;return function(i){let n=this[r];t.call(this,i),this.requestUpdate(r,n,e,!0,i)}}throw Error("Unsupported decorator location: "+r)})(e,t,i):(r=t.hasOwnProperty(i),t.constructor.createProperty(i,e),r?Object.getOwnPropertyDescriptor(t,i):void 0)}}},874(e,t,i){"use strict";let r,n,a,s,o;i.d(t,{$Kf:()=>im,A$4:()=>tS,AQS:()=>p,B69:()=>e4,BH$:()=>iZ,BKk:()=>tZ,BRH:()=>nd,CSG:()=>rY,D$Q:()=>rW,DXC:()=>iK,EAD:()=>ix,F1T:()=>t5,FCc:()=>i$,FZo:()=>nw,FvD:()=>i9,GOR:()=>re,GYF:()=>iv,Gc6:()=>ri,Gu$:()=>rq,GxU:()=>tb,HgN:()=>W,HiM:()=>n_,Hit:()=>r9,I46:()=>ig,I9Y:()=>P,IUQ:()=>Z,Iit:()=>tJ,Iw4:()=>nH,KPJ:()=>nn,Kzg:()=>nB,LlO:()=>t$,LoY:()=>tP,MBL:()=>r7,MSw:()=>rV,MW4:()=>tC,N1A:()=>ij,NRn:()=>en,Nex:()=>nX,Nv2:()=>i8,Nwf:()=>nk,O9p:()=>eG,ONl:()=>i4,PPD:()=>iO,PTz:()=>U,Pq0:()=>F,Q1f:()=>tp,Qev:()=>_,R3r:()=>ie,R8M:()=>v,RiT:()=>nt,Rm2:()=>m,THS:()=>tE,Tap:()=>np,V9B:()=>tm,VCu:()=>rt,Y9S:()=>nh,YHV:()=>nj,YJl:()=>t6,Z58:()=>it,ZLX:()=>iB,Zcv:()=>iP,Zr2:()=>c,ZyN:()=>nC,_4j:()=>rj,_Ut:()=>tK,a55:()=>M,aHM:()=>ns,aVO:()=>rJ,b4q:()=>t8,bdM:()=>rz,c5h:()=>i7,cj9:()=>L,dYF:()=>er,dwI:()=>k,eB$:()=>ii,eHs:()=>ia,eaF:()=>tW,gPd:()=>$,iNn:()=>tX,iOZ:()=>i6,imn:()=>tg,iyt:()=>e_,jej:()=>x,kLi:()=>X,kn4:()=>eR,lGw:()=>r0,lMl:()=>tl,lPF:()=>f,lxW:()=>tY,mcG:()=>y,mrM:()=>ik,nCl:()=>ny,nWS:()=>et,nZQ:()=>nR,o6l:()=>t9,ppV:()=>z,qUd:()=>nE,qq$:()=>A,qtW:()=>tM,r6x:()=>nI,rFo:()=>ei,rjZ:()=>rr,tBo:()=>nV,tz3:()=>ni,uSd:()=>rX,uWO:()=>i_,ubm:()=>t4,ypk:()=>r_,z3S:()=>b,zgK:()=>eH});let l="attached",h="srgb",c="srgb-linear",u="linear",d="srgb";function p(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function A(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function f(){let e=A("canvas");return e.style.display="block",e}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let g={};function m(...e){console.log("THREE."+e.shift(),...e)}function v(...e){console.warn("THREE."+e.shift(),...e)}function b(...e){console.error("THREE."+e.shift(),...e)}function y(...e){let t=e.join(" ");t in g||(g[t]=!0,v(...e))}function x(e,t,i){return new Promise(function(r,n){setTimeout(function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:n();break;case e.TIMEOUT_EXPIRED:setTimeout(a,i);break;default:r()}},i)})}class _{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){let i=this._listeners;return void 0!==i&&void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){let i=this._listeners;if(void 0===i)return;let r=i[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let i=t[e.type];if(void 0!==i){e.target=this;let t=i.slice(0);for(let i=0,r=t.length;i<r;i++)t[i].call(this,e);e.target=null}}}let E=["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"],S=1234567,C=Math.PI/180,M=180/Math.PI;function w(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,r=0xffffffff*Math.random()|0;return(E[255&e]+E[e>>8&255]+E[e>>16&255]+E[e>>24&255]+"-"+E[255&t]+E[t>>8&255]+"-"+E[t>>16&15|64]+E[t>>24&255]+"-"+E[63&i|128]+E[i>>8&255]+"-"+E[i>>16&255]+E[i>>24&255]+E[255&r]+E[r>>8&255]+E[r>>16&255]+E[r>>24&255]).toLowerCase()}function I(e,t,i){return Math.max(t,Math.min(i,e))}function T(e,t){return(e%t+t)%t}function B(e,t,i){return(1-i)*e+i*t}function R(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function D(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let L={DEG2RAD:C,RAD2DEG:M,generateUUID:w,clamp:I,euclideanModulo:T,mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},lerp:B,damp:function(e,t,i,r){return B(e,t,1-Math.exp(-i*r))},pingpong:function(e,t=1){return t-Math.abs(T(e,2*t)-t)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(S=e);let t=S+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},degToRad:function(e){return e*C},radToDeg:function(e){return e*M},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,i,r,n){let a=Math.cos,s=Math.sin,o=a(i/2),l=s(i/2),h=a((t+r)/2),c=s((t+r)/2),u=a((t-r)/2),d=s((t-r)/2),p=a((r-t)/2),A=s((r-t)/2);switch(n){case"XYX":e.set(o*c,l*u,l*d,o*h);break;case"YZY":e.set(l*d,o*c,l*u,o*h);break;case"ZXZ":e.set(l*u,l*d,o*c,o*h);break;case"XZX":e.set(o*c,l*A,l*p,o*h);break;case"YXY":e.set(l*p,o*c,l*A,o*h);break;case"ZYZ":e.set(l*A,l*p,o*c,o*h);break;default:v("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}},normalize:D,denormalize:R};class P{constructor(e=0,t=0){P.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=I(this.x,e.x,t.x),this.y=I(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=I(this.x,e,t),this.y=I(this.y,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(I(i,e,t))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(I(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*i-a*r+e.x,this.y=n*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class U{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,n,a,s){let o=i[r+0],l=i[r+1],h=i[r+2],c=i[r+3],u=n[a+0],d=n[a+1],p=n[a+2],A=n[a+3];if(s<=0){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c;return}if(s>=1){e[t+0]=u,e[t+1]=d,e[t+2]=p,e[t+3]=A;return}if(c!==A||o!==u||l!==d||h!==p){let e=o*u+l*d+h*p+c*A;e<0&&(u=-u,d=-d,p=-p,A=-A,e=-e);let t=1-s;if(e<.9995){let i=Math.acos(e),r=Math.sin(i);o=o*(t=Math.sin(t*i)/r)+u*(s=Math.sin(s*i)/r),l=l*t+d*s,h=h*t+p*s,c=c*t+A*s}else{let e=1/Math.sqrt((o=o*t+u*s)*o+(l=l*t+d*s)*l+(h=h*t+p*s)*h+(c=c*t+A*s)*c);o*=e,l*=e,h*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c}static multiplyQuaternionsFlat(e,t,i,r,n,a){let s=i[r],o=i[r+1],l=i[r+2],h=i[r+3],c=n[a],u=n[a+1],d=n[a+2],p=n[a+3];return e[t]=s*p+h*c+o*d-l*u,e[t+1]=o*p+h*u+l*c-s*d,e[t+2]=l*p+h*d+s*u-o*c,e[t+3]=h*p-s*c-o*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,r=e._y,n=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(i/2),h=s(r/2),c=s(n/2),u=o(i/2),d=o(r/2),p=o(n/2);switch(a){case"XYZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"YXZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"ZXY":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"ZYX":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"YZX":this._x=u*h*c+l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c-u*d*p;break;case"XZY":this._x=u*h*c-l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c+u*d*p;break;default:v("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],n=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],c=t[10],u=i+s+c;if(u>0){let e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(h-o)*e,this._y=(n-l)*e,this._z=(a-r)*e}else if(i>s&&i>c){let e=2*Math.sqrt(1+i-s-c);this._w=(h-o)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(n+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-i-c);this._w=(n-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(o+h)/e}else{let e=2*Math.sqrt(1+c-i-s);this._w=(a-r)/e,this._x=(n+l)/e,this._y=(o+h)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=i,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(I(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(0===i)return this;let r=Math.min(1,t/i);return this.slerp(e,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,r=e._y,n=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=i*h+a*s+r*l-n*o,this._y=r*h+a*o+n*s-i*l,this._z=n*h+a*l+i*o-r*s,this._w=a*h-i*s-r*o-n*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let i=e._x,r=e._y,n=e._z,a=e._w,s=this.dot(e);s<0&&(i=-i,r=-r,n=-n,a=-a,s=-s);let o=1-t;if(s<.9995){let e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+i*t,this._y=this._y*o+r*t,this._z=this._z*o+n*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+i*t,this._y=this._y*o+r*t,this._z=this._z*o+n*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),n=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),n*Math.sin(t),n*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,i=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(O.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(O.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=e.elements,a=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*a,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*a,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*a,this}applyQuaternion(e){let t=this.x,i=this.y,r=this.z,n=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*r-s*i),h=2*(s*t-n*r),c=2*(n*i-a*t);return this.x=t+o*l+a*c-s*h,this.y=i+o*h+s*l-n*c,this.z=r+o*c+n*h-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=I(this.x,e.x,t.x),this.y=I(this.y,e.y,t.y),this.z=I(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=I(this.x,e,t),this.y=I(this.y,e,t),this.z=I(this.z,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(I(i,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,r=e.y,n=e.z,a=t.x,s=t.y,o=t.z;return this.x=r*o-n*s,this.y=n*a-i*o,this.z=i*s-r*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return N.copy(this).projectOnVector(e),this.sub(N)}reflect(e){return this.sub(N.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(I(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let N=new F,O=new U;class k{constructor(e,t,i,r,n,a,s,o,l){k.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,r,n,a,s,o,l)}set(e,t,i,r,n,a,s,o,l){let h=this.elements;return h[0]=e,h[1]=r,h[2]=s,h[3]=t,h[4]=n,h[5]=o,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],h=i[4],c=i[7],u=i[2],d=i[5],p=i[8],A=r[0],f=r[3],g=r[6],m=r[1],v=r[4],b=r[7],y=r[2],x=r[5],_=r[8];return n[0]=a*A+s*m+o*y,n[3]=a*f+s*v+o*x,n[6]=a*g+s*b+o*_,n[1]=l*A+h*m+c*y,n[4]=l*f+h*v+c*x,n[7]=l*g+h*b+c*_,n[2]=u*A+d*m+p*y,n[5]=u*f+d*v+p*x,n[8]=u*g+d*b+p*_,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*s*l-i*n*h+i*s*o+r*n*l-r*a*o}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=h*a-s*l,u=s*o-h*n,d=l*n-a*o,p=t*c+i*u+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let A=1/p;return e[0]=c*A,e[1]=(r*l-h*i)*A,e[2]=(s*i-r*a)*A,e[3]=u*A,e[4]=(h*t-r*o)*A,e[5]=(r*n-s*t)*A,e[6]=d*A,e[7]=(i*o-l*t)*A,e[8]=(a*t-i*n)*A,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,n,a,s){let o=Math.cos(n),l=Math.sin(n);return this.set(i*o,i*l,-i*(o*a+l*s)+a+e,-r*l,r*o,-r*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(Q.makeScale(e,t)),this}rotate(e){return this.premultiply(Q.makeRotation(-e)),this}translate(e,t){return this.premultiply(Q.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let Q=new k,G=new k().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),H=new k().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),z=(a=[.64,.33,.3,.6,.15,.06],s=[.2126,.7152,.0722],o=[.3127,.329],(n={enabled:!0,workingColorSpace:c,spaces:{},convert:function(e,t,i){return!1!==this.enabled&&t!==i&&t&&i&&(this.spaces[t].transfer===d&&(e.r=V(e.r),e.g=V(e.g),e.b=V(e.b)),this.spaces[t].primaries!==this.spaces[i].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===d&&(e.r=q(e.r),e.g=q(e.g),e.b=q(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return""===e?u:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,i){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,t){return y("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(e,t)},toWorkingColorSpace:function(e,t){return y("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(e,t)}}).define({[c]:{primaries:a,whitePoint:o,transfer:u,toXYZ:G,fromXYZ:H,luminanceCoefficients:s,workingColorSpaceConfig:{unpackColorSpace:h},outputColorSpaceConfig:{drawingBufferColorSpace:h}},[h]:{primaries:a,whitePoint:o,transfer:d,toXYZ:G,fromXYZ:H,luminanceCoefficients:s,outputColorSpaceConfig:{drawingBufferColorSpace:h}}}),n);function V(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function q(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class W{static getDataURL(e,t="image/png"){let i;if(/^data:/i.test(e.src)||"u"<typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)i=e;else{void 0===r&&(r=A("canvas")),r.width=e.width,r.height=e.height;let t=r.getContext("2d");e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),i=r}return i.toDataURL(t)}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=A("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),n=r.data;for(let e=0;e<n.length;e++)n[e]=255*V(n[e]/255);return i.putImageData(r,0,0),t}if(!e.data)return v("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*V(t[e]/255)):t[e]=V(t[e]);return{data:t,width:e.width,height:e.height}}}}let j=0;class X{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:j++}),this.uuid=w(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return"u">typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"u">typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(null!==r){let e;if(Array.isArray(r)){e=[];for(let t=0,i=r.length;t<i;t++)r[t].isDataTexture?e.push(Y(r[t].image)):e.push(Y(r[t]))}else e=Y(r);i.url=e}return t||(e.images[this.uuid]=i),i}}function Y(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?W.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(v("Texture: Unable to serialize Texture."),{})}let J=0,K=new F;class $ extends _{constructor(e=$.DEFAULT_IMAGE,t=$.DEFAULT_MAPPING,i=1001,r=1001,n=1006,a=1008,s=1023,o=1009,l=$.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:J++}),this.uuid=w(),this.name="",this.source=new X(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=n,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new P(0,0),this.repeat=new P(1,1),this.center=new P(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new k,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0}get width(){return this.source.getSize(K).x}get height(){return this.source.getSize(K).y}get depth(){return this.source.getSize(K).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let i=e[t];if(void 0===i){v(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(void 0===r){v(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}$.DEFAULT_IMAGE=null,$.DEFAULT_MAPPING=300,$.DEFAULT_ANISOTROPY=1;class Z{constructor(e=0,t=0,i=0,r=1){Z.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*n,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*n,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*n,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*n,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,n,a=e.elements,s=a[0],o=a[4],l=a[8],h=a[1],c=a[5],u=a[9],d=a[2],p=a[6],A=a[10];if(.01>Math.abs(o-h)&&.01>Math.abs(l-d)&&.01>Math.abs(u-p)){if(.1>Math.abs(o+h)&&.1>Math.abs(l+d)&&.1>Math.abs(u+p)&&.1>Math.abs(s+c+A-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,f=(A+1)/2,g=(o+h)/4,m=(l+d)/4,v=(u+p)/4;return e>a&&e>f?e<.01?(i=0,r=.707106781,n=.707106781):(r=g/(i=Math.sqrt(e)),n=m/i):a>f?a<.01?(i=.707106781,r=0,n=.707106781):(i=g/(r=Math.sqrt(a)),n=v/r):f<.01?(i=.707106781,r=.707106781,n=0):(i=m/(n=Math.sqrt(f)),r=v/n),this.set(i,r,n,t),this}let f=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(h-o)*(h-o));return .001>Math.abs(f)&&(f=1),this.x=(p-u)/f,this.y=(l-d)/f,this.z=(h-o)/f,this.w=Math.acos((s+c+A-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=I(this.x,e.x,t.x),this.y=I(this.y,e.y,t.y),this.z=I(this.z,e.z,t.z),this.w=I(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=I(this.x,e,t),this.y=I(this.y,e,t),this.z=I(this.z,e,t),this.w=I(this.w,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(I(i,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ee extends _{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new Z(0,0,e,t),this.scissorTest=!1,this.viewport=new Z(0,0,e,t);const r=new $({width:e,height:t,depth:i.depth});this.textures=[];const n=i.count;for(let e=0;e<n;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,n=this.textures.length;r<n;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,!0!==this.textures[r].isData3DTexture&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new X(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class et extends ee{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class ei extends ${constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class er extends ${constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class en{constructor(e=new F(Infinity,Infinity,Infinity),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(es.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(es.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=es.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(void 0!==i){let r=i.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(let t=0,i=r.count;t<i;t++)!0===e.isMesh?e.getVertexPosition(t,es):es.fromBufferAttribute(r,t),es.applyMatrix4(e.matrixWorld),this.expandByPoint(es);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),eo.copy(e.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),eo.copy(i.boundingBox)),eo.applyMatrix4(e.matrixWorld),this.union(eo)}let r=e.children;for(let e=0,i=r.length;e<i;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(eA),ef.subVectors(this.max,eA),el.subVectors(e.a,eA),eh.subVectors(e.b,eA),ec.subVectors(e.c,eA),eu.subVectors(eh,el),ed.subVectors(ec,eh),ep.subVectors(el,ec);let t=[0,-eu.z,eu.y,0,-ed.z,ed.y,0,-ep.z,ep.y,eu.z,0,-eu.x,ed.z,0,-ed.x,ep.z,0,-ep.x,-eu.y,eu.x,0,-ed.y,ed.x,0,-ep.y,ep.x,0];return!!ev(t,el,eh,ec,ef)&&!!ev(t=[1,0,0,0,1,0,0,0,1],el,eh,ec,ef)&&(eg.crossVectors(eu,ed),ev(t=[eg.x,eg.y,eg.z],el,eh,ec,ef))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(es).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(ea[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ea[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ea[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ea[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ea[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ea[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ea[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ea[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ea)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}let ea=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,eo=new en,el=new F,eh=new F,ec=new F,eu=new F,ed=new F,ep=new F,eA=new F,ef=new F,eg=new F,em=new F;function ev(e,t,i,r,n){for(let a=0,s=e.length-3;a<=s;a+=3){em.fromArray(e,a);let s=n.x*Math.abs(em.x)+n.y*Math.abs(em.y)+n.z*Math.abs(em.z),o=t.dot(em),l=i.dot(em),h=r.dot(em);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>s)return!1}return!0}let eb=new en,ey=new F,ex=new F;class e_{constructor(e=new F,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;void 0!==t?i.copy(t):eb.setFromPoints(e).getCenter(i);let r=0;for(let t=0,n=e.length;t<n;t++)r=Math.max(r,i.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ey.subVectors(e,this.center);let t=ey.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(ey,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(ex.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ey.copy(e.center).add(ex)),this.expandByPoint(ey.copy(e.center).sub(ex)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let eE=new F,eS=new F,eC=new F,eM=new F,ew=new F,eI=new F,eT=new F;class eB{constructor(e=new F,t=new F(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,eE)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=eE.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(eE.copy(this.origin).addScaledVector(this.direction,t),eE.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){let n,a,s,o;eS.copy(e).add(t).multiplyScalar(.5),eC.copy(t).sub(e).normalize(),eM.copy(this.origin).sub(eS);let l=.5*e.distanceTo(t),h=-this.direction.dot(eC),c=eM.dot(this.direction),u=-eM.dot(eC),d=eM.lengthSq(),p=Math.abs(1-h*h);if(p>0)if(n=h*u-c,a=h*c-u,o=l*p,n>=0)if(a>=-o)if(a<=o){let e=1/p;n*=e,a*=e,s=n*(n+h*a+2*c)+a*(h*n+a+2*u)+d}else s=-(n=Math.max(0,-(h*(a=l)+c)))*n+a*(a+2*u)+d;else s=-(n=Math.max(0,-(h*(a=-l)+c)))*n+a*(a+2*u)+d;else a<=-o?(a=(n=Math.max(0,-(-h*l+c)))>0?-l:Math.min(Math.max(-l,-u),l),s=-n*n+a*(a+2*u)+d):a<=o?(n=0,s=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+d):(a=(n=Math.max(0,-(h*l+c)))>0?l:Math.min(Math.max(-l,-u),l),s=-n*n+a*(a+2*u)+d);else a=h>0?-l:l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,n),r&&r.copy(eS).addScaledVector(eC,a),s}intersectSphere(e,t){eE.subVectors(e.center,this.origin);let i=eE.dot(this.direction),r=eE.dot(eE)-i*i,n=e.radius*e.radius;if(r>n)return null;let a=Math.sqrt(n-r),s=i-a,o=i+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let i,r,n,a,s,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return(l>=0?(i=(e.min.x-u.x)*l,r=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,r=(e.min.x-u.x)*l),h>=0?(n=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),i>a||n>r||((n>i||isNaN(i))&&(i=n),(a<r||isNaN(r))&&(r=a),c>=0?(s=(e.min.z-u.z)*c,o=(e.max.z-u.z)*c):(s=(e.max.z-u.z)*c,o=(e.min.z-u.z)*c),i>o||s>r||((s>i||i!=i)&&(i=s),(o<r||r!=r)&&(r=o),r<0)))?null:this.at(i>=0?i:r,t)}intersectsBox(e){return null!==this.intersectBox(e,eE)}intersectTriangle(e,t,i,r,n){let a;ew.subVectors(t,e),eI.subVectors(i,e),eT.crossVectors(ew,eI);let s=this.direction.dot(eT);if(s>0){if(r)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}eM.subVectors(this.origin,e);let o=a*this.direction.dot(eI.crossVectors(eM,eI));if(o<0)return null;let l=a*this.direction.dot(ew.cross(eM));if(l<0||o+l>s)return null;let h=-a*eM.dot(eT);return h<0?null:this.at(h/s,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class eR{constructor(e,t,i,r,n,a,s,o,l,h,c,u,d,p,A,f){eR.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,r,n,a,s,o,l,h,c,u,d,p,A,f)}set(e,t,i,r,n,a,s,o,l,h,c,u,d,p,A,f){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=n,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=u,g[3]=d,g[7]=p,g[11]=A,g[15]=f,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 eR().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return 0===this.determinant()?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1)):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2)),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinant())return this.identity();let t=this.elements,i=e.elements,r=1/eD.setFromMatrixColumn(e,0).length(),n=1/eD.setFromMatrixColumn(e,1).length(),a=1/eD.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,r=e.y,n=e.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(r),l=Math.sin(r),h=Math.cos(n),c=Math.sin(n);if("XYZ"===e.order){let e=a*h,i=a*c,r=s*h,n=s*c;t[0]=o*h,t[4]=-o*c,t[8]=l,t[1]=i+r*l,t[5]=e-n*l,t[9]=-s*o,t[2]=n-e*l,t[6]=r+i*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*h,i=o*c,r=l*h,n=l*c;t[0]=e+n*s,t[4]=r*s-i,t[8]=a*l,t[1]=a*c,t[5]=a*h,t[9]=-s,t[2]=i*s-r,t[6]=n+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*h,i=o*c,r=l*h,n=l*c;t[0]=e-n*s,t[4]=-a*c,t[8]=r+i*s,t[1]=i+r*s,t[5]=a*h,t[9]=n-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*h,i=a*c,r=s*h,n=s*c;t[0]=o*h,t[4]=r*l-i,t[8]=e*l+n,t[1]=o*c,t[5]=n*l+e,t[9]=i*l-r,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,i=a*l,r=s*o,n=s*l;t[0]=o*h,t[4]=n-e*c,t[8]=r*c+i,t[1]=c,t[5]=a*h,t[9]=-s*h,t[2]=-l*h,t[6]=i*c+r,t[10]=e-n*c}else if("XZY"===e.order){let e=a*o,i=a*l,r=s*o,n=s*l;t[0]=o*h,t[4]=-c,t[8]=l*h,t[1]=e*c+n,t[5]=a*h,t[9]=i*c-r,t[2]=r*c-i,t[6]=s*h,t[10]=n*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(eP,e,eU)}lookAt(e,t,i){let r=this.elements;return eO.subVectors(e,t),0===eO.lengthSq()&&(eO.z=1),eO.normalize(),eF.crossVectors(i,eO),0===eF.lengthSq()&&(1===Math.abs(i.z)?eO.x+=1e-4:eO.z+=1e-4,eO.normalize(),eF.crossVectors(i,eO)),eF.normalize(),eN.crossVectors(eO,eF),r[0]=eF.x,r[4]=eN.x,r[8]=eO.x,r[1]=eF.y,r[5]=eN.y,r[9]=eO.y,r[2]=eF.z,r[6]=eN.z,r[10]=eO.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],h=i[1],c=i[5],u=i[9],d=i[13],p=i[2],A=i[6],f=i[10],g=i[14],m=i[3],v=i[7],b=i[11],y=i[15],x=r[0],_=r[4],E=r[8],S=r[12],C=r[1],M=r[5],w=r[9],I=r[13],T=r[2],B=r[6],R=r[10],D=r[14],L=r[3],P=r[7],U=r[11],F=r[15];return n[0]=a*x+s*C+o*T+l*L,n[4]=a*_+s*M+o*B+l*P,n[8]=a*E+s*w+o*R+l*U,n[12]=a*S+s*I+o*D+l*F,n[1]=h*x+c*C+u*T+d*L,n[5]=h*_+c*M+u*B+d*P,n[9]=h*E+c*w+u*R+d*U,n[13]=h*S+c*I+u*D+d*F,n[2]=p*x+A*C+f*T+g*L,n[6]=p*_+A*M+f*B+g*P,n[10]=p*E+A*w+f*R+g*U,n[14]=p*S+A*I+f*D+g*F,n[3]=m*x+v*C+b*T+y*L,n[7]=m*_+v*M+b*B+y*P,n[11]=m*E+v*w+b*R+y*U,n[15]=m*S+v*I+b*D+y*F,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],a=e[1],s=e[5],o=e[9],l=e[13],h=e[2],c=e[6],u=e[10],d=e[14],p=e[3],A=e[7],f=e[11],g=e[15],m=o*d-l*u,v=s*d-l*c,b=s*u-o*c,y=a*d-l*h,x=a*u-o*h,_=a*c-s*h;return t*(A*m-f*v+g*b)-i*(p*m-f*y+g*x)+r*(p*v-A*y+g*_)-n*(p*b-A*x+f*_)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,i){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],A=e[13],f=e[14],g=e[15],m=c*f*l-A*u*l+A*o*d-s*f*d-c*o*g+s*u*g,v=p*u*l-h*f*l-p*o*d+a*f*d+h*o*g-a*u*g,b=h*A*l-p*c*l+p*s*d-a*A*d-h*s*g+a*c*g,y=p*c*o-h*A*o-p*s*u+a*A*u+h*s*f-a*c*f,x=t*m+i*v+r*b+n*y;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let _=1/x;return e[0]=m*_,e[1]=(A*u*n-c*f*n-A*r*d+i*f*d+c*r*g-i*u*g)*_,e[2]=(s*f*n-A*o*n+A*r*l-i*f*l-s*r*g+i*o*g)*_,e[3]=(c*o*n-s*u*n-c*r*l+i*u*l+s*r*d-i*o*d)*_,e[4]=v*_,e[5]=(h*f*n-p*u*n+p*r*d-t*f*d-h*r*g+t*u*g)*_,e[6]=(p*o*n-a*f*n-p*r*l+t*f*l+a*r*g-t*o*g)*_,e[7]=(a*u*n-h*o*n+h*r*l-t*u*l-a*r*d+t*o*d)*_,e[8]=b*_,e[9]=(p*c*n-h*A*n-p*i*d+t*A*d+h*i*g-t*c*g)*_,e[10]=(a*A*n-p*s*n+p*i*l-t*A*l-a*i*g+t*s*g)*_,e[11]=(h*s*n-a*c*n-h*i*l+t*c*l+a*i*d-t*s*d)*_,e[12]=y*_,e[13]=(h*A*r-p*c*r+p*i*u-t*A*u-h*i*f+t*c*f)*_,e[14]=(p*s*r-a*A*r-p*i*o+t*A*o+a*i*f-t*s*f)*_,e[15]=(a*c*r-h*s*r+h*i*o-t*c*o-a*i*u+t*s*u)*_,this}scale(e){let t=this.elements,i=e.x,r=e.y,n=e.z;return t[0]*=i,t[4]*=r,t[8]*=n,t[1]*=i,t[5]*=r,t[9]*=n,t[2]*=i,t[6]*=r,t[10]*=n,t[3]*=i,t[7]*=r,t[11]*=n,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),r=Math.sin(t),n=1-i,a=e.x,s=e.y,o=e.z,l=n*a,h=n*s;return this.set(l*a+i,l*s-r*o,l*o+r*s,0,l*s+r*o,h*s+i,h*o-r*a,0,l*o-r*s,h*o+r*a,n*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,n,a){return this.set(1,i,n,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,n=t._x,a=t._y,s=t._z,o=t._w,l=n+n,h=a+a,c=s+s,u=n*l,d=n*h,p=n*c,A=a*h,f=a*c,g=s*c,m=o*l,v=o*h,b=o*c,y=i.x,x=i.y,_=i.z;return r[0]=(1-(A+g))*y,r[1]=(d+b)*y,r[2]=(p-v)*y,r[3]=0,r[4]=(d-b)*x,r[5]=(1-(u+g))*x,r[6]=(f+m)*x,r[7]=0,r[8]=(p+v)*_,r[9]=(f-m)*_,r[10]=(1-(u+A))*_,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements;if(e.x=r[12],e.y=r[13],e.z=r[14],0===this.determinant())return i.set(1,1,1),t.identity(),this;let n=eD.set(r[0],r[1],r[2]).length(),a=eD.set(r[4],r[5],r[6]).length(),s=eD.set(r[8],r[9],r[10]).length();0>this.determinant()&&(n=-n),eL.copy(this);let o=1/n,l=1/a,h=1/s;return eL.elements[0]*=o,eL.elements[1]*=o,eL.elements[2]*=o,eL.elements[4]*=l,eL.elements[5]*=l,eL.elements[6]*=l,eL.elements[8]*=h,eL.elements[9]*=h,eL.elements[10]*=h,t.setFromRotationMatrix(eL),i.x=n,i.y=a,i.z=s,this}makePerspective(e,t,i,r,n,a,s=2e3,o=!1){let l,h,c=this.elements;if(o)l=n/(a-n),h=a*n/(a-n);else if(2e3===s)l=-(a+n)/(a-n),h=-2*a*n/(a-n);else if(2001===s)l=-a/(a-n),h=-a*n/(a-n);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return c[0]=2*n/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*n/(i-r),c[9]=(i+r)/(i-r),c[13]=0,c[2]=0,c[6]=0,c[10]=l,c[14]=h,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,n,a,s=2e3,o=!1){let l,h,c=this.elements;if(o)l=1/(a-n),h=a/(a-n);else if(2e3===s)l=-2/(a-n),h=-(a+n)/(a-n);else if(2001===s)l=-1/(a-n),h=-n/(a-n);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(i-r),c[9]=0,c[13]=-(i+r)/(i-r),c[2]=0,c[6]=0,c[10]=l,c[14]=h,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}let eD=new F,eL=new eR,eP=new F(0,0,0),eU=new F(1,1,1),eF=new F,eN=new F,eO=new F,ek=new eR,eQ=new U;class eG{constructor(e=0,t=0,i=0,r=eG.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let r=e.elements,n=r[0],a=r[4],s=r[8],o=r[1],l=r[5],h=r[9],c=r[2],u=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(I(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-I(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,n),this._z=0);break;case"ZXY":this._x=Math.asin(I(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-I(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(I(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,n)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-I(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,n)):(this._x=Math.atan2(-h,d),this._y=0);break;default:v("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return ek.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ek,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return eQ.setFromEuler(this),this.setFromQuaternion(eQ,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}eG.DEFAULT_ORDER="XYZ";class eH{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}}let ez=0,eV=new F,eq=new U,eW=new eR,ej=new F,eX=new F,eY=new F,eJ=new U,eK=new F(1,0,0),e$=new F(0,1,0),eZ=new F(0,0,1),e0={type:"added"},e1={type:"removed"},e2={type:"childadded",child:null},e3={type:"childremoved",child:null};class e4 extends _{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ez++}),this.uuid=w(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=e4.DEFAULT_UP.clone();const e=new F,t=new eG,i=new U,r=new F(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new eR},normalMatrix:{value:new k}}),this.matrix=new eR,this.matrixWorld=new eR,this.matrixAutoUpdate=e4.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e4.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new eH,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return eq.setFromAxisAngle(e,t),this.quaternion.multiply(eq),this}rotateOnWorldAxis(e,t){return eq.setFromAxisAngle(e,t),this.quaternion.premultiply(eq),this}rotateX(e){return this.rotateOnAxis(eK,e)}rotateY(e){return this.rotateOnAxis(e$,e)}rotateZ(e){return this.rotateOnAxis(eZ,e)}translateOnAxis(e,t){return eV.copy(e).applyQuaternion(this.quaternion),this.position.add(eV.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(eK,e)}translateY(e){return this.translateOnAxis(e$,e)}translateZ(e){return this.translateOnAxis(eZ,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(eW.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?ej.copy(e):ej.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),eX.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?eW.lookAt(eX,ej,this.up):eW.lookAt(ej,eX,this.up),this.quaternion.setFromRotationMatrix(eW),r&&(eW.extractRotation(r.matrixWorld),eq.setFromRotationMatrix(eW),this.quaternion.premultiply(eq.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?b("Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(e0),e2.child=e,this.dispatchEvent(e2),e2.child=null):b("Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(e1),e3.child=e,this.dispatchEvent(e3),e3.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),eW.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),eW.multiply(e.parent.matrixWorld)),e.applyMatrix4(eW),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(e0),e2.child=e,this.dispatchEvent(e2),e2.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){let r=this.children[i].getObjectByProperty(e,t);if(void 0!==r)return r}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let r=this.children;for(let n=0,a=r.length;n<a;n++)r[n].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(eX,e,eY),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(eX,eJ,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};function n(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(r.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(r.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=n(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let r=i[t];n(e.shapes,r)}else n(e.shapes,i)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(n(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let i=0,r=this.material.length;i<r;i++)t.push(n(e.materials,this.material[i]));r.material=t}else r.material=n(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let i=this.animations[t];r.animations.push(n(e.animations,i))}}if(t){let t=a(e.geometries),r=a(e.materials),n=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),h=a(e.animations),c=a(e.nodes);t.length>0&&(i.geometries=t),r.length>0&&(i.materials=r),n.length>0&&(i.textures=n),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),c.length>0&&(i.nodes=c)}return i.object=r,i;function a(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){let i=e.children[t];this.add(i.clone())}return this}}e4.DEFAULT_UP=new F(0,1,0),e4.DEFAULT_MATRIX_AUTO_UPDATE=!0,e4.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let e5=new F,e8=new F,e9=new F,e6=new F,e7=new F,te=new F,tt=new F,ti=new F,tr=new F,tn=new F,ta=new Z,ts=new Z,to=new Z;class tl{constructor(e=new F,t=new F,i=new F){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),e5.subVectors(e,t),r.cross(e5);let n=r.lengthSq();return n>0?r.multiplyScalar(1/Math.sqrt(n)):r.set(0,0,0)}static getBarycoord(e,t,i,r,n){e5.subVectors(r,t),e8.subVectors(i,t),e9.subVectors(e,t);let a=e5.dot(e5),s=e5.dot(e8),o=e5.dot(e9),l=e8.dot(e8),h=e8.dot(e9),c=a*l-s*s;if(0===c)return n.set(0,0,0),null;let u=1/c,d=(l*o-s*h)*u,p=(a*h-s*o)*u;return n.set(1-d-p,p,d)}static containsPoint(e,t,i,r){return null!==this.getBarycoord(e,t,i,r,e6)&&e6.x>=0&&e6.y>=0&&e6.x+e6.y<=1}static getInterpolation(e,t,i,r,n,a,s,o){return null===this.getBarycoord(e,t,i,r,e6)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(n,e6.x),o.addScaledVector(a,e6.y),o.addScaledVector(s,e6.z),o)}static getInterpolatedAttribute(e,t,i,r,n,a){return ta.setScalar(0),ts.setScalar(0),to.setScalar(0),ta.fromBufferAttribute(e,t),ts.fromBufferAttribute(e,i),to.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(ta,n.x),a.addScaledVector(ts,n.y),a.addScaledVector(to,n.z),a}static isFrontFacing(e,t,i,r){return e5.subVectors(i,t),e8.subVectors(e,t),0>e5.cross(e8).dot(r)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return e5.subVectors(this.c,this.b),e8.subVectors(this.a,this.b),.5*e5.cross(e8).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tl.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tl.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,n){return tl.getInterpolation(e,this.a,this.b,this.c,t,i,r,n)}containsPoint(e){return tl.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tl.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,r,n=this.a,a=this.b,s=this.c;e7.subVectors(a,n),te.subVectors(s,n),ti.subVectors(e,n);let o=e7.dot(ti),l=te.dot(ti);if(o<=0&&l<=0)return t.copy(n);tr.subVectors(e,a);let h=e7.dot(tr),c=te.dot(tr);if(h>=0&&c<=h)return t.copy(a);let u=o*c-h*l;if(u<=0&&o>=0&&h<=0)return i=o/(o-h),t.copy(n).addScaledVector(e7,i);tn.subVectors(e,s);let d=e7.dot(tn),p=te.dot(tn);if(p>=0&&d<=p)return t.copy(s);let A=d*l-o*p;if(A<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(n).addScaledVector(te,r);let f=h*p-d*c;if(f<=0&&c-h>=0&&d-p>=0)return tt.subVectors(s,a),r=(c-h)/(c-h+(d-p)),t.copy(a).addScaledVector(tt,r);let g=1/(f+A+u);return i=A*g,r=u*g,t.copy(n).addScaledVector(e7,i).addScaledVector(te,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let th={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},tc={h:0,s:0,l:0},tu={h:0,s:0,l:0};function td(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}class tp{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){return void 0===t&&void 0===i?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,i),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=h){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,z.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=z.workingColorSpace){return this.r=e,this.g=t,this.b=i,z.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=z.workingColorSpace){if(e=T(e,1),t=I(t,0,1),i=I(i,0,1),0===t)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+t):i+t-i*t,n=2*i-r;this.r=td(n,r,e+1/3),this.g=td(n,r,e),this.b=td(n,r,e-1/3)}return z.colorSpaceToWorking(this,r),this}setStyle(e,t=h){let i;function r(t){void 0!==t&&1>parseFloat(t)&&v("Color: Alpha component of "+e+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let n,a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,t);if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,t);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,t);break;default:v("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],n=r.length;if(3===n)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(6===n)return this.setHex(parseInt(r,16),t);v("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=h){let i=th[e.toLowerCase()];return void 0!==i?this.setHex(i,t):v("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=V(e.r),this.g=V(e.g),this.b=V(e.b),this}copyLinearToSRGB(e){return this.r=q(e.r),this.g=q(e.g),this.b=q(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=h){return z.workingToColorSpace(tA.copy(this),e),65536*Math.round(I(255*tA.r,0,255))+256*Math.round(I(255*tA.g,0,255))+Math.round(I(255*tA.b,0,255))}getHexString(e=h){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=z.workingColorSpace){let i,r;z.workingToColorSpace(tA.copy(this),t);let n=tA.r,a=tA.g,s=tA.b,o=Math.max(n,a,s),l=Math.min(n,a,s),h=(l+o)/2;if(l===o)i=0,r=0;else{let e=o-l;switch(r=h<=.5?e/(o+l):e/(2-o-l),o){case n:i=(a-s)/e+6*(a<s);break;case a:i=(s-n)/e+2;break;case s:i=(n-a)/e+4}i/=6}return e.h=i,e.s=r,e.l=h,e}getRGB(e,t=z.workingColorSpace){return z.workingToColorSpace(tA.copy(this),t),e.r=tA.r,e.g=tA.g,e.b=tA.b,e}getStyle(e=h){z.workingToColorSpace(tA.copy(this),e);let t=tA.r,i=tA.g,r=tA.b;return e!==h?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*i)},${Math.round(255*r)})`}offsetHSL(e,t,i){return this.getHSL(tc),this.setHSL(tc.h+e,tc.s+t,tc.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(tc),e.getHSL(tu);let i=B(tc.h,tu.h,t),r=B(tc.s,tu.s,t),n=B(tc.l,tu.l,t);return this.setHSL(i,r,n),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,r=this.b,n=e.elements;return this.r=n[0]*t+n[3]*i+n[6]*r,this.g=n[1]*t+n[4]*i+n[7]*r,this.b=n[2]*t+n[5]*i+n[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let tA=new tp;tp.NAMES=th;let tf=0;class tg extends _{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:tf++}),this.uuid=w(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new tp(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){v(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(void 0===r){v(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=r(e.textures),n=r(e.images);t.length>0&&(i.textures=t),n.length>0&&(i.images=n)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=Array(e);for(let r=0;r!==e;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class tm extends tg{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tp(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new eG,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let tv=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),i=new Uint32Array(e),r=new Uint32Array(512),n=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[256|e]=32768,n[e]=24,n[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,n[e]=-t-1,n[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,n[e]=13,n[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,n[e]=24,n[256|e]=24):(r[e]=31744,r[256|e]=64512,n[e]=13,n[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,i=0;for(;(8388608&t)==0;)t<<=1,i-=8388608;t&=-8388609,i+=0x38800000,a[e]=t|i}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:i,baseTable:r,shiftTable:n,mantissaTable:a,exponentTable:s,offsetTable:o}}();class tb{static toHalfFloat(e){var t;let i,r;return Math.abs(t=e)>65504&&v("DataUtils.toHalfFloat(): Value out of range."),t=I(t,-65504,65504),tv.floatView[0]=t,r=(i=tv.uint32View[0])>>23&511,tv.baseTable[r]+((8388607&i)>>tv.shiftTable[r])}static fromHalfFloat(e){let t;return t=e>>10,tv.uint32View[0]=tv.mantissaTable[tv.offsetTable[t]+(1023&e)]+tv.exponentTable[t],tv.floatView[0]}}let ty=new F,tx=new P,t_=0;class tE{constructor(e,t,i=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:t_++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,n=this.itemSize;r<n;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)tx.fromBufferAttribute(this,t),tx.applyMatrix3(e),this.setXY(t,tx.x,tx.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)ty.fromBufferAttribute(this,t),ty.applyMatrix3(e),this.setXYZ(t,ty.x,ty.y,ty.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)ty.fromBufferAttribute(this,t),ty.applyMatrix4(e),this.setXYZ(t,ty.x,ty.y,ty.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ty.fromBufferAttribute(this,t),ty.applyNormalMatrix(e),this.setXYZ(t,ty.x,ty.y,ty.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ty.fromBufferAttribute(this,t),ty.transformDirection(e),this.setXYZ(t,ty.x,ty.y,ty.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=R(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=D(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=R(t,this.array)),t}setX(e,t){return this.normalized&&(t=D(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=R(t,this.array)),t}setY(e,t){return this.normalized&&(t=D(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=R(t,this.array)),t}setZ(e,t){return this.normalized&&(t=D(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=R(t,this.array)),t}setW(e,t){return this.normalized&&(t=D(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=D(t,this.array),i=D(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=D(t,this.array),i=D(i,this.array),r=D(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e*=this.itemSize,this.normalized&&(t=D(t,this.array),i=D(i,this.array),r=D(r,this.array),n=D(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=n,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}}class tS extends tE{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class tC extends tE{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class tM extends tE{constructor(e,t,i){super(new Float32Array(e),t,i)}}let tw=0,tI=new eR,tT=new e4,tB=new F,tR=new en,tD=new en,tL=new F;class tP extends _{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:tw++}),this.uuid=w(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(p(e)?tC:tS)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let t=new k().getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return tI.makeRotationFromQuaternion(e),this.applyMatrix4(tI),this}rotateX(e){return tI.makeRotationX(e),this.applyMatrix4(tI),this}rotateY(e){return tI.makeRotationY(e),this.applyMatrix4(tI),this}rotateZ(e){return tI.makeRotationZ(e),this.applyMatrix4(tI),this}translate(e,t,i){return tI.makeTranslation(e,t,i),this.applyMatrix4(tI),this}scale(e,t,i){return tI.makeScale(e,t,i),this.applyMatrix4(tI),this}lookAt(e){return tT.lookAt(e),tT.updateMatrix(),this.applyMatrix4(tT.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(tB).negate(),this.translate(tB.x,tB.y,tB.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let i=0,r=e.length;i<r;i++){let r=e[i];t.push(r.x,r.y,r.z||0)}this.setAttribute("position",new tM(t,3))}else{let i=Math.min(e.length,t.count);for(let r=0;r<i;r++){let i=e[r];t.setXYZ(r,i.x,i.y,i.z||0)}e.length>t.count&&v("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new en);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){b("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];tR.setFromBufferAttribute(i),this.morphTargetsRelative?(tL.addVectors(this.boundingBox.min,tR.min),this.boundingBox.expandByPoint(tL),tL.addVectors(this.boundingBox.max,tR.max),this.boundingBox.expandByPoint(tL)):(this.boundingBox.expandByPoint(tR.min),this.boundingBox.expandByPoint(tR.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&b('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new e_);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){b("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new F,1/0);return}if(e){let i=this.boundingSphere.center;if(tR.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];tD.setFromBufferAttribute(i),this.morphTargetsRelative?(tL.addVectors(tR.min,tD.min),tR.expandByPoint(tL),tL.addVectors(tR.max,tD.max),tR.expandByPoint(tL)):(tR.expandByPoint(tD.min),tR.expandByPoint(tD.max))}tR.getCenter(i);let r=0;for(let t=0,n=e.count;t<n;t++)tL.fromBufferAttribute(e,t),r=Math.max(r,i.distanceToSquared(tL));if(t)for(let n=0,a=t.length;n<a;n++){let a=t[n],s=this.morphTargetsRelative;for(let t=0,n=a.count;t<n;t++)tL.fromBufferAttribute(a,t),s&&(tB.fromBufferAttribute(e,t),tL.add(tB)),r=Math.max(r,i.distanceToSquared(tL))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&b('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void b("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=t.position,r=t.normal,n=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new tE(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<i.count;e++)s[e]=new F,o[e]=new F;let l=new F,h=new F,c=new F,u=new P,d=new P,p=new P,A=new F,f=new F,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,r=g.length;t<r;++t){let r=g[t],a=r.start,m=r.count;for(let t=a,r=a+m;t<r;t+=3)!function(e,t,r){l.fromBufferAttribute(i,e),h.fromBufferAttribute(i,t),c.fromBufferAttribute(i,r),u.fromBufferAttribute(n,e),d.fromBufferAttribute(n,t),p.fromBufferAttribute(n,r),h.sub(l),c.sub(l),d.sub(u),p.sub(u);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(A.copy(h).multiplyScalar(p.y).addScaledVector(c,-d.y).multiplyScalar(a),f.copy(c).multiplyScalar(d.x).addScaledVector(h,-p.x).multiplyScalar(a),s[e].add(A),s[t].add(A),s[r].add(A),o[e].add(f),o[t].add(f),o[r].add(f))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let m=new F,v=new F,y=new F,x=new F;function _(e){y.fromBufferAttribute(r,e),x.copy(y);let t=s[e];m.copy(t),m.sub(y.multiplyScalar(y.dot(t))).normalize(),v.crossVectors(x,t);let i=v.dot(o[e]);a.setXYZW(e,m.x,m.y,m.z,i<0?-1:1)}for(let t=0,i=g.length;t<i;++t){let i=g[t],r=i.start,n=i.count;for(let t=r,i=r+n;t<i;t+=3)_(e.getX(t+0)),_(e.getX(t+1)),_(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new tE(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);let r=new F,n=new F,a=new F,s=new F,o=new F,l=new F,h=new F,c=new F;if(e)for(let u=0,d=e.count;u<d;u+=3){let d=e.getX(u+0),p=e.getX(u+1),A=e.getX(u+2);r.fromBufferAttribute(t,d),n.fromBufferAttribute(t,p),a.fromBufferAttribute(t,A),h.subVectors(a,n),c.subVectors(r,n),h.cross(c),s.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,A),s.add(h),o.add(h),l.add(h),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(A,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)r.fromBufferAttribute(t,e+0),n.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),h.subVectors(a,n),c.subVectors(r,n),h.cross(c),i.setXYZ(e+0,h.x,h.y,h.z),i.setXYZ(e+1,h.x,h.y,h.z),i.setXYZ(e+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)tL.fromBufferAttribute(e,t),tL.normalize(),e.setXYZ(t,tL.x,tL.y,tL.z)}toNonIndexed(){function e(e,t){let i=e.array,r=e.itemSize,n=e.normalized,a=new i.constructor(t.length*r),s=0,o=0;for(let n=0,l=t.length;n<l;n++){s=e.isInterleavedBufferAttribute?t[n]*e.data.stride+e.offset:t[n]*r;for(let e=0;e<r;e++)a[o++]=i[s++]}return new tE(a,r,n)}if(null===this.index)return v("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new tP,i=this.index.array,r=this.attributes;for(let n in r){let a=e(r[n],i);t.setAttribute(n,a)}let n=this.morphAttributes;for(let r in n){let a=[],s=n[r];for(let t=0,r=s.length;t<r;t++){let r=e(s[t],i);a.push(r)}t.morphAttributes[r]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,i=a.length;e<i;e++){let i=a[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let r=i[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},n=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],a=[];for(let t=0,r=i.length;t<r;t++){let r=i[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,n=!0)}n&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone());let r=e.attributes;for(let e in r){let i=r[e];this.setAttribute(e,i.clone(t))}let n=e.morphAttributes;for(let e in n){let i=[],r=n[e];for(let e=0,n=r.length;e<n;e++)i.push(r[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let tU=new eR,tF=new eB,tN=new e_,tO=new F,tk=new F,tQ=new F,tG=new F,tH=new F,tz=new F,tV=new F,tq=new F;class tW extends e4{constructor(e=new tP,t=new tm){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,n=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let s=this.morphTargetInfluences;if(n&&s){tz.set(0,0,0);for(let i=0,r=n.length;i<r;i++){let r=s[i],o=n[i];0!==r&&(tH.fromBufferAttribute(o,e),a?tz.addScaledVector(tH,r):tz.addScaledVector(tH.sub(t),r))}t.add(tz)}return t}raycast(e,t){let i=this.geometry,r=this.material,n=this.matrixWorld;void 0===r||(null===i.boundingSphere&&i.computeBoundingSphere(),tN.copy(i.boundingSphere),tN.applyMatrix4(n),tF.copy(e.ray).recast(e.near),!1===tN.containsPoint(tF.origin)&&(null===tF.intersectSphere(tN,tO)||tF.origin.distanceToSquared(tO)>(e.far-e.near)**2)||(tU.copy(n).invert(),tF.copy(e.ray).applyMatrix4(tU),(null===i.boundingBox||!1!==tF.intersectsBox(i.boundingBox))&&this._computeIntersections(e,t,tF)))}_computeIntersections(e,t,i){let r,n=this.geometry,a=this.material,s=n.index,o=n.attributes.position,l=n.attributes.uv,h=n.attributes.uv1,c=n.attributes.normal,u=n.groups,d=n.drawRange;if(null!==s)if(Array.isArray(a))for(let n=0,o=u.length;n<o;n++){let o=u[n],p=a[o.materialIndex],A=Math.max(o.start,d.start),f=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let n=A;n<f;n+=3)(r=tj(this,p,e,i,l,h,c,s.getX(n),s.getX(n+1),s.getX(n+2)))&&(r.faceIndex=Math.floor(n/3),r.face.materialIndex=o.materialIndex,t.push(r))}else{let n=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let u=n;u<o;u+=3)(r=tj(this,a,e,i,l,h,c,s.getX(u),s.getX(u+1),s.getX(u+2)))&&(r.faceIndex=Math.floor(u/3),t.push(r))}else if(void 0!==o)if(Array.isArray(a))for(let n=0,s=u.length;n<s;n++){let s=u[n],p=a[s.materialIndex],A=Math.max(s.start,d.start),f=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let n=A;n<f;n+=3)(r=tj(this,p,e,i,l,h,c,n,n+1,n+2))&&(r.faceIndex=Math.floor(n/3),r.face.materialIndex=s.materialIndex,t.push(r))}else{let n=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=n;o<s;o+=3)(r=tj(this,a,e,i,l,h,c,o,o+1,o+2))&&(r.faceIndex=Math.floor(o/3),t.push(r))}}}function tj(e,t,i,r,n,a,s,o,l,h){e.getVertexPosition(o,tk),e.getVertexPosition(l,tQ),e.getVertexPosition(h,tG);let c=function(e,t,i,r,n,a,s,o){if(null===(1===t.side?r.intersectTriangle(s,a,n,!0,o):r.intersectTriangle(n,a,s,0===t.side,o)))return null;tq.copy(o),tq.applyMatrix4(e.matrixWorld);let l=i.ray.origin.distanceTo(tq);return l<i.near||l>i.far?null:{distance:l,point:tq.clone(),object:e}}(e,t,i,r,tk,tQ,tG,tV);if(c){let e=new F;tl.getBarycoord(tV,tk,tQ,tG,e),n&&(c.uv=tl.getInterpolatedAttribute(n,o,l,h,e,new P)),a&&(c.uv1=tl.getInterpolatedAttribute(a,o,l,h,e,new P)),s&&(c.normal=tl.getInterpolatedAttribute(s,o,l,h,e,new F),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:h,normal:new F,materialIndex:0};tl.getNormal(tk,tQ,tG,t.normal),c.face=t,c.barycoord=e}return c}class tX extends tP{constructor(e=1,t=1,i=1,r=1,n=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:a};const s=this;r=Math.floor(r),n=Math.floor(n);const o=[],l=[],h=[],c=[];let u=0,d=0;function p(e,t,i,r,n,a,p,A,f,g,m){let v=a/f,b=p/g,y=a/2,x=p/2,_=A/2,E=f+1,S=g+1,C=0,M=0,w=new F;for(let a=0;a<S;a++){let s=a*b-x;for(let o=0;o<E;o++){let u=o*v-y;w[e]=u*r,w[t]=s*n,w[i]=_,l.push(w.x,w.y,w.z),w[e]=0,w[t]=0,w[i]=A>0?1:-1,h.push(w.x,w.y,w.z),c.push(o/f),c.push(1-a/g),C+=1}}for(let e=0;e<g;e++)for(let t=0;t<f;t++){let i=u+t+E*e,r=u+t+E*(e+1),n=u+(t+1)+E*(e+1),a=u+(t+1)+E*e;o.push(i,r,a),o.push(r,n,a),M+=6}s.addGroup(d,M,m),d+=M,u+=C}p("z","y","x",-1,-1,i,t,e,a=Math.floor(a),n,0),p("z","y","x",1,-1,i,t,-e,a,n,1),p("x","z","y",1,1,e,i,t,r,a,2),p("x","z","y",1,-1,e,i,-t,r,a,3),p("x","y","z",1,-1,e,t,i,r,n,4),p("x","y","z",-1,-1,e,t,-i,r,n,5),this.setIndex(o),this.setAttribute("position",new tM(l,3)),this.setAttribute("normal",new tM(h,3)),this.setAttribute("uv",new tM(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tX(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function tY(e){let t={};for(let i in e)for(let r in t[i]={},e[i]){let n=e[i][r];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.isRenderTargetTexture?(v("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][r]=null):t[i][r]=n.clone():Array.isArray(n)?t[i][r]=n.slice():t[i][r]=n}return t}function tJ(e){let t={};for(let i=0;i<e.length;i++){let r=tY(e[i]);for(let e in r)t[e]=r[e]}return t}function tK(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:z.workingColorSpace}let t$={clone:tY,merge:tJ};class tZ extends tg{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=tY(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let r=this.uniforms[i].value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class t0 extends e4{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new eR,this.projectionMatrix=new eR,this.projectionMatrixInverse=new eR,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let t1=new F,t2=new P,t3=new P;class t4 extends t0{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*M*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*C*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*M*Math.atan(Math.tan(.5*C*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){t1.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(t1.x,t1.y).multiplyScalar(-e/t1.z),t1.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(t1.x,t1.y).multiplyScalar(-e/t1.z)}getViewSize(e,t){return this.getViewBounds(e,t2,t3),t.subVectors(t3,t2)}setViewOffset(e,t,i,r,n,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*C*this.fov)/this.zoom,i=2*t,r=this.aspect*i,n=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;n+=a.offsetX*r/e,t-=a.offsetY*i/s,r*=a.width/e,i*=a.height/s}let s=this.filmOffset;0!==s&&(n+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+r,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class t5 extends e4{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new t4(-90,1,e,t);r.layers=this.layers,this.add(r);const n=new t4(-90,1,e,t);n.layers=this.layers,this.add(n);const a=new t4(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new t4(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new t4(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new t4(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,r,n,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),n.up.set(0,0,-1),n.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),n.up.set(0,0,1),n.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[n,a,s,o,l,h]=this.children,c=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let A=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,n),e.setRenderTarget(i,1,r),e.render(t,a),e.setRenderTarget(i,2,r),e.render(t,s),e.setRenderTarget(i,3,r),e.render(t,o),e.setRenderTarget(i,4,r),e.render(t,l),i.texture.generateMipmaps=A,e.setRenderTarget(i,5,r),e.render(t,h),e.setRenderTarget(c,u,d),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class t8 extends ${constructor(e=[],t=301,i,r,n,a,s,o,l,h){super(e,t,i,r,n,a,s,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class t9 extends et{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1};this.texture=new t8([i,i,i,i,i,i]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
949
|
+
|
|
950
|
+
varying vec3 vWorldDirection;
|
|
951
|
+
|
|
952
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
953
|
+
|
|
954
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
955
|
+
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
void main() {
|
|
959
|
+
|
|
960
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
961
|
+
|
|
962
|
+
#include <begin_vertex>
|
|
963
|
+
#include <project_vertex>
|
|
964
|
+
|
|
965
|
+
}
|
|
966
|
+
`,fragmentShader:`
|
|
967
|
+
|
|
968
|
+
uniform sampler2D tEquirect;
|
|
969
|
+
|
|
970
|
+
varying vec3 vWorldDirection;
|
|
971
|
+
|
|
972
|
+
#include <common>
|
|
973
|
+
|
|
974
|
+
void main() {
|
|
975
|
+
|
|
976
|
+
vec3 direction = normalize( vWorldDirection );
|
|
977
|
+
|
|
978
|
+
vec2 sampleUV = equirectUv( direction );
|
|
979
|
+
|
|
980
|
+
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
981
|
+
|
|
982
|
+
}
|
|
983
|
+
`},r=new tX(5,5,5),n=new tZ({name:"CubemapFromEquirect",uniforms:tY(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});n.uniforms.tEquirect.value=t;let a=new tW(r,n),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new t5(1,10,this).update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){let n=e.getRenderTarget();for(let n=0;n<6;n++)e.setRenderTarget(this,n),e.clear(t,i,r);e.setRenderTarget(n)}}class t6 extends e4{constructor(){super(),this.isGroup=!0,this.type="Group"}}let t7={type:"move"};class ie{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new t6,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new t6,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new t6,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let r=null,n=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let r of(a=!0,e.hand.values())){let e=t.getJointPose(r,i),n=this._getHandJoint(l,r);null!==e&&(n.matrix.fromArray(e.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.matrixWorldNeedsUpdate=!0,n.jointRadius=e.radius),n.visible=null!==e}let r=l.joints["index-finger-tip"],n=l.joints["thumb-tip"],s=r.position.distanceTo(n.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(n=t.getPose(e.gripSpace,i))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(r=t.getPose(e.targetRaySpace,i))&&null!==n&&(r=n),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(t7)))}return null!==s&&(s.visible=null!==r),null!==o&&(o.visible=null!==n),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new t6;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class it extends e4{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new eG,this.environmentIntensity=1,this.environmentRotation=new eG,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ii{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=w()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,n=this.stride;r<n;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=w()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=w()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}let ir=new F;class ia{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix4(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ir.fromBufferAttribute(this,t),ir.applyNormalMatrix(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ir.fromBufferAttribute(this,t),ir.transformDirection(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=R(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=D(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=D(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=D(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=D(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=D(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=R(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=R(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=R(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=R(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=D(t,this.array),i=D(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=D(t,this.array),i=D(i,this.array),r=D(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=D(t,this.array),i=D(i,this.array),r=D(r,this.array),n=D(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=n,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new ia(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{m("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return new tE(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{m("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}}let is=new F,io=new Z,il=new Z,ih=new F,ic=new eR,iu=new F,id=new e_,ip=new eR,iA=new eB;class ig extends tW{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=l,this.bindMatrix=new eR,this.bindMatrixInverse=new eR,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;null===this.boundingBox&&(this.boundingBox=new en),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,iu),this.boundingBox.expandByPoint(iu)}computeBoundingSphere(){let e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new e_),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,iu),this.boundingSphere.expandByPoint(iu)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let i=this.material,r=this.matrixWorld;void 0===i||(null===this.boundingSphere&&this.computeBoundingSphere(),id.copy(this.boundingSphere),id.applyMatrix4(r),!1===e.ray.intersectsSphere(id)||(ip.copy(r).invert(),iA.copy(e.ray).applyMatrix4(ip),(null===this.boundingBox||!1!==iA.intersectsBox(this.boundingBox))&&this._computeIntersections(e,t,iA)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Z,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);let r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===l?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():v("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let i=this.skeleton,r=this.geometry;io.fromBufferAttribute(r.attributes.skinIndex,e),il.fromBufferAttribute(r.attributes.skinWeight,e),is.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=il.getComponent(e);if(0!==r){let n=io.getComponent(e);ic.multiplyMatrices(i.bones[n].matrixWorld,i.boneInverses[n]),t.addScaledVector(ih.copy(is).applyMatrix4(ic),r)}}return t.applyMatrix4(this.bindMatrixInverse)}}class im extends e4{constructor(){super(),this.isBone=!0,this.type="Bone"}}class iv extends ${constructor(e=null,t=1,i=1,r,n,a,s,o,l=1003,h=1003,c,u){super(null,a,s,o,l,h,r,n,c,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let ib=new eR,iy=new eR;class ix{constructor(e=[],t=[]){this.uuid=w(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){v("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new eR)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new eR;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let r=0,n=e.length;r<n;r++){let n=e[r]?e[r].matrixWorld:iy;ib.multiplyMatrices(n,t[r]),ib.toArray(i,16*r)}null!==r&&(r.needsUpdate=!0)}clone(){return new ix(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length),t=new Float32Array((e=Math.max(e=4*Math.ceil(e/4),4))*e*4);t.set(this.boneMatrices);let i=new iv(t,e,e,1023,1015);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){let r=e.bones[i],n=t[r];void 0===n&&(v("Skeleton: No bone found with UUID:",r),n=new im),this.bones.push(n),this.boneInverses.push(new eR().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let r=0,n=t.length;r<n;r++){let n=t[r];e.bones.push(n.uuid);let a=i[r];e.boneInverses.push(a.toArray())}return e}}class i_ extends tE{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}let iE=new eR,iS=new eR,iC=[],iM=new en,iw=new eR,iI=new tW,iT=new e_;class iB extends tW{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new i_(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<i;e++)this.setMatrixAt(e,iw)}computeBoundingBox(){let e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new en),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,iE),iM.copy(e.boundingBox).applyMatrix4(iE),this.boundingBox.union(iM)}computeBoundingSphere(){let e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new e_),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,iE),iT.copy(e.boundingSphere).applyMatrix4(iE),this.boundingSphere.union(iT)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){let i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,n=e*(i.length+1)+1;for(let e=0;e<i.length;e++)i[e]=r[n+e]}raycast(e,t){let i=this.matrixWorld,r=this.count;if((iI.geometry=this.geometry,iI.material=this.material,void 0!==iI.material)&&(null===this.boundingSphere&&this.computeBoundingSphere(),iT.copy(this.boundingSphere),iT.applyMatrix4(i),!1!==e.ray.intersectsSphere(iT)))for(let n=0;n<r;n++){this.getMatrixAt(n,iE),iS.multiplyMatrices(i,iE),iI.matrixWorld=iS,iI.raycast(e,iC);for(let e=0,i=iC.length;e<i;e++){let i=iC[e];i.instanceId=n,i.object=this,t.push(i)}iC.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new i_(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){let i=t.morphTargetInfluences,r=i.length+1;null===this.morphTexture&&(this.morphTexture=new iv(new Float32Array(r*this.count),r,this.count,1028,1015));let n=this.morphTexture.source.data.data,a=0;for(let e=0;e<i.length;e++)a+=i[e];let s=this.geometry.morphTargetsRelative?1:1-a,o=r*e;n[o]=s,n.set(i,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}let iR=new F,iD=new F,iL=new k;class iP{constructor(e=new F(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let r=iR.subVectors(i,t).cross(iD.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(iR),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let n=-(e.start.dot(this.normal)+this.constant)/r;return n<0||n>1?null:t.copy(e.start).addScaledVector(i,n)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||iL.getNormalMatrix(e),r=this.coplanarPoint(iR).applyMatrix4(e),n=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(n),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}let iU=new e_,iF=new P(.5,.5),iN=new F;class iO{constructor(e=new iP,t=new iP,i=new iP,r=new iP,n=new iP,a=new iP){this.planes=[e,t,i,r,n,a]}set(e,t,i,r,n,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(r),s[4].copy(n),s[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=2e3,i=!1){let r=this.planes,n=e.elements,a=n[0],s=n[1],o=n[2],l=n[3],h=n[4],c=n[5],u=n[6],d=n[7],p=n[8],A=n[9],f=n[10],g=n[11],m=n[12],v=n[13],b=n[14],y=n[15];if(r[0].setComponents(l-a,d-h,g-p,y-m).normalize(),r[1].setComponents(l+a,d+h,g+p,y+m).normalize(),r[2].setComponents(l+s,d+c,g+A,y+v).normalize(),r[3].setComponents(l-s,d-c,g-A,y-v).normalize(),i)r[4].setComponents(o,u,f,b).normalize(),r[5].setComponents(l-o,d-u,g-f,y-b).normalize();else if(r[4].setComponents(l-o,d-u,g-f,y-b).normalize(),2e3===t)r[5].setComponents(l+o,d+u,g+f,y+b).normalize();else if(2001===t)r[5].setComponents(o,u,f,b).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),iU.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),iU.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(iU)}intersectsSprite(e){return iU.center.set(0,0,0),iU.radius=.7071067811865476+iF.distanceTo(e.center),iU.applyMatrix4(e.matrixWorld),this.intersectsSphere(iU)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let r=t[i];if(iN.x=r.normal.x>0?e.max.x:e.min.x,iN.y=r.normal.y>0?e.max.y:e.min.y,iN.z=r.normal.z>0?e.max.z:e.min.z,0>r.distanceToPoint(iN))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}class ik extends tg{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new tp(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}let iQ=new F,iG=new F,iH=new eR,iz=new eB,iV=new e_,iq=new F,iW=new F;class ij extends e4{constructor(e=new tP,t=new ik){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[0];for(let e=1,r=t.count;e<r;e++)iQ.fromBufferAttribute(t,e-1),iG.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=iQ.distanceTo(iG);e.setAttribute("lineDistance",new tM(i,1))}else v("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,n=e.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),iV.copy(i.boundingSphere),iV.applyMatrix4(r),iV.radius+=n,!1===e.ray.intersectsSphere(iV))return;iH.copy(r).invert(),iz.copy(e.ray).applyMatrix4(iH);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,h=i.index,c=i.attributes.position;if(null!==h){let i=Math.max(0,a.start),r=Math.min(h.count,a.start+a.count);for(let n=i,a=r-1;n<a;n+=l){let i=iX(this,e,iz,o,h.getX(n),h.getX(n+1),n);i&&t.push(i)}if(this.isLineLoop){let n=iX(this,e,iz,o,h.getX(r-1),h.getX(i),r-1);n&&t.push(n)}}else{let i=Math.max(0,a.start),r=Math.min(c.count,a.start+a.count);for(let n=i,a=r-1;n<a;n+=l){let i=iX(this,e,iz,o,n,n+1,n);i&&t.push(i)}if(this.isLineLoop){let n=iX(this,e,iz,o,r-1,i,r-1);n&&t.push(n)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function iX(e,t,i,r,n,a,s){let o=e.geometry.attributes.position;if(iQ.fromBufferAttribute(o,n),iG.fromBufferAttribute(o,a),i.distanceSqToSegment(iQ,iG,iq,iW)>r)return;iq.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(iq);if(!(l<t.near)&&!(l>t.far))return{distance:l,point:iW.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}let iY=new F,iJ=new F;class iK extends ij{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[];for(let e=0,r=t.count;e<r;e+=2)iY.fromBufferAttribute(t,e),iJ.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+iY.distanceTo(iJ);e.setAttribute("lineDistance",new tM(i,1))}else v("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class i$ extends ij{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class iZ extends tg{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new tp(0xffffff),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let i0=new eR,i1=new eB,i2=new e_,i3=new F;class i4 extends e4{constructor(e=new tP,t=new iZ){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,n=e.params.Points.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),i2.copy(i.boundingSphere),i2.applyMatrix4(r),i2.radius+=n,!1===e.ray.intersectsSphere(i2))return;i0.copy(r).invert(),i1.copy(e.ray).applyMatrix4(i0);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=i.index,h=i.attributes.position;if(null!==l){let i=Math.max(0,a.start),n=Math.min(l.count,a.start+a.count);for(let a=i;a<n;a++){let i=l.getX(a);i3.fromBufferAttribute(h,i),i5(i3,i,o,r,e,t,this)}}else{let i=Math.max(0,a.start),n=Math.min(h.count,a.start+a.count);for(let a=i;a<n;a++)i3.fromBufferAttribute(h,a),i5(i3,a,o,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function i5(e,t,i,r,n,a,s){let o=i1.distanceSqToPoint(e);if(o<i){let i=new F;i1.closestPointToPoint(e,i),i.applyMatrix4(r);let l=n.ray.origin.distanceTo(i);if(l<n.near||l>n.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:t,face:null,faceIndex:null,barycoord:null,object:s})}}class i8 extends ${constructor(e,t,i,r,n=1006,a=1006,s,o,l){super(e,t,i,r,n,a,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class i9 extends ${constructor(e,t,i,r,n,a,s,o,l,h,c,u){super(null,a,s,o,l,h,r,n,c,u),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class i6 extends i9{constructor(e,t,i,r,n,a){super(e,t,i,n,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class i7 extends i9{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class re extends ${constructor(e,t,i,r,n,a,s,o,l){super(e,t,i,r,n,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rt extends ${constructor(e,t,i=1014,r,n,a,s=1003,o=1003,l,h=1026,c=1){if(1026!==h&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},r,n,a,s,o,h,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new X(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class ri extends rt{constructor(e,t=1014,i=301,r,n,a=1003,s=1003,o,l=1026){const h={width:e,height:e,depth:1};super(e,e,t,i,r,n,a,s,o,l),this.image=[h,h,h,h,h,h],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class rr extends ${constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class rn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){v("Curve: .getPoint() not implemented.")}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,r=this.getPoint(0),n=0;t.push(0);for(let a=1;a<=e;a++)t.push(n+=(i=this.getPoint(a/e)).distanceTo(r)),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let i,r=this.getLengths(),n=0,a=r.length;i=t||e*r[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=r[n=Math.floor(s+(o-s)/2)]-i)<0)s=n+1;else if(l>0)o=n-1;else{o=n;break}if(r[n=o]===i)return n/(a-1);let h=r[n],c=r[n+1];return(n+(i-h)/(c-h))/(a-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);let n=this.getPoint(i),a=this.getPoint(r),s=t||(n.isVector2?new P:new F);return s.copy(a).sub(n).normalize(),s}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){let i=new F,r=[],n=[],a=[],s=new F,o=new eR;for(let t=0;t<=e;t++){let i=t/e;r[t]=this.getTangentAt(i,new F)}n[0]=new F,a[0]=new F;let l=Number.MAX_VALUE,h=Math.abs(r[0].x),c=Math.abs(r[0].y),u=Math.abs(r[0].z);h<=l&&(l=h,i.set(1,0,0)),c<=l&&(l=c,i.set(0,1,0)),u<=l&&i.set(0,0,1),s.crossVectors(r[0],i).normalize(),n[0].crossVectors(r[0],s),a[0].crossVectors(r[0],n[0]);for(let t=1;t<=e;t++){if(n[t]=n[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(r[t-1],r[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(I(r[t-1].dot(r[t]),-1,1));n[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(r[t],n[t])}if(!0===t){let t=Math.acos(I(n[0].dot(n[e]),-1,1));t/=e,r[0].dot(s.crossVectors(n[0],n[e]))>0&&(t=-t);for(let i=1;i<=e;i++)n[i].applyMatrix4(o.makeRotationAxis(r[i],t*i)),a[i].crossVectors(r[i],n[i])}return{tangents:r,normals:n,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class ra extends rn{constructor(e=0,t=0,i=1,r=1,n=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new P){let i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,n=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=n?0:i),!0!==this.aClockwise||n||(r===i?r=-i:r-=i);let a=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),i=s-this.aX,r=o-this.aY;s=i*e-r*t+this.aX,o=i*t+r*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}function rs(){let e=0,t=0,i=0,r=0;function n(n,a,s,o){e=n,t=s,i=-3*n+3*a-2*s-o,r=2*n-2*a+s+o}return{initCatmullRom:function(e,t,i,r,a){n(t,i,a*(i-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,i,r,a,s,o){let l=(t-e)/a-(i-e)/(a+s)+(i-t)/s,h=(i-t)/s-(r-t)/(s+o)+(r-i)/o;n(t,i,l*=s,h*=s)},calc:function(n){let a=n*n;return e+t*n+i*a+a*n*r}}}let ro=new F,rl=new rs,rh=new rs,rc=new rs;function ru(e,t,i,r,n){let a=(r-t)*.5,s=(n-i)*.5,o=e*e;return e*o*(2*i-2*r+a+s)+(-3*i+3*r-2*a-s)*o+a*e+i}function rd(e,t,i,r){let n;return(n=1-e)*n*t+2*(1-e)*e*i+e*e*r}function rp(e,t,i,r,n){let a,s;return(a=1-e)*a*a*t+3*(s=1-e)*s*e*i+3*(1-e)*e*e*r+e*e*e*n}class rA extends rn{constructor(e=new P,t=new P,i=new P,r=new P){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new P){let i=this.v0,r=this.v1,n=this.v2,a=this.v3;return t.set(rp(e,i.x,r.x,n.x,a.x),rp(e,i.y,r.y,n.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class rf extends rn{constructor(e=new P,t=new P){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new P){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new P){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class rg extends rn{constructor(e=new P,t=new P,i=new P){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new P){let i=this.v0,r=this.v1,n=this.v2;return t.set(rd(e,i.x,r.x,n.x),rd(e,i.y,r.y,n.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class rm extends rn{constructor(e=new F,t=new F,i=new F){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new F){let i=this.v0,r=this.v1,n=this.v2;return t.set(rd(e,i.x,r.x,n.x),rd(e,i.y,r.y,n.y),rd(e,i.z,r.z,n.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class rv extends rn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new P){let i=this.points,r=(i.length-1)*e,n=Math.floor(r),a=r-n,s=i[0===n?n:n-1],o=i[n],l=i[n>i.length-2?i.length-1:n+1],h=i[n>i.length-3?i.length-1:n+2];return t.set(ru(a,s.x,o.x,l.x,h.x),ru(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new P().fromArray(i))}return this}}var rb=Object.freeze({__proto__:null,ArcCurve:class extends ra{constructor(e,t,i,r,n,a){super(e,t,i,i,r,n,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends rn{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new F){let i,r,n=this.points,a=n.length,s=(a-!this.closed)*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?i=n[(o-1)%a]:(ro.subVectors(n[0],n[1]).add(n[0]),i=ro);let h=n[o%a],c=n[(o+1)%a];if(this.closed||o+2<a?r=n[(o+2)%a]:(ro.subVectors(n[a-1],n[a-2]).add(n[a-1]),r=ro),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,t=Math.pow(i.distanceToSquared(h),e),n=Math.pow(h.distanceToSquared(c),e),a=Math.pow(c.distanceToSquared(r),e);n<1e-4&&(n=1),t<1e-4&&(t=n),a<1e-4&&(a=n),rl.initNonuniformCatmullRom(i.x,h.x,c.x,r.x,t,n,a),rh.initNonuniformCatmullRom(i.y,h.y,c.y,r.y,t,n,a),rc.initNonuniformCatmullRom(i.z,h.z,c.z,r.z,t,n,a)}else"catmullrom"===this.curveType&&(rl.initCatmullRom(i.x,h.x,c.x,r.x,this.tension),rh.initCatmullRom(i.y,h.y,c.y,r.y,this.tension),rc.initCatmullRom(i.z,h.z,c.z,r.z,this.tension));return t.set(rl.calc(l),rh.calc(l),rc.calc(l)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new F().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},CubicBezierCurve:rA,CubicBezierCurve3:class extends rn{constructor(e=new F,t=new F,i=new F,r=new F){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new F){let i=this.v0,r=this.v1,n=this.v2,a=this.v3;return t.set(rp(e,i.x,r.x,n.x,a.x),rp(e,i.y,r.y,n.y,a.y),rp(e,i.z,r.z,n.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},EllipseCurve:ra,LineCurve:rf,LineCurve3:class extends rn{constructor(e=new F,t=new F){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new F){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new F){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},QuadraticBezierCurve:rg,QuadraticBezierCurve3:rm,SplineCurve:rv});class ry extends rn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let i=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new rb[i](t,e))}return this}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),n=0;for(;n<r.length;){if(r[n]>=i){let e=r[n]-i,a=this.curves[n],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}n++}return null}getLength(){let e=this.getCurveLengths();return e[e.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 e=[],t=0;for(let i=0,r=this.curves.length;i<r;i++)e.push(t+=this.curves[i].getLength());return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t,i=[];for(let r=0,n=this.curves;r<n.length;r++){let a=n[r],s=a.isEllipseCurve?2*e:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,o=a.getPoints(s);for(let e=0;e<o.length;e++){let r=o[e];t&&t.equals(r)||(i.push(r),t=r)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let i=e.curves[t];this.curves.push(new rb[i.type]().fromJSON(i))}return this}}class rx extends ry{constructor(e){super(),this.type="Path",this.currentPoint=new P,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new rf(this.currentPoint.clone(),new P(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let n=new rg(this.currentPoint.clone(),new P(e,t),new P(i,r));return this.curves.push(n),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,n,a){let s=new rA(this.currentPoint.clone(),new P(e,t),new P(i,r),new P(n,a));return this.curves.push(s),this.currentPoint.set(n,a),this}splineThru(e){let t=new rv([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,n,a){let s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,i,r,n,a),this}absarc(e,t,i,r,n,a){return this.absellipse(e,t,i,i,r,n,a),this}ellipse(e,t,i,r,n,a,s,o){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,i,r,n,a,s,o),this}absellipse(e,t,i,r,n,a,s,o){let l=new ra(e,t,i,r,n,a,s,o);if(this.curves.length>0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class r_ extends rx{constructor(e){super(e),this.uuid=w(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let i=e.holes[t];this.holes.push(new rx().fromJSON(i))}return this}}function rE(e,t,i,r,n){let a;if(n===function(e,t,i,r){let n=0;for(let a=t,s=i-r;a<i;a+=r)n+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return n}(e,t,i,r)>0)for(let n=t;n<i;n+=r)a=rF(n/r|0,e[n],e[n+1],a);else for(let n=i-r;n>=t;n-=r)a=rF(n/r|0,e[n],e[n+1],a);return a&&rB(a,a.next)&&(rN(a),a=a.next),a}function rS(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(rB(i,i.next)||0===rT(i.prev,i,i.next))){if(rN(i),(i=t=i.prev)===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function rC(e,t){let i=e.x-t.x;return 0===i&&0==(i=e.y-t.y)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function rM(e,t,i,r,n){return(e=((e=((e=((e=((e=(e-i)*n|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-r)*n|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function rw(e,t,i,r,n,a,s,o){return(n-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(r-o)>=(i-s)*(t-o)&&(i-s)*(a-o)>=(n-s)*(r-o)}function rI(e,t,i,r,n,a,s,o){return(e!==s||t!==o)&&rw(e,t,i,r,n,a,s,o)}function rT(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function rB(e,t){return e.x===t.x&&e.y===t.y}function rR(e,t,i,r){let n=rL(rT(e,t,i)),a=rL(rT(e,t,r)),s=rL(rT(i,r,e)),o=rL(rT(i,r,t));return!!(n!==a&&s!==o||0===n&&rD(e,i,t)||0===a&&rD(e,r,t)||0===s&&rD(i,e,r)||0===o&&rD(i,t,r))}function rD(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function rL(e){return e>0?1:e<0?-1:0}function rP(e,t){return 0>rT(e.prev,e,e.next)?rT(e,t,e.next)>=0&&rT(e,e.prev,t)>=0:0>rT(e,t,e.prev)||0>rT(e,e.next,t)}function rU(e,t){let i=rO(e.i,e.x,e.y),r=rO(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function rF(e,t,i,r){let n=rO(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function rN(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function rO(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class rk{static triangulate(e,t,i=2){return function(e,t,i=2){let r,n,a,s=t&&t.length,o=s?t[0]*i:e.length,l=rE(e,0,o,i,!0),h=[];if(!l||l.next===l.prev)return h;if(s&&(l=function(e,t,i,r){let n=[];for(let i=0,a=t.length;i<a;i++){let s=t[i]*r,o=i<a-1?t[i+1]*r:e.length,l=rE(e,s,o,r,!1);l===l.next&&(l.steiner=!0),n.push(function(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}(l))}n.sort(rC);for(let e=0;e<n.length;e++)i=function(e,t){let i=function(e,t){let i,r=t,n=e.x,a=e.y,s=-1/0;if(rB(e,r))return r;do{if(rB(e,r.next))return r.next;if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){let e=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=n&&e>s&&(s=e,i=r.x<r.next.x?r:r.next,e===n))return i}r=r.next}while(r!==t);if(!i)return null;let o=i,l=i.x,h=i.y,c=1/0;r=i;do{if(n>=r.x&&r.x>=l&&n!==r.x&&rw(a<h?n:s,a,l,h,a<h?s:n,a,r.x,r.y)){var u,d;let t=Math.abs(a-r.y)/(n-r.x);rP(r,e)&&(t<c||t===c&&(r.x>i.x||r.x===i.x&&(u=i,d=r,0>rT(u.prev,u,d.prev)&&0>rT(d.next,u,u.next))))&&(i=r,c=t)}r=r.next}while(r!==o);return i}(e,t);if(!i)return t;let r=rU(i,e);return rS(r,r.next),rS(i,i.next)}(n[e],i);return i}(e,t,l,i)),e.length>80*i){r=e[0],n=e[1];let t=r,s=n;for(let a=i;a<o;a+=i){let i=e[a],o=e[a+1];i<r&&(r=i),o<n&&(n=o),i>t&&(t=i),o>s&&(s=o)}a=0!==(a=Math.max(t-r,s-n))?32767/a:0}return function e(t,i,r,n,a,s,o){if(!t)return;!o&&s&&function(e,t,i,r){let n=e;do 0===n.z&&(n.z=rM(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let a=null;for(t=0;n;){t++;let s=n,o=0;for(let e=0;e<i&&(o++,s=s.nextZ);e++);let l=i;for(;o>0||l>0&&s;)0!==o&&(0===l||!s||n.z<=s.z)?(r=n,n=n.nextZ,o--):(r=s,s=s.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=s}a.nextZ=null,i*=2}while(t>1)}(n)}(t,n,a,s);let l=t;for(;t.prev!==t.next;){let h=t.prev,c=t.next;if(s?function(e,t,i,r){let n=e.prev,a=e.next;if(rT(n,e,a)>=0)return!1;let s=n.x,o=e.x,l=a.x,h=n.y,c=e.y,u=a.y,d=Math.min(s,o,l),p=Math.min(h,c,u),A=Math.max(s,o,l),f=Math.max(h,c,u),g=rM(d,p,t,i,r),m=rM(A,f,t,i,r),v=e.prevZ,b=e.nextZ;for(;v&&v.z>=g&&b&&b.z<=m;){if(v.x>=d&&v.x<=A&&v.y>=p&&v.y<=f&&v!==n&&v!==a&&rI(s,h,o,c,l,u,v.x,v.y)&&rT(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=d&&b.x<=A&&b.y>=p&&b.y<=f&&b!==n&&b!==a&&rI(s,h,o,c,l,u,b.x,b.y)&&rT(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=A&&v.y>=p&&v.y<=f&&v!==n&&v!==a&&rI(s,h,o,c,l,u,v.x,v.y)&&rT(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=m;){if(b.x>=d&&b.x<=A&&b.y>=p&&b.y<=f&&b!==n&&b!==a&&rI(s,h,o,c,l,u,b.x,b.y)&&rT(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(t,n,a,s):function(e){let t=e.prev,i=e.next;if(rT(t,e,i)>=0)return!1;let r=t.x,n=e.x,a=i.x,s=t.y,o=e.y,l=i.y,h=Math.min(r,n,a),c=Math.min(s,o,l),u=Math.max(r,n,a),d=Math.max(s,o,l),p=i.next;for(;p!==t;){if(p.x>=h&&p.x<=u&&p.y>=c&&p.y<=d&&rI(r,s,n,o,a,l,p.x,p.y)&&rT(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){i.push(h.i,t.i,c.i),rN(t),t=c.next,l=c.next;continue}if((t=c)===l){o?1===o?e(t=function(e,t){let i=e;do{let r=i.prev,n=i.next.next;!rB(r,n)&&rR(r,i,i.next,n)&&rP(r,n)&&rP(n,r)&&(t.push(r.i,i.i,n.i),rN(i),rN(i.next),i=e=n),i=i.next}while(i!==e);return rS(i)}(rS(t),i),i,r,n,a,s,2):2===o&&function(t,i,r,n,a,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,h;if(o.i!==t.i&&(l=o,h=t,l.next.i!==h.i&&l.prev.i!==h.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&rR(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(l,h)&&(rP(l,h)&&rP(h,l)&&function(e,t){let i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}(l,h)&&(rT(l.prev,l,h.prev)||rT(l,h.prev,h))||rB(l,h)&&rT(l.prev,l,l.next)>0&&rT(h.prev,h,h.next)>0))){let l=rU(o,t);o=rS(o,o.next),l=rS(l,l.next),e(o,i,r,n,a,s,0),e(l,i,r,n,a,s,0);return}t=t.next}o=o.next}while(o!==t)}(t,i,r,n,a,s):e(rS(t),i,r,n,a,s,1);break}}}(l,h,i,r,n,a,0),h}(e,t,i)}}class rQ{static area(e){let t=e.length,i=0;for(let r=t-1,n=0;n<t;r=n++)i+=e[r].x*e[n].y-e[n].x*e[r].y;return .5*i}static isClockWise(e){return 0>rQ.area(e)}static triangulateShape(e,t){let i=[],r=[],n=[];rG(e),rH(i,e);let a=e.length;t.forEach(rG);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,rH(i,t[e]);let s=rk.triangulate(i,r);for(let e=0;e<s.length;e+=3)n.push(s.slice(e,e+3));return n}}function rG(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function rH(e,t){for(let i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}class rz extends tP{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const n=e/2,a=t/2,s=Math.floor(i),o=Math.floor(r),l=s+1,h=o+1,c=e/s,u=t/o,d=[],p=[],A=[],f=[];for(let e=0;e<h;e++){const t=e*u-a;for(let i=0;i<l;i++){const r=i*c-n;p.push(r,-t,0),A.push(0,0,1),f.push(i/s),f.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const i=t+l*e,r=t+l*(e+1),n=t+1+l*(e+1),a=t+1+l*e;d.push(i,r,a),d.push(r,n,a)}this.setIndex(d),this.setAttribute("position",new tM(p,3)),this.setAttribute("normal",new tM(A,3)),this.setAttribute("uv",new tM(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rz(e.width,e.height,e.widthSegments,e.heightSegments)}}class rV extends tP{constructor(e=new r_([new P(0,.5),new P(-.5,-.5),new P(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],n=[],a=[];let s=0,o=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(s,o,t),s+=o,o=0;function l(e){let s=r.length/3,l=e.extractPoints(t),h=l.shape,c=l.holes;!1===rQ.isClockWise(h)&&(h=h.reverse());for(let e=0,t=c.length;e<t;e++){let t=c[e];!0===rQ.isClockWise(t)&&(c[e]=t.reverse())}let u=rQ.triangulateShape(h,c);for(let e=0,t=c.length;e<t;e++){let t=c[e];h=h.concat(t)}for(let e=0,t=h.length;e<t;e++){let t=h[e];r.push(t.x,t.y,0),n.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=u.length;e<t;e++){let t=u[e],r=t[0]+s,n=t[1]+s,a=t[2]+s;i.push(r,n,a),o+=3}}this.setIndex(i),this.setAttribute("position",new tM(r,3)),this.setAttribute("normal",new tM(n,3)),this.setAttribute("uv",new tM(a,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let i=0,r=e.length;i<r;i++){let r=e[i];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){let i=[];for(let r=0,n=e.shapes.length;r<n;r++){let n=t[e.shapes[r]];i.push(n)}return new rV(i,e.curveSegments)}}class rq extends tP{constructor(e=1,t=32,i=16,r=0,n=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:n,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const o=Math.min(a+s,Math.PI);let l=0;const h=[],c=new F,u=new F,d=[],p=[],A=[],f=[];for(let d=0;d<=i;d++){const g=[],m=d/i;let v=0;0===d&&0===a?v=.5/t:d===i&&o===Math.PI&&(v=-.5/t);for(let i=0;i<=t;i++){const o=i/t;c.x=-e*Math.cos(r+o*n)*Math.sin(a+m*s),c.y=e*Math.cos(a+m*s),c.z=e*Math.sin(r+o*n)*Math.sin(a+m*s),p.push(c.x,c.y,c.z),u.copy(c).normalize(),A.push(u.x,u.y,u.z),f.push(o+v,1-m),g.push(l++)}h.push(g)}for(let e=0;e<i;e++)for(let r=0;r<t;r++){const t=h[e][r+1],n=h[e][r],s=h[e+1][r],l=h[e+1][r+1];(0!==e||a>0)&&d.push(t,n,l),(e!==i-1||o<Math.PI)&&d.push(n,s,l)}this.setIndex(d),this.setAttribute("position",new tM(p,3)),this.setAttribute("normal",new tM(A,3)),this.setAttribute("uv",new tM(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rq(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class rW extends tZ{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class rj extends tg{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new tp(0xffffff),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tp(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new P(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new eG,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class rX extends rj{constructor(e){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 P(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return I(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new tp(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 tp(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new tp(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class rY extends tg{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class rJ extends tg{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function rK(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function r$(e,t,i){let r=e.length,n=new e.constructor(r);for(let a=0,s=0;s!==r;++a){let r=i[a]*t;for(let i=0;i!==t;++i)n[s++]=e[r+i]}return n}function rZ(e,t,i,r){let n=1,a=e[0];for(;void 0!==a&&void 0===a[r];)a=e[n++];if(void 0===a)return;let s=a[r];if(void 0!==s)if(Array.isArray(s))do void 0!==(s=a[r])&&(t.push(a.time),i.push(...s)),a=e[n++];while(void 0!==a);else if(void 0!==s.toArray)do void 0!==(s=a[r])&&(t.push(a.time),s.toArray(i,i.length)),a=e[n++];while(void 0!==a);else do void 0!==(s=a[r])&&(t.push(a.time),i.push(s)),a=e[n++];while(void 0!==a)}class r0{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],n=t[i-1];e:{t:{let a;i:{r:if(!(e<r)){for(let a=i+2;;){if(void 0===r){if(e<n)break r;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(n=r,e<(r=t[++i]))break t}a=t.length;break i}if(!(e>=n)){let s=t[1];e<s&&(i=2,n=s);for(let a=i-2;;){if(void 0===n)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(r=n,e>=(n=t[--i-1]))break t}a=i,i=0;break i}break e}for(;i<a;){let r=i+a>>>1;e<t[r]?a=r:i=r+1}if(r=t[i],void 0===(n=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,n,r)}return this.interpolate_(i,n,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r;for(let e=0;e!==r;++e)t[e]=i[n+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class r1 extends r0{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,i){let r=this.parameterPositions,n=e-2,a=e+1,s=r[n],o=r[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:n=e,s=2*t-i;break;case 2402:n=r.length-2,s=t+r[n]-r[n+1];break;default:n=e,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*i-t;break;case 2402:a=1,o=i+r[1]-r[0];break;default:a=e-1,o=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-i),this._offsetPrev=n*h,this._offsetNext=a*h}interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-t)/(r-t),A=p*p,f=A*p,g=-u*f+2*u*A-u*p,m=(1+u)*f+(-1.5-2*u)*A+(-.5+u)*p+1,v=(-1-d)*f+(1.5+d)*A+.5*p,b=d*f-d*A;for(let e=0;e!==s;++e)n[e]=g*a[h+e]+m*a[l+e]+v*a[o+e]+b*a[c+e];return n}}class r2 extends r0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=(i-t)/(r-t),c=1-h;for(let e=0;e!==s;++e)n[e]=a[l+e]*c+a[o+e]*h;return n}}class r3 extends r0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class r4{constructor(e,t,i,r){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=rK(t,this.TimeBufferType),this.values=rK(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t,i=e.constructor;if(i.toJSON!==this.toJSON)t=i.toJSON(e);else{t={name:e.name,times:rK(e.times,Array),values:rK(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new r3(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new r2(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new r1(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return v("KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,n=0,a=r-1;for(;n!==r&&i[n]<e;)++n;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==n||a!==r){n>=a&&(n=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=i.slice(n,a),this.values=this.values.slice(n*e,a*e)}return this}validate(){var e;let t=!0,i=this.getValueSize();i-Math.floor(i)!=0&&(b("KeyframeTrack: Invalid value size in track.",this),t=!1);let r=this.times,n=this.values,a=r.length;0===a&&(b("KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==a;e++){let i=r[e];if("number"==typeof i&&isNaN(i)){b("KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){b("KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==n&&ArrayBuffer.isView(e=n)&&!(e instanceof DataView))for(let e=0,i=n.length;e!==i;++e){let i=n[e];if(isNaN(i)){b("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=2302===this.getInterpolation(),n=e.length-1,a=1;for(let s=1;s<n;++s){let n=!1,o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(r)n=!0;else{let e=s*i,r=e-i,a=e+i;for(let s=0;s!==i;++s){let i=t[e+s];if(i!==t[r+s]||i!==t[a+s]){n=!0;break}}}if(n){if(s!==a){e[a]=e[s];let r=s*i,n=a*i;for(let e=0;e!==i;++e)t[n+e]=t[r+e]}++a}}if(n>0){e[a]=e[n];for(let e=n*i,r=a*i,s=0;s!==i;++s)t[r+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}r4.prototype.ValueTypeName="",r4.prototype.TimeBufferType=Float32Array,r4.prototype.ValueBufferType=Float32Array,r4.prototype.DefaultInterpolation=2301;class r5 extends r4{constructor(e,t,i){super(e,t,i)}}r5.prototype.ValueTypeName="bool",r5.prototype.ValueBufferType=Array,r5.prototype.DefaultInterpolation=2300,r5.prototype.InterpolantFactoryMethodLinear=void 0,r5.prototype.InterpolantFactoryMethodSmooth=void 0;class r8 extends r4{constructor(e,t,i,r){super(e,t,i,r)}}r8.prototype.ValueTypeName="color";class r9 extends r4{constructor(e,t,i,r){super(e,t,i,r)}}r9.prototype.ValueTypeName="number";class r6 extends r0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-t)/(r-t),l=e*s;for(let e=l+s;l!==e;l+=4)U.slerpFlat(n,0,a,l-s,a,l,o);return n}}class r7 extends r4{constructor(e,t,i,r){super(e,t,i,r)}InterpolantFactoryMethodLinear(e){return new r6(this.times,this.values,this.getValueSize(),e)}}r7.prototype.ValueTypeName="quaternion",r7.prototype.InterpolantFactoryMethodSmooth=void 0;class ne extends r4{constructor(e,t,i){super(e,t,i)}}ne.prototype.ValueTypeName="string",ne.prototype.ValueBufferType=Array,ne.prototype.DefaultInterpolation=2300,ne.prototype.InterpolantFactoryMethodLinear=void 0,ne.prototype.InterpolantFactoryMethodSmooth=void 0;class nt extends r4{constructor(e,t,i,r){super(e,t,i,r)}}nt.prototype.ValueTypeName="vector";class ni{constructor(e="",t=-1,i=[],r=2500){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=w(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,r=1/(e.fps||1);for(let e=0,n=i.length;e!==n;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return r9;case"vector":case"vector2":case"vector3":case"vector4":return nt;case"color":return r8;case"quaternion":return r7;case"bool":case"boolean":return r5;case"string":return ne}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],i=[];rZ(e.keys,t,i,"value"),e.times=t,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(i[e]).scale(r));let n=new this(e.name,e.duration,t,e.blendMode);return n.uuid=e.uuid,n.userData=JSON.parse(e.userData||"{}"),n}static toJSON(e){let t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,r=i.length;e!==r;++e)t.push(r4.toJSON(i[e]));return r}static CreateFromMorphTargetSequence(e,t,i,r){let n=t.length,a=[];for(let e=0;e<n;e++){let s=[],o=[];s.push((e+n-1)%n,e,(e+1)%n),o.push(0,1,0);let l=function(e){let t=e.length,i=Array(t);for(let e=0;e!==t;++e)i[e]=e;return i.sort(function(t,i){return e[t]-e[i]}),i}(s);s=r$(s,1,l),o=r$(o,1,l),r||0!==s[0]||(s.push(n),o.push(o[0])),a.push(new r9(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;Array.isArray(e)||(i=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<i.length;e++)if(i[e].name===t)return i[e];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let r={},n=/^([\w-]*?)([\d]+)$/;for(let t=0,i=e.length;t<i;t++){let i=e[t],a=i.name.match(n);if(a&&a.length>1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(i)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,i));return a}static parseAnimation(e,t){if(v("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return b("AnimationClip: No animation in JSONLoader data."),null;let i=function(e,t,i,r,n){if(0!==i.length){let a=[],s=[];rZ(i,a,s,r),0!==a.length&&n.push(new e(t,a,s))}},r=[],n=e.name||"default",a=e.fps||30,s=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let e=0;e<l.length;e++){let n=l[e].keys;if(n&&0!==n.length)if(n[0].morphTargets){let e,t={};for(e=0;e<n.length;e++)if(n[e].morphTargets)for(let i=0;i<n[e].morphTargets.length;i++)t[n[e].morphTargets[i]]=-1;for(let i in t){let t=[],a=[];for(let r=0;r!==n[e].morphTargets.length;++r){let r=n[e];t.push(r.time),a.push(+(r.morphTarget===i))}r.push(new r9(".morphTargetInfluence["+i+"]",t,a))}o=t.length*a}else{let a=".bones["+t[e].name+"]";i(nt,a+".position",n,"pos",r),i(r7,a+".quaternion",n,"rot",r),i(nt,a+".scale",n,"scl",r)}}return 0===r.length?null:new this(n,o,r,s)}resetDuration(){let e=this.tracks,t=0;for(let i=0,r=e.length;i!==r;++i){let e=this.tracks[i];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}let nr={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class nn{constructor(e,t,i){let r;const n=this;let a=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(e){o++,!1===a&&void 0!==n.onStart&&n.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==n.onProgress&&n.onProgress(e,s,o),s===o&&(a=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,i=l.length;t<i;t+=2){let i=l[t],r=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}let na=new nn;class ns{constructor(e){this.manager=void 0!==e?e:na,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(r,n){i.load(e,r,t,n)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}ns.DEFAULT_MATERIAL_NAME="__DEFAULT";let no={};class nl extends Error{constructor(e,t){super(e),this.response=t}}class nh extends ns{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,i,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=nr.get(`file:${e}`);if(void 0!==n)return this.manager.itemStart(e),setTimeout(()=>{t&&t(n),this.manager.itemEnd(e)},0),n;if(void 0!==no[e])return void no[e].push({onLoad:t,onProgress:i,onError:r});no[e]=[],no[e].push({onLoad:t,onProgress:i,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&v("FileLoader: HTTP Status 0 received."),"u"<typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let i=no[e],r=t.body.getReader(),n=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=n?parseInt(n):0,s=0!==a,o=0;return new Response(new ReadableStream({start(e){!function t(){r.read().then(({done:r,value:n})=>{if(r)e.close();else{let r=new ProgressEvent("progress",{lengthComputable:s,loaded:o+=n.byteLength,total:a});for(let e=0,t=i.length;e<t;e++){let t=i[e];t.onProgress&&t.onProgress(r)}e.enqueue(n),t()}},t=>{e.error(t)})}()}}))}throw new nl(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),i=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{nr.add(`file:${e}`,t);let i=no[e];delete no[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let i=no[e];if(void 0===i)throw this.manager.itemError(e),t;delete no[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let nc=new WeakMap;class nu extends ns{constructor(e){super(e)}load(e,t,i,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=nr.get(`image:${e}`);if(void 0!==a){if(!0===a.complete)n.manager.itemStart(e),setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0);else{let e=nc.get(a);void 0===e&&(e=[],nc.set(a,e)),e.push({onLoad:t,onError:r})}return a}let s=A("img");function o(){h(),t&&t(this);let i=nc.get(this)||[];for(let e=0;e<i.length;e++){let t=i[e];t.onLoad&&t.onLoad(this)}nc.delete(this),n.manager.itemEnd(e)}function l(t){h(),r&&r(t),nr.remove(`image:${e}`);let i=nc.get(this)||[];for(let e=0;e<i.length;e++){let r=i[e];r.onError&&r.onError(t)}nc.delete(this),n.manager.itemError(e),n.manager.itemEnd(e)}function h(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),nr.add(`image:${e}`,s),n.manager.itemStart(e),s.src=e,s}}class nd extends ns{constructor(e){super(e)}load(e,t,i,r){let n=this,a=new iv,s=new nh(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(n.withCredentials),s.load(e,function(e){let i;try{i=n.parse(e)}catch(e){if(void 0===r)return void e(e);r(e)}void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:1001,a.wrapT=void 0!==i.wrapT?i.wrapT:1001,a.magFilter=void 0!==i.magFilter?i.magFilter:1006,a.minFilter=void 0!==i.minFilter?i.minFilter:1006,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(a.colorSpace=i.colorSpace),void 0!==i.flipY&&(a.flipY=i.flipY),void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps,a.minFilter=1008),1===i.mipmapCount&&(a.minFilter=1006),void 0!==i.generateMipmaps&&(a.generateMipmaps=i.generateMipmaps),a.needsUpdate=!0,t&&t(a,i)},i,r),a}}class np extends ns{constructor(e){super(e)}load(e,t,i,r){let n=new $,a=new nu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){n.image=e,n.needsUpdate=!0,void 0!==t&&t(n)},i,r),n}}class nA extends e4{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new tp(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}let nf=new eR,ng=new F,nm=new F;class nv{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new P(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new eR,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new iO,this._frameExtents=new P(1,1),this._viewportCount=1,this._viewports=[new Z(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;ng.setFromMatrixPosition(e.matrixWorld),t.position.copy(ng),nm.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(nm),t.updateMatrixWorld(),nf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(nf,t.coordinateSystem,t.reversedDepth),t.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(nf)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class nb extends nv{constructor(){super(new t4(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,i=2*M*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,n=e.distance||t.far;(i!==t.fov||r!==t.aspect||n!==t.far)&&(t.fov=i,t.aspect=r,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class ny extends nA{constructor(e,t,i=0,r=Math.PI/3,n=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(e4.DEFAULT_UP),this.updateMatrix(),this.target=new e4,this.distance=i,this.angle=r,this.penumbra=n,this.decay=a,this.map=null,this.shadow=new nb}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class nx extends nv{constructor(){super(new t4(90,1,.5,500)),this.isPointLightShadow=!0}}class n_ extends nA{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new nx}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class nE extends t0{constructor(e=-1,t=1,i=1,r=-1,n=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=n,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,n,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,n=i-e,a=i+e,s=r+t,o=r-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=e*this.view.offsetX,a=n+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(n,a,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class nS extends nv{constructor(){super(new nE(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class nC extends nA{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(e4.DEFAULT_UP),this.updateMatrix(),this.target=new e4,this.shadow=new nS}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class nM{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new F)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let i=e.x,r=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*n),t.addScaledVector(a[3],.488603*i),t.addScaledVector(a[4],i*r*1.092548),t.addScaledVector(a[5],r*n*1.092548),t.addScaledVector(a[6],.315392*(3*n*n-1)),t.addScaledVector(a[7],i*n*1.092548),t.addScaledVector(a[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){let i=e.x,r=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*n),t.addScaledVector(a[3],1.023328*i),t.addScaledVector(a[4],.858086*i*r),t.addScaledVector(a[5],.858086*r*n),t.addScaledVector(a[6],.743125*n*n-.247708),t.addScaledVector(a[7],.858086*i*n),t.addScaledVector(a[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+3*r);return this}toArray(e=[],t=0){let i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){let i=e.x,r=e.y,n=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*n,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*n,t[6]=.315392*(3*n*n-1),t[7]=1.092548*i*n,t[8]=.546274*(i*i-r*r)}}class nw extends nA{constructor(e=new nM,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class nI{static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}}let nT=new WeakMap;class nB extends ns{constructor(e){super(e),this.isImageBitmapLoader=!0,"u"<typeof createImageBitmap&&v("ImageBitmapLoader: createImageBitmap() not supported."),"u"<typeof fetch&&v("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,i,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=nr.get(`image-bitmap:${e}`);if(void 0!==a)return(n.manager.itemStart(e),a.then)?void a.then(i=>{if(!0!==nT.has(a))return t&&t(i),n.manager.itemEnd(e),i;r&&r(nT.get(a)),n.manager.itemError(e),n.manager.itemEnd(e)}):(setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0),a);let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,s.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(n.options,{colorSpaceConversion:"none"}))}).then(function(i){return nr.add(`image-bitmap:${e}`,i),t&&t(i),n.manager.itemEnd(e),i}).catch(function(t){r&&r(t),nT.set(o,t),nr.remove(`image-bitmap:${e}`),n.manager.itemError(e),n.manager.itemEnd(e)});nr.add(`image-bitmap:${e}`,o),n.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class nR extends t4{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class nD{constructor(e,t,i){let r,n,a;switch(this.binding=e,this.valueSize=i,t){case"quaternion":r=this._slerp,n=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":r=this._select,n=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*i);break;default:r=this._lerp,n=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=n,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let i=this.buffer,r=this.valueSize,n=e*r+r,a=this.cumulativeWeight;if(0===a){for(let e=0;e!==r;++e)i[n+e]=i[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(i,n,0,e,r)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,i=this.valueSize,r=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,i=this.buffer,r=e*t+t,n=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,n<1){let e=t*this._origIndex;this._mixBufferRegion(i,r,e,1-n,t)}a>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let e=t,n=t+t;e!==n;++e)if(i[e]!==i[e+t]){s.setValue(i,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let e=i;e!==r;++e)t[e]=t[r+e%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,n){if(r>=.5)for(let r=0;r!==n;++r)e[t+r]=e[i+r]}_slerp(e,t,i,r){U.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,n){let a=this._workIndex*n;U.multiplyQuaternionsFlat(e,a,e,t,e,i),U.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,i,r,n){let a=1-r;for(let s=0;s!==n;++s){let n=t+s;e[n]=e[n]*a+e[i+s]*r}}_lerpAdditive(e,t,i,r,n){for(let a=0;a!==n;++a){let n=t+a;e[n]=e[n]+e[i+a]*r}}}let nL="\\[\\]\\.:\\/",nP=RegExp("["+nL+"]","g"),nU="[^"+nL+"]",nF="[^"+nL.replace("\\.","")+"]",nN=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",nU)+/(WCOD+)?/.source.replace("WCOD",nF)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nU)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nU)+"$"),nO=["material","materials","bones","map"];class nk{constructor(e,t,i){this.path=t,this.parsedPath=i||nk.parseTrackName(t),this.node=nk.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new nk.Composite(e,t,i):new nk(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(nP,"")}static parseTrackName(e){let t=nN.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){let e=i.nodeName.substring(r+1);-1!==nO.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let i=function(e){for(let r=0;r<e.length;r++){let n=e[r];if(n.name===t||n.uuid===t)return n;let a=i(n.children);if(a)return a}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,n=t.propertyIndex;if(e||(e=nk.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void v("PropertyBinding: No target node found for track: "+this.path+".");if(i){let r=t.objectIndex;switch(i){case"materials":if(!e.material)return void b("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void b("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void b("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void b("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void b("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[i])return void b("PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==r){if(void 0===e[r])return void b("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[r]}}let a=e[r];if(void 0===a)return void b("PropertyBinding: Trying to update property for track: "+t.nodeName+"."+r+" but it wasn't found.",e);let s=this.Versioning.None;this.targetObject=e,!0===e.isMaterial?s=this.Versioning.NeedsUpdate:!0===e.isObject3D&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==n){if("morphTargetInfluences"===r){if(!e.geometry)return void b("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void b("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[n]&&(n=e.morphTargetDictionary[n])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=n}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}nk.Composite=class{constructor(e,t,i){const r=i||nk.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},nk.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},nk.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},nk.prototype.GetterByBindingType=[nk.prototype._getValue_direct,nk.prototype._getValue_array,nk.prototype._getValue_arrayElement,nk.prototype._getValue_toArray],nk.prototype.SetterByBindingTypeAndVersioning=[[nk.prototype._setValue_direct,nk.prototype._setValue_direct_setNeedsUpdate,nk.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nk.prototype._setValue_array,nk.prototype._setValue_array_setNeedsUpdate,nk.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nk.prototype._setValue_arrayElement,nk.prototype._setValue_arrayElement_setNeedsUpdate,nk.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nk.prototype._setValue_fromArray,nk.prototype._setValue_fromArray_setNeedsUpdate,nk.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class nQ{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const n=t.tracks,a=n.length,s=Array(a),o={endingStart:2400,endingEnd:2400};for(let e=0;e!==a;++e){const t=n[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i=!1){if(e.fadeOut(t),this.fadeIn(t),!0===i){let i=this._clip.duration,r=e._clip.duration;e.warp(1,r/i,t),this.warp(i/r,1,t)}return this}crossFadeTo(e,t,i=!1){return e.crossFadeFrom(this,t,i)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){let r=this._mixer,n=r.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=r._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=n,o[1]=n+i,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled)return void this._updateWeight(e);let n=this._startTime;if(null!==n){let r=(e-n)*i;r<0||0===i?t=0:(this._startTime=null,t=i*r)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let i=0,r=e.length;i!==r;++i)e[i].evaluate(a),t[i].accumulateAdditive(s);else for(let i=0,n=e.length;i!==n;++i)e[i].evaluate(a),t[i].accumulate(r,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let i=this._weightInterpolant;if(null!==i){let r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,i=this.loop,r=this.time+e,n=this._loopCount,a=2202===i;if(0===e)return -1===n?r:a&&(1&n)==1?t-r:r;if(2200===i){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));n:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break n}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){let i=Math.floor(r/t);r-=t*i,n+=Math.abs(i);let s=this.repetitions-n;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=r;if(a&&(1&n)==1)return t-r}return r}_setEndings(e,t,i){let r=this._interpolantSettings;i?(r.endingStart=2401,r.endingEnd=2401):(e?r.endingStart=this.zeroSlopeAtStart?2401:2400:r.endingStart=2402,t?r.endingEnd=this.zeroSlopeAtEnd?2401:2400:r.endingEnd=2402)}_scheduleFading(e,t,i){let r=this._mixer,n=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=n,o[0]=t,s[1]=n+e,o[1]=i,this}}let nG=new Float32Array(1);class nH extends _{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,a=e._propertyBindings,s=e._interpolants,o=i.uuid,l=this._bindingsByRootAndName,h=l[o];void 0===h&&(h={},l[o]=h);for(let e=0;e!==n;++e){let n=r[e],l=n.name,c=h[l];if(void 0!==c)++c.referenceCount,a[e]=c;else{if(void 0!==(c=a[e])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;c=new nD(nk.create(i,l,r),n.ValueTypeName,n.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[e]=c}s[e].resultBuffer=c.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,i){let r=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[i]=e}_removeInactiveAction(e){let t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;let n=e._clip.uuid,a=this._actionsByClip,s=a[n],o=s.knownActions,l=o[o.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),e._byClipCacheIndex=null;let c=s.actionByRoot,u=(e._localRoot||this._root).uuid;delete c[u],0===o.length&&delete a[n],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(e){let t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_takeBackAction(e){let t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_addInactiveBinding(e,t,i){let r=this._bindingsByRootAndName,n=this._bindings,a=r[t];void 0===a&&(a={},r[t]=a),a[i]=e,e._cacheIndex=n.length,n.push(e)}_removeInactiveBinding(e){let t=this._bindings,i=e.binding,r=i.rootNode.uuid,n=i.path,a=this._bindingsByRootAndName,s=a[r],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[n],0===Object.keys(s).length&&delete a[r]}_lendBinding(e){let t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_takeBackBinding(e){let t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&((i=new r2(new Float32Array(2),new Float32Array(2),1,nG)).__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){let t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,n=t[r];e.__cacheIndex=r,t[r]=e,n.__cacheIndex=i,t[i]=n}clipAction(e,t,i){let r=t||this._root,n=r.uuid,a="string"==typeof e?ni.findByName(r,e):e,s=null!==a?a.uuid:e,o=this._actionsByClip[s],l=null;if(void 0===i&&(i=null!==a?a.blendMode:2500),void 0!==o){let e=o.actionByRoot[n];if(void 0!==e&&e.blendMode===i)return e;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;let h=new nQ(this,a,t,i);return this._bindAction(h,l),this._addInactiveAction(h,s,n),h}existingAction(e,t){let i=t||this._root,r=i.uuid,n="string"==typeof e?ni.findByName(i,e):e,a=n?n.uuid:e,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[r]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;let t=this._actions,i=this._nActiveActions,r=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==i;++s)t[s]._update(r,e,n,a);let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,i=e.uuid,r=this._actionsByClip,n=r[i];if(void 0!==n){let e=n.knownActions;for(let i=0,r=e.length;i!==r;++i){let r=e[i];this._deactivateAction(r);let n=r._cacheIndex,a=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,a._cacheIndex=n,t[n]=a,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[i]}}uncacheRoot(e){let t=e.uuid,i=this._actionsByClip;for(let e in i){let r=i[e].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}let r=this._bindingsByRootAndName[t];if(void 0!==r)for(let e in r){let t=r[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}let nz=new eR;class nV{constructor(e,t,i=0,r=1/0){this.ray=new eB(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new eH,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):b("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return nz.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(nz),this}intersectObject(e,t=!0,i=[]){return nW(e,this,i,t),i.sort(nq),i}intersectObjects(e,t=!0,i=[]){for(let r=0,n=e.length;r<n;r++)nW(e[r],this,i,t);return i.sort(nq),i}}function nq(e,t){return e.distance-t.distance}function nW(e,t,i,r){let n=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,i)&&(n=!1),!0===n&&!0===r){let r=e.children;for(let e=0,n=r.length;e<n;e++)nW(r[e],t,i,!0)}}class nj{constructor(e=1,t=0,i=0){this.radius=e,this.phi=t,this.theta=i}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=I(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(I(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}function nX(e,t,i,r){let n=function(e){switch(e){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${e}.`)}(r);switch(i){case 1021:return e*t;case 1028:case 1029:return e*t/n.components*n.byteLength;case 1030:case 1031:return e*t*2/n.components*n.byteLength;case 1022:return e*t*3/n.components*n.byteLength;case 1023:case 1033:return e*t*4/n.components*n.byteLength;case 33776:case 33777:case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:case 37496:case 37490:case 37491:case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8}throw Error(`Unable to determine texture byte length for ${i} format.`)}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}})),"u">typeof window&&(window.__THREE__?v("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182")},3770(e,t,i){"use strict";i.d(t,{B:()=>c,v:()=>n});var r=i(874);class n extends r.B69{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new r.I9Y(.5,.5),this.addEventListener("removed",function(){this.traverse(function(e){e.element&&e.element instanceof e.element.ownerDocument.defaultView.Element&&null!==e.element.parentNode&&e.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}let a=new r.Pq0,s=new r.kn4,o=new r.kn4,l=new r.Pq0,h=new r.Pq0;class c{constructor(e={}){let t,i,r,n;const c=this,u={objects:new WeakMap},d=void 0!==e.element?e.element:document.createElement("div");d.style.overflow="hidden",this.domElement=d,this.sortObjects=!0,this.getSize=function(){return{width:t,height:i}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),s.copy(t.matrixWorldInverse),o.multiplyMatrices(t.projectionMatrix,s),function e(t,i,s){if(!1===t.visible)return void function e(t){t.isCSS2DObject&&(t.element.style.display="none");for(let i=0,r=t.children.length;i<r;i++)e(t.children[i])}(t);if(t.isCSS2DObject){var p,A;a.setFromMatrixPosition(t.matrixWorld),a.applyMatrix4(o);let e=a.z>=-1&&a.z<=1&&!0===t.layers.test(s.layers),f=t.element;f.style.display=!0===e?"":"none",!0===e&&(t.onBeforeRender(c,i,s),f.style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(a.x*r+r)+"px,"+(-a.y*n+n)+"px)",f.parentNode!==d&&d.appendChild(f),t.onAfterRender(c,i,s));let g={distanceToCameraSquared:(p=s,A=t,l.setFromMatrixPosition(p.matrixWorld),h.setFromMatrixPosition(A.matrixWorld),l.distanceToSquared(h))};u.objects.set(t,g)}for(let r=0,n=t.children.length;r<n;r++)e(t.children[r],i,s)}(e,e,t),this.sortObjects&&function(e){let t,i=(t=[],e.traverseVisible(function(e){e.isCSS2DObject&&t.push(e)}),t).sort(function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:u.objects.get(e).distanceToCameraSquared-u.objects.get(t).distanceToCameraSquared}),r=i.length;for(let e=0,t=i.length;e<t;e++)i[e].element.style.zIndex=r-e}(e)},this.setSize=function(e,a){t=e,i=a,r=t/2,n=i/2,d.style.width=e+"px",d.style.height=a+"px"}}}}}]);
|