1
0

chunk-ZUTZQNJG.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. import {
  2. ACESFilmicToneMapping,
  3. Clock,
  4. Color,
  5. LinearEncoding,
  6. LoadingManager,
  7. MathUtils,
  8. Mesh,
  9. NoToneMapping,
  10. OrthographicCamera,
  11. PCFShadowMap,
  12. PCFSoftShadowMap,
  13. PerspectiveCamera,
  14. Raycaster,
  15. Scene,
  16. TextureLoader,
  17. Vector2,
  18. WebGLRenderer,
  19. sRGBEncoding,
  20. three_module_exports
  21. } from "./chunk-UMTEG5DH.js";
  22. import {
  23. computed,
  24. createRenderer,
  25. defineComponent,
  26. getCurrentInstance,
  27. getCurrentScope,
  28. h,
  29. nextTick,
  30. onMounted,
  31. onScopeDispose,
  32. readonly,
  33. ref,
  34. shallowReactive,
  35. shallowRef,
  36. toRef,
  37. toRefs,
  38. unref,
  39. watch,
  40. watchEffect
  41. } from "./chunk-LZPJ5JBW.js";
  42. // node_modules/.pnpm/@vueuse+shared@9.13.0_vue@3.2.47/node_modules/@vueuse/shared/index.mjs
  43. var _a;
  44. var isClient = typeof window !== "undefined";
  45. var isFunction = (val) => typeof val === "function";
  46. var isString = (val) => typeof val === "string";
  47. var noop = () => {
  48. };
  49. var isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  50. function resolveUnref(r) {
  51. return typeof r === "function" ? r() : unref(r);
  52. }
  53. function identity(arg) {
  54. return arg;
  55. }
  56. function tryOnScopeDispose(fn) {
  57. if (getCurrentScope()) {
  58. onScopeDispose(fn);
  59. return true;
  60. }
  61. return false;
  62. }
  63. function createEventHook() {
  64. const fns = [];
  65. const off = (fn) => {
  66. const index = fns.indexOf(fn);
  67. if (index !== -1)
  68. fns.splice(index, 1);
  69. };
  70. const on = (fn) => {
  71. fns.push(fn);
  72. const offFn = () => off(fn);
  73. tryOnScopeDispose(offFn);
  74. return {
  75. off: offFn
  76. };
  77. };
  78. const trigger = (param) => {
  79. fns.forEach((fn) => fn(param));
  80. };
  81. return {
  82. on,
  83. off,
  84. trigger
  85. };
  86. }
  87. function tryOnMounted(fn, sync = true) {
  88. if (getCurrentInstance())
  89. onMounted(fn);
  90. else if (sync)
  91. fn();
  92. else
  93. nextTick(fn);
  94. }
  95. // node_modules/.pnpm/@vueuse+core@9.13.0_vue@3.2.47/node_modules/@vueuse/core/index.mjs
  96. function unrefElement(elRef) {
  97. var _a2;
  98. const plain = resolveUnref(elRef);
  99. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  100. }
  101. var defaultWindow = isClient ? window : void 0;
  102. var defaultDocument = isClient ? window.document : void 0;
  103. var defaultNavigator = isClient ? window.navigator : void 0;
  104. var defaultLocation = isClient ? window.location : void 0;
  105. function useEventListener(...args) {
  106. let target;
  107. let events;
  108. let listeners;
  109. let options;
  110. if (isString(args[0]) || Array.isArray(args[0])) {
  111. [events, listeners, options] = args;
  112. target = defaultWindow;
  113. } else {
  114. [target, events, listeners, options] = args;
  115. }
  116. if (!target)
  117. return noop;
  118. if (!Array.isArray(events))
  119. events = [events];
  120. if (!Array.isArray(listeners))
  121. listeners = [listeners];
  122. const cleanups = [];
  123. const cleanup = () => {
  124. cleanups.forEach((fn) => fn());
  125. cleanups.length = 0;
  126. };
  127. const register = (el, event, listener, options2) => {
  128. el.addEventListener(event, listener, options2);
  129. return () => el.removeEventListener(event, listener, options2);
  130. };
  131. const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
  132. cleanup();
  133. if (!el)
  134. return;
  135. cleanups.push(...events.flatMap((event) => {
  136. return listeners.map((listener) => register(el, event, listener, options2));
  137. }));
  138. }, { immediate: true, flush: "post" });
  139. const stop = () => {
  140. stopWatch();
  141. cleanup();
  142. };
  143. tryOnScopeDispose(stop);
  144. return stop;
  145. }
  146. function useSupported(callback, sync = false) {
  147. const isSupported = ref();
  148. const update = () => isSupported.value = Boolean(callback());
  149. update();
  150. tryOnMounted(update, sync);
  151. return isSupported;
  152. }
  153. var _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  154. var globalKey = "__vueuse_ssr_handlers__";
  155. _global[globalKey] = _global[globalKey] || {};
  156. var handlers = _global[globalKey];
  157. function useDevicePixelRatio({
  158. window: window2 = defaultWindow
  159. } = {}) {
  160. const pixelRatio = ref(1);
  161. if (window2) {
  162. let observe = function() {
  163. pixelRatio.value = window2.devicePixelRatio;
  164. cleanup();
  165. media = window2.matchMedia(`(resolution: ${pixelRatio.value}dppx)`);
  166. media.addEventListener("change", observe, { once: true });
  167. }, cleanup = function() {
  168. media == null ? void 0 : media.removeEventListener("change", observe);
  169. };
  170. let media;
  171. observe();
  172. tryOnScopeDispose(cleanup);
  173. }
  174. return { pixelRatio };
  175. }
  176. var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
  177. var __hasOwnProp$g = Object.prototype.hasOwnProperty;
  178. var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
  179. var __objRest$2 = (source, exclude) => {
  180. var target = {};
  181. for (var prop in source)
  182. if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
  183. target[prop] = source[prop];
  184. if (source != null && __getOwnPropSymbols$g)
  185. for (var prop of __getOwnPropSymbols$g(source)) {
  186. if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
  187. target[prop] = source[prop];
  188. }
  189. return target;
  190. };
  191. function useResizeObserver(target, callback, options = {}) {
  192. const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  193. let observer;
  194. const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
  195. const cleanup = () => {
  196. if (observer) {
  197. observer.disconnect();
  198. observer = void 0;
  199. }
  200. };
  201. const stopWatch = watch(() => unrefElement(target), (el) => {
  202. cleanup();
  203. if (isSupported.value && window2 && el) {
  204. observer = new ResizeObserver(callback);
  205. observer.observe(el, observerOptions);
  206. }
  207. }, { immediate: true, flush: "post" });
  208. const stop = () => {
  209. cleanup();
  210. stopWatch();
  211. };
  212. tryOnScopeDispose(stop);
  213. return {
  214. isSupported,
  215. stop
  216. };
  217. }
  218. function useRafFn(fn, options = {}) {
  219. const {
  220. immediate = true,
  221. window: window2 = defaultWindow
  222. } = options;
  223. const isActive = ref(false);
  224. let previousFrameTimestamp = 0;
  225. let rafId = null;
  226. function loop(timestamp2) {
  227. if (!isActive.value || !window2)
  228. return;
  229. const delta = timestamp2 - previousFrameTimestamp;
  230. fn({ delta, timestamp: timestamp2 });
  231. previousFrameTimestamp = timestamp2;
  232. rafId = window2.requestAnimationFrame(loop);
  233. }
  234. function resume() {
  235. if (!isActive.value && window2) {
  236. isActive.value = true;
  237. rafId = window2.requestAnimationFrame(loop);
  238. }
  239. }
  240. function pause() {
  241. isActive.value = false;
  242. if (rafId != null && window2) {
  243. window2.cancelAnimationFrame(rafId);
  244. rafId = null;
  245. }
  246. }
  247. if (immediate)
  248. resume();
  249. tryOnScopeDispose(pause);
  250. return {
  251. isActive: readonly(isActive),
  252. pause,
  253. resume
  254. };
  255. }
  256. function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
  257. const { window: window2 = defaultWindow, box = "content-box" } = options;
  258. const isSVG = computed(() => {
  259. var _a2, _b;
  260. return (_b = (_a2 = unrefElement(target)) == null ? void 0 : _a2.namespaceURI) == null ? void 0 : _b.includes("svg");
  261. });
  262. const width = ref(initialSize.width);
  263. const height = ref(initialSize.height);
  264. useResizeObserver(target, ([entry]) => {
  265. const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
  266. if (window2 && isSVG.value) {
  267. const $elem = unrefElement(target);
  268. if ($elem) {
  269. const styles = window2.getComputedStyle($elem);
  270. width.value = parseFloat(styles.width);
  271. height.value = parseFloat(styles.height);
  272. }
  273. } else {
  274. if (boxSize) {
  275. const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
  276. width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
  277. height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
  278. } else {
  279. width.value = entry.contentRect.width;
  280. height.value = entry.contentRect.height;
  281. }
  282. }
  283. }, options);
  284. watch(() => unrefElement(target), (ele) => {
  285. width.value = ele ? initialSize.width : 0;
  286. height.value = ele ? initialSize.height : 0;
  287. });
  288. return {
  289. width,
  290. height
  291. };
  292. }
  293. var defaultState = {
  294. x: 0,
  295. y: 0,
  296. pointerId: 0,
  297. pressure: 0,
  298. tiltX: 0,
  299. tiltY: 0,
  300. width: 0,
  301. height: 0,
  302. twist: 0,
  303. pointerType: null
  304. };
  305. var keys = Object.keys(defaultState);
  306. var SwipeDirection;
  307. (function(SwipeDirection2) {
  308. SwipeDirection2["UP"] = "UP";
  309. SwipeDirection2["RIGHT"] = "RIGHT";
  310. SwipeDirection2["DOWN"] = "DOWN";
  311. SwipeDirection2["LEFT"] = "LEFT";
  312. SwipeDirection2["NONE"] = "NONE";
  313. })(SwipeDirection || (SwipeDirection = {}));
  314. var __defProp = Object.defineProperty;
  315. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  316. var __hasOwnProp = Object.prototype.hasOwnProperty;
  317. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  318. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  319. var __spreadValues = (a, b2) => {
  320. for (var prop in b2 || (b2 = {}))
  321. if (__hasOwnProp.call(b2, prop))
  322. __defNormalProp(a, prop, b2[prop]);
  323. if (__getOwnPropSymbols)
  324. for (var prop of __getOwnPropSymbols(b2)) {
  325. if (__propIsEnum.call(b2, prop))
  326. __defNormalProp(a, prop, b2[prop]);
  327. }
  328. return a;
  329. };
  330. var _TransitionPresets = {
  331. easeInSine: [0.12, 0, 0.39, 0],
  332. easeOutSine: [0.61, 1, 0.88, 1],
  333. easeInOutSine: [0.37, 0, 0.63, 1],
  334. easeInQuad: [0.11, 0, 0.5, 0],
  335. easeOutQuad: [0.5, 1, 0.89, 1],
  336. easeInOutQuad: [0.45, 0, 0.55, 1],
  337. easeInCubic: [0.32, 0, 0.67, 0],
  338. easeOutCubic: [0.33, 1, 0.68, 1],
  339. easeInOutCubic: [0.65, 0, 0.35, 1],
  340. easeInQuart: [0.5, 0, 0.75, 0],
  341. easeOutQuart: [0.25, 1, 0.5, 1],
  342. easeInOutQuart: [0.76, 0, 0.24, 1],
  343. easeInQuint: [0.64, 0, 0.78, 0],
  344. easeOutQuint: [0.22, 1, 0.36, 1],
  345. easeInOutQuint: [0.83, 0, 0.17, 1],
  346. easeInExpo: [0.7, 0, 0.84, 0],
  347. easeOutExpo: [0.16, 1, 0.3, 1],
  348. easeInOutExpo: [0.87, 0, 0.13, 1],
  349. easeInCirc: [0.55, 0, 1, 0.45],
  350. easeOutCirc: [0, 0.55, 0.45, 1],
  351. easeInOutCirc: [0.85, 0, 0.15, 1],
  352. easeInBack: [0.36, 0, 0.66, -0.56],
  353. easeOutBack: [0.34, 1.56, 0.64, 1],
  354. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  355. };
  356. var TransitionPresets = __spreadValues({
  357. linear: identity
  358. }, _TransitionPresets);
  359. function useWindowSize(options = {}) {
  360. const {
  361. window: window2 = defaultWindow,
  362. initialWidth = Infinity,
  363. initialHeight = Infinity,
  364. listenOrientation = true,
  365. includeScrollbar = true
  366. } = options;
  367. const width = ref(initialWidth);
  368. const height = ref(initialHeight);
  369. const update = () => {
  370. if (window2) {
  371. if (includeScrollbar) {
  372. width.value = window2.innerWidth;
  373. height.value = window2.innerHeight;
  374. } else {
  375. width.value = window2.document.documentElement.clientWidth;
  376. height.value = window2.document.documentElement.clientHeight;
  377. }
  378. }
  379. };
  380. update();
  381. tryOnMounted(update);
  382. useEventListener("resize", update, { passive: true });
  383. if (listenOrientation)
  384. useEventListener("orientationchange", update, { passive: true });
  385. return { width, height };
  386. }
  387. // node_modules/.pnpm/@tresjs+core@2.0.0-alpha.1_three@0.151.3+vue@3.2.47/node_modules/@tresjs/core/dist/tres.js
  388. var G = ref({ uuid: MathUtils.generateUUID() });
  389. var se = (e) => void Object.assign(G.value, e);
  390. var Ne = ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Ne || {});
  391. var qe = 45;
  392. var y;
  393. function ce() {
  394. const { state: e, setState: t, aspectRatio: r } = L();
  395. function o(a = "Perspective", s) {
  396. var l, p, m;
  397. if (a === "Perspective") {
  398. const { near: d, far: w, fov: v } = s || {
  399. near: 0.1,
  400. far: 1e3,
  401. fov: qe
  402. };
  403. y = new PerspectiveCamera(v, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, d, w), (p = e.cameras) == null || p.push(y);
  404. } else {
  405. const { left: d, right: w, top: v, bottom: g, near: E, far: x } = s || {
  406. left: -100,
  407. right: 100,
  408. top: 100,
  409. bottom: -100,
  410. near: 0.1,
  411. far: 1e3
  412. };
  413. y = new OrthographicCamera(d, w, v, g, E, x), (m = e.cameras) == null || m.push(y);
  414. }
  415. return e.camera = y, t("camera", e.camera), y;
  416. }
  417. function n() {
  418. var a;
  419. e.camera instanceof PerspectiveCamera && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (a = e.camera) == null || a.updateProjectionMatrix();
  420. }
  421. function i(a) {
  422. var s;
  423. (s = e.cameras) == null || s.push(a), a instanceof PerspectiveCamera && e.aspectRatio && (a.aspect = e.aspectRatio.value), a.updateProjectionMatrix(), t("camera", a);
  424. }
  425. function c() {
  426. e.cameras = [];
  427. }
  428. return watchEffect(() => {
  429. r != null && r.value && n();
  430. }), {
  431. activeCamera: toRef(e, "camera"),
  432. createCamera: o,
  433. updateCamera: n,
  434. pushCamera: i,
  435. clearCameras: c
  436. };
  437. }
  438. var ue = createEventHook();
  439. var le = createEventHook();
  440. var V = createEventHook();
  441. var b = new Clock();
  442. var A = 0;
  443. var k = 0;
  444. var { pause: Je, resume: Ke, isActive: Xe } = useRafFn(
  445. () => {
  446. ue.trigger({ delta: A, elapsed: k, clock: b }), le.trigger({ delta: A, elapsed: k, clock: b }), V.trigger({ delta: A, elapsed: k, clock: b });
  447. },
  448. { immediate: false }
  449. );
  450. V.on(() => {
  451. A = b.getDelta(), k = b.getElapsedTime();
  452. });
  453. function $() {
  454. return {
  455. onBeforeLoop: ue.on,
  456. onLoop: le.on,
  457. onAfterLoop: V.on,
  458. pause: Je,
  459. resume: Ke,
  460. isActive: Xe
  461. };
  462. }
  463. function Ye(e) {
  464. return e instanceof Color ? e : Array.isArray(e) ? new Color(...e) : new Color(e);
  465. }
  466. var B = {
  467. realistic: {
  468. outputEncoding: sRGBEncoding,
  469. toneMapping: ACESFilmicToneMapping,
  470. toneMappingExposure: 3,
  471. shadowMap: {
  472. enabled: true,
  473. type: PCFSoftShadowMap
  474. }
  475. }
  476. };
  477. var fe = (e, t) => {
  478. for (const r of Object.keys(t))
  479. t[r] instanceof Object && Object.assign(t[r], fe(e[r], t[r]));
  480. return Object.assign(e || {}, t), e;
  481. };
  482. var Qe = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  483. var Ze = et(Qe);
  484. function I(e) {
  485. return e.replace(/-([a-z])/g, (t, r) => r.toUpperCase());
  486. }
  487. function et(e, t) {
  488. const r = /* @__PURE__ */ Object.create(null), o = e.split(",");
  489. for (let n = 0; n < o.length; n++)
  490. r[o[n]] = true;
  491. return t ? (n) => !!r[n.toLowerCase()] : (n) => !!r[n];
  492. }
  493. var f = shallowRef();
  494. var H = ref(false);
  495. function tt(e, t, r) {
  496. const {
  497. alpha: o = true,
  498. antialias: n = true,
  499. depth: i,
  500. logarithmicDepthBuffer: c,
  501. failIfMajorPerformanceCaveat: a,
  502. precision: s,
  503. premultipliedAlpha: l,
  504. stencil: p,
  505. shadows: m = false,
  506. shadowMapType: d = PCFShadowMap,
  507. physicallyCorrectLights: w = false,
  508. useLegacyLights: v = false,
  509. outputEncoding: g = LinearEncoding,
  510. toneMapping: E = NoToneMapping,
  511. toneMappingExposure: x = 1,
  512. context: de = void 0,
  513. powerPreference: ve = "default",
  514. preserveDrawingBuffer: ge = false,
  515. clearColor: C,
  516. windowSize: we = false,
  517. preset: he = void 0
  518. } = toRefs(r), { setState: D } = L(), { width: N, height: q } = resolveUnref(we) ? useWindowSize() : useElementSize(t), { logError: ye } = j(), { pixelRatio: J } = useDevicePixelRatio(), { pause: Me, resume: Ce } = $(), F = computed(() => N.value / q.value), K = () => {
  519. f.value && (f.value.setSize(N.value, q.value), f.value.setPixelRatio(Math.min(J.value, 2)));
  520. }, X = () => {
  521. if (!f.value)
  522. return;
  523. const h2 = resolveUnref(he);
  524. if (h2) {
  525. h2 in B || ye("Renderer Preset must be one of these: " + Object.keys(B).join(", ")), fe(f.value, B[h2]);
  526. return;
  527. }
  528. f.value.shadowMap.enabled = resolveUnref(m), f.value.shadowMap.type = resolveUnref(d), f.value.toneMapping = resolveUnref(E) || NoToneMapping, f.value.toneMappingExposure = resolveUnref(x), f.value.outputEncoding = resolveUnref(g) || LinearEncoding, C != null && C.value && f.value.setClearColor(Ye(resolveUnref(C))), f.value.useLegacyLights = resolveUnref(v);
  529. }, be = () => {
  530. const h2 = unrefElement(e);
  531. h2 && (f.value = new WebGLRenderer({
  532. canvas: h2,
  533. alpha: resolveUnref(o),
  534. antialias: resolveUnref(n),
  535. context: resolveUnref(de),
  536. depth: resolveUnref(i),
  537. failIfMajorPerformanceCaveat: resolveUnref(a),
  538. logarithmicDepthBuffer: resolveUnref(c),
  539. powerPreference: resolveUnref(ve),
  540. precision: resolveUnref(s),
  541. stencil: resolveUnref(p),
  542. preserveDrawingBuffer: resolveUnref(ge),
  543. premultipliedAlpha: resolveUnref(l)
  544. }), D("renderer", f.value), D("clock", new Clock()), D("aspectRatio", F), X(), K(), Ce(), H.value = true);
  545. }, Le = () => {
  546. f.value && (f.value.dispose(), f.value = void 0, H.value = false, Me());
  547. };
  548. return watch([F, J], K), watch(
  549. [m, d, g, v, E, x, C],
  550. X
  551. ), watch(
  552. () => [e, t],
  553. () => {
  554. unrefElement(e) && unrefElement(t) && be();
  555. },
  556. { immediate: true, deep: true }
  557. ), {
  558. renderer: f,
  559. isReady: H,
  560. dispose: Le,
  561. aspectRatio: F
  562. };
  563. }
  564. var pe = (e) => !!e && e.constructor === Array;
  565. function nt(e) {
  566. const t = { nodes: {}, materials: {} };
  567. return e && e.traverse((r) => {
  568. r.name && (t.nodes[r.name] = r), r.material && !t.materials[r.material.name] && (t.materials[r.material.name] = r.material);
  569. }), t;
  570. }
  571. async function dt(e, t, r, o, n) {
  572. const { logError: i } = j(), c = new e();
  573. n && n(c), r && r(c);
  574. const s = (Array.isArray(t) ? t : [t]).map(
  575. (l) => new Promise((p, m) => {
  576. c.load(
  577. l,
  578. (d) => {
  579. d.scene && Object.assign(d, nt(d.scene)), p(d);
  580. },
  581. o,
  582. (d) => m(i("[useLoader] - Failed to load resource", d))
  583. );
  584. })
  585. );
  586. return pe(t) ? await Promise.all(s) : await s[0];
  587. }
  588. async function vt(e) {
  589. const t = new LoadingManager(), r = new TextureLoader(t), o = (n) => new Promise((i, c) => {
  590. r.load(
  591. n,
  592. (a) => i(a),
  593. () => null,
  594. () => {
  595. c(new Error("[useTextures] - Failed to load texture"));
  596. }
  597. );
  598. });
  599. if (pe(e)) {
  600. const n = await Promise.all(e.map((i) => o(i)));
  601. return e.length > 1 ? n : n[0];
  602. } else {
  603. const { map: n, displacementMap: i, normalMap: c, roughnessMap: a, metalnessMap: s, aoMap: l } = e;
  604. return {
  605. map: n ? await o(n) : null,
  606. displacementMap: i ? await o(i) : null,
  607. normalMap: c ? await o(c) : null,
  608. roughnessMap: a ? await o(a) : null,
  609. metalnessMap: s ? await o(s) : null,
  610. aoMap: l ? await o(l) : null
  611. };
  612. }
  613. }
  614. var R = shallowReactive({
  615. camera: void 0,
  616. cameras: [],
  617. aspectRatio: computed(() => window.innerWidth / window.innerHeight)
  618. });
  619. function L() {
  620. function e(r) {
  621. return R[r];
  622. }
  623. function t(r, o) {
  624. R[r] = o;
  625. }
  626. return {
  627. state: R,
  628. ...toRefs(R),
  629. getState: e,
  630. setState: t
  631. };
  632. }
  633. var ee = shallowRef(new Raycaster());
  634. var S = ref(new Vector2());
  635. var at = ref(null);
  636. function me() {
  637. const { setState: e } = L();
  638. e("raycaster", ee.value), e("pointer", S), e("currentInstance", at);
  639. function t(r) {
  640. S.value.x = r.clientX / window.innerWidth * 2 - 1, S.value.y = -(r.clientY / window.innerHeight) * 2 + 1;
  641. }
  642. return window.addEventListener("pointermove", t), {
  643. raycaster: ee,
  644. pointer: S
  645. };
  646. }
  647. var gt = true;
  648. var te = "[TresJS ▲ ■ ●] ";
  649. function j() {
  650. function e(o, n) {
  651. console.error(`${te} ${o}`, n || "");
  652. }
  653. function t(o) {
  654. console.warn(`${te} ${o}`);
  655. }
  656. function r(o, n) {
  657. }
  658. return {
  659. logError: e,
  660. logWarning: t,
  661. logMessage: r
  662. };
  663. }
  664. var { logWarning: rt } = j();
  665. function ot(e) {
  666. for (const t in e)
  667. if (t.indexOf("on") === 0)
  668. return true;
  669. return false;
  670. }
  671. var T = null;
  672. var it = {
  673. createElement(e, t, r, o) {
  674. if (e === "template" || Ze(e))
  675. return null;
  676. let n;
  677. if (o === null && (o = {}), o != null && o.args ? n = new G.value[e.replace("Tres", "")](...o.args) : n = new G.value[e.replace("Tres", "")](), n.isCamera) {
  678. (!(o != null && o.position) || o != null && o.position.every((c) => c == 0)) && rt(
  679. // eslint-disable-next-line max-len
  680. "Camera is positioned at the center of the scene [0,0,0], if this is not intentional try setting a position if your scene seems empty 🤗"
  681. );
  682. const { pushCamera: i } = ce();
  683. i(n);
  684. }
  685. return (o == null ? void 0 : o.attach) === void 0 && (n.isMaterial ? n.attach = "material" : n.isBufferGeometry && (n.attach = "geometry")), n;
  686. },
  687. insert(e, t, r) {
  688. if (T === null && t.isScene && (T = t), t === null && (t = T), t != null && t.isObject3D && (e != null && e.isObject3D)) {
  689. const a = r ? t.children.indexOf(r) : 0;
  690. e.parent = t, t.children.splice(a, 0, e), e.dispatchEvent({ type: "added" });
  691. } else
  692. typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
  693. const { onLoop: o } = $();
  694. let n = null, i = null;
  695. const { raycaster: c } = me();
  696. e && e instanceof Mesh && ot(e) && (o(() => {
  697. var a, s, l;
  698. if (t != null && t.children && e && c) {
  699. const p = c.value.intersectObjects(t.children);
  700. p.length > 0 && p[0].object.uuid === e.uuid ? (i = p[0], (n === null || n.object.uuid !== (i == null ? void 0 : i.object.uuid)) && ((a = e.onPointerEnter) == null || a.call(e, i)), (s = e.onPointerMove) == null || s.call(e, i)) : (i = null, n !== null && ((l = e.onPointerLeave) == null || l.call(e, n))), n = i;
  701. }
  702. }), useEventListener(window, "click", () => {
  703. var a;
  704. i !== null && ((a = e.onClick) == null || a.call(e, i));
  705. }));
  706. },
  707. remove(e) {
  708. if (!e)
  709. return;
  710. const t = e.parentNode;
  711. t && t.removeChild(e);
  712. },
  713. patchProp(e, t, r, o) {
  714. if (e) {
  715. let n = e, i = t;
  716. const c = I(i);
  717. let a = n == null ? void 0 : n[c];
  718. if (e.parent || (e.parent = T), i.includes("-") && a === void 0) {
  719. const l = i.split("-");
  720. a = l.reduce((p, m) => p[I(m)], n), i = l.pop(), a != null && a.set || (n = l.reduce((p, m) => p[I(m)], n));
  721. }
  722. let s = o;
  723. if (s === "" && (s = true), isFunction(a))
  724. return;
  725. !(a != null && a.set) && !isFunction(a) ? n[c] = s : a.constructor === s.constructor && (a != null && a.copy) ? a == null || a.copy(s) : Array.isArray(s) ? a.set(...s) : !a.isColor && a.setScalar ? a.setScalar(s) : a.set(s);
  726. }
  727. },
  728. parentNode(e) {
  729. return (e == null ? void 0 : e.parent) || null;
  730. },
  731. createText: () => void 0,
  732. createComment: () => void 0,
  733. setText: () => void 0,
  734. setElementText: () => void 0,
  735. nextSibling: () => void 0,
  736. querySelector: () => void 0,
  737. setScopeId: () => void 0,
  738. cloneNode: () => void 0,
  739. insertStaticContent: () => void 0
  740. };
  741. var { createApp: st } = createRenderer(it);
  742. var ct = (e) => {
  743. const t = st(r);
  744. function r() {
  745. return e && e.default ? e.default() : [];
  746. }
  747. return t;
  748. };
  749. se(three_module_exports);
  750. var { logWarning: ut } = j();
  751. var lt = defineComponent({
  752. name: "TresCanvas",
  753. props: [
  754. "shadows",
  755. "shadowMapType",
  756. "physicallyCorrectLights",
  757. "useLegacyLights",
  758. "outputEncoding",
  759. "toneMapping",
  760. "toneMappingExposure",
  761. "context",
  762. "powerPreference",
  763. "preserveDrawingBuffer",
  764. "clearColor",
  765. "windowSize",
  766. "preset"
  767. ],
  768. setup(e, { slots: t, expose: r }) {
  769. e.physicallyCorrectLights === true && ut("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
  770. const o = ref(), n = ref(), i = new Scene(), { setState: c } = L();
  771. c("scene", i);
  772. function a() {
  773. const { renderer: p } = tt(n, o, e), { activeCamera: m } = ce(), { onLoop: d } = $(), { raycaster: w, pointer: v } = me();
  774. d(() => {
  775. var g;
  776. m.value && (w.value.setFromCamera(v.value, m.value), (g = p.value) == null || g.render(i, m.value));
  777. });
  778. }
  779. watch(n, a);
  780. let s;
  781. function l() {
  782. s = ct(t), s.provide("useTres", L()), s.provide("extend", se), s.mount(i);
  783. }
  784. return l(), r({
  785. scene: i
  786. }), () => h(
  787. h(
  788. "div",
  789. {
  790. ref: o,
  791. style: {
  792. position: "relative",
  793. width: "100%",
  794. height: "100%",
  795. pointerEvents: "auto",
  796. touchAction: "none"
  797. }
  798. },
  799. [
  800. h(
  801. "div",
  802. {
  803. style: {
  804. width: "100%",
  805. height: "100%"
  806. }
  807. },
  808. [
  809. h("canvas", {
  810. ref: n,
  811. style: {
  812. display: "block",
  813. width: "100%",
  814. height: "100%",
  815. position: e.windowSize ? "fixed" : "absolute",
  816. top: 0,
  817. left: 0
  818. }
  819. })
  820. ]
  821. )
  822. ]
  823. )
  824. );
  825. }
  826. });
  827. var wt = {
  828. install(e) {
  829. e.component("TresCanvas", lt);
  830. }
  831. };
  832. export {
  833. G,
  834. se,
  835. Ne,
  836. ce,
  837. $,
  838. tt,
  839. nt,
  840. dt,
  841. vt,
  842. L,
  843. me,
  844. gt,
  845. j,
  846. lt,
  847. wt
  848. };
  849. //# sourceMappingURL=chunk-ZUTZQNJG.js.map