@2112-lab/central-plant 0.1.3 โ†’ 0.1.4

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.
Files changed (115) hide show
  1. package/dist/bundle/index.js +1 -1
  2. package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -1
  3. package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1
  4. package/dist/cjs/node_modules/three/examples/jsm/exporters/GLTFExporter.js +1 -0
  5. package/dist/cjs/node_modules/three/examples/jsm/exporters/OBJExporter.js +1 -0
  6. package/dist/cjs/node_modules/three/examples/jsm/exporters/PLYExporter.js +1 -0
  7. package/dist/cjs/node_modules/three/examples/jsm/exporters/STLExporter.js +1 -0
  8. package/dist/cjs/node_modules/three/examples/jsm/loaders/DRACOLoader.js +1 -0
  9. package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -1
  10. package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -1
  11. package/dist/cjs/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +1 -0
  12. package/dist/cjs/src/analysis/analysis.js +1 -0
  13. package/dist/cjs/src/analysis/testing.js +1 -0
  14. package/dist/cjs/src/core/centralPlant.js +1 -0
  15. package/dist/cjs/src/core/debugLogger.js +1 -0
  16. package/dist/cjs/src/core/mathUtils.js +1 -0
  17. package/dist/cjs/src/core/nameUtils.js +1 -0
  18. package/dist/cjs/src/data/export.js +1 -0
  19. package/dist/cjs/src/data/import.js +1 -0
  20. package/dist/cjs/src/data/numerics.js +1 -0
  21. package/dist/cjs/src/helpers/sceneHelper.js +1 -0
  22. package/dist/cjs/src/index.js +1 -1
  23. package/dist/cjs/src/managers/components/animationManager.js +1 -0
  24. package/dist/cjs/src/managers/components/componentManager.js +1 -0
  25. package/dist/cjs/src/managers/components/pathfindingManager.js +1 -0
  26. package/dist/cjs/src/managers/controls/TransformControls.js +1 -0
  27. package/dist/cjs/src/managers/controls/cameraControlsManager.js +1 -0
  28. package/dist/cjs/src/managers/controls/dragDropManager.js +1 -0
  29. package/dist/cjs/src/managers/controls/keyboardControlsManager.js +1 -0
  30. package/dist/cjs/src/managers/controls/transformControlsManager.js +1 -0
  31. package/dist/cjs/src/managers/environment/environmentManager.js +1 -0
  32. package/dist/cjs/src/managers/environment/textureConfig.js +1 -0
  33. package/dist/cjs/src/managers/scene/sceneExportManager.js +1 -0
  34. package/dist/cjs/src/managers/scene/sceneInitializationManager.js +1 -0
  35. package/dist/cjs/src/managers/scene/sceneOperationsManager.js +1 -0
  36. package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +1 -0
  37. package/dist/cjs/src/managers/system/disposalManager.js +1 -0
  38. package/dist/cjs/src/managers/system/hotReloadManager.js +1 -0
  39. package/dist/cjs/src/managers/system/performanceMonitor.js +1 -0
  40. package/dist/cjs/src/rendering/modelPreloader.js +1 -0
  41. package/dist/cjs/src/rendering/rendering2D.js +1 -0
  42. package/dist/cjs/src/rendering/rendering3D.js +1 -0
  43. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -1
  44. package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1
  45. package/dist/esm/node_modules/three/examples/jsm/exporters/GLTFExporter.js +1 -0
  46. package/dist/esm/node_modules/three/examples/jsm/exporters/OBJExporter.js +1 -0
  47. package/dist/esm/node_modules/three/examples/jsm/exporters/PLYExporter.js +1 -0
  48. package/dist/esm/node_modules/three/examples/jsm/exporters/STLExporter.js +1 -0
  49. package/dist/esm/node_modules/three/examples/jsm/loaders/DRACOLoader.js +1 -0
  50. package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -1
  51. package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -1
  52. package/dist/esm/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +1 -0
  53. package/dist/esm/src/analysis/analysis.js +1 -0
  54. package/dist/esm/src/analysis/testing.js +1 -0
  55. package/dist/esm/src/core/centralPlant.js +1 -0
  56. package/dist/esm/src/core/debugLogger.js +1 -0
  57. package/dist/esm/src/core/mathUtils.js +1 -0
  58. package/dist/esm/src/core/nameUtils.js +1 -0
  59. package/dist/esm/src/data/export.js +1 -0
  60. package/dist/esm/src/data/import.js +1 -0
  61. package/dist/esm/src/data/numerics.js +1 -0
  62. package/dist/esm/src/helpers/sceneHelper.js +1 -0
  63. package/dist/esm/src/index.js +1 -1
  64. package/dist/esm/src/managers/components/animationManager.js +1 -0
  65. package/dist/esm/src/managers/components/componentManager.js +1 -0
  66. package/dist/esm/src/managers/components/pathfindingManager.js +1 -0
  67. package/dist/esm/src/managers/controls/TransformControls.js +1 -0
  68. package/dist/esm/src/managers/controls/cameraControlsManager.js +1 -0
  69. package/dist/esm/src/managers/controls/dragDropManager.js +1 -0
  70. package/dist/esm/src/managers/controls/keyboardControlsManager.js +1 -0
  71. package/dist/esm/src/managers/controls/transformControlsManager.js +1 -0
  72. package/dist/esm/src/managers/environment/environmentManager.js +1 -0
  73. package/dist/esm/src/managers/environment/textureConfig.js +1 -0
  74. package/dist/esm/src/managers/scene/sceneExportManager.js +1 -0
  75. package/dist/esm/src/managers/scene/sceneInitializationManager.js +1 -0
  76. package/dist/esm/src/managers/scene/sceneOperationsManager.js +1 -0
  77. package/dist/esm/src/managers/scene/sceneTooltipsManager.js +1 -0
  78. package/dist/esm/src/managers/system/disposalManager.js +1 -0
  79. package/dist/esm/src/managers/system/hotReloadManager.js +1 -0
  80. package/dist/esm/src/managers/system/performanceMonitor.js +1 -0
  81. package/dist/esm/src/rendering/modelPreloader.js +1 -0
  82. package/dist/esm/src/rendering/rendering2D.js +1 -0
  83. package/dist/esm/src/rendering/rendering3D.js +1 -0
  84. package/dist/index.d.ts +52 -255
  85. package/package.json +3 -6
  86. package/dist/cjs/node_modules/three/examples/jsm/controls/TransformControls.js +0 -1
  87. package/dist/cjs/src/animationManager.js +0 -1
  88. package/dist/cjs/src/componentManager.js +0 -1
  89. package/dist/cjs/src/debugLogger.js +0 -1
  90. package/dist/cjs/src/disposalManager.js +0 -1
  91. package/dist/cjs/src/environmentManager.js +0 -1
  92. package/dist/cjs/src/hotReloadManager.js +0 -1
  93. package/dist/cjs/src/keyboardControlsManager.js +0 -1
  94. package/dist/cjs/src/nameUtils.js +0 -1
  95. package/dist/cjs/src/pathfindingManager.js +0 -1
  96. package/dist/cjs/src/performanceMonitor.js +0 -1
  97. package/dist/cjs/src/sceneExportManager.js +0 -1
  98. package/dist/cjs/src/sceneInitializationManager.js +0 -1
  99. package/dist/cjs/src/textureConfig.js +0 -1
  100. package/dist/cjs/src/transformControlsManager.js +0 -1
  101. package/dist/esm/node_modules/three/examples/jsm/controls/TransformControls.js +0 -1
  102. package/dist/esm/src/animationManager.js +0 -1
  103. package/dist/esm/src/componentManager.js +0 -1
  104. package/dist/esm/src/debugLogger.js +0 -1
  105. package/dist/esm/src/disposalManager.js +0 -1
  106. package/dist/esm/src/environmentManager.js +0 -1
  107. package/dist/esm/src/hotReloadManager.js +0 -1
  108. package/dist/esm/src/keyboardControlsManager.js +0 -1
  109. package/dist/esm/src/nameUtils.js +0 -1
  110. package/dist/esm/src/pathfindingManager.js +0 -1
  111. package/dist/esm/src/performanceMonitor.js +0 -1
  112. package/dist/esm/src/sceneExportManager.js +0 -1
  113. package/dist/esm/src/sceneInitializationManager.js +0 -1
  114. package/dist/esm/src/textureConfig.js +0 -1
  115. package/dist/esm/src/transformControlsManager.js +0 -1
@@ -1 +1 @@
1
- "use strict";function t(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=Array(r);n<r;n++)e[n]=t[n];return e}function r(t){if(Array.isArray(t))return t}function n(r){if(Array.isArray(r))return t(r)}function e(t,r,n,e,o,i,u){try{var f=t[i](u),c=f.value}catch(t){return void n(t)}f.done?r(c):Promise.resolve(c).then(e,o)}function o(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,m(e.key),e)}}function i(t,r,n){return(r=m(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(u=function(){return!!t})()}function f(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function c(t,r){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var e,o,i,u,f=[],c=!0,a=!1;try{if(i=(n=n.call(t)).next,0===r){if(Object(n)!==n)return;c=!1}else for(;!(c=(e=i.call(n)).done)&&(f.push(e.value),f.length!==r);c=!0);}catch(t){a=!0,o=t}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(a)throw o}}return f}}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,e)}return n}function b(){var t,r,n="function"==typeof Symbol?Symbol:{},e=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,e,o,i){var c=e&&e.prototype instanceof f?e:f,a=Object.create(c.prototype);return y(a,"_invoke",function(n,e,o){var i,f,c,a=0,l=o||[],s=!1,b={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,n){return i=r,f=0,c=t,b.n=n,u}};function y(n,e){for(f=n,c=e,r=0;!s&&a&&!o&&r<l.length;r++){var o,i=l[r],y=b.p,p=i[2];n>3?(o=p===e)&&(c=i[(f=i[4])?5:(f=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(f=0,b.v=e,b.n=i[1]):y<p&&(o=n<3||i[0]>e||e>p)&&(i[4]=n,i[5]=e,b.n=p,f=0))}if(o||n>1)return u;throw s=!0,e}return function(o,l,p){if(a>1)throw TypeError("Generator is already running");for(s&&1===l&&y(l,p),f=l,c=p;(r=f<2?t:c)||!s;){i||(f?f<3?(f>1&&(b.n=-1),y(f,c)):b.n=c:b.v=c);try{if(a=2,i){if(f||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,f<2&&(f=0)}else 1===f&&(r=i.return)&&r.call(i),f<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),f=1);i=t}else if((r=(s=b.n<0)?c:n.call(e,b))!==u)break}catch(r){i=t,f=1,c=r}finally{a=1}}return{value:r,done:s}}}(n,o,i),!0),a}var u={};function f(){}function c(){}function a(){}r=Object.getPrototypeOf;var l=[][e]?r(r([][e]())):(y(r={},e,function(){return this}),r),s=a.prototype=f.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,y(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return c.prototype=a,y(s,"constructor",a),y(a,"constructor",c),c.displayName="GeneratorFunction",y(a,o,"GeneratorFunction"),y(s),y(s,o,"Generator"),y(s,e,function(){return this}),y(s,"toString",function(){return"[object Generator]"}),(b=function(){return{w:i,m:p}})()}function y(t,r,n,e){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}y=function(t,r,n,e){if(r)o?o(t,r,{value:n,enumerable:!e,configurable:!e,writable:!e}):t[r]=n;else{function i(r,n){y(t,r,function(t){return this.t(r,n,t)})}i("next",0),i("throw",1),i("return",2)}},y(t,r,n,e)}function p(t,r){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},p(t,r)}function v(t,r){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,r||"default");if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function m(t){var r=v(t,"string");return"symbol"==typeof r?r:r+""}function d(r,n){if(r){if("string"==typeof r)return t(r,n);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?t(r,n):void 0}}Object.defineProperty(exports,"o",{value:!0}),exports.arrayLikeToArray=t,exports.arrayWithHoles=r,exports.arrayWithoutHoles=n,exports.asyncToGenerator=function(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var u=t.apply(r,n);function f(t){e(u,o,i,f,c,"next",t)}function c(t){e(u,o,i,f,c,"throw",t)}f(void 0)})}},exports.classCallCheck=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},exports.construct=function(t,r,n){if(u())return Reflect.construct.apply(null,arguments);var e=[null];e.push.apply(e,r);var o=new(t.bind.apply(t,e));return n&&p(o,n.prototype),o},exports.createClass=function(t,r,n){return r&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},exports.createForOfIteratorHelper=function(t,r){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=d(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,f=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){f=!0,i=t},f:function(){try{u||null==n.return||n.return()}finally{if(f)throw i}}}},exports.defineProperty=i,exports.isNativeReflectConstruct=u,exports.iterableToArray=f,exports.iterableToArrayLimit=c,exports.nonIterableRest=a,exports.nonIterableSpread=l,exports.objectSpread2=function(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?s(Object(n),!0).forEach(function(r){i(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t},exports.regenerator=b,exports.regeneratorDefine=y,exports.regeneratorValues=function(t){if(null!=t){var r=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(typeof t+" is not iterable")},exports.setPrototypeOf=p,exports.slicedToArray=function(t,n){return r(t)||c(t,n)||d(t,n)||a()},exports.toConsumableArray=function(t){return n(t)||f(t)||d(t)||l()},exports.toPrimitive=v,exports.toPropertyKey=m,exports.unsupportedIterableToArray=d;
1
+ "use strict";function t(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=Array(r);n<r;n++)e[n]=t[n];return e}function r(t){if(Array.isArray(t))return t}function n(r){if(Array.isArray(r))return t(r)}function e(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t,r,n,e,o,u,i){try{var f=t[u](i),c=f.value}catch(t){return void n(t)}f.done?r(c):Promise.resolve(c).then(e,o)}function u(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,w(e.key),e)}}function i(t,r,n){return(r=w(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function f(){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,r,n){var e=x(t,r);if(e){var o=Object.getOwnPropertyDescriptor(e,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},f.apply(null,arguments)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(a=function(){return!!t})()}function l(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function s(t,r){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var e,o,u,i,f=[],c=!0,a=!1;try{if(u=(n=n.call(t)).next,0===r){if(Object(n)!==n)return;c=!1}else for(;!(c=(e=u.call(n)).done)&&(f.push(e.value),f.length!==r);c=!0);}catch(t){a=!0,o=t}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(a)throw o}}return f}}function b(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,e)}return n}function v(t,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return e(t)}function m(){var t,r,n="function"==typeof Symbol?Symbol:{},e=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function u(n,e,o,u){var c=e&&e.prototype instanceof f?e:f,a=Object.create(c.prototype);return d(a,"_invoke",function(n,e,o){var u,f,c,a=0,l=o||[],s=!1,b={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(r,n){return u=r,f=0,c=t,b.n=n,i}};function p(n,e){for(f=n,c=e,r=0;!s&&a&&!o&&r<l.length;r++){var o,u=l[r],p=b.p,y=u[2];n>3?(o=y===e)&&(c=u[(f=u[4])?5:(f=3,3)],u[4]=u[5]=t):u[0]<=p&&((o=n<2&&p<u[1])?(f=0,b.v=e,b.n=u[1]):p<y&&(o=n<3||u[0]>e||e>y)&&(u[4]=n,u[5]=e,b.n=y,f=0))}if(o||n>1)return i;throw s=!0,e}return function(o,l,y){if(a>1)throw TypeError("Generator is already running");for(s&&1===l&&p(l,y),f=l,c=y;(r=f<2?t:c)||!s;){u||(f?f<3?(f>1&&(b.n=-1),p(f,c)):b.n=c:b.v=c);try{if(a=2,u){if(f||(o="next"),r=u[o]){if(!(r=r.call(u,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,f<2&&(f=0)}else 1===f&&(r=u.return)&&r.call(u),f<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),f=1);u=t}else if((r=(s=b.n<0)?c:n.call(e,b))!==i)break}catch(r){u=t,f=1,c=r}finally{a=1}}return{value:r,done:s}}}(n,o,u),!0),a}var i={};function f(){}function c(){}function a(){}r=Object.getPrototypeOf;var l=[][e]?r(r([][e]())):(d(r={},e,function(){return this}),r),s=a.prototype=f.prototype=Object.create(l);function b(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,d(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return c.prototype=a,d(s,"constructor",a),d(a,"constructor",c),c.displayName="GeneratorFunction",d(a,o,"GeneratorFunction"),d(s),d(s,o,"Generator"),d(s,e,function(){return this}),d(s,"toString",function(){return"[object Generator]"}),(m=function(){return{w:u,m:b}})()}function d(t,r,n,e){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}d=function(t,r,n,e){if(r)o?o(t,r,{value:n,enumerable:!e,configurable:!e,writable:!e}):t[r]=n;else{function u(r,n){d(t,r,function(t){return this.t(r,n,t)})}u("next",0),u("throw",1),u("return",2)}},d(t,r,n,e)}function j(t,r){return j=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},j(t,r)}function x(t,r){for(;!{}.hasOwnProperty.call(t,r)&&null!==(t=c(t)););return t}function h(t,r){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,r||"default");if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function w(t){var r=h(t,"string");return"symbol"==typeof r?r:r+""}function O(t){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(t)}function S(r,n){if(r){if("string"==typeof r)return t(r,n);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?t(r,n):void 0}}Object.defineProperty(exports,"o",{value:!0}),exports.arrayLikeToArray=t,exports.arrayWithHoles=r,exports.arrayWithoutHoles=n,exports.assertThisInitialized=e,exports.asyncToGenerator=function(t){return function(){var r=this,n=arguments;return new Promise(function(e,u){var i=t.apply(r,n);function f(t){o(i,e,u,f,c,"next",t)}function c(t){o(i,e,u,f,c,"throw",t)}f(void 0)})}},exports.callSuper=function(t,r,n){return r=c(r),v(t,a()?Reflect.construct(r,n||[],c(t).constructor):r.apply(t,n))},exports.classCallCheck=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},exports.construct=function(t,r,n){if(a())return Reflect.construct.apply(null,arguments);var e=[null];e.push.apply(e,r);var o=new(t.bind.apply(t,e));return n&&j(o,n.prototype),o},exports.createClass=function(t,r,n){return r&&u(t.prototype,r),n&&u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},exports.createForOfIteratorHelper=function(t,r){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=S(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,i=!0,f=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){f=!0,u=t},f:function(){try{i||null==n.return||n.return()}finally{if(f)throw u}}}},exports.defineProperty=i,exports.get=f,exports.getPrototypeOf=c,exports.inherits=function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&j(t,r)},exports.isNativeReflectConstruct=a,exports.iterableToArray=l,exports.iterableToArrayLimit=s,exports.nonIterableRest=b,exports.nonIterableSpread=p,exports.objectSpread2=function(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?y(Object(n),!0).forEach(function(r){i(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t},exports.possibleConstructorReturn=v,exports.regenerator=m,exports.regeneratorDefine=d,exports.regeneratorValues=function(t){if(null!=t){var r=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(typeof t+" is not iterable")},exports.setPrototypeOf=j,exports.slicedToArray=function(t,n){return r(t)||s(t,n)||S(t,n)||b()},exports.superPropBase=x,exports.superPropGet=function(t,r,n,e){var o=f(c(1&e?t.prototype:t),r,n);return 2&e&&"function"==typeof o?function(t){return o.apply(n,t)}:o},exports.toConsumableArray=function(t){return n(t)||l(t)||S(t)||p()},exports.toPrimitive=h,exports.toPropertyKey=w,exports.typeof=O,exports.unsupportedIterableToArray=S;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("three");const n={type:"change"},e={type:"start"},i={type:"end"};class s extends t.EventDispatcher{constructor(s,c){super(),this.object=s,this.domElement=c,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new t.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:t.MOUSE.ROTATE,MIDDLE:t.MOUSE.DOLLY,RIGHT:t.MOUSE.PAN},this.touches={ONE:t.TOUCH.ROTATE,TWO:t.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.i=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",K),this.i=t},this.stopListenToKeyEvents=function(){this.i.removeEventListener("keydown",K),this.i=null},this.saveState=function(){o.target0.copy(o.target),o.position0.copy(o.object.position),o.zoom0=o.object.zoom},this.reset=function(){o.target.copy(o.target0),o.object.position.copy(o.position0),o.object.zoom=o.zoom0,o.object.updateProjectionMatrix(),o.dispatchEvent(n),o.update(),h=r.NONE},this.update=function(){const e=new t.Vector3,i=(new t.Quaternion).setFromUnitVectors(s.up,new t.Vector3(0,1,0)),c=i.clone().invert(),k=new t.Vector3,p=new t.Quaternion,b=2*Math.PI;return function(){const t=o.object.position;e.copy(t).sub(o.target),e.applyQuaternion(i),a.setFromVector3(e),o.autoRotate&&h===r.NONE&&y(2*Math.PI/60/60*o.autoRotateSpeed),o.enableDamping?(a.theta+=f.theta*o.dampingFactor,a.phi+=f.phi*o.dampingFactor):(a.theta+=f.theta,a.phi+=f.phi);let s=o.minAzimuthAngle,d=o.maxAzimuthAngle;return isFinite(s)&&isFinite(d)&&(s<-Math.PI?s+=b:s>Math.PI&&(s-=b),d<-Math.PI?d+=b:d>Math.PI&&(d-=b),a.theta=s<=d?Math.max(s,Math.min(d,a.theta)):a.theta>(s+d)/2?Math.max(s,a.theta):Math.min(d,a.theta)),a.phi=Math.max(o.minPolarAngle,Math.min(o.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=w,a.radius=Math.max(o.minDistance,Math.min(o.maxDistance,a.radius)),!0===o.enableDamping?o.target.addScaledVector(l,o.dampingFactor):o.target.add(l),e.setFromSpherical(a),e.applyQuaternion(c),t.copy(o.target).add(e),o.object.lookAt(o.target),!0===o.enableDamping?(f.theta*=1-o.dampingFactor,f.phi*=1-o.dampingFactor,l.multiplyScalar(1-o.dampingFactor)):(f.set(0,0,0),l.set(0,0,0)),w=1,!!(M||k.distanceToSquared(o.object.position)>u||8*(1-p.dot(o.object.quaternion))>u)&&(o.dispatchEvent(n),k.copy(o.object.position),p.copy(o.object.quaternion),M=!1,!0)}}(),this.dispose=function(){o.domElement.removeEventListener("contextmenu",Q),o.domElement.removeEventListener("pointerdown",q),o.domElement.removeEventListener("pointercancel",z),o.domElement.removeEventListener("wheel",J),o.domElement.removeEventListener("pointermove",B),o.domElement.removeEventListener("pointerup",W),null!==o.i&&(o.i.removeEventListener("keydown",K),o.i=null)};const o=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=r.NONE;const u=1e-6,a=new t.Spherical,f=new t.Spherical;let w=1;const l=new t.Vector3;let M=!1;const k=new t.Vector2,p=new t.Vector2,b=new t.Vector2,d=new t.Vector2,T=new t.Vector2,O=new t.Vector2,A=new t.Vector2,L=new t.Vector2,v=new t.Vector2,E=[],_={};function x(){return Math.pow(.95,o.zoomSpeed)}function y(t){f.theta-=t}function D(t){f.phi-=t}const H=function(){const n=new t.Vector3;return function(t,e){n.setFromMatrixColumn(e,0),n.multiplyScalar(-t),l.add(n)}}(),N=function(){const n=new t.Vector3;return function(t,e){!0===o.screenSpacePanning?n.setFromMatrixColumn(e,1):(n.setFromMatrixColumn(e,0),n.crossVectors(o.object.up,n)),n.multiplyScalar(t),l.add(n)}}(),R=function(){const n=new t.Vector3;return function(t,e){const i=o.domElement;if(o.object.isPerspectiveCamera){const s=o.object.position;n.copy(s).sub(o.target);let c=n.length();c*=Math.tan(o.object.fov/2*Math.PI/180),H(2*t*c/i.clientHeight,o.object.matrix),N(2*e*c/i.clientHeight,o.object.matrix)}else o.object.isOrthographicCamera?(H(t*(o.object.right-o.object.left)/o.object.zoom/i.clientWidth,o.object.matrix),N(e*(o.object.top-o.object.bottom)/o.object.zoom/i.clientHeight,o.object.matrix)):o.enablePan=!1}}();function U(t){o.object.isPerspectiveCamera?w/=t:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom*t)),o.object.updateProjectionMatrix(),M=!0):o.enableZoom=!1}function m(t){o.object.isPerspectiveCamera?w*=t:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom/t)),o.object.updateProjectionMatrix(),M=!0):o.enableZoom=!1}function C(t){k.set(t.clientX,t.clientY)}function F(t){d.set(t.clientX,t.clientY)}function P(){if(1===E.length)k.set(E[0].pageX,E[0].pageY);else{const t=.5*(E[0].pageX+E[1].pageX),n=.5*(E[0].pageY+E[1].pageY);k.set(t,n)}}function I(){if(1===E.length)d.set(E[0].pageX,E[0].pageY);else{const t=.5*(E[0].pageX+E[1].pageX),n=.5*(E[0].pageY+E[1].pageY);d.set(t,n)}}function Y(){const t=E[0].pageX-E[1].pageX,n=E[0].pageY-E[1].pageY,e=Math.sqrt(t*t+n*n);A.set(0,e)}function g(t){if(1==E.length)p.set(t.pageX,t.pageY);else{const n=X(t),e=.5*(t.pageX+n.x),i=.5*(t.pageY+n.y);p.set(e,i)}b.subVectors(p,k).multiplyScalar(o.rotateSpeed);const n=o.domElement;y(2*Math.PI*b.x/n.clientHeight),D(2*Math.PI*b.y/n.clientHeight),k.copy(p)}function G(t){if(1===E.length)T.set(t.pageX,t.pageY);else{const n=X(t),e=.5*(t.pageX+n.x),i=.5*(t.pageY+n.y);T.set(e,i)}O.subVectors(T,d).multiplyScalar(o.panSpeed),R(O.x,O.y),d.copy(T)}function j(t){const n=X(t),e=t.pageX-n.x,i=t.pageY-n.y,s=Math.sqrt(e*e+i*i);L.set(0,s),v.set(0,Math.pow(L.y/A.y,o.zoomSpeed)),U(v.y),A.copy(L)}function q(n){!1!==o.enabled&&(0===E.length&&(o.domElement.setPointerCapture(n.pointerId),o.domElement.addEventListener("pointermove",B),o.domElement.addEventListener("pointerup",W)),function(t){E.push(t)}(n),"touch"===n.pointerType?function(n){switch(V(n),E.length){case 1:switch(o.touches.ONE){case t.TOUCH.ROTATE:if(!1===o.enableRotate)return;P(),h=r.TOUCH_ROTATE;break;case t.TOUCH.PAN:if(!1===o.enablePan)return;I(),h=r.TOUCH_PAN;break;default:h=r.NONE}break;case 2:switch(o.touches.TWO){case t.TOUCH.DOLLY_PAN:if(!1===o.enableZoom&&!1===o.enablePan)return;o.enableZoom&&Y(),o.enablePan&&I(),h=r.TOUCH_DOLLY_PAN;break;case t.TOUCH.DOLLY_ROTATE:if(!1===o.enableZoom&&!1===o.enableRotate)return;o.enableZoom&&Y(),o.enableRotate&&P(),h=r.TOUCH_DOLLY_ROTATE;break;default:h=r.NONE}break;default:h=r.NONE}h!==r.NONE&&o.dispatchEvent(e)}(n):function(n){let i;switch(n.button){case 0:i=o.mouseButtons.LEFT;break;case 1:i=o.mouseButtons.MIDDLE;break;case 2:i=o.mouseButtons.RIGHT;break;default:i=-1}switch(i){case t.MOUSE.DOLLY:if(!1===o.enableZoom)return;!function(t){A.set(t.clientX,t.clientY)}(n),h=r.DOLLY;break;case t.MOUSE.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(!1===o.enablePan)return;F(n),h=r.PAN}else{if(!1===o.enableRotate)return;C(n),h=r.ROTATE}break;case t.MOUSE.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(!1===o.enableRotate)return;C(n),h=r.ROTATE}else{if(!1===o.enablePan)return;F(n),h=r.PAN}break;default:h=r.NONE}h!==r.NONE&&o.dispatchEvent(e)}(n))}function B(t){!1!==o.enabled&&("touch"===t.pointerType?function(t){switch(V(t),h){case r.TOUCH_ROTATE:if(!1===o.enableRotate)return;g(t),o.update();break;case r.TOUCH_PAN:if(!1===o.enablePan)return;G(t),o.update();break;case r.TOUCH_DOLLY_PAN:if(!1===o.enableZoom&&!1===o.enablePan)return;!function(t){o.enableZoom&&j(t),o.enablePan&&G(t)}(t),o.update();break;case r.TOUCH_DOLLY_ROTATE:if(!1===o.enableZoom&&!1===o.enableRotate)return;!function(t){o.enableZoom&&j(t),o.enableRotate&&g(t)}(t),o.update();break;default:h=r.NONE}}(t):function(t){switch(h){case r.ROTATE:if(!1===o.enableRotate)return;!function(t){p.set(t.clientX,t.clientY),b.subVectors(p,k).multiplyScalar(o.rotateSpeed);const n=o.domElement;y(2*Math.PI*b.x/n.clientHeight),D(2*Math.PI*b.y/n.clientHeight),k.copy(p),o.update()}(t);break;case r.DOLLY:if(!1===o.enableZoom)return;!function(t){L.set(t.clientX,t.clientY),v.subVectors(L,A),v.y>0?U(x()):v.y<0&&m(x()),A.copy(L),o.update()}(t);break;case r.PAN:if(!1===o.enablePan)return;!function(t){T.set(t.clientX,t.clientY),O.subVectors(T,d).multiplyScalar(o.panSpeed),R(O.x,O.y),d.copy(T),o.update()}(t)}}(t))}function W(t){S(t),0===E.length&&(o.domElement.releasePointerCapture(t.pointerId),o.domElement.removeEventListener("pointermove",B),o.domElement.removeEventListener("pointerup",W)),o.dispatchEvent(i),h=r.NONE}function z(t){S(t)}function J(t){!1!==o.enabled&&!1!==o.enableZoom&&h===r.NONE&&(t.preventDefault(),o.dispatchEvent(e),function(t){t.deltaY<0?m(x()):t.deltaY>0&&U(x()),o.update()}(t),o.dispatchEvent(i))}function K(t){!1!==o.enabled&&!1!==o.enablePan&&function(t){let n=!1;switch(t.code){case o.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?D(2*Math.PI*o.rotateSpeed/o.domElement.clientHeight):R(0,o.keyPanSpeed),n=!0;break;case o.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?D(-2*Math.PI*o.rotateSpeed/o.domElement.clientHeight):R(0,-o.keyPanSpeed),n=!0;break;case o.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?y(2*Math.PI*o.rotateSpeed/o.domElement.clientHeight):R(o.keyPanSpeed,0),n=!0;break;case o.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?y(-2*Math.PI*o.rotateSpeed/o.domElement.clientHeight):R(-o.keyPanSpeed,0),n=!0}n&&(t.preventDefault(),o.update())}(t)}function Q(t){!1!==o.enabled&&t.preventDefault()}function S(t){delete _[t.pointerId];for(let n=0;n<E.length;n++)if(E[n].pointerId==t.pointerId)return void E.splice(n,1)}function V(n){let e=_[n.pointerId];void 0===e&&(e=new t.Vector2,_[n.pointerId]=e),e.set(n.pageX,n.pageY)}function X(t){const n=t.pointerId===E[0].pointerId?E[1]:E[0];return _[n.pointerId]}o.domElement.addEventListener("contextmenu",Q),o.domElement.addEventListener("pointerdown",q),o.domElement.addEventListener("pointercancel",z),o.domElement.addEventListener("wheel",J,{passive:!1}),this.update()}}exports.MapControls=class extends s{constructor(n,e){super(n,e),this.screenSpacePanning=!1,this.mouseButtons.LEFT=t.MOUSE.PAN,this.mouseButtons.RIGHT=t.MOUSE.ROTATE,this.touches.ONE=t.TOUCH.PAN,this.touches.TWO=t.TOUCH.DOLLY_ROTATE}},exports.OrbitControls=s;
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("three");const s={type:"change"},i={type:"start"},h={type:"end"},e=new t.Ray,n=new t.Plane,a=Math.cos(70*t.MathUtils.DEG2RAD),o=new t.Vector3,r=2*Math.PI,c=-1,l=0,u=1,f=2,w=3,d=4,M=5,p=6,_=1e-6;class k extends t.Controls{constructor(s,i=null){super(s,i),this.state=c,this.target=new t.Vector3,this.cursor=new t.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:t.MOUSE.ROTATE,MIDDLE:t.MOUSE.DOLLY,RIGHT:t.MOUSE.PAN},this.touches={ONE:t.TOUCH.ROTATE,TWO:t.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.i=null,this.h=new t.Vector3,this.o=new t.Quaternion,this.l=new t.Vector3,this.u=(new t.Quaternion).setFromUnitVectors(s.up,new t.Vector3(0,1,0)),this.M=this.u.clone().invert(),this.p=new t.Spherical,this._=new t.Spherical,this.k=1,this.v=new t.Vector3,this.T=new t.Vector2,this.D=new t.Vector2,this.P=new t.Vector2,this.m=new t.Vector2,this.R=new t.Vector2,this.A=new t.Vector2,this.S=new t.Vector2,this.L=new t.Vector2,this.O=new t.Vector2,this.I=new t.Vector3,this.F=new t.Vector2,this.U=!1,this.K=[],this.W={},this.Y=!1,this.C=v.bind(this),this.G=b.bind(this),this.H=y.bind(this),this.X=A.bind(this),this.Z=P.bind(this),this.j=g.bind(this),this.q=m.bind(this),this.B=R.bind(this),this.N=T.bind(this),this.J=D.bind(this),this.V=S.bind(this),this.$=E.bind(this),null!==this.domElement&&this.connect(this.domElement),this.update()}connect(t){super.connect(t),this.domElement.addEventListener("pointerdown",this.G),this.domElement.addEventListener("pointercancel",this.H),this.domElement.addEventListener("contextmenu",this.X),this.domElement.addEventListener("wheel",this.Z,{passive:!1});this.domElement.getRootNode().addEventListener("keydown",this.V,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this.G),this.domElement.removeEventListener("pointermove",this.C),this.domElement.removeEventListener("pointerup",this.H),this.domElement.removeEventListener("pointercancel",this.H),this.domElement.removeEventListener("wheel",this.Z),this.domElement.removeEventListener("contextmenu",this.X),this.stopListenToKeyEvents();this.domElement.getRootNode().removeEventListener("keydown",this.V,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this.p.phi}getAzimuthalAngle(){return this.p.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(t){t.addEventListener("keydown",this.j),this.i=t}stopListenToKeyEvents(){null!==this.i&&(this.i.removeEventListener("keydown",this.j),this.i=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(s),this.update(),this.state=c}update(i=null){const h=this.object.position;o.copy(h).sub(this.target),o.applyQuaternion(this.u),this.p.setFromVector3(o),this.autoRotate&&this.state===c&&this.tt(this.st(i)),this.enableDamping?(this.p.theta+=this._.theta*this.dampingFactor,this.p.phi+=this._.phi*this.dampingFactor):(this.p.theta+=this._.theta,this.p.phi+=this._.phi);let l=this.minAzimuthAngle,u=this.maxAzimuthAngle;isFinite(l)&&isFinite(u)&&(l<-Math.PI?l+=r:l>Math.PI&&(l-=r),u<-Math.PI?u+=r:u>Math.PI&&(u-=r),this.p.theta=l<=u?Math.max(l,Math.min(u,this.p.theta)):this.p.theta>(l+u)/2?Math.max(l,this.p.theta):Math.min(u,this.p.theta)),this.p.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.p.phi)),this.p.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this.v,this.dampingFactor):this.target.add(this.v),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let f=!1;if(this.zoomToCursor&&this.U||this.object.isOrthographicCamera)this.p.radius=this.it(this.p.radius);else{const t=this.p.radius;this.p.radius=this.it(this.p.radius*this.k),f=t!=this.p.radius}if(o.setFromSpherical(this.p),o.applyQuaternion(this.M),h.copy(this.target).add(o),this.object.lookAt(this.target),!0===this.enableDamping?(this._.theta*=1-this.dampingFactor,this._.phi*=1-this.dampingFactor,this.v.multiplyScalar(1-this.dampingFactor)):(this._.set(0,0,0),this.v.set(0,0,0)),this.zoomToCursor&&this.U){let s=null;if(this.object.isPerspectiveCamera){const t=o.length();s=this.it(t*this.k);const i=t-s;this.object.position.addScaledVector(this.I,i),this.object.updateMatrixWorld(),f=!!i}else if(this.object.isOrthographicCamera){const i=new t.Vector3(this.F.x,this.F.y,0);i.unproject(this.object);const h=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this.k)),this.object.updateProjectionMatrix(),f=h!==this.object.zoom;const e=new t.Vector3(this.F.x,this.F.y,0);e.unproject(this.object),this.object.position.sub(e).add(i),this.object.updateMatrixWorld(),s=o.length()}else this.zoomToCursor=!1;null!==s&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position):(e.origin.copy(this.object.position),e.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(e.direction))<a?this.object.lookAt(this.target):(n.setFromNormalAndCoplanarPoint(this.object.up,this.target),e.intersectPlane(n,this.target))))}else if(this.object.isOrthographicCamera){const t=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this.k)),t!==this.object.zoom&&(this.object.updateProjectionMatrix(),f=!0)}return this.k=1,this.U=!1,!!(f||this.h.distanceToSquared(this.object.position)>_||8*(1-this.o.dot(this.object.quaternion))>_||this.l.distanceToSquared(this.target)>_)&&(this.dispatchEvent(s),this.h.copy(this.object.position),this.o.copy(this.object.quaternion),this.l.copy(this.target),!0)}st(t){return null!==t?r/60*this.autoRotateSpeed*t:r/60/60*this.autoRotateSpeed}ht(t){const s=Math.abs(.01*t);return Math.pow(.95,this.zoomSpeed*s)}tt(t){this._.theta-=t}et(t){this._.phi-=t}nt(t,s){o.setFromMatrixColumn(s,0),o.multiplyScalar(-t),this.v.add(o)}ot(t,s){!0===this.screenSpacePanning?o.setFromMatrixColumn(s,1):(o.setFromMatrixColumn(s,0),o.crossVectors(this.object.up,o)),o.multiplyScalar(t),this.v.add(o)}rt(t,s){const i=this.domElement;if(this.object.isPerspectiveCamera){const h=this.object.position;o.copy(h).sub(this.target);let e=o.length();e*=Math.tan(this.object.fov/2*Math.PI/180),this.nt(2*t*e/i.clientHeight,this.object.matrix),this.ot(2*s*e/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this.nt(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this.ot(s*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):this.enablePan=!1}ct(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this.k/=t:this.enableZoom=!1}lt(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this.k*=t:this.enableZoom=!1}ut(t,s){if(!this.zoomToCursor)return;this.U=!0;const i=this.domElement.getBoundingClientRect(),h=t-i.left,e=s-i.top,n=i.width,a=i.height;this.F.x=h/n*2-1,this.F.y=-e/a*2+1,this.I.set(this.F.x,this.F.y,1).unproject(this.object).sub(this.object.position).normalize()}it(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}ft(t){this.T.set(t.clientX,t.clientY)}wt(t){this.ut(t.clientX,t.clientX),this.S.set(t.clientX,t.clientY)}dt(t){this.m.set(t.clientX,t.clientY)}Mt(t){this.D.set(t.clientX,t.clientY),this.P.subVectors(this.D,this.T).multiplyScalar(this.rotateSpeed);const s=this.domElement;this.tt(r*this.P.x/s.clientHeight),this.et(r*this.P.y/s.clientHeight),this.T.copy(this.D),this.update()}_t(t){this.L.set(t.clientX,t.clientY),this.O.subVectors(this.L,this.S),this.O.y>0?this.ct(this.ht(this.O.y)):this.O.y<0&&this.lt(this.ht(this.O.y)),this.S.copy(this.L),this.update()}kt(t){this.R.set(t.clientX,t.clientY),this.A.subVectors(this.R,this.m).multiplyScalar(this.panSpeed),this.rt(this.A.x,this.A.y),this.m.copy(this.R),this.update()}bt(t){this.ut(t.clientX,t.clientY),t.deltaY<0?this.lt(this.ht(t.deltaY)):t.deltaY>0&&this.ct(this.ht(t.deltaY)),this.update()}vt(t){let s=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this.et(r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this.rt(0,this.keyPanSpeed),s=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this.et(-r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this.rt(0,-this.keyPanSpeed),s=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this.tt(r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this.rt(this.keyPanSpeed,0),s=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this.tt(-r*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this.rt(-this.keyPanSpeed,0),s=!0}s&&(t.preventDefault(),this.update())}yt(t){if(1===this.K.length)this.T.set(t.pageX,t.pageY);else{const s=this.Tt(t),i=.5*(t.pageX+s.x),h=.5*(t.pageY+s.y);this.T.set(i,h)}}Dt(t){if(1===this.K.length)this.m.set(t.pageX,t.pageY);else{const s=this.Tt(t),i=.5*(t.pageX+s.x),h=.5*(t.pageY+s.y);this.m.set(i,h)}}Pt(t){const s=this.Tt(t),i=t.pageX-s.x,h=t.pageY-s.y,e=Math.sqrt(i*i+h*h);this.S.set(0,e)}gt(t){this.enableZoom&&this.Pt(t),this.enablePan&&this.Dt(t)}Rt(t){this.enableZoom&&this.Pt(t),this.enableRotate&&this.yt(t)}At(t){if(1==this.K.length)this.D.set(t.pageX,t.pageY);else{const s=this.Tt(t),i=.5*(t.pageX+s.x),h=.5*(t.pageY+s.y);this.D.set(i,h)}this.P.subVectors(this.D,this.T).multiplyScalar(this.rotateSpeed);const s=this.domElement;this.tt(r*this.P.x/s.clientHeight),this.et(r*this.P.y/s.clientHeight),this.T.copy(this.D)}St(t){if(1===this.K.length)this.R.set(t.pageX,t.pageY);else{const s=this.Tt(t),i=.5*(t.pageX+s.x),h=.5*(t.pageY+s.y);this.R.set(i,h)}this.A.subVectors(this.R,this.m).multiplyScalar(this.panSpeed),this.rt(this.A.x,this.A.y),this.m.copy(this.R)}Et(t){const s=this.Tt(t),i=t.pageX-s.x,h=t.pageY-s.y,e=Math.sqrt(i*i+h*h);this.L.set(0,e),this.O.set(0,Math.pow(this.L.y/this.S.y,this.zoomSpeed)),this.ct(this.O.y),this.S.copy(this.L);const n=.5*(t.pageX+s.x),a=.5*(t.pageY+s.y);this.ut(n,a)}Lt(t){this.enableZoom&&this.Et(t),this.enablePan&&this.St(t)}Ot(t){this.enableZoom&&this.Et(t),this.enableRotate&&this.At(t)}xt(t){this.K.push(t.pointerId)}It(t){delete this.W[t.pointerId];for(let s=0;s<this.K.length;s++)if(this.K[s]==t.pointerId)return void this.K.splice(s,1)}Ft(t){for(let s=0;s<this.K.length;s++)if(this.K[s]==t.pointerId)return!0;return!1}Ut(s){let i=this.W[s.pointerId];void 0===i&&(i=new t.Vector2,this.W[s.pointerId]=i),i.set(s.pageX,s.pageY)}Tt(t){const s=t.pointerId===this.K[0]?this.K[1]:this.K[0];return this.W[s]}Kt(t){const s=t.deltaMode,i={clientX:t.clientX,clientY:t.clientY,deltaY:t.deltaY};switch(s){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100}return t.ctrlKey&&!this.Y&&(i.deltaY*=10),i}}function b(t){!1!==this.enabled&&(0===this.K.length&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this.C),this.domElement.addEventListener("pointerup",this.H)),this.Ft(t)||(this.xt(t),"touch"===t.pointerType?this.q(t):this.N(t)))}function v(t){!1!==this.enabled&&("touch"===t.pointerType?this.B(t):this.J(t))}function y(t){switch(this.It(t),this.K.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this.C),this.domElement.removeEventListener("pointerup",this.H),this.dispatchEvent(h),this.state=c;break;case 1:const s=this.K[0],i=this.W[s];this.q({pointerId:s,pageX:i.x,pageY:i.y})}}function T(s){let h;switch(s.button){case 0:h=this.mouseButtons.LEFT;break;case 1:h=this.mouseButtons.MIDDLE;break;case 2:h=this.mouseButtons.RIGHT;break;default:h=-1}switch(h){case t.MOUSE.DOLLY:if(!1===this.enableZoom)return;this.wt(s),this.state=u;break;case t.MOUSE.ROTATE:if(s.ctrlKey||s.metaKey||s.shiftKey){if(!1===this.enablePan)return;this.dt(s),this.state=f}else{if(!1===this.enableRotate)return;this.ft(s),this.state=l}break;case t.MOUSE.PAN:if(s.ctrlKey||s.metaKey||s.shiftKey){if(!1===this.enableRotate)return;this.ft(s),this.state=l}else{if(!1===this.enablePan)return;this.dt(s),this.state=f}break;default:this.state=c}this.state!==c&&this.dispatchEvent(i)}function D(t){switch(this.state){case l:if(!1===this.enableRotate)return;this.Mt(t);break;case u:if(!1===this.enableZoom)return;this._t(t);break;case f:if(!1===this.enablePan)return;this.kt(t)}}function P(t){!1!==this.enabled&&!1!==this.enableZoom&&this.state===c&&(t.preventDefault(),this.dispatchEvent(i),this.bt(this.Kt(t)),this.dispatchEvent(h))}function g(t){!1!==this.enabled&&this.vt(t)}function m(s){switch(this.Ut(s),this.K.length){case 1:switch(this.touches.ONE){case t.TOUCH.ROTATE:if(!1===this.enableRotate)return;this.yt(s),this.state=w;break;case t.TOUCH.PAN:if(!1===this.enablePan)return;this.Dt(s),this.state=d;break;default:this.state=c}break;case 2:switch(this.touches.TWO){case t.TOUCH.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.gt(s),this.state=M;break;case t.TOUCH.DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.Rt(s),this.state=p;break;default:this.state=c}break;default:this.state=c}this.state!==c&&this.dispatchEvent(i)}function R(t){switch(this.Ut(t),this.state){case w:if(!1===this.enableRotate)return;this.At(t),this.update();break;case d:if(!1===this.enablePan)return;this.St(t),this.update();break;case M:if(!1===this.enableZoom&&!1===this.enablePan)return;this.Lt(t),this.update();break;case p:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.Ot(t),this.update();break;default:this.state=c}}function A(t){!1!==this.enabled&&t.preventDefault()}function S(t){if("Control"===t.key){this.Y=!0;this.domElement.getRootNode().addEventListener("keyup",this.$,{passive:!0,capture:!0})}}function E(t){if("Control"===t.key){this.Y=!1;this.domElement.getRootNode().removeEventListener("keyup",this.$,{passive:!0,capture:!0})}}exports.OrbitControls=k;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("three");const e={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 n{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register(function(t){return new F(t)}),this.register(function(t){return new z(t)}),this.register(function(t){return new k(t)}),this.register(function(t){return new D(t)}),this.register(function(t){return new G(t)}),this.register(function(t){return new V(t)}),this.register(function(t){return new U(t)}),this.register(function(t){return new B(t)}),this.register(function(t){return new K(t)}),this.register(function(t){return new j(t)}),this.register(function(t){return new P(t)}),this.register(function(t){return new X(t)}),this.register(function(t){return new q(t)}),this.register(function(t){return new J(t)})}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}setTextureUtils(t){return this.textureUtils=t,this}parse(t,e,n,s){const i=new S,r=[];for(let t=0,e=this.pluginCallbacks.length;t<e;t++)r.push(this.pluginCallbacks[t](i));i.setPlugins(r),i.setTextureUtils(this.textureUtils),i.writeAsync(t,e,s).catch(n)}parseAsync(t,e){const n=this;return new Promise(function(s,i){n.parse(t,s,i,e)})}}const s=0,i=1,r=2,o=3,a=4,c=5120,h=5121,u=5122,l=5123,f=5124,w=5125,d=5126,y=34962,m=34963,p=9728,A=9729,T=9984,x=9985,g=9986,b=9987,E=33071,M=33648,_=10497,v="KHR_mesh_quantization",O={};O[t.NearestFilter]=p,O[t.NearestMipmapNearestFilter]=T,O[t.NearestMipmapLinearFilter]=g,O[t.LinearFilter]=A,O[t.LinearMipmapNearestFilter]=x,O[t.LinearMipmapLinearFilter]=b,O[t.ClampToEdgeWrapping]=E,O[t.RepeatWrapping]=_,O[t.MirroredRepeatWrapping]=M;const C={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},R=new t.Color;function I(t,e){return t.length===e.length&&t.every(function(t,n){return t===e[n]})}function N(t){return 4*Math.ceil(t/4)}function H(t,e=0){const n=N(t.byteLength);if(n!==t.byteLength){const s=new Uint8Array(n);if(s.set(new Uint8Array(t)),0!==e)for(let i=t.byteLength;i<n;i++)s[i]=e;return s.buffer}return t}function L(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}class S{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 r"+t.REVISION}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.textureUtils=null}setPlugins(t){this.plugins=t}setTextureUtils(t){this.textureUtils=t}async writeAsync(t,e,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(t),await Promise.all(this.pending);const s=this,i=s.buffers,r=s.json;n=s.options;const o=s.extensionsUsed,a=s.extensionsRequired,c=new Blob(i,{type:"application/octet-stream"}),h=Object.keys(o),u=Object.keys(a);if(h.length>0&&(r.extensionsUsed=h),u.length>0&&(r.extensionsRequired=u),r.buffers&&r.buffers.length>0&&(r.buffers[0].byteLength=c.size),!0===n.binary){const t=new FileReader;t.readAsArrayBuffer(c),t.onloadend=function(){const n=H(t.result),s=new DataView(new ArrayBuffer(8));s.setUint32(0,n.byteLength,!0),s.setUint32(4,5130562,!0);const i=H((o=JSON.stringify(r),(new TextEncoder).encode(o).buffer),32);var o;const a=new DataView(new ArrayBuffer(8));a.setUint32(0,i.byteLength,!0),a.setUint32(4,1313821514,!0);const c=new ArrayBuffer(12),h=new DataView(c);h.setUint32(0,1179937895,!0),h.setUint32(4,2,!0);const u=12+a.byteLength+i.byteLength+s.byteLength+n.byteLength;h.setUint32(8,u,!0);const l=new Blob([c,a,i,s,n],{type:"application/octet-stream"}),f=new FileReader;f.readAsArrayBuffer(l),f.onloadend=function(){e(f.result)}}}else if(r.buffers&&r.buffers.length>0){const t=new FileReader;t.readAsDataURL(c),t.onloadend=function(){const n=t.result;r.buffers[0].uri=n,e(r)}}else e(r)}serializeUserData(t,e){if(0===Object.keys(t.userData).length)return;const n=this.options,s=this.extensionsUsed;try{const i=JSON.parse(JSON.stringify(t.userData));if(n.includeCustomExtensions&&i.gltfExtensions){void 0===e.extensions&&(e.extensions={});for(const t in i.gltfExtensions)e.extensions[t]=i.gltfExtensions[t],s[t]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(e.extras=i)}catch(t){}}getUID(t,e=!1){if(!1===this.uids.has(t)){const e=new Map;e.set(!0,this.uid++),e.set(!1,this.uid++),this.uids.set(t,e)}return this.uids.get(t).get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new t.Vector3;for(let t=0,s=e.count;t<s;t++)if(Math.abs(n.fromBufferAttribute(e,t).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const n=this.cache;if(n.attributesNormalized.has(e))return n.attributesNormalized.get(e);const s=e.clone(),i=new t.Vector3;for(let t=0,e=s.count;t<e;t++)i.fromBufferAttribute(s,t),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),s.setXYZ(t,i.x,i.y,i.z);return n.attributesNormalized.set(e,s),s}applyTextureTransform(t,e){let n=!1;const s={};0===e.offset.x&&0===e.offset.y||(s.offset=e.offset.toArray(),n=!0),0!==e.rotation&&(s.rotation=e.rotation,n=!0),1===e.repeat.x&&1===e.repeat.y||(s.scale=e.repeat.toArray(),n=!0),n&&(t.extensions=t.extensions||{},t.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(e,n){if(e===n)return e;function s(e){return e.colorSpace===t.SRGBColorSpace?function(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}:function(t){return t}}e instanceof t.CompressedTexture&&(e=await this.decompressTextureAsync(e)),n instanceof t.CompressedTexture&&(n=await this.decompressTextureAsync(n));const i=e?e.image:null,r=n?n.image:null,o=Math.max(i?i.width:0,r?r.width:0),a=Math.max(i?i.height:0,r?r.height:0),c=L();c.width=o,c.height=a;const h=c.getContext("2d",{willReadFrequently:!0});h.fillStyle="#00ffff",h.fillRect(0,0,o,a);const u=h.getImageData(0,0,o,a);if(i){h.drawImage(i,0,0,o,a);const t=s(e),n=h.getImageData(0,0,o,a).data;for(let e=2;e<n.length;e+=4)u.data[e]=256*t(n[e]/256)}if(r){h.drawImage(r,0,0,o,a);const t=s(n),e=h.getImageData(0,0,o,a).data;for(let n=1;n<e.length;n+=4)u.data[n]=256*t(e[n]/256)}h.putImageData(u,0,0);const l=(e||n).clone();return l.source=new t.Source(c),l.colorSpace=t.NoColorSpace,l.channel=(e||n).channel,e&&n&&(e.channel,n.channel),l}async decompressTextureAsync(t,e=1/0){if(null===this.textureUtils)throw new Error("THREE.GLTFExporter: setTextureUtils() must be called to process compressed textures.");return await this.textureUtils.decompress(t,e)}processBuffer(t){const e=this.json,n=this.buffers;return e.buffers||(e.buffers=[{byteLength:0}]),n.push(t),0}processBufferView(e,n,s,i,r){const o=this.json;let a;switch(o.bufferViews||(o.bufferViews=[]),n){case c:case h:a=1;break;case u:case l:a=2;break;default:a=4}let m=e.itemSize*a;r===y&&(m=4*Math.ceil(m/4));const p=N(i*m),A=new DataView(new ArrayBuffer(p));let T=0;for(let r=s;r<s+i;r++){for(let s=0;s<e.itemSize;s++){let i;e.itemSize>4?i=e.array[r*e.itemSize+s]:(0===s?i=e.getX(r):1===s?i=e.getY(r):2===s?i=e.getZ(r):3===s&&(i=e.getW(r)),!0===e.normalized&&(i=t.MathUtils.normalize(i,e.array))),n===d?A.setFloat32(T,i,!0):n===f?A.setInt32(T,i,!0):n===w?A.setUint32(T,i,!0):n===u?A.setInt16(T,i,!0):n===l?A.setUint16(T,i,!0):n===c?A.setInt8(T,i):n===h&&A.setUint8(T,i),T+=a}T%m!==0&&(T+=m-T%m)}const x={buffer:this.processBuffer(A.buffer),byteOffset:this.byteOffset,byteLength:p};void 0!==r&&(x.target=r),r===y&&(x.byteStride=m),this.byteOffset+=p,o.bufferViews.push(x);return{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(t){const e=this,n=e.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(s){const i=new FileReader;i.readAsArrayBuffer(t),i.onloadend=function(){const t=H(i.result),r={buffer:e.processBuffer(t),byteOffset:e.byteOffset,byteLength:t.byteLength};e.byteOffset+=t.byteLength,s(n.bufferViews.push(r)-1)}})}processAccessor(e,n,s,i){const r=this.json;let o;if(e.array.constructor===Float32Array)o=d;else if(e.array.constructor===Int32Array)o=f;else if(e.array.constructor===Uint32Array)o=w;else if(e.array.constructor===Int16Array)o=u;else if(e.array.constructor===Uint16Array)o=l;else if(e.array.constructor===Int8Array)o=c;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);o=h}if(void 0===s&&(s=0),void 0!==i&&i!==1/0||(i=e.count),0===i)return null;const a=function(e,n,s){const i={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let r=n;r<n+s;r++)for(let n=0;n<e.itemSize;n++){let s;e.itemSize>4?s=e.array[r*e.itemSize+n]:(0===n?s=e.getX(r):1===n?s=e.getY(r):2===n?s=e.getZ(r):3===n&&(s=e.getW(r)),!0===e.normalized&&(s=t.MathUtils.normalize(s,e.array))),i.min[n]=Math.min(i.min[n],s),i.max[n]=Math.max(i.max[n],s)}return i}(e,s,i);let p;void 0!==n&&(p=e===n.index?m:y);const A=this.processBufferView(e,o,s,i,p),T={bufferView:A.id,byteOffset:A.byteOffset,componentType:o,count:i,max:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(T.normalized=!0),r.accessors||(r.accessors=[]),r.accessors.push(T)-1}processImage(e,n,s,i="image/png"){if(null!==e){const n=this,r=n.cache,o=n.json,a=n.options,c=n.pending;r.images.has(e)||r.images.set(e,{});const h=r.images.get(e),u=i+":flipY/"+s.toString();if(void 0!==h[u])return h[u];o.images||(o.images=[]);const l={mimeType:i},f=L();f.width=Math.min(e.width,a.maxTextureSize),f.height=Math.min(e.height,a.maxTextureSize);const w=f.getContext("2d",{willReadFrequently:!0});if(!0===s&&(w.translate(0,f.height),w.scale(1,-1)),void 0!==e.data){t.RGBAFormat,e.width>a.maxTextureSize||(e.height,a.maxTextureSize);const n=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<n.length;t+=4)n[t+0]=e.data[t+0],n[t+1]=e.data[t+1],n[t+2]=e.data[t+2],n[t+3]=e.data[t+3];w.putImageData(new ImageData(n,e.width,e.height),0,0)}else{if(!("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas))throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");w.drawImage(e,0,0,f.width,f.height)}!0===a.binary?c.push(function(t,e){if(void 0!==t.toBlob)return new Promise(n=>t.toBlob(n,e));let n;return"image/jpeg"===e?n=.92:"image/webp"===e&&(n=.8),t.convertToBlob({type:e,quality:n})}(f,i).then(t=>n.processBufferViewImage(t)).then(t=>{l.bufferView=t})):l.uri=t.ImageUtils.getDataURL(f,i);const d=o.images.push(l)-1;return h[u]=d,d}throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(t){const e=this.json;e.samplers||(e.samplers=[]);const n={magFilter:O[t.magFilter],minFilter:O[t.minFilter],wrapS:O[t.wrapS],wrapT:O[t.wrapT]};return e.samplers.push(n)-1}async processTextureAsync(e){const n=this.options,s=this.cache,i=this.json;if(s.textures.has(e))return s.textures.get(e);i.textures||(i.textures=[]),e instanceof t.CompressedTexture&&(e=await this.decompressTextureAsync(e,n.maxTextureSize));let r=e.userData.mimeType;"image/webp"===r&&(r="image/png");const o={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,r)};e.name&&(o.name=e.name),await this.i(async function(t){t.writeTexture&&await t.writeTexture(e,o)});const a=i.textures.push(o)-1;return s.textures.set(e,a),a}async processMaterialAsync(e){const n=this.cache,s=this.json;if(n.materials.has(e))return n.materials.get(e);if(e.isShaderMaterial)return null;s.materials||(s.materials=[]);const i={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&e.isMeshBasicMaterial;const r=e.color.toArray().concat([e.opacity]);if(I(r,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=r),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=0,i.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){const t=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),n={index:await this.processTextureAsync(t),texCoord:t.channel};this.applyTextureTransform(n,t),i.pbrMetallicRoughness.metallicRoughnessTexture=n}if(e.map){const t={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),i.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),i.emissiveTexture=t}}if(e.normalMap){const 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),i.normalTexture=t}if(e.aoMap){const t={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),i.occlusionTexture=t}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===t.DoubleSide&&(i.doubleSided=!0),""!==e.name&&(i.name=e.name),this.serializeUserData(e,i),await this.i(async function(t){t.writeMaterialAsync&&await t.writeMaterialAsync(e,i)});const o=s.materials.push(i)-1;return n.materials.set(e,o),o}async processMeshAsync(e){const c=this.cache,h=this.json,u=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,n=e.material.length;t<n;t++)u.push(e.material[t].uuid);else u.push(e.material.uuid);const l=u.join(":");if(c.meshes.has(l))return c.meshes.get(l);const f=e.geometry;let w;w=e.isLineSegments?i:e.isLineLoop?r:e.isLine?o:e.isPoints?s:e.material.wireframe?i:a;const d={},y={},m=[],p=[],A={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},T=f.getAttribute("normal");void 0===T||this.isNormalizedNormalAttribute(T)||f.setAttribute("normal",this.createNormalizedNormalAttribute(T));let x=null;for(let e in f.attributes){if("morph"===e.slice(0,5))continue;const s=f.attributes[e];e=A[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),c.attributes.has(this.getUID(s))){y[e]=c.attributes.get(this.getUID(s));continue}x=null;const i=s.array;"JOINTS_0"!==e||i instanceof Uint16Array||i instanceof Uint8Array?(i instanceof Uint32Array||i instanceof Int32Array)&&!e.startsWith("_")&&(x=n.Utils.toFloat32BufferAttribute(s)):x=new t.BufferAttribute(new Uint16Array(i),s.itemSize,s.normalized);const r=this.processAccessor(x||s,f);null!==r&&(e.startsWith("_")||this.detectMeshQuantization(e,s),y[e]=r,c.attributes.set(this.getUID(s),r))}if(void 0!==T&&f.setAttribute("normal",T),0===Object.keys(y).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const t=[],n=[],s={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)s[e.morphTargetDictionary[t]]=t;for(let i=0;i<e.morphTargetInfluences.length;++i){const r={};let o=!1;for(const t in f.morphAttributes){if("position"!==t&&"normal"!==t){o||(o=!0);continue}const e=f.morphAttributes[t][i],n=t.toUpperCase(),s=f.attributes[t];if(c.attributes.has(this.getUID(e,!0))){r[n]=c.attributes.get(this.getUID(e,!0));continue}const a=e.clone();if(!f.morphTargetsRelative)for(let t=0,n=e.count;t<n;t++)for(let n=0;n<e.itemSize;n++)0===n&&a.setX(t,e.getX(t)-s.getX(t)),1===n&&a.setY(t,e.getY(t)-s.getY(t)),2===n&&a.setZ(t,e.getZ(t)-s.getZ(t)),3===n&&a.setW(t,e.getW(t)-s.getW(t));r[n]=this.processAccessor(a,f),c.attributes.set(this.getUID(s,!0),r[n])}p.push(r),t.push(e.morphTargetInfluences[i]),void 0!==e.morphTargetDictionary&&n.push(s[i])}d.weights=t,n.length>0&&(d.extras={},d.extras.targetNames=n)}const g=Array.isArray(e.material);if(g&&0===f.groups.length)return null;let b=!1;if(g&&null===f.index){const t=[];for(let e=0,n=f.attributes.position.count;e<n;e++)t[e]=e;f.setIndex(t),b=!0}const E=g?e.material:[e.material],M=g?f.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let t=0,e=M.length;t<e;t++){const e={mode:w,attributes:y};if(this.serializeUserData(f,e),p.length>0&&(e.targets=p),null!==f.index){let n=this.getUID(f.index);void 0===M[t].start&&void 0===M[t].count||(n+=":"+M[t].start+":"+M[t].count),c.attributes.has(n)?e.indices=c.attributes.get(n):(e.indices=this.processAccessor(f.index,f,M[t].start,M[t].count),c.attributes.set(n,e.indices)),null===e.indices&&delete e.indices}const n=await this.processMaterialAsync(E[M[t].materialIndex]);null!==n&&(e.material=n),m.push(e)}!0===b&&f.setIndex(null),d.primitives=m,h.meshes||(h.meshes=[]),await this.i(function(t){t.writeMesh&&t.writeMesh(e,d)});const _=h.meshes.push(d)-1;return c.meshes.set(l,_),_}detectMeshQuantization(t,n){if(this.extensionsUsed[v])return;let s;switch(n.array.constructor){case Int8Array:s="byte";break;case Uint8Array:s="unsigned byte";break;case Int16Array:s="short";break;case Uint16Array:s="unsigned short";break;default:return}n.normalized&&(s+=" normalized");const i=t.split("_",1)[0];e[i]&&e[i].includes(s)&&(this.extensionsUsed[v]=!0,this.extensionsRequired[v]=!0)}processCamera(e){const n=this.json;n.cameras||(n.cameras=[]);const s=e.isOrthographicCamera,i={type:s?"orthographic":"perspective"};return s?i.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:t.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(i.name=e.type),n.cameras.push(i)-1}processAnimation(e,s){const i=this.json,r=this.nodeMap;i.animations||(i.animations=[]);const o=(e=n.Utils.mergeMorphTargetTracks(e.clone(),s)).tracks,a=[],c=[];for(let e=0;e<o.length;++e){const n=o[e],i=t.PropertyBinding.parseTrackName(n.name);let h=t.PropertyBinding.findNode(s,i.nodeName);const u=C[i.propertyName];if("bones"===i.objectName&&(h=!0===h.isSkinnedMesh?h.skeleton.getBoneByName(i.objectIndex):void 0),!h||!u)continue;const l=1;let f,w=n.values.length/n.times.length;u===C.morphTargetInfluences&&(w/=h.morphTargetInfluences.length),!0===n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(f="CUBICSPLINE",w/=3):f=n.getInterpolation()===t.InterpolateDiscrete?"STEP":"LINEAR",c.push({input:this.processAccessor(new t.BufferAttribute(n.times,l)),output:this.processAccessor(new t.BufferAttribute(n.values,w)),interpolation:f}),a.push({sampler:c.length-1,target:{node:r.get(h),path:u}})}return i.animations.push({name:e.name||"clip_"+i.animations.length,samplers:c,channels:a}),i.animations.length-1}processSkin(e){const n=this.json,s=this.nodeMap,i=n.nodes[s.get(e)],r=e.skeleton;if(void 0===r)return null;const o=e.skeleton.bones[0];if(void 0===o)return null;const a=[],c=new Float32Array(16*r.bones.length),h=new t.Matrix4;for(let t=0;t<r.bones.length;++t)a.push(s.get(r.bones[t])),h.copy(r.boneInverses[t]),h.multiply(e.bindMatrix).toArray(c,16*t);void 0===n.skins&&(n.skins=[]),n.skins.push({inverseBindMatrices:this.processAccessor(new t.BufferAttribute(c,16)),joints:a,skeleton:s.get(o)});return i.skin=n.skins.length-1}async processNodeAsync(t){const e=this.json,n=this.options,s=this.nodeMap;e.nodes||(e.nodes=[]);const i={};if(n.trs){const e=t.quaternion.toArray(),n=t.position.toArray(),s=t.scale.toArray();I(e,[0,0,0,1])||(i.rotation=e),I(n,[0,0,0])||(i.translation=n),I(s,[1,1,1])||(i.scale=s)}else t.matrixAutoUpdate&&t.updateMatrix(),!1===I(t.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(i.matrix=t.matrix.elements);if(""!==t.name&&(i.name=String(t.name)),this.serializeUserData(t,i),t.isMesh||t.isLine||t.isPoints){const e=await this.processMeshAsync(t);null!==e&&(i.mesh=e)}else t.isCamera&&(i.camera=this.processCamera(t));t.isSkinnedMesh&&this.skins.push(t);const r=e.nodes.push(i)-1;if(s.set(t,r),t.children.length>0){const e=[];for(let s=0,i=t.children.length;s<i;s++){const i=t.children[s];if(i.visible||!1===n.onlyVisible){const t=await this.processNodeAsync(i);null!==t&&e.push(t)}}e.length>0&&(i.children=e)}return await this.i(function(e){e.writeNode&&e.writeNode(t,i)}),r}async processSceneAsync(t){const e=this.json,n=this.options;e.scenes||(e.scenes=[],e.scene=0);const s={};""!==t.name&&(s.name=t.name),e.scenes.push(s);const i=[];for(let e=0,s=t.children.length;e<s;e++){const s=t.children[e];if(s.visible||!1===n.onlyVisible){const t=await this.processNodeAsync(s);null!==t&&i.push(t)}}i.length>0&&(s.nodes=i),this.serializeUserData(t,s)}async processObjectsAsync(e){const n=new t.Scene;n.name="AuxScene";for(let t=0;t<e.length;t++)n.children.push(e[t]);await this.processSceneAsync(n)}async processInputAsync(e){const n=this.options;e=e instanceof Array?e:[e],await this.i(function(t){t.beforeParse&&t.beforeParse(e)});const s=[];for(let n=0;n<e.length;n++)e[n]instanceof t.Scene?await this.processSceneAsync(e[n]):s.push(e[n]);s.length>0&&await this.processObjectsAsync(s);for(let t=0;t<this.skins.length;++t)this.processSkin(this.skins[t]);for(let t=0;t<n.animations.length;++t)this.processAnimation(n.animations[t],e[0]);await this.i(function(t){t.afterParse&&t.afterParse(e)})}async i(t){for(let e=0,n=this.plugins.length;e<n;e++)await t(this.plugins[e])}}class F{constructor(t){this.writer=t,this.name="KHR_lights_punctual"}writeNode(t,e){if(!t.isLight)return;if(!t.isDirectionalLight&&!t.isPointLight&&!t.isSpotLight)return;const n=this.writer,s=n.json,i=n.extensionsUsed,r={};t.name&&(r.name=t.name),r.color=t.color.toArray(),r.intensity=t.intensity,t.isDirectionalLight?r.type="directional":t.isPointLight?(r.type="point",t.distance>0&&(r.range=t.distance)):t.isSpotLight&&(r.type="spot",t.distance>0&&(r.range=t.distance),r.spot={},r.spot.innerConeAngle=(1-t.penumbra)*t.angle,r.spot.outerConeAngle=t.angle),void 0!==t.decay&&t.decay,t.target&&(t.target.parent!==t||0!==t.target.position.x||0!==t.target.position.y||t.target.position.z),i[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},i[this.name]=!0);const o=s.extensions[this.name].lights;o.push(r),e.extensions=e.extensions||{},e.extensions[this.name]={light:o.length-1}}}class z{constructor(t){this.writer=t,this.name="KHR_materials_unlit"}async writeMaterialAsync(t,e){if(!t.isMeshBasicMaterial)return;const n=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},n[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}}class U{constructor(t){this.writer=t,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.clearcoat)return;const n=this.writer,s=n.extensionsUsed,i={};if(i.clearcoatFactor=t.clearcoat,t.clearcoatMap){const e={index:await n.processTextureAsync(t.clearcoatMap),texCoord:t.clearcoatMap.channel};n.applyTextureTransform(e,t.clearcoatMap),i.clearcoatTexture=e}if(i.clearcoatRoughnessFactor=t.clearcoatRoughness,t.clearcoatRoughnessMap){const e={index:await n.processTextureAsync(t.clearcoatRoughnessMap),texCoord:t.clearcoatRoughnessMap.channel};n.applyTextureTransform(e,t.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=e}if(t.clearcoatNormalMap){const e={index:await n.processTextureAsync(t.clearcoatNormalMap),texCoord:t.clearcoatNormalMap.channel};1!==t.clearcoatNormalScale.x&&(e.scale=t.clearcoatNormalScale.x),n.applyTextureTransform(e,t.clearcoatNormalMap),i.clearcoatNormalTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=i,s[this.name]=!0}}class B{constructor(t){this.writer=t,this.name="KHR_materials_dispersion"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.dispersion)return;const n=this.writer.extensionsUsed,s={};s.dispersion=t.dispersion,e.extensions=e.extensions||{},e.extensions[this.name]=s,n[this.name]=!0}}class K{constructor(t){this.writer=t,this.name="KHR_materials_iridescence"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.iridescence)return;const n=this.writer,s=n.extensionsUsed,i={};if(i.iridescenceFactor=t.iridescence,t.iridescenceMap){const e={index:await n.processTextureAsync(t.iridescenceMap),texCoord:t.iridescenceMap.channel};n.applyTextureTransform(e,t.iridescenceMap),i.iridescenceTexture=e}if(i.iridescenceIor=t.iridescenceIOR,i.iridescenceThicknessMinimum=t.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=t.iridescenceThicknessRange[1],t.iridescenceThicknessMap){const e={index:await n.processTextureAsync(t.iridescenceThicknessMap),texCoord:t.iridescenceThicknessMap.channel};n.applyTextureTransform(e,t.iridescenceThicknessMap),i.iridescenceThicknessTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=i,s[this.name]=!0}}class k{constructor(t){this.writer=t,this.name="KHR_materials_transmission"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.transmission)return;const n=this.writer,s=n.extensionsUsed,i={};if(i.transmissionFactor=t.transmission,t.transmissionMap){const e={index:await n.processTextureAsync(t.transmissionMap),texCoord:t.transmissionMap.channel};n.applyTextureTransform(e,t.transmissionMap),i.transmissionTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=i,s[this.name]=!0}}class D{constructor(t){this.writer=t,this.name="KHR_materials_volume"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.transmission)return;const n=this.writer,s=n.extensionsUsed,i={};if(i.thicknessFactor=t.thickness,t.thicknessMap){const e={index:await n.processTextureAsync(t.thicknessMap),texCoord:t.thicknessMap.channel};n.applyTextureTransform(e,t.thicknessMap),i.thicknessTexture=e}t.attenuationDistance!==1/0&&(i.attenuationDistance=t.attenuationDistance),i.attenuationColor=t.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,s[this.name]=!0}}class G{constructor(t){this.writer=t,this.name="KHR_materials_ior"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||1.5===t.ior)return;const n=this.writer.extensionsUsed,s={};s.ior=t.ior,e.extensions=e.extensions||{},e.extensions[this.name]=s,n[this.name]=!0}}class V{constructor(t){this.writer=t,this.name="KHR_materials_specular"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||1===t.specularIntensity&&t.specularColor.equals(R)&&!t.specularIntensityMap&&!t.specularColorMap)return;const n=this.writer,s=n.extensionsUsed,i={};if(t.specularIntensityMap){const e={index:await n.processTextureAsync(t.specularIntensityMap),texCoord:t.specularIntensityMap.channel};n.applyTextureTransform(e,t.specularIntensityMap),i.specularTexture=e}if(t.specularColorMap){const e={index:await n.processTextureAsync(t.specularColorMap),texCoord:t.specularColorMap.channel};n.applyTextureTransform(e,t.specularColorMap),i.specularColorTexture=e}i.specularFactor=t.specularIntensity,i.specularColorFactor=t.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,s[this.name]=!0}}class j{constructor(t){this.writer=t,this.name="KHR_materials_sheen"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0==t.sheen)return;const n=this.writer,s=n.extensionsUsed,i={};if(t.sheenRoughnessMap){const e={index:await n.processTextureAsync(t.sheenRoughnessMap),texCoord:t.sheenRoughnessMap.channel};n.applyTextureTransform(e,t.sheenRoughnessMap),i.sheenRoughnessTexture=e}if(t.sheenColorMap){const e={index:await n.processTextureAsync(t.sheenColorMap),texCoord:t.sheenColorMap.channel};n.applyTextureTransform(e,t.sheenColorMap),i.sheenColorTexture=e}i.sheenRoughnessFactor=t.sheenRoughness,i.sheenColorFactor=t.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,s[this.name]=!0}}class P{constructor(t){this.writer=t,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0==t.anisotropy)return;const n=this.writer,s=n.extensionsUsed,i={};if(t.anisotropyMap){const e={index:await n.processTextureAsync(t.anisotropyMap)};n.applyTextureTransform(e,t.anisotropyMap),i.anisotropyTexture=e}i.anisotropyStrength=t.anisotropy,i.anisotropyRotation=t.anisotropyRotation,e.extensions=e.extensions||{},e.extensions[this.name]=i,s[this.name]=!0}}class X{constructor(t){this.writer=t,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(t,e){if(!t.isMeshStandardMaterial||1===t.emissiveIntensity)return;const n=this.writer.extensionsUsed,s={};s.emissiveStrength=t.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=s,n[this.name]=!0}}class q{constructor(t){this.writer=t,this.name="EXT_materials_bump"}async writeMaterialAsync(t,e){if(!t.isMeshStandardMaterial||1===t.bumpScale&&!t.bumpMap)return;const n=this.writer,s=n.extensionsUsed,i={};if(t.bumpMap){const e={index:await n.processTextureAsync(t.bumpMap),texCoord:t.bumpMap.channel};n.applyTextureTransform(e,t.bumpMap),i.bumpTexture=e}i.bumpFactor=t.bumpScale,e.extensions=e.extensions||{},e.extensions[this.name]=i,s[this.name]=!0}}class J{constructor(t){this.writer=t,this.name="EXT_mesh_gpu_instancing"}writeNode(e,n){if(!e.isInstancedMesh)return;const s=this.writer,i=e,r=new Float32Array(3*i.count),o=new Float32Array(4*i.count),a=new Float32Array(3*i.count),c=new t.Matrix4,h=new t.Vector3,u=new t.Quaternion,l=new t.Vector3;for(let t=0;t<i.count;t++)i.getMatrixAt(t,c),c.decompose(h,u,l),h.toArray(r,3*t),u.toArray(o,4*t),l.toArray(a,3*t);const f={TRANSLATION:s.processAccessor(new t.BufferAttribute(r,3)),ROTATION:s.processAccessor(new t.BufferAttribute(o,4)),SCALE:s.processAccessor(new t.BufferAttribute(a,3))};i.instanceColor&&(f.o=s.processAccessor(i.instanceColor)),n.extensions=n.extensions||{},n.extensions[this.name]={attributes:f},s.extensionsUsed[this.name]=!0,s.extensionsRequired[this.name]=!0}}n.Utils={insertKeyframe:function(t,e){const n=.001,s=t.getValueSize(),i=new t.TimeBufferType(t.times.length+1),r=new t.ValueBufferType(t.values.length+s),o=t.createInterpolant(new t.ValueBufferType(s));let a;if(0===t.times.length){i[0]=e;for(let t=0;t<s;t++)r[t]=0;a=0}else if(e<t.times[0]){if(Math.abs(t.times[0]-e)<n)return 0;i[0]=e,i.set(t.times,1),r.set(o.evaluate(e),0),r.set(t.values,s),a=0}else if(e>t.times[t.times.length-1]){if(Math.abs(t.times[t.times.length-1]-e)<n)return t.times.length-1;i[i.length-1]=e,i.set(t.times,0),r.set(t.values,0),r.set(o.evaluate(e),t.values.length),a=i.length-1}else for(let c=0;c<t.times.length;c++){if(Math.abs(t.times[c]-e)<n)return c;if(t.times[c]<e&&t.times[c+1]>e){i.set(t.times.slice(0,c+1),0),i[c+1]=e,i.set(t.times.slice(c+1),c+2),r.set(t.values.slice(0,(c+1)*s),0),r.set(o.evaluate(e),(c+1)*s),r.set(t.values.slice((c+1)*s),(c+2)*s),a=c+1;break}}return t.times=i,t.values=r,a},mergeMorphTargetTracks:function(e,n){const s=[],i={},r=e.tracks;for(let e=0;e<r.length;++e){let o=r[e];const a=t.PropertyBinding.parseTrackName(o.name),c=t.PropertyBinding.findNode(n,a.nodeName);if("morphTargetInfluences"!==a.propertyName||void 0===a.propertyIndex){s.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");o=o.clone(),o.setInterpolation(t.InterpolateLinear)}const h=c.morphTargetInfluences.length,u=c.morphTargetDictionary[a.propertyIndex];if(void 0===u)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let l;if(void 0===i[c.uuid]){l=o.clone();const t=new l.ValueBufferType(h*l.times.length);for(let e=0;e<l.times.length;e++)t[e*h+u]=l.values[e];l.name=(a.nodeName||"")+".morphTargetInfluences",l.values=t,i[c.uuid]=l,s.push(l);continue}const f=o.createInterpolant(new o.ValueBufferType(1));l=i[c.uuid];for(let t=0;t<l.times.length;t++)l.values[t*h+u]=f.evaluate(l.times[t]);for(let t=0;t<o.times.length;t++){const e=this.insertKeyframe(l,o.times[t]);l.values[e*h+u]=o.values[t]}}return e.tracks=s,e},toFloat32BufferAttribute:function(e){const n=new t.BufferAttribute(new Float32Array(e.count*e.itemSize),e.itemSize,!1);if(!e.normalized&&!e.isInterleavedBufferAttribute)return n.array.set(e.array),n;for(let t=0,s=e.count;t<s;t++)for(let s=0;s<e.itemSize;s++)n.setComponent(t,s,e.getComponent(t,s));return n}},exports.GLTFExporter=n;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"o",{value:!0});var n=require("three");exports.OBJExporter=class{parse(o){let e="",t=0,i=0,l=0;const f=new n.Vector3,r=new n.Color,s=new n.Vector3,c=new n.Vector2,v=[];return o.traverse(function(o){!0===o.isMesh&&function(o){let r=0,u=0,d=0;const p=o.geometry,a=new n.Matrix3,w=p.getAttribute("position"),m=p.getAttribute("normal"),x=p.getAttribute("uv"),L=p.getIndex();if(e+="o "+o.name+"\n",o.material&&o.material.name&&(e+="usemtl "+o.material.name+"\n"),void 0!==w)for(let n=0,t=w.count;n<t;n++,r++)f.fromBufferAttribute(w,n),f.applyMatrix4(o.matrixWorld),e+="v "+f.x+" "+f.y+" "+f.z+"\n";if(void 0!==x)for(let n=0,o=x.count;n<o;n++,d++)c.fromBufferAttribute(x,n),e+="vt "+c.x+" "+c.y+"\n";if(void 0!==m){a.getNormalMatrix(o.matrixWorld);for(let n=0,o=m.count;n<o;n++,u++)s.fromBufferAttribute(m,n),s.applyMatrix3(a).normalize(),e+="vn "+s.x+" "+s.y+" "+s.z+"\n"}if(null!==L)for(let n=0,o=L.count;n<o;n+=3){for(let o=0;o<3;o++){const e=L.getX(n+o)+1;v[o]=t+e+(m||x?"/"+(x?i+e:"")+(m?"/"+(l+e):""):"")}e+="f "+v.join(" ")+"\n"}else for(let n=0,o=w.count;n<o;n+=3){for(let o=0;o<3;o++){const e=n+o+1;v[o]=t+e+(m||x?"/"+(x?i+e:"")+(m?"/"+(l+e):""):"")}e+="f "+v.join(" ")+"\n"}t+=r,i+=d,l+=u}(o),!0===o.isLine&&function(n){let o=0;const i=n.geometry,l=n.type,r=i.getAttribute("position");if(e+="o "+n.name+"\n",void 0!==r)for(let t=0,i=r.count;t<i;t++,o++)f.fromBufferAttribute(r,t),f.applyMatrix4(n.matrixWorld),e+="v "+f.x+" "+f.y+" "+f.z+"\n";if("Line"===l){e+="l ";for(let n=1,o=r.count;n<=o;n++)e+=t+n+" ";e+="\n"}if("LineSegments"===l)for(let n=1,o=n+1,i=r.count;n<i;n+=2,o=n+1)e+="l "+(t+n)+" "+(t+o)+"\n";t+=o}(o),!0===o.isPoints&&function(o){let i=0;const l=o.geometry,s=l.getAttribute("position"),c=l.getAttribute("color");if(e+="o "+o.name+"\n",void 0!==s){for(let t=0,l=s.count;t<l;t++,i++)f.fromBufferAttribute(s,t),f.applyMatrix4(o.matrixWorld),e+="v "+f.x+" "+f.y+" "+f.z,void 0!==c&&(r.fromBufferAttribute(c,t),n.ColorManagement.workingToColorSpace(r,n.SRGBColorSpace),e+=" "+r.r+" "+r.g+" "+r.b),e+="\n";e+="p ";for(let n=1,o=s.count;n<=o;n++)e+=t+n+" ";e+="\n"}t+=i}(o)}),e}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var n=require("three");exports.PLYExporter=class{parse(e,t,o={}){function r(n){e.traverse(function(e){if(!0===e.isMesh||e.isPoints){const t=e,o=t.geometry;!0===o.hasAttribute("position")&&n(t,o)}})}const l=(o=Object.assign({binary:!1,excludeAttributes:[],littleEndian:!1},o)).excludeAttributes;let i=!0,a=!1,u=!1,f=!1,p=0,c=0;e.traverse(function(n){if(!0===n.isMesh){const e=n.geometry,t=e.getAttribute("position"),o=e.getAttribute("normal"),r=e.getAttribute("uv"),l=e.getAttribute("color"),i=e.getIndex();if(void 0===t)return;p+=t.count,c+=i?i.count/3:t.count/3,void 0!==o&&(a=!0),void 0!==r&&(f=!0),void 0!==l&&(u=!0)}else if(n.isPoints){const e=n.geometry,t=e.getAttribute("position"),o=e.getAttribute("normal"),r=e.getAttribute("color");p+=t.count,void 0!==o&&(a=!0),void 0!==r&&(u=!0),i=!1}});const s=new n.Color;if(i=i&&-1===l.indexOf("index"),a=a&&-1===l.indexOf("normal"),u=u&&-1===l.indexOf("color"),f=f&&-1===l.indexOf("uv"),i&&c!==Math.floor(c))return null;let y=`ply\nformat ${o.binary?o.littleEndian?"binary_little_endian":"binary_big_endian":"ascii"} 1.0\nelement vertex ${p}\nproperty float x\nproperty float y\nproperty float z\n`;!0===a&&(y+="property float nx\nproperty float ny\nproperty float nz\n"),!0===f&&(y+="property float s\nproperty float t\n"),!0===u&&(y+="property uchar red\nproperty uchar green\nproperty uchar blue\n"),!0===i&&(y+=`element face ${c}\nproperty list uchar int vertex_index\n`),y+="end_header\n";const d=new n.Vector3,v=new n.Matrix3;let h=null;if(!0===o.binary){const e=(new TextEncoder).encode(y),t=p*(12+(a?12:0)+(u?3:0)+(f?8:0)),l=i?13*c:0,$=new DataView(new ArrayBuffer(e.length+t+l));new Uint8Array($.buffer).set(e,0);let m=e.length,x=e.length+t,b=0;r(function(e,t){const r=t.getAttribute("position"),l=t.getAttribute("normal"),p=t.getAttribute("uv"),c=t.getAttribute("color"),y=t.getIndex();v.getNormalMatrix(e.matrixWorld);for(let t=0,i=r.count;t<i;t++)d.fromBufferAttribute(r,t),d.applyMatrix4(e.matrixWorld),$.setFloat32(m,d.x,o.littleEndian),m+=4,$.setFloat32(m,d.y,o.littleEndian),m+=4,$.setFloat32(m,d.z,o.littleEndian),m+=4,!0===a&&(null!=l?(d.fromBufferAttribute(l,t),d.applyMatrix3(v).normalize(),$.setFloat32(m,d.x,o.littleEndian),m+=4,$.setFloat32(m,d.y,o.littleEndian),m+=4,$.setFloat32(m,d.z,o.littleEndian),m+=4):($.setFloat32(m,0,o.littleEndian),m+=4,$.setFloat32(m,0,o.littleEndian),m+=4,$.setFloat32(m,0,o.littleEndian),m+=4)),!0===f&&(null!=p?($.setFloat32(m,p.getX(t),o.littleEndian),m+=4,$.setFloat32(m,p.getY(t),o.littleEndian),m+=4):($.setFloat32(m,0,o.littleEndian),m+=4,$.setFloat32(m,0,o.littleEndian),m+=4)),!0===u&&(null!=c?(s.fromBufferAttribute(c,t),n.ColorManagement.workingToColorSpace(s,n.SRGBColorSpace),$.setUint8(m,Math.floor(255*s.r)),m+=1,$.setUint8(m,Math.floor(255*s.g)),m+=1,$.setUint8(m,Math.floor(255*s.b)),m+=1):($.setUint8(m,255),m+=1,$.setUint8(m,255),m+=1,$.setUint8(m,255),m+=1));if(!0===i)if(null!==y)for(let n=0,e=y.count;n<e;n+=3)$.setUint8(x,3),x+=1,$.setUint32(x,y.getX(n+0)+b,o.littleEndian),x+=4,$.setUint32(x,y.getX(n+1)+b,o.littleEndian),x+=4,$.setUint32(x,y.getX(n+2)+b,o.littleEndian),x+=4;else for(let n=0,e=r.count;n<e;n+=3)$.setUint8(x,3),x+=1,$.setUint32(x,b+n,o.littleEndian),x+=4,$.setUint32(x,b+n+1,o.littleEndian),x+=4,$.setUint32(x,b+n+2,o.littleEndian),x+=4;b+=r.count}),h=$.buffer}else{let e=0,t="",o="";r(function(r,l){const p=l.getAttribute("position"),y=l.getAttribute("normal"),h=l.getAttribute("uv"),$=l.getAttribute("color"),m=l.getIndex();v.getNormalMatrix(r.matrixWorld);for(let e=0,o=p.count;e<o;e++){d.fromBufferAttribute(p,e),d.applyMatrix4(r.matrixWorld);let o=d.x+" "+d.y+" "+d.z;!0===a&&(null!=y?(d.fromBufferAttribute(y,e),d.applyMatrix3(v).normalize(),o+=" "+d.x+" "+d.y+" "+d.z):o+=" 0 0 0"),!0===f&&(o+=null!=h?" "+h.getX(e)+" "+h.getY(e):" 0 0"),!0===u&&(null!=$?(s.fromBufferAttribute($,e),n.ColorManagement.workingToColorSpace(s,n.SRGBColorSpace),o+=" "+Math.floor(255*s.r)+" "+Math.floor(255*s.g)+" "+Math.floor(255*s.b)):o+=" 255 255 255"),t+=o+"\n"}if(!0===i){if(null!==m)for(let n=0,t=m.count;n<t;n+=3)o+=`3 ${m.getX(n+0)+e}`,o+=` ${m.getX(n+1)+e}`,o+=` ${m.getX(n+2)+e}\n`;else for(let n=0,t=p.count;n<t;n+=3)o+=`3 ${e+n} ${e+n+1} ${e+n+2}\n`;c+=m?m.count/3:p.count/3}e+=p.count}),h=`${y}${t}${i?`${o}\n`:"\n"}`}return"function"==typeof t&&requestAnimationFrame(()=>t(h)),h}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("three");exports.STLExporter=class{parse(t,n={}){const o=(n=Object.assign({binary:!1},n)).binary,r=[];let l,s=0;t.traverse(function(e){if(e.isMesh){const t=e.geometry,n=t.index,o=t.getAttribute("position");s+=null!==n?n.count/3:o.count/3,r.push({object3d:e,geometry:t})}});let i=80;if(!0===o){const e=new ArrayBuffer(2*s+3*s*4*4+80+4);l=new DataView(e),l.setUint32(i,s,!0),i+=4}else l="",l+="solid exported\n";const c=new e.Vector3,f=new e.Vector3,u=new e.Vector3,a=new e.Vector3,d=new e.Vector3,p=new e.Vector3;for(let e=0,t=r.length;e<t;e++){const t=r[e].object3d,n=r[e].geometry,o=n.index,l=n.getAttribute("position");if(null!==o)for(let e=0;e<o.count;e+=3){w(o.getX(e+0),o.getX(e+1),o.getX(e+2),l,t)}else for(let e=0;e<l.count;e+=3){w(e+0,e+1,e+2,l,t)}}return!1===o&&(l+="endsolid exported\n"),l;function w(e,t,n,r,s){c.fromBufferAttribute(r,e),f.fromBufferAttribute(r,t),u.fromBufferAttribute(r,n),!0===s.isSkinnedMesh&&(s.applyBoneTransform(e,c),s.applyBoneTransform(t,f),s.applyBoneTransform(n,u)),c.applyMatrix4(s.matrixWorld),f.applyMatrix4(s.matrixWorld),u.applyMatrix4(s.matrixWorld),function(e,t,n){a.subVectors(n,t),d.subVectors(e,t),a.cross(d).normalize(),p.copy(a).normalize(),!0===o?(l.setFloat32(i,p.x,!0),i+=4,l.setFloat32(i,p.y,!0),i+=4,l.setFloat32(i,p.z,!0),i+=4):(l+="\tfacet normal "+p.x+" "+p.y+" "+p.z+"\n",l+="\t\touter loop\n")}(c,f,u),x(c),x(f),x(u),!0===o?(l.setUint16(i,0,!0),i+=2):(l+="\t\tendloop\n",l+="\tendfacet\n")}function x(e){!0===o?(l.setFloat32(i,e.x,!0),i+=4,l.setFloat32(i,e.y,!0),i+=4,l.setFloat32(i,e.z,!0),i+=4):l+="\t\t\tvertex "+e.x+" "+e.y+" "+e.z+"\n"}}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("three");const t=new WeakMap;class r extends e.Loader{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(t,r,s,n){const o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,e=>{this.parse(e,r,n)},s,n)}parse(t,r,s=()=>{}){this.decodeDracoFile(t,r,null,null,e.SRGBColorSpace,s).catch(s)}decodeDracoFile(t,r,s,n,o=e.LinearSRGBColorSpace,i=()=>{}){const c={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:o};return this.decodeGeometry(t,c).then(r).catch(i)}decodeGeometry(e,r){const s=JSON.stringify(r);if(t.has(e)){const r=t.get(e);if(r.key===s)return r.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const o=this.workerNextTaskID++,i=e.byteLength,c=this.o(o,i).then(t=>(n=t,new Promise((t,s)=>{n.i[o]={resolve:t,reject:s},n.postMessage({type:"decode",id:o,taskConfig:r,buffer:e},[e])}))).then(e=>this.h(e.geometry));return c.catch(()=>!0).then(()=>{n&&o&&this.u(n,o)}),t.set(e,{key:s,promise:c}),c}h(t){const r=new e.BufferGeometry;t.index&&r.setIndex(new e.BufferAttribute(t.index.array,1));for(let s=0;s<t.attributes.length;s++){const n=t.attributes[s],o=n.name,i=n.array,c=n.itemSize,a=new e.BufferAttribute(i,c);"color"===o&&(this.l(a,n.vertexColorSpace),a.normalized=i instanceof Float32Array==!1),r.setAttribute(o,a)}return r}l(t,r){if(r!==e.SRGBColorSpace)return;const s=new e.Color;for(let r=0,n=t.count;r<n;r++)s.fromBufferAttribute(t,r),e.ColorManagement.colorSpaceToWorking(s,e.SRGBColorSpace),t.setXYZ(r,s.r,s.g,s.b)}p(t,r){const s=new e.FileLoader(this.manager);return s.setPath(this.decoderPath),s.setResponseType(r),s.setWithCredentials(this.withCredentials),new Promise((e,r)=>{s.load(t,e,void 0,r)})}preload(){return this.m(),this}m(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this.p("draco_decoder.js","text")):(t.push(this.p("draco_wasm_wrapper.js","text")),t.push(this.p("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const n=s.toString(),o=["/* draco decoder */",r,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}o(e,t){return this.m().then(()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e.i={},e.A={},e.D=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const r=t.data;switch(r.type){case"decode":e.i[r.id].resolve(r);break;case"error":e.i[r.id].reject(r)}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e.D>t.D?-1:1});const r=this.workerPool[this.workerPool.length-1];return r.A[e]=t,r.D+=t,r})}u(e,t){e.D-=e.A[t],delete e.i[t],delete e.A[t]}debug(){}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 s(){let e,t;function r(e,t,r,s,n,o){const i=o.num_components(),c=r.num_points()*i,a=c*n.BYTES_PER_ELEMENT,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),u=e._(a);t.GetAttributeDataArrayForAllPoints(r,o,h,a,u);const l=new n(e.HEAPF32.buffer,u,c).slice();return e.O(u),{name:s,array:l,itemSize:i}}onmessage=function(s){const n=s.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":const s=n.buffer,o=n.taskConfig;t.then(e=>{const t=e.draco,i=new t.Decoder;try{const e=function(e,t,s,n){const o=n.attributeIDs,i=n.attributeTypes;let c,a;const h=t.GetEncodedGeometryType(s);if(h===e.TRIANGULAR_MESH)c=new e.Mesh,a=t.DecodeArrayToMesh(s,s.byteLength,c);else{if(h!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");c=new e.PointCloud,a=t.DecodeArrayToPointCloud(s,s.byteLength,c)}if(!a.ok()||0===c.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());const u={index:null,attributes:[]};for(const s in o){const a=self[i[s]];let h,l;if(n.useUniqueIDs)l=o[s],h=t.GetAttributeByUniqueId(c,l);else{if(l=t.GetAttributeId(c,e[o[s]]),-1===l)continue;h=t.GetAttribute(c,l)}const d=r(e,t,c,s,a,h);"color"===s&&(d.vertexColorSpace=n.vertexColorSpace),u.attributes.push(d)}h===e.TRIANGULAR_MESH&&(u.index=function(e,t,r){const s=r.num_faces(),n=3*s,o=4*n,i=e._(o);t.GetTrianglesUInt32Array(r,o,i);const c=new Uint32Array(e.HEAPF32.buffer,i,n).slice();return e.O(i),{array:c,itemSize:1}}(e,t,c));return e.destroy(c),u}(t,i,new Int8Array(s),o),c=e.attributes.map(e=>e.array.buffer);e.index&&c.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},c)}catch(e){self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(i)}})}}}exports.DRACOLoader=r;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("three"),e=require("../utils/BufferGeometryUtils.js");class s extends t.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new a(t)}),this.register(function(t){return new w(t)}),this.register(function(t){return new m(t)}),this.register(function(t){return new v(t)}),this.register(function(t){return new h(t)}),this.register(function(t){return new f(t)}),this.register(function(t){return new l(t)}),this.register(function(t){return new A(t)}),this.register(function(t){return new c(t)}),this.register(function(t){return new d(t)}),this.register(function(t){return new u(t)}),this.register(function(t){return new r(t)}),this.register(function(t){return new E(t)}),this.register(function(t){return new T(t)})}load(e,s,n,i){const r=this;let o;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:t.LoaderUtils.extractUrlBase(e),this.manager.itemStart(e);const c=function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)},a=new t.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(t){try{r.parse(t,o,function(t){s(t),r.manager.itemEnd(e)},c)}catch(t){c(t)}},n,c)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,s,n){let r;const c={},a={},u=new TextDecoder;if("string"==typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer){if(u.decode(new Uint8Array(t,0,4))===p){try{c[i.KHR_BINARY_GLTF]=new M(t)}catch(t){return void(n&&n(t))}r=JSON.parse(c[i.KHR_BINARY_GLTF].content)}else r=JSON.parse(u.decode(t))}else r=t;if(void 0===r.asset||r.asset.version[0]<2)return void(n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const h=new q(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](h);a[e.name]=e,c[e.name]=!0}if(r.extensionsUsed)for(let t=0;t<r.extensionsUsed.length;++t){const e=r.extensionsUsed[t],s=r.extensionsRequired||[];switch(e){case i.KHR_MATERIALS_UNLIT:c[e]=new o;break;case i.KHR_DRACO_MESH_COMPRESSION:c[e]=new P(r,this.dracoLoader);break;case i.KHR_TEXTURE_TRANSFORM:c[e]=new g;break;case i.KHR_MESH_QUANTIZATION:c[e]=new L;break;default:s.indexOf(e)>=0&&a[e]}}h.setExtensions(c),h.setPlugins(a),h.parse(s,n)}parseAsync(t,e){const s=this;return new Promise(function(n,i){s.parse(t,e,n,i)})}}function n(){let t={};return{get:function(e){return t[e]},add:function(e,s){t[e]=s},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const i={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_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_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 r{constructor(t){this.parser=t,this.name=i.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}i(){const t=this.parser,e=this.parser.json.nodes||[];for(let s=0,n=e.length;s<n;s++){const n=e[s];n.extensions&&n.extensions[this.name]&&void 0!==n.extensions[this.name].light&&t.o(this.cache,n.extensions[this.name].light)}}u(e){const s=this.parser,n="light:"+e;let i=s.cache.get(n);if(i)return i;const r=s.json,o=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let c;const a=new t.Color(16777215);void 0!==o.color&&a.fromArray(o.color);const u=void 0!==o.range?o.range:0;switch(o.type){case"directional":c=new t.DirectionalLight(a),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new t.PointLight(a),c.distance=u;break;case"spot":c=new t.SpotLight(a),c.distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),c.decay=2,V(c,o),void 0!==o.intensity&&(c.intensity=o.intensity),c.name=s.createUniqueName(o.name||"light_"+e),i=Promise.resolve(c),s.cache.add(n,i),i}getDependency(t,e){if("light"===t)return this.u(e)}createNodeAttachment(t){const e=this,s=this.parser,n=s.json.nodes[t],i=(n.extensions&&n.extensions[this.name]||{}).light;return void 0===i?null:this.u(i).then(function(t){return s.h(e.cache,i,t)})}}class o{constructor(){this.name=i.KHR_MATERIALS_UNLIT}getMaterialType(){return t.MeshBasicMaterial}extendParams(e,s,n){const i=[];e.color=new t.Color(1,1,1),e.opacity=1;const r=s.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.fromArray(t),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,t.sRGBEncoding))}return Promise.all(i)}}class c{constructor(t){this.parser=t,this.name=i.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const n=s.extensions[this.name].emissiveStrength;return void 0!==n&&(e.emissiveIntensity=n),Promise.resolve()}}class a{constructor(t){this.parser=t,this.name=i.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],o=i.extensions[this.name];if(void 0!==o.clearcoatFactor&&(s.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&r.push(n.assignTexture(s,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(s.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&r.push(n.assignTexture(s,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(r.push(n.assignTexture(s,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){const e=o.clearcoatNormalTexture.scale;s.clearcoatNormalScale=new t.Vector2(e,e)}return Promise.all(r)}}class u{constructor(t){this.parser=t,this.name=i.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],r=n.extensions[this.name];return void 0!==r.iridescenceFactor&&(e.iridescence=r.iridescenceFactor),void 0!==r.iridescenceTexture&&i.push(s.assignTexture(e,"iridescenceMap",r.iridescenceTexture)),void 0!==r.iridescenceIor&&(e.iridescenceIOR=r.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==r.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),void 0!==r.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),void 0!==r.iridescenceThicknessTexture&&i.push(s.assignTexture(e,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(i)}}class h{constructor(t){this.parser=t,this.name=i.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];s.sheenColor=new t.Color(0,0,0),s.sheenRoughness=0,s.sheen=1;const o=i.extensions[this.name];return void 0!==o.sheenColorFactor&&s.sheenColor.fromArray(o.sheenColorFactor),void 0!==o.sheenRoughnessFactor&&(s.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&r.push(n.assignTexture(s,"sheenColorMap",o.sheenColorTexture,t.sRGBEncoding)),void 0!==o.sheenRoughnessTexture&&r.push(n.assignTexture(s,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(r)}}class f{constructor(t){this.parser=t,this.name=i.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],r=n.extensions[this.name];return void 0!==r.transmissionFactor&&(e.transmission=r.transmissionFactor),void 0!==r.transmissionTexture&&i.push(s.assignTexture(e,"transmissionMap",r.transmissionTexture)),Promise.all(i)}}class l{constructor(t){this.parser=t,this.name=i.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],o=i.extensions[this.name];s.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&r.push(n.assignTexture(s,"thicknessMap",o.thicknessTexture)),s.attenuationDistance=o.attenuationDistance||1/0;const c=o.attenuationColor||[1,1,1];return s.attenuationColor=new t.Color(c[0],c[1],c[2]),Promise.all(r)}}class A{constructor(t){this.parser=t,this.name=i.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const n=s.extensions[this.name];return e.ior=void 0!==n.ior?n.ior:1.5,Promise.resolve()}}class d{constructor(t){this.parser=t,this.name=i.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],o=i.extensions[this.name];s.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&r.push(n.assignTexture(s,"specularIntensityMap",o.specularTexture));const c=o.specularColorFactor||[1,1,1];return s.specularColor=new t.Color(c[0],c[1],c[2]),void 0!==o.specularColorTexture&&r.push(n.assignTexture(s,"specularColorMap",o.specularColorTexture,t.sRGBEncoding)),Promise.all(r)}}class w{constructor(t){this.parser=t,this.name=i.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,s=e.json,n=s.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const i=n.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,i.source,r)}}class m{constructor(t){this.parser=t,this.name=i.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,s=this.parser,n=s.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],o=n.images[r.source];let c=s.textureLoader;if(o.uri){const t=s.options.manager.getHandler(o.uri);null!==t&&(c=t)}return this.detectSupport().then(function(i){if(i)return s.loadTextureImage(t,r.source,c);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}})),this.isSupported}}class v{constructor(t){this.parser=t,this.name=i.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,s=this.parser,n=s.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],o=n.images[r.source];let c=s.textureLoader;if(o.uri){const t=s.options.manager.getHandler(o.uri);null!==t&&(c=t)}return this.detectSupport().then(function(i){if(i)return s.loadTextureImage(t,r.source,c);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}})),this.isSupported}}class E{constructor(t){this.name=i.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,s=e.bufferViews[t];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],n=this.parser.getDependency("buffer",t.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return n.then(function(e){const s=t.byteOffset||0,n=t.byteLength||0,r=t.count,o=t.byteStride,c=new Uint8Array(e,s,n);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(r,o,c,t.mode,t.filter).then(function(t){return t.buffer}):i.ready.then(function(){const e=new ArrayBuffer(r*o);return i.decodeGltfBuffer(new Uint8Array(e),r,o,c,t.mode,t.filter),e})})}return null}}class T{constructor(t){this.name=i.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(e){const s=this.parser.json,n=s.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=s.meshes[n.mesh];for(const t of i.primitives)if(t.mode!==H.TRIANGLES&&t.mode!==H.TRIANGLE_STRIP&&t.mode!==H.TRIANGLE_FAN&&void 0!==t.mode)return null;const r=n.extensions[this.name].attributes,o=[],c={};for(const t in r)o.push(this.parser.getDependency("accessor",r[t]).then(e=>(c[t]=e,c[t])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(e=>{const s=e.pop(),n=s.isGroup?s.children:[s],i=e[0].count,r=[];for(const e of n){const s=new t.Matrix4,n=new t.Vector3,o=new t.Quaternion,a=new t.Vector3(1,1,1),u=new t.InstancedMesh(e.geometry,e.material,i);for(let t=0;t<i;t++)c.TRANSLATION&&n.fromBufferAttribute(c.TRANSLATION,t),c.ROTATION&&o.fromBufferAttribute(c.ROTATION,t),c.SCALE&&a.fromBufferAttribute(c.SCALE,t),u.setMatrixAt(t,s.compose(n,o,a));for(const t in c)"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,c[t]);t.Object3D.prototype.copy.call(u,e),u.frustumCulled=!1,this.parser.assignFinalMaterial(u),r.push(u)}return s.isGroup?(s.clear(),s.add(...r),s):r[0]}))}}const p="glTF",_=1313821514,R=5130562;class M{constructor(t){this.name=i.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,12),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==p)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-12,r=new DataView(t,12);let o=0;for(;o<n;){const e=r.getUint32(o,!0);o+=4;const n=r.getUint32(o,!0);if(o+=4,n===_){const n=new Uint8Array(t,12+o,e);this.content=s.decode(n)}else if(n===R){const s=12+o;this.body=t.slice(s,s+e)}o+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class P{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=i.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const s=this.json,n=this.dracoLoader,i=t.extensions[this.name].bufferView,r=t.extensions[this.name].attributes,o={},c={},a={};for(const t in r){const e=x[t]||t.toLowerCase();o[e]=r[t]}for(const e in t.attributes){const n=x[e]||e.toLowerCase();if(void 0!==r[e]){const i=s.accessors[t.attributes[e]],r=y[i.componentType];a[n]=r.name,c[n]=!0===i.normalized}}return e.getDependency("bufferView",i).then(function(t){return new Promise(function(e){n.decodeDracoFile(t,function(t){for(const e in t.attributes){const s=t.attributes[e],n=c[e];void 0!==n&&(s.normalized=n)}e(t)},o,a)})})}}class g{constructor(){this.name=i.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return e.texCoord,void 0===e.offset&&void 0===e.rotation&&void 0===e.scale||(t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class L{constructor(){this.name=i.KHR_MESH_QUANTIZATION}}class I extends t.Interpolant{constructor(t,e,s,n){super(t,e,s,n)}copySampleValue_(t){const e=this.resultBuffer,s=this.sampleValues,n=this.valueSize,i=t*n*3+n;for(let t=0;t!==n;t++)e[t]=s[i+t];return e}interpolate_(t,e,s,n){const i=this.resultBuffer,r=this.sampleValues,o=this.valueSize,c=2*o,a=3*o,u=n-e,h=(s-e)/u,f=h*h,l=f*h,A=t*a,d=A-a,w=-2*l+3*f,m=l-f,v=1-w,E=m-f+h;for(let t=0;t!==o;t++){const e=r[d+t+o],s=r[d+t+c]*u,n=r[A+t+o],a=r[A+t]*u;i[t]=v*e+E*s+w*n+m*a}return i}}const b=new t.Quaternion;class S extends I{interpolate_(t,e,s,n){const i=super.interpolate_(t,e,s,n);return b.fromArray(i).normalize().toArray(i),i}}const H={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},y={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},N={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},O={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},B={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},x={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},F={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},G={CUBICSPLINE:void 0,LINEAR:t.InterpolateLinear,STEP:t.InterpolateDiscrete},U="OPAQUE",k="MASK",K="BLEND";function C(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),e.DefaultMaterial}function D(t,e,s){for(const n in s.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=s.extensions[n])}function V(t,e){void 0!==e.extras&&"object"==typeof e.extras&&Object.assign(t.userData,e.extras)}function X(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let s=0,n=e.weights.length;s<n;s++)t.morphTargetInfluences[s]=e.weights[s];if(e.extras&&Array.isArray(e.extras.targetNames)){const s=e.extras.targetNames;if(t.morphTargetInfluences.length===s.length){t.morphTargetDictionary={};for(let e=0,n=s.length;e<n;e++)t.morphTargetDictionary[s[e]]=e}}}function j(t){const e=t.extensions&&t.extensions[i.KHR_DRACO_MESH_COMPRESSION];let s;return s=e?"draco:"+e.bufferView+":"+e.indices+":"+Q(e.attributes):t.indices+":"+Q(t.attributes)+":"+t.mode,s}function Q(t){let e="";const s=Object.keys(t).sort();for(let n=0,i=s.length;n<i;n++)e+=s[n]+":"+t[s[n]]+";";return e}function W(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Y=new t.Matrix4;class q{constructor(e={},s={}){this.json=e,this.extensions={},this.plugins={},this.options=s,this.cache=new n,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,o=-1;"undefined"!=typeof navigator&&(i=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=navigator.userAgent.indexOf("Firefox")>-1,o=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||i||r&&o<98?this.textureLoader=new t.TextureLoader(this.options.manager):this.textureLoader=new t.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const s=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this.l(function(t){return t.i&&t.i()}),Promise.all(this.l(function(t){return t.beforeRoot&&t.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(e){const r={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:s,userData:{}};D(i,r,n),V(r,n),Promise.all(s.l(function(t){return t.afterRoot&&t.afterRoot(r)})).then(function(){t(r)})}).catch(e)}i(){const t=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let s=0,n=e.length;s<n;s++){const n=e[s].joints;for(let e=0,s=n.length;e<s;e++)t[n[e]].isBone=!0}for(let e=0,n=t.length;e<n;e++){const n=t[e];void 0!==n.mesh&&(this.o(this.meshCache,n.mesh),void 0!==n.skin&&(s[n.mesh].isSkinnedMesh=!0)),void 0!==n.camera&&this.o(this.cameraCache,n.camera)}}o(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}h(t,e,s){if(t.refs[e]<=1)return s;const n=s.clone(),i=(t,e)=>{const s=this.associations.get(t);null!=s&&this.associations.set(e,s);for(const[s,n]of t.children.entries())i(n,e.children[s])};return i(s,n),n.name+="_instance_"+t.uses[e]++,n}A(t){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const n=t(e[s]);if(n)return n}return null}l(t){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let n=0;n<e.length;n++){const i=t(e[n]);i&&s.push(i)}return s}getDependency(t,e){const s=t+":"+e;let n=this.cache.get(s);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this.A(function(t){return t.loadNode&&t.loadNode(e)});break;case"mesh":n=this.A(function(t){return t.loadMesh&&t.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this.A(function(t){return t.loadBufferView&&t.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this.A(function(t){return t.loadMaterial&&t.loadMaterial(e)});break;case"texture":n=this.A(function(t){return t.loadTexture&&t.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this.A(function(t){return t.loadAnimation&&t.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this.A(function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t)}this.cache.add(s,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const s=this,n=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(n.map(function(e,n){return s.getDependency(t,n)})),this.cache.add(t,e)}return e}loadBuffer(e){const s=this.json.buffers[e],n=this.fileLoader;if(s.type&&"arraybuffer"!==s.type)throw new Error("THREE.GLTFLoader: "+s.type+" buffer type is not supported.");if(void 0===s.uri&&0===e)return Promise.resolve(this.extensions[i.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(e,i){n.load(t.LoaderUtils.resolveURL(s.uri,r.path),e,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+s.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(t){const s=e.byteLength||0,n=e.byteOffset||0;return t.slice(n,n+s)})}loadAccessor(e){const s=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=B[i.type],s=y[i.componentType],n=!0===i.normalized,r=new s(i.count*e);return Promise.resolve(new t.BufferAttribute(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(e){const r=e[0],o=B[i.type],c=y[i.componentType],a=c.BYTES_PER_ELEMENT,u=a*o,h=i.byteOffset||0,f=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,l=!0===i.normalized;let A,d;if(f&&f!==u){const e=Math.floor(h/f),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let u=s.cache.get(n);u||(A=new c(r,e*f,i.count*f/a),u=new t.InterleavedBuffer(A,f/a),s.cache.add(n,u)),d=new t.InterleavedBufferAttribute(u,o,h%f/a,l)}else A=null===r?new c(i.count*o):new c(r,h,i.count*o),d=new t.BufferAttribute(A,o,l);if(void 0!==i.sparse){const s=B.SCALAR,n=y[i.sparse.indices.componentType],a=i.sparse.indices.byteOffset||0,u=i.sparse.values.byteOffset||0,h=new n(e[1],a,i.sparse.count*s),f=new c(e[2],u,i.sparse.count*o);null!==r&&(d=new t.BufferAttribute(d.array.slice(),d.itemSize,d.normalized));for(let t=0,e=h.length;t<e;t++){const e=h[t];if(d.setX(e,f[t*o]),o>=2&&d.setY(e,f[t*o+1]),o>=3&&d.setZ(e,f[t*o+2]),o>=4&&d.setW(e,f[t*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return d})}loadTexture(t){const e=this.json,s=this.options,n=e.textures[t].source,i=e.images[n];let r=this.textureLoader;if(i.uri){const t=s.manager.getHandler(i.uri);null!==t&&(r=t)}return this.loadTextureImage(t,n,r)}loadTextureImage(e,s,n){const i=this,r=this.json,o=r.textures[e],c=r.images[s],a=(c.uri||c.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];const u=this.loadImageSource(s,n).then(function(s){s.flipY=!1,s.name=o.name||c.name||"";const n=(r.samplers||{})[o.sampler]||{};return s.magFilter=N[n.magFilter]||t.LinearFilter,s.minFilter=N[n.minFilter]||t.LinearMipmapLinearFilter,s.wrapS=O[n.wrapS]||t.RepeatWrapping,s.wrapT=O[n.wrapT]||t.RepeatWrapping,i.associations.set(s,{textures:e}),s}).catch(function(){return null});return this.textureCache[a]=u,u}loadImageSource(e,s){const n=this,i=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(t=>t.clone());const o=i.images[e],c=self.URL||self.webkitURL;let a=o.uri||"",u=!1;if(void 0!==o.bufferView)a=n.getDependency("bufferView",o.bufferView).then(function(t){u=!0;const e=new Blob([t],{type:o.mimeType});return a=c.createObjectURL(e),a});else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(a).then(function(e){return new Promise(function(n,i){let o=n;!0===s.isImageBitmapLoader&&(o=function(e){const s=new t.Texture(e);s.needsUpdate=!0,n(s)}),s.load(t.LoaderUtils.resolveURL(e,r.path),o,void 0,i)})}).then(function(t){var e;return!0===u&&c.revokeObjectURL(a),t.userData.mimeType=o.mimeType||((e=o.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t}).catch(function(t){throw t});return this.sourceCache[e]=h,h}assignTexture(t,e,s,n){const r=this;return this.getDependency("texture",s.index).then(function(o){if(!o)return null;if(void 0!==s.texCoord&&0!=s.texCoord&&("aoMap"!==e||s.texCoord),r.extensions[i.KHR_TEXTURE_TRANSFORM]){const t=void 0!==s.extensions?s.extensions[i.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(o);o=r.extensions[i.KHR_TEXTURE_TRANSFORM].extendTexture(o,t),r.associations.set(o,e)}}return void 0!==n&&(o.encoding=n),t[e]=o,o})}assignFinalMaterial(e){const s=e.geometry;let n=e.material;const i=void 0===s.attributes.tangent,r=void 0!==s.attributes.color,o=void 0===s.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let s=this.cache.get(e);s||(s=new t.PointsMaterial,t.Material.prototype.copy.call(s,n),s.color.copy(n.color),s.map=n.map,s.sizeAttenuation=!1,this.cache.add(e,s)),n=s}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let s=this.cache.get(e);s||(s=new t.LineBasicMaterial,t.Material.prototype.copy.call(s,n),s.color.copy(n.color),this.cache.add(e,s)),n=s}if(i||r||o){let t="ClonedMaterial:"+n.uuid+":";i&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),o&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),r&&(e.vertexColors=!0),o&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}n.aoMap&&void 0===s.attributes.uv2&&void 0!==s.attributes.uv&&s.setAttribute("uv2",s.attributes.uv),e.material=n}getMaterialType(){return t.MeshStandardMaterial}loadMaterial(e){const s=this,n=this.json,r=this.extensions,o=n.materials[e];let c;const a={},u=[];if((o.extensions||{})[i.KHR_MATERIALS_UNLIT]){const t=r[i.KHR_MATERIALS_UNLIT];c=t.getMaterialType(),u.push(t.extendParams(a,o,s))}else{const n=o.pbrMetallicRoughness||{};if(a.color=new t.Color(1,1,1),a.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;a.color.fromArray(t),a.opacity=t[3]}void 0!==n.baseColorTexture&&u.push(s.assignTexture(a,"map",n.baseColorTexture,t.sRGBEncoding)),a.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,a.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(u.push(s.assignTexture(a,"metalnessMap",n.metallicRoughnessTexture)),u.push(s.assignTexture(a,"roughnessMap",n.metallicRoughnessTexture))),c=this.A(function(t){return t.getMaterialType&&t.getMaterialType(e)}),u.push(Promise.all(this.l(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)})))}!0===o.doubleSided&&(a.side=t.DoubleSide);const h=o.alphaMode||U;if(h===K?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===k&&(a.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&c!==t.MeshBasicMaterial&&(u.push(s.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new t.Vector2(1,1),void 0!==o.normalTexture.scale)){const t=o.normalTexture.scale;a.normalScale.set(t,t)}return void 0!==o.occlusionTexture&&c!==t.MeshBasicMaterial&&(u.push(s.assignTexture(a,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(a.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&c!==t.MeshBasicMaterial&&(a.emissive=(new t.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&c!==t.MeshBasicMaterial&&u.push(s.assignTexture(a,"emissiveMap",o.emissiveTexture,t.sRGBEncoding)),Promise.all(u).then(function(){const t=new c(a);return o.name&&(t.name=o.name),V(t,o),s.associations.set(t,{materials:e}),o.extensions&&D(r,t,o),t})}createUniqueName(e){const s=t.PropertyBinding.sanitizeNodeName(e||"");let n=s;for(let t=1;this.nodeNamesUsed[n];++t)n=s+"_"+t;return this.nodeNamesUsed[n]=!0,n}loadGeometries(e){const s=this,n=this.extensions,r=this.primitiveCache;function o(t){return n[i.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,s).then(function(e){return J(e,t,s)})}const c=[];for(let n=0,a=e.length;n<a;n++){const a=e[n],u=j(a),h=r[u];if(h)c.push(h.promise);else{let e;e=a.extensions&&a.extensions[i.KHR_DRACO_MESH_COMPRESSION]?o(a):J(new t.BufferGeometry,a,s),r[u]={primitive:a,promise:e},c.push(e)}}return Promise.all(c)}loadMesh(s){const n=this,i=this.json,r=this.extensions,o=i.meshes[s],c=o.primitives,a=[];for(let t=0,e=c.length;t<e;t++){const e=void 0===c[t].material?C(this.cache):this.getDependency("material",c[t].material);a.push(e)}return a.push(n.loadGeometries(c)),Promise.all(a).then(function(i){const a=i.slice(0,i.length-1),u=i[i.length-1],h=[];for(let i=0,f=u.length;i<f;i++){const f=u[i],l=c[i];let A;const d=a[i];if(l.mode===H.TRIANGLES||l.mode===H.TRIANGLE_STRIP||l.mode===H.TRIANGLE_FAN||void 0===l.mode)A=!0===o.isSkinnedMesh?new t.SkinnedMesh(f,d):new t.Mesh(f,d),!0===A.isSkinnedMesh&&A.normalizeSkinWeights(),l.mode===H.TRIANGLE_STRIP?A.geometry=e.toTrianglesDrawMode(A.geometry,t.TriangleStripDrawMode):l.mode===H.TRIANGLE_FAN&&(A.geometry=e.toTrianglesDrawMode(A.geometry,t.TriangleFanDrawMode));else if(l.mode===H.LINES)A=new t.LineSegments(f,d);else if(l.mode===H.LINE_STRIP)A=new t.Line(f,d);else if(l.mode===H.LINE_LOOP)A=new t.LineLoop(f,d);else{if(l.mode!==H.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+l.mode);A=new t.Points(f,d)}Object.keys(A.geometry.morphAttributes).length>0&&X(A,o),A.name=n.createUniqueName(o.name||"mesh_"+s),V(A,o),l.extensions&&D(r,A,l),n.assignFinalMaterial(A),h.push(A)}for(let t=0,e=h.length;t<e;t++)n.associations.set(h[t],{meshes:s,primitives:t});if(1===h.length)return h[0];const f=new t.Group;n.associations.set(f,{meshes:s});for(let t=0,e=h.length;t<e;t++)f.add(h[t]);return f})}loadCamera(e){let s;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?s=new t.PerspectiveCamera(t.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(s=new t.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(s.name=this.createUniqueName(n.name)),V(s,n),Promise.resolve(s)}loadSkin(e){const s=this.json.skins[e],n=[];for(let t=0,e=s.joints.length;t<e;t++)n.push(this.m(s.joints[t]));return void 0!==s.inverseBindMatrices?n.push(this.getDependency("accessor",s.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(e){const s=e.pop(),n=e,i=[],r=[];for(let e=0,o=n.length;e<o;e++){const o=n[e];if(o){i.push(o);const n=new t.Matrix4;null!==s&&n.fromArray(s.array,16*e),r.push(n)}}return new t.Skeleton(i,r)})}loadAnimation(e){const s=this.json.animations[e],n=[],i=[],r=[],o=[],c=[];for(let t=0,e=s.channels.length;t<e;t++){const e=s.channels[t],a=s.samplers[e.sampler],u=e.target,h=u.node,f=void 0!==s.parameters?s.parameters[a.input]:a.input,l=void 0!==s.parameters?s.parameters[a.output]:a.output;n.push(this.getDependency("node",h)),i.push(this.getDependency("accessor",f)),r.push(this.getDependency("accessor",l)),o.push(a),c.push(u)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(r),Promise.all(o),Promise.all(c)]).then(function(n){const i=n[0],r=n[1],o=n[2],c=n[3],a=n[4],u=[];for(let e=0,s=i.length;e<s;e++){const s=i[e],n=r[e],h=o[e],f=c[e],l=a[e];if(void 0===s)continue;let A;switch(s.updateMatrix(),F[l.path]){case F.weights:A=t.NumberKeyframeTrack;break;case F.rotation:A=t.QuaternionKeyframeTrack;break;default:A=t.VectorKeyframeTrack}const d=s.name?s.name:s.uuid,w=void 0!==f.interpolation?G[f.interpolation]:t.InterpolateLinear,m=[];F[l.path]===F.weights?s.traverse(function(t){t.morphTargetInfluences&&m.push(t.name?t.name:t.uuid)}):m.push(d);let v=h.array;if(h.normalized){const t=W(v.constructor),e=new Float32Array(v.length);for(let s=0,n=v.length;s<n;s++)e[s]=v[s]*t;v=e}for(let e=0,s=m.length;e<s;e++){const s=new A(m[e]+"."+F[l.path],n.array,v,w);"CUBICSPLINE"===f.interpolation&&(s.createInterpolant=function(e){return new(this instanceof t.QuaternionKeyframeTrack?S:I)(this.times,this.values,this.getValueSize()/3,e)},s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(s)}}const h=s.name?s.name:"animation_"+e;return new t.AnimationClip(h,void 0,u)})}createNodeMesh(t){const e=this.json,s=this,n=e.nodes[t];return void 0===n.mesh?null:s.getDependency("mesh",n.mesh).then(function(t){const e=s.h(s.meshCache,n.mesh,t);return void 0!==n.weights&&e.traverse(function(t){if(t.isMesh)for(let e=0,s=n.weights.length;e<s;e++)t.morphTargetInfluences[e]=n.weights[e]}),e})}loadNode(t){const e=this,s=this.json.nodes[t],n=e.m(t),i=[],r=s.children||[];for(let t=0,s=r.length;t<s;t++)i.push(e.getDependency("node",r[t]));const o=void 0===s.skin?Promise.resolve(null):e.getDependency("skin",s.skin);return Promise.all([n,Promise.all(i),o]).then(function(t){const e=t[0],s=t[1],n=t[2];null!==n&&e.traverse(function(t){t.isSkinnedMesh&&t.bind(n,Y)});for(let t=0,n=s.length;t<n;t++)e.add(s[t]);return e})}m(e){const s=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=s.nodes[e],o=r.name?i.createUniqueName(r.name):"",c=[],a=i.A(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return a&&c.push(a),void 0!==r.camera&&c.push(i.getDependency("camera",r.camera).then(function(t){return i.h(i.cameraCache,r.camera,t)})),i.l(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(t){c.push(t)}),this.nodeCache[e]=Promise.all(c).then(function(s){let c;if(c=!0===r.isBone?new t.Bone:s.length>1?new t.Group:1===s.length?s[0]:new t.Object3D,c!==s[0])for(let t=0,e=s.length;t<e;t++)c.add(s[t]);if(r.name&&(c.userData.name=r.name,c.name=o),V(c,r),r.extensions&&D(n,c,r),void 0!==r.matrix){const e=new t.Matrix4;e.fromArray(r.matrix),c.applyMatrix4(e)}else void 0!==r.translation&&c.position.fromArray(r.translation),void 0!==r.rotation&&c.quaternion.fromArray(r.rotation),void 0!==r.scale&&c.scale.fromArray(r.scale);return i.associations.has(c)||i.associations.set(c,{}),i.associations.get(c).nodes=e,c}),this.nodeCache[e]}loadScene(e){const s=this.extensions,n=this.json.scenes[e],i=this,r=new t.Group;n.name&&(r.name=i.createUniqueName(n.name)),V(r,n),n.extensions&&D(s,r,n);const o=n.nodes||[],c=[];for(let t=0,e=o.length;t<e;t++)c.push(i.getDependency("node",o[t]));return Promise.all(c).then(function(e){for(let t=0,s=e.length;t<s;t++)r.add(e[t]);return i.associations=(e=>{const s=new Map;for(const[e,n]of i.associations)(e instanceof t.Material||e instanceof t.Texture)&&s.set(e,n);return e.traverse(t=>{const e=i.associations.get(t);null!=e&&s.set(t,e)}),s})(r),r})}}function J(e,s,n){const i=s.attributes,r=[];function o(t,s){return n.getDependency("accessor",t).then(function(t){e.setAttribute(s,t)})}for(const t in i){const s=x[t]||t.toLowerCase();s in e.attributes||r.push(o(i[t],s))}if(void 0!==s.indices&&!e.index){const t=n.getDependency("accessor",s.indices).then(function(t){e.setIndex(t)});r.push(t)}return V(e,s),function(e,s,n){const i=s.attributes,r=new t.Box3;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],s=e.min,o=e.max;if(void 0===s||void 0===o)return;if(r.set(new t.Vector3(s[0],s[1],s[2]),new t.Vector3(o[0],o[1],o[2])),e.normalized){const t=W(y[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const o=s.targets;if(void 0!==o){const e=new t.Vector3,s=new t.Vector3;for(let t=0,i=o.length;t<i;t++){const i=o[t];if(void 0!==i.POSITION){const t=n.json.accessors[i.POSITION],r=t.min,o=t.max;if(void 0!==r&&void 0!==o){if(s.setX(Math.max(Math.abs(r[0]),Math.abs(o[0]))),s.setY(Math.max(Math.abs(r[1]),Math.abs(o[1]))),s.setZ(Math.max(Math.abs(r[2]),Math.abs(o[2]))),t.normalized){const e=W(y[t.componentType]);s.multiplyScalar(e)}e.max(s)}}}r.expandByVector(e)}e.boundingBox=r;const c=new t.Sphere;r.getCenter(c.center),c.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=c}(e,s,n),Promise.all(r).then(function(){return void 0!==s.targets?function(t,e,s){let n=!1,i=!1,r=!1;for(let t=0,s=e.length;t<s;t++){const s=e[t];if(void 0!==s.POSITION&&(n=!0),void 0!==s.NORMAL&&(i=!0),void 0!==s.COLOR_0&&(r=!0),n&&i&&r)break}if(!n&&!i&&!r)return Promise.resolve(t);const o=[],c=[],a=[];for(let u=0,h=e.length;u<h;u++){const h=e[u];if(n){const e=void 0!==h.POSITION?s.getDependency("accessor",h.POSITION):t.attributes.position;o.push(e)}if(i){const e=void 0!==h.NORMAL?s.getDependency("accessor",h.NORMAL):t.attributes.normal;c.push(e)}if(r){const e=void 0!==h.COLOR_0?s.getDependency("accessor",h.COLOR_0):t.attributes.color;a.push(e)}}return Promise.all([Promise.all(o),Promise.all(c),Promise.all(a)]).then(function(e){const s=e[0],o=e[1],c=e[2];return n&&(t.morphAttributes.position=s),i&&(t.morphAttributes.normal=o),r&&(t.morphAttributes.color=c),t.morphTargetsRelative=!0,t})}(e,s.targets,n):e})}exports.GLTFLoader=s;
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("three"),e=require("../utils/BufferGeometryUtils.js");class s extends t.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new a(t)}),this.register(function(t){return new u(t)}),this.register(function(t){return new _(t)}),this.register(function(t){return new E(t)}),this.register(function(t){return new p(t)}),this.register(function(t){return new f(t)}),this.register(function(t){return new l(t)}),this.register(function(t){return new d(t)}),this.register(function(t){return new m(t)}),this.register(function(t){return new c(t)}),this.register(function(t){return new v(t)}),this.register(function(t){return new h(t)}),this.register(function(t){return new T(t)}),this.register(function(t){return new w(t)}),this.register(function(t){return new r(t)}),this.register(function(t){return new R(t)}),this.register(function(t){return new A(t)})}load(e,s,i,n){const r=this;let o;if(""!==this.resourcePath)o=this.resourcePath;else if(""!==this.path){const s=t.LoaderUtils.extractUrlBase(e);o=t.LoaderUtils.resolveURL(s,this.path)}else o=t.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const c=function(t){n&&n(t),r.manager.itemError(e),r.manager.itemEnd(e)},a=new t.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(t){try{r.parse(t,o,function(t){s(t),r.manager.itemEnd(e)},c)}catch(t){c(t)}},i,c)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,s,i){let r;const c={},a={},u=new TextDecoder;if("string"==typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer){if(u.decode(new Uint8Array(t,0,4))===P){try{c[n.KHR_BINARY_GLTF]=new g(t)}catch(t){return void(i&&i(t))}r=JSON.parse(c[n.KHR_BINARY_GLTF].content)}else r=JSON.parse(u.decode(t))}else r=t;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const h=new Q(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](h);e.name,a[e.name]=e,c[e.name]=!0}if(r.extensionsUsed)for(let t=0;t<r.extensionsUsed.length;++t){const e=r.extensionsUsed[t],s=r.extensionsRequired||[];switch(e){case n.KHR_MATERIALS_UNLIT:c[e]=new o;break;case n.KHR_DRACO_MESH_COMPRESSION:c[e]=new I(r,this.dracoLoader);break;case n.KHR_TEXTURE_TRANSFORM:c[e]=new S;break;case n.KHR_MESH_QUANTIZATION:c[e]=new y;break;default:s.indexOf(e)>=0&&a[e]}}h.setExtensions(c),h.setPlugins(a),h.parse(s,i)}parseAsync(t,e){const s=this;return new Promise(function(i,n){s.parse(t,e,i,n)})}}function i(){let t={};return{get:function(e){return t[e]},add:function(e,s){t[e]=s},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const n={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 r{constructor(t){this.parser=t,this.name=n.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}i(){const t=this.parser,e=this.parser.json.nodes||[];for(let s=0,i=e.length;s<i;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t.o(this.cache,i.extensions[this.name].light)}}u(e){const s=this.parser,i="light:"+e;let n=s.cache.get(i);if(n)return n;const r=s.json,o=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let c;const a=new t.Color(16777215);void 0!==o.color&&a.setRGB(o.color[0],o.color[1],o.color[2],t.LinearSRGBColorSpace);const u=void 0!==o.range?o.range:0;switch(o.type){case"directional":c=new t.DirectionalLight(a),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new t.PointLight(a),c.distance=u;break;case"spot":c=new t.SpotLight(a),c.distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),q(c,o),void 0!==o.intensity&&(c.intensity=o.intensity),c.name=s.createUniqueName(o.name||"light_"+e),n=Promise.resolve(c),s.cache.add(i,n),n}getDependency(t,e){if("light"===t)return this.u(e)}createNodeAttachment(t){const e=this,s=this.parser,i=s.json.nodes[t],n=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===n?null:this.u(n).then(function(t){return s.h(e.cache,n,t)})}}class o{constructor(){this.name=n.KHR_MATERIALS_UNLIT}getMaterialType(){return t.MeshBasicMaterial}extendParams(e,s,i){const n=[];e.color=new t.Color(1,1,1),e.opacity=1;const r=s.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const s=r.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],t.LinearSRGBColorSpace),e.opacity=s[3]}void 0!==r.baseColorTexture&&n.push(i.assignTexture(e,"map",r.baseColorTexture,t.SRGBColorSpace))}return Promise.all(n)}}class c{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name].emissiveStrength;return void 0!==i&&(e.emissiveIntensity=i),Promise.resolve()}}class a{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],o=n.extensions[this.name];if(void 0!==o.clearcoatFactor&&(s.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&r.push(i.assignTexture(s,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(s.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&r.push(i.assignTexture(s,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(r.push(i.assignTexture(s,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){const e=o.clearcoatNormalTexture.scale;s.clearcoatNormalScale=new t.Vector2(e,e)}return Promise.all(r)}}class u{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_DISPERSION}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name];return e.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class h{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];return void 0!==r.iridescenceFactor&&(e.iridescence=r.iridescenceFactor),void 0!==r.iridescenceTexture&&n.push(s.assignTexture(e,"iridescenceMap",r.iridescenceTexture)),void 0!==r.iridescenceIor&&(e.iridescenceIOR=r.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==r.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),void 0!==r.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),void 0!==r.iridescenceThicknessTexture&&n.push(s.assignTexture(e,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(n)}}class f{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[];s.sheenColor=new t.Color(0,0,0),s.sheenRoughness=0,s.sheen=1;const o=n.extensions[this.name];if(void 0!==o.sheenColorFactor){const e=o.sheenColorFactor;s.sheenColor.setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace)}return void 0!==o.sheenRoughnessFactor&&(s.sheenRoughness=o.sheenRoughnessFactor),void 0!==o.sheenColorTexture&&r.push(i.assignTexture(s,"sheenColorMap",o.sheenColorTexture,t.SRGBColorSpace)),void 0!==o.sheenRoughnessTexture&&r.push(i.assignTexture(s,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(r)}}class l{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];return void 0!==r.transmissionFactor&&(e.transmission=r.transmissionFactor),void 0!==r.transmissionTexture&&n.push(s.assignTexture(e,"transmissionMap",r.transmissionTexture)),Promise.all(n)}}class d{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],o=n.extensions[this.name];s.thickness=void 0!==o.thicknessFactor?o.thicknessFactor:0,void 0!==o.thicknessTexture&&r.push(i.assignTexture(s,"thicknessMap",o.thicknessTexture)),s.attenuationDistance=o.attenuationDistance||1/0;const c=o.attenuationColor||[1,1,1];return s.attenuationColor=(new t.Color).setRGB(c[0],c[1],c[2],t.LinearSRGBColorSpace),Promise.all(r)}}class m{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const s=this.parser.json.materials[t];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name];return e.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class v{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(e,s){const i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],o=n.extensions[this.name];s.specularIntensity=void 0!==o.specularFactor?o.specularFactor:1,void 0!==o.specularTexture&&r.push(i.assignTexture(s,"specularIntensityMap",o.specularTexture));const c=o.specularColorFactor||[1,1,1];return s.specularColor=(new t.Color).setRGB(c[0],c[1],c[2],t.LinearSRGBColorSpace),void 0!==o.specularColorTexture&&r.push(i.assignTexture(s,"specularColorMap",o.specularColorTexture,t.SRGBColorSpace)),Promise.all(r)}}class w{constructor(t){this.parser=t,this.name=n.EXT_MATERIALS_BUMP}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];return e.bumpScale=void 0!==r.bumpFactor?r.bumpFactor:1,void 0!==r.bumpTexture&&n.push(s.assignTexture(e,"bumpMap",r.bumpTexture)),Promise.all(n)}}class T{constructor(t){this.parser=t,this.name=n.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return s.extensions&&s.extensions[this.name]?t.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const n=[],r=i.extensions[this.name];return void 0!==r.anisotropyStrength&&(e.anisotropy=r.anisotropyStrength),void 0!==r.anisotropyRotation&&(e.anisotropyRotation=r.anisotropyRotation),void 0!==r.anisotropyTexture&&n.push(s.assignTexture(e,"anisotropyMap",r.anisotropyTexture)),Promise.all(n)}}class _{constructor(t){this.parser=t,this.name=n.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,s=e.json,i=s.textures[t];if(!i.extensions||!i.extensions[this.name])return null;const n=i.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,n.source,r)}}class E{constructor(t){this.parser=t,this.name=n.EXT_TEXTURE_WEBP}loadTexture(t){const e=this.name,s=this.parser,i=s.json,n=i.textures[t];if(!n.extensions||!n.extensions[e])return null;const r=n.extensions[e],o=i.images[r.source];let c=s.textureLoader;if(o.uri){const t=s.options.manager.getHandler(o.uri);null!==t&&(c=t)}return s.loadTextureImage(t,r.source,c)}}class p{constructor(t){this.parser=t,this.name=n.EXT_TEXTURE_AVIF}loadTexture(t){const e=this.name,s=this.parser,i=s.json,n=i.textures[t];if(!n.extensions||!n.extensions[e])return null;const r=n.extensions[e],o=i.images[r.source];let c=s.textureLoader;if(o.uri){const t=s.options.manager.getHandler(o.uri);null!==t&&(c=t)}return s.loadTextureImage(t,r.source,c)}}class R{constructor(t){this.name=n.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,s=e.bufferViews[t];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(e){const s=t.byteOffset||0,i=t.byteLength||0,r=t.count,o=t.byteStride,c=new Uint8Array(e,s,i);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(r,o,c,t.mode,t.filter).then(function(t){return t.buffer}):n.ready.then(function(){const e=new ArrayBuffer(r*o);return n.decodeGltfBuffer(new Uint8Array(e),r,o,c,t.mode,t.filter),e})})}return null}}class A{constructor(t){this.name=n.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(e){const s=this.parser.json,i=s.nodes[e];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;const n=s.meshes[i.mesh];for(const t of n.primitives)if(t.mode!==N.TRIANGLES&&t.mode!==N.TRIANGLE_STRIP&&t.mode!==N.TRIANGLE_FAN&&void 0!==t.mode)return null;const r=i.extensions[this.name].attributes,o=[],c={};for(const t in r)o.push(this.parser.getDependency("accessor",r[t]).then(e=>(c[t]=e,c[t])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(e=>{const s=e.pop(),i=s.isGroup?s.children:[s],n=e[0].count,r=[];for(const e of i){const s=new t.Matrix4,i=new t.Vector3,o=new t.Quaternion,a=new t.Vector3(1,1,1),u=new t.InstancedMesh(e.geometry,e.material,n);for(let t=0;t<n;t++)c.TRANSLATION&&i.fromBufferAttribute(c.TRANSLATION,t),c.ROTATION&&o.fromBufferAttribute(c.ROTATION,t),c.SCALE&&a.fromBufferAttribute(c.SCALE,t),u.setMatrixAt(t,s.compose(i,o,a));for(const s in c)if("_COLOR_0"===s){const e=c[s];u.instanceColor=new t.InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==s&&"ROTATION"!==s&&"SCALE"!==s&&e.geometry.setAttribute(s,c[s]);t.Object3D.prototype.copy.call(u,e),this.parser.assignFinalMaterial(u),r.push(u)}return s.isGroup?(s.clear(),s.add(...r),s):r[0]}))}}const P="glTF",M=1313821514,L=5130562;class g{constructor(t){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,12),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==P)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(t,12);let o=0;for(;o<i;){const e=r.getUint32(o,!0);o+=4;const i=r.getUint32(o,!0);if(o+=4,i===M){const i=new Uint8Array(t,12+o,e);this.content=s.decode(i)}else if(i===L){const s=12+o;this.body=t.slice(s,s+e)}o+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class I{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(e,s){const i=this.json,n=this.dracoLoader,r=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,c={},a={},u={};for(const t in o){const e=C[t]||t.toLowerCase();c[e]=o[t]}for(const t in e.attributes){const s=C[t]||t.toLowerCase();if(void 0!==o[t]){const n=i.accessors[e.attributes[t]],r=x[n.componentType];u[s]=r.name,a[s]=!0===n.normalized}}return s.getDependency("bufferView",r).then(function(e){return new Promise(function(s,i){n.decodeDracoFile(e,function(t){for(const e in t.attributes){const s=t.attributes[e],i=a[e];void 0!==i&&(s.normalized=i)}s(t)},c,u,t.LinearSRGBColorSpace,i)})})}}class S{constructor(){this.name=n.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}class y{constructor(){this.name=n.KHR_MESH_QUANTIZATION}}class b extends t.Interpolant{constructor(t,e,s,i){super(t,e,s,i)}copySampleValue_(t){const e=this.resultBuffer,s=this.sampleValues,i=this.valueSize,n=t*i*3+i;for(let t=0;t!==i;t++)e[t]=s[n+t];return e}interpolate_(t,e,s,i){const n=this.resultBuffer,r=this.sampleValues,o=this.valueSize,c=2*o,a=3*o,u=i-e,h=(s-e)/u,f=h*h,l=f*h,d=t*a,m=d-a,v=-2*l+3*f,w=l-f,T=1-v,_=w-f+h;for(let t=0;t!==o;t++){const e=r[m+t+o],s=r[m+t+c]*u,i=r[d+t+o],a=r[d+t]*u;n[t]=T*e+_*s+v*i+w*a}return n}}const O=new t.Quaternion;class H extends b{interpolate_(t,e,s,i){const n=super.interpolate_(t,e,s,i);return O.fromArray(n).normalize().toArray(n),n}}const N={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},x={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},k={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},K={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},U={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},C={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"},F={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},G={CUBICSPLINE:void 0,LINEAR:t.InterpolateLinear,STEP:t.InterpolateDiscrete},D="OPAQUE",V="MASK",X="BLEND";function B(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),e.DefaultMaterial}function j(t,e,s){for(const i in s.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=s.extensions[i])}function q(t,e){void 0!==e.extras&&"object"==typeof e.extras&&Object.assign(t.userData,e.extras)}function J(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let s=0,i=e.weights.length;s<i;s++)t.morphTargetInfluences[s]=e.weights[s];if(e.extras&&Array.isArray(e.extras.targetNames)){const s=e.extras.targetNames;if(t.morphTargetInfluences.length===s.length){t.morphTargetDictionary={};for(let e=0,i=s.length;e<i;e++)t.morphTargetDictionary[s[e]]=e}}}function z(t){let e;const s=t.extensions&&t.extensions[n.KHR_DRACO_MESH_COMPRESSION];if(e=s?"draco:"+s.bufferView+":"+s.indices+":"+W(s.attributes):t.indices+":"+W(t.attributes)+":"+t.mode,void 0!==t.targets)for(let s=0,i=t.targets.length;s<i;s++)e+=":"+W(t.targets[s]);return e}function W(t){let e="";const s=Object.keys(t).sort();for(let i=0,n=s.length;i<n;i++)e+=s[i]+":"+t[s[i]]+";";return e}function Y(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const $=new t.Matrix4;class Q{constructor(e={},s={}){this.json=e,this.extensions={},this.plugins={},this.options=s,this.cache=new i,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,o=!1,c=-1;if("undefined"!=typeof navigator){const t=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(t);const e=t.match(/Version\/(\d+)/);r=n&&e?parseInt(e[1],10):-1,o=t.indexOf("Firefox")>-1,c=o?t.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&r<17||o&&c<98?this.textureLoader=new t.TextureLoader(this.options.manager):this.textureLoader=new t.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const s=this,i=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this.l(function(t){return t.i&&t.i()}),Promise.all(this.l(function(t){return t.beforeRoot&&t.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(e){const r={scene:e[0][i.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:i.asset,parser:s,userData:{}};return j(n,r,i),q(r,i),Promise.all(s.l(function(t){return t.afterRoot&&t.afterRoot(r)})).then(function(){for(const t of r.scenes)t.updateMatrixWorld();t(r)})}).catch(e)}i(){const t=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let s=0,i=e.length;s<i;s++){const i=e[s].joints;for(let e=0,s=i.length;e<s;e++)t[i[e]].isBone=!0}for(let e=0,i=t.length;e<i;e++){const i=t[e];void 0!==i.mesh&&(this.o(this.meshCache,i.mesh),void 0!==i.skin&&(s[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this.o(this.cameraCache,i.camera)}}o(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}h(t,e,s){if(t.refs[e]<=1)return s;const i=s.clone(),n=(t,e)=>{const s=this.associations.get(t);null!=s&&this.associations.set(e,s);for(const[s,i]of t.children.entries())n(i,e.children[s])};return n(s,i),i.name+="_instance_"+t.uses[e]++,i}m(t){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const i=t(e[s]);if(i)return i}return null}l(t){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let i=0;i<e.length;i++){const n=t(e[i]);n&&s.push(n)}return s}getDependency(t,e){const s=t+":"+e;let i=this.cache.get(s);if(!i){switch(t){case"scene":i=this.loadScene(e);break;case"node":i=this.m(function(t){return t.loadNode&&t.loadNode(e)});break;case"mesh":i=this.m(function(t){return t.loadMesh&&t.loadMesh(e)});break;case"accessor":i=this.loadAccessor(e);break;case"bufferView":i=this.m(function(t){return t.loadBufferView&&t.loadBufferView(e)});break;case"buffer":i=this.loadBuffer(e);break;case"material":i=this.m(function(t){return t.loadMaterial&&t.loadMaterial(e)});break;case"texture":i=this.m(function(t){return t.loadTexture&&t.loadTexture(e)});break;case"skin":i=this.loadSkin(e);break;case"animation":i=this.m(function(t){return t.loadAnimation&&t.loadAnimation(e)});break;case"camera":i=this.loadCamera(e);break;default:if(i=this.m(function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)}),!i)throw new Error("Unknown type: "+t)}this.cache.add(s,i)}return i}getDependencies(t){let e=this.cache.get(t);if(!e){const s=this,i=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(i.map(function(e,i){return s.getDependency(t,i)})),this.cache.add(t,e)}return e}loadBuffer(e){const s=this.json.buffers[e],i=this.fileLoader;if(s.type&&"arraybuffer"!==s.type)throw new Error("THREE.GLTFLoader: "+s.type+" buffer type is not supported.");if(void 0===s.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(e,n){i.load(t.LoaderUtils.resolveURL(s.uri,r.path),e,void 0,function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+s.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(t){const s=e.byteLength||0,i=e.byteOffset||0;return t.slice(i,i+s)})}loadAccessor(e){const s=this,i=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse){const e=U[n.type],s=x[n.componentType],i=!0===n.normalized,r=new s(n.count*e);return Promise.resolve(new t.BufferAttribute(r,e,i))}const r=[];return void 0!==n.bufferView?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),void 0!==n.sparse&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(e){const r=e[0],o=U[n.type],c=x[n.componentType],a=c.BYTES_PER_ELEMENT,u=a*o,h=n.byteOffset||0,f=void 0!==n.bufferView?i.bufferViews[n.bufferView].byteStride:void 0,l=!0===n.normalized;let d,m;if(f&&f!==u){const e=Math.floor(h/f),i="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+e+":"+n.count;let u=s.cache.get(i);u||(d=new c(r,e*f,n.count*f/a),u=new t.InterleavedBuffer(d,f/a),s.cache.add(i,u)),m=new t.InterleavedBufferAttribute(u,o,h%f/a,l)}else d=null===r?new c(n.count*o):new c(r,h,n.count*o),m=new t.BufferAttribute(d,o,l);if(void 0!==n.sparse){const s=U.SCALAR,i=x[n.sparse.indices.componentType],a=n.sparse.indices.byteOffset||0,u=n.sparse.values.byteOffset||0,h=new i(e[1],a,n.sparse.count*s),f=new c(e[2],u,n.sparse.count*o);null!==r&&(m=new t.BufferAttribute(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(m.setX(e,f[t*o]),o>=2&&m.setY(e,f[t*o+1]),o>=3&&m.setZ(e,f[t*o+2]),o>=4&&m.setW(e,f[t*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=l}return m})}loadTexture(t){const e=this.json,s=this.options,i=e.textures[t].source,n=e.images[i];let r=this.textureLoader;if(n.uri){const t=s.manager.getHandler(n.uri);null!==t&&(r=t)}return this.loadTextureImage(t,i,r)}loadTextureImage(e,s,i){const n=this,r=this.json,o=r.textures[e],c=r.images[s],a=(c.uri||c.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];const u=this.loadImageSource(s,i).then(function(s){s.flipY=!1,s.name=o.name||c.name||"",""===s.name&&"string"==typeof c.uri&&!1===c.uri.startsWith("data:image/")&&(s.name=c.uri);const i=(r.samplers||{})[o.sampler]||{};return s.magFilter=k[i.magFilter]||t.LinearFilter,s.minFilter=k[i.minFilter]||t.LinearMipmapLinearFilter,s.wrapS=K[i.wrapS]||t.RepeatWrapping,s.wrapT=K[i.wrapT]||t.RepeatWrapping,s.generateMipmaps=!s.isCompressedTexture&&s.minFilter!==t.NearestFilter&&s.minFilter!==t.LinearFilter,n.associations.set(s,{textures:e}),s}).catch(function(){return null});return this.textureCache[a]=u,u}loadImageSource(e,s){const i=this,n=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(t=>t.clone());const o=n.images[e],c=self.URL||self.webkitURL;let a=o.uri||"",u=!1;if(void 0!==o.bufferView)a=i.getDependency("bufferView",o.bufferView).then(function(t){u=!0;const e=new Blob([t],{type:o.mimeType});return a=c.createObjectURL(e),a});else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(a).then(function(e){return new Promise(function(i,n){let o=i;!0===s.isImageBitmapLoader&&(o=function(e){const s=new t.Texture(e);s.needsUpdate=!0,i(s)}),s.load(t.LoaderUtils.resolveURL(e,r.path),o,void 0,n)})}).then(function(t){var e;return!0===u&&c.revokeObjectURL(a),q(t,o),t.userData.mimeType=o.mimeType||((e=o.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":e.search(/\.ktx2($|\?)/i)>0||0===e.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),t}).catch(function(t){throw t});return this.sourceCache[e]=h,h}assignTexture(t,e,s,i){const r=this;return this.getDependency("texture",s.index).then(function(o){if(!o)return null;if(void 0!==s.texCoord&&s.texCoord>0&&((o=o.clone()).channel=s.texCoord),r.extensions[n.KHR_TEXTURE_TRANSFORM]){const t=void 0!==s.extensions?s.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(o);o=r.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(o,t),r.associations.set(o,e)}}return void 0!==i&&(o.colorSpace=i),t[e]=o,o})}assignFinalMaterial(e){const s=e.geometry;let i=e.material;const n=void 0===s.attributes.tangent,r=void 0!==s.attributes.color,o=void 0===s.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+i.uuid;let s=this.cache.get(e);s||(s=new t.PointsMaterial,t.Material.prototype.copy.call(s,i),s.color.copy(i.color),s.map=i.map,s.sizeAttenuation=!1,this.cache.add(e,s)),i=s}else if(e.isLine){const e="LineBasicMaterial:"+i.uuid;let s=this.cache.get(e);s||(s=new t.LineBasicMaterial,t.Material.prototype.copy.call(s,i),s.color.copy(i.color),s.map=i.map,this.cache.add(e,s)),i=s}if(n||r||o){let t="ClonedMaterial:"+i.uuid+":";n&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),o&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=i.clone(),r&&(e.vertexColors=!0),o&&(e.flatShading=!0),n&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(i))),i=e}e.material=i}getMaterialType(){return t.MeshStandardMaterial}loadMaterial(e){const s=this,i=this.json,r=this.extensions,o=i.materials[e];let c;const a={},u=[];if((o.extensions||{})[n.KHR_MATERIALS_UNLIT]){const t=r[n.KHR_MATERIALS_UNLIT];c=t.getMaterialType(),u.push(t.extendParams(a,o,s))}else{const i=o.pbrMetallicRoughness||{};if(a.color=new t.Color(1,1,1),a.opacity=1,Array.isArray(i.baseColorFactor)){const e=i.baseColorFactor;a.color.setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace),a.opacity=e[3]}void 0!==i.baseColorTexture&&u.push(s.assignTexture(a,"map",i.baseColorTexture,t.SRGBColorSpace)),a.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,a.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(u.push(s.assignTexture(a,"metalnessMap",i.metallicRoughnessTexture)),u.push(s.assignTexture(a,"roughnessMap",i.metallicRoughnessTexture))),c=this.m(function(t){return t.getMaterialType&&t.getMaterialType(e)}),u.push(Promise.all(this.l(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,a)})))}!0===o.doubleSided&&(a.side=t.DoubleSide);const h=o.alphaMode||D;if(h===X?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===V&&(a.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&c!==t.MeshBasicMaterial&&(u.push(s.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new t.Vector2(1,1),void 0!==o.normalTexture.scale)){const t=o.normalTexture.scale;a.normalScale.set(t,t)}if(void 0!==o.occlusionTexture&&c!==t.MeshBasicMaterial&&(u.push(s.assignTexture(a,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(a.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&c!==t.MeshBasicMaterial){const e=o.emissiveFactor;a.emissive=(new t.Color).setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace)}return void 0!==o.emissiveTexture&&c!==t.MeshBasicMaterial&&u.push(s.assignTexture(a,"emissiveMap",o.emissiveTexture,t.SRGBColorSpace)),Promise.all(u).then(function(){const t=new c(a);return o.name&&(t.name=o.name),q(t,o),s.associations.set(t,{materials:e}),o.extensions&&j(r,t,o),t})}createUniqueName(e){const s=t.PropertyBinding.sanitizeNodeName(e||"");return s in this.nodeNamesUsed?s+"_"+ ++this.nodeNamesUsed[s]:(this.nodeNamesUsed[s]=0,s)}loadGeometries(e){const s=this,i=this.extensions,r=this.primitiveCache;function o(t){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,s).then(function(e){return Z(e,t,s)})}const c=[];for(let i=0,a=e.length;i<a;i++){const a=e[i],u=z(a),h=r[u];if(h)c.push(h.promise);else{let e;e=a.extensions&&a.extensions[n.KHR_DRACO_MESH_COMPRESSION]?o(a):Z(new t.BufferGeometry,a,s),r[u]={primitive:a,promise:e},c.push(e)}}return Promise.all(c)}loadMesh(s){const i=this,n=this.json,r=this.extensions,o=n.meshes[s],c=o.primitives,a=[];for(let t=0,e=c.length;t<e;t++){const e=void 0===c[t].material?B(this.cache):this.getDependency("material",c[t].material);a.push(e)}return a.push(i.loadGeometries(c)),Promise.all(a).then(function(n){const a=n.slice(0,n.length-1),u=n[n.length-1],h=[];for(let n=0,f=u.length;n<f;n++){const f=u[n],l=c[n];let d;const m=a[n];if(l.mode===N.TRIANGLES||l.mode===N.TRIANGLE_STRIP||l.mode===N.TRIANGLE_FAN||void 0===l.mode)d=!0===o.isSkinnedMesh?new t.SkinnedMesh(f,m):new t.Mesh(f,m),!0===d.isSkinnedMesh&&d.normalizeSkinWeights(),l.mode===N.TRIANGLE_STRIP?d.geometry=e.toTrianglesDrawMode(d.geometry,t.TriangleStripDrawMode):l.mode===N.TRIANGLE_FAN&&(d.geometry=e.toTrianglesDrawMode(d.geometry,t.TriangleFanDrawMode));else if(l.mode===N.LINES)d=new t.LineSegments(f,m);else if(l.mode===N.LINE_STRIP)d=new t.Line(f,m);else if(l.mode===N.LINE_LOOP)d=new t.LineLoop(f,m);else{if(l.mode!==N.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+l.mode);d=new t.Points(f,m)}Object.keys(d.geometry.morphAttributes).length>0&&J(d,o),d.name=i.createUniqueName(o.name||"mesh_"+s),q(d,o),l.extensions&&j(r,d,l),i.assignFinalMaterial(d),h.push(d)}for(let t=0,e=h.length;t<e;t++)i.associations.set(h[t],{meshes:s,primitives:t});if(1===h.length)return o.extensions&&j(r,h[0],o),h[0];const f=new t.Group;o.extensions&&j(r,f,o),i.associations.set(f,{meshes:s});for(let t=0,e=h.length;t<e;t++)f.add(h[t]);return f})}loadCamera(e){let s;const i=this.json.cameras[e],n=i[i.type];if(n)return"perspective"===i.type?s=new t.PerspectiveCamera(t.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===i.type&&(s=new t.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(s.name=this.createUniqueName(i.name)),q(s,i),Promise.resolve(s)}loadSkin(e){const s=this.json.skins[e],i=[];for(let t=0,e=s.joints.length;t<e;t++)i.push(this.v(s.joints[t]));return void 0!==s.inverseBindMatrices?i.push(this.getDependency("accessor",s.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(e){const s=e.pop(),i=e,n=[],r=[];for(let e=0,o=i.length;e<o;e++){const o=i[e];if(o){n.push(o);const i=new t.Matrix4;null!==s&&i.fromArray(s.array,16*e),r.push(i)}}return new t.Skeleton(n,r)})}loadAnimation(e){const s=this.json,i=this,n=s.animations[e],r=n.name?n.name:"animation_"+e,o=[],c=[],a=[],u=[],h=[];for(let t=0,e=n.channels.length;t<e;t++){const e=n.channels[t],s=n.samplers[e.sampler],i=e.target,r=i.node,f=void 0!==n.parameters?n.parameters[s.input]:s.input,l=void 0!==n.parameters?n.parameters[s.output]:s.output;void 0!==i.node&&(o.push(this.getDependency("node",r)),c.push(this.getDependency("accessor",f)),a.push(this.getDependency("accessor",l)),u.push(s),h.push(i))}return Promise.all([Promise.all(o),Promise.all(c),Promise.all(a),Promise.all(u),Promise.all(h)]).then(function(e){const s=e[0],n=e[1],o=e[2],c=e[3],a=e[4],u=[];for(let t=0,e=s.length;t<e;t++){const e=s[t],r=n[t],h=o[t],f=c[t],l=a[t];if(void 0===e)continue;e.updateMatrix&&e.updateMatrix();const d=i.T(e,r,h,f,l);if(d)for(let t=0;t<d.length;t++)u.push(d[t])}return new t.AnimationClip(r,void 0,u)})}createNodeMesh(t){const e=this.json,s=this,i=e.nodes[t];return void 0===i.mesh?null:s.getDependency("mesh",i.mesh).then(function(t){const e=s.h(s.meshCache,i.mesh,t);return void 0!==i.weights&&e.traverse(function(t){if(t.isMesh)for(let e=0,s=i.weights.length;e<s;e++)t.morphTargetInfluences[e]=i.weights[e]}),e})}loadNode(t){const e=this,s=this.json.nodes[t],i=e.v(t),n=[],r=s.children||[];for(let t=0,s=r.length;t<s;t++)n.push(e.getDependency("node",r[t]));const o=void 0===s.skin?Promise.resolve(null):e.getDependency("skin",s.skin);return Promise.all([i,Promise.all(n),o]).then(function(t){const e=t[0],s=t[1],i=t[2];null!==i&&e.traverse(function(t){t.isSkinnedMesh&&t.bind(i,$)});for(let t=0,i=s.length;t<i;t++)e.add(s[t]);return e})}v(e){const s=this.json,i=this.extensions,n=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=s.nodes[e],o=r.name?n.createUniqueName(r.name):"",c=[],a=n.m(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return a&&c.push(a),void 0!==r.camera&&c.push(n.getDependency("camera",r.camera).then(function(t){return n.h(n.cameraCache,r.camera,t)})),n.l(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(t){c.push(t)}),this.nodeCache[e]=Promise.all(c).then(function(s){let c;if(c=!0===r.isBone?new t.Bone:s.length>1?new t.Group:1===s.length?s[0]:new t.Object3D,c!==s[0])for(let t=0,e=s.length;t<e;t++)c.add(s[t]);if(r.name&&(c.userData.name=r.name,c.name=o),q(c,r),r.extensions&&j(i,c,r),void 0!==r.matrix){const e=new t.Matrix4;e.fromArray(r.matrix),c.applyMatrix4(e)}else void 0!==r.translation&&c.position.fromArray(r.translation),void 0!==r.rotation&&c.quaternion.fromArray(r.rotation),void 0!==r.scale&&c.scale.fromArray(r.scale);if(n.associations.has(c)){if(void 0!==r.mesh&&n.meshCache.refs[r.mesh]>1){const t=n.associations.get(c);n.associations.set(c,{...t})}}else n.associations.set(c,{});return n.associations.get(c).nodes=e,c}),this.nodeCache[e]}loadScene(e){const s=this.extensions,i=this.json.scenes[e],n=this,r=new t.Group;i.name&&(r.name=n.createUniqueName(i.name)),q(r,i),i.extensions&&j(s,r,i);const o=i.nodes||[],c=[];for(let t=0,e=o.length;t<e;t++)c.push(n.getDependency("node",o[t]));return Promise.all(c).then(function(e){for(let t=0,s=e.length;t<s;t++)r.add(e[t]);return n.associations=(e=>{const s=new Map;for(const[e,i]of n.associations)(e instanceof t.Material||e instanceof t.Texture)&&s.set(e,i);return e.traverse(t=>{const e=n.associations.get(t);null!=e&&s.set(t,e)}),s})(r),r})}T(e,s,i,n,r){const o=[],c=e.name?e.name:e.uuid,a=[];let u;switch(F[r.path]===F.weights?e.traverse(function(t){t.morphTargetInfluences&&a.push(t.name?t.name:t.uuid)}):a.push(c),F[r.path]){case F.weights:u=t.NumberKeyframeTrack;break;case F.rotation:u=t.QuaternionKeyframeTrack;break;case F.translation:case F.scale:u=t.VectorKeyframeTrack;break;default:if(1===i.itemSize)u=t.NumberKeyframeTrack;else u=t.VectorKeyframeTrack}const h=void 0!==n.interpolation?G[n.interpolation]:t.InterpolateLinear,f=this._(i);for(let t=0,e=a.length;t<e;t++){const e=new u(a[t]+"."+F[r.path],s.array,f,h);"CUBICSPLINE"===n.interpolation&&this.p(e),o.push(e)}return o}_(t){let e=t.array;if(t.normalized){const t=Y(e.constructor),s=new Float32Array(e.length);for(let i=0,n=e.length;i<n;i++)s[i]=e[i]*t;e=s}return e}p(e){e.createInterpolant=function(e){return new(this instanceof t.QuaternionKeyframeTrack?H:b)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Z(e,s,i){const n=s.attributes,r=[];function o(t,s){return i.getDependency("accessor",t).then(function(t){e.setAttribute(s,t)})}for(const t in n){const s=C[t]||t.toLowerCase();s in e.attributes||r.push(o(n[t],s))}if(void 0!==s.indices&&!e.index){const t=i.getDependency("accessor",s.indices).then(function(t){e.setIndex(t)});r.push(t)}return t.ColorManagement.workingColorSpace,t.LinearSRGBColorSpace,q(e,s),function(e,s,i){const n=s.attributes,r=new t.Box3;if(void 0===n.POSITION)return;{const e=i.json.accessors[n.POSITION],s=e.min,o=e.max;if(void 0===s||void 0===o)return;if(r.set(new t.Vector3(s[0],s[1],s[2]),new t.Vector3(o[0],o[1],o[2])),e.normalized){const t=Y(x[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const o=s.targets;if(void 0!==o){const e=new t.Vector3,s=new t.Vector3;for(let t=0,n=o.length;t<n;t++){const n=o[t];if(void 0!==n.POSITION){const t=i.json.accessors[n.POSITION],r=t.min,o=t.max;if(void 0!==r&&void 0!==o){if(s.setX(Math.max(Math.abs(r[0]),Math.abs(o[0]))),s.setY(Math.max(Math.abs(r[1]),Math.abs(o[1]))),s.setZ(Math.max(Math.abs(r[2]),Math.abs(o[2]))),t.normalized){const e=Y(x[t.componentType]);s.multiplyScalar(e)}e.max(s)}}}r.expandByVector(e)}e.boundingBox=r;const c=new t.Sphere;r.getCenter(c.center),c.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=c}(e,s,i),Promise.all(r).then(function(){return void 0!==s.targets?function(t,e,s){let i=!1,n=!1,r=!1;for(let t=0,s=e.length;t<s;t++){const s=e[t];if(void 0!==s.POSITION&&(i=!0),void 0!==s.NORMAL&&(n=!0),void 0!==s.COLOR_0&&(r=!0),i&&n&&r)break}if(!i&&!n&&!r)return Promise.resolve(t);const o=[],c=[],a=[];for(let u=0,h=e.length;u<h;u++){const h=e[u];if(i){const e=void 0!==h.POSITION?s.getDependency("accessor",h.POSITION):t.attributes.position;o.push(e)}if(n){const e=void 0!==h.NORMAL?s.getDependency("accessor",h.NORMAL):t.attributes.normal;c.push(e)}if(r){const e=void 0!==h.COLOR_0?s.getDependency("accessor",h.COLOR_0):t.attributes.color;a.push(e)}}return Promise.all([Promise.all(o),Promise.all(c),Promise.all(a)]).then(function(e){const s=e[0],o=e[1],c=e[2];return i&&(t.morphAttributes.position=s),n&&(t.morphAttributes.normal=o),r&&(t.morphAttributes.color=c),t.morphTargetsRelative=!0,t})}(e,s.targets,i):e})}exports.GLTFLoader=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("three");class r extends t.DataTextureLoader{constructor(r){super(r),this.type=t.HalfFloatType}parse(r){const e=function(t,r){return-1},n=function(t,r,e){r=r||1024;let n=t.pos,s=-1,a=0,i="",o=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));for(;0>(s=o.indexOf("\n"))&&a<r&&n<t.byteLength;)i+=o,a+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));return-1<s&&(!1!==e&&(t.pos+=a+s+1),i+o.slice(0,s))},s=function(t,r,e,n){const s=t[r+3],a=Math.pow(2,s-128)/255;e[n+0]=t[r+0]*a,e[n+1]=t[r+1]*a,e[n+2]=t[r+2]*a,e[n+3]=1},a=function(r,e,n,s){const a=r[e+3],i=Math.pow(2,a-128)/255;n[s+0]=t.DataUtils.toHalfFloat(Math.min(r[e+0]*i,65504)),n[s+1]=t.DataUtils.toHalfFloat(Math.min(r[e+1]*i,65504)),n[s+2]=t.DataUtils.toHalfFloat(Math.min(r[e+2]*i,65504)),n[s+3]=t.DataUtils.toHalfFloat(1)},i=new Uint8Array(r);i.pos=0;const o=function(t){const r=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,e=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,a=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,i={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let o,u;if(t.pos>=t.byteLength||!(o=n(t)))return-1;if(!(u=o.match(/^#\?(\S+)/)))return-1;for(i.valid|=1,i.programtype=u[1],i.string+=o+"\n";o=n(t),!1!==o;)if(i.string+=o+"\n","#"!==o.charAt(0)){if((u=o.match(r))&&(i.gamma=parseFloat(u[1])),(u=o.match(e))&&(i.exposure=parseFloat(u[1])),(u=o.match(s))&&(i.valid|=2,i.format=u[1]),(u=o.match(a))&&(i.valid|=4,i.height=parseInt(u[1],10),i.width=parseInt(u[2],10)),2&i.valid&&4&i.valid)break}else i.comments+=o+"\n";return 2&i.valid&&4&i.valid?i:-1}(i);if(-1!==o){const r=o.width,n=o.height,u=function(t,r,n){const s=r;if(s<8||s>32767||2!==t[0]||2!==t[1]||128&t[2])return new Uint8Array(t);if(s!==(t[2]<<8|t[3]))return-1;const a=new Uint8Array(4*r*n);if(!a.length)return-1;let i=0,o=0;const u=4*s,c=new Uint8Array(4),f=new Uint8Array(u);let l=n;for(;l>0&&o<t.byteLength;){if(o+4>t.byteLength)return e();if(c[0]=t[o++],c[1]=t[o++],c[2]=t[o++],c[3]=t[o++],2!=c[0]||2!=c[1]||(c[2]<<8|c[3])!=s)return e();let r,n=0;for(;n<u&&o<t.byteLength;){r=t[o++];const s=r>128;if(s&&(r-=128),0===r||n+r>u)return e();if(s){const e=t[o++];for(let t=0;t<r;t++)f[n++]=e}else f.set(t.subarray(o,o+r),n),n+=r,o+=r}const h=s;for(let t=0;t<h;t++){let r=0;a[i]=f[t+r],r+=s,a[i+1]=f[t+r],r+=s,a[i+2]=f[t+r],r+=s,a[i+3]=f[t+r],i+=4}l--}return a}(i.subarray(i.pos),r,n);if(-1!==u){let e,i,c;switch(this.type){case t.FloatType:c=u.length/4;const r=new Float32Array(4*c);for(let t=0;t<c;t++)s(u,4*t,r,4*t);e=r,i=t.FloatType;break;case t.HalfFloatType:c=u.length/4;const n=new Uint16Array(4*c);for(let t=0;t<c;t++)a(u,4*t,n,4*t);e=n,i=t.HalfFloatType}return{width:r,height:n,data:e,header:o.string,gamma:o.gamma,exposure:o.exposure,type:i}}}return null}setDataType(t){return this.type=t,this}load(r,e,n,s){return super.load(r,function(r,n){switch(r.type){case t.FloatType:case t.HalfFloatType:r.encoding=t.LinearEncoding,r.minFilter=t.LinearFilter,r.magFilter=t.LinearFilter,r.generateMipmaps=!1,r.flipY=!0}e&&e(r,n)},n,s)}}exports.RGBELoader=r;
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var r=require("three");class e extends r.DataTextureLoader{constructor(e){super(e),this.type=r.HalfFloatType}parse(e){const t=function(r,e){switch(r){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(e||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(e||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(e||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(e||""))}},n=function(r,e,t){e=e||1024;let n=r.pos,s=-1,a=0,o="",i=String.fromCharCode.apply(null,new Uint16Array(r.subarray(n,n+128)));for(;0>(s=i.indexOf("\n"))&&a<e&&n<r.byteLength;)o+=i,a+=i.length,n+=128,i+=String.fromCharCode.apply(null,new Uint16Array(r.subarray(n,n+128)));return-1<s&&(!1!==t&&(r.pos+=a+s+1),o+i.slice(0,s))},s=function(r,e,t,n){const s=r[e+3],a=Math.pow(2,s-128)/255;t[n+0]=r[e+0]*a,t[n+1]=r[e+1]*a,t[n+2]=r[e+2]*a,t[n+3]=1},a=function(e,t,n,s){const a=e[t+3],o=Math.pow(2,a-128)/255;n[s+0]=r.DataUtils.toHalfFloat(Math.min(e[t+0]*o,65504)),n[s+1]=r.DataUtils.toHalfFloat(Math.min(e[t+1]*o,65504)),n[s+2]=r.DataUtils.toHalfFloat(Math.min(e[t+2]*o,65504)),n[s+3]=r.DataUtils.toHalfFloat(1)},o=new Uint8Array(e);o.pos=0;const i=function(r){const e=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,i={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let c,l;for((r.pos>=r.byteLength||!(c=n(r)))&&t(1,"no header found"),(l=c.match(/^#\?(\S+)/))||t(3,"bad initial token"),i.valid|=1,i.programtype=l[1],i.string+=c+"\n";c=n(r),!1!==c;)if(i.string+=c+"\n","#"!==c.charAt(0)){if((l=c.match(e))&&(i.gamma=parseFloat(l[1])),(l=c.match(s))&&(i.exposure=parseFloat(l[1])),(l=c.match(a))&&(i.valid|=2,i.format=l[1]),(l=c.match(o))&&(i.valid|=4,i.height=parseInt(l[1],10),i.width=parseInt(l[2],10)),2&i.valid&&4&i.valid)break}else i.comments+=c+"\n";return 2&i.valid||t(3,"missing format specifier"),4&i.valid||t(3,"missing image size specifier"),i}(o),c=i.width,l=i.height,d=function(r,e,n){const s=e;if(s<8||s>32767||2!==r[0]||2!==r[1]||128&r[2])return new Uint8Array(r);s!==(r[2]<<8|r[3])&&t(3,"wrong scanline width");const a=new Uint8Array(4*e*n);a.length||t(4,"unable to allocate buffer space");let o=0,i=0;const c=4*s,l=new Uint8Array(4),d=new Uint8Array(c);let u=n;for(;u>0&&i<r.byteLength;){i+4>r.byteLength&&t(1),l[0]=r[i++],l[1]=r[i++],l[2]=r[i++],l[3]=r[i++],2==l[0]&&2==l[1]&&(l[2]<<8|l[3])==s||t(3,"bad rgbe scanline format");let e,n=0;for(;n<c&&i<r.byteLength;){e=r[i++];const s=e>128;if(s&&(e-=128),(0===e||n+e>c)&&t(3,"bad scanline data"),s){const t=r[i++];for(let r=0;r<e;r++)d[n++]=t}else d.set(r.subarray(i,i+e),n),n+=e,i+=e}const f=s;for(let r=0;r<f;r++){let e=0;a[o]=d[r+e],e+=s,a[o+1]=d[r+e],e+=s,a[o+2]=d[r+e],e+=s,a[o+3]=d[r+e],o+=4}u--}return a}(o.subarray(o.pos),c,l);let u,f,h;switch(this.type){case r.FloatType:h=d.length/4;const e=new Float32Array(4*h);for(let r=0;r<h;r++)s(d,4*r,e,4*r);u=e,f=r.FloatType;break;case r.HalfFloatType:h=d.length/4;const t=new Uint16Array(4*h);for(let r=0;r<h;r++)a(d,4*r,t,4*r);u=t,f=r.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:c,height:l,data:u,header:i.string,gamma:i.gamma,exposure:i.exposure,type:f}}setDataType(r){return this.type=r,this}load(e,t,n,s){return super.load(e,function(e,n){switch(e.type){case r.FloatType:case r.HalfFloatType:e.colorSpace=r.LinearSRGBColorSpace,e.minFilter=r.LinearFilter,e.magFilter=r.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,n)},n,s)}}exports.RGBELoader=e;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var t=require("three");class n extends t.Object3D{constructor(n=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=n,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new t.Vector2(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof t.element.ownerDocument.defaultView.Element&&null!==t.element.parentNode&&t.element.remove()})})}copy(t,n){return super.copy(t,n),this.element=t.element.cloneNode(!0),this.center=t.center,this}}const e=new t.Vector3,s=new t.Matrix4,o=new t.Matrix4,i=new t.Vector3,r=new t.Vector3;exports.CSS2DObject=n,exports.CSS2DRenderer=class{constructor(t={}){const n=this;let c,u,h,f;const a={objects:new WeakMap},l=void 0!==t.element?t.element:document.createElement("div");function d(t){t.isCSS2DObject&&(t.element.style.display="none");for(let n=0,e=t.children.length;n<e;n++)d(t.children[n])}function p(t,s,i){if(!1!==t.visible){if(t.isCSS2DObject){e.setFromMatrixPosition(t.matrixWorld),e.applyMatrix4(o);const r=e.z>=-1&&e.z<=1&&!0===t.layers.test(i.layers),c=t.element;c.style.display=!0===r?"":"none",!0===r&&(t.onBeforeRender(n,s,i),c.style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(e.x*h+h)+"px,"+(-e.y*f+f)+"px)",c.parentNode!==l&&l.appendChild(c),t.onAfterRender(n,s,i));const u={distanceToCameraSquared:w(i,t)};a.objects.set(t,u)}for(let n=0,e=t.children.length;n<e;n++)p(t.children[n],s,i)}else d(t)}function w(t,n){return i.setFromMatrixPosition(t.matrixWorld),r.setFromMatrixPosition(n.matrixWorld),i.distanceToSquared(r)}l.style.overflow="hidden",this.domElement=l,this.getSize=function(){return{width:c,height:u}},this.render=function(t,n){!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===n.parent&&!0===n.matrixWorldAutoUpdate&&n.updateMatrixWorld(),s.copy(n.matrixWorldInverse),o.multiplyMatrices(n.projectionMatrix,s),p(t,t,n),function(t){const n=function(t){const n=[];return t.traverseVisible(function(t){t.isCSS2DObject&&n.push(t)}),n}(t).sort(function(t,n){if(t.renderOrder!==n.renderOrder)return n.renderOrder-t.renderOrder;return a.objects.get(t).distanceToCameraSquared-a.objects.get(n).distanceToCameraSquared}),e=n.length;for(let t=0,s=n.length;t<s;t++)n[t].element.style.zIndex=e-t}(t)},this.setSize=function(t,n){c=t,u=n,h=c/2,f=u/2,l.style.width=t+"px",l.style.height=n+"px"}}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("three"),n=require("../core/debugLogger.js");function i(e){if(e&&e.t)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var a=i(t),r=function(){return e.createClass(function t(){e.classCallCheck(this,t),this.analysisHistory=[],this.validationRules=new Map,this.adjustmentStrategies=new Map,this.initializeDefaultRules()},[{key:"initializeDefaultRules",value:function(){this.addValidationRule("component_bounds",{check:function(e){var t=(new a.Box3).setFromObject(e);return!t.isEmpty()&&t.getSize(new a.Vector3).length()>0},message:"Component has invalid bounding box"}),this.addValidationRule("component_position",{check:function(e){var t=e.position;return!isNaN(t.x)&&!isNaN(t.y)&&!isNaN(t.z)&&isFinite(t.x)&&isFinite(t.y)&&isFinite(t.z)},message:"Component has invalid position values"}),this.addValidationRule("component_scale",{check:function(e){var t=e.scale;return t.x>0&&t.y>0&&t.z>0&&t.x<1e3&&t.y<1e3&&t.z<1e3},message:"Component has invalid scale values"}),this.addValidationRule("scene_complexity",{check:function(e){var t=0;return e.traverse(function(e){e.isMesh&&t++}),t<1e4},message:"Scene complexity too high (too many meshes)"})}},{key:"addValidationRule",value:function(e,t){this.validationRules.set(e,t)}},{key:"addAdjustmentStrategy",value:function(e,t){this.adjustmentStrategies.set(e,t)}},{key:"analyzeScene",value:function(e){var t=performance.now();n.logger.info("๐Ÿ” Starting scene analysis...");var i={timestamp:(new Date).toISOString(),performance:{},structure:{},quality:{},recommendations:[]},a=0,r=0,s=0,o=0,u=new Set,c=new Set;e.traverse(function(e){if(e.isMesh){if(a++,e.geometry){r++;var t=e.geometry.getAttribute("position");t&&(s+=t.count,e.geometry.index?o+=e.geometry.index.count/3:o+=t.count/3)}if(e.material)if(Array.isArray(e.material))e.material.forEach(function(e){return u.add(e.uuid)});else{u.add(e.material.uuid);var n=e.material;Object.keys(n).forEach(function(e){n[e]&&n[e].isTexture&&c.add(n[e].uuid)})}}}),i.performance={meshCount:a,geometryCount:r,materialCount:u.size,textureCount:c.size,vertexCount:s,triangleCount:o,memoryEstimate:this.estimateMemoryUsage(s,u.size,c.size)},i.structure=this.analyzeSceneStructure(e),i.quality=this.analyzeQuality(e),i.recommendations=this.generateRecommendations(i);var l=performance.now();return i.performance.analysisTime=l-t,n.logger.info("โœ… Scene analysis complete in ".concat(i.performance.analysisTime.toFixed(2),"ms")),this.analysisHistory.push(i),i}},{key:"analyzeSceneStructure",value:function(e){var t={depth:0,branches:0,emptyNodes:0,namedObjects:0,groups:0},n=function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t.depth=Math.max(t.depth,i),e.children.length>0&&t.branches++,0!==e.children.length||e.isMesh||e.isLight||e.isCamera||t.emptyNodes++,e.name&&""!==e.name.trim()&&t.namedObjects++,e.isGroup&&t.groups++,e.children.forEach(function(e){return n(e,i+1)})};return n(e),t}},{key:"analyzeQuality",value:function(e){var t=this,n={duplicateMaterials:0,unusedMaterials:0,missingTextures:0,invalidTransforms:0,memoryLeaks:[],optimization:{mergeable:[],instancingCandidates:[]}},i=new Map,a=new Map;return e.traverse(function(e){if(e.material){var r=t.getMaterialSignature(e.material);i.has(r)?n.duplicateMaterials++:i.set(r,e.material)}if(e.geometry){var s=t.getGeometrySignature(e.geometry);a.has(s)||a.set(s,[]),a.get(s).push(e)}!e.position||isFinite(e.position.x)&&isFinite(e.position.y)&&isFinite(e.position.z)||n.invalidTransforms++}),a.forEach(function(e,t){e.length>1&&n.optimization.instancingCandidates.push({geometry:t,count:e.length,objects:e.map(function(e){return e.uuid})})}),n}},{key:"generateRecommendations",value:function(e){var t=[];return e.performance.triangleCount>5e5&&t.push({type:"performance",priority:"high",message:"Consider using Level of Detail (LOD) for high polygon models",action:"implement_lod"}),e.performance.materialCount>50&&t.push({type:"performance",priority:"medium",message:"High material count detected. Consider material atlasing",action:"optimize_materials"}),e.quality.duplicateMaterials>10&&t.push({type:"optimization",priority:"medium",message:"Duplicate materials found. Consider material sharing",action:"merge_materials"}),e.quality.optimization.instancingCandidates.length>0&&t.push({type:"optimization",priority:"high",message:"Instancing opportunities detected for repeated geometries",action:"implement_instancing"}),t}},{key:"validateScene",value:function(e){var t=this;n.logger.info("๐Ÿ” Validating scene components...");var i={passed:[],failed:[],warnings:[]};return this.validationRules.forEach(function(t,n){try{t.check(e)?i.passed.push({rule:n,target:"scene"}):i.failed.push({rule:n,target:"scene",message:t.message})}catch(e){i.warnings.push({rule:n,target:"scene",message:"Validation error: ".concat(e.message)})}}),e.traverse(function(e){e.isMesh&&t.validationRules.forEach(function(t,n){try{t.check(e)?i.passed.push({rule:n,target:e.uuid}):i.failed.push({rule:n,target:e.uuid,message:t.message,objectName:e.name||"Unnamed Object"})}catch(t){i.warnings.push({rule:n,target:e.uuid,message:"Validation error: ".concat(t.message),objectName:e.name||"Unnamed Object"})}})}),n.logger.info("โœ… Validation complete: ".concat(i.passed.length," passed, ").concat(i.failed.length," failed, ").concat(i.warnings.length," warnings")),i}},{key:"applyAdjustments",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];n.logger.info("๐Ÿ”ง Applying scene adjustments...");var a={applied:[],failed:[],skipped:[]};return i.forEach(function(n){var i=t.adjustmentStrategies.get(n.type);if(i)try{var r=i(e,n.options||{});a.applied.push({adjustment:n.type,result:r})}catch(e){a.failed.push({adjustment:n.type,error:e.message})}else a.skipped.push({adjustment:n.type,reason:"No strategy found"})}),n.logger.info("โœ… Adjustments complete: ".concat(a.applied.length," applied, ").concat(a.failed.length," failed, ").concat(a.skipped.length," skipped")),a}},{key:"getMaterialSignature",value:function(e){var t={type:e.type,color:e.color?e.color.getHex():null,metalness:e.metalness,roughness:e.roughness,transparent:e.transparent,opacity:e.opacity};return JSON.stringify(t)}},{key:"getGeometrySignature",value:function(e){var t,n=Object.keys(e.attributes),i=(null===(t=e.getAttribute("position"))||void 0===t?void 0:t.count)||0,a=!!e.index;return"".concat(e.type,"_").concat(i,"_").concat(a,"_").concat(n.join(","))}},{key:"estimateMemoryUsage",value:function(e,t,n){var i=32*e,a=1024*t,r=1048576*n,s=i+a+r;return{geometry:this.formatBytes(i),materials:this.formatBytes(a),textures:this.formatBytes(r),total:this.formatBytes(s),totalBytes:s}}},{key:"formatBytes",value:function(e){if(0===e)return"0 Bytes";var t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB"][t]}},{key:"getAnalysisHistory",value:function(){return this.analysisHistory}},{key:"clearHistory",value:function(){this.analysisHistory=[]}},{key:"dispose",value:function(){this.clearHistory(),this.validationRules.clear(),this.adjustmentStrategies.clear(),n.logger.info("Analysis disposed")}}])}();exports.Analysis=r;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"t",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../core/debugLogger.js"),n=function(){return e.createClass(function n(){var r,s=this;e.classCallCheck(this,n),e.defineProperty(this,"mock",{create:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.objectSpread2({calls:[],callCount:0},t);return Object.keys(t).forEach(function(e){var r=t[e];n[e]=function(){for(var t=arguments.length,s=new Array(t),i=0;i<t;i++)s[i]=arguments[i];return n.calls.push({method:e,args:s,timestamp:Date.now()}),n.callCount++,r.apply(void 0,s)}}),n},spy:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},t=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.calls.push({args:r,timestamp:Date.now()}),t.callCount++,void 0!==t.returnValue?t.returnValue:e.apply(void 0,r)};return t.calls=[],t.callCount=0,t.returnValue=void 0,t.returns=function(e){return t.returnValue=e,t},t.throws=function(e){return t.throwError=e,t},t},three:{vector3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{x:e,y:t,z:n,set:function(r,s,i){e=r,t=s,n=i},clone:function(){return{x:e,y:t,z:n}},add:function(r){return{x:e+r.x,y:t+r.y,z:n+r.z}},sub:function(r){return{x:e-r.x,y:t-r.y,z:n-r.z}},length:function(){return Math.sqrt(e*e+t*t+n*n)},normalize:function(){var r=Math.sqrt(e*e+t*t+n*n);return{x:e/r,y:t/r,z:n/r}}}},object3D:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},children:[],parent:null,name:e.name||"",uuid:e.uuid||Math.random().toString(36),add:function(e){this.children.push(e),e.parent=this},remove:function(e){var t=this.children.indexOf(e);t>-1&&this.children.splice(t,1)},traverse:function(e){e(this),this.children.forEach(function(t){return t.traverse(e)})}}},scene:function(){return e.objectSpread2(e.objectSpread2({},s.mock.three.object3D()),{},{background:null,environment:null,fog:null,type:"Scene"})}}}),e.defineProperty(this,"benchmark",{run:(r=e.asyncToGenerator(e.regenerator().m(function n(r,i){var o,a,u,c,f,h,d,l,p,m,v,w,E,g,b,y,k,x,T,M=arguments;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:a=(o=M.length>2&&void 0!==M[2]?M[2]:{}).iterations,u=void 0===a?1e3:a,c=o.warmupIterations,f=void 0===c?10:c,h=o.timeout,d=void 0===h?5e3:h,t.logger.info("โฑ๏ธ Running benchmark: ".concat(r)),l=0;case 1:if(!(l<f)){e.n=3;break}return e.n=2,i();case 2:l++,e.n=1;break;case 3:p=[],m=performance.now(),v=0;case 4:if(!(v<u)){e.n=7;break}return w=performance.now(),e.n=5,i();case 5:if(E=performance.now(),p.push(E-w),!(performance.now()-m>d)){e.n=6;break}return t.logger.warn('โš ๏ธ Benchmark "'.concat(r,'" timed out after ').concat(v+1," iterations")),e.a(3,7);case 6:v++,e.n=4;break;case 7:return g=performance.now()-m,b=p.reduce(function(e,t){return e+t},0)/p.length,y=Math.min.apply(Math,p),k=Math.max.apply(Math,p),x=p.sort()[Math.floor(p.length/2)],T={name:r,iterations:p.length,totalTime:g,avgTime:b,minTime:y,maxTime:k,medianTime:x,opsPerSecond:1e3/b},s.benchmarks.set(r,T),t.logger.info('โœ… Benchmark "'.concat(r,'" completed: ').concat(T.opsPerSecond.toFixed(2)," ops/sec")),e.a(2,T)}},n)})),function(e,t){return r.apply(this,arguments)}),compare:function(e){var t=e.map(function(e){return s.benchmarks.get(e)}).filter(Boolean);if(t.length<2)throw new Error("Need at least 2 benchmarks to compare");var n=t.reduce(function(e,t){return e.opsPerSecond>t.opsPerSecond?e:t}),r=t.map(function(e){return{name:e.name,opsPerSecond:e.opsPerSecond,relativeSpeed:e.opsPerSecond/n.opsPerSecond,slower:n.opsPerSecond/e.opsPerSecond}});return{fastest:n.name,comparison:r}}}),this.testSuites=new Map,this.testResults=[],this.mockData=new Map,this.assertions=new Map,this.benchmarks=new Map,this.setupDefaultAssertions()},[{key:"setupDefaultAssertions",value:function(){this.addAssertion("equals",function(e,t,n){if(e!==t)throw new Error(n||"Expected ".concat(t,", got ").concat(e))}),this.addAssertion("notEquals",function(e,t,n){if(e===t)throw new Error(n||"Expected not ".concat(t,", got ").concat(e))}),this.addAssertion("deepEquals",function(e,t,n){if(JSON.stringify(e)!==JSON.stringify(t))throw new Error(n||"Deep equality failed")}),this.addAssertion("true",function(e,t){if(!0!==e)throw new Error(t||"Expected true, got ".concat(e))}),this.addAssertion("false",function(e,t){if(!1!==e)throw new Error(t||"Expected false, got ".concat(e))}),this.addAssertion("truthy",function(e,t){if(!e)throw new Error(t||"Expected truthy value, got ".concat(e))}),this.addAssertion("falsy",function(e,t){if(e)throw new Error(t||"Expected falsy value, got ".concat(e))}),this.addAssertion("null",function(e,t){if(null!==e)throw new Error(t||"Expected null, got ".concat(e))}),this.addAssertion("undefined",function(e,t){if(void 0!==e)throw new Error(t||"Expected undefined, got ".concat(e))}),this.addAssertion("defined",function(e,t){if(void 0===e)throw new Error(t||"Expected defined value, got undefined")}),this.addAssertion("instanceOf",function(t,n,r){if(!(t instanceof n))throw new Error(r||"Expected instance of ".concat(n.name,", got ").concat(e.typeof(t)))}),this.addAssertion("typeof",function(t,n,r){if(e.typeof(t)!==n)throw new Error(r||"Expected type ".concat(n,", got ").concat(e.typeof(t)))}),this.addAssertion("greaterThan",function(e,t,n){if(e<=t)throw new Error(n||"Expected ".concat(e," > ").concat(t))}),this.addAssertion("lessThan",function(e,t,n){if(e>=t)throw new Error(n||"Expected ".concat(e," < ").concat(t))}),this.addAssertion("greaterThanOrEqual",function(e,t,n){if(e<t)throw new Error(n||"Expected ".concat(e," >= ").concat(t))}),this.addAssertion("lessThanOrEqual",function(e,t,n){if(e>t)throw new Error(n||"Expected ".concat(e," <= ").concat(t))}),this.addAssertion("approximately",function(e,t,n,r){if(Math.abs(e-t)>n)throw new Error(r||"Expected ".concat(e," โ‰ˆ ").concat(t," (ยฑ").concat(n,")"))}),this.addAssertion("includes",function(e,t,n){if(!e.includes(t))throw new Error(n||'Expected "'.concat(e,'" to include "').concat(t,'"'))}),this.addAssertion("startsWith",function(e,t,n){if(!e.startsWith(t))throw new Error(n||'Expected "'.concat(e,'" to start with "').concat(t,'"'))}),this.addAssertion("endsWith",function(e,t,n){if(!e.endsWith(t))throw new Error(n||'Expected "'.concat(e,'" to end with "').concat(t,'"'))}),this.addAssertion("matches",function(e,t,n){if(!t.test(e))throw new Error(n||'Expected "'.concat(e,'" to match pattern ').concat(t))}),this.addAssertion("hasLength",function(e,t,n){if(e.length!==t)throw new Error(n||"Expected length ".concat(t,", got ").concat(e.length))}),this.addAssertion("isEmpty",function(e,t){if(0!==e.length)throw new Error(t||"Expected empty array/string, got length ".concat(e.length))}),this.addAssertion("isNotEmpty",function(e,t){if(0===e.length)throw new Error(t||"Expected non-empty array/string")}),this.addAssertion("hasProperty",function(e,t,n){if(!e.hasOwnProperty(t))throw new Error(n||'Expected object to have property "'.concat(t,'"'))}),this.addAssertion("hasMethod",function(e,t,n){if("function"!=typeof e[t])throw new Error(n||'Expected object to have method "'.concat(t,'"'))}),this.addAssertion("resolves",function(){var t=e.asyncToGenerator(e.regenerator().m(function t(n,r){var s;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,n;case 1:e.n=3;break;case 2:throw e.p=2,s=e.v,new Error(r||"Expected promise to resolve, but it rejected: ".concat(s.message));case 3:return e.a(2)}},t,null,[[0,2]])}));return function(e,n){return t.apply(this,arguments)}}()),this.addAssertion("rejects",function(){var t=e.asyncToGenerator(e.regenerator().m(function t(n,r){return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,n;case 1:throw new Error(r||"Expected promise to reject, but it resolved");case 2:e.p=2,e.v;case 3:return e.a(2)}},t,null,[[0,2]])}));return function(e,n){return t.apply(this,arguments)}}()),this.addAssertion("throws",function(e,t){try{throw e(),new Error(t||"Expected function to throw, but it didn't")}catch(e){}})}},{key:"addAssertion",value:function(e,t){this.assertions.set(e,t)}},{key:"createTestSuite",value:function(e){var t=this,n={name:e,tests:[],beforeEach:null,afterEach:null,beforeAll:null,afterAll:null,setup:arguments.length>1&&void 0!==arguments[1]?arguments[1]:null};return this.testSuites.set(e,n),{test:function(n,r){return t.addTest(e,n,r)},beforeEach:function(e){n.beforeEach=e},afterEach:function(e){n.afterEach=e},beforeAll:function(e){n.beforeAll=e},afterAll:function(e){n.afterAll=e}}}},{key:"addTest",value:function(e,t,n){var r=this.testSuites.get(e);if(!r)throw new Error('Test suite "'.concat(e,'" not found'));r.tests.push({name:t,fn:n,skip:!1,only:!1})}},{key:"runAllTests",value:(s=e.asyncToGenerator(e.regenerator().m(function n(){var r,s,i,o,a,u,c,f;return e.regenerator().w(function(n){for(;;)switch(n.n){case 0:t.logger.info("๐Ÿงช Running all test suites..."),r=performance.now(),s={suites:[],totalTests:0,passedTests:0,failedTests:0,skippedTests:0,duration:0},i=e.createForOfIteratorHelper(this.testSuites),n.p=1,i.s();case 2:if((o=i.n()).done){n.n=5;break}return a=e.slicedToArray(o.value,2),u=a[0],a[1],n.n=3,this.runTestSuite(u);case 3:c=n.v,s.suites.push(c),s.totalTests+=c.totalTests,s.passedTests+=c.passedTests,s.failedTests+=c.failedTests,s.skippedTests+=c.skippedTests;case 4:n.n=2;break;case 5:n.n=7;break;case 6:n.p=6,f=n.v,i.e(f);case 7:return n.p=7,i.f(),n.f(7);case 8:return s.duration=performance.now()-r,t.logger.info("โœ… All tests completed: ".concat(s.passedTests,"/").concat(s.totalTests," passed in ").concat(s.duration.toFixed(2),"ms")),this.testResults.push(s),n.a(2,s)}},n,this,[[1,6,7,8]])})),function(){return s.apply(this,arguments)})},{key:"runTestSuite",value:(r=e.asyncToGenerator(e.regenerator().m(function n(r){var s,i,o,a,u,c,f,h,d;return e.regenerator().w(function(n){for(;;)switch(n.n){case 0:if(s=this.testSuites.get(r)){n.n=1;break}throw new Error('Test suite "'.concat(r,'" not found'));case 1:if(t.logger.info("๐Ÿงช Running test suite: ".concat(r)),i=performance.now(),o={name:r,tests:[],totalTests:s.tests.length,passedTests:0,failedTests:0,skippedTests:0,duration:0},n.p=2,!s.setup){n.n=3;break}return n.n=3,s.setup();case 3:if(!s.beforeAll){n.n=4;break}return n.n=4,s.beforeAll();case 4:a=e.createForOfIteratorHelper(s.tests),n.p=5,a.s();case 6:if((u=a.n()).done){n.n=9;break}return c=u.value,n.n=7,this.runTest(s,c);case 7:f=n.v,o.tests.push(f),"passed"===f.status?o.passedTests++:"failed"===f.status?o.failedTests++:"skipped"===f.status&&o.skippedTests++;case 8:n.n=6;break;case 9:n.n=11;break;case 10:n.p=10,h=n.v,a.e(h);case 11:return n.p=11,a.f(),n.f(11);case 12:if(!s.afterAll){n.n=13;break}return n.n=13,s.afterAll();case 13:n.n=15;break;case 14:n.p=14,d=n.v,t.logger.error('โŒ Test suite "'.concat(r,'" setup failed:'),d);case 15:return o.duration=performance.now()-i,t.logger.info('โœ… Suite "'.concat(r,'" completed: ').concat(o.passedTests,"/").concat(o.totalTests," passed")),n.a(2,o)}},n,this,[[5,10,11,12],[2,14]])})),function(e){return r.apply(this,arguments)})},{key:"runTest",value:(n=e.asyncToGenerator(e.regenerator().m(function n(r,s){var i,o,a,u;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:if(!s.skip){e.n=1;break}return e.a(2,{name:s.name,status:"skipped",duration:0,error:null});case 1:if(i=performance.now(),o={name:s.name,status:"passed",duration:0,error:null},e.p=2,!r.beforeEach){e.n=3;break}return e.n=3,r.beforeEach();case 3:return a=this.createAssertionContext(),e.n=4,s.fn(a);case 4:if(!r.afterEach){e.n=5;break}return e.n=5,r.afterEach();case 5:e.n=7;break;case 6:e.p=6,u=e.v,o.status="failed",o.error={message:u.message,stack:u.stack},t.logger.error('โŒ Test "'.concat(s.name,'" failed:'),u.message);case 7:return o.duration=performance.now()-i,e.a(2,o)}},n,this,[[2,6]])})),function(e,t){return n.apply(this,arguments)})},{key:"createAssertionContext",value:function(){var t,n={},r=e.createForOfIteratorHelper(this.assertions);try{for(r.s();!(t=r.n()).done;){var s=e.slicedToArray(t.value,2),i=s[0],o=s[1];n[i]=o}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"generateReport",value:function(e){var t=(e.passedTests/e.totalTests*100).toFixed(1),n='\n<!DOCTYPE html>\n<html>\n<head>\n <title>Test Report</title>\n <style>\n body { font-family: Arial, sans-serif; margin: 20px; }\n .summary { background: #f5f5f5; padding: 15px; border-radius: 5px; margin-bottom: 20px; }\n .suite { margin-bottom: 20px; border: 1px solid #ddd; border-radius: 5px; }\n .suite-header { background: #e9e9e9; padding: 10px; font-weight: bold; }\n .test { padding: 10px; border-bottom: 1px solid #eee; }\n .test:last-child { border-bottom: none; }\n .passed { color: green; }\n .failed { color: red; }\n .skipped { color: orange; }\n .error { background: #ffe6e6; padding: 10px; margin-top: 5px; border-radius: 3px; }\n </style>\n</head>\n<body>\n <h1>Test Report</h1>\n \n <div class="summary">\n <h2>Summary</h2>\n <p><strong>Total Tests:</strong> '.concat(e.totalTests,'</p>\n <p><strong>Passed:</strong> <span class="passed">').concat(e.passedTests,'</span></p>\n <p><strong>Failed:</strong> <span class="failed">').concat(e.failedTests,'</span></p>\n <p><strong>Skipped:</strong> <span class="skipped">').concat(e.skippedTests,"</span></p>\n <p><strong>Pass Rate:</strong> ").concat(t,"%</p>\n <p><strong>Duration:</strong> ").concat(e.duration.toFixed(2),"ms</p>\n </div>\n \n <h2>Test Suites</h2>\n");return e.suites.forEach(function(e){n+='\n <div class="suite">\n <div class="suite-header">\n '.concat(e.name," (").concat(e.passedTests,"/").concat(e.totalTests," passed)\n </div>\n"),e.tests.forEach(function(e){n+='\n <div class="test">\n <span class="'.concat(e.status,'">').concat(e.status.toUpperCase(),"</span>\n <strong>").concat(e.name,"</strong>\n <small>(").concat(e.duration.toFixed(2),"ms)</small>\n"),e.error&&(n+='\n <div class="error">\n <strong>Error:</strong> '.concat(e.error.message,"\n </div>\n")),n+=" </div>"}),n+=" </div>"}),n+="\n</body>\n</html>\n"}},{key:"clearResults",value:function(){this.testResults=[]}},{key:"getResults",value:function(){return this.testResults}},{key:"getBenchmarks",value:function(){return this.benchmarks}},{key:"dispose",value:function(){this.testSuites.clear(),this.clearResults(),this.mockData.clear(),this.benchmarks.clear(),t.logger.info("Testing disposed")}}]);var n,r,s}();exports.Testing=n;