clipoox-render 0.4.3 → 0.4.5

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 (191) hide show
  1. package/package.json +4 -3
  2. package/scripts/render-local.mjs +5160 -1446
  3. package/web/assets/FxEmbed-DbfuM8Yo.js +1 -0
  4. package/web/assets/MotionEmbed-CBQ-8Tzh.js +1 -0
  5. package/web/assets/PluginStore-OOEx0lP5.js +3 -0
  6. package/web/assets/ShotComposer-Cng515xa.js +287 -0
  7. package/web/assets/{ShotComposer-VixLbeMe.css → ShotComposer-deLi4grZ.css} +1 -1
  8. package/web/assets/TemplateEmbed-hjwM2b0o.js +2 -0
  9. package/web/assets/{TimelinePlugins-BYZ9y4m3.js → TimelinePlugins-D-NakABP.js} +4 -4
  10. package/web/assets/TimelineShotFx-D3kGhHN3.js +2 -0
  11. package/web/assets/TransitionEmbed-DR26yI3a.js +1 -0
  12. package/web/assets/{Whiteboard-BP_DvIAV.js → Whiteboard-BhxY0D0Z.js} +3 -3
  13. package/web/assets/aerial-BisYSXzG.js +2 -0
  14. package/web/assets/agentTools-CPFQeiDP.js +2 -0
  15. package/web/assets/aiInbetween-AOOM1e6p.js +2 -0
  16. package/web/assets/analyzerRun-Dtp2o7gT.js +1 -0
  17. package/web/assets/analyzerSandbox-BG_3Cea1.js +33 -0
  18. package/web/assets/api-BFN7blbw.js +3158 -0
  19. package/web/assets/auraTrack-D_gxHNVe.js +1 -0
  20. package/web/assets/breakthrough-0qFpZW-V.js +2 -0
  21. package/web/assets/{cameraPresets-CYw0OdM3.js → cameraPresets-eK3mP7qb.js} +1 -1
  22. package/web/assets/cameraTracker-BAQHuTV-.js +72 -0
  23. package/web/assets/captionLayout-CWPcbid-.js +1 -0
  24. package/web/assets/clientExport-DvpTTndR.js +1 -0
  25. package/web/assets/clientJobs-CIrYTMpn.js +2 -0
  26. package/web/assets/clientJobs-CuuUyhEy.js +1 -0
  27. package/web/assets/cutoutClean-CLYYAuXg.js +1 -0
  28. package/web/assets/depthEstimate-B7D7cGCl.js +1 -0
  29. package/web/assets/directorTools-CJD4Huqk.js +1 -0
  30. package/web/assets/distortFrames-BLt1icUb.js +2 -0
  31. package/web/assets/{distortGL-QalhICvi.js → distortGL-BA5molk-.js} +3 -3
  32. package/web/assets/draco_decoder-C32yEggz.wasm +0 -0
  33. package/web/assets/draco_decoder-Z1_iN-Ht.wasm +0 -0
  34. package/web/assets/draco_decoder-fzg4nYZr.js +34 -0
  35. package/web/assets/draco_wasm_wrapper-DxJM36Ib.js +117 -0
  36. package/web/assets/draco_wasm_wrapper-fZCQGLGb.js +116 -0
  37. package/web/assets/editTools-NKLsWZD1.js +1 -0
  38. package/web/assets/{engine-BedcnK45.js → engine-DioUF2mX.js} +1 -1
  39. package/web/assets/exportGlb-BOdI9cVS.js +2 -0
  40. package/web/assets/faceTracker-D7CbF-qX.js +1 -0
  41. package/web/assets/fightDirector-CYP8jxo8.js +1 -0
  42. package/web/assets/fightDrama-DIPcRKnc.js +2 -0
  43. package/web/assets/focusTool-vfabPqQ5.js +1 -0
  44. package/web/assets/{frameSink-DeM8xC8_.js → frameSink-DYs2gTzq.js} +3 -3
  45. package/web/assets/glTransitionSources.generated-DM5sRMX2.js +3695 -0
  46. package/web/assets/gltfLoader-U0Eebg7v.js +2 -0
  47. package/web/assets/{gpuCompose-CA3UmOl4.js → gpuCompose-DbnZuelB.js} +1 -1
  48. package/web/assets/gpuExport-CQ7ZhpsX.js +198 -0
  49. package/web/assets/handMatte-DIbMuqCu.js +1 -0
  50. package/web/assets/handTracker-DY_g5Xmg.js +2 -0
  51. package/web/assets/i18n-BJppIrtF.js +3 -0
  52. package/web/assets/index-BfrDwjDI.js +4247 -0
  53. package/web/assets/index-CKtv7gGE.js +9 -0
  54. package/web/assets/{index-D5oyVCRl.js → index-DxdDhmLR.js} +2 -2
  55. package/web/assets/layer-worker-DK67WH1a.js +5 -0
  56. package/web/assets/library-B6KsZUKq.js +1 -0
  57. package/web/assets/lottieLayer-C2YbiXhK.js +161 -0
  58. package/web/assets/{lottie_light_canvas-B-d7-ATe.js → lottie_light_canvas-DX9Wf-DS.js} +1 -1
  59. package/web/assets/main-B27kf5aL.css +1 -0
  60. package/web/assets/main-BKatDoGw.js +309 -0
  61. package/web/assets/mapBake-C-G7WpFM.js +1 -0
  62. package/web/assets/maskTrack-LMrwm5ub.js +1 -0
  63. package/web/assets/matteFixRun-B38CbeEt.js +1 -0
  64. package/web/assets/matteQuality-9X-jgJrH.js +1 -0
  65. package/web/assets/objectLocate-CKi3OTnL.js +1 -0
  66. package/web/assets/objectSegmenter-CziPuM61.js +1 -0
  67. package/web/assets/{objectTrack.worker-BlZkgpOX.js → objectTrack.worker-b7DJ-ub6.js} +196 -196
  68. package/web/assets/pathTracer-bqau16sX.js +2 -0
  69. package/web/assets/pendingMatte-CQb7jPg1.js +2 -0
  70. package/web/assets/personAi-CQntGDqK.js +2 -0
  71. package/web/assets/personHq-B1c0QVJT.js +2 -0
  72. package/web/assets/plateCamera-D7iLiNBy.js +1 -0
  73. package/web/assets/plateCameraMatch-BM88dx-a.js +2 -0
  74. package/web/assets/plateFollow-4iGUDTu1.js +2 -0
  75. package/web/assets/plateMatte-zTyuHHqh.js +2 -0
  76. package/web/assets/plugin-guide.en-DO_fHbzT.js +1 -0
  77. package/web/assets/plugin-guide.vi-CMJDxOhi.js +1 -0
  78. package/web/assets/pluginAutomation-DSg-sYLF.js +1 -0
  79. package/web/assets/poseTracker-DZl8l2qS.js +1 -0
  80. package/web/assets/productTools-B-jh8ukh.js +2 -0
  81. package/web/assets/remote-DJd9xWjn.js +963 -0
  82. package/web/assets/{rigTrack-urT3nDK0.js → rigTrack-XaMj1yaH.js} +1 -1
  83. package/web/assets/rotoMaskStore-DdpmT9C3.js +1 -0
  84. package/web/assets/{rotoMatte-C-2o3vv0.js → rotoMatte-i-cJTYmK.js} +1 -1
  85. package/web/assets/rotoscope-DqRSWmHR.js +1 -0
  86. package/web/assets/sceneTrack-Bbov7zET.js +1 -0
  87. package/web/assets/sceneTrack-DIPzBmMK.js +1 -0
  88. package/web/assets/{sceneTrack.worker-CT4uoTKn.js → sceneTrack.worker-Bav9h0pv.js} +180 -180
  89. package/web/assets/shot-worker-m-q77W9f.js +1 -0
  90. package/web/assets/{shotFxAgent-BFLkqs8v.js → shotFxAgent-DIMS7BGA.js} +2 -2
  91. package/web/assets/{skin-DY4QLaBI.js → skin-DrUzJE1u.js} +1 -1
  92. package/web/assets/{spark.module-DzziUgOj.js → spark.module-Y1SEI8Xz.js} +10 -10
  93. package/web/assets/spellDuel-DNnyQDVr.js +2 -0
  94. package/web/assets/store-GFMJzaWS.js +1 -0
  95. package/web/assets/surfaceLight-C--moyc9.js +1 -0
  96. package/web/assets/surfacePin-B4-1UqXD.js +2 -0
  97. package/web/assets/{textAnimators-DUZjhVGO.js → textAnimators-BVXTl8bU.js} +1 -1
  98. package/web/assets/{thumb-CS0ZuiGS.js → thumb-CTfDJgLp.js} +1 -1
  99. package/web/assets/timeline3d-Dn7PqmEe.js +2 -0
  100. package/web/assets/timeline3dExport-DCOr6ARB.js +1 -0
  101. package/web/assets/timelineComp-Dx_kED5V.js +1 -0
  102. package/web/assets/timelineOps-afzSo188.js +525 -0
  103. package/web/assets/timelineProps-eYgO6gs5.js +1 -0
  104. package/web/assets/timelineText-RKyRP988.js +1 -0
  105. package/web/assets/{titleArt-Drsrtfiv.js → titleArt-CUtA0C3I.js} +4 -4
  106. package/web/assets/{titleFrameBudget-CLZWaFHO.js → titleFrameBudget-X7HLSDre.js} +721 -704
  107. package/web/assets/titleFrames-aMG7HdVe.js +1 -0
  108. package/web/assets/{tool-DktQYmS6.js → tool-DpFjybaq.js} +1 -1
  109. package/web/assets/{tools-Co9aRDiT.js → tools-CeOU0p13.js} +1 -1
  110. package/web/assets/toonTools-DLmo37Z_.js +2 -0
  111. package/web/assets/trackAnchor-hAOtEhKO.js +1 -0
  112. package/web/assets/userFonts-1kuRjWOo.js +1 -0
  113. package/web/assets/{vfxAlpha-71tSN86T.js → vfxAlpha-DxS5-QwY.js} +2 -2
  114. package/web/assets/vfxBackground-CYpaQaTa.js +2 -0
  115. package/web/assets/videoExport-Cg4B2Nyh.js +1 -0
  116. package/web/assets/views-CUXyRb9x.js +1 -0
  117. package/web/assets/weaponDuel-nFECu9nk.js +1 -0
  118. package/web/assets/windowFrames-1wAkkWnv.js +1 -0
  119. package/web/layer-worker.html +3 -3
  120. package/web/shot-worker.html +41 -0
  121. package/web/assets/FxEmbed-BCmj9Q5C.js +0 -1
  122. package/web/assets/GLTFLoader-BHWu1lKg.js +0 -1
  123. package/web/assets/MotionEmbed-CEmbcq8Z.js +0 -1
  124. package/web/assets/PluginStore-C5hyahvG.js +0 -3
  125. package/web/assets/ShotComposer-0DUtMTVI.js +0 -287
  126. package/web/assets/TemplateEmbed-ANxSs7H5.js +0 -2
  127. package/web/assets/TimelineShotFx-q5PQwq-V.js +0 -2
  128. package/web/assets/TransitionEmbed-O6LInGWq.js +0 -1
  129. package/web/assets/aerial-CGLDKKtP.js +0 -2
  130. package/web/assets/agentTools-2Ghb80VH.js +0 -2
  131. package/web/assets/analyzerRun-DRgxrcJA.js +0 -1
  132. package/web/assets/analyzerSandbox-DuIVFnsk.js +0 -33
  133. package/web/assets/api-CJ8PdbfZ.js +0 -3168
  134. package/web/assets/auraTrack-DQw9sVU6.js +0 -1
  135. package/web/assets/breakthrough-BNj_iTDr.js +0 -2
  136. package/web/assets/captionLayout-DvDPTwO9.js +0 -1
  137. package/web/assets/clientExport-xhoXY6Dh.js +0 -1
  138. package/web/assets/depthEstimate-DEpeCojm.js +0 -1
  139. package/web/assets/directorTools-C5CpTmci.js +0 -1
  140. package/web/assets/distortFrames-Dia8O1NM.js +0 -2
  141. package/web/assets/editTools-CY_JrQfw.js +0 -1
  142. package/web/assets/exportEncode-QYsT9JBO.js +0 -1
  143. package/web/assets/exportGlb-TSj09XoV.js +0 -2
  144. package/web/assets/faceTracker-CnCWOwnJ.js +0 -1
  145. package/web/assets/fightDirector-DCI_FWTh.js +0 -1
  146. package/web/assets/fightDrama-Bg7uP_2Q.js +0 -2
  147. package/web/assets/gpuExport-D31azOQA.js +0 -198
  148. package/web/assets/handMatte-Dl-xVXFR.js +0 -1
  149. package/web/assets/handTracker-CplBsAFg.js +0 -2
  150. package/web/assets/layer-worker-DFuo32bk.js +0 -5
  151. package/web/assets/library-BufgA-Pl.js +0 -1
  152. package/web/assets/lottieLayer-DzbA3bHV.js +0 -158
  153. package/web/assets/main-Ca_CVxMz.css +0 -1
  154. package/web/assets/main-VVYiW8XD.js +0 -309
  155. package/web/assets/mapBake-BKOcEd0w.js +0 -1
  156. package/web/assets/maskTrack-CHGXtBRy.js +0 -1
  157. package/web/assets/matteFixRun-vgYrINet.js +0 -1
  158. package/web/assets/objectLocate-BJltm8Ob.js +0 -1
  159. package/web/assets/pendingMatte-BPyzzx4y.js +0 -2
  160. package/web/assets/personAi-gJu03SjU.js +0 -2
  161. package/web/assets/plateCamera-B2JvhjJw.js +0 -1
  162. package/web/assets/plateCameraMatch-ByB9nVQT.js +0 -2
  163. package/web/assets/plateFollow-C9S-l7RH.js +0 -2
  164. package/web/assets/plateMatte-J4qlNHnY.js +0 -2
  165. package/web/assets/plugin-guide.en-CGYh_9Su.js +0 -1
  166. package/web/assets/plugin-guide.vi-DMphSELb.js +0 -1
  167. package/web/assets/pluginAutomation-CkP3tA9r.js +0 -1
  168. package/web/assets/poseTracker-DGLbouqt.js +0 -1
  169. package/web/assets/productTools-CkaWF1bM.js +0 -2
  170. package/web/assets/remote-C7J0Tqhb.js +0 -1433
  171. package/web/assets/rotoMaskStore-DPziPKAN.js +0 -1
  172. package/web/assets/rotoscope-GvPFRUBg.js +0 -1
  173. package/web/assets/shot-worker-6dYkHPoL.js +0 -1
  174. package/web/assets/spellDuel-BD3m2ebA.js +0 -2
  175. package/web/assets/store-DW4E9xnW.js +0 -1
  176. package/web/assets/surfaceLight-aDSYU8Jg.js +0 -1
  177. package/web/assets/surfacePin-m83hCgGP.js +0 -2
  178. package/web/assets/timeline3d-DOw-CpZI.js +0 -2
  179. package/web/assets/timeline3dExport-BtYLU1pw.js +0 -1
  180. package/web/assets/timelineComp-B4GtoH2f.js +0 -1
  181. package/web/assets/timelineProps-D7MVutxu.js +0 -1
  182. package/web/assets/timelineText-BH09jfSM.js +0 -1
  183. package/web/assets/titleFrames-BI1DnLBn.js +0 -1
  184. package/web/assets/toonTools-CD9clJvN.js +0 -2
  185. package/web/assets/trackAnchor-sOjTtd3I.js +0 -1
  186. package/web/assets/userFonts-CwlKh9NR.js +0 -1
  187. package/web/assets/vfxBackground-Bq7lJvmZ.js +0 -2
  188. package/web/assets/videoExport-D4KbireJ.js +0 -1
  189. package/web/assets/views-ozVF4ABO.js +0 -1
  190. package/web/assets/weaponDuel-ZhX-tjGZ.js +0 -1
  191. package/web/assets/windowFrames-CpqX3kOM.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{BufferAttribute as I,TrianglesDrawMode as ze,TriangleFanDrawMode as fe,TriangleStripDrawMode as ye,BufferGeometry as ke,Loader as Se,LoaderUtils as q,FileLoader as ae,MeshPhysicalMaterial as M,Vector2 as Ge,Color as K,LinearSRGBColorSpace as P,SRGBColorSpace as N,SpotLight as Je,PointLight as Be,DirectionalLight as We,Matrix4 as te,InstancedMesh as Ve,Vector3 as H,Quaternion as _e,InstancedBufferAttribute as Xe,Object3D as Pe,TextureLoader as Qe,ImageBitmapLoader as Ye,InterleavedBuffer as Me,LinearMipmapLinearFilter as Oe,NearestMipmapLinearFilter as Ze,LinearMipmapNearestFilter as $e,NearestMipmapNearestFilter as ea,LinearFilter as he,NearestFilter as qe,RepeatWrapping as ue,MirroredRepeatWrapping as aa,ClampToEdgeWrapping as ta,PointsMaterial as na,Material as re,LineBasicMaterial as sa,MeshStandardMaterial as Ne,DoubleSide as ia,MeshBasicMaterial as Z,PropertyBinding as ra,SkinnedMesh as oa,Mesh as ca,LineSegments as ba,Line as la,LineLoop as da,Points as fa,Group as oe,PerspectiveCamera as ha,MathUtils as ua,OrthographicCamera as pa,Skeleton as ga,AnimationClip as ma,Bone as ka,InterpolateDiscrete as xa,InterpolateLinear as Ke,InterleavedBufferAttribute as Ce,Texture as xe,VectorKeyframeTrack as Te,NumberKeyframeTrack as Re,QuaternionKeyframeTrack as we,ColorManagement as pe,FrontSide as Ta,Interpolant as Ra,Box3 as wa,Sphere as Aa}from"./three.module-Bx43vjkH.js";function ut(f,a=!1){const e=f[0].index!==null,n=new Set(Object.keys(f[0].attributes)),t=new Set(Object.keys(f[0].morphAttributes)),s={},i={},c=f[0].morphTargetsRelative,r=new ke;let b=0;for(let o=0;o<f.length;++o){const l=f[o];let d=0;if(e!==(l.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const h in l.attributes){if(!n.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+'. All geometries must have compatible attributes; make sure "'+h+'" attribute exists among all geometries, or in none of them.'),null;s[h]===void 0&&(s[h]=[]),s[h].push(l.attributes[h]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". Make sure all geometries have the same number of attributes."),null;if(c!==l.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const h in l.morphAttributes){if(!t.has(h))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". .morphAttributes must be consistent throughout all geometries."),null;i[h]===void 0&&(i[h]=[]),i[h].push(l.morphAttributes[h])}if(a){let h;if(e)h=l.index.count;else if(l.attributes.position!==void 0)h=l.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+o+". The geometry must have either an index or a position attribute"),null;r.addGroup(b,h,o),b+=h}}if(e){let o=0;const l=[];for(let d=0;d<f.length;++d){const h=f[d].index;for(let k=0;k<h.count;++k)l.push(h.getX(k)+o);o+=f[d].attributes.position.count}r.setIndex(l)}for(const o in s){const l=Ae(s[o]);if(!l)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+o+" attribute."),null;r.setAttribute(o,l)}for(const o in i){const l=i[o][0].length;if(l!==0){r.morphAttributes=r.morphAttributes||{},r.morphAttributes[o]=[];for(let d=0;d<l;++d){const h=[];for(let R=0;R<i[o].length;++R)h.push(i[o][R][d]);const k=Ae(h);if(!k)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+o+" morphAttribute."),null;r.morphAttributes[o].push(k)}}}return r}function Ae(f){let a,e,n,t=-1,s=0;for(let b=0;b<f.length;++b){const o=f[b];if(a===void 0&&(a=o.array.constructor),a!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=o.itemSize),e!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=o.normalized),n!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(t===-1&&(t=o.gpuType),t!==o.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=o.count*e}const i=new a(s),c=new I(i,e,n);let r=0;for(let b=0;b<f.length;++b){const o=f[b];if(o.isInterleavedBufferAttribute){const l=r/e;for(let d=0,h=o.count;d<h;d++)for(let k=0;k<e;k++){const R=o.getComponent(d,k);c.setComponent(d+l,k,R)}}else i.set(o.array,r);r+=o.count*e}return t!==void 0&&(c.gpuType=t),c}function Fe(f,a){if(a===ze)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(a===fe||a===ye){let e=f.getIndex();if(e===null){const i=[],c=f.getAttribute("position");if(c!==void 0){for(let r=0;r<c.count;r++)i.push(r);f.setIndex(i),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const n=e.count-2,t=[];if(a===fe)for(let i=1;i<=n;i++)t.push(e.getX(0)),t.push(e.getX(i)),t.push(e.getX(i+1));else for(let i=0;i<n;i++)i%2===0?(t.push(e.getX(i)),t.push(e.getX(i+1)),t.push(e.getX(i+2))):(t.push(e.getX(i+2)),t.push(e.getX(i+1)),t.push(e.getX(i)));t.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=f.clone();return s.setIndex(t),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",a),f}function pt(f,a=Math.PI/3){const e=f.index?f.toNonIndexed():f,n=e.attributes.position,t=n.count;let s;if(n.isBufferAttribute===!0&&n.itemSize===3&&n.normalized===!1)s=n.array;else{s=new Float64Array(t*3);for(let u=0;u<t;u++)s[3*u+0]=n.getX(u),s[3*u+1]=n.getY(u),s[3*u+2]=n.getZ(u)}const i=Math.cos(a),c=(1+1e-10)*100,r=t/3,b=new Float64Array(r*3);for(let u=0;u<r;u++){const x=9*u,A=s[x+0],F=s[x+1],v=s[x+2],j=s[x+3],E=s[x+4],D=s[x+5],y=s[x+6],G=s[x+7],U=s[x+8],z=y-j,J=G-E,$=U-D,B=A-j,X=F-E,Q=v-D,W=J*Q-$*X,ne=$*B-z*Q,se=z*X-J*B,ie=1/(Math.sqrt(W*W+ne*ne+se*se)||1);b[3*u+0]=W*ie,b[3*u+1]=ne*ie,b[3*u+2]=se*ie}const o=new Int32Array(t),l=new Int32Array(t*3);let d=1;for(;d<t*2;)d<<=1;const h=d-1,k=new Int32Array(d);let R=0;for(let u=0;u<t;u++){const x=3*u,A=~~(s[x+0]*c),F=~~(s[x+1]*c),v=~~(s[x+2]*c);let j=(Math.imul(A,73856093)^Math.imul(F,19349663)^Math.imul(v,83492791))&h;for(;;){const E=k[j];if(E===0){const y=3*R;l[y+0]=A,l[y+1]=F,l[y+2]=v,k[j]=R+1,o[u]=R++;break}const D=3*(E-1);if(l[D+0]===A&&l[D+1]===F&&l[D+2]===v){o[u]=E-1;break}j=j+1&h}}const T=new Int32Array(R+1);for(let u=0;u<t;u++)T[o[u]+1]++;for(let u=0;u<R;u++)T[u+1]+=T[u];const p=new Int32Array(t),g=T.slice(0,R);for(let u=0;u<r;u++){const x=3*u;p[g[o[x+0]]++]=u,p[g[o[x+1]]++]=u,p[g[o[x+2]]++]=u}const m=new Float32Array(t*3);for(let u=0;u<r;u++){const x=3*u,A=b[x+0],F=b[x+1],v=b[x+2];for(let j=0;j<3;j++){const E=x+j,D=o[E];let y=0,G=0,U=0;for(let J=T[D],$=T[D+1];J<$;J++){const B=3*p[J],X=b[B+0],Q=b[B+1],W=b[B+2];A*X+F*Q+v*W>i&&(y+=X,G+=Q,U+=W)}const z=1/(Math.sqrt(y*y+G*G+U*U)||1);m[3*E+0]=y*z,m[3*E+1]=G*z,m[3*E+2]=U*z}}return e.setAttribute("normal",new I(m,3,!1)),e}function Fa(f){const a=new Map,e=new Map,n=f.clone();return He(f,n,function(t,s){a.set(s,t),e.set(t,s)}),n.traverse(function(t){if(!t.isSkinnedMesh)return;const s=t,i=a.get(t),c=i.skeleton.bones;s.skeleton=i.skeleton.clone(),s.bindMatrix.copy(i.bindMatrix),s.skeleton.bones=c.map(function(r){return e.get(r)}),s.bind(s.skeleton,s.bindMatrix)}),n}function He(f,a,e){e(f,a);for(let n=0;n<f.children.length;n++)He(f.children[n],a.children[n],e)}class Ea extends Se{constructor(a){super(a),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new ya(e)}),this.register(function(e){return new Sa(e)}),this.register(function(e){return new Ca(e)}),this.register(function(e){return new Ha(e)}),this.register(function(e){return new Ia(e)}),this.register(function(e){return new _a(e)}),this.register(function(e){return new Pa(e)}),this.register(function(e){return new Ma(e)}),this.register(function(e){return new Oa(e)}),this.register(function(e){return new Da(e)}),this.register(function(e){return new qa(e)}),this.register(function(e){return new Ga(e)}),this.register(function(e){return new Ka(e)}),this.register(function(e){return new Na(e)}),this.register(function(e){return new va(e)}),this.register(function(e){return new Ee(e,w.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new Ee(e,w.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new Ua(e)})}load(a,e,n,t){const s=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const b=q.extractUrlBase(a);i=q.resolveURL(b,this.path)}else i=q.extractUrlBase(a);this.manager.itemStart(a);const c=function(b){t?t(b):console.error(b),s.manager.itemError(a),s.manager.itemEnd(a)},r=new ae(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(a,function(b){try{s.parse(b,i,function(o){e(o),s.manager.itemEnd(a)},c)}catch(o){c(o)}},n,c)}setDRACOLoader(a){return this.dracoLoader=a,this}setKTX2Loader(a){return this.ktx2Loader=a,this}setMeshoptDecoder(a){return this.meshoptDecoder=a,this}register(a){return this.pluginCallbacks.indexOf(a)===-1&&this.pluginCallbacks.push(a),this}unregister(a){return this.pluginCallbacks.indexOf(a)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(a),1),this}parse(a,e,n,t){let s;const i={},c={},r=new TextDecoder;if(typeof a=="string")s=JSON.parse(a);else if(a instanceof ArrayBuffer)if(r.decode(new Uint8Array(a,0,4))===Ie){try{i[w.KHR_BINARY_GLTF]=new za(a)}catch(l){t&&t(l);return}s=JSON.parse(i[w.KHR_BINARY_GLTF].content)}else s=JSON.parse(r.decode(a));else s=a;if(s.asset===void 0||s.asset.version[0]<2){t&&t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const b=new nt(s,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});b.fileLoader.setRequestHeader(this.requestHeader);for(let o=0;o<this.pluginCallbacks.length;o++){const l=this.pluginCallbacks[o](b);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[l.name]=l,i[l.name]=!0}if(s.extensionsUsed)for(let o=0;o<s.extensionsUsed.length;++o){const l=s.extensionsUsed[o],d=s.extensionsRequired||[];switch(l){case w.KHR_MATERIALS_UNLIT:i[l]=new La;break;case w.KHR_DRACO_MESH_COMPRESSION:i[l]=new Ja(s,this.dracoLoader);break;case w.KHR_TEXTURE_TRANSFORM:i[l]=new Ba;break;case w.KHR_MESH_QUANTIZATION:i[l]=new Wa;break;default:d.indexOf(l)>=0&&c[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}b.setExtensions(i),b.setPlugins(c),b.parse(n,t)}parseAsync(a,e){const n=this;return new Promise(function(t,s){n.parse(a,e,t,s)})}}function ja(){let f={};return{get:function(a){return f[a]},add:function(a,e){f[a]=e},remove:function(a){delete f[a]},removeAll:function(){f={}}}}function L(f,a,e){const n=f.json.materials[a];return n.extensions&&n.extensions[e]?n.extensions[e]:null}const w={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",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class va{constructor(a){this.parser=a,this.name=w.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const a=this.parser,e=this.parser.json.nodes||[];for(let n=0,t=e.length;n<t;n++){const s=e[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&a._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(a){const e=this.parser,n="light:"+a;let t=e.cache.get(n);if(t)return t;const s=e.json,r=((s.extensions&&s.extensions[this.name]||{}).lights||[])[a];let b;const o=new K(16777215);r.color!==void 0&&o.setRGB(r.color[0],r.color[1],r.color[2],P);const l=r.range!==void 0?r.range:0;switch(r.type){case"directional":b=new We(o),b.target.position.set(0,0,-1),b.add(b.target);break;case"point":b=new Be(o),b.distance=l;break;case"spot":b=new Je(o),b.distance=l,r.spot=r.spot||{},r.spot.innerConeAngle=r.spot.innerConeAngle!==void 0?r.spot.innerConeAngle:0,r.spot.outerConeAngle=r.spot.outerConeAngle!==void 0?r.spot.outerConeAngle:Math.PI/4,b.angle=r.spot.outerConeAngle,b.penumbra=1-r.spot.innerConeAngle/r.spot.outerConeAngle,b.target.position.set(0,0,-1),b.add(b.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+r.type)}return b.position.set(0,0,0),_(b,r),r.intensity!==void 0&&(b.intensity=r.intensity),b.name=e.createUniqueName(r.name||"light_"+a),t=Promise.resolve(b),e.cache.add(n,t),t}getDependency(a,e){if(a==="light")return this._loadLight(e)}createNodeAttachment(a){const e=this,n=this.parser,s=n.json.nodes[a],c=(s.extensions&&s.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(r){return n._getNodeRef(e.cache,c,r)})}}class La{constructor(){this.name=w.KHR_MATERIALS_UNLIT}getMaterialType(){return Z}extendParams(a,e,n){const t=[];a.color=new K(1,1,1),a.opacity=1;const s=e.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const i=s.baseColorFactor;a.color.setRGB(i[0],i[1],i[2],P),a.opacity=i[3]}s.baseColorTexture!==void 0&&t.push(n.assignTexture(a,"map",s.baseColorTexture,N))}return Promise.all(t)}}class Da{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);return n===null||n.emissiveStrength!==void 0&&(e.emissiveIntensity=n.emissiveStrength),Promise.resolve()}}class ya{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_CLEARCOAT}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);if(n===null)return Promise.resolve();const t=[];if(n.clearcoatFactor!==void 0&&(e.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatMap",n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(t.push(this.parser.assignTexture(e,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){const s=n.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Ge(s,s)}return Promise.all(t)}}class Sa{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_DISPERSION}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);return n===null||(e.dispersion=n.dispersion!==void 0?n.dispersion:0),Promise.resolve()}}class Ga{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_IRIDESCENCE}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);if(n===null)return Promise.resolve();const t=[];return n.iridescenceFactor!==void 0&&(e.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceMap",n.iridescenceTexture)),n.iridescenceIor!==void 0&&(e.iridescenceIOR=n.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(t)}}class _a{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_SHEEN}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);if(n===null)return Promise.resolve();const t=[];if(e.sheenColor=new K(0,0,0),e.sheenRoughness=0,e.sheen=1,n.sheenColorFactor!==void 0){const s=n.sheenColorFactor;e.sheenColor.setRGB(s[0],s[1],s[2],P)}return n.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenColorMap",n.sheenColorTexture,N)),n.sheenRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(t)}}class Pa{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_TRANSMISSION}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);if(n===null)return Promise.resolve();const t=[];return n.transmissionFactor!==void 0&&(e.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&t.push(this.parser.assignTexture(e,"transmissionMap",n.transmissionTexture)),Promise.all(t)}}class Ma{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_VOLUME}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);if(n===null)return Promise.resolve();const t=[];e.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"thicknessMap",n.thicknessTexture)),e.attenuationDistance=n.attenuationDistance||1/0;const s=n.attenuationColor||[1,1,1];return e.attenuationColor=new K().setRGB(s[0],s[1],s[2],P),Promise.all(t)}}class Oa{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_IOR}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);return n===null||(e.ior=n.ior!==void 0?n.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}}class qa{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_SPECULAR}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);if(n===null)return Promise.resolve();const t=[];e.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularIntensityMap",n.specularTexture));const s=n.specularColorFactor||[1,1,1];return e.specularColor=new K().setRGB(s[0],s[1],s[2],P),n.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",n.specularColorTexture,N)),Promise.all(t)}}class Na{constructor(a){this.parser=a,this.name=w.EXT_MATERIALS_BUMP}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);if(n===null)return Promise.resolve();const t=[];return e.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&t.push(this.parser.assignTexture(e,"bumpMap",n.bumpTexture)),Promise.all(t)}}class Ka{constructor(a){this.parser=a,this.name=w.KHR_MATERIALS_ANISOTROPY}getMaterialType(a){return L(this.parser,a,this.name)!==null?M:null}extendMaterialParams(a,e){const n=L(this.parser,a,this.name);if(n===null)return Promise.resolve();const t=[];return n.anisotropyStrength!==void 0&&(e.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(e.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&t.push(this.parser.assignTexture(e,"anisotropyMap",n.anisotropyTexture)),Promise.all(t)}}class Ca{constructor(a){this.parser=a,this.name=w.KHR_TEXTURE_BASISU}loadTexture(a){const e=this.parser,n=e.json,t=n.textures[a];if(!t.extensions||!t.extensions[this.name])return null;const s=t.extensions[this.name],i=e.options.ktx2Loader;if(!i){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(a,s.source,i)}}class Ha{constructor(a){this.parser=a,this.name=w.EXT_TEXTURE_WEBP}loadTexture(a){const e=this.name,n=this.parser,t=n.json,s=t.textures[a];if(!s.extensions||!s.extensions[e])return null;const i=s.extensions[e],c=t.images[i.source];let r=n.textureLoader;if(c.uri){const b=n.options.manager.getHandler(c.uri);b!==null&&(r=b)}return n.loadTextureImage(a,i.source,r)}}class Ia{constructor(a){this.parser=a,this.name=w.EXT_TEXTURE_AVIF}loadTexture(a){const e=this.name,n=this.parser,t=n.json,s=t.textures[a];if(!s.extensions||!s.extensions[e])return null;const i=s.extensions[e],c=t.images[i.source];let r=n.textureLoader;if(c.uri){const b=n.options.manager.getHandler(c.uri);b!==null&&(r=b)}return n.loadTextureImage(a,i.source,r)}}class Ee{constructor(a,e){this.name=e,this.parser=a}loadBufferView(a){const e=this.parser.json,n=e.bufferViews[a];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],s=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 s.then(function(c){const r=t.byteOffset||0,b=t.byteLength||0,o=t.count,l=t.byteStride,d=new Uint8Array(c,r,b);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(o,l,d,t.mode,t.filter).then(function(h){return h.buffer}):i.ready.then(function(){const h=new ArrayBuffer(o*l);return i.decodeGltfBuffer(new Uint8Array(h),o,l,d,t.mode,t.filter),h})})}else return null}}class Ua{constructor(a){this.name=w.EXT_MESH_GPU_INSTANCING,this.parser=a}createNodeMesh(a){const e=this.parser.json,n=e.nodes[a];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const t=e.meshes[n.mesh];for(const b of t.primitives)if(b.mode!==S.TRIANGLES&&b.mode!==S.TRIANGLE_STRIP&&b.mode!==S.TRIANGLE_FAN&&b.mode!==void 0)return null;const i=n.extensions[this.name].attributes,c=[],r={};for(const b in i)c.push(this.parser.getDependency("accessor",i[b]).then(o=>(r[b]=o,r[b])));return c.length<1?null:(c.push(this.parser.createNodeMesh(a)),Promise.all(c).then(b=>{const o=b.pop(),l=o.isGroup?o.children:[o],d=b[0].count,h=[];for(const k of l){const R=new te,T=new H,p=new _e,g=new H(1,1,1),m=new Ve(k.geometry,k.material,d);for(let u=0;u<d;u++)r.TRANSLATION&&T.fromBufferAttribute(r.TRANSLATION,u),r.ROTATION&&p.fromBufferAttribute(r.ROTATION,u),r.SCALE&&g.fromBufferAttribute(r.SCALE,u),m.setMatrixAt(u,R.compose(T,p,g));for(const u in r)if(u==="_COLOR_0"){const x=r[u];m.instanceColor=new Xe(x.array,x.itemSize,x.normalized)}else u!=="TRANSLATION"&&u!=="ROTATION"&&u!=="SCALE"&&k.geometry.setAttribute(u,r[u]);Pe.prototype.copy.call(m,k),this.parser.assignFinalMaterial(m),h.push(m)}return o.isGroup?(o.clear(),o.add(...h),o):h[0]}))}}const Ie="glTF",Y=12,je={JSON:1313821514,BIN:5130562};class za{constructor(a){this.name=w.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(a,0,Y),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(a.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ie)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const t=this.header.length-Y,s=new DataView(a,Y);let i=0;for(;i<t;){const c=s.getUint32(i,!0);i+=4;const r=s.getUint32(i,!0);if(i+=4,r===je.JSON){const b=new Uint8Array(a,Y+i,c);this.content=n.decode(b)}else if(r===je.BIN){const b=Y+i;this.body=a.slice(b,b+c)}i+=c}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Ja{constructor(a,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=w.KHR_DRACO_MESH_COMPRESSION,this.json=a,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(a,e){const n=this.json,t=this.dracoLoader,s=a.extensions[this.name].bufferView,i=a.extensions[this.name].attributes,c={},r={},b={};for(const o in i){const l=ge[o]||o.toLowerCase();c[l]=i[o]}for(const o in a.attributes){const l=ge[o]||o.toLowerCase();if(i[o]!==void 0){const d=n.accessors[a.attributes[o]],h=V[d.componentType];b[l]=h.name,r[l]=d.normalized===!0}}return e.getDependency("bufferView",s).then(function(o){return new Promise(function(l,d){t.decodeDracoFile(o,function(h){for(const k in h.attributes){const R=h.attributes[k],T=r[k];T!==void 0&&(R.normalized=T)}l(h)},c,b,P,d)})})}}class Ba{constructor(){this.name=w.KHR_TEXTURE_TRANSFORM}extendTexture(a,e){return(e.texCoord===void 0||e.texCoord===a.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(a=a.clone(),e.texCoord!==void 0&&(a.channel=e.texCoord),e.offset!==void 0&&a.offset.fromArray(e.offset),e.rotation!==void 0&&(a.rotation=e.rotation),e.scale!==void 0&&a.repeat.fromArray(e.scale),a.needsUpdate=!0),a}}class Wa{constructor(){this.name=w.KHR_MESH_QUANTIZATION}}class Ue extends Ra{constructor(a,e,n,t){super(a,e,n,t)}copySampleValue_(a){const e=this.resultBuffer,n=this.sampleValues,t=this.valueSize,s=a*t*3+t;for(let i=0;i!==t;i++)e[i]=n[s+i];return e}interpolate_(a,e,n,t){const s=this.resultBuffer,i=this.sampleValues,c=this.valueSize,r=c*2,b=c*3,o=t-e,l=(n-e)/o,d=l*l,h=d*l,k=a*b,R=k-b,T=-2*h+3*d,p=h-d,g=1-T,m=p-d+l;for(let u=0;u!==c;u++){const x=i[R+u+c],A=i[R+u+r]*o,F=i[k+u+c],v=i[k+u]*o;s[u]=g*x+m*A+T*F+p*v}return s}}const Va=new _e;class Xa extends Ue{interpolate_(a,e,n,t){const s=super.interpolate_(a,e,n,t);return Va.fromArray(s).normalize().toArray(s),s}}const S={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},V={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ve={9728:qe,9729:he,9984:ea,9985:$e,9986:Ze,9987:Oe},Le={33071:ta,33648:aa,10497:ue},ce={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ge={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"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Qa={CUBICSPLINE:void 0,LINEAR:Ke,STEP:xa},be={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ya(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new Ne({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ta})),f.DefaultMaterial}function C(f,a,e){for(const n in e.extensions)f[n]===void 0&&(a.userData.gltfExtensions=a.userData.gltfExtensions||{},a.userData.gltfExtensions[n]=e.extensions[n])}function _(f,a){a.extras!==void 0&&(typeof a.extras=="object"?Object.assign(f.userData,a.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+a.extras))}function Za(f,a,e){let n=!1,t=!1,s=!1;for(let b=0,o=a.length;b<o;b++){const l=a[b];if(l.POSITION!==void 0&&(n=!0),l.NORMAL!==void 0&&(t=!0),l.COLOR_0!==void 0&&(s=!0),n&&t&&s)break}if(!n&&!t&&!s)return Promise.resolve(f);const i=[],c=[],r=[];for(let b=0,o=a.length;b<o;b++){const l=a[b];if(n){const d=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;i.push(d)}if(t){const d=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;c.push(d)}if(s){const d=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;r.push(d)}}return Promise.all([Promise.all(i),Promise.all(c),Promise.all(r)]).then(function(b){const o=b[0],l=b[1],d=b[2];return n&&(f.morphAttributes.position=o),t&&(f.morphAttributes.normal=l),s&&(f.morphAttributes.color=d),f.morphTargetsRelative=!0,f})}function $a(f,a){if(f.updateMorphTargets(),a.weights!==void 0)for(let e=0,n=a.weights.length;e<n;e++)f.morphTargetInfluences[e]=a.weights[e];if(a.extras&&Array.isArray(a.extras.targetNames)){const e=a.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let n=0,t=e.length;n<t;n++)f.morphTargetDictionary[e[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function et(f){let a;const e=f.extensions&&f.extensions[w.KHR_DRACO_MESH_COMPRESSION];if(e?a="draco:"+e.bufferView+":"+e.indices+":"+le(e.attributes):a=f.indices+":"+le(f.attributes)+":"+f.mode,f.targets!==void 0)for(let n=0,t=f.targets.length;n<t;n++)a+=":"+le(f.targets[n]);return a}function le(f){let a="";const e=Object.keys(f).sort();for(let n=0,t=e.length;n<t;n++)a+=e[n]+":"+f[e[n]]+";";return a}function me(f){switch(f){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.")}}function at(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const tt=new te;class nt{constructor(a={},e={}){this.json=a,this.extensions={},this.plugins={},this.options=e,this.cache=new ja,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,t=-1,s=!1,i=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const c=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(c)===!0;const r=c.match(/Version\/(\d+)/);t=n&&r?parseInt(r[1],10):-1,s=c.indexOf("Firefox")>-1,i=s?c.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&t<17||s&&i<98?this.textureLoader=new Qe(this.options.manager):this.textureLoader=new Ye(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ae(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(a){this.extensions=a}setPlugins(a){this.plugins=a}parse(a,e){const n=this,t=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(i){const c={scene:i[0][t.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:t.asset,parser:n,userData:{}};return C(s,c,t),_(c,t),Promise.all(n._invokeAll(function(r){return r.afterRoot&&r.afterRoot(c)})).then(function(){for(const r of c.scenes)r.updateMatrixWorld();a(c)})}).catch(e)}_markDefs(){const a=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let t=0,s=e.length;t<s;t++){const i=e[t].joints;for(let c=0,r=i.length;c<r;c++)a[i[c]].isBone=!0}for(let t=0,s=a.length;t<s;t++){const i=a[t];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(n[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(a,e){e!==void 0&&(a.refs[e]===void 0&&(a.refs[e]=a.uses[e]=0),a.refs[e]++)}_getNodeRef(a,e,n){if(a.refs[e]<=1)return n;const t=n.clone(),s=(i,c)=>{const r=this.associations.get(i);r!=null&&this.associations.set(c,r);for(const[b,o]of i.children.entries())s(o,c.children[b])};return s(n,t),t.name+="_instance_"+a.uses[e]++,t}_invokeOne(a){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const t=a(e[n]);if(t)return t}return null}_invokeAll(a){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let t=0;t<e.length;t++){const s=a(e[t]);s&&n.push(s)}return n}getDependency(a,e){const n=a+":"+e;let t=this.cache.get(n);if(!t){switch(a){case"scene":t=this.loadScene(e);break;case"node":t=this._invokeOne(function(s){return s.loadNode&&s.loadNode(e)});break;case"mesh":t=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(e)});break;case"accessor":t=this.loadAccessor(e);break;case"bufferView":t=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(e)});break;case"buffer":t=this.loadBuffer(e);break;case"material":t=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(e)});break;case"texture":t=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(e)});break;case"skin":t=this.loadSkin(e);break;case"animation":t=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(e)});break;case"camera":t=this.loadCamera(e);break;default:if(t=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(a,e)}),!t)throw new Error("Unknown type: "+a);break}this.cache.add(n,t)}return t}getDependencies(a){let e=this.cache.get(a);if(!e){const n=this,t=this.json[a+(a==="mesh"?"es":"s")]||[];e=Promise.all(t.map(function(s,i){return n.getDependency(a,i)})),this.cache.add(a,e)}return e}loadBuffer(a){const e=this.json.buffers[a],n=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&a===0)return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);const t=this.options;return new Promise(function(s,i){n.load(q.resolveURL(e.uri,t.path),s,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(a){const e=this.json.bufferViews[a];return this.getDependency("buffer",e.buffer).then(function(n){const t=e.byteLength||0,s=e.byteOffset||0;return n.slice(s,s+t)})}loadAccessor(a){const e=this,n=this.json,t=this.json.accessors[a];if(t.bufferView===void 0&&t.sparse===void 0){const i=ce[t.type],c=V[t.componentType],r=t.normalized===!0,b=new c(t.count*i);return Promise.resolve(new I(b,i,r))}const s=[];return t.bufferView!==void 0?s.push(this.getDependency("bufferView",t.bufferView)):s.push(null),t.sparse!==void 0&&(s.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(s).then(function(i){const c=i[0],r=ce[t.type],b=V[t.componentType],o=b.BYTES_PER_ELEMENT,l=o*r,d=t.byteOffset||0,h=t.bufferView!==void 0?n.bufferViews[t.bufferView].byteStride:void 0,k=t.normalized===!0;let R,T;if(h&&h!==l){const p=Math.floor(d/h),g="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+p+":"+t.count;let m=e.cache.get(g);m||(R=new b(c,p*h,t.count*h/o),m=new Me(R,h/o),e.cache.add(g,m)),T=new Ce(m,r,d%h/o,k)}else c===null?R=new b(t.count*r):R=new b(c,d,t.count*r),T=new I(R,r,k);if(t.sparse!==void 0){const p=ce.SCALAR,g=V[t.sparse.indices.componentType],m=t.sparse.indices.byteOffset||0,u=t.sparse.values.byteOffset||0,x=new g(i[1],m,t.sparse.count*p),A=new b(i[2],u,t.sparse.count*r);c!==null&&(T=new I(T.array.slice(),T.itemSize,T.normalized)),T.normalized=!1;for(let F=0,v=x.length;F<v;F++){const j=x[F];if(T.setX(j,A[F*r]),r>=2&&T.setY(j,A[F*r+1]),r>=3&&T.setZ(j,A[F*r+2]),r>=4&&T.setW(j,A[F*r+3]),r>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}T.normalized=k}return T})}loadTexture(a){const e=this.json,n=this.options,s=e.textures[a].source,i=e.images[s];let c=this.textureLoader;if(i.uri){const r=n.manager.getHandler(i.uri);r!==null&&(c=r)}return this.loadTextureImage(a,s,c)}loadTextureImage(a,e,n){const t=this,s=this.json,i=s.textures[a],c=s.images[e],r=(c.uri||c.bufferView)+":"+i.sampler;if(this.textureCache[r])return this.textureCache[r];const b=this.loadImageSource(e,n).then(function(o){o.flipY=!1,o.name=i.name||c.name||"",o.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(o.name=c.uri);const d=(s.samplers||{})[i.sampler]||{};return o.magFilter=ve[d.magFilter]||he,o.minFilter=ve[d.minFilter]||Oe,o.wrapS=Le[d.wrapS]||ue,o.wrapT=Le[d.wrapT]||ue,o.generateMipmaps=!o.isCompressedTexture&&o.minFilter!==qe&&o.minFilter!==he,t.associations.set(o,{textures:a}),o}).catch(function(){return null});return this.textureCache[r]=b,b}loadImageSource(a,e){const n=this,t=this.json,s=this.options;if(this.sourceCache[a]!==void 0)return this.sourceCache[a].then(l=>l.clone());const i=t.images[a],c=self.URL||self.webkitURL;let r=i.uri||"",b=!1;if(i.bufferView!==void 0)r=n.getDependency("bufferView",i.bufferView).then(function(l){b=!0;const d=new Blob([l],{type:i.mimeType});return r=c.createObjectURL(d),r});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+a+" is missing URI and bufferView");const o=Promise.resolve(r).then(function(l){return new Promise(function(d,h){let k=d;e.isImageBitmapLoader===!0&&(k=function(R){const T=new xe(R);T.needsUpdate=!0,d(T)}),e.load(q.resolveURL(l,s.path),k,void 0,h)})}).then(function(l){return b===!0&&c.revokeObjectURL(r),_(l,i),l.userData.mimeType=i.mimeType||at(i.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",r),l});return this.sourceCache[a]=o,o}assignTexture(a,e,n,t){const s=this;return this.getDependency("texture",n.index).then(function(i){if(!i)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(i=i.clone(),i.channel=n.texCoord),s.extensions[w.KHR_TEXTURE_TRANSFORM]){const c=n.extensions!==void 0?n.extensions[w.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const r=s.associations.get(i);i=s.extensions[w.KHR_TEXTURE_TRANSFORM].extendTexture(i,c),s.associations.set(i,r)}}return t!==void 0&&(i.colorSpace=t),a[e]=i,i})}assignFinalMaterial(a){const e=a.geometry;let n=a.material;const t=e.attributes.tangent===void 0,s=e.attributes.color!==void 0,i=e.attributes.normal===void 0;if(a.isPoints){const c="PointsMaterial:"+n.uuid;let r=this.cache.get(c);r||(r=new na,re.prototype.copy.call(r,n),r.color.copy(n.color),r.map=n.map,r.sizeAttenuation=!1,this.cache.add(c,r)),n=r}else if(a.isLine){const c="LineBasicMaterial:"+n.uuid;let r=this.cache.get(c);r||(r=new sa,re.prototype.copy.call(r,n),r.color.copy(n.color),r.map=n.map,this.cache.add(c,r)),n=r}if(t||s||i){let c="ClonedMaterial:"+n.uuid+":";t&&(c+="derivative-tangents:"),s&&(c+="vertex-colors:"),i&&(c+="flat-shading:");let r=this.cache.get(c);r||(r=n.clone(),s&&(r.vertexColors=!0),i&&(r.flatShading=!0),t&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(c,r),this.associations.set(r,this.associations.get(n))),n=r}a.material=n}getMaterialType(){return Ne}loadMaterial(a){const e=this,n=this.json,t=this.extensions,s=n.materials[a];let i;const c={},r=s.extensions||{},b=[];if(r[w.KHR_MATERIALS_UNLIT]){const l=t[w.KHR_MATERIALS_UNLIT];i=l.getMaterialType(),b.push(l.extendParams(c,s,e))}else{const l=s.pbrMetallicRoughness||{};if(c.color=new K(1,1,1),c.opacity=1,Array.isArray(l.baseColorFactor)){const d=l.baseColorFactor;c.color.setRGB(d[0],d[1],d[2],P),c.opacity=d[3]}l.baseColorTexture!==void 0&&b.push(e.assignTexture(c,"map",l.baseColorTexture,N)),c.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,c.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(b.push(e.assignTexture(c,"metalnessMap",l.metallicRoughnessTexture)),b.push(e.assignTexture(c,"roughnessMap",l.metallicRoughnessTexture))),i=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(a)}),b.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(a,c)})))}s.doubleSided===!0&&(c.side=ia);const o=s.alphaMode||be.OPAQUE;if(o===be.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,o===be.MASK&&(c.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&i!==Z&&(b.push(e.assignTexture(c,"normalMap",s.normalTexture)),c.normalScale=new Ge(1,1),s.normalTexture.scale!==void 0)){const l=s.normalTexture.scale;c.normalScale.set(l,l)}if(s.occlusionTexture!==void 0&&i!==Z&&(b.push(e.assignTexture(c,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&i!==Z){const l=s.emissiveFactor;c.emissive=new K().setRGB(l[0],l[1],l[2],P)}return s.emissiveTexture!==void 0&&i!==Z&&b.push(e.assignTexture(c,"emissiveMap",s.emissiveTexture,N)),Promise.all(b).then(function(){const l=new i(c);return s.name&&(l.name=s.name),_(l,s),e.associations.set(l,{materials:a}),s.extensions&&C(t,l,s),l})}createUniqueName(a){const e=ra.sanitizeNodeName(a||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(a){const e=this,n=this.extensions,t=this.primitiveCache;function s(c){return n[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,e).then(function(r){return De(r,c,e)})}const i=[];for(let c=0,r=a.length;c<r;c++){const b=a[c],o=et(b),l=t[o];if(l)i.push(l.promise);else{let d;b.extensions&&b.extensions[w.KHR_DRACO_MESH_COMPRESSION]?d=s(b):d=De(new ke,b,e),t[o]={primitive:b,promise:d},i.push(d)}}return Promise.all(i)}loadMesh(a){const e=this,n=this.json,t=this.extensions,s=n.meshes[a],i=s.primitives,c=[];for(let r=0,b=i.length;r<b;r++){const o=i[r].material===void 0?Ya(this.cache):this.getDependency("material",i[r].material);c.push(o)}return c.push(e.loadGeometries(i)),Promise.all(c).then(function(r){const b=r.slice(0,r.length-1),o=r[r.length-1],l=[];for(let h=0,k=o.length;h<k;h++){const R=o[h],T=i[h];let p;const g=b[h];if(T.mode===S.TRIANGLES||T.mode===S.TRIANGLE_STRIP||T.mode===S.TRIANGLE_FAN||T.mode===void 0)p=s.isSkinnedMesh===!0?new oa(R,g):new ca(R,g),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),T.mode===S.TRIANGLE_STRIP?p.geometry=Fe(p.geometry,ye):T.mode===S.TRIANGLE_FAN&&(p.geometry=Fe(p.geometry,fe));else if(T.mode===S.LINES)p=new ba(R,g);else if(T.mode===S.LINE_STRIP)p=new la(R,g);else if(T.mode===S.LINE_LOOP)p=new da(R,g);else if(T.mode===S.POINTS)p=new fa(R,g);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+T.mode);Object.keys(p.geometry.morphAttributes).length>0&&$a(p,s),p.name=e.createUniqueName(s.name||"mesh_"+a),_(p,s),T.extensions&&C(t,p,T),e.assignFinalMaterial(p),l.push(p)}for(let h=0,k=l.length;h<k;h++)e.associations.set(l[h],{meshes:a,primitives:h});if(l.length===1)return s.extensions&&C(t,l[0],s),l[0];const d=new oe;s.extensions&&C(t,d,s),e.associations.set(d,{meshes:a});for(let h=0,k=l.length;h<k;h++)d.add(l[h]);return d})}loadCamera(a){let e;const n=this.json.cameras[a],t=n[n.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?e=new ha(ua.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):n.type==="orthographic"&&(e=new pa(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),_(e,n),Promise.resolve(e)}loadSkin(a){const e=this.json.skins[a],n=[];for(let t=0,s=e.joints.length;t<s;t++)n.push(this._loadNodeShallow(e.joints[t]));return e.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(t){const s=t.pop(),i=t,c=[],r=[];for(let b=0,o=i.length;b<o;b++){const l=i[b];if(l){c.push(l);const d=new te;s!==null&&d.fromArray(s.array,b*16),r.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[b])}return new ga(c,r)})}loadAnimation(a){const e=this.json,n=this,t=e.animations[a],s=t.name?t.name:"animation_"+a,i=[],c=[],r=[],b=[],o=[];for(let l=0,d=t.channels.length;l<d;l++){const h=t.channels[l],k=t.samplers[h.sampler],R=h.target,T=R.node,p=t.parameters!==void 0?t.parameters[k.input]:k.input,g=t.parameters!==void 0?t.parameters[k.output]:k.output;R.node!==void 0&&(i.push(this.getDependency("node",T)),c.push(this.getDependency("accessor",p)),r.push(this.getDependency("accessor",g)),b.push(k),o.push(R))}return Promise.all([Promise.all(i),Promise.all(c),Promise.all(r),Promise.all(b),Promise.all(o)]).then(function(l){const d=l[0],h=l[1],k=l[2],R=l[3],T=l[4],p=[];for(let m=0,u=d.length;m<u;m++){const x=d[m],A=h[m],F=k[m],v=R[m],j=T[m];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();const E=n._createAnimationTracks(x,A,F,v,j);if(E)for(let D=0;D<E.length;D++)p.push(E[D])}const g=new ma(s,void 0,p);return _(g,t),g})}createNodeMesh(a){const e=this.json,n=this,t=e.nodes[a];return t.mesh===void 0?null:n.getDependency("mesh",t.mesh).then(function(s){const i=n._getNodeRef(n.meshCache,t.mesh,s);return t.weights!==void 0&&i.traverse(function(c){if(c.isMesh)for(let r=0,b=t.weights.length;r<b;r++)c.morphTargetInfluences[r]=t.weights[r]}),i})}loadNode(a){const e=this.json,n=this,t=e.nodes[a],s=n._loadNodeShallow(a),i=[],c=t.children||[];for(let b=0,o=c.length;b<o;b++)i.push(n.getDependency("node",c[b]));const r=t.skin===void 0?Promise.resolve(null):n.getDependency("skin",t.skin);return Promise.all([s,Promise.all(i),r]).then(function(b){const o=b[0],l=b[1],d=b[2];d!==null&&o.traverse(function(h){h.isSkinnedMesh&&h.bind(d,tt)});for(let h=0,k=l.length;h<k;h++)o.add(l[h]);if(o.userData.pivot!==void 0&&l.length>0){const h=o.userData.pivot,k=l[0];o.pivot=new H().fromArray(h),o.position.x-=h[0],o.position.y-=h[1],o.position.z-=h[2],k.position.set(0,0,0),delete o.userData.pivot}return o})}_loadNodeShallow(a){const e=this.json,n=this.extensions,t=this;if(this.nodeCache[a]!==void 0)return this.nodeCache[a];const s=e.nodes[a],i=s.name?t.createUniqueName(s.name):"",c=[],r=t._invokeOne(function(b){return b.createNodeMesh&&b.createNodeMesh(a)});return r&&c.push(r),s.camera!==void 0&&c.push(t.getDependency("camera",s.camera).then(function(b){return t._getNodeRef(t.cameraCache,s.camera,b)})),t._invokeAll(function(b){return b.createNodeAttachment&&b.createNodeAttachment(a)}).forEach(function(b){c.push(b)}),this.nodeCache[a]=Promise.all(c).then(function(b){let o;if(s.isBone===!0?o=new ka:b.length>1?o=new oe:b.length===1?o=b[0]:o=new Pe,o!==b[0])for(let l=0,d=b.length;l<d;l++)o.add(b[l]);if(s.name&&(o.userData.name=s.name,o.name=i),_(o,s),s.extensions&&C(n,o,s),s.matrix!==void 0){const l=new te;l.fromArray(s.matrix),o.applyMatrix4(l)}else s.translation!==void 0&&o.position.fromArray(s.translation),s.rotation!==void 0&&o.quaternion.fromArray(s.rotation),s.scale!==void 0&&o.scale.fromArray(s.scale);if(!t.associations.has(o))t.associations.set(o,{});else if(s.mesh!==void 0&&t.meshCache.refs[s.mesh]>1){const l=t.associations.get(o);t.associations.set(o,{...l})}return t.associations.get(o).nodes=a,o}),this.nodeCache[a]}loadScene(a){const e=this.extensions,n=this.json.scenes[a],t=this,s=new oe;n.name&&(s.name=t.createUniqueName(n.name)),_(s,n),n.extensions&&C(e,s,n);const i=n.nodes||[],c=[];for(let r=0,b=i.length;r<b;r++)c.push(t.getDependency("node",i[r]));return Promise.all(c).then(function(r){for(let o=0,l=r.length;o<l;o++){const d=r[o];d.parent!==null?s.add(Fa(d)):s.add(d)}const b=o=>{const l=new Map;for(const[d,h]of t.associations)(d instanceof re||d instanceof xe)&&l.set(d,h);return o.traverse(d=>{const h=t.associations.get(d);h!=null&&l.set(d,h)}),l};return t.associations=b(s),s})}_createAnimationTracks(a,e,n,t,s){const i=[],c=a.name?a.name:a.uuid,r=[];function b(h){h.morphTargetInfluences&&r.push(h.name?h.name:h.uuid)}O[s.path]===O.weights?(b(a),a.isGroup&&a.children.forEach(b)):r.push(c);let o;switch(O[s.path]){case O.weights:o=Re;break;case O.rotation:o=we;break;case O.translation:case O.scale:o=Te;break;default:switch(n.itemSize){case 1:o=Re;break;case 2:case 3:default:o=Te;break}break}const l=t.interpolation!==void 0?Qa[t.interpolation]:Ke,d=this._getArrayFromAccessor(n);for(let h=0,k=r.length;h<k;h++){const R=new o(r[h]+"."+O[s.path],e.array,d,l);t.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),i.push(R)}return i}_getArrayFromAccessor(a){let e=a.array;if(a.normalized){const n=me(e.constructor),t=new Float32Array(e.length);for(let s=0,i=e.length;s<i;s++)t[s]=e[s]*n;e=t}return e}_createCubicSplineTrackInterpolant(a){a.createInterpolant=function(n){const t=this instanceof we?Xa:Ue;return new t(this.times,this.values,this.getValueSize()/3,n)},a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function st(f,a,e){const n=a.attributes,t=new wa;if(n.POSITION!==void 0){const c=e.json.accessors[n.POSITION],r=c.min,b=c.max;if(r!==void 0&&b!==void 0){if(t.set(new H(r[0],r[1],r[2]),new H(b[0],b[1],b[2])),c.normalized){const o=me(V[c.componentType]);t.min.multiplyScalar(o),t.max.multiplyScalar(o)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=a.targets;if(s!==void 0){const c=new H,r=new H;for(let b=0,o=s.length;b<o;b++){const l=s[b];if(l.POSITION!==void 0){const d=e.json.accessors[l.POSITION],h=d.min,k=d.max;if(h!==void 0&&k!==void 0){if(r.setX(Math.max(Math.abs(h[0]),Math.abs(k[0]))),r.setY(Math.max(Math.abs(h[1]),Math.abs(k[1]))),r.setZ(Math.max(Math.abs(h[2]),Math.abs(k[2]))),d.normalized){const R=me(V[d.componentType]);r.multiplyScalar(R)}c.max(r)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}t.expandByVector(c)}f.boundingBox=t;const i=new Aa;t.getCenter(i.center),i.radius=t.min.distanceTo(t.max)/2,f.boundingSphere=i}function De(f,a,e){const n=a.attributes,t=[];function s(i,c){return e.getDependency("accessor",i).then(function(r){f.setAttribute(c,r)})}for(const i in n){const c=ge[i]||i.toLowerCase();c in f.attributes||t.push(s(n[i],c))}if(a.indices!==void 0&&!f.index){const i=e.getDependency("accessor",a.indices).then(function(c){f.setIndex(c)});t.push(i)}return pe.workingColorSpace!==P&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${pe.workingColorSpace}" not supported.`),_(f,a),st(f,a,e),Promise.all(t).then(function(){return a.targets!==void 0?Za(f,a.targets,e):f})}const de=new WeakMap,it=new URL("/assets/draco_decoder-C32yEggz.wasm",import.meta.url).toString(),rt=new URL("/assets/draco_wasm_wrapper-DxJM36Ib.js",import.meta.url).toString(),ot=new URL("/assets/draco_decoder-fzg4nYZr.js",import.meta.url).toString();new URL("/assets/draco_wasm_wrapper-fZCQGLGb.js",import.meta.url).toString(),new URL("/assets/draco_decoder-Z1_iN-Ht.wasm",import.meta.url).toString();class ct extends Se{constructor(a){super(a),this.decoderPaths={js:rt,wasm:it,dep_js:ot},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(a){const{decoderPaths:e}=this;return typeof a=="object"?(e.js=a.js,e.wasm=a.wasm,e.dep_js=null):(e.js=q.resolveURL("draco_wasm_wrapper.js",a),e.wasm=q.resolveURL("draco_decoder.wasm",a),e.dep_js=q.resolveURL("draco_decoder.js",a)),this}setDecoderConfig(a){return console.warn("THREE.DRACOLoader: setDecoderConfig to has been deprecated and will be removed in r194."),this.decoderConfig=a,this}setWorkerLimit(a){return this.workerLimit=a,this}load(a,e,n,t){const s=new ae(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(a,i=>{this.parse(i,e,t)},n,t)}parse(a,e,n=()=>{}){this.decodeDracoFile(a,e,null,null,N,n).catch(n)}decodeDracoFile(a,e,n,t,s=P,i=()=>{}){const c={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:t||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:s};return this.decodeGeometry(a,c).then(e).catch(i)}decodeGeometry(a,e){const n=JSON.stringify(e);if(de.has(a)){const r=de.get(a);if(r.key===n)return r.promise;if(a.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let t;const s=this.workerNextTaskID++,i=a.byteLength,c=this._getWorker(s,i).then(r=>(t=r,new Promise((b,o)=>{t._callbacks[s]={resolve:b,reject:o},t.postMessage({type:"decode",id:s,taskConfig:e,buffer:a},[a])}))).then(r=>this._createGeometry(r.geometry));return c.catch(()=>!0).then(()=>{t&&s&&this._releaseTask(t,s)}),de.set(a,{key:n,promise:c}),c}_createGeometry(a){const e=new ke;a.index&&e.setIndex(new I(a.index.array,1));for(let n=0;n<a.attributes.length;n++){const{name:t,array:s,itemSize:i,stride:c,vertexColorSpace:r}=a.attributes[n];let b;if(i===c)b=new I(s,i);else{const o=new Me(s,c);b=new Ce(o,i,0)}t==="color"&&(this._assignVertexColorSpace(b,r),b.normalized=!(s instanceof Float32Array)),e.setAttribute(t,b)}return e}_assignVertexColorSpace(a,e){if(e!==N)return;const n=new K;for(let t=0,s=a.count;t<s;t++)n.fromBufferAttribute(a,t),pe.colorSpaceToWorking(n,N),a.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(a,e){const n=new ae(this.manager);return n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((t,s)=>{n.load(a,t,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const a=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[],{decoderPaths:n}=this;if(a){if(n.dep_js===null)throw new Error("THREE.DRACOLoader: WebAssembly is required when using a custom decoder paths.");e.push(this._loadLibrary(n.dep_js,"text"))}else e.push(this._loadLibrary(n.js,"text")),e.push(this._loadLibrary(n.wasm,"arraybuffer"));return this.decoderPending=Promise.all(e).then(t=>{const s=t[0];a||(this.decoderConfig.wasmBinary=t[1]);const i=bt.toString(),c=["/* draco decoder */",s,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join(`
2
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([c]))}),this.decoderPending}_getWorker(a,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const t=new Worker(this.workerSourceURL);t._callbacks={},t._taskCosts={},t._taskLoad=0,t.postMessage({type:"init",decoderConfig:this.decoderConfig}),t.onmessage=function(s){const i=s.data;switch(i.type){case"decode":t._callbacks[i.id].resolve(i);break;case"error":t._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(t)}else this.workerPool.sort(function(t,s){return t._taskLoad>s._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[a]=e,n._taskLoad+=e,n})}_releaseTask(a,e){a._taskLoad-=a._taskCosts[e],delete a._callbacks[e],delete a._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(a=>a._taskLoad))}dispose(){for(let a=0;a<this.workerPool.length;++a)this.workerPool[a].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function bt(){let f,a;onmessage=function(i){const c=i.data;switch(c.type){case"init":f=c.decoderConfig,a=new Promise(function(o){f.onModuleLoaded=function(l){o({draco:l})},DracoDecoderModule(f)});break;case"decode":const r=c.buffer,b=c.taskConfig;a.then(o=>{const l=o.draco,d=new l.Decoder;try{const h=e(l,d,new Int8Array(r),b),k=h.attributes.map(R=>R.array.buffer);h.index&&k.push(h.index.array.buffer),self.postMessage({type:"decode",id:c.id,geometry:h},k)}catch(h){console.error(h),self.postMessage({type:"error",id:c.id,error:h.message})}finally{l.destroy(d)}});break}};function e(i,c,r,b){const o=b.attributeIDs,l=b.attributeTypes;let d,h;const k=c.GetEncodedGeometryType(r);if(k===i.TRIANGULAR_MESH)d=new i.Mesh,h=c.DecodeArrayToMesh(r,r.byteLength,d);else if(k===i.POINT_CLOUD)d=new i.PointCloud,h=c.DecodeArrayToPointCloud(r,r.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!h.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const R={index:null,attributes:[]};for(const T in o){const p=self[l[T]];let g,m;if(b.useUniqueIDs)m=o[T],g=c.GetAttributeByUniqueId(d,m);else{if(m=c.GetAttributeId(d,i[o[T]]),m===-1)continue;g=c.GetAttribute(d,m)}const u=t(i,c,d,T,p,g);T==="color"&&(u.vertexColorSpace=b.vertexColorSpace),R.attributes.push(u)}return k===i.TRIANGULAR_MESH&&(R.index=n(i,c,d)),i.destroy(d),R}function n(i,c,r){const o=r.num_faces()*3,l=o*4,d=i._malloc(l);c.GetTrianglesUInt32Array(r,l,d);const h=new Uint32Array(i.HEAPF32.buffer,d,o).slice();return i._free(d),{array:h,itemSize:1}}function t(i,c,r,b,o,l){const d=r.num_points(),h=l.num_components(),k=s(i,o),R=h*o.BYTES_PER_ELEMENT,T=Math.ceil(R/4)*4,p=T/o.BYTES_PER_ELEMENT,g=d*R,m=d*T,u=i._malloc(g);c.GetAttributeDataArrayForAllPoints(r,l,k,g,u);const x=new o(i.HEAPF32.buffer,u,g/o.BYTES_PER_ELEMENT);let A;if(R===T)A=x.slice();else{A=new o(m/o.BYTES_PER_ELEMENT);let F=0;for(let v=0,j=x.length;v<j;v++){for(let E=0;E<h;E++)A[F+E]=x[v*h+E];F+=p}}return i._free(u),{name:b,count:d,itemSize:h,array:A,stride:p}}function s(i,c){switch(c){case Float32Array:return i.DT_FLOAT32;case Int8Array:return i.DT_INT8;case Int16Array:return i.DT_INT16;case Int32Array:return i.DT_INT32;case Uint8Array:return i.DT_UINT8;case Uint16Array:return i.DT_UINT16;case Uint32Array:return i.DT_UINT32}}}var lt=(function(){var f="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb",a="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaoclffagRb:q:W:cjbfhoxikaqaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaocwffagRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbahaocdffagRb:q:W:cjbfhokalcdfhlaiczfgiaQ6mbkkaohAaoTmoka8EaQfh8Ea5cefg5cl9hmbkdndndndnawTmbaza8Acd4fRbbglciGPlbedwbkaQTmdavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep9Ta8Fpxeeeeeeeeeeeeeeeegap9op9Hp9rg8Fa8Jp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ugap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp9Ugap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp9Ugap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9AbbbaladfhlaoczfgoaQ6mbxikkaQTmeavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep:nea8Fpxebebebebebebebebgap9op:bep9rg8Fa8Jp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oegap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp:oegap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp:oegap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9AbbbaladfhlaoczfgoaQ6mbxdkkaQTmbcbhocbalcl4gl9Rc8FGhiavcjdfa8Afhrava8Afpbdbhainaravcj;cbfaofpblbg8JaYaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaLaofpblbg8MaKaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Faap9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8LaypmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb",e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var t=WebAssembly.validate(e)?c(a):c(f),s,i=WebAssembly.instantiate(t,{}).then(function(p){s=p.instance,s.exports.__wasm_call_ctors()});function c(p){for(var g=new Uint8Array(p.length),m=0;m<p.length;++m){var u=p.charCodeAt(m);g[m]=u>96?u-97:u>64?u-39:u+4}for(var x=0,m=0;m<p.length;++m)g[x++]=g[m]<60?n[g[m]]:(g[m]-60)*64+g[++m];return g.buffer.slice(0,x)}function r(p,g,m,u,x,A,F){var v=p.exports.sbrk,j=u+3&-4,E=v(j*x),D=v(A.length),y=new Uint8Array(p.exports.memory.buffer);y.set(A,D);var G=g(E,u,x,D,A.length);if(G==0&&F&&F(E,j,x),m.set(y.subarray(E,E+u*x)),v(E-v(0)),G!=0)throw new Error("Malformed buffer data: "+G)}var b={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},o={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},l=[],d=0;function h(p){var g={object:new Worker(p),pending:0,requests:{}};return g.object.onmessage=function(m){var u=m.data;g.pending-=u.count,g.requests[u.id][u.action](u.value),delete g.requests[u.id]},g}function k(p){for(var g="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(t)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+T.name+";"+r.toString()+T.toString(),m=new Blob([g],{type:"text/javascript"}),u=URL.createObjectURL(m),x=l.length;x<p;++x)l[x]=h(u);for(var x=p;x<l.length;++x)l[x].object.postMessage({});l.length=p,URL.revokeObjectURL(u)}function R(p,g,m,u,x){for(var A=l[0],F=1;F<l.length;++F)l[F].pending<A.pending&&(A=l[F]);return new Promise(function(v,j){var E=new Uint8Array(m),D=++d;A.pending+=p,A.requests[D]={resolve:v,reject:j},A.object.postMessage({id:D,count:p,size:g,source:E,mode:u,filter:x},[E.buffer])})}function T(p){var g=p.data;self.ready.then(function(m){if(!g.id)return self.close();try{var u=new Uint8Array(g.count*g.size);r(m,m.exports[g.mode],u,g.count,g.size,g.source,m.exports[g.filter]),self.postMessage({id:g.id,count:g.count,action:"resolve",value:u},[u.buffer])}catch(x){self.postMessage({id:g.id,count:g.count,action:"reject",value:x})}})}return{ready:i,supported:!0,useWorkers:function(p){k(p)},decodeVertexBuffer:function(p,g,m,u,x){r(s,s.exports.meshopt_decodeVertexBuffer,p,g,m,u,s.exports[b[x]])},decodeIndexBuffer:function(p,g,m,u){r(s,s.exports.meshopt_decodeIndexBuffer,p,g,m,u)},decodeIndexSequence:function(p,g,m,u){r(s,s.exports.meshopt_decodeIndexSequence,p,g,m,u)},decodeGltfBuffer:function(p,g,m,u,x,A){r(s,s.exports[o[x]],p,g,m,u,s.exports[b[A]])},decodeGltfBufferAsync:function(p,g,m,u,x){return l.length>0?R(p,g,m,o[u],b[x]):i.then(function(){var A=new Uint8Array(p*g);return r(s,s.exports[o[u]],A,p,g,m,s.exports[b[x]]),A})}}})();let ee=null;function dt(){return ee||(ee=new ct,ee.setDecoderPath("/draco/")),ee}function ft(){const f=new Ea;return f.setMeshoptDecoder(lt),typeof window<"u"&&f.setDRACOLoader(dt()),f}const gt=Object.freeze(Object.defineProperty({__proto__:null,createGltfLoader:ft},Symbol.toStringTag,{value:"Module"}));export{Fa as a,ft as c,gt as g,ut as m,pt as t};
@@ -1 +1 @@
1
- import{no as T,lI as U,bO as V,bR as Z,bT as R,bS as H,np as W,nq as J}from"./titleFrameBudget-CLZWaFHO.js";const rt=(n,a,e)=>Math.round(Math.min(4e7,Math.max(2e6,n*a*e*.16)));function at(n,a,e,t,o,r){const i=n.crop||{left:0,right:0,top:0,bottom:0},m=Math.max(2,Math.floor(a*(1-i.left-i.right)/2)*2),c=Math.max(2,Math.floor(e*(1-i.top-i.bottom)/2)*2);let h=i.left,y=i.top,s=m/a,f=c/e,w=0,u=0,l=t,x=o;const d=T(n,t,o);if(d){const b=Math.max(d.w/m,d.h/c),v=d.w/b/a,z=d.h/b/e;h+=(s-v)/2,y+=(f-z)/2,s=v,f=z,w=d.x,u=d.y,l=d.w,x=d.h}else if(n.fit==="cover"){const b=Math.max(t/m,o/c),v=t/b/a,z=o/b/e;h+=(s-v)/2,y+=(f-z)/2,s=v,f=z}else{const b=Math.min(t/m,o/c);l=Math.round(m*b),x=Math.round(c*b),w=(t-l)/2,u=(o-x)/2}n.flipX&&(h+=s,s=-s),n.flipY&&(y+=f,f=-f);const M=Math.max(2,Math.trunc(t*r.zoom*(r.sx??1)/2)*2),p=Math.max(2,Math.trunc(o*r.zoom*(r.sy??1)/2)*2),k=Math.trunc((t-M)/2+r.x*t),g=Math.trunc((o-p)/2+r.y*o);return{dst:[(k+w*M/t)/t,(g+u*p/o)/o,l*M/t/t,x*p/o/o],src:[h,y,s,f]}}function et(n,a){const e=Math.min(n.visualFadeIn||0,n.duration),t=Math.min(n.visualFadeOut||0,n.duration);return e>a+1e-5?{k:Math.min(1,Math.max(0,a/e)),white:n.fadeInColor==="white"}:t>0&&a>n.duration-t+1e-5?{k:Math.min(1,Math.max(0,(n.duration-a)/t)),white:n.fadeOutColor==="white"}:{k:1,white:!1}}function tt(n,a=48e3,e=.95){const t=n[0].length,o=Math.round(a*.005),r=Math.exp(-1/(a*.05)),i=new Float32Array(t);for(let h=0;h<t;h++){let y=0;for(const s of n)y=Math.max(y,Math.abs(s[h]));i[h]=y>e?e/y:1}let m=1;const c=[];for(let h=0;h<t+o;h++){if(h<t){for(;c.length&&i[c[c.length-1]]>=i[h];)c.pop();c.push(h)}const y=h-o;if(y<0)continue;for(;c.length&&c[0]<y;)c.shift();const s=c.length?i[c[0]]:1;m=Math.min(s,1-(1-m)*r);for(const f of n)f[y]*=m}}function st(n){if(n.colorBypass)return null;const a=(n.brightness??1)*2**(n.exposure??0),e=n.contrast??1,t=n.saturation??1,o=n.hue??0;if(a===1&&e===1&&t===1&&o===0)return null;const{sat:r,rot:i}=U(t,o);return{bright:a,contrast:e,sat:r,rot:i}}function it(n,a){const e=-J*255/(255-J);return(Array.isArray(n.effects)?n.effects:[]).filter(t=>!t.off&&t.amount>.001).flatMap(t=>{if(t.type==="blur")return[{type:"blur",sigma:V(t.amount,a)}];if(t.type==="glow")return[{type:"glow",sigma:Z(a),lo:e/255,k:(255-e)/255,amount:+t.amount.toFixed(4)}];if(t.type==="rgb-split")return[{type:"shift",px:R(t.amount,a)}];if(t.type==="light-burst")return[{type:"burst",amount:t.amount,lo:e/255,k:(255-e)/255}];if(t.type==="pixelate"){const r=H(t.amount,a);return r>1?[{type:"pixel",block:r}]:[]}const o=W(t.type,t.amount);return o?[{type:"colour",m:o.m,lut:o.lut,key:`${t.type}:${t.amount}`}]:[]})}function ht(n,a,e=48e3){const t=n[0]?.length??0,o=Math.max(1,Math.round(t/a));if(Math.abs(a-1)<1e-9||t<2)return n.map(u=>u.slice(0,o));const r=2*Math.round(e*.02),i=r/2,m=Math.round(e*.01),c=4,h=new Float32Array(r);for(let u=0;u<r;u++)h[u]=.5-.5*Math.cos(2*Math.PI*u/r);const y=new Float32Array(t);for(const u of n)for(let l=0;l<t;l++)y[l]+=u[l]/n.length;const s=n.map(()=>new Float32Array(o+r)),f=new Float32Array(o+r);let w=0;for(let u=0;u*i<o;u++){const l=u*i,x=Math.min(t-1,Math.round(l*a));let d=x;if(u>0){const M=w+i;let p=-1/0;for(let k=-m;k<=m;k+=2){const g=x+k;if(g<0||g+i>t||M+i>t)continue;let F=0;for(let b=0;b<i;b+=c)F+=y[g+b]*y[M+b];F>p&&(p=F,d=g)}}for(let M=0;M<n.length;M++){const p=n[M],k=s[M];for(let g=0;g<r&&d+g<t;g++)k[l+g]+=p[d+g]*h[g]}for(let M=0;M<r&&d+M<t;M++)f[l+M]+=h[M];w=d}return s.map(u=>{const l=new Float32Array(o);for(let x=0;x<o;x++)l[x]=f[x]>.001?u[x]/f[x]:u[x];return l})}function ot(n,a=48e3){if(a!==48e3)throw Error("integratedLoudness: 48 kHz only");const e=n[0].length,t=n.map(s=>{const f=new Float64Array(e),w=new Float64Array(e);let u=0,l=0,x=0,d=0;for(let M=0;M<e;M++){const p=1.53512485958697*s[M]-2.69169618940638*u+1.19839281085285*l+1.69065929318241*x-.73248077421585*d;l=u,u=s[M],d=x,x=p,f[M]=p}u=0,l=0,x=0,d=0;for(let M=0;M<e;M++){const p=f[M]-2*u+l+1.99004745483398*x-.99007225036621*d;l=u,u=f[M],d=x,x=p,w[M]=p*p}return w}),o=.4*a,r=.1*a,i=[];for(let s=0;s+o<=e;s+=r){let f=0;for(const w of t){let u=0;for(let l=s;l<s+o;l++)u+=w[l];f+=u/o}i.push(f)}const m=s=>-.691+10*Math.log10(s),c=i.filter(s=>m(s)>-70);if(!c.length)return-1/0;const h=m(c.reduce((s,f)=>s+f,0)/c.length)-10,y=c.filter(s=>m(s)>h);return m(y.reduce((s,f)=>s+f,0)/y.length)}function ct(n,a,e=48e3){const t=ot(n,e);if(!Number.isFinite(t))return t;const o=10**((a-t)/20);for(const r of n)for(let i=0;i<r.length;i++)r[i]*=o;return tt(n,e,10**(-1.5/20)),t}function ut([n,a,e,t],o,r){return[(2+n*(o-4))/o,(2+a*(r-4))/r,e*(o-4)/o,t*(r-4)/r]}function lt(n,a,e){const[[t,o],[r,i],[m,c],[h,y]]=n,s=t-r+h-m,f=o-i+y-c;let w,u,l,x,d,M,p,k;if(Math.abs(s)<1e-9&&Math.abs(f)<1e-9)w=r-t,u=h-r,l=t,x=i-o,d=y-i,M=o,p=0,k=0;else{const N=r-h,Q=m-h,_=i-y,$=c-y,j=N*$-Q*_;p=(s*$-Q*f)/j,k=(N*f-s*_)/j,w=r-t+p*r,u=m-t+k*m,l=t,x=i-o+p*i,d=c-o+k*c,M=o}const g=[w/a,u/e,l,x/a,d/e,M,p/a,k/e,1],[F,b,v,z,O,P,I,B,C]=g,S=O*C-P*B,q=-(b*C-v*B),G=b*P-v*O,L=-(z*C-P*I),X=F*C-v*I,D=-(F*P-v*z),E=z*B-O*I,Y=-(F*B-b*I),K=F*O-b*z,A=F*S+b*L+v*E;return[S/A,q/A,G/A,L/A,X/A,D/A,E/A,Y/A,K/A]}function ft(n,a,e){const t=n.crop||{left:0,right:0,top:0,bottom:0},o=Math.max(2,Math.floor(a*(1-t.left-t.right)/2)*2),r=Math.max(2,Math.floor(e*(1-t.top-t.bottom)/2)*2);let i=t.left,m=t.top,c=o/a,h=r/e;return n.flipX&&(i+=c,c=-c),n.flipY&&(m+=h,h=-h),[i,m,c,h]}function Mt(n,a,e,t,o,r,i){const m=n.crop||{left:0,right:0,top:0,bottom:0},c=Math.max(2,Math.floor(a*(1-m.left-m.right)/2)*2),h=Math.max(2,Math.floor(e*(1-m.top-m.bottom)/2)*2),y=(r.rot||0)*Math.PI/180,s=Math.cos(y),f=Math.sin(y),w=X=>Math.ceil(X/2)*2,u=w(Math.hypot(c,h)),l=i?u:w(c*Math.abs(s)+h*Math.abs(f)),x=i?u:w(c*Math.abs(f)+h*Math.abs(s)),d=Math.round(o*l/x),M=Math.round(t*x/l),p=n.fit==="cover",k=p?Math.max(d,t):Math.min(d,t),g=p?Math.max(M,o):Math.min(M,o),F=p?-Math.trunc((k-t)/2):Math.trunc((t-k)/2),b=p?-Math.trunc((g-o)/2):Math.trunc((o-g)/2),v=k/l,z=g/x,O=F+k/2,P=b+g/2,I=Math.max(2,Math.trunc(t*r.zoom*(r.sx??1)/2)*2),B=Math.max(2,Math.trunc(o*r.zoom*(r.sy??1)/2)*2),C=Math.trunc((t-I)/2+r.x*t),S=Math.trunc((o-B)/2+r.y*o),q=I/t,G=B/o,L=(X,D)=>{const E=(X-2)/(t-4)*c-c/2,Y=(D-2)/(o-4)*h-h/2,K=O+(E*s-Y*f)*v,A=P+(E*f+Y*s)*z;return[C+K*q,S+A*G]};return{quad:[L(0,0),L(t,0),L(0,o),L(t,o)],clip:p?[C,S,I,B]:null}}function mt(n,a,e,t){const o=t*Math.PI/180,r=Math.cos(o),i=Math.sin(o),m=a/2,c=e/2,h=(y,s)=>{const f=(y-2)/(a-4),w=(s-2)/(e-4),u=(n[0]+f*n[2])*a-m,l=(n[1]+w*n[3])*e-c;return[m+u*r-l*i,c+u*i+l*r]};return[h(0,0),h(a,0),h(0,e),h(a,e)]}export{at as a,it as b,ht as c,tt as d,et as f,rt as g,st as l,ct as n,ut as p,Mt as r,ft as s,mt as t,lt as w};
1
+ import{nx as T,j3 as U,bO as V,bR as Z,bT as R,bS as H,ny as W,nz as J}from"./titleFrameBudget-X7HLSDre.js";const rt=(n,a,e)=>Math.round(Math.min(4e7,Math.max(2e6,n*a*e*.16)));function at(n,a,e,t,o,r){const i=n.crop||{left:0,right:0,top:0,bottom:0},m=Math.max(2,Math.floor(a*(1-i.left-i.right)/2)*2),c=Math.max(2,Math.floor(e*(1-i.top-i.bottom)/2)*2);let h=i.left,y=i.top,s=m/a,l=c/e,w=0,u=0,f=t,x=o;const d=T(n,t,o);if(d){const b=Math.max(d.w/m,d.h/c),v=d.w/b/a,z=d.h/b/e;h+=(s-v)/2,y+=(l-z)/2,s=v,l=z,w=d.x,u=d.y,f=d.w,x=d.h}else if(n.fit==="cover"){const b=Math.max(t/m,o/c),v=t/b/a,z=o/b/e;h+=(s-v)/2,y+=(l-z)/2,s=v,l=z}else{const b=Math.min(t/m,o/c);f=Math.round(m*b),x=Math.round(c*b),w=(t-f)/2,u=(o-x)/2}n.flipX&&(h+=s,s=-s),n.flipY&&(y+=l,l=-l);const M=Math.max(2,Math.trunc(t*r.zoom*(r.sx??1)/2)*2),p=Math.max(2,Math.trunc(o*r.zoom*(r.sy??1)/2)*2),k=Math.trunc((t-M)/2+r.x*t),g=Math.trunc((o-p)/2+r.y*o);return{dst:[(k+w*M/t)/t,(g+u*p/o)/o,f*M/t/t,x*p/o/o],src:[h,y,s,l]}}function et(n,a){const e=Math.min(n.visualFadeIn||0,n.duration),t=Math.min(n.visualFadeOut||0,n.duration);return e>a+1e-5?{k:Math.min(1,Math.max(0,a/e)),white:n.fadeInColor==="white"}:t>0&&a>n.duration-t+1e-5?{k:Math.min(1,Math.max(0,(n.duration-a)/t)),white:n.fadeOutColor==="white"}:{k:1,white:!1}}function tt(n,a=48e3,e=.95){const t=n[0].length,o=Math.round(a*.005),r=Math.exp(-1/(a*.05)),i=new Float32Array(t);for(let h=0;h<t;h++){let y=0;for(const s of n)y=Math.max(y,Math.abs(s[h]));i[h]=y>e?e/y:1}let m=1;const c=[];for(let h=0;h<t+o;h++){if(h<t){for(;c.length&&i[c[c.length-1]]>=i[h];)c.pop();c.push(h)}const y=h-o;if(y<0)continue;for(;c.length&&c[0]<y;)c.shift();const s=c.length?i[c[0]]:1;m=Math.min(s,1-(1-m)*r);for(const l of n)l[y]*=m}}function st(n){if(n.colorBypass)return null;const a=(n.brightness??1)*2**(n.exposure??0),e=n.contrast??1,t=n.saturation??1,o=n.hue??0;if(a===1&&e===1&&t===1&&o===0)return null;const{sat:r,rot:i}=U(t,o);return{bright:a,contrast:e,sat:r,rot:i}}function it(n,a){const e=-J*255/(255-J);return(Array.isArray(n.effects)?n.effects:[]).filter(t=>!t.off&&t.amount>.001).flatMap(t=>{if(t.type==="blur")return[{type:"blur",sigma:V(t.amount,a)}];if(t.type==="glow")return[{type:"glow",sigma:Z(a),lo:e/255,k:(255-e)/255,amount:+t.amount.toFixed(4)}];if(t.type==="rgb-split")return[{type:"shift",px:R(t.amount,a)}];if(t.type==="light-burst")return[{type:"burst",amount:t.amount,lo:e/255,k:(255-e)/255}];if(t.type==="pixelate"){const r=H(t.amount,a);return r>1?[{type:"pixel",block:r}]:[]}const o=W(t.type,t.amount);return o?[{type:"colour",m:o.m,lut:o.lut,key:`${t.type}:${t.amount}`}]:[]})}function ht(n,a,e=48e3){const t=n[0]?.length??0,o=Math.max(1,Math.round(t/a));if(Math.abs(a-1)<1e-9||t<2)return n.map(u=>u.slice(0,o));const r=2*Math.round(e*.02),i=r/2,m=Math.round(e*.01),c=4,h=new Float32Array(r);for(let u=0;u<r;u++)h[u]=.5-.5*Math.cos(2*Math.PI*u/r);const y=new Float32Array(t);for(const u of n)for(let f=0;f<t;f++)y[f]+=u[f]/n.length;const s=n.map(()=>new Float32Array(o+r)),l=new Float32Array(o+r);let w=0;for(let u=0;u*i<o;u++){const f=u*i,x=Math.min(t-1,Math.round(f*a));let d=x;if(u>0){const M=w+i;let p=-1/0;for(let k=-m;k<=m;k+=2){const g=x+k;if(g<0||g+i>t||M+i>t)continue;let F=0;for(let b=0;b<i;b+=c)F+=y[g+b]*y[M+b];F>p&&(p=F,d=g)}}for(let M=0;M<n.length;M++){const p=n[M],k=s[M];for(let g=0;g<r&&d+g<t;g++)k[f+g]+=p[d+g]*h[g]}for(let M=0;M<r&&d+M<t;M++)l[f+M]+=h[M];w=d}return s.map(u=>{const f=new Float32Array(o);for(let x=0;x<o;x++)f[x]=l[x]>.001?u[x]/l[x]:u[x];return f})}function ot(n,a=48e3){if(a!==48e3)throw Error("integratedLoudness: 48 kHz only");const e=n[0].length,t=n.map(s=>{const l=new Float64Array(e),w=new Float64Array(e);let u=0,f=0,x=0,d=0;for(let M=0;M<e;M++){const p=1.53512485958697*s[M]-2.69169618940638*u+1.19839281085285*f+1.69065929318241*x-.73248077421585*d;f=u,u=s[M],d=x,x=p,l[M]=p}u=0,f=0,x=0,d=0;for(let M=0;M<e;M++){const p=l[M]-2*u+f+1.99004745483398*x-.99007225036621*d;f=u,u=l[M],d=x,x=p,w[M]=p*p}return w}),o=.4*a,r=.1*a,i=[];for(let s=0;s+o<=e;s+=r){let l=0;for(const w of t){let u=0;for(let f=s;f<s+o;f++)u+=w[f];l+=u/o}i.push(l)}const m=s=>-.691+10*Math.log10(s),c=i.filter(s=>m(s)>-70);if(!c.length)return-1/0;const h=m(c.reduce((s,l)=>s+l,0)/c.length)-10,y=c.filter(s=>m(s)>h);return m(y.reduce((s,l)=>s+l,0)/y.length)}function ct(n,a,e=48e3){const t=ot(n,e);if(!Number.isFinite(t))return t;const o=10**((a-t)/20);for(const r of n)for(let i=0;i<r.length;i++)r[i]*=o;return tt(n,e,10**(-1.5/20)),t}function ut([n,a,e,t],o,r){return[(2+n*(o-4))/o,(2+a*(r-4))/r,e*(o-4)/o,t*(r-4)/r]}function ft(n,a,e){const[[t,o],[r,i],[m,c],[h,y]]=n,s=t-r+h-m,l=o-i+y-c;let w,u,f,x,d,M,p,k;if(Math.abs(s)<1e-9&&Math.abs(l)<1e-9)w=r-t,u=h-r,f=t,x=i-o,d=y-i,M=o,p=0,k=0;else{const K=r-h,N=m-h,Q=i-y,_=c-y,$=K*_-N*Q;p=(s*_-N*l)/$,k=(K*l-s*Q)/$,w=r-t+p*r,u=m-t+k*m,f=t,x=i-o+p*i,d=c-o+k*c,M=o}const g=[w/a,u/e,f,x/a,d/e,M,p/a,k/e,1],[F,b,v,z,O,P,I,B,C]=g,S=O*C-P*B,G=-(b*C-v*B),j=b*P-v*O,L=-(z*C-P*I),X=F*C-v*I,q=-(F*P-v*z),E=z*B-O*I,Y=-(F*B-b*I),D=F*O-b*z,A=F*S+b*L+v*E;return[S/A,G/A,j/A,L/A,X/A,q/A,E/A,Y/A,D/A]}function lt(n,a,e){const t=n.crop||{left:0,right:0,top:0,bottom:0},o=Math.max(2,Math.floor(a*(1-t.left-t.right)/2)*2),r=Math.max(2,Math.floor(e*(1-t.top-t.bottom)/2)*2);let i=t.left,m=t.top,c=o/a,h=r/e;return n.flipX&&(i+=c,c=-c),n.flipY&&(m+=h,h=-h),[i,m,c,h]}function Mt(n,a,e,t,o,r,i){const m=n.crop||{left:0,right:0,top:0,bottom:0},c=Math.max(2,Math.floor(a*(1-m.left-m.right)/2)*2),h=Math.max(2,Math.floor(e*(1-m.top-m.bottom)/2)*2),y=(r.rot||0)*Math.PI/180,s=Math.cos(y),l=Math.sin(y),w=X=>Math.ceil(X/2)*2,u=w(Math.hypot(c,h)),f=i?u:w(c*Math.abs(s)+h*Math.abs(l)),x=i?u:w(c*Math.abs(l)+h*Math.abs(s)),d=Math.round(o*f/x),M=Math.round(t*x/f),p=n.fit==="cover",k=p?Math.max(d,t):Math.min(d,t),g=p?Math.max(M,o):Math.min(M,o),F=p?-Math.trunc((k-t)/2):Math.trunc((t-k)/2),b=p?-Math.trunc((g-o)/2):Math.trunc((o-g)/2),v=k/f,z=g/x,O=F+k/2,P=b+g/2,I=Math.max(2,Math.trunc(t*r.zoom*(r.sx??1)/2)*2),B=Math.max(2,Math.trunc(o*r.zoom*(r.sy??1)/2)*2),C=Math.trunc((t-I)/2+r.x*t),S=Math.trunc((o-B)/2+r.y*o),G=I/t,j=B/o,L=(X,q)=>{const E=(X-2)/(t-4)*c-c/2,Y=(q-2)/(o-4)*h-h/2,D=O+(E*s-Y*l)*v,A=P+(E*l+Y*s)*z;return[C+D*G,S+A*j]};return{quad:[L(0,0),L(t,0),L(0,o),L(t,o)],clip:p?[C,S,I,B]:null}}function mt(n,a,e,t){const o=t*Math.PI/180,r=Math.cos(o),i=Math.sin(o),m=a/2,c=e/2,h=(y,s)=>{const l=(y-2)/(a-4),w=(s-2)/(e-4),u=(n[0]+l*n[2])*a-m,f=(n[1]+w*n[3])*e-c;return[m+u*r-f*i,c+u*i+f*r]};return[h(0,0),h(a,0),h(0,e),h(a,e)]}export{at as a,it as b,ht as c,tt as d,et as f,rt as g,st as l,ct as n,ut as p,Mt as r,lt as s,mt as t,ft as w};
@@ -0,0 +1,198 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/titleFrames-aMG7HdVe.js","assets/titleFrameBudget-X7HLSDre.js","assets/titleArt-CUtA0C3I.js","assets/textAnimators-BVXTl8bU.js","assets/lottieLayer-C2YbiXhK.js","assets/rigTrack-XaMj1yaH.js","assets/i18n-BJppIrtF.js","assets/index-CKtv7gGE.js","assets/api-BFN7blbw.js","assets/frameSink-DYs2gTzq.js","assets/timeline3dExport-DCOr6ARB.js","assets/timeline3d-Dn7PqmEe.js","assets/three.module-Bx43vjkH.js","assets/gltfLoader-U0Eebg7v.js","assets/RoomEnvironment-Dmv_G5ka.js","assets/rotoMatte-i-cJTYmK.js","assets/store-GFMJzaWS.js","assets/captionLayout-CWPcbid-.js"])))=>i.map(i=>d[i]);
2
+ import{b_ as ao,U as Ht,eB as Go,ez as uo,cD as Uo,au as qo,eU as $o,iK as jo,iF as Ho,_ as Nt,i9 as oo,aq as Vo,iL as eo,aR as Yo,aP as mo,hR as Ko,hS as Wo,iM as po,e7 as Qo,eL as xo,ca as to,cc as Zo,fo as Jo,eV as Vt,eT as ei,W as io,er as vo,et as ho,es as go,cL as Yt,ev as ti,eR as oi,dE as Eo,iN as ii,cb as ri,eN as ai,fh as ni,eM as si,hL as ci,eb as Wt,iO as fi,el as bo,ej as li,hJ as ui,iP as mi,iQ as pi,iR as xi,b2 as di,aQ as vi,iS as hi,iT as gi,iU as Ei,bH as bi,aG as ko,iV as Ti,h as Po,iW as wi,iX as yi,d$ as Ri,e0 as _i,ai as Fi,iY as Ai,em as Mi,en as Si,eo as Di,eh as Ui,ep as ki,iZ as Pi,i_ as Bi,f2 as Li,cn as Ni,hV as Ii,i$ as Ci,hP as Xi,eq as To,j0 as Oi,V as zi,X as Gi,a0 as wo,j1 as yo,Y as Ro,an as qi,j2 as $i,e2 as ji,a2 as Hi,a3 as Vi,j3 as Yi,a4 as Ki,e1 as Wi,a5 as Qi,ab as Zi,aa as Ji,a8 as er,a6 as St,j4 as ro,ew as tr,j5 as or,e3 as ir,j6 as rr,j7 as ar}from"./titleFrameBudget-X7HLSDre.js";import{f as no,h as nr,G as sr,z as cr,L as fr,d as lr,c as ur,l as mr,b as pr}from"./glTransitionSources.generated-DM5sRMX2.js";import{b as xr,e as dr,a as vr}from"./timelineComp-Dx_kED5V.js";import{g as so,l as ot,f as It,p as Ct,s as _o,w as Ot,r as hr,a as Xt,t as gr,n as Er,b as Fo,c as Bo,d as br}from"./gpuCompose-DbnZuelB.js";import{t as Tr}from"./motionBlur-uAm030t9.js";import{c as wr}from"./distortGL-BA5molk-.js";import{c as co,V as yr,a as Rr,I as _r,A as Fr,U as Ar,b as Mr}from"./id3-arvEpAg7.js";import{S as Ao,B as Sr,O as Dr,M as Ur,a as kr,C as Pr,A as Br}from"./output-p-Q7qous.js";import"./api-BFN7blbw.js";import"./i18n-BJppIrtF.js";import"./index-CKtv7gGE.js";const Lr=m=>m.kind==="image"&&!!m.title?.text&&!m.url&&!oo(m)&&!Uo(m),Kt=m=>ui(m)||Lr(m),zt=48e3,Lo=192e3,Nr=4,No=(m,g)=>g?.name==="AbortError"||m>=Nr?null:Math.min(2**(m-1),4);async function Ir(m,g){for(let y=1;;y++){let e;try{e=await fetch(m,{signal:g})}catch(q){const h=g?.aborted?null:No(y,q);if(h===null)throw q;await new Promise(L=>setTimeout(L,h*1e3));continue}if(!e.ok)throw Error(`media ${e.status}`);return e.blob()}}const Io=()=>Rr("aac",{numberOfChannels:2,sampleRate:zt,bitrate:Lo}).catch(()=>!1),Xa=async(m,g)=>await co("avc",{width:m,height:g}).catch(()=>!1)&&Io();async function Oa(m){try{const{width:g,height:y,fps:e}=ao(m);return typeof VideoEncoder>"u"||!new OffscreenCanvas(2,2).getContext("webgl2")?!1:(await VideoEncoder.isConfigSupported({codec:"avc1.640034",width:g,height:y,bitrate:no(null,{width:g,height:y,fps:e},so),framerate:e,hardwareAcceleration:"prefer-software"})).supported===!0}catch{return!1}}const za=(m,g)=>co("hevc",{width:m,height:g}).catch(()=>!1);async function Ga(m,g){try{const{width:y,height:e,fps:q}=ao(m),h=g?.codec==="hevc";return typeof VideoEncoder>"u"||typeof AudioEncoder>"u"||typeof OfflineAudioContext>"u"||!new OffscreenCanvas(2,2).getContext("webgl2")||!(await VideoEncoder.isConfigSupported({codec:h?"hvc1.1.6.L153.B0":"avc1.640034",width:y,height:e,bitrate:no(g,{width:y,height:e,fps:q},so),framerate:q,hardwareAcceleration:"prefer-hardware"})).supported?!1:await co(h?"hevc":"avc",{width:y,height:e})&&await Io()}catch{return!1}}class Cr{frames=new Map;async push(g,y,e){let q=this.frames.get(y);q||(q=[],this.frames.set(y,q)),q.push(e)}}async function Mo(m,g,y,e,q,h,L){const M=g.get(y.url);if(!M)return null;if(ko(y)&&!y._still){const C=`${y.id}
3
+ remap
4
+ ${h}`,N=Math.round((e-h)*q);let X=m.get(C);if(!X){const te=M.samplesAtTimestamps(Ti(y,h-y.start,Math.max(1,Math.round(L*q)),q))[Symbol.asyncIterator]();X={iterator:te,peek:null,current:null,ts0:0,idx:0,next:async()=>{const oe=await te.next();return oe.done?null:oe.value}},m.set(C,X)}for(;(X.idx??0)<=N;){const te=await X.iterator.next();if(X.idx=(X.idx??0)+1,te.done)break;te.value&&te.value!==X.current&&(X.current?.close(),X.current=te.value)}return X.current}const V=!!(y._still||y.freeze),ie=V?1:y.playbackRate||1,se=!V&&Po(y),me=se?wi(y,h,L).start:(y.inPoint||0)+(V?0:(h-y.start)*ie),pe=`${y.id}
5
+ ${V?"still":h}`;let x=m.get(pe);if(!x){if(!V)for(const[N,X]of m)N!==pe&&N.startsWith(`${y.id}
6
+ `)&&!N.endsWith(`
7
+ still`)&&!N.includes(`
8
+ remap
9
+ `)&&(X.current?.close(),X.peek?.close(),m.delete(N),await X.iterator.return?.());const C=M.samples(Math.max(0,me-.5))[Symbol.asyncIterator]();if(x={iterator:C,peek:null,current:null,ts0:me,next:async()=>{const N=await C.next();return N.done?null:N.value}},x.peek=await x.next(),!V){for(;x.peek&&x.peek.timestamp<me-1e-4;)x.peek.close(),x.peek=await x.next();x.ts0=x.peek?.timestamp??me}if(se){const N=O=>Number(O.toFixed(6)),X=h-y.start,te=yi(y,X,X+L),oe=te.slice(0,-1).map(([O,Ae],we)=>{const[$e,ye]=te[we+1];return{xa:N(O),dx:N($e-O),k:$e-O>1e-9?N((ye-Ae)/($e-O)):0}}).filter(O=>O.dx>1e-9);x.out=O=>oe.reduce((Ae,we)=>Ae+Math.min(we.dx,Math.max(0,O-we.xa))*we.k,0)}m.set(pe,x)}if(V){const C=Math.round(me*q);for(;x.peek&&Math.round(x.peek.timestamp*q)<=C;)x.current?.close(),x.current=x.peek,x.peek=await x.next();return x.current??x.peek}const R=Math.round((e-h)*q),F=C=>x.out?x.out(C-x.ts0):(C-x.ts0)/ie;for(;x.peek&&Math.round(F(x.peek.timestamp)*q)<=R;)x.current?.close(),x.current=x.peek,x.peek=await x.next();return x.current??x.peek}const Xr=`#version 300 es
10
+ in vec2 p;uniform vec4 dst;uniform vec4 src;out vec2 uv;
11
+ void main(){uv=src.xy+p*src.zw;vec2 q=dst.xy+p*dst.zw;gl_Position=vec4(q.x*2.-1.,1.-q.y*2.,0,1);}`,Or=`#version 300 es
12
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform float alpha;uniform float fade;uniform float white;
13
+ uniform float bright;uniform float contrast;uniform mat3 sat;uniform mat3 rot;uniform float colour;out vec4 o;
14
+ uniform sampler2D matte;uniform float useMatte;uniform vec4 mrect;
15
+ // chroma key (shared/chromaKey.js, the server's geq on the decoded picture): alpha = clip((d − similarity) / blend), d = |CbCr − key|
16
+ // / (255√2) with the picture's own Cb / Cr (8-bit studio range, back from RGB with its matrix: kmat 1 = BT.709, 0 = BT.601) and the
17
+ // key's BT.601 Cb / Cr; then despill (mix 0.5) pulls the green / blue cast back by spill
18
+ uniform vec4 key;uniform vec4 keyOpt;
19
+ // the grade's 1D LUT (shared/timelineGrade.js gradeLut, 256 entries: an 8-bit input lands on an entry) and its 3D table (the colour
20
+ // mixer, timelineMixer.js mixerLut; ffmpeg lut3d trilinear), each on 8-bit values like the server's lut1d / lut3d
21
+ uniform highp sampler2D lut1;uniform highp sampler3D lut3;uniform float useL1;uniform float useL3;
22
+ vec3 tri(vec3 q){int n=textureSize(lut3,0).x;vec3 p=q*float(n-1),f=floor(p),w=p-f;ivec3 i=ivec3(f),j=min(i+1,ivec3(n-1));
23
+ vec3 c000=texelFetch(lut3,i,0).rgb,c100=texelFetch(lut3,ivec3(j.x,i.y,i.z),0).rgb,c010=texelFetch(lut3,ivec3(i.x,j.y,i.z),0).rgb,c110=texelFetch(lut3,ivec3(j.x,j.y,i.z),0).rgb;
24
+ vec3 c001=texelFetch(lut3,ivec3(i.x,i.y,j.z),0).rgb,c101=texelFetch(lut3,ivec3(j.x,i.y,j.z),0).rgb,c011=texelFetch(lut3,ivec3(i.x,j.y,j.z),0).rgb,c111=texelFetch(lut3,j,0).rgb;
25
+ return mix(mix(mix(c000,c100,w.x),mix(c010,c110,w.x),w.y),mix(mix(c001,c101,w.x),mix(c011,c111,w.x),w.y),w.z);}
26
+ void main(){vec4 c=texture(tex,uv);vec3 rgb=c.rgb;
27
+ if(keyOpt.x>.5){vec3 q=floor(rgb*255.+.5);float k=224./255.;
28
+ float u=keyOpt.w>.5?floor((-.114572*q.r-.385428*q.g+.5*q.b)*k+128.5):floor((-.168736*q.r-.331264*q.g+.5*q.b)*k+128.5);
29
+ float v=keyOpt.w>.5?floor((.5*q.r-.454153*q.g-.045847*q.b)*k+128.5):floor((.5*q.r-.418688*q.g-.081312*q.b)*k+128.5);
30
+ float d=length(vec2(u-key.x,v-key.y))/360.62445840513925,a=key.w>1e-4?clamp((d-key.z)/key.w,0.,1.):step(key.z,d)-step(d,key.z)*0.;
31
+ c.a*=floor(a*255.)/255.;
32
+ if(keyOpt.z>0.){if(keyOpt.y>.5){float m=max(0.,rgb.b-(rgb.r*.5+rgb.g*.5));rgb.b=max(0.,rgb.b-m*keyOpt.z);}else{float m=max(0.,rgb.g-(rgb.r*.5+rgb.b*.5));rgb.g=max(0.,rgb.g-m*keyOpt.z);}}}
33
+ if(useMatte>.5)c.a*=texture(matte,(uv-mrect.xy)/mrect.zw).r;
34
+ if(colour>.5){rgb=clamp(rgb*bright,0.,1.);rgb=clamp((rgb-.5)*contrast+.5,0.,1.);rgb=clamp(sat*rgb,0.,1.);rgb=clamp(rot*rgb,0.,1.);}
35
+ if(useL1>.5){ivec3 k=ivec3(floor(rgb*255.+.5));rgb=floor(vec3(texelFetch(lut1,ivec2(k.r,0),0).r,texelFetch(lut1,ivec2(k.g,0),0).g,texelFetch(lut1,ivec2(k.b,0),0).b)*255.+.5)/255.;}
36
+ if(useL3>.5)rgb=floor(clamp(tri(floor(rgb*255.+.5)/255.),0.,1.)*255.+.5)/255.;
37
+ rgb=white>.5?1.-(1.-rgb)*fade:rgb*fade;o=vec4(rgb,c.a*alpha);}`,G=`#version 300 es
38
+ in vec2 p;out vec2 uv;void main(){uv=p;gl_Position=vec4(p*2.-1.,0,1);}`,zr=`#version 300 es
39
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform vec2 step;uniform float sigma;out vec4 o;
40
+ void main(){int r=min(int(ceil(sigma*3.)),128);vec4 acc=vec4(0);float wsum=0.;
41
+ for(int i=-r;i<=r;i++){float w=exp(-float(i*i)/(2.*sigma*sigma));acc+=texture(tex,uv+step*float(i))*w;wsum+=w;}
42
+ o=acc/wsum;}`,Gr=`#version 300 es
43
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform float lo;uniform float k;out vec4 o;
44
+ void main(){vec4 c=texture(tex,uv);o=vec4(clamp(lo+c.rgb*k,0.,1.),c.a);}`,qr=`#version 300 es
45
+ precision highp float;in vec2 uv;uniform sampler2D a;uniform sampler2D b;uniform float amount;out vec4 o;
46
+ void main(){vec4 x=texture(a,uv),y=texture(b,uv);o=mix(x,1.-(1.-x)*(1.-y),amount);}`,$r=`#version 300 es
47
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform vec2 step;uniform float b;uniform int reach;out vec4 o;
48
+ void main(){vec4 acc=texture(tex,uv);float ws=1.;float w=1.;
49
+ for(int i=1;i<=512;i++){if(i>reach)break;w*=b;acc+=(texture(tex,uv+step*float(i))+texture(tex,uv-step*float(i)))*w;ws+=2.*w;}
50
+ o=acc/ws;}`,jr=`#version 300 es
51
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform float taps[16];uniform int n;uniform vec2 ctr;out vec4 o;
52
+ void main(){vec4 acc=vec4(0);for(int i=0;i<16;i++){if(i>=n)break;acc+=texture(tex,ctr+(uv-ctr)/taps[i]);}o=acc/float(n);}`,Hr=`#version 300 es
53
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform float sx[8];uniform float sy[8];uniform int n;uniform vec3 gain;out vec4 o;
54
+ void main(){vec4 acc=vec4(0);for(int i=0;i<8;i++){if(i>=n)break;acc+=texture(tex,vec2(.5)+(uv-vec2(.5))/vec2(sx[i],sy[i]));}
55
+ acc/=float(n);o=vec4(min(acc.rgb*gain,1.),acc.a);}`,Vr=`#version 300 es
56
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform float gain;out vec4 o;
57
+ void main(){vec4 c=texture(tex,uv);o=vec4(min(c.rgb*gain,1.),c.a);}`,Yr=`#version 300 es
58
+ precision highp float;in vec2 uv;uniform sampler2D a;uniform sampler2D b;uniform float w;out vec4 o;
59
+ void main(){o=mix(texture(a,uv),texture(b,uv),w);}`,Kr=`#version 300 es
60
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform vec4 colour;uniform float usetex;out vec4 o;
61
+ void main(){o=usetex>.5?texture(tex,vec2(uv.x,1.-uv.y)):colour;}`,Wr=`#version 300 es
62
+ precision highp float;uniform sampler2D tex;uniform mat3 inv;uniform vec2 size;uniform vec4 rnd;uniform float keepPre;out vec4 o;
63
+ // a pinned screen's rounded corners (shared/cornerPin.js pinRoundGraph): the server's geq mask on the stretched plane BEFORE its
64
+ // 2 px inset, at pixel centres, kept at least rnd.z (the portal dive's fade to square corners); rnd.w = on
65
+ float corner(ivec2 i){if(rnd.w<.5)return 1.;vec2 k=size/(size-4.),X=(vec2(i)+.5-2.)*k;
66
+ float dx=max(0.,max(rnd.x-X.x,X.x-(size.x-rnd.x))),dy=max(0.,max(rnd.y-X.y,X.y-(size.y-rnd.y)));
67
+ float m=clamp((1.-sqrt(pow(dx/rnd.x,2.)+pow(dy/rnd.y,2.)))*min(rnd.x,rnd.y)+.5,0.,1.);return max(floor(m*255.)/255.,rnd.z);}
68
+ vec4 px(ivec2 i){ivec2 s=ivec2(size);i=clamp(i,ivec2(0),s-1);vec4 c=texelFetch(tex,ivec2(i.x,s.y-1-i.y),0);float a=c.a*corner(i);return vec4(c.rgb*a,a);}
69
+ void main(){vec2 d=vec2(gl_FragCoord.x-.5,size.y-gl_FragCoord.y-.5);vec3 q=inv*vec3(d,1.);vec2 u=floor(q.xy/q.z*256.+.5)/256.;
70
+ vec2 f=floor(u),w=u-f;ivec2 i=ivec2(f);
71
+ vec4 c=mix(mix(px(i),px(i+ivec2(1,0)),w.x),mix(px(i+ivec2(0,1)),px(i+ivec2(1,1)),w.x),w.y);
72
+ o=keepPre>.5?c:c.a>0.?vec4(c.rgb/c.a,c.a):vec4(0);}`,Qr=`#version 300 es
73
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform vec2 size;uniform int kind;uniform float e;uniform float f;uniform float inv;
74
+ uniform vec2 ctr;uniform vec3 csh;uniform float count;out vec4 o;
75
+ void main(){vec4 c=texture(tex,uv);float X=gl_FragCoord.x-.5,Y=size.y-gl_FragCoord.y-.5,W=size.x,H=size.y,r;
76
+ float cx=ctr.x*W,cy=ctr.y*H,dx=X-cx,dy=Y-cy,R=length(vec2(max(cx,W-cx),max(cy,H-cy)));
77
+ if(kind<=2){float lin=(X/W-.5)*csh.x+(Y/H-.5)*csh.y,h=csh.z;if(kind==2)r=abs(lin)/h;else{float u=(lin+h)/(2.*h);r=kind==1?mod(u*count,1.):u;}}
78
+ else if(kind==3)r=length(vec2(dx,dy))/R;
79
+ else if(kind==4)r=(abs(dx)/max(cx,W-cx)+abs(dy)/max(cy,H-cy))/2.;
80
+ else if(kind==5){float u=X/W,v=Y/H,A=W/H;r=.1+.78*length(vec2(dx,dy))/R+.12*((sin(u*A*5.3+1.7)*sin(v*4.9+.4)+.55*sin(u*A*11.3-v*9.7+2.3)+.3*sin(u*A*19.1+v*17.3+.7))/1.85);}
81
+ else if(kind==7){float s=W/count,i=floor(X/s),j=floor(Y/s);r=mod(i*i*31.+j*j*17.+i*j*7.+i*13.+j*29.+11.,97.)/97.;}
82
+ else{float a=atan(dx,-dy);if(a<0.)a+=6.283185307179586;r=a/6.283185307179586;}
83
+ float m=clamp((e-r)/f,0.,1.);if(inv>.5)m=1.-m;m=floor(m*255.+.5)/255.;o=vec4(c.rgb,c.a*m);}`,Zr=`#version 300 es
84
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform highp sampler2D lut;uniform float m[12];uniform float useM;uniform float useL;out vec4 o;
85
+ void main(){vec4 c=texture(tex,uv),v=floor(c*255.+.5);vec3 q=v.rgb;
86
+ if(useM>.5){vec3 r;for(int i=0;i<3;i++)r[i]=floor(v.r*m[i*4]+.5)+floor(v.g*m[i*4+1]+.5)+floor(v.b*m[i*4+2]+.5)+floor(v.a*m[i*4+3]+.5);q=clamp(r,0.,255.);}
87
+ if(useL>.5)q=vec3(texelFetch(lut,ivec2(int(q.r),0),0).r,texelFetch(lut,ivec2(int(q.g),1),0).r,texelFetch(lut,ivec2(int(q.b),2),0).r)*255.;
88
+ o=vec4(q/255.,c.a);}`,Jr=`#version 300 es
89
+ precision highp float;uniform sampler2D tex;uniform int px;out vec4 o;
90
+ void main(){ivec2 p=ivec2(gl_FragCoord.xy);int W=textureSize(tex,0).x;vec4 c=texelFetch(tex,p,0);
91
+ o=vec4(texelFetch(tex,ivec2(clamp(p.x+px,0,W-1),p.y),0).r,c.g,texelFetch(tex,ivec2(clamp(p.x-px,0,W-1),p.y),0).b,c.a);}`,ea=`#version 300 es
92
+ precision highp float;uniform sampler2D tex;uniform int b;uniform ivec2 small;out vec4 o;
93
+ void main(){ivec2 s=textureSize(tex,0),k=ivec2(gl_FragCoord.xy);k.y=small.y-1-k.y;vec4 sum=vec4(0);float n=0.;
94
+ for(int j=0;j<64;j++){if(j>=b)break;int y=k.y*b+j;if(y>=s.y)break;for(int i=0;i<64;i++){if(i>=b)break;int x=k.x*b+i;if(x>=s.x)break;sum+=texelFetch(tex,ivec2(x,s.y-1-y),0);n+=1.;}}
95
+ o=sum/n;}`,ta=`#version 300 es
96
+ precision highp float;uniform sampler2D small;uniform int b;uniform vec2 size;out vec4 o;
97
+ void main(){ivec2 p=ivec2(gl_FragCoord.xy),ss=textureSize(small,0);int y=int(size.y)-1-p.y;o=texelFetch(small,ivec2(p.x/b,ss.y-1-y/b),0);}`,oa=`#version 300 es
98
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform vec2 off;uniform vec3 col;uniform float op;uniform float times;uniform vec2 dil;out vec4 o;
99
+ void main(){vec2 p=uv-off;float v=0.;if(p.x>=0.&&p.x<=1.&&p.y>=0.&&p.y<=1.)v=floor(texture(tex,p).a*255.+.5);
100
+ float a=dil.y>0.?clamp(floor((v-dil.x)*dil.y),0.,255.):times<1.5?floor(v*op):floor(255.*(1.-pow(1.-v/255.*op,times)));
101
+ o=vec4(col,a/255.);}`,ia=`#version 300 es
102
+ precision highp float;uniform sampler2D tex;uniform float harden;out vec4 o;
103
+ void main(){float a=floor(texelFetch(tex,ivec2(gl_FragCoord.xy),0).a*255.+.5);if(harden>0.)a=clamp((a-128.)*harden+128.,0.,255.);o=vec4(a/255.,0,0,1);}`,ra=`#version 300 es
104
+ precision highp float;uniform sampler2D tex;uniform ivec2 dir;uniform float sigma;out vec4 o;
105
+ void main(){ivec2 p=ivec2(gl_FragCoord.xy),n=textureSize(tex,0);int r=min(int(ceil(sigma*3.)),128);float acc=0.,ws=0.;
106
+ for(int i=-r;i<=r;i++){float w=exp(-float(i*i)/(2.*sigma*sigma));ivec2 q=p+dir*i;
107
+ if(q.x>=0&&q.y>=0&&q.x<n.x&&q.y<n.y)acc+=texelFetch(tex,q,0).r*w;ws+=w;}
108
+ o=vec4(floor(acc/ws*255.+.5)/255.,0,0,1);}`,aa=`#version 300 es
109
+ precision highp float;uniform sampler2D a;uniform sampler2D b;uniform float arc;uniform vec2 cw;uniform vec2 cen;uniform float start;uniform float cover;uniform float comet;uniform float feather;out vec4 o;
110
+ void main(){ivec2 p=ivec2(gl_FragCoord.xy);float x=floor(texelFetch(a,p,0).r*255.+.5),y=floor(texelFetch(b,p,0).r*255.+.5);
111
+ float band=floor(x*clamp(2.*(1.-y/max(x,1.)),0.,1.));
112
+ if(arc>.5){float K=${ro}.,TAU=6.283185307179586;vec2 u=vec2(gl_FragCoord.x,cw.y*K-gl_FragCoord.y)/K;float th=atan(u.x-cw.x*cen.x,cw.y*cen.y-u.y);
113
+ float d=mod(mod(th-start,TAU)+TAU,TAU)/TAU,m=d<=cover?1.:0.;if(cover<.999)m*=clamp(min(d,cover-d)/feather,0.,1.);if(comet>.5)m*=d/cover;
114
+ band=floor(band*floor(255.*m)/255.);}
115
+ o=vec4(band/255.,0,0,1);}`,na=`#version 300 es
116
+ precision highp float;uniform sampler2D pic;uniform sampler2D band;uniform sampler2D glow;uniform vec3 col;uniform float k;uniform float am;out vec4 o;
117
+ void main(){ivec2 p=ivec2(gl_FragCoord.xy);float b=floor(texelFetch(band,p,0).r*255.+.5),g=floor(texelFetch(glow,p,0).r*255.+.5);
118
+ float rim=clamp(floor(b+g*k),0.,255.);if(am<255.)rim=floor(rim*am/255.);
119
+ vec4 P=texelFetch(pic,p,0);float ra=rim/255.,oa=ra+P.a*(1.-ra);
120
+ o=vec4(oa>0.?(col*ra+P.rgb*P.a*(1.-ra))/oa:P.rgb,oa);}`,sa=`#version 300 es
121
+ precision highp float;in vec2 uv;uniform sampler2D tex;out vec4 o;void main(){vec4 c=texture(tex,uv);o=vec4(c.rgb*c.a,c.a)*.25;}`,ca=`#version 300 es
122
+ precision highp float;in vec2 uv;uniform sampler2D tex;out vec4 o;void main(){vec4 c=texture(tex,uv);o=c.a>0.?vec4(min(c.rgb/c.a,1.),c.a):vec4(0);}`,fa=`#version 300 es
123
+ precision highp float;uniform sampler2D tex;uniform vec2 big;uniform vec2 small;uniform vec4 q1;uniform vec4 q2;uniform float useQ;
124
+ uniform vec4 w1;uniform vec4 w2;uniform float useW;uniform float inv;out vec4 o;
125
+ float rp(float v,float lo,float hi,float ss){return clamp((v-lo)/ss+1.,0.,1.)*clamp((hi-v)/ss+1.,0.,1.);}
126
+ void main(){vec2 X=floor(gl_FragCoord.xy),c=(X+.5)*big/small;vec3 a=vec3(0);
127
+ for(int j=0;j<2;j++)for(int i=0;i<2;i++)a+=texture(tex,(c+vec2(float(i)*2.-1.,float(j)*2.-1.))/big).rgb;
128
+ vec3 p=floor(a/4.*255.+.5)/255.;float m=1.;
129
+ if(useQ>.5){float h=atan(sqrt(3.)*(p.g-p.b),2.*p.r-p.g-p.b)*180./3.14159265358979;if(h<0.)h+=360.;
130
+ float d=abs(h-q1.x);if(d>180.)d=360.-d;float mh=q1.y>=360.?1.:clamp((q1.y/2.+q1.z-d)/q1.z,0.,1.);
131
+ float ch=max(max(p.r,p.g),p.b)-min(min(p.r,p.g),p.b),l=.2126*p.r+.7152*p.g+.0722*p.b;
132
+ m*=mh*rp(ch,q2.x,q2.y,q1.w)*rp(l,q2.z,q2.w,q1.w);}
133
+ if(useW>.5){float dx=X.x/small.x-w1.x,dy=X.y/small.y-w1.y,x=dx*w2.x-dy*w2.y,y=dx*w2.y+dy*w2.x;
134
+ if(w2.w>1.5)m*=clamp(.5-y/w1.w,0.,1.);
135
+ else{float nx=abs(x)/w1.z,ny=abs(y)/w2.z,dist=w2.w>.5?max(nx,ny):length(vec2(nx,ny));m*=clamp((1.+w1.w/2.-dist)/w1.w,0.,1.);}}
136
+ if(inv>.5)m=1.-m;o=vec4(floor(255.*m+1e-4)/255.,0,0,1);}`,la=`#version 300 es
137
+ precision highp float;uniform sampler2D tex;uniform highp sampler2D lut;uniform highp sampler3D t3;uniform float useT;uniform float useL;
138
+ uniform float useS;uniform mat3 sat;uniform float useR;uniform mat3 rot;out vec4 o;
139
+ vec3 tri(vec3 q){int n=textureSize(t3,0).x;vec3 p=q*float(n-1),f=floor(p),w=p-f;ivec3 i=ivec3(f),j=min(i+1,ivec3(n-1));
140
+ vec3 c000=texelFetch(t3,i,0).rgb,c100=texelFetch(t3,ivec3(j.x,i.y,i.z),0).rgb,c010=texelFetch(t3,ivec3(i.x,j.y,i.z),0).rgb,c110=texelFetch(t3,ivec3(j.x,j.y,i.z),0).rgb;
141
+ vec3 c001=texelFetch(t3,ivec3(i.x,i.y,j.z),0).rgb,c101=texelFetch(t3,ivec3(j.x,i.y,j.z),0).rgb,c011=texelFetch(t3,ivec3(i.x,j.y,j.z),0).rgb,c111=texelFetch(t3,j,0).rgb;
142
+ return mix(mix(mix(c000,c100,w.x),mix(c010,c110,w.x),w.y),mix(mix(c001,c101,w.x),mix(c011,c111,w.x),w.y),w.z);}
143
+ void main(){ivec2 P=ivec2(gl_FragCoord.xy);vec4 c=texelFetch(tex,P,0);vec3 g=floor(c.rgb*255.+.5);
144
+ if(useT>.5)g=floor(clamp(tri(g/255.),0.,1.)*255.+.5);
145
+ if(useL>.5){ivec3 k=ivec3(g);g=floor(vec3(texelFetch(lut,ivec2(k.r,0),0).r,texelFetch(lut,ivec2(k.g,0),0).g,texelFetch(lut,ivec2(k.b,0),0).b)*255.+.5);}
146
+ if(useS>.5)g=floor(clamp(sat*(g/255.),0.,1.)*255.+.5);
147
+ if(useR>.5)g=floor(clamp(rot*(g/255.),0.,1.)*255.+.5);
148
+ o=vec4(g/255.,c.a);}`,ua=`#version 300 es
149
+ precision highp float;uniform sampler2D base;uniform sampler2D over;uniform sampler2D mask;uniform vec2 msz;uniform float full;out vec4 o;
150
+ void main(){ivec2 P=ivec2(gl_FragCoord.xy);vec4 b=texelFetch(base,P,0),g=texelFetch(over,P,0);if(full>.5){o=g;return;}
151
+ vec3 q=floor(b.rgb*255.+.5),G=floor(g.rgb*255.+.5);float m=floor(texture(mask,gl_FragCoord.xy/msz).r*255.+.5);
152
+ o=vec4((q+floor((m*(G-q)+128.)/256.))/255.,b.a);}`,ma=`#version 300 es
153
+ precision highp float;uniform sampler2D tex;uniform float k[9];uniform float rdiv;out vec4 o;
154
+ void main(){ivec2 P=ivec2(gl_FragCoord.xy),S=textureSize(tex,0);vec3 s=vec3(0);
155
+ for(int j=0;j<3;j++)for(int i=0;i<3;i++){int x=abs(P.x+i-1),y=abs(P.y+j-1);x=x>=S.x?2*S.x-1-x:x;y=y>=S.y?2*S.y-1-y:y;s+=floor(texelFetch(tex,ivec2(x,y),0).rgb*255.+.5)*k[j*3+i];}
156
+ vec4 c=texelFetch(tex,P,0);o=vec4(clamp(floor(s*rdiv+.5),0.,255.)/255.,c.a);}`,pa=`#version 300 es
157
+ precision highp float;uniform sampler2D tex;uniform sampler2D grain;out vec4 o;
158
+ void main(){ivec2 P=ivec2(gl_FragCoord.xy);vec4 c=texelFetch(tex,P,0);float n=floor(texelFetch(grain,P,0).r*255.+.5)-128.;o=vec4(clamp(floor(c.rgb*255.+.5)+n,0.,255.)/255.,c.a);}`,xa=`#version 300 es
159
+ precision highp float;uniform sampler2D res;uniform sampler2D outp;uniform sampler2D inp;out vec4 o;
160
+ void main(){ivec2 P=ivec2(gl_FragCoord.xy);vec4 r=texelFetch(res,P,0);vec3 R=floor(r.rgb*255.+.5),O=floor(texelFetch(outp,P,0).rgb*255.+.5),I=floor(texelFetch(inp,P,0).rgb*255.+.5);
161
+ vec3 d=clamp(O-I+128.,0.,255.);o=vec4(clamp(R+d-128.,0.,255.)/255.,r.a);}`,da=`#version 300 es
162
+ precision highp float;uniform sampler2D tex;uniform sampler2D soft;uniform float t;out vec4 o;
163
+ void main(){ivec2 P=ivec2(gl_FragCoord.xy);vec4 c=texelFetch(tex,P,0);vec3 V=floor(c.rgb*255.+.5),B=floor(texelFetch(soft,P,0).rgb*255.+.5);
164
+ vec3 x=clamp(V-B+128.,0.,255.)-128.,g=clamp((abs(x)-t)/t,0.,1.),d=clamp(floor(128.+x*g*g*(3.-2.*g)+.5),0.,255.);
165
+ o=vec4(clamp(B+d-128.,0.,255.)/255.,c.a);}`,va=`#version 300 es
166
+ precision highp float;in vec2 uv;uniform sampler2D top;uniform sampler2D bg;uniform int mode;out vec4 o;
167
+ void main(){vec4 s=texture(top,uv),b=texture(bg,uv);vec3 Bp=floor(b.rgb*255.+.5),S=floor(s.rgb*255.+.5);float a=floor(s.a*255.+.5),ab=b.a;
168
+ if(mode==1){o=vec4(min(vec3(255.),Bp+floor(S*a/255.+.5))/255.,min(1.,a/255.+ab));return;}
169
+ // the backdrop is premultiplied (a comp's own transparent picture, gpuExport frames mode): blended against its straight colour, and
170
+ // where it is transparent the layer shows as itself (W3C / After Effects); an opaque backdrop (ab = 1) is the formula as before
171
+ vec3 B=ab>0.?(ab<1.?floor(Bp/ab+.5):Bp):vec3(0),X;
172
+ if(mode==2)X=255.-floor((255.-B)*(255.-S)/255.);
173
+ else if(mode==3)X=floor(B*S/255.);
174
+ else if(mode==4)X=mix(255.-2.*floor((255.-B)*(255.-S)/255.),2.*floor(B*S/255.),step(B,vec3(127.5)));
175
+ else if(mode==5)X=max(B,S);else if(mode==6)X=min(B,S);else if(mode==7)X=abs(B-S);else X=B+S-2.*floor(B*S/255.);
176
+ X=clamp(X,0.,255.);if(ab<1.)X=mix(S,X,ab);o=vec4(floor((X*a+Bp*(255.-a))/255.+.5)/255.,ab<1.?a/255.+ab*(1.-a/255.):b.a);}`,ha=`#version 300 es
177
+ precision highp float;uniform sampler2D tex;uniform int ss;out vec4 o;
178
+ void main(){ivec2 p=ivec2(gl_FragCoord.xy)*ss;vec4 c=vec4(0);for(int j=0;j<4;j++){if(j>=ss)break;for(int i=0;i<4;i++){if(i>=ss)break;c+=texelFetch(tex,p+ivec2(i,j),0);}}
179
+ c/=float(ss*ss);o=c.a>0.?vec4(c.rgb/c.a,c.a):vec4(0);}`,ga=`#version 300 es
180
+ precision highp float;uniform sampler2D tex;uniform int px;out vec4 o;
181
+ void main(){ivec2 p=ivec2(gl_FragCoord.xy);int W=textureSize(tex,0).x;vec4 c=texelFetch(tex,p,0);int xr=p.x-px,xb=p.x+px;
182
+ o=vec4(xr>=0&&xr<W?texelFetch(tex,ivec2(xr,p.y),0).r:0.,c.g,xb>=0&&xb<W?texelFetch(tex,ivec2(xb,p.y),0).b:0.,c.a);}`,Ea=`#version 300 es
183
+ precision highp float;uniform sampler2D tex;uniform vec2 size;uniform vec2 msize;uniform float v;uniform float fr;out vec4 o;
184
+ float sh(float Y){float band=floor(Y*24./size.y),k=mod(band*73.+fr*151.+17.,97.)/97.;return k>1.-v*.6?(k-.5)*2.*v*.15:0.;}
185
+ float mx(vec2 s){float X=(s.x+.5)*size.x/msize.x-.5,Y=(s.y+.5)*size.y/msize.y-.5;return floor(clamp(X-size.x*sh(Y),0.,size.x-1.));}
186
+ void main(){float X=gl_FragCoord.x-.5,Y=size.y-gl_FragCoord.y-.5;vec2 p=vec2((X+.5)*msize.x/size.x-.5,(Y+.5)*msize.y/size.y-.5),f=floor(p),w=p-f;
187
+ vec2 a=clamp(f,vec2(0),msize-1.),b=clamp(f+1.,vec2(0),msize-1.);
188
+ float m=mix(mix(mx(a),mx(vec2(b.x,a.y)),w.x),mix(mx(vec2(a.x,b.y)),mx(b),w.x),w.y);
189
+ o=texelFetch(tex,ivec2(clamp(int(floor(m+.5)),0,int(size.x)-1),int(size.y)-1-int(Y)),0);}`,ba=`#version 300 es
190
+ precision highp float;uniform sampler2D tex;uniform vec2 size;uniform float a[8];uniform float sx[8];uniform float sy[8];out vec4 o;
191
+ void main(){vec2 p=vec2(gl_FragCoord.x-.5,size.y-gl_FragCoord.y-.5),c=size*.5-.5;vec4 acc=vec4(0);
192
+ for(int k=0;k<8;k++){vec2 d=p-c;float cs=cos(a[k]),sn=sin(a[k]);vec2 q=vec2(d.x*cs+d.y*sn,-d.x*sn+d.y*cs);vec2 s=q/vec2(sx[k],sy[k])+c;
193
+ vec2 uv=vec2((s.x+.5)/size.x,1.-(s.y+.5)/size.y);acc+=(uv.x<0.||uv.x>1.||uv.y<0.||uv.y>1.)?vec4(0):texture(tex,uv);}
194
+ o=acc/8.;}`,Ta=`#version 300 es
195
+ precision highp float;in vec2 uv;uniform sampler2D tex;uniform float w;out vec4 o;
196
+ void main(){vec4 c=texture(tex,uv);o=vec4(mix(c.rgb,1.-c.rgb,w),c.a);}`,wa=`#version 300 es
197
+ precision highp float;in vec2 uv;uniform sampler2D tex;out vec4 o;void main(){o=texture(tex,uv);}`,ya=["wipe","blinds","split","iris","diamond","burn"];function So(m,g){const y=Math.max(1e-4,m.feather??.05),e=m.progress?Wt(m.progress,g)??0:g,q=(m.angle??0)*Math.PI/180,h=Math.cos(q),L=Math.sin(q),M=ya.indexOf(m.type??""),V=m.type==="grid";return{type:"txMask",kind:V?7:M<0?6:M,e:e*(1+2*y)-y,f:y,inv:!!m.invert,cx:m.cx??.5,cy:m.cy??.5,c:h,s:L,h:.5*(Math.abs(h)+Math.abs(L)),count:m.count??(V?Pi:8)}}function Do(m,g,y,e,q=0,h){if(!m)return[];const L=V=>Wt(m[V],g)??0,M=[];if(m.zoomBlur&&M.push({type:"txZoom",taps:Mi(),w:L("zoomBlur"),...h?{c:[h.cx,1-h.cy]}:{}}),m.spinBlur){const V=Si(y,e),ie=se=>Math.max(2,Math.round(se/2)*2);M.push({type:"txSpin",a:V.map(se=>+se.a.toFixed(6)),sx:V.map(se=>ie(y*se.scale)/y),sy:V.map(se=>ie(e*se.scale)/e),w:L("spinBlur")})}if(m.dirBlur){const V=To*y/1280,ie=V/(1+V);M.push({type:"txDir",b:ie,reach:Math.min(512,Math.ceil(Math.log(.001)/Math.log(ie))),w:L("dirBlur")})}if(m.dirBlurV){const V=To*y/1280,ie=V/(1+V);M.push({type:"txDir",b:ie,reach:Math.min(512,Math.ceil(Math.log(.001)/Math.log(ie))),w:L("dirBlurV"),v:!0})}return m.blur&&M.push({type:"txGauss",sigma:Di*y/1280,w:L("blur")}),m.glitch&&M.push({type:"txGlitch",v:L("glitch"),fr:Math.floor(q*30+.5)}),m.rgbSplit&&M.push({type:"txRgb",px:Math.trunc(L("rgbSplit")*Ui*y/1280+.5)}),m.exposure&&M.push({type:"txExpo",gain:ki,w:L("exposure")}),m.invert&&M.push({type:"txInv",w:L("invert")}),M}function Ra(m,g){const y=new OffscreenCanvas(m,g),e=y.getContext("webgl2",{premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1});if(!e)throw Error("WebGL2 unavailable");const q=(a,c)=>{const i=e.createShader(a);if(e.shaderSource(i,c),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS))throw Error(String(e.getShaderInfoLog(i)));return i},h=(a,c)=>{const i=e.createProgram();if(e.attachShader(i,q(e.VERTEX_SHADER,a)),e.attachShader(i,q(e.FRAGMENT_SHADER,c)),e.bindAttribLocation(i,0,"p"),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw Error(String(e.getProgramInfoLog(i)));return i},L=h(Xr,Or),M=h(G,oa),V=h(G,ia),ie=h(G,ra),se=h(G,aa),me=h(G,na),pe=h(G,sa),x=h(G,ca),R=h(G,fa),F=h(G,zr),C=h(G,Gr),N=h(G,qr),X=h(G,wa),te=h(G,Hr),oe=h(G,la),O=h(G,ua),Ae=h(G,ma),we=h(G,pa),$e=h(G,da),ye=h(G,xa),We=h(G,$r),je=h(G,jr),nt=h(G,Vr),Me=h(G,Yr),st=h(G,Kr),Qe=h(G,Wr),Re=h(G,Qr),He=h(G,Zr),Ze=h(G,Jr),Se=h(G,ea),Xe=h(G,ta),it=h(G,va),Z=h(G,ha),ge=h(G,ga),ct=h(G,Ta),Ve=h(G,Ea),ke=h(G,ba),rt=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,rt),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0);const Ye=a=>c=>e.getUniformLocation(a,c),A=Ye(L);e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);const ce=()=>{const a=e.createTexture();e.bindTexture(e.TEXTURE_2D,a);for(const[c,i]of[[e.TEXTURE_MIN_FILTER,e.LINEAR],[e.TEXTURE_MAG_FILTER,e.LINEAR],[e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE],[e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE]])e.texParameteri(e.TEXTURE_2D,c,i);return a},ft=ce(),Et=ce();let Ke=null;const at=ce(),lt=e.createTexture(),Oe={l1:"",l3:""};let bt=!1,Gt=!1,Pe=null;const Qt={add:1,screen:2,multiply:3,overlay:4,lighten:5,darken:6,difference:7,exclusion:8};let _e=0;const Tt=ce();let U=[],wt=null,yt=null;const Rt=new Map;let Be=!1,be=null;const _t=a=>{const c=Fe(),i=(a+1)%3,o=(a+2)%3;for(const p of U){let b=a;e.disable(e.BLEND),p.sigma>.05&&(j(F,c[i].fb,[c[a].tex],w=>{e.uniform1i(w("tex"),0),e.uniform2f(w("step"),1/m,0),e.uniform1f(w("sigma"),p.sigma)}),j(F,c[o].fb,[c[i].tex],w=>{e.uniform1i(w("tex"),0),e.uniform2f(w("step"),0,1/g),e.uniform1f(w("sigma"),p.sigma)}),b=o),le(null),e.enable(e.BLEND),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);const[t,l,u]=[1,3,5].map(w=>parseInt(p.color.slice(w,w+2),16)/255);j(M,null,[c[b].tex],w=>{e.uniform1i(w("tex"),0),e.uniform2f(w("off"),Math.trunc(p.dx)/m,-Math.trunc(p.dy)/g),e.uniform3f(w("col"),t,l,u),e.uniform1f(w("op"),p.opacity),e.uniform1f(w("times"),p.times),e.uniform2f(w("dil"),p.dilate?+(rr*255).toFixed(3):0,p.dilate?+(1/ar).toFixed(3):0)})}},ut=a=>{const c=Fe();if(Be){le(be.fb),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE),j(pe,be.fb,[c[a].tex],i=>e.uniform1i(i("tex"),0)),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);return}if(U.length&&_t(a),_e){Je(c[a].tex);return}le(null),e.enable(e.BLEND),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),j(X,null,[c[a].tex],i=>e.uniform1i(i("tex"),0))},Je=a=>{le(null),e.bindTexture(e.TEXTURE_2D,Tt),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA8,0,0,m,g,0),e.disable(e.BLEND),j(it,null,[a,Tt],c=>{e.uniform1i(c("top"),0),e.uniform1i(c("bg"),1),e.uniform1i(c("mode"),_e)})};let Le=null;const Fe=()=>Le??=[De(),De(),De()],Ft=new Map,Dt=a=>{let c=Ft.get(a);if(c)return c;const i=()=>{const o=ce();e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,m*a,g*a,0,e.RGBA,e.UNSIGNED_BYTE,null);const p=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,p),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0),{tex:o,fb:p}};return c={plane:i(),out:i()},Ft.set(a,c),c},Ut=new Map,qt=new Map,Zt=a=>{let c=Ut.get(a.key);if(c)return c;c=ce();const i=new Uint8Array(256*3);(a.lut??[]).forEach((o,p)=>i.set(o,p*256)),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.texImage2D(e.TEXTURE_2D,0,e.R8,256,3,0,e.RED,e.UNSIGNED_BYTE,i),e.pixelStorei(e.UNPACK_ALIGNMENT,4);for(const o of[e.TEXTURE_MIN_FILTER,e.TEXTURE_MAG_FILTER])e.texParameteri(e.TEXTURE_2D,o,e.NEAREST);return Ut.set(a.key,c),c},mt=(a,c)=>{const i=`${a}x${c}`;let o=qt.get(i);if(o)return o;const p=ce();e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,a,c,0,e.RGBA,e.UNSIGNED_BYTE,null);for(const t of[e.TEXTURE_MIN_FILTER,e.TEXTURE_MAG_FILTER])e.texParameteri(e.TEXTURE_2D,t,e.NEAREST);const b=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,b),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,p,0),o={tex:p,fb:b},qt.set(i,o),o},At=new Map,kt=(a,c)=>{const i=`${a}x${c}`;let o=At.get(i);return o||(o=[0,1].map(()=>{const p=ce();e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,a,c,0,e.RGBA,e.UNSIGNED_BYTE,null);const b=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,b),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,p,0),{tex:p,fb:b}}),At.set(i,o),o)},De=()=>{const a=ce();e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,m,g,0,e.RGBA,e.UNSIGNED_BYTE,null);const c=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,c),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0),{tex:a,fb:c}},le=a=>{e.bindFramebuffer(e.FRAMEBUFFER,a),e.viewport(0,0,m,g)},j=(a,c,i,o)=>Mt(a,c,m,g,i,o),Mt=(a,c,i,o,p,b)=>{e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(0,0,i,o),e.useProgram(a);const t=Ye(a);p.forEach((l,u)=>{e.activeTexture(e.TEXTURE0+u),e.bindTexture(e.TEXTURE_2D,l)}),b(t),e.drawArrays(e.TRIANGLE_STRIP,0,4),p.length>1&&r(),e.activeTexture(e.TEXTURE0)},r=()=>{e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,Et),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,at),e.activeTexture(e.TEXTURE3),e.bindTexture(e.TEXTURE_3D,lt),e.activeTexture(e.TEXTURE0)},f=(a,c=0)=>{const i=Fe();let o=c;const p=(t,l,u,w)=>{j(F,i[l].fb,[i[t].tex],n=>{e.uniform1i(n("tex"),0),e.uniform2f(n("step"),1/m,0),e.uniform1f(n("sigma"),w)}),j(F,i[u].fb,[i[l].tex],n=>{e.uniform1i(n("tex"),0),e.uniform2f(n("step"),0,1/g),e.uniform1f(n("sigma"),w)})},b=(t,l,u,w)=>j(Me,i[u].fb,[i[t].tex,i[l].tex],n=>{e.uniform1i(n("a"),0),e.uniform1i(n("b"),1),e.uniform1f(n("w"),w)});for(const t of a){const[l,u,w]=[o,(o+1)%3,(o+2)%3];if(t.type==="blur"){t.sigma>.05&&(p(l,u,w,t.sigma),o=w);continue}if(t.type==="colour"){const n=Zt(t);j(He,i[u].fb,[i[l].tex,n],v=>{e.uniform1i(v("tex"),0),e.uniform1i(v("lut"),1),e.uniform1f(v("useM"),t.m?1:0),e.uniform1f(v("useL"),t.lut?1:0),t.m&&e.uniform1fv(v("m"),t.m.flatMap(S=>[S[0],S[1],S[2],S[3]??0]))}),o=u;continue}if(t.type==="txRgb"){t.px>0&&(j(ge,i[u].fb,[i[l].tex],n=>{e.uniform1i(n("tex"),0),e.uniform1i(n("px"),t.px)}),o=u);continue}if(t.type==="txGlitch"){t.v>1e-4&&(j(Ve,i[u].fb,[i[l].tex],n=>{e.uniform1i(n("tex"),0),e.uniform2f(n("size"),m,g),e.uniform2f(n("msize"),Math.max(2,Math.round(m/4)),Math.max(2,Math.round(g/4))),e.uniform1f(n("v"),t.v),e.uniform1f(n("fr"),t.fr)}),o=u);continue}if(t.type==="txInv"){t.w>1e-4&&(j(ct,i[u].fb,[i[l].tex],n=>{e.uniform1i(n("tex"),0),e.uniform1f(n("w"),Math.min(1,t.w))}),o=u);continue}if(t.type==="shift"){j(Ze,i[u].fb,[i[l].tex],n=>{e.uniform1i(n("tex"),0),e.uniform1i(n("px"),t.px)}),o=u;continue}if(t.type==="pixel"){const n=Math.ceil(m/t.block),v=Math.ceil(g/t.block),S=mt(n,v);e.bindFramebuffer(e.FRAMEBUFFER,S.fb),e.viewport(0,0,n,v),e.useProgram(Se),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,i[l].tex),e.uniform1i(e.getUniformLocation(Se,"tex"),0),e.uniform1i(e.getUniformLocation(Se,"b"),t.block),e.uniform2i(e.getUniformLocation(Se,"small"),n,v),e.drawArrays(e.TRIANGLE_STRIP,0,4),j(Xe,i[u].fb,[S.tex],Y=>{e.uniform1i(Y("small"),0),e.uniform1i(Y("b"),t.block),e.uniform2f(Y("size"),m,g)}),o=u;continue}if(t.type==="txMask"){j(Re,i[u].fb,[i[l].tex],n=>{e.uniform1i(n("tex"),0),e.uniform2f(n("size"),m,g),e.uniform1i(n("kind"),t.kind),e.uniform1f(n("e"),t.e),e.uniform1f(n("f"),t.f),e.uniform1f(n("inv"),t.inv?1:0),e.uniform2f(n("ctr"),t.cx,t.cy),e.uniform3f(n("csh"),t.c,t.s,t.h),e.uniform1f(n("count"),t.count)}),o=u;continue}if(t.type==="txGauss"||t.type==="txDir"||t.type==="txZoom"||t.type==="txSpin"||t.type==="txExpo"){if(!(t.w>1e-4))continue;let n=u;t.type==="txGauss"?(p(l,u,w,t.sigma),n=w):t.type==="txDir"?j(We,i[u].fb,[i[l].tex],S=>{e.uniform1i(S("tex"),0),t.v?e.uniform2f(S("step"),0,1/g):e.uniform2f(S("step"),1/m,0),e.uniform1f(S("b"),t.b),e.uniform1i(S("reach"),t.reach)}):t.type==="txZoom"?j(je,i[u].fb,[i[l].tex],S=>{e.uniform1i(S("tex"),0),e.uniform1fv(S("taps"),t.taps),e.uniform1i(S("n"),t.taps.length),e.uniform2f(S("ctr"),t.c?.[0]??.5,t.c?.[1]??.5)}):t.type==="txSpin"?j(ke,i[u].fb,[i[l].tex],S=>{e.uniform1i(S("tex"),0),e.uniform2f(S("size"),m,g),e.uniform1fv(S("a"),t.a),e.uniform1fv(S("sx"),t.sx),e.uniform1fv(S("sy"),t.sy)}):j(nt,i[u].fb,[i[l].tex],S=>{e.uniform1i(S("tex"),0),e.uniform1f(S("gain"),t.gain)});const v=n===w?u:w;b(l,n,v,Math.min(1,t.w)),o=v;continue}if(t.type==="burst"){const{w:n,h:v}=ur(m,g),[S,Y]=kt(n,v),W=cr(fr.burst*t.amount).map(Q=>lr(n,v,Q));j(C,i[u].fb,[i[l].tex],Q=>{e.uniform1i(Q("tex"),0),e.uniform1f(Q("lo"),t.lo),e.uniform1f(Q("k"),t.k)}),Mt(X,S.fb,n,v,[i[u].tex],Q=>e.uniform1i(Q("tex"),0)),Mt(te,Y.fb,n,v,[S.tex],Q=>{e.uniform1i(Q("tex"),0),e.uniform1i(Q("n"),W.length),e.uniform1fv(Q("sx"),W.map(Ee=>Ee.sw/n)),e.uniform1fv(Q("sy"),W.map(Ee=>Ee.sh/v)),e.uniform3f(Q("gain"),...pr(t.amount))}),j(N,i[w].fb,[i[l].tex,Y.tex],Q=>{e.uniform1i(Q("a"),0),e.uniform1i(Q("b"),1),e.uniform1f(Q("amount"),+t.amount.toFixed(4))}),o=w;continue}j(C,i[u].fb,[i[l].tex],n=>{e.uniform1i(n("tex"),0),e.uniform1f(n("lo"),t.lo),e.uniform1f(n("k"),t.k)}),p(u,w,u,t.sigma),j(N,i[w].fb,[i[l].tex,i[u].tex],n=>{e.uniform1i(n("a"),0),e.uniform1i(n("b"),1),e.uniform1f(n("amount"),t.amount)}),o=w}return o};let k=null,d="",E=[],z="";const B=(a,c)=>{if(z!==`${a}x${c}`){for(const i of E)e.deleteTexture(i.tex),e.deleteFramebuffer(i.fb);E=Array.from({length:4},()=>{const i=ce();e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,a,c,0,e.RGBA,e.UNSIGNED_BYTE,null);const o=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,o),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),{tex:i,fb:o}}),z=`${a}x${c}`}return E},ue=(a,c,i,o)=>{const p=e.getParameter(e.FRAMEBUFFER_BINDING),b=e.getParameter(e.VIEWPORT),t=e.isEnabled(e.BLEND),l=B(o.ew,o.eh),u=(n,v,S,Y)=>{e.bindFramebuffer(e.FRAMEBUFFER,l[v].fb),e.viewport(0,0,o.ew,o.eh),e.useProgram(n);const W=Ye(n);S.forEach((Q,Ee)=>{e.activeTexture(e.TEXTURE0+Ee),e.bindTexture(e.TEXTURE_2D,l[Q].tex)}),Y(W),e.drawArrays(e.TRIANGLE_STRIP,0,4),S.length>1&&r(),e.activeTexture(e.TEXTURE0)};e.disable(e.BLEND),e.bindFramebuffer(e.FRAMEBUFFER,l[0].fb),e.viewport(0,0,o.ew,o.eh),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT);{const n=Bt(a,i);e.bindFramebuffer(e.FRAMEBUFFER,l[0].fb),e.viewport(0,0,o.ew,o.eh),e.disable(e.BLEND),qe(a,[0,0,1,1],c,1,1,!1,n==="win"?null:i,n)}u(V,1,[0],n=>{e.uniform1i(n("tex"),0),e.uniform1f(n("harden"),o.harden?tr:0)});const w=(n,v,S,Y)=>{u(ie,v,[n],W=>{e.uniform1i(W("tex"),0),e.uniform2i(W("dir"),1,0),e.uniform1f(W("sigma"),Y)}),u(ie,S,[v],W=>{e.uniform1i(W("tex"),0),e.uniform2i(W("dir"),0,1),e.uniform1f(W("sigma"),Y)})};w(1,2,3,o.band),u(se,2,[1,3],n=>{e.uniform1i(n("a"),0),e.uniform1i(n("b"),1);const v=o.arc;e.uniform1f(n("arc"),v?1:0),v&&(e.uniform2f(n("cw"),o.ew/ro,o.eh/ro),e.uniform2f(n("cen"),v.cen[0],v.cen[1]),e.uniform1f(n("start"),v.start),e.uniform1f(n("cover"),v.cover),e.uniform1f(n("comet"),v.comet?1:0),e.uniform1f(n("feather"),or*v.cover))}),w(2,1,3,o.glow),u(me,1,[0,2,3],n=>{e.uniform1i(n("pic"),0),e.uniform1i(n("band"),1),e.uniform1i(n("glow"),2),e.uniform3f(n("col"),...o.col),e.uniform1f(n("k"),o.k),e.uniform1f(n("am"),o.am)}),e.bindFramebuffer(e.FRAMEBUFFER,p),e.viewport(b[0],b[1],b[2],b[3]),t&&e.enable(e.BLEND)};let K=null,J="",s=null,_=[],re="";const xe=new Map,ze=new Map,de=new Map,Ge=new Map,ae=new Map,P=new Map,Ne=ce(),Pt=(a,c)=>{const i=ce();e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,a,c,0,e.RGBA,e.UNSIGNED_BYTE,null);const o=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,o),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),{tex:i,fb:o}},$t=(a,c,i)=>{const o=e.getParameter(e.FRAMEBUFFER_BINDING),p=e.getParameter(e.VIEWPORT),b=e.isEnabled(e.BLEND),t=a.w,l=a.h;if(re!==`${t}x${l}`){for(const H of _)e.deleteTexture(H.tex),e.deleteFramebuffer(H.fb);_=Array.from({length:7},()=>Pt(t,l)),re=`${t}x${l}`}e.disable(e.BLEND),e.bindFramebuffer(e.FRAMEBUFFER,_[0].fb),e.viewport(0,0,t,l),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),qe(a,[0,1,1,-1],[0,0,1,1],1,1,!1,c,"base");let u=0;const w=H=>[H[0],H[3],H[6],H[1],H[4],H[7],H[2],H[5],H[8]],n=(H,$,xt,et)=>{e.bindFramebuffer(e.FRAMEBUFFER,_[$].fb),e.viewport(0,0,t,l),e.useProgram(H);const Ie=Ye(H);xt.forEach((dt,vt)=>{e.activeTexture(e.TEXTURE0+vt),e.bindTexture(dt.d3?e.TEXTURE_3D:e.TEXTURE_2D,dt.t)}),et(Ie),e.drawArrays(e.TRIANGLE_STRIP,0,4),r()},v=H=>({t:_[H].tex}),S=(H,$,xt,et)=>{n(F,$,[v(H)],Ie=>{e.uniform1i(Ie("tex"),0),e.uniform2f(Ie("step"),1/t,0),e.uniform1f(Ie("sigma"),et)}),n(F,xt,[v($)],Ie=>{e.uniform1i(Ie("tex"),0),e.uniform2f(Ie("step"),0,1/l),e.uniform1f(Ie("sigma"),et)})},Y=i.list,W=Y.map(H=>io(H)),Q=zi(Y),Ee=new Set;for(const[H,$]of Y.entries()){const xt=Q[H];if(H===xt&&Y.some((T,D)=>D>H&&Q[D]===H&&W[D])&&(n(X,2,[v(u)],T=>e.uniform1i(T("tex"),0)),Ee.add(H)),!W[H])continue;const et=H!==xt&&Ee.has(xt)?$.branch:void 0,Ie=et?2:u;let dt=Ne,vt=[1,1];if($.qualifier){const T=Math.max(2,Math.trunc((t+St-1)/St)),D=Math.max(2,Math.trunc((l+St-1)/St)),I=`${T}x${D}`;let ne=xe.get(I);ne||(ne=Pt(T,D),xe.set(I,ne));const ee=$.qualifier,ve=Math.max(.001,ee.soft??.3),Ue=$.window,gt=-(Ue?.rot??0)*Math.PI/180;e.bindFramebuffer(e.FRAMEBUFFER,ne.fb),e.viewport(0,0,T,D),e.useProgram(R),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,_[Ie].tex);const Te=Ye(R);e.uniform1i(Te("tex"),0),e.uniform2f(Te("big"),t,l),e.uniform2f(Te("small"),T,D),e.uniform4f(Te("q1"),ee.hue,ee.hueWidth,Math.max(1,ve*60),Math.max(.001,ve*.2)),e.uniform4f(Te("q2"),ee.satMin,ee.satMax,ee.lumMin,ee.lumMax),e.uniform1f(Te("useQ"),1),e.uniform1f(Te("useW"),Ue?1:0),Ue&&(e.uniform4f(Te("w1"),Ue.cx,Ue.cy,Math.max(1e-4,Ue.w/2),Math.max(.001,Ue.feather??.2)),e.uniform4f(Te("w2"),Math.cos(gt),Math.sin(gt),Math.max(1e-4,Ue.h/2),Ue.type==="gradient"?2:Ue.type==="rect"?1:0)),e.uniform1f(Te("inv"),$.invert?1:0),e.drawArrays(e.TRIANGLE_STRIP,0,4),dt=ne.tex,vt=[T*St,D*St]}else if(!$.whole&&Gi($)&&$.window?.type!=="person"){const T=`${i.clip}#${H}`,D=`${t}x${l}@${i.local??0}`,I=yo,ne=Math.max(2,Math.min(yo*2,Math.round(I*l/t)));let ee=Ge.get(T);if(ee||(ee={tex:ce(),at:""},Ge.set(T,ee)),ee.at!==D){const ve=wo($,i.src,i.local??0,l/t,null),Ue=new Uint8Array(I*ne);for(let gt=0;gt<ne;gt++)for(let Te=0;Te<I;Te++)Ue[gt*I+Te]=Math.round(ve((Te+.5)/I,(gt+.5)/ne,0,0,0)*255);e.bindTexture(e.TEXTURE_2D,ee.tex),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.texImage2D(e.TEXTURE_2D,0,e.R8,I,ne,0,e.RED,e.UNSIGNED_BYTE,Ue),e.pixelStorei(e.UNPACK_ALIGNMENT,4),ee.at=D}dt=ee.tex,vt=[t,l]}else if(!$.whole){const T=Ro($)?i.src?.depthMap:void 0,D=`${i.clip}#${H}@${t}x${l}${T?`@${T.at}:${T.data.length}:${T.data.slice(0,24)}`:""}`;let I=ze.get(D);if(!I){const ne=qi($,t,l,Ro($)?wo($,i.src,0,l/t):null);I=ce(),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.texImage2D(e.TEXTURE_2D,0,e.R8,ne.w4,ne.h4,0,e.RED,e.UNSIGNED_BYTE,ne.px),e.pixelStorei(e.UNPACK_ALIGNMENT,4),ze.set(D,I)}dt=I,vt=[t,l]}const Lt=$.adjust??{},fo=$i($),Jt=`${i.clip}#${H}`;let jt=de.get(Jt);if(fo&&!jt){const T=new Float32Array(1024);for(let D=0;D<256;D++)["r","g","b"].forEach((I,ne)=>{T[D*4+ne]=+ji(Lt,I,D/255,$.wheels,$.curves).toFixed(6)}),T[D*4+3]=1;jt=ce(),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,256,1,0,e.RGBA,e.FLOAT,T);for(const D of[e.TEXTURE_MIN_FILTER,e.TEXTURE_MAG_FILTER])e.texParameteri(e.TEXTURE_2D,D,e.NEAREST);de.set(Jt,jt)}let ht=null;if(Hi($)){const T=`${Jt}:${JSON.stringify([$.cst,$.look,$.lut,$.mixer])}`;if(ht=ae.get(T)??null,!ht){const D=Vi($,I=>mr(I));if(!D)throw Error(`LUT "${$.lut?.name??""}" chưa tải xong`);ht=e.createTexture(),e.activeTexture(e.TEXTURE4),e.bindTexture(e.TEXTURE_3D,ht),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.texImage3D(e.TEXTURE_3D,0,e.RGB32F,D.size,D.size,D.size,0,e.RGB,e.FLOAT,D.data),e.pixelStorei(e.UNPACK_ALIGNMENT,4);for(const I of[e.TEXTURE_MIN_FILTER,e.TEXTURE_MAG_FILTER])e.texParameteri(e.TEXTURE_3D,I,e.NEAREST);for(const I of[e.TEXTURE_WRAP_S,e.TEXTURE_WRAP_T,e.TEXTURE_WRAP_R])e.texParameteri(e.TEXTURE_3D,I,e.CLAMP_TO_EDGE);e.activeTexture(e.TEXTURE0),ae.set(T,ht)}}const{sat:Co,rot:Xo}=Yi(Lt.saturation??1,Lt.hue??0);n(oe,3,[v(Ie),{t:jt??at},{t:ht??lt,d3:!0}],T=>{e.uniform1i(T("tex"),0),e.uniform1i(T("lut"),1),e.uniform1i(T("t3"),2),e.uniform1f(T("useT"),ht?1:0),e.uniform1f(T("useL"),fo?1:0),e.uniform1f(T("useS"),(Lt.saturation??1)!==1?1:0),e.uniform1f(T("useR"),(Lt.hue??0)!==0?1:0),e.uniformMatrix3fv(T("sat"),!1,w(Co)),e.uniformMatrix3fv(T("rot"),!1,w(Xo))}),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_3D,null),e.activeTexture(e.TEXTURE0),r();let fe=3;const tt=(T,D)=>[3,4,5].find(I=>I!==T&&I!==D);if(($.blur??0)>0){const T=tt(fe),D=tt(fe,T);S(fe,T,D,Math.max(.1,+(($.blur??0)*Ki*t).toFixed(3))),fe=D}const lo=Wi({sharpness:$.sharpen??0});if(lo){const T=tt(fe);n(Ae,T,[v(fe)],D=>{e.uniform1i(D("tex"),0),e.uniform1fv(D("k"),lo),e.uniform1f(D("rdiv"),1/ir)}),fe=T}const he=$.fx?Qi($.fx,t):null;if(he&&(he.type==="glow"||he.type==="halation")){const T=tt(fe),D=tt(fe,T);n(C,T,[v(fe)],ve=>{e.uniform1i(ve("tex"),0),e.uniform1f(ve("lo"),he.lo),e.uniform1f(ve("k"),he.k)});let I=T;he.tint&&(n(He,D,[v(T),{t:at}],ve=>{e.uniform1i(ve("tex"),0),e.uniform1i(ve("lut"),1),e.uniform1f(ve("useM"),1),e.uniform1f(ve("useL"),0),e.uniform1fv(ve("m"),he.tint.flat())}),I=D),S(I,I===T?D:T,I,he.sigma);const ee=6;n(N,ee,[v(fe),v(I)],ve=>{e.uniform1i(ve("a"),0),e.uniform1i(ve("b"),1),e.uniform1f(ve("amount"),he.amount)}),n(X,3,[v(ee)],ve=>e.uniform1i(ve("tex"),0)),fe=3}else if(he?.type==="grain"){const T=Zi(i.frame??0),D=`${T}:${t}x${l}:${he.amp}`;let I=P.get(D);if(!I){if(P.size>8){for(const ee of P.values())e.deleteTexture(ee);P.clear()}I=ce(),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.texImage2D(e.TEXTURE_2D,0,e.R8,t,l,0,e.RED,e.UNSIGNED_BYTE,Ji(T,t,l,he.amp)),e.pixelStorei(e.UNPACK_ALIGNMENT,4),P.set(D,I)}const ne=tt(fe);n(we,ne,[v(fe),{t:I}],ee=>{e.uniform1i(ee("tex"),0),e.uniform1i(ee("grain"),1)}),fe=ne}else if(he?.type==="denoise"){const T=tt(fe),D=tt(fe,T);S(fe,T,D,he.sigma),n($e,6,[v(fe),v(D)],I=>{e.uniform1i(I("tex"),0),e.uniform1i(I("soft"),1),e.uniform1f(I("t"),he.t)}),n(X,3,[v(6)],I=>e.uniform1i(I("tex"),0)),fe=3}else if(he?.type==="swirl"){const T=D=>Math.max(2,Math.round(D/2)*2);for(const D of er(t,l,he.deg)){const I=tt(fe);n(ke,I,[v(fe)],ne=>{e.uniform1i(ne("tex"),0),e.uniform2f(ne("size"),t,l),e.uniform1fv(ne("a"),D.map(ee=>+ee.a.toFixed(6))),e.uniform1fv(ne("sx"),D.map(ee=>T(t*ee.scale)/t)),e.uniform1fv(ne("sy"),D.map(ee=>T(l*ee.scale)/l))}),fe=I}}const Oo=et==="parallel"?2:u,zo=et==="parallel"?6:1-u;n(O,zo,[v(Oo),v(fe),{t:dt}],T=>{e.uniform1i(T("base"),0),e.uniform1i(T("over"),1),e.uniform1i(T("mask"),2),e.uniform2f(T("msz"),vt[0],vt[1]),e.uniform1f(T("full"),$.whole?1:0)}),et==="parallel"&&n(ye,1-u,[v(u),v(6),v(2)],T=>{e.uniform1i(T("res"),0),e.uniform1i(T("outp"),1),e.uniform1i(T("inp"),2)}),u=1-u}s=_[u].tex,e.bindFramebuffer(e.FRAMEBUFFER,o),e.viewport(p[0],p[1],p[2],p[3]),b&&e.enable(e.BLEND)},Bt=(a,c)=>K?(J!==K.key&&($t(a,c,K),J=K.key),"win"):"pic",pt=(a,c,i,o,p,b,t)=>{if(!k){const S=Bt(a,t);qe(a,c,i,o,p,b,S==="win"?null:t,S);return}const l=Ke??[0,0,1,1];d!==k.key&&(ue(a,l,t,k),d=k.key);const u=(i[0]-l[0])/l[2],w=(i[1]-l[1])/l[3],n=i[2]/l[2],v=i[3]/l[3];qe(a,c,[u,1-w,n,-v],o,p,b,null,"edge")},qe=(a,c,i,o,p,b,t,l)=>{const u=l==="edge"||l==="win",w=l==="pic"||l==="base";if(e.useProgram(L),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,ft),w&&e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a.source),e.uniform4f(A("dst"),c[0],c[1],c[2],c[3]),e.uniform4f(A("src"),i[0],i[1],i[2],i[3]),e.uniform1f(A("alpha"),o),e.uniform1f(A("fade"),p),e.uniform1f(A("white"),b?1:0),e.uniform1f(A("colour"),t?1:0),e.uniform1i(A("tex"),0),e.uniform1i(A("matte"),1),e.uniform1f(A("useMatte"),Ke&&(l==="pic"||l==="win")?1:0),Pe&&!u?(e.uniform4f(A("key"),Pe.u,Pe.v,Pe.similarity,Pe.blend),e.uniform4f(A("keyOpt"),1,Pe.blue?1:0,Pe.spill,a.bt709?1:0)):e.uniform4f(A("keyOpt"),0,0,0,0),e.uniform1i(A("lut1"),2),e.uniform1i(A("lut3"),3),e.uniform1f(A("useL1"),bt&&!u?1:0),e.uniform1f(A("useL3"),Gt&&!u?1:0),Ke&&e.uniform4f(A("mrect"),Ke[0],Ke[1],Ke[2],Ke[3]),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,Et),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,at),e.activeTexture(e.TEXTURE3),e.bindTexture(e.TEXTURE_3D,lt),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,l==="edge"?E[1].tex:l==="win"?s:ft),t){const n=v=>[v[0],v[3],v[6],v[1],v[4],v[7],v[2],v[5],v[8]];e.uniform1f(A("bright"),t.bright),e.uniform1f(A("contrast"),t.contrast),e.uniformMatrix3fv(A("sat"),!1,n(t.sat)),e.uniformMatrix3fv(A("rot"),!1,n(t.rot))}e.drawArrays(e.TRIANGLE_STRIP,0,4)};return{canvas:y,clear(a=1){le(null),e.clearColor(0,0,0,a),e.clear(e.COLOR_BUFFER_BIT)},pixels(){le(null);const a=new Uint8ClampedArray(m*g*4),c=m*4,i=new Uint8ClampedArray(m*g*4);e.readPixels(0,0,m,g,e.RGBA,e.UNSIGNED_BYTE,a);for(let o=0;o<g;o++){const p=(g-1-o)*c,b=o*c;for(let t=0;t<c;t+=4){const l=a[p+t+3];if(i[b+t+3]=l,l){const u=255/l;i[b+t]=a[p+t]*u,i[b+t+1]=a[p+t+1]*u,i[b+t+2]=a[p+t+2]*u}}}return i},draw(a,c,i,o,p,b,t=null,l=[],u=null){if(!l.length&&!_e&&!U.length&&!Be){le(null),e.enable(e.BLEND),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),pt(a,c,i,o,p,b,t);return}Le??=[De(),De(),De()],le(Le[0].fb),e.disable(e.BLEND),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),pt(a,u??c,i,o,p,b,t);const w=f(l);if(le(null),e.enable(e.BLEND),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),_e||U.length||Be){let n=w;u&&(n=(w+1)%3,le(Le[n].fb),e.disable(e.BLEND),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.useProgram(L),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,Le[w].tex),e.uniform4f(A("dst"),c[0],c[1],c[2],c[3]),e.uniform4f(A("src"),0,1,1,-1),e.uniform1f(A("alpha"),1),e.uniform1f(A("fade"),1),e.uniform1f(A("white"),0),e.uniform1f(A("colour"),0),e.uniform1f(A("useMatte"),0),e.drawArrays(e.TRIANGLE_STRIP,0,4)),ut(n);return}if(!u){j(X,null,[Le[w].tex],n=>e.uniform1i(n("tex"),0));return}e.useProgram(L),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,Le[w].tex),e.uniform4f(A("dst"),c[0],c[1],c[2],c[3]),e.uniform4f(A("src"),0,1,1,-1),e.uniform1f(A("alpha"),1),e.uniform1f(A("fade"),1),e.uniform1f(A("white"),0),e.uniform1f(A("colour"),0),e.uniform1f(A("useMatte"),0),e.drawArrays(e.TRIANGLE_STRIP,0,4)},warp(a,c,i,o,p,b,t,l,u,w=null,n=null,v=[]){const S=Fe();le(S[0].fb),e.disable(e.BLEND),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),pt(a,c,i,o,p,b,t);const Y=f(l),W=_e||U.length||Be||v.length?(Y+1)%3:-1;W>=0?(le(S[W].fb),e.disable(e.BLEND),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)):(le(null),e.enable(e.BLEND),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),n&&(e.enable(e.SCISSOR_TEST),e.scissor(n[0],g-n[1]-n[3],n[2],n[3])),j(Qe,W>=0?S[W].fb:null,[S[Y].tex],Q=>{e.uniform1i(Q("tex"),0),e.uniform2f(Q("size"),m,g),e.uniform1f(Q("keepPre"),0),e.uniformMatrix3fv(Q("inv"),!1,[u[0],u[3],u[6],u[1],u[4],u[7],u[2],u[5],u[8]]),e.uniform4f(Q("rnd"),w?.[0]??0,w?.[1]??0,w?.[2]??0,w?1:0)}),e.disable(e.SCISSOR_TEST),W>=0&&ut(v.length?f(v,W):W)},adjust(a,c,i){const o=Fe();if(le(null),e.bindTexture(e.TEXTURE_2D,Tt),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA8,0,0,m,g,0),le(o[0].fb),e.disable(e.BLEND),e.useProgram(L),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,Tt),e.uniform4f(A("dst"),0,0,1,1),e.uniform4f(A("src"),0,1,1,-1),e.uniform1i(A("tex"),0),e.uniform1f(A("alpha"),1),e.uniform1f(A("fade"),1),e.uniform1f(A("white"),0),e.uniform1f(A("useMatte"),0),e.uniform1f(A("colour"),a?1:0),a){const b=t=>[t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]];e.uniform1f(A("bright"),a.bright),e.uniform1f(A("contrast"),a.contrast),e.uniformMatrix3fv(A("sat"),!1,b(a.sat)),e.uniformMatrix3fv(A("rot"),!1,b(a.rot))}e.drawArrays(e.TRIANGLE_STRIP,0,4);const p=f(c);le(null),e.enable(e.BLEND),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),e.useProgram(L),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,o[p].tex),e.uniform4f(A("dst"),0,0,1,1),e.uniform4f(A("src"),0,1,1,-1),e.uniform1f(A("alpha"),i),e.uniform1f(A("fade"),1),e.uniform1f(A("white"),0),e.uniform1f(A("colour"),0),e.uniform1f(A("useMatte"),0),e.drawArrays(e.TRIANGLE_STRIP,0,4)},grade(a,c){if(bt=!!a,Gt=!!c,a&&Oe.l1!==a.key){const i=new Float32Array(1024);for(let o=0;o<256;o++)i[o*4]=a.r[o],i[o*4+1]=a.g[o],i[o*4+2]=a.b[o],i[o*4+3]=1;e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,at),e.texImage2D(e.TEXTURE_2D,0,e.RGBA32F,256,1,0,e.RGBA,e.FLOAT,i);for(const o of[e.TEXTURE_MIN_FILTER,e.TEXTURE_MAG_FILTER])e.texParameteri(e.TEXTURE_2D,o,e.NEAREST);e.activeTexture(e.TEXTURE0),Oe.l1=a.key}if(c&&Oe.l3!==c.key){e.activeTexture(e.TEXTURE3),e.bindTexture(e.TEXTURE_3D,lt),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.texImage3D(e.TEXTURE_3D,0,e.RGB32F,c.size,c.size,c.size,0,e.RGB,e.FLOAT,c.data),e.pixelStorei(e.UNPACK_ALIGNMENT,4);for(const i of[e.TEXTURE_MIN_FILTER,e.TEXTURE_MAG_FILTER])e.texParameteri(e.TEXTURE_3D,i,e.NEAREST);for(const i of[e.TEXTURE_WRAP_S,e.TEXTURE_WRAP_T,e.TEXTURE_WRAP_R])e.texParameteri(e.TEXTURE_3D,i,e.CLAMP_TO_EDGE);e.activeTexture(e.TEXTURE0),Oe.l3=c.key}},key(a){if(!a){Pe=null;return}const[c,i,o]=[1,3,5].map(b=>parseInt(a.color.slice(b,b+2),16)),p=224/255;Pe={u:Math.round(-.168736*p*c-.331264*p*i+.5*p*o+128),v:Math.round(.5*p*c-.418688*p*i-.081312*p*o+128),similarity:a.similarity,blend:a.blend,spill:+a.spill.toFixed(3),blue:o>i}},mode(a){_e=a&&Qt[a]||0},shadow(a){U=a},glBegin(){wt??={base:ce(),a:ce(),b:ce()},le(null),e.bindTexture(e.TEXTURE_2D,wt.base),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA8,0,0,m,g,0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},glEnd(a,c,i){const o=wt;if(le(null),e.bindTexture(e.TEXTURE_2D,a==="a"?o.a:o.b),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA8,0,0,m,g,0),e.disable(e.BLEND),j(X,null,[o.base],t=>e.uniform1i(t("tex"),0)),a==="a")return;let p=Rt.get(c);p||(p=h(G,mi(sr[c])),Rt.set(c,p)),yt??=De(),j(p,yt.fb,[o.a,o.b],t=>{e.uniform1i(t("glFrom"),0),e.uniform1i(t("glTo"),1),e.uniform1f(t("progress"),Math.max(0,Math.min(1,i))),e.uniform1f(t("ratio"),m/g),e.uniform1f(t("glPremul"),1)});const b=_e;_e=0,Je(yt.tex),_e=b},blurBegin(){be??=De(),le(be.fb),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),Be=!0},blurEnd(){Be=!1;const a=Fe();e.disable(e.BLEND),j(x,a[0].fb,[be.tex],c=>e.uniform1i(c("tex"),0)),ut(0)},windows(a){K=a},edge(a){k=a},warpBig(a,c,i,o,p,b,t,l,u,w=[]){const n=Dt(u),v=m*u,S=g*u;e.bindFramebuffer(e.FRAMEBUFFER,n.plane.fb),e.viewport(0,0,v,S),e.disable(e.BLEND),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),pt(a,c,i,o,p,b,t);const Y=Ot(l.map(([Ee,H])=>[Ee*u,H*u]),v,S);e.bindFramebuffer(e.FRAMEBUFFER,n.out.fb),e.viewport(0,0,v,S),e.useProgram(Qe),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n.plane.tex);const W=Ye(Qe);if(e.uniform1i(W("tex"),0),e.uniform2f(W("size"),v,S),e.uniform1f(W("keepPre"),1),e.uniform4f(W("rnd"),0,0,0,0),e.uniformMatrix3fv(W("inv"),!1,[Y[0],Y[3],Y[6],Y[1],Y[4],Y[7],Y[2],Y[5],Y[8]]),e.drawArrays(e.TRIANGLE_STRIP,0,4),le(null),e.enable(e.BLEND),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),!w.length&&!_e&&!U.length&&!Be){j(Z,null,[n.out.tex],Ee=>{e.uniform1i(Ee("tex"),0),e.uniform1i(Ee("ss"),u)});return}const Q=Fe();e.disable(e.BLEND),j(Z,Q[0].fb,[n.out.tex],Ee=>{e.uniform1i(Ee("tex"),0),e.uniform1i(Ee("ss"),u)}),ut(f(w,0))},matte(a,c=[0,0,1,1]){Ke=a?c:null,a&&(e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,Et),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a),e.activeTexture(e.TEXTURE0))},overlay(a,c){le(null),e.enable(e.BLEND),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),c&&(e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,ft),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,c.w,c.h,0,e.RGBA,e.UNSIGNED_BYTE,c.data)),j(st,null,c?[ft]:[],i=>{e.uniform1i(i("tex"),0),e.uniform1f(i("usetex"),c?1:0),e.uniform4f(i("colour"),...a??[0,0,0,0])})},finish(){e.finish()}}}let Ce="";const qa=()=>Ce;async function _a(m,{format:g,encode:y=null,tracks:e={},camera:q=null,signal:h,onProgress:L,frames:M,software:V=!1,liveMotion:ie=!1,range:se,only:me,sink:pe}){const x=performance.now(),{width:R,height:F,fps:C}=ao(g);Ce="layers",await Promise.all([...new Set(m.filter(r=>!r.colorBypass).flatMap(r=>Ht(r.grade).map(f=>f?.lut?.id)).filter(r=>!!r))].map(r=>nr(r))),Go(uo(m.filter(r=>!r.disabled)));const N=m.filter(r=>!r.disabled&&!Uo(r)),X=uo(N),te=qo(N.reduce((r,f)=>Math.max(r,f.start+f.duration),0)),oe=Math.round(te*C);if(!(oe>0)&&!M)throw Error("Empty timeline");const O=$o(q)?q:null,Ae=jo(X,e,O?r=>Xi(r,O,R,F):void 0),we=r=>Ae.find(f=>r>=f.start-1e-6&&r<f.start+f.duration-1e-6)??null,$e=()=>{if(h?.aborted)throw new DOMException("Export cancelled","AbortError")},ye=r=>ie&&!M&&!!r.motion&&!r._virtual&&!r.warped,We=r=>M||me!=="audio"&&(!se||r.start<se.to/C+1e-6&&r.start+r.duration>se.from/C-1e-6),je=new Cr,nt=[...N.filter(r=>Kt(r)&&!ye(r)),...Ho(N)].filter(We);nt.length&&await(await Nt(async()=>{const{renderTitleFrames:r}=await import("./titleFrames-aMG7HdVe.js");return{renderTitleFrames:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).renderTitleFrames(nt,g,je,h);const Me=new Map;if(N.some(r=>ye(r)&&We(r))){const r=await Nt(()=>import("./titleFrames-aMG7HdVe.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));for(const f of N.filter(k=>ye(k)&&We(k)))Me.set(f.id,r.liveMotion(f,N,g))}N.some(r=>r.kind==="model")&&await(await Nt(async()=>{const{render3DFrames:r}=await import("./timeline3dExport-DCOr6ARB.js");return{render3DFrames:r}},__vite__mapDeps([10,1,11,12,13,8,6,7,14,9]))).render3DFrames(m.filter(r=>!r.disabled),g,je,h,q);for(const r of X.filter(f=>f._group&&f.comp)){const f=[],k=Math.max(1,Math.ceil(r.duration*C-1e-6));await _a(dr(vr(r),{W:R,H:F}),{format:g,signal:h,frames:{times:Array.from({length:k},(d,E)=>xr(r,E/C)),push:(d,E)=>{f[d]=E}}}),je.frames.set(r.id,f)}const st=performance.now();$e(),Ce="mattes";const Qe=N.filter(r=>r.mask||r.person),Re=Qe.length?await Nt(()=>import("./rotoMatte-i-cJTYmK.js").then(r=>r.r),__vite__mapDeps([15,1,8,6,7,16])):null;Re&&await Re.prepareMattes(Qe);const He=Re?document.createElement("canvas"):null;Ce="media";const Ze=new Map,Se=new Map,Xe=new Map,it=r=>{let f=Ze.get(r);return f||(f=new _r({source:new Ar(r,{getRetryDelay:No}),formats:Fr}),Ze.set(r,f)),f};for(const r of N){if(r.kind==="video"&&!Se.has(r.url)){const f=await it(r.url).getPrimaryVideoTrack();f&&Se.set(r.url,new yr(f))}if(r.kind==="image"&&!Kt(r)&&!oo(r)&&!r._group&&!Xe.has(r.url)){const f=await createImageBitmap(await Ir(r.url,h),{imageOrientation:"from-image",premultiplyAlpha:"none",colorSpaceConversion:"none"});Xe.set(r.url,{source:f,w:f.width,h:f.height,close:()=>f.close()})}}const Z=new Map,ge=async(r,f)=>{const k=Me.get(r.id);if(k)return{source:await k.frame(Math.round((f-r.start)*C)),w:k.W,h:k.H};const d=je.frames.get(r.id);if(!d?.length)return null;let E=d.length===1?0:Math.max(0,Math.min(Math.round((f-r.start)*C),Math.ceil(r.duration*C)-1,d.length-1));for(;E>0&&d[E]==="=";)E--;const z=Z.get(r.id);if(z&&z.index===E)return z.pic;z?.pic?.close?.();const B=await createImageBitmap(await(await fetch(`data:image/webp;base64,${d[E]}`)).blob(),{premultiplyAlpha:"none",colorSpaceConversion:"none"}),ue={source:B,w:B.width,h:B.height,close:()=>B.close()};return Z.set(r.id,{index:E,pic:ue}),ue},ct=N.filter(r=>Vo(r)),Ve=ct.length?await Nt(()=>import("./captionLayout-CWPcbid-.js"),__vite__mapDeps([17,1])):null,ke=new Map,rt=new Map;if(Ve){for(const r of new Set(ct.flatMap(f=>[eo(Yo(f.captionStyle).font),eo(mo(f.captionStyle).font)])))if(await Ve.captionFontReady(r.id),!ke.has(r.id)){const f=new Uint8Array(await(await fetch(`/fonts/${r.file}`,{signal:h})).arrayBuffer());let k="";for(let d=0;d<f.length;d+=32768)k+=String.fromCharCode(...f.subarray(d,d+32768));ke.set(r.id,`@font-face{font-family:'${r.family}';src:url(data:font/${r.file.endsWith(".otf")?"otf":"ttf"};base64,${btoa(k)})}`)}}const Ye=new Map,A=async(r,f,k)=>{let d=Ye.get(f.start);if(!d||d.owner!==r){const _=pi(r,f.start,f.duration);d={plan:_,starts:xi(_.entries,C),owner:r},Ye.clear(),Ye.set(f.start,d)}const E=k-Math.round(f.start*C);let z=-1;for(let _=0;_<d.starts.length&&d.starts[_]<=E;_++)z=_;const B=d.plan.entries[z];if(!B||B.blank)return null;const ue=d.plan.social?d.plan.social.style:mo(r.captionStyle),K=d.plan.social?di(d.plan.social,B.gi,R,F,Ve.measureCaption):vi({width:R,height:F,text:B.text,style:ue,measure:Ve.measureCaption,second:B.second}),J=hi(K,ue,d.plan.social?B.scale:1,R,F,B.active,B.motion);let s=rt.get(J);if(!s){const _=eo(ue.font),re=URL.createObjectURL(new Blob([J.replace("<defs>",`<defs><style>${ke.get(_.id)??""}</style>`)],{type:"image/svg+xml"}));try{const xe=new Image(R,F);xe.src=re,await xe.decode();const ze=await createImageBitmap(xe,{premultiplyAlpha:"none"});s={source:ze,w:R,h:F,close:()=>ze.close()}}finally{URL.revokeObjectURL(re)}if(rt.size>64){const[xe,ze]=rt.entries().next().value;ze.close?.(),rt.delete(xe)}rt.set(J,s)}return s},ce=[0,0,1,1],ft=new Map,Et=["x","y","zoom","rot","sx","sy"],Ke=(r,f,k,d)=>{const E=`${r.id}@${f.start}`;let z=ft.get(E);if(!z){const ue=Math.max(1,Math.ceil(f.duration/.1-1e-6)),K=Array.from({length:ue+1},(_,re)=>f.start+f.duration*re/ue),J=K.map(_=>to(r,_-r.start,R,F)),s=_=>+(+_).toFixed(3);z={ts:K.map(_=>+_.toFixed(5)),v:Object.fromEntries(Et.map(_=>[_,J.map(re=>s(re[_]??(_==="sx"||_==="sy"?1:0)))]))},ft.set(E,z)}const B={...d};for(const ue of Et){const K=z.v[ue];if(K.every(re=>re===K[0])){B[ue]=K[0];continue}let J=z.ts.findIndex((re,xe)=>xe<z.ts.length-1&&k<z.ts[xe+1]);J<0&&(J=z.ts.length-2);const s=+(K[J+1]-K[J]).toFixed(3),_=z.ts[J+1]-z.ts[J];B[ue]=Math.abs(K[J+1]-K[J])<1e-4?K[J]:K[J]+s*Math.max(0,Math.min(1,(k-z.ts[J])/_))}return B},at=new Map,lt=new Map,Oe=(r,f,k,d=r,E="")=>{if(!gi(d))return Fo(d,R);const z=`${r.id}${E}@${f.start}`;let B=lt.get(z);B||(B=Ei(d,{offset:f.start-r.start,duration:f.duration,fps:C}),lt.set(z,B));const ue=k-Math.round(f.start*C),K=B.find(J=>ue>=J.from&&ue<J.to)??B[B.length-1];return Fo({effects:bi(d,K.t)},R)},bt=new Map,Gt=(r,f,k)=>{const d=`${r.id}@${f.start}`;bt.has(d)||bt.set(d,O?Bi(r,O,f.start,f.duration,R,F):null);const E=bt.get(d);return E?Oe(r,f,k,E,":dof"):[]},Pe=new Map,Qt=r=>{const f=JSON.stringify(r.grade);let k=Pe.get(f);if(!k){const d=B=>Array.from(B,ue=>+ue.toFixed(6)),E=Ri(r.grade)?_i(r.grade):null,z=r.grade.mixer&&Fi(r.grade.mixer)?Ai(r.grade.mixer):null;k={l1:E?{key:`1${f}`,r:d(E.r),g:d(E.g),b:d(E.b)}:null,l3:z?{key:`3${f}`,size:z.size,data:Float32Array.from(z.data,B=>+B.toFixed(6))}:null},Pe.set(f,k)}return k};let _e=null;const Tt=async(r,f,k)=>{const d=N.find(B=>B.id===r);if(!d||f<d.start||f>=d.start+d.duration)return null;if(Kt(d)){const B=await ge(d,f);return B&&{source:B.source,w:B.w,h:B.h}}if(d.kind==="image"){const B=Xe.get(d.url);return B?{source:B.source,w:B.w,h:B.h}:null}if(d.kind!=="video")return null;const E=await Mo(mt,Se,d,f,C,Math.max(k.start,d.start),k.duration);if(!E)return null;const z=E.toVideoFrame();return{source:z,w:E.displayWidth,h:E.displayHeight,close:()=>z.close()}};Ce="output";const U=Ra(R,F),wt=no(y,{width:R,height:F,fps:C},so),yt=y?.codec==="hevc",Rt=y?.container==="mov",Be=!M&&!pe&&te*wt/8>15e7&&!!navigator.storage?.getDirectory;let be=null,_t;if(Be){const r=await navigator.storage.getDirectory(),f=`gpu-export-${crypto.randomUUID()}.${Rt?"mov":"mp4"}`,k=await r.getFileHandle(f,{create:!0});be={dir:r,handle:k,name:f},_t=new Ao(await k.createWritable(),{chunked:!0,chunkSize:1<<20})}else _t=pe&&!M?new Ao(pe,{chunked:!0,chunkSize:1<<22}):new Sr;const ut=pe&&!M?!1:Be?"reserve":"in-memory",Je=new Dr({format:Rt?new Ur({fastStart:ut}):new kr({fastStart:ut}),target:_t}),Le=new Pr(U.canvas,{codec:yt?"hevc":"avc",bitrate:wt,keyFrameInterval:2,...yt?{hardwareAcceleration:"prefer-hardware"}:V?{hardwareAcceleration:"prefer-software"}:{}}),Fe=me==="audio"?0:Math.max(0,Math.min(oe,se?.from??0)),Ft=me==="audio"?0:Math.max(Fe,Math.min(oe,se?.to??oe));me!=="audio"&&Je.addVideoTrack(Le,{frameRate:C,...Be?{maximumPacketCount:Ft-Fe+8}:{}});const Dt=new Br({codec:"aac",bitrate:Lo});me!=="video"&&Je.addAudioTrack(Dt,Be?{maximumPacketCount:Math.ceil(te*zt/1024)+16}:{}),M||await Je.start();const Ut=M?new OffscreenCanvas(R,F):null,qt=Ut?.getContext("2d"),Zt=async r=>{qt.putImageData(new ImageData(U.pixels(),R,F),0,0);const f=new Uint8Array(await(await Ut.convertToBlob({type:"image/webp",quality:.9})).arrayBuffer());let k="";for(let d=0;d<f.length;d+=32768)k+=String.fromCharCode(...f.subarray(d,d+32768));M.push(r,btoa(k))},mt=new Map;let At=0;const kt={decode:0,matte:0,titles:0,captions:0,encode:0},De=async(r,f)=>{const k=performance.now();try{return await f}finally{kt[r]+=performance.now()-k}},le=(r,f)=>{const k=performance.now();try{return f()}finally{kt[r]+=performance.now()-k}};try{for(let f=M?0:Fe,k=M?M.times.length:Ft;f<k;f++){$e(),Ce="frame";const d=M?M.times[f]:f/C,E=we(d);U.clear(M?0:1);const z=E&&Ve?Ko(N,E.start+1e-5,e):void 0,B=z&&E?Wo(E.visuals,z.captionStyle?.layerTrack):-1,ue=async()=>{const K=z&&E&&await De("captions",A(z,E,f));K&&(U.shadow([]),U.edge(null),U.windows(null),U.matte(null),U.mode(void 0),U.key(null),U.grade(null,null),U.draw(K,ce,ce,1,1,!1,null,[]))};for(const[K,J]of(E?.visuals??[]).entries()){let s=J;if(K===B&&await ue(),s.kind==="audio")continue;const _=E?po(s,E.start,E.start+E.duration):null,re=_?s._txIn===_?"b":"a":null,xe=_?Qo(_,d):0,ze=_&&re?_.spec.gl?.id??null:null;ze&&U.glBegin();e:{if(s.kind==="model"){U.matte(null),U.edge(null),U.windows(null),U.mode(void 0),U.shadow(xo(s,R)),U.key(null),U.grade(null,null);const o=await ge(s,d);o&&U.draw(o,ce,ce,1,1,!1,null,[]);break e}const de=d-s.start,Ge=to(s,de,R,F),ae=(Zo(s)||Jo(s))&&!_&&!(O&&Vt(s))&&!s.pin?Ke(s,E,d,Ge):Ge;if(!(ae.opacity>1e-4))break e;if(oo(s)){U.adjust(ot(s),Oe(s,E,f),Math.min(1,ae.opacity));break e}let P=null,Ne=null;if(Kt(s)||s._group)P=await De("titles",ge(s,d));else if(s.kind==="image")P=Xe.get(s.url)??null;else if(s.kind==="video"){const o=await De("decode",Mo(mt,Se,s,d,C,E.start,E.duration));o&&(Ne=o.toVideoFrame(),P={source:Ne,w:o.displayWidth,h:o.displayHeight,bt709:Ne.colorSpace?.matrix?Ne.colorSpace.matrix==="bt709":o.displayHeight>=720})}if(!P)break e;if(ei(s)){const o=s.crop||{left:0,right:0,top:0,bottom:0},p=Math.floor(P.w*o.left/2)*2,b=Math.floor(P.h*o.top/2)*2,t=Math.max(2,Math.floor(P.w*(1-o.left-o.right)/2)*2),l=Math.max(2,Math.floor(P.h*(1-o.top-o.bottom)/2)*2),u=s.distort.displace?await Tt(s.distort.displace.map,d,E):null;_e??=wr();const w=_e.render({source:P.source,srcW:P.w,srcH:P.h,rect:[p,b,t,l],outW:t,outH:l,distort:s.distort,local:de,map:u?.source??null,matte:Re&&(s.mask||s.person)?Re.matteCanvas(s,de,He,!1,N):null});u?.close?.(),P={source:w,w:t,h:l,bt709:P.bt709},s={...s,crop:void 0,mask:void 0,person:void 0}}if(Re&&(s.mask||s.person)){const o=s.crop||{left:0,right:0,top:0,bottom:0},p=Math.max(2,Math.floor(P.w*(1-o.left-o.right)/2)*2),b=Math.max(2,Math.floor(P.h*(1-o.top-o.bottom)/2)*2);U.matte(le("matte",()=>Re.matteCanvas(s,de,He,!1,N)),[o.left,o.top,p/P.w,b/P.h])}else U.matte(null);U.mode(s.blend),U.key(s.key),U.shadow(xo(s,R));{const o=s.colorBypass?[]:Ht(s.grade).filter(io);U.windows(o.length?{key:`${s.id}@${f}`,list:Ht(s.grade),clip:s.id,src:s,frame:Math.round((d-s.start)*C),local:Math.round((d-s.start)*C)/C}:null)}if(vo(s)&&ho(go(s),de)>.001){const o=go(s),p=Re&&(s.mask||s.person),b=s.crop||{left:0,right:0,top:0,bottom:0},t=p?Math.max(2,Math.floor(p.mw*(1-b.left-b.right)/2)*2):P.w,l=p?Math.max(2,Math.floor(p.mh*(1-b.top-b.bottom)/2)*2):P.h,u=t>=l?Yt:Math.max(8,Math.trunc(Yt*t/l/8)*8),w=t>=l?Math.max(8,Math.trunc(Yt*l/t/8)*8):Yt,n=ti(o),v=ho(o,de),S=!!o.keys?.length||o.amount<.999;U.edge({key:`${s.id}@${f}`,ew:u,eh:w,band:n.band,glow:n.glow,k:o.glow,col:[1,3,5].map(Y=>parseInt(o.color.slice(Y,Y+2),16)/255),am:S?Math.trunc(255*v):255,harden:!!p,arc:o.cover>=.999&&!o.comet?null:{cen:p?oi(s):[.5,.5],start:(o.angle+o.sweep*de)*Math.PI/180,cover:o.cover,comet:!!o.comet}})}else U.edge(null);{const o=s.grade&&!s.colorBypass?Qt(s):null;U.grade(o?.l1??null,o?.l3??null)}if(s.pin&&!(O&&Vt(s))&&E&&Eo(s,N,E.start,R,F,O)){const o=Eo(s,N,d,R,F,O)??[[0,0],[0,0],[0,0],[0,0]],p=It(s,de),b=ii(s,N,R,F,O),t=s.pin.dive,l=b&&!s.pin.scene?[+(b[0]*R).toFixed(3),+(b[1]*F).toFixed(3),t?Math.max(0,Math.min(1,(d-t.at)/t.dur)):0]:null;U.warp(P,Ct([0,0,1,1],R,F),_o(s,P.w,P.h),Math.min(1,ae.opacity),p.k,p.white,ot(s),Oe(s,E,f),Ot(o,R,F),l),Ne?.close();break e}const Pt=ri(s,"rot")||ai(s),$t=()=>s.motionBlur?Tr(d,C).map(o=>({...to(s,o-s.start,R,F),rot:ae.rot,opacity:ae.opacity})):[ae];if((Pt||Math.abs(ae.rot||0)>1e-9)&&!(O&&Vt(s))){const o=It(s,de),p=_&&re?[...Do(_.spec[re],xe,R,F,d,_.spec.zoomAt),...re==="b"&&_.spec.mask?[So(_.spec.mask,xe)]:[]]:[];s.motionBlur&&U.blurBegin();for(const b of $t()){const t=hr(s,P.w,P.h,R,F,b,Pt);U.warp(P,Ct([0,0,1,1],R,F),_o(s,P.w,P.h),Math.min(1,ae.opacity),o.k,o.white,ot(s),[],Ot(t.quad,R,F),null,t.clip,p)}s.motionBlur&&U.blurEnd(),Ne?.close();break e}if(O&&Vt(s)){const o=ni(s,de,O,d,R,F);if(o){const p=Xt(s,P.w,P.h,R,F,{x:0,y:0,zoom:1}),b=It(s,de),t=Oe(s,E,f);let l=at.get(s.id);l===void 0&&(l=s.effects?.some(w=>!w.off)||s.mask||s.person||vo(s)||!s.colorBypass&&Ht(s.grade).some(io)?1:si(ci(s,O,R,F),P.w,P.h,R,F),at.set(s.id,l));const u=Gt(s,E,f);l>1&&!t.length?U.warpBig(P,Ct(p.dst,R,F),p.src,Math.min(1,ae.opacity),b.k,b.white,ot(s),o.quad,l,u):U.warp(P,Ct(p.dst,R,F),p.src,Math.min(1,ae.opacity),b.k,b.white,ot(s),t,Ot(o.quad,R,F),null,null,u)}Ne?.close();break e}if(s.motionBlur&&!_&&!Oe(s,E,f).length){const o=It(s,de);U.blurBegin();for(const p of $t()){const b=Xt(s,P.w,P.h,R,F,p);U.draw(P,b.dst,b.src,Math.min(1,ae.opacity),o.k,o.white,ot(s),[])}U.blurEnd(),Ne?.close();break e}const{dst:Bt,src:pt}=Xt(s,P.w,P.h,R,F,ae),qe=It(s,de),a=[...Oe(s,E,f),..._&&re?Do(_.spec[re],xe,R,F,d,_.spec.zoomAt):[],..._&&re==="b"&&_.spec.mask?[So(_.spec.mask,xe)]:[]],c=_&&re?_.spec[re]?.rot:null;if(c){const o=Wt(c,xe)??0;U.warp(P,Ct([0,0,1,1],R,F),pt,Math.min(1,ae.opacity),qe.k,qe.white,ot(s),[],Ot(gr(Bt,R,F,o),R,F),null,null,a),Ne?.close();break e}if(a.length>0&&!!E&&!s.layout&&!po(s,E.start,E.start+E.duration)&&fi(s,E.start,E.start+E.duration,R,F)){const o=Xt(s,P.w,P.h,R,F,{x:0,y:0,zoom:1}),p=Xt({},R,F,R,F,ae);U.draw(P,p.dst,o.src,Math.min(1,ae.opacity),qe.k,qe.white,ot(s),a,o.dst)}else U.draw(P,Bt,pt,Math.min(1,ae.opacity),qe.k,qe.white,ot(s),a);Ne?.close()}if(ze&&U.glEnd(re,ze,xe),_&&re==="b"){if(_.spec.light){const Ge=Math.max(2,Math.ceil(R/bo)),ae=Math.max(2,Math.ceil(F/bo));U.overlay(null,{data:li(_.spec,xe,Ge,ae),w:Ge,h:ae})}const de=_.spec.flash;if(de){const Ge=Wt(de.opacity,xe)??0;if(Ge>1e-4){const ae=parseInt(de.color.slice(1),16);U.overlay([(ae>>16&255)/255,(ae>>8&255)/255,(ae&255)/255,Math.min(1,Ge)],null)}}}}B>=0&&B>=(E?.visuals.length??0)&&await ue();for(const[K,J]of mt){const s=K.split(`
198
+ `)[0],_=X.find(re=>re.id===s);(!_||d>_.start+_.duration+1)&&(J.current?.close(),J.peek?.close(),await J.iterator.return?.(),mt.delete(K))}if(M){await Zt(f);continue}Ce="video encode",await De("encode",Le.add((f-Fe)/C,1/C)),L?.((me==="video"?1:.9)*(f+1-Fe)/Math.max(1,Ft-Fe))}if(M)return{blob:new Blob,ms:{titles:0,video:0,audio:0,total:Math.round(performance.now()-x)}};const r=performance.now();if(me==="video")Le.close(),Ce="finalize",await Je.finalize();else{Ce="audio";const f=new Map(X.map(d=>[d.id,d])),k=await Aa(N.map(d=>f.get(d.id)??d),Ae,te,e,it,h);typeof g.loudness=="number"&&Er([k.getChannelData(0),k.getChannelData(1)],g.loudness,zt),Ce="audio encode",await Dt.add(k),At=performance.now()-r,me!=="audio"&&Le.close(),Dt.close(),Ce="finalize",await Je.finalize()}}catch(r){throw await Je.cancel().catch(()=>{}),be&&await be.dir.removeEntry(be.name).catch(()=>{}),r}finally{for(const r of mt.values())r.current?.close(),r.peek?.close();_e?.dispose();for(const r of Xe.values())r.close?.();for(const r of Z.values())r.pic?.close?.();for(const r of Me.values())r.close();for(const r of rt.values())r.close?.();for(const r of Ze.values())r.dispose?.()}L?.(1),Ce="file";const j=be?await be.handle.getFile():pe?new Blob([]):new Blob([_t.buffer],{type:Rt?"video/quicktime":"video/mp4"});be&&setTimeout(()=>void be.dir.removeEntry(be.name).catch(()=>{}),600*1e3);const Mt=performance.now()-x;return{blob:j,ms:{titles:Math.round(st-x),video:Math.round(Mt-(st-x)-At),audio:Math.round(At),total:Math.round(Mt),parts:Object.fromEntries(Object.entries(kt).map(([r,f])=>[r,Math.round(f)]))}}}function Fa(m,g,y,e,q){const h=[new Float32Array(Math.max(1,Math.round(q*y))),new Float32Array(Math.max(1,Math.round(q*y)))],L=Math.round(Oi*y);return g.forEach((M,V)=>{if(M.silent)return;const ie=Math.round((M.t1-M.t0)*y)+(V<g.length-1?L:0),se=Math.abs(M.rate),me=Math.round(M.t0*y),pe=Math.max(0,Math.round(((M.rate>0?M.s0:M.s0-se*ie/y)-e)*y)),x=Math.min(m[0].length,Math.round(((M.rate>0?M.s0+se*ie/y:M.s0)-e)*y));if(x-pe<2)return;const R=(x-pe)/ie,F=Math.round(.06*y),C=Math.max(0,pe-F),N=Math.min(m[0].length,x+F);let X=m.map(oe=>oe.slice(C,N));M.rate<0&&X.forEach(oe=>oe.reverse());const te=Math.round((M.rate<0?N-x:pe-C)/R);X=Bo(X,R,y).map(oe=>oe.subarray(te,te+ie));for(let oe=0;oe<2;oe++)for(let O=0;O<ie&&me+O<h[oe].length;O++){const Ae=(V>0&&O<L?O/L:1)*(V<g.length-1&&O>=ie-L?(ie-O)/L:1);h[oe][me+O]+=(X[oe][O]??0)*Ae}}),h}async function Aa(m,g,y,e,q,h){const L=new OfflineAudioContext({numberOfChannels:2,length:Math.max(1,Math.round(y*zt)),sampleRate:zt}),M=1/200,V=m.filter(x=>(x.kind==="video"||x.kind==="audio")&&!x.freeze&&!Po(x)&&(x.volume??1)>0),ie=x=>(x.kind==="video"||x.kind==="audio")&&!!x.url,se=new Map;for(const x of g.flatMap(R=>R.audios))!ie(x)||se.has(x.url)||se.set(x.url,await q(x.url).getPrimaryAudioTrack().then(R=>!!R,()=>!1));const me=x=>ie(x)&&!!se.get(x.url);for(const x of V){if(h?.aborted)throw new DOMException("Export cancelled","AbortError");const R=Math.max(2,Math.ceil(x.duration/M)+1),F=new Float32Array(R);let C=!1;const N=Li(x.track,e);for(let Z=0;Z<R;Z++){const ge=x.start+Math.min(x.duration,Z*M),ct=g.find(ke=>ge>=ke.start-1e-6&&ge<ke.start+ke.duration-1e-6),Ve=ct?.audios.some(ke=>ke.id===x.id)?Ni(x,ge-x.start)*N.gain/Ii(ct.audios,me):0;F[Z]=Ve,Ve>0&&(C=!0)}if(!C)continue;const X=await q(x.url).getPrimaryAudioTrack();if(!X)continue;const te=ko(x)?Ci(x,0,x.duration):null,oe=x.playbackRate||1,O=new Mr(X),Ae=te?te.flatMap(Z=>[Z.s0,Z.s1]):[],we=te?Math.max(0,Math.min(...Ae)-.2):x.inPoint||0,$e=te?Math.max(...Ae)+.2:we+x.duration*oe,ye=[];let We=we;for await(const Z of O.samples(we,$e))ye.length||(We=Z.timestamp),ye.push(Z.toAudioBuffer()),Z.close();if(!ye.length)continue;const je=ye[0].sampleRate,nt=ye.reduce((Z,ge)=>Z+ge.length,0);let Me=[new Float32Array(nt),new Float32Array(nt)],st=0;for(const Z of ye){for(let ge=0;ge<2;ge++)Me[ge].set(Z.getChannelData(Math.min(ge,Z.numberOfChannels-1)),st);st+=Z.length}te?Me=Fa(Me,te,je,We,x.duration):oe!==1&&(Me=Bo(Me,oe,je));const Qe=L.createBuffer(2,Me[0].length,je);for(let Z=0;Z<2;Z++)Qe.copyToChannel(Me[Z],Z);const Re=L.createBufferSource();Re.buffer=Qe;const He=L.createGain();He.gain.value=0,He.gain.setValueCurveAtTime(F,x.start,Math.max(M,x.duration));const Ze=L.createChannelSplitter(2),Se=L.createChannelMerger(2),Xe=L.createGain(),it=L.createGain();Xe.gain.value=N.left,it.gain.value=N.right,Re.connect(He),He.connect(Ze),Ze.connect(Xe,0),Ze.connect(it,1),Xe.connect(Se,0,0),it.connect(Se,0,1),Se.connect(L.destination),Re.start(x.start,te?0:Math.max(0,we-We)/oe,x.duration)}const pe=await L.startRendering();return br([pe.getChannelData(0),pe.getChannelData(1)]),pe}export{Oa as canEncodeH264,za as canEncodeHevc,Xa as canEncodeMp4,_a as exportOnGpu,so as gpuBitrate,qa as gpuExportStage,Ga as gpuExportSupported};