util.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. import * as THREE from 'three';
  2. import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
  3. import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js';
  4. import { OutlinePass } from 'three/examples/jsm/postprocessing/OutlinePass.js';
  5. import { FXAAShader } from 'three/examples/jsm/shaders/FXAAShader.js';
  6. import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass.js';
  7. import TWEEN from 'three/examples/jsm/libs/tween.module.js';
  8. import { CSS3DObject } from 'three/examples/jsm/renderers/CSS3DRenderer.js';
  9. import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader.js';
  10. import gsap from 'gsap';
  11. import { useAppStore } from '/@/store/modules/app';
  12. import UseThree from './useThree';
  13. import { useGlobSetting } from '/@/hooks/setting';
  14. const globSetting = useGlobSetting();
  15. const baseApiUrl = globSetting.domainUrl;
  16. // import * as dat from "dat.gui";
  17. /* 设置模型居中 */
  18. export const setModalCenter = (group, modal?) => {
  19. const box3 = new THREE.Box3();
  20. // 计算层级模型group的包围盒
  21. // 模型group是加载一个三维模型返回的对象,包含多个网格模型
  22. box3.expandByObject(group);
  23. // 计算一个层级模型对应包围盒的几何体中心在世界坐标中的位置
  24. const center = new THREE.Vector3();
  25. box3.getCenter(center);
  26. // console.log('查看几何体中心坐标', center);
  27. // 重新设置模型的位置,使之居中。
  28. group.position.x = group.position.x - center.x;
  29. group.position.y = group.position.y - center.y;
  30. group.position.z = group.position.z - center.z;
  31. // debugger;
  32. };
  33. // 获取一个canvas 图文纹理
  34. export const getTextCanvas = (w, h, textArr, imgUrl) => {
  35. // canvas 宽高最好是2的倍数
  36. const width = w;
  37. const height = h;
  38. // 创建一个canvas元素 获取上下文环境
  39. const canvas = document.createElement('canvas');
  40. canvas.style.letterSpacing = 10 + 'px';
  41. const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
  42. canvas.width = width;
  43. canvas.height = height;
  44. // 设置样式
  45. ctx.textAlign = 'start';
  46. ctx.fillStyle = 'rgba(0, 0, 0, 0)';
  47. // 创建渐变
  48. // var gradient=ctx.createLinearGradient(0,0, canvas.width,0);
  49. // gradient.addColorStop(0,"magenta");
  50. // gradient.addColorStop(0.5,"blue");
  51. // gradient.addColorStop(1.0,"red");
  52. // // 用渐变填色
  53. // ctx.fillStyle=gradient;
  54. ctx.shadowColor = 'rgba(0, 10,0,0.8)';
  55. ctx.shadowBlur = 4;
  56. ctx.shadowOffsetX = 1;
  57. ctx.shadowOffsetY = 1;
  58. ctx.fillRect(0, 0, width, height);
  59. //添加背景图片,进行异步,否则可能会过早渲染,导致空白
  60. return new Promise((resolve, reject) => {
  61. if (imgUrl) {
  62. const img = new Image();
  63. img.src = new URL('/src/assets/images/vent/model_image/' + imgUrl, import.meta.url).href;
  64. img.onload = () => {
  65. //将画布处理为透明
  66. ctx.clearRect(0, 0, width, height);
  67. //绘画图片
  68. ctx.drawImage(img, 0, 0, width, height);
  69. ctx.textBaseline = 'middle';
  70. // 由于文字需要自己排版 所以循环一下
  71. // item 是自定义的文字对象 包含文字内容 字体大小颜色 位置信息等
  72. if (textArr) {
  73. textArr.forEach((item) => {
  74. ctx.font = item.font;
  75. ctx.fillStyle = item.color;
  76. ctx.fillText(item.text, item.x, item.y, 1024);
  77. });
  78. }
  79. resolve(canvas);
  80. };
  81. //图片加载失败的方法
  82. img.onerror = (e) => {
  83. reject(e);
  84. };
  85. } else {
  86. //将画布处理为透明
  87. ctx.clearRect(0, 0, width, height);
  88. ctx.textBaseline = 'middle';
  89. textArr.forEach((item) => {
  90. ctx.lineWidth = 2;
  91. ctx.font = item.font;
  92. ctx.fillStyle = item.color;
  93. // !!item.strokeStyle && (ctx.strokeStyle = item.strokeStyle);
  94. // if (item.strokeStyle) ctx.strokeText(item.text, item.x, item.y, 1024);
  95. ctx.fillText(item.text, item.x, item.y, 1024);
  96. });
  97. resolve(canvas);
  98. }
  99. });
  100. };
  101. // 发光路径
  102. export const setLineGeo = (scene) => {
  103. const box = new THREE.BoxGeometry(30, 30, 30);
  104. // 立方体几何体box作为EdgesGeometry参数创建一个新的几何体
  105. const edges = new THREE.EdgesGeometry(box);
  106. // 立方体线框,不显示中间的斜线
  107. new THREE.TextureLoader().setPath('/model/hdr/').load('8.png', (texture) => {
  108. const edgesMaterial = new THREE.MeshBasicMaterial({
  109. // color: 0x00ffff,
  110. map: texture,
  111. transparent: true,
  112. depthWrite: false,
  113. });
  114. const line = new THREE.LineSegments(edges, edgesMaterial);
  115. // 网格模型和网格模型对应的轮廓线框插入到场景中
  116. scene.add(line);
  117. texture.dispose();
  118. });
  119. box.attributes.position.array;
  120. const lightMaterial = new THREE.ShaderMaterial({
  121. vertexShader: `varying vec3 vPosition;
  122. varying vec2 vUv;
  123. uniform float uTime;
  124. void main(){
  125. // vec3 scalePosition = vec3(position.x+uTime,position.y,position.z+uTime);
  126. vec4 viewPosition = viewMatrix * modelMatrix * vec4(position,1);
  127. gl_Position = projectionMatrix * viewPosition;
  128. vPosition = position;
  129. vUv = uv;
  130. }`,
  131. fragmentShader: `varying vec3 vPosition;
  132. varying vec2 vUv;
  133. uniform vec3 uColor;
  134. uniform float uHeight;
  135. vec4 permute(vec4 x)
  136. {
  137. return mod(((x*34.0)+1.0)*x, 289.0);
  138. }
  139. vec2 fade(vec2 t)
  140. {
  141. return t*t*t*(t*(t*6.0-15.0)+10.0);
  142. }
  143. float cnoise(vec2 P)
  144. {
  145. vec4 Pi = floor(P.xyxy) + vec4(0.0, 0.0, 1.0, 1.0);
  146. vec4 Pf = fract(P.xyxy) - vec4(0.0, 0.0, 1.0, 1.0);
  147. Pi = mod(Pi, 289.0); // To avoid truncation effects in permutation
  148. vec4 ix = Pi.xzxz;
  149. vec4 iy = Pi.yyww;
  150. vec4 fx = Pf.xzxz;
  151. vec4 fy = Pf.yyww;
  152. vec4 i = permute(permute(ix) + iy);
  153. vec4 gx = 2.0 * fract(i * 0.0243902439) - 1.0; // 1/41 = 0.024...
  154. vec4 gy = abs(gx) - 0.5;
  155. vec4 tx = floor(gx + 0.5);
  156. gx = gx - tx;
  157. vec2 g00 = vec2(gx.x,gy.x);
  158. vec2 g10 = vec2(gx.y,gy.y);
  159. vec2 g01 = vec2(gx.z,gy.z);
  160. vec2 g11 = vec2(gx.w,gy.w);
  161. vec4 norm = 1.79284291400159 - 0.85373472095314 * vec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11));
  162. g00 *= norm.x;
  163. g01 *= norm.y;
  164. g10 *= norm.z;
  165. g11 *= norm.w;
  166. float n00 = dot(g00, vec2(fx.x, fy.x));
  167. float n10 = dot(g10, vec2(fx.y, fy.y));
  168. float n01 = dot(g01, vec2(fx.z, fy.z));
  169. float n11 = dot(g11, vec2(fx.w, fy.w));
  170. vec2 fade_xy = fade(Pf.xy);
  171. vec2 n_x = mix(vec2(n00, n01), vec2(n10, n11), fade_xy.x);
  172. float n_xy = mix(n_x.x, n_x.y, fade_xy.y);
  173. return 2.3 * n_xy;
  174. }
  175. void main(){
  176. float strength = (vPosition.y+uHeight/2.0)/uHeight;
  177. gl_FragColor = vec4(uColor,1.0 - strength);
  178. // float strength =1.0 - abs(cnoise(vUv * 10.0)) ;
  179. // gl_FragColor =vec4(strength,strength,strength,1);
  180. }`,
  181. transparent: true,
  182. side: THREE.DoubleSide,
  183. });
  184. const lightMesh = new THREE.Mesh(box, lightMaterial);
  185. lightMesh.geometry.computeBoundingBox();
  186. const { min, max } = lightMesh.geometry.boundingBox;
  187. const uHeight = max.y - min.y;
  188. lightMaterial.uniforms.uHeight = {
  189. value: uHeight,
  190. };
  191. lightMaterial.uniforms.uColor = {
  192. value: new THREE.Color(0x00ff00),
  193. };
  194. lightMaterial.uniforms.uTime = {
  195. value: 0,
  196. };
  197. // gsap.to(lightMesh.scale, {
  198. // // x: 2,
  199. // // z: 2,
  200. // y: 0.8,
  201. // duration: 1,
  202. // ease: 'none',
  203. // repeat: -1,
  204. // yoyo: true,
  205. // });
  206. scene.add(lightMesh);
  207. };
  208. export const setOutline = (model, group) => {
  209. const { scene, renderer, camera } = model;
  210. const params = {
  211. edgeStrength: 10.0,
  212. edgeGlow: 1,
  213. edgeThickness: 1.0,
  214. pulsePeriod: 5,
  215. rotate: false,
  216. usePatternTexture: false,
  217. };
  218. const composer = new EffectComposer(renderer);
  219. const renderPass = new RenderPass(scene, camera);
  220. composer.addPass(renderPass);
  221. const outlinePass = new OutlinePass(new THREE.Vector2(window.innerWidth, window.innerHeight), scene, camera);
  222. composer.addPass(outlinePass);
  223. outlinePass.visibleEdgeColor.set(parseInt(0xffffff));
  224. outlinePass.hiddenEdgeColor.set('#190a05');
  225. outlinePass.edgeStrength = params.edgeStrength;
  226. outlinePass.edgeThickness = params.edgeThickness;
  227. outlinePass.pulsePeriod = params.pulsePeriod;
  228. outlinePass.usePatternTexture = params.usePatternTexture;
  229. // const textureLoader = new THREE.TextureLoader();
  230. // textureLoader.load('model/hdr/tri_pattern.jpg', function (texture) {
  231. // outlinePass.patternTexture = texture;
  232. // texture.wrapS = THREE.RepeatWrapping;
  233. // texture.wrapT = THREE.RepeatWrapping;
  234. // });
  235. const effectFXAA = new ShaderPass(FXAAShader);
  236. effectFXAA.uniforms['resolution'].value.set(1 / window.innerWidth, 1 / window.innerHeight);
  237. composer.addPass(effectFXAA);
  238. const scale = 1;
  239. group.traverse(function (child) {
  240. if (child instanceof THREE.Mesh) {
  241. // child.geometry.center();
  242. child.geometry.computeBoundingSphere();
  243. }
  244. });
  245. // group.scale.multiplyScalar(Math.random() * 0.3 + 0.1);
  246. group.scale.divideScalar(scale);
  247. return { outlinePass, composer };
  248. };
  249. /* 渲染视频 */
  250. export const renderVideo = (group, player, playerMeshName) => {
  251. //加载视频贴图;
  252. THREE.ImageUtils['crossOrigin'] = '';
  253. const texture = new THREE.VideoTexture(player);
  254. console.log('视频贴图------------>', texture);
  255. if (texture && texture['data'] && !texture['data'].currentSrc) {
  256. console.log('摄像头纹理为空。。。。');
  257. }
  258. if (texture && group?.getObjectByName(playerMeshName)) {
  259. const player = group.getObjectByName(playerMeshName);
  260. player.material.map = texture;
  261. // texture.dispose();
  262. } else {
  263. //创建网格;
  264. const planeGeometry = new THREE.PlaneGeometry(30, 20);
  265. const material = new THREE.MeshBasicMaterial({
  266. map: texture,
  267. side: THREE.DoubleSide,
  268. });
  269. /* 消除摩尔纹 */
  270. texture.magFilter = THREE.LinearFilter;
  271. texture.minFilter = THREE.LinearFilter;
  272. texture.wrapS = texture.wrapT = THREE.ClampToEdgeWrapping;
  273. texture.format = THREE.RGBAFormat;
  274. texture.anisotropy = 0.5;
  275. // texture.generateMipmaps = false
  276. const mesh = new THREE.Mesh(planeGeometry, material);
  277. mesh.name = playerMeshName;
  278. texture.dispose();
  279. // group.add(mesh);
  280. return mesh;
  281. }
  282. };
  283. // oldP 相机原来的位置
  284. // oldT target原来的位置
  285. // newP 相机新的位置
  286. // newT target新的位置
  287. // callBack 动画结束时的回调函数
  288. export const animateCamera = (oldP, oldT, newP, newT, model, duration = 0.5, callBack?) => {
  289. return new Promise((resolve) => {
  290. const camera = model.camera;
  291. const controls = model.orbitControls;
  292. controls.renderEnabled = false;
  293. controls.target.set(0, 0, 0);
  294. const animateObj = {
  295. x1: oldP.x, // 相机x
  296. y1: oldP.y, // 相机y
  297. z1: oldP.z, // 相机z
  298. x2: oldT.x, // 控制点的中心点x
  299. y2: oldT.y, // 控制点的中心点y
  300. z2: oldT.z, // 控制点的中心点z
  301. };
  302. gsap.fromTo(
  303. animateObj,
  304. {
  305. x1: oldP.x, // 相机x
  306. y1: oldP.y, // 相机y
  307. z1: oldP.z, // 相机z
  308. x2: oldT.x, // 控制点的中心点x
  309. y2: oldT.y, // 控制点的中心点y
  310. z2: oldT.z, // 控制点的中心点z
  311. },
  312. {
  313. x1: newP.x,
  314. y1: newP.y,
  315. z1: newP.z,
  316. x2: newT.x,
  317. y2: newT.y,
  318. z2: newT.z,
  319. duration: duration,
  320. ease: 'easeOutBounce',
  321. onUpdate: function (object) {
  322. // 这里写逻辑
  323. // debugger;
  324. camera.position.set(object.x1, object.y1, object.z1);
  325. controls.target.set(object.x2, object.y2, object.z2);
  326. controls.update();
  327. if (callBack) callBack();
  328. },
  329. onUpdateParams: [animateObj],
  330. onComplete: function () {
  331. // 完成
  332. controls.renderEnabled = true;
  333. resolve(null);
  334. },
  335. }
  336. );
  337. });
  338. };
  339. export const transScreenCoord = (vector, camera) => {
  340. // const screenCoord = { x: 0, y: 0 };
  341. // vector.project(camera);
  342. // screenCoord.x = (0.5 + vector.x / 2) * window.innerWidth;
  343. // screenCoord.y = (0.5 - vector.y / 2) * window.innerHeight;
  344. // return screenCoord;
  345. const stdVector = vector.project(camera);
  346. const a = window.innerWidth / 2;
  347. const b = window.innerHeight / 2;
  348. const x = Math.round(stdVector.x * a + a);
  349. const y = Math.round(-stdVector.y * b + b);
  350. return { x, y };
  351. };
  352. export const drawHot = (scale: number) => {
  353. // const hotMap = new THREE.TextureLoader().load('/src/assets/images/hot-point.png');
  354. // const hotMap = new THREE.TextureLoader().setPath('/model/img/').load('/hot-point.png');
  355. const hotMap = new THREE.TextureLoader().load('/model/img/hot-point.png');
  356. const material = new THREE.SpriteMaterial({
  357. map: hotMap,
  358. });
  359. const hotPoint = new THREE.Sprite(material);
  360. const spriteTween = new TWEEN.Tween({
  361. scale: 1 * scale,
  362. })
  363. .to(
  364. {
  365. scale: 0.65 * scale,
  366. },
  367. 1000
  368. )
  369. .easing(TWEEN.Easing.Quadratic.Out);
  370. spriteTween.onUpdate(function (that) {
  371. hotPoint.scale.set(that.scale, that.scale, that.scale);
  372. });
  373. spriteTween.yoyo(true);
  374. spriteTween.repeat(Infinity);
  375. spriteTween.start();
  376. hotMap.dispose();
  377. return hotPoint;
  378. };
  379. export const deviceDetailCard = () => {
  380. //
  381. };
  382. export const updateAxisCenter = (modal: UseThree, group: THREE.Object3D, event, callBack?) => {
  383. if (!modal) return;
  384. const appStore = useAppStore();
  385. event.stopPropagation();
  386. const widthScale = appStore.getWidthScale;
  387. const heightScale = appStore.getHeightScale;
  388. // 将鼠标位置归一化为设备坐标。x 和 y 方向的取值范围是 (-1 to +1)
  389. modal.mouse.x =
  390. ((-modal.canvasContainer.getBoundingClientRect().left * widthScale + event.clientX) / (modal.canvasContainer.clientWidth * widthScale)) * 2 - 1;
  391. modal.mouse.y =
  392. -((-modal.canvasContainer.getBoundingClientRect().top + event.clientY) / (modal.canvasContainer.clientHeight * heightScale)) * 2 + 1;
  393. (modal.rayCaster as THREE.Raycaster).setFromCamera(modal.mouse, modal.camera as THREE.Camera);
  394. if (group) {
  395. const intersects = modal.rayCaster?.intersectObjects(group.children, true) as THREE.Intersection[];
  396. if (intersects.length > 0) {
  397. const point = intersects[0].point;
  398. const target0 = modal.orbitControls.target.clone();
  399. gsap.fromTo(
  400. modal.orbitControls.target,
  401. { x: target0.x, y: target0.y, z: target0.z },
  402. {
  403. x: point.x,
  404. y: point.y,
  405. z: point.z,
  406. duration: 0.4,
  407. ease: 'easeInCirc',
  408. onUpdate: function (object) {
  409. if (object) modal.camera?.lookAt(new THREE.Vector3(object.x, object.y, object.z));
  410. },
  411. }
  412. );
  413. callBack(intersects);
  414. }
  415. }
  416. // const factor = 1;
  417. // //这里定义深度值为0.5,深度值越大,意味着精度越高
  418. // var vector = new THREE.Vector3(modal.mouse.x, modal.mouse.y, 0.5);
  419. // //将鼠标坐标转换为3D空间坐标
  420. // vector.unproject(modal.camera);
  421. // //获得从相机指向鼠标所对应的3D空间点的射线(归一化)
  422. // vector.sub(modal.camera.position).normalize();
  423. // if (event.originalEvent && event.originalEvent.deltaY && event.originalEvent.deltaY < 0) {
  424. // modal.camera.position.x += vector.x * factor;
  425. // modal.camera.position.y += vector.y * factor;
  426. // modal.camera.position.z += vector.z * factor;
  427. // modal.orbitControls.target.x += vector.x * factor;
  428. // modal.orbitControls.target.y += vector.y * factor;
  429. // modal.orbitControls.target.z += vector.z * factor;
  430. // } else {
  431. // modal.camera.position.x -= vector.x * factor;
  432. // modal.camera.position.y -= vector.y * factor;
  433. // modal.camera.position.z -= vector.z * factor;
  434. // modal.orbitControls.target.x -= vector.x * factor;
  435. // modal.orbitControls.target.y -= vector.y * factor;
  436. // modal.orbitControls.target.z -= vector.z * factor;
  437. // }
  438. // modal.orbitControls.update();
  439. // modal.camera.updateMatrixWorld();
  440. };
  441. export const addEnvMap = (hdr, modal) => {
  442. return new Promise((resolve) => {
  443. const loader = new RGBELoader().setPath('/model/hdr/').load(hdr + '.hdr', (texture) => {
  444. texture.mapping = THREE.EquirectangularReflectionMapping;
  445. const defaultEnvironment = texture;
  446. modal.scene.environment = defaultEnvironment;
  447. resolve(null);
  448. texture.dispose();
  449. });
  450. loader.dispose();
  451. });
  452. };
  453. export const setTag3D = (text, className) => {
  454. const div = document.createElement('div') as HTMLElement;
  455. div.innerHTML = text;
  456. div.classList.add(className);
  457. //div元素包装为CSS3模型对象CSS3DObject
  458. const label = new CSS3DObject(div);
  459. div.style.pointerEvents = 'none'; //避免HTML标签遮挡三维场景的鼠标事件
  460. // 设置HTML元素标签在three.js世界坐标中位置
  461. // label.position.set(x, y, z);
  462. //缩放CSS3DObject模型对象
  463. // label.rotateY(Math.PI / 2); //控制HTML标签CSS3对象姿态角度
  464. label.rotateX(-Math.PI / 2);
  465. return label; //返回CSS3模型标签
  466. };
  467. // convert #hex notation to rgb array
  468. const parseColor = function (hexStr) {
  469. return hexStr.length === 4
  470. ? hexStr
  471. .substr(1)
  472. .split('')
  473. .map(function (s) {
  474. return 0x11 * parseInt(s, 16);
  475. })
  476. : [hexStr.substr(1, 2), hexStr.substr(3, 2), hexStr.substr(5, 2)].map(function (s) {
  477. return parseInt(s, 16);
  478. });
  479. };
  480. // zero-pad 1 digit to 2
  481. const pad = function (s) {
  482. return s.length === 1 ? '0' + s : s;
  483. };
  484. export const gradientColors = function (start, end, steps, gamma) {
  485. let i,
  486. j,
  487. ms,
  488. me,
  489. output = [],
  490. so = [];
  491. gamma = gamma || 1;
  492. const normalize = function (channel) {
  493. return Math.pow(channel / 255, gamma);
  494. };
  495. start = parseColor(start).map(normalize);
  496. end = parseColor(end).map(normalize);
  497. for (i = 0; i < steps; i++) {
  498. ms = i / (steps - 1);
  499. me = 1 - ms;
  500. for (j = 0; j < 3; j++) {
  501. so[j] = pad(Math.round(Math.pow(start[j] * me + end[j] * ms, 1 / gamma) * 255).toString(16));
  502. }
  503. output.push('#' + so.join(''));
  504. }
  505. return output;
  506. };
  507. export function saveModel(fileName, path, version) {
  508. const db = window['CustomDB'];
  509. const loader = new THREE.FileLoader();
  510. loader.setResponseType('arraybuffer');
  511. loader.setRequestHeader({});
  512. loader.setWithCredentials(false);
  513. try {
  514. loader.load(`${baseApiUrl}/sys/common/static/${path}`, async (data) => {
  515. const model = {
  516. modalName: fileName,
  517. modalVal: data,
  518. versionStr: version,
  519. };
  520. const modalArr = await db.modal.where('modalName').equals(fileName).toArray();
  521. if (modalArr.length > 0) {
  522. db.modal.delete(fileName);
  523. }
  524. await db.modal.add(model);
  525. });
  526. } catch (error) {}
  527. }