clipoox-render 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/package.json +1 -1
  2. package/scripts/render-local.mjs +1480 -1479
  3. package/web/assets/FxEmbed-BymBArNa.js +1 -0
  4. package/web/assets/MotionEmbed-PmXWSWe5.js +1 -0
  5. package/web/assets/PluginStore-BVsm6n6N.js +3 -0
  6. package/web/assets/{ShotComposer-AHScyNYv.js → ShotComposer-Dprx-Yi7.js} +4 -4
  7. package/web/assets/TemplateEmbed-CrZXoUk_.js +2 -0
  8. package/web/assets/{TimelinePlugins-CkP5P9b_.js → TimelinePlugins-B1KGtbmb.js} +3 -3
  9. package/web/assets/TimelineShotFx-DoLx312Y.js +2 -0
  10. package/web/assets/TransitionEmbed-C5SUosv2.js +1 -0
  11. package/web/assets/{Whiteboard-C9Mwa3nF.js → Whiteboard-DybaKCdo.js} +3 -3
  12. package/web/assets/aerial-DSt_mJNA.js +2 -0
  13. package/web/assets/agentTools-CxZqRLeR.js +2 -0
  14. package/web/assets/analyzerRun-DCJwb_-Z.js +1 -0
  15. package/web/assets/{analyzerSandbox-DQGHjUCa.js → analyzerSandbox-DO5ZTv5q.js} +2 -2
  16. package/web/assets/{api-C5pOWyBM.js → api-BsKbf3l3.js} +4 -4
  17. package/web/assets/auraTrack-QR0WqBHp.js +1 -0
  18. package/web/assets/breakthrough-Dv1bndQb.js +2 -0
  19. package/web/assets/{cameraPresets-CeStHDvF.js → cameraPresets-B234aNzE.js} +1 -1
  20. package/web/assets/{captionLayout-BAdmqwdS.js → captionLayout-CNgb471H.js} +1 -1
  21. package/web/assets/clientExport-NtJmxOYP.js +1 -0
  22. package/web/assets/{depthEstimate-1OjTo_pb.js → depthEstimate-wVYSJtW8.js} +1 -1
  23. package/web/assets/directorTools-BqFcShgT.js +1 -0
  24. package/web/assets/{distortFrames-D39fkQ_H.js → distortFrames-D3TQNcJA.js} +2 -2
  25. package/web/assets/{distortGL-5uNfls9s.js → distortGL-BklPDXPq.js} +1 -1
  26. package/web/assets/editTools-BQlG5WB_.js +1 -0
  27. package/web/assets/exportEncode-CaKEPgsy.js +1 -0
  28. package/web/assets/exportGlb-DstxwzH5.js +2 -0
  29. package/web/assets/faceTracker-DWxxieVC.js +1 -0
  30. package/web/assets/fightDirector-OMlPZgjv.js +1 -0
  31. package/web/assets/fightDrama-G7bXfpQu.js +2 -0
  32. package/web/assets/{frameSink-CB1EghW0.js → frameSink-Dj71jCRb.js} +3 -3
  33. package/web/assets/{gpuCompose-EfzSAeMh.js → gpuCompose-DIxBHlTa.js} +1 -1
  34. package/web/assets/gpuExport-CPSw_dmq.js +189 -0
  35. package/web/assets/handMatte-DHsHHz4m.js +1 -0
  36. package/web/assets/handTracker-D_O-C4Dw.js +2 -0
  37. package/web/assets/{index-BGZJld3s.js → index-CZn97Ygs.js} +1 -1
  38. package/web/assets/layer-worker-Bar7WgOA.js +5 -0
  39. package/web/assets/library-BtBrCaFk.js +1 -0
  40. package/web/assets/{lottieLayer-BhLbZOpr.js → lottieLayer-CfUPParC.js} +4 -4
  41. package/web/assets/{lottie_light_canvas-D9fsNLID.js → lottie_light_canvas-7iv3btPX.js} +1 -1
  42. package/web/assets/main-BPmr0TOL.css +1 -0
  43. package/web/assets/{main-BNZrzSIG.js → main-M1vRa-gd.js} +32 -32
  44. package/web/assets/{mapBake-BAG6i5fI.js → mapBake-lPNhNZgv.js} +1 -1
  45. package/web/assets/maskTrack-D2jUh7aw.js +1 -0
  46. package/web/assets/matteFixRun-B7tWV9Y1.js +1 -0
  47. package/web/assets/motionBlur-uAm030t9.js +1 -0
  48. package/web/assets/{objectLocate-Dhktxe5z.js → objectLocate-BDqfSo9J.js} +1 -1
  49. package/web/assets/pendingMatte-q35zVaiB.js +2 -0
  50. package/web/assets/personAi-ZjQVo-80.js +2 -0
  51. package/web/assets/plateCamera-A2E_WO_x.js +1 -0
  52. package/web/assets/plateCameraMatch-D41LQrsm.js +2 -0
  53. package/web/assets/plateFollow-CNfi4xuP.js +2 -0
  54. package/web/assets/plateMatte-BdIxGhw5.js +2 -0
  55. package/web/assets/{pluginAutomation-DdZOnpoV.js → pluginAutomation-BtQ_w2TB.js} +1 -1
  56. package/web/assets/poseTracker-DVX__OK7.js +1 -0
  57. package/web/assets/productTools-r2RgILaA.js +2 -0
  58. package/web/assets/{remote-DXG553d8.js → remote-sTZauTqM.js} +77 -77
  59. package/web/assets/rigTrack-Bx9QHlFv.js +1 -0
  60. package/web/assets/{rotoMaskStore-DrRawyH9.js → rotoMaskStore-pxpRt5Cj.js} +1 -1
  61. package/web/assets/{rotoMatte-2EcyuvBX.js → rotoMatte-DyXlW4jK.js} +1 -1
  62. package/web/assets/rotoscope-GORCSVBr.js +1 -0
  63. package/web/assets/shot-worker-B8JWkmBz.js +1 -0
  64. package/web/assets/{shotFxAgent-CETPcjzU.js → shotFxAgent-CzHfe75S.js} +2 -2
  65. package/web/assets/{skin-BQG1Iz6Q.js → skin-BkaT2QuX.js} +1 -1
  66. package/web/assets/{spark.module-CMSPLU2n.js → spark.module-BRT8yMS4.js} +10 -10
  67. package/web/assets/spellDuel-BUy289OT.js +2 -0
  68. package/web/assets/{store-Dxq3MZF3.js → store-BSSbvpzr.js} +1 -1
  69. package/web/assets/{surfaceLight-B_OSTxcx.js → surfaceLight-CMaBhZ_d.js} +1 -1
  70. package/web/assets/surfacePin-DM9b9ubh.js +2 -0
  71. package/web/assets/textAnimators-Cihw35O8.js +1 -0
  72. package/web/assets/{thumb-xLFX6lDN.js → thumb-Cs636sYt.js} +1 -1
  73. package/web/assets/{timeline3d-DqXTKdEK.js → timeline3d-BEuZZOxM.js} +2 -2
  74. package/web/assets/{timeline3dExport-MWomW4fF.js → timeline3dExport-CmSI_pjv.js} +1 -1
  75. package/web/assets/timelineComp-CRRzLazc.js +1 -0
  76. package/web/assets/timelineProps-tN2YsMYN.js +1 -0
  77. package/web/assets/timelineText-CkoUgWcY.js +1 -0
  78. package/web/assets/{titleArt-CAOxtyHl.js → titleArt-CcTdJuOC.js} +5 -5
  79. package/web/assets/{titleFrameBudget-BjW--v_T.js → titleFrameBudget-3MFHWIT6.js} +1 -1
  80. package/web/assets/titleFrames-w-iWje9N.js +1 -0
  81. package/web/assets/{tool-DEWWeyCz.js → tool-BhIsq238.js} +1 -1
  82. package/web/assets/tools-DMUnabc_.js +1 -0
  83. package/web/assets/toonTools-CICrV3QB.js +2 -0
  84. package/web/assets/trackAnchor-D2bB5mZE.js +1 -0
  85. package/web/assets/userFonts-BZ4QL-zq.js +1 -0
  86. package/web/assets/{vfxAlpha-vbbI-03F.js → vfxAlpha-D3Dk1tfF.js} +2 -2
  87. package/web/assets/vfxBackground-CHlCg8lb.js +2 -0
  88. package/web/assets/{vfxTrack-BmxWjlDi.js → vfxTrack-CqiQDEYm.js} +1 -1
  89. package/web/assets/videoExport-l5MGvMn_.js +1 -0
  90. package/web/assets/views-BdWnG2xK.js +1 -0
  91. package/web/assets/weaponDuel-B2wTffPC.js +1 -0
  92. package/web/assets/{windowFrames-DydW5Al5.js → windowFrames-CoIyWqxr.js} +1 -1
  93. package/web/layer-worker.html +3 -3
  94. package/web/assets/FxEmbed-B5TQxKxk.js +0 -1
  95. package/web/assets/MotionEmbed-Catb_GgA.js +0 -1
  96. package/web/assets/PluginStore-8TjQawtB.js +0 -3
  97. package/web/assets/TemplateEmbed-Cao8Z5fY.js +0 -2
  98. package/web/assets/TimelineShotFx-DvmPZQXM.js +0 -2
  99. package/web/assets/TransitionEmbed-o4UxJ35e.js +0 -1
  100. package/web/assets/aerial-BPRLPci2.js +0 -2
  101. package/web/assets/agentTools-CSnN-LvS.js +0 -2
  102. package/web/assets/analyzerRun-5zJsmMS1.js +0 -1
  103. package/web/assets/auraTrack-pF-WhpH3.js +0 -1
  104. package/web/assets/breakthrough-DQN1i-Pw.js +0 -2
  105. package/web/assets/clientExport-Ca9a3Jiy.js +0 -1
  106. package/web/assets/directorTools-CvmghG_6.js +0 -1
  107. package/web/assets/editTools-CUoVvupD.js +0 -1
  108. package/web/assets/exportEncode-pFxeatJt.js +0 -1
  109. package/web/assets/exportGlb-MK05aKqH.js +0 -2
  110. package/web/assets/faceTracker-_rQOgBvX.js +0 -1
  111. package/web/assets/fightDirector-Dt60kfbV.js +0 -1
  112. package/web/assets/fightDrama-py4jxSdn.js +0 -2
  113. package/web/assets/gpuExport-Cnv2NfEb.js +0 -189
  114. package/web/assets/handMatte-DZCsuqD2.js +0 -1
  115. package/web/assets/handTracker-Btr9L-Hu.js +0 -2
  116. package/web/assets/layer-worker-Rbo-YZv-.js +0 -5
  117. package/web/assets/library-CdukL2BW.js +0 -1
  118. package/web/assets/main-By_IEoB_.css +0 -1
  119. package/web/assets/maskTrack-AZwAVz1c.js +0 -1
  120. package/web/assets/matteFixRun-wTHGiGGf.js +0 -1
  121. package/web/assets/pendingMatte-iKz2-XBZ.js +0 -2
  122. package/web/assets/personAi-BEVyjCii.js +0 -2
  123. package/web/assets/plateCamera-D_J3-X06.js +0 -1
  124. package/web/assets/plateCameraMatch-C0peOvBn.js +0 -2
  125. package/web/assets/plateFollow-BbJMVxfg.js +0 -2
  126. package/web/assets/plateMatte-u5wKpsUN.js +0 -2
  127. package/web/assets/poseTracker--VJYw-hX.js +0 -1
  128. package/web/assets/productTools-DbhbyJxx.js +0 -2
  129. package/web/assets/rigTrack-CW9_kg5j.js +0 -1
  130. package/web/assets/rotoscope-_CYT-9ry.js +0 -1
  131. package/web/assets/shot-worker-BxIzQRZh.js +0 -1
  132. package/web/assets/spellDuel-eZvRwaxi.js +0 -2
  133. package/web/assets/surfacePin-CfLBhSrm.js +0 -2
  134. package/web/assets/timelineProps-KL6XCR4Q.js +0 -1
  135. package/web/assets/timelineText-DEK2BRyU.js +0 -1
  136. package/web/assets/titleFrames-WfiLHzjf.js +0 -1
  137. package/web/assets/tools-CBfIZX8_.js +0 -1
  138. package/web/assets/toonTools-D7jucq3t.js +0 -2
  139. package/web/assets/trackAnchor-DFqKIb8a.js +0 -1
  140. package/web/assets/userFonts-txN4I-eo.js +0 -1
  141. package/web/assets/vfxBackground-C1dHlJN6.js +0 -2
  142. package/web/assets/videoExport-DiNI9GY1.js +0 -1
  143. package/web/assets/views-sH39zgjD.js +0 -1
  144. package/web/assets/weaponDuel-CEvRDeuE.js +0 -1
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-sTZauTqM.js","assets/api-BsKbf3l3.js","assets/titleFrameBudget-3MFHWIT6.js","assets/three.module-Bx43vjkH.js","assets/GLTFLoader-Dy6SrZg8.js","assets/store-BSSbvpzr.js","assets/rotoMaskStore-pxpRt5Cj.js","assets/textAnimators-Cihw35O8.js","assets/timelineComp-CRRzLazc.js","assets/rigTrack-Bx9QHlFv.js"])))=>i.map(i=>d[i]);
2
+ import{_ as G}from"./titleFrameBudget-3MFHWIT6.js";import{jf as st,iR as Q,fh as W,gD as v,dy as K,fj as B,hx as J,fu as Y,fv as R,fk as rt,jg as pt,iK as at,fw as nt,fx as dt,fn as mt,hu as ut}from"./remote-sTZauTqM.js";import{c as ct}from"./cameraPresets-B234aNzE.js";import"./api-BsKbf3l3.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-Dy6SrZg8.js";import"./store-BSSbvpzr.js";import"./rotoMaskStore-pxpRt5Cj.js";import"./textAnimators-Cihw35O8.js";import"./timelineComp-CRRzLazc.js";import"./rigTrack-Bx9QHlFv.js";const gt=s=>{let l=Math.abs(Math.floor(s))%2147483646+1;return()=>(l=l*16807%2147483647)/2147483647},z=s=>st(s)?.keys.find(l=>l.strike)?.t??.4,it={"xx-palm-shield":.22,"xx-teleport":.26,"xx-float-back":.3},L=Object.freeze({palm:{clip:"xx-palm-strike",fx:"chuong-luc",twin:"chuong-luc",kind:"path",travel:.32,power:1},twin:{clip:"xx-double-palm",fx:"cau-nang-luong",twin:"cau-nang-luong",kind:"path",travel:.5,power:2},sword:{clip:"xx-sword-command",fx:"phi-kiem",twin:"phi-kiem-vang",kind:"path",travel:.42,power:1},volley:{clip:"xx-hand-seals",fx:"van-kiem",twin:"van-kiem",kind:"path",travel:.6,power:3},wave:{clip:"xx-sleeve-sweep",fx:"tram-nguyet",twin:"tram-nguyet-tim",kind:"wave",travel:.4,power:2},spin:{clip:"xx-spin-palm",fx:"chuong-luc",twin:"chuong-luc",kind:"path",travel:.32,power:1},lightning:{clip:"xx-call-lightning",fx:"loi-kiep",twin:"loi-kiep",kind:"sky",travel:.18,power:3},palmSky:{clip:"xx-ground-seal",fx:"cu-chuong-vang",twin:"cu-chuong-tim",kind:"sky",travel:.8,power:3},dragon:{clip:"xx-sword-command",fx:"loi-long-lam",twin:"loi-long-tim",kind:"path",travel:.7,power:3}}),N=Object.freeze({shield:{clip:"xx-palm-shield",fx:"khien-nang-luong",result:"blocked"},blink:{clip:"xx-teleport",fx:"dich-chuyen",result:"evaded"},float:{clip:"xx-float-back",fx:null,result:"evaded"}}),xt=["lightning","volley","twin","wave","palmSky","dragon"];function lt({exchanges:s=5,seed:l=1,rush:j=!0}={}){const S=gt(l),u=Math.max(2,Math.min(8,Math.round(s))),a=[],c=$=>$[Math.floor(S()*$.length)];let o=2.3;const D={seals:0,until:o};let h=0,P=null;for(let $=0;$<u;$++){const q=$===u-1;if(j&&!q&&$===Math.floor(u/2)){const p=st("xx-air-dash"),_=o+p.duration-.2+z("xx-sky-slam");a.push({time:o,attacker:h,technique:"rush",clip:"xx-air-dash",then:"xx-sky-slam",thenAt:o+p.duration-.2,fx:"xung-kich",kind:"ground",travel:0,impact:_,defence:"float",defenceClip:N.float.clip,defenceAt:_-it["xx-float-back"],defenceFx:null,result:"evaded"}),o=_+1,h=1-h;continue}const w=c(q?xt:Object.keys(L).filter(p=>p!==P&&p!=="volley"&&p!=="palmSky"));P=w;const x=L[w],I=o+z(x.clip),C=I+x.travel,y=S();let M=null,b="hit";q||(y<.28&&x.kind==="path"?b="clash":(M=y<.62?"shield":y<.84?"blink":"float",b=N[M].result));const T={time:o,attacker:h,technique:w,clip:x.clip,fx:h?x.twin:x.fx,kind:x.kind,travel:x.travel,release:I,impact:C,result:b};if(M&&Object.assign(T,{defence:M,defenceClip:N[M].clip,defenceAt:C-it[N[M].clip],defenceFx:N[M].fx}),b==="clash"){const p=L[c(["palm","twin","sword"])],_=I+x.travel/2,i=_-p.travel/2;Object.assign(T,{counter:{clip:p.clip,fx:h?p.fx:p.twin,start:i-z(p.clip),release:i,travel:p.travel/2},impact:_})}a.push(T);const A=b==="blocked"||b==="evaded";o=Math.max(C,T.defenceAt!=null?T.defenceAt+.9:C)+(A?.25+S()*.25:.6+S()*.5),h=A&&S()<.7||S()<.5?1-h:h}const d=a[a.length-1];return{opening:D,beats:a,end:d.impact+1.6}}const ft=Object.freeze([{id:"phap-tuong",name:"Pháp tướng kim thân",nameEn:"Golden dharma avatar",clip:"xx-summon-avatar",role:"buff",effects:[{fx:"phap-tuong-vang",at:"start",offset:.6,place:"self",duration:4}]},{id:"linh-thuong",name:"Huyết linh thương",nameEn:"Crimson spear of light",clip:"xx-conjure-spear",role:"attack",hit:.4,effects:[{fx:"linh-thuong-do",at:"release",offset:-.6,place:"path",duration:1.4}]},{id:"kim-diem",name:"Kim diễm hộ thể",nameEn:"Golden flame aura",clip:"xx-flame-surge",role:"buff",effects:[{fx:"kim-diem",at:"release",offset:-.1,place:"self",duration:2.5}]},{id:"an-xoay",name:"Phong ấn xoay",nameEn:"Spinning seal",clip:"xx-throw-seal",role:"attack",hit:.6,effects:[{fx:"an-xoay-vang",at:"release",place:"path",duration:1.2}]},{id:"that-tinh",name:"Thất tinh phong ấn",nameEn:"Seven-star seal",clip:"xx-seven-star",role:"control",hit:.4,effects:[{fx:"that-tinh-an",at:"start",offset:.2,place:"target",duration:2}]},{id:"cu-kiem",name:"Cự kiếm khai thiên",nameEn:"Heaven-cleaving sword",clip:"xx-heaven-cleave",role:"attack",hit:.3,effects:[{fx:"cu-kiem-khai-thien",at:"release",offset:-.8,place:"self",duration:2.2}]},{id:"hu-khong-chi",name:"Hư không chỉ",nameEn:"Void-piercing finger",clip:"xx-void-finger",role:"attack",hit:.08,effects:[{fx:"chi-quang",at:"release",place:"path",duration:.9}]},{id:"long-hong",name:"Long hống",nameEn:"Dragon's roar",clip:"xx-dragon-roar",role:"attack",hit:.4,effects:[{fx:"long-hong",at:"release",place:"self",duration:1.6}]},{id:"bat-quai",name:"Bát quái chưởng",nameEn:"Bagua palm",clip:"xx-bagua-palm",role:"attack",hit:.35,effects:[{fx:"bat-quai",at:"start",place:"self",duration:2.2},{fx:"chuong-luc",at:"release",place:"path",duration:.7}]},{id:"hon-ky",name:"Chiêu hồn kỳ",nameEn:"Soul banner",clip:"xx-plant-banner",role:"buff",effects:[{fx:"hon-ky",at:"release",place:"self",duration:4}]},{id:"kiem-y-mua",name:"Kiếm ý trong mưa",nameEn:"Sword intent in the rain",clip:"xx-rain-sword-intent",role:"attack",hit:.4,effects:[{fx:"kiem-vu-lam",at:"release",place:"area",duration:2}]},{id:"lien-hoa-chuong",name:"Liên hoa chưởng",nameEn:"Lotus palm",clip:"xx-lotus-palm",role:"attack",hit:.6,effects:[{fx:"lien-hoa-tim",at:"release",place:"target",duration:2,params:{dist:0,height:1.2,size:.8}}]},{id:"loi-long",name:"Lôi long xuất hải",nameEn:"Lightning dragon",clip:"xx-dragon-call",role:"attack",hit:.7,effects:[{fx:"loi-long-lam",at:"release",place:"path",duration:1.2}]},{id:"don-quang",name:"Hoá độn quang",nameEn:"Escape light",clip:"xx-escape-light",role:"escape",effects:[{fx:"don-quang-cau-vong",at:"release",place:"ahead",ahead:6,duration:.8}]},{id:"kiem-luan-tram",name:"Kiếm luân trảm",nameEn:"Sword-halo slash",clip:"xx-halo-slash",role:"attack",hit:.45,effects:[{fx:"kiem-luan-lam",at:"start",place:"self",duration:1.6},{fx:"tram-nguyet",at:"release",place:"self",duration:1}]},{id:"thai-cuc",name:"Thái cực hoá giải",nameEn:"Taiji deflection",clip:"xx-taiji-deflect",role:"defence",effects:[{fx:"thai-cuc-trang",at:"start",place:"self",duration:1.6}]},{id:"huyet-ma",name:"Huyết ma công",nameEn:"Blood art",clip:"xx-blood-art",role:"buff",effects:[{fx:"huyet-vu",at:"start",place:"self",duration:2.4},{fx:"to-khi-do",at:"release",place:"self",duration:1.5}]},{id:"thien-quang",name:"Thỉnh thiên quang",nameEn:"Heavenly light",clip:"xx-heaven-light",role:"attack",hit:.25,effects:[{fx:"thien-quang-vang",at:"release",place:"target",duration:1.6}]},{id:"tran-ap",name:"Trấn áp chưởng",nameEn:"Suppressing palm",clip:"xx-suppress-palm",role:"attack",hit:.5,effects:[{fx:"cu-chuong-vang",at:"release",offset:-.3,place:"target",duration:1.6,params:{dist:0}}]},{id:"phu-chu",name:"Phóng phù chú",nameEn:"Talisman volley",clip:"xx-talisman-cast",role:"attack",hit:.6,effects:[{fx:"phu-chu-vang",at:"start",place:"self",duration:.6},{fx:"an-xoay-tim",at:"release",place:"path",duration:1.2}]},{id:"bang-quang-tu-luc",name:"Băng quang tụ lực",nameEn:"Ice-light charge",clip:"xx-power-burst",role:"buff",effects:[{fx:"bang-quang-tu",at:"start",offset:.1,place:"self",duration:2}]},{id:"bang-nguyet-tram",name:"Băng nguyệt trảm",nameEn:"Ice crescent slash",clip:"xx-backhand-slash",role:"attack",hit:.15,effects:[{fx:"nguyet-tram-bang",at:"release",offset:-.08,place:"self",duration:1.2},{fx:"tinh-bao-bang",at:"release",offset:.15,place:"target",duration:1.6}]},{id:"bang-thich-lan",name:"Băng thích lan",nameEn:"Ice spike surge",clip:"xx-ground-seal",role:"attack",hit:.7,effects:[{fx:"gai-bang-lan",at:"release",place:"ground",duration:2.4}]},{id:"bang-quang-phao",name:"Băng quang pháo",nameEn:"Ice-light cannon",clip:"xx-double-palm",role:"attack",hit:.2,effects:[{fx:"bang-quang-tu",at:"start",place:"self",duration:.9,params:{size:.8}},{fx:"bang-quang-phao",at:"release",place:"path",duration:1.6},{fx:"tinh-bao-bang",at:"release",offset:.2,place:"target",duration:1.6}]},{id:"hoa-bang-ho-the",name:"Hoa băng hộ thể",nameEn:"Ice flower guard",clip:"xx-palm-shield",role:"defence",effects:[{fx:"hoa-bang-ho-the",at:"release",offset:-.1,place:"self",duration:2.6}]},{id:"thien-kiem-giang",name:"Thiên kiếm giáng",nameEn:"Sky sword descends",clip:"xx-call-lightning",role:"attack",hit:.95,effects:[{fx:"thanh-truc-thien-kiem",at:"release",offset:-.6,place:"area",duration:4.5}]}]),kt=s=>ft.find(l=>l.id===s)??null,wt=Object.freeze(Object.defineProperty({__proto__:null,DEFENCES:N,TECHNIQUES:L,XIANXIA_SETS:ft,planSpellDuel:lt,releaseAt:z,xianxiaSet:kt},Symbol.toStringTag,{value:"Module"})),F=()=>crypto.randomUUID(),E=s=>Math.round(s*100)/100,Z=s=>s*Math.PI/180,ot=s=>(s.kind==="model"?(s.model?.height??2)/1.8:ut(s))*(s.scale[1]||1);function tt(s,l){const j=v(s),S=j.duration/l,u=c=>c?.map(o=>({...o,time:Math.min(1,o.time*S)})),a={...j,duration:l,cameraKeys:u(j.cameraKeys)??[],objectKeys:Object.fromEntries(Object.entries(j.objectKeys||{}).map(([c,o])=>[c,u(o)||[]])),...j.flight?{flight:Object.fromEntries(Object.entries(j.flight).map(([c,o])=>[c,u(o)||[]]))}:{}};return{...s,shots:s.shots.map(c=>c.id===j.id?a:c)}}async function At(s,l){const j=l.getStage(),S=Array.isArray(s.fighters)?s.fighters.map(String):[];if(S.length!==2)return{ok:!1,error:"give fighters: [first caster, opponent] (two person names)"};let u;try{u=S.map(t=>Q(j,t))}catch(t){return{ok:!1,error:t.message}}for(const t of u)if(!W(t))return{ok:!1,error:`'${t.name}' is not a person (or a humanoid-rigged model)`};if(u[0].id===u[1].id)return{ok:!1,error:"two different people are needed"};const a=Math.max(0,Number(s.start??0)||0),c=lt({exchanges:Number(s.exchanges??5)||5,seed:Number(s.seed)||1,rush:s.rush!==!1});try{await pt(["mc-react-fall-back"])}catch{}let o=j;const D=a+c.end;D>v(o).duration&&(o=tt(o,Math.min(300,Math.ceil(D*10)/10)));const h=v(o).duration,P=v(o),d=K(u[0],{...P,flight:void 0},a/h),$=(ot(u[0])+ot(u[1]))/2,q=Math.max(3,Math.min(14,Number(s.distance)||7))*$,w=d.rotation[1],x=[Math.sin(Z(w)),Math.cos(Z(w))],I=[d.position[0]+x[0]*q,d.position[1],d.position[2]+x[1]*q],C=(t,e,n)=>{const r=v(o),f=(r.objectKeys?.[t]||[]).filter(g=>g.time*h<a-1e-6);o={...o,shots:o.shots.map(g=>g.id===r.id?{...g,objectKeys:{...g.objectKeys,[t]:[...f,{id:F(),time:a/h,position:e.map(k=>+k.toFixed(3)),rotation:[0,+n.toFixed(1),0],scale:o.items.find(k=>k.id===t).scale}]}}:g)}};if(C(u[0].id,d.position,w),C(u[1].id,I,w+180),s.air===!0){const t=v(o),e=Math.max(1.5,Math.min(20,Number(s.height)||3));for(const n of u){let r=at(t.flight?.[n.id],{time:a/h,on:!0,height:e,ground:d.position[1]});r=at(r,{time:Math.min(1,(a+c.end-.2)/h),on:!1}),o={...o,shots:o.shots.map(f=>f.id===t.id?{...f,flight:{...f.flight,[n.id]:r}}:f)}}}const y=[{who:0,clip:"xx-hand-seals",at:0},{who:1,clip:"xx-stand-calm",at:0}];for(const t of c.beats)y.push({who:t.attacker,clip:t.clip,at:t.time}),t.then&&y.push({who:t.attacker,clip:t.then,at:t.thenAt}),t.defenceClip&&y.push({who:1-t.attacker,clip:t.defenceClip,at:t.defenceAt}),t.counter&&y.push({who:1-t.attacker,clip:t.counter.clip,at:t.counter.start});const M=c.beats[c.beats.length-1];y.push({who:1-M.attacker,clip:B("mc-react-fall-back")?"mc-react-fall-back":"fist-hit",at:M.impact}),y.sort((t,e)=>t.at-e.at);const b=[];for(const t of y){const e=B(t.clip);if(!e){b.push(`missing clip ${t.clip}`);continue}const n=J(o,u[t.who].id,e,{start:Math.max(0,a+t.at)/h,newId:F,loop:!1});n.ok?o=n.stage:b.push(`${u[t.who].name} ${t.clip}: ${n.error}`)}l.setStage(()=>o);const{runTool:T}=await G(async()=>{const{runTool:t}=await import("./remote-sTZauTqM.js").then(e=>e.jq);return{runTool:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),A=[],p=async t=>{const e=await T("add_effect",t,l);e.ok?A.push(String(t.effect)):b.push(`${String(t.effect)}: ${String(e.error)}`)},_=t=>u[t].name;if(s.vfx!==!1){await p({effect:["hao-quang-lam","hao-quang-tim"][0],attach_to:_(0),start:a+.1,duration:c.opening.until,intensity:.55}),await p({effect:"phap-tran",attach_to:_(0),start:a+.3,duration:c.opening.until,intensity:.5}),s.ambience!==!1&&await p({effect:"dom-linh-vang",at:[(d.position[0]+I[0])/2,1.2,(d.position[2]+I[2])/2],start:a,duration:c.end,intensity:.5});for(const e of c.beats){const n=_(e.attacker),r=_(1-e.attacker),f=a+(e.release??e.time);if(e.kind==="path"?await p({effect:e.fx,from:`${n}.hand_right`,to:`${r}.chest`,start:f,duration:(e.counter?e.travel/2+.05:e.travel)+.3,intensity:.75}):e.kind==="sky"?await p(e.fx.startsWith("cu-chuong")?{effect:e.fx,attach_to:r,start:f,duration:e.travel+.6,intensity:.7,params:{dist:0,fall:e.travel}}:{effect:e.fx,from:`${n}.hand_right`,to:`${r}.chest`,start:a+e.impact-.12,duration:.6,intensity:.6}):e.kind==="wave"?await p({effect:e.fx,attach_to:n,start:f,duration:e.travel+.5,intensity:.7}):e.kind==="ground"&&(await p({effect:"xung-kich",attach_to:n,start:a+e.impact,duration:.7,intensity:.45}),await p({effect:"mat-dat-vo",attach_to:n,start:a+e.impact,duration:1.2,intensity:.5})),e.technique==="rush"&&await p({effect:"luot-chem-loi",attach_to:n,start:a+e.time+.1,duration:.6,intensity:.6}),e.defenceFx&&await p({effect:e.defenceFx,attach_to:r,start:a+e.defenceAt,duration:.7,intensity:.6}),e.result==="blocked"&&await p({effect:"vong-xung-kich",attach_to:r,start:a+e.impact,duration:.35,intensity:.4}),e.counter){await p({effect:e.counter.fx,from:`${r}.hand_right`,to:`${n}.chest`,start:a+e.counter.release,duration:e.counter.travel+.25,intensity:.75});const g=v(l.getStage()),k=K(u[0],g,(a+e.impact)/g.duration).position,H=K(u[1],g,(a+e.impact)/g.duration).position;await p({effect:"vong-xung-kich",at:[(k[0]+H[0])/2,(k[1]+H[1])/2+1.3*$,(k[2]+H[2])/2],start:a+e.impact,duration:.6,intensity:.65})}e.result==="hit"&&await p({effect:"hoa-loi",attach_to:r,start:a+e.impact,duration:.6,intensity:.5})}}if(s.timing!==!1){const t=v(l.getStage());let e=rt(t.timing,t.duration);e=Y(e,c.beats.filter(n=>n.result==="blocked"||n.result==="clash").map(n=>a+n.impact),R.light,t.duration),e=Y(e,[a+M.impact],R.heavy,t.duration);for(const n of c.beats.filter(r=>r.result==="clash"))e=nt(e,a+n.impact,.25,.4,t.duration);e=nt(e,a+M.impact-.05,.3,.3,t.duration),l.setStage(n=>({...n,shots:n.shots.map(r=>r.id===t.id?{...r,timing:e??void 0}:r)}))}let i=null;if(s.camera!==!1&&s.director_camera!==!1){const t=[["orbit-180",0,a,a+c.opening.until]];c.beats.forEach((n,r)=>{const f=c.beats[r+1],g=a+(n.release??n.thenAt??n.time),k=f?a+f.time:a+c.end;t.push(["low-hero",n.attacker,a+n.time,Math.max(a+n.time+.3,g-.05)]),t.push([f?"wide-track":"crash-zoom",f?n.attacker:1-n.attacker,Math.max(a+n.time+.3,g-.05),k])});const e=[];for(const[n,r,f,g]of t){if(g-f<.25)continue;const k=ct(l.getStage(),{preset:n,subject:u[r].id,start:f,end:g});k.ok&&(l.setStage(()=>k.stage),e.push(`${n} ${E(f)}–${E(g)} s on ${u[r].name}`))}i={director:e}}else if(s.camera!==!1)try{const t=dt(l.getStage(),{fighters:S,start:a,end:a+c.end,focal_length_mm:Number(s.focal_length_mm)||28});l.setStage(()=>t.stage),i=t.result}catch(t){i={error:t.message}}const m=v(l.getStage());return{ok:!0,fighters:S,distance_m:E(q),opening_until_s:E(a+c.opening.until),exchange:c.beats.map(t=>({time_s:E(a+t.time),caster:_(t.attacker),technique:t.technique,impact_s:E(a+t.impact),result:t.result,...t.defence?{defence:t.defence}:{}})),effects:A.length,shot_s:m.duration,video_s:E(mt(m)),...b.length?{notes:b.slice(0,12)}:{},...i?{camera:i}:{},hint:"tune any effect with update_effect (colour, size); camera_preset for wide-track / low-hero shots; set_character for robes and hair"}}async function It(s,l){const{xianxiaSet:j,releaseAt:S,XIANXIA_SETS:u}=await G(async()=>{const{xianxiaSet:i,releaseAt:m,XIANXIA_SETS:t}=await Promise.resolve().then(()=>wt);return{xianxiaSet:i,releaseAt:m,XIANXIA_SETS:t}},void 0),a=j(String(s.technique??""));if(!a)return{ok:!1,error:`unknown technique; use one of ${u.map(i=>i.id).join(", ")}`};const c=l.getStage();let o;try{o=Q(c,String(s.name??""))}catch(i){return{ok:!1,error:i.message}}if(!W(o))return{ok:!1,error:`'${o.name}' is not a person`};const D=v(c),h=Math.max(0,Number(s.time??0)||0),P=Math.min(1,h/D.duration);let d=null;if(s.target!=null)try{d=Q(c,String(s.target))}catch(i){return{ok:!1,error:i.message}}else{const i=K(o,D,P).position;d=c.items.filter(m=>m.id!==o.id&&W(m)&&!m.hidden).map(m=>{const t=K(m,D,P).position;return{i:m,d:Math.hypot(t[0]-i[0],t[2]-i[2])}}).sort((m,t)=>m.d-t.d)[0]?.i??null}const $=a.effects.some(i=>i.place==="target"||i.place==="path"||i.place==="area"||i.place==="ground");if($&&!d)return{ok:!1,error:`${a.name} needs a target (another person in the scene, or give target)`};const q=B(a.clip);if(!q)return{ok:!1,error:`the clip ${a.clip} is missing`};let w=c;q.duration+h>D.duration&&(w=tt(w,Math.min(300,Math.ceil((h+q.duration+.5)*10)/10)));const x=v(w).duration;if(d){const i=v(w),m=K(o,{...i,flight:void 0},Math.min(1,h/x)),t=K(d,i,Math.min(1,h/x)).position,e=Math.atan2(t[0]-m.position[0],t[2]-m.position[2])*180/Math.PI,n=(i.objectKeys?.[o.id]||[]).filter(r=>r.time*x<h-1e-6);w={...w,shots:w.shots.map(r=>r.id===i.id?{...r,objectKeys:{...r.objectKeys,[o.id]:[...n,{id:F(),time:h/x,position:m.position.map(f=>+f.toFixed(3)),rotation:[0,+e.toFixed(1),0],scale:o.scale}]}}:r)}}const I=J(w,o.id,q,{start:h/x,newId:F,loop:!1});if(!I.ok)return{ok:!1,error:I.error};l.setStage(()=>I.stage);const{runTool:C}=await G(async()=>{const{runTool:i}=await import("./remote-sTZauTqM.js").then(m=>m.jq);return{runTool:i}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),y=h+S(a.clip),M=[],b=[];for(const i of a.effects){const m=Math.max(0,(i.at==="release"?y:h)+(i.offset??0)),t={effect:i.fx,start:m,duration:i.duration,...i.params?{params:i.params}:{},...s.color?{color:s.color}:{}};let e;if(i.place==="self")e={...t,attach_to:o.name};else if(i.place==="target")e={...t,attach_to:d.name};else if(i.place==="path")e={...t,from:`${o.name}.hand_right`,to:`${d.name}.chest`};else if(i.place==="ground")e={...t,from:`${o.name}.feet`,to:`${d.name}.feet`};else if(i.place==="area"){const r=v(l.getStage()),f=K(d,r,Math.min(1,m/r.duration)).position;e={...t,at:[f[0],0,f[2]]}}else{const r=v(l.getStage()),f=K(o,r,Math.min(1,m/r.duration)),g=Z(f.rotation[1]),k=i.ahead??6;e={...t,from:`${o.name}.chest`,to:[f.position[0]+Math.sin(g)*k,f.position[1]+1.2,f.position[2]+Math.cos(g)*k]}}const n=await C("add_effect",e,l);n.ok?M.push({effect:i.fx,start_s:E(m)}):b.push(`${i.fx}: ${String(n.error)}`)}const T=y+(a.hit??.4),A=String(s.react??"hit");let p=null;if(d&&(a.role==="attack"||a.role==="control")&&A!=="none"){const i=A==="block"?"xx-palm-shield":A==="evade"?"xx-teleport":a.role==="control"?"xx-kneel-wounded":"xx-knocked-flying",m=A==="block"?.22:A==="evade"?.26:0,t=Math.max(0,T-m),e=B(i);if(e){let n=l.getStage();const r=v(n),f=r.duration,g=K(d,{...r,flight:void 0},Math.min(1,t/f)),k=K(o,r,Math.min(1,t/f)).position,H=Math.atan2(k[0]-g.position[0],k[2]-g.position[2])*180/Math.PI,ht=(r.objectKeys?.[d.id]||[]).filter(O=>O.time*f<t-1e-6);n={...n,shots:n.shots.map(O=>O.id===r.id?{...O,objectKeys:{...O.objectKeys,[d.id]:[...ht,{id:F(),time:t/f,position:g.position.map(V=>+V.toFixed(3)),rotation:[0,+H.toFixed(1),0],scale:d.scale}]}}:O)},t+e.duration>f&&(n=tt(n,Math.min(300,Math.ceil((t+e.duration+.3)*10)/10)));const X=J(n,d.id,e,{start:t/v(n).duration,newId:F,loop:!1});if(X.ok){if(l.setStage(()=>X.stage),p={motion:i,at_s:E(t)},A==="hit"&&s.timing!==!1){const O=v(l.getStage()),V=Y(rt(O.timing,O.duration),[T],a.role==="control"?R.light:R.medium,O.duration);l.setStage(et=>({...et,shots:et.shots.map(U=>U.id===O.id?{...U,timing:V??void 0}:U)}))}}else b.push(`${d.name} ${i}: ${X.error}`)}}const _=[];if(s.camera===!0){const i=[["low-hero",o,h,Math.max(h+.4,y)]];d&&$&&i.push(["wide-track",d,Math.max(h+.4,y),T+1]);for(const[m,t,e,n]of i){const r=ct(l.getStage(),{preset:m,subject:t.id,start:e,end:n});r.ok&&(l.setStage(()=>r.stage),_.push(`${m} ${E(e)}–${E(n)} s`))}}return{ok:!0,technique:a.id,name:a.name,role:a.role,caster:o.name,...d?{target:d.name}:{},start_s:E(h),release_s:E(y),impact_s:E(T),end_s:E(h+q.duration),effects:M,...p?{reaction:p}:{},..._.length?{camera:_}:{},...b.length?{notes:b}:{}}}export{It as castTechnique,At as stageSpellDuel};
@@ -1 +1 @@
1
- import{d5 as A,ea as O,fu as w,ec as b,k as K,n0 as N}from"./titleFrameBudget-BjW--v_T.js";import{R as y}from"./api-C5pOWyBM.js";const E=n=>{let i;const e=new Set,t=(s,m)=>{const c=typeof s=="function"?s(i):s;if(!Object.is(c,i)){const d=i;i=m??(typeof c!="object"||c===null)?c:Object.assign({},i,c),e.forEach(h=>h(i,d))}},o=()=>i,l={setState:t,getState:o,getInitialState:()=>u,subscribe:s=>(e.add(s),()=>e.delete(s))},u=i=n(t,o,l);return l},U=(n=>n?E(n):E),D=n=>n;function F(n,i=D){const e=y.useSyncExternalStore(n.subscribe,y.useCallback(()=>i(n.getState()),[n,i]),y.useCallback(()=>i(n.getInitialState()),[n,i]));return y.useDebugValue(e),e}const C=n=>{const i=U(n),e=t=>F(i,t);return Object.assign(e,i),e},V=(n=>n?C(n):C),S=Object.freeze(["x","y","zoom","sx","sy","rot","opacity","depth","tiltX","tiltY","trimStart","trimEnd","reveal"]),f=Object.freeze({links:8,factor:100,offset:1e4,delay:30,chain:12}),k=n=>Math.round(n*1e4)/1e4,M=(n,i)=>Math.max(w[n].min,Math.min(w[n].max,i));function _(n,i){if(!Array.isArray(n)||n.length>f.links)throw Error(`Links: at most ${f.links}`);const e=new Set;return n.map(t=>{if(!t||typeof t!="object")throw Error("Invalid link");const o=t.fromProp??t.prop;if(!S.includes(t.prop)||!S.includes(o))throw Error(`Link property must be one of ${S.join(", ")}`);if(typeof t.from!="string"||!t.from||t.from===i)throw Error("A link needs another layer (from)");if(e.has(t.prop))throw Error(`Property "${t.prop}" is linked twice`);e.add(t.prop);const r={prop:t.prop,from:t.from};o!==t.prop&&(r.fromProp=o);for(const[a,l]of[["factor",f.factor],["offset",f.offset],["delay",f.delay]])if(t[a]!==void 0){if(!Number.isFinite(t[a])||Math.abs(t[a])>l||a==="delay"&&t[a]<0)throw Error(`Invalid link ${a}`);t[a]!==(a==="factor"?1:0)&&(r[a]=k(t[a]))}if(t.add!==void 0){if(typeof t.add!="boolean")throw Error("Invalid link add");t.add&&(r.add=!0)}return r})}function x(n,i,e){const t=e.fromProp??e.prop,o=e.factor??1,r=e.offset??0,a=i.start+(e.delay??0)-n.start,l=O(i,t),u=w[e.prop].base(n),s=l.length?l[0].value:b(i,t,0),m=e.add?p=>k(M(e.prop,u+(p-s)*o+r)):p=>k(M(e.prop,p*o+r));if(!l.length)return[{time:0,value:m(b(i,t,0))}];const c=l.map(p=>({...p,time:k(p.time+a),value:m(p.value)})),d=c.filter(p=>p.time>=0&&p.time<=n.duration+1e-6),h=c.filter(p=>p.time<0);if(h.length){const p=m(b(i,t,-a));(!d.length||d[0].time>1e-6)&&d.unshift({...h.at(-1),time:0,value:p})}return d.length?d.map(({time:p,value:L,ease:I})=>({time:p,value:L,...I!==void 0?{ease:I}:{}})):[{time:0,value:m(b(i,t,Math.max(0,Math.min(i.duration,n.duration-a))))}]}function j(n,i,e){if(!e||!e.length)return{links:void 0};const t=_(e,i.id),o=new Map(n.map(l=>[l.id,l]));for(const l of t){if(!o.get(l.from))throw Error(`Link source "${l.from}" not found`);if(P(n,i.id,l.from))throw Error("Links would loop")}let r={...i,links:t},a={links:t};for(const l of t){const u=A(r,l.prop,x(r,o.get(l.from),l));r={...r,...u},a={...a,...u}}return a}function P(n,i,e){const t=new Map(n.map(a=>[a.id,a])),o=[e],r=new Set;for(;o.length;){const a=o.pop();if(a===i)return!0;if(!(r.has(a)||r.size>200)){r.add(a);for(const l of t.get(a)?.links??[])o.push(l.from)}}return!1}function G(n){if(!n.some(a=>a.links?.length))return n;const i=new Map(n.map(a=>[a.id,a])),e=new Map,t=[],o=(a,l=0)=>{if(!(e.has(a.id)||l>f.chain)){e.set(a.id,!0);for(const u of a.links??[]){const s=i.get(u.from);s&&o(s,l+1)}t.push(a)}};for(const a of n)a.links?.length&&o(a);let r=!1;for(const a of t){if(!a.links?.length)continue;const l=i.get(a.id),u=l.links.filter(m=>i.has(m.from)&&!P([...i.values()],l.id,m.from));let s={...l,...u.length?{links:u}:{links:void 0}};for(const m of u)s={...s,...A(s,m.prop,x(s,i.get(m.from),m))};JSON.stringify(s)!==JSON.stringify(l)&&(i.set(a.id,s),r=!0)}return r?n.map(a=>i.get(a.id)):n}function Y(n,i,e,t=["x","y","rot"],o=.08){if(!Array.isArray(e)||!e.length||e.length>f.chain)throw Error(`Follow chain: 1–${f.chain} layers`);if(!Number.isFinite(o)||o<0||o>2)throw Error("Follow chain delay: 0–2 s");const r=new Map(n.map(s=>[s.id,s])),a={};let l=i,u=[...n];for(const s of e){const m=r.get(s);if(!m||s===l)throw Error(`Layer "${s}" not found`);const c=(m.links??[]).filter(h=>!t.includes(h.prop)),d=j(u,m,[...c,...t.map(h=>({prop:h,from:l,delay:o,add:!0}))]);a[s]=d,u=u.map(h=>h.id===s?{...h,...d}:h),l=s}return a}const Q={image:["16:9","9:16","1:1","4:3","3:4","3:2","2:3","4:5","5:4","21:9","9:21","2:1","1:2"],video:["Adaptive","16:9","9:16","1:1","4:3","3:4","21:9"],audio:[],world:[],model:[]},W={image:["1K","2K","4K"],video:["720p","1080p"],audio:[],world:[],model:[]},X=["Low","Medium","High"],$={min:3,max:30,default:5},ee={min:10,max:120},T={image:"muapi:nano-banana-2",video:"kling:3.0-turbo",audio:"muapi:minimax-music",world:"worldlabs:marble-1.1",model:"muapi:tripo-h31-text-3d"},te=[{id:"arri-alexa",label:"ARRI Alexa 35",hint:"cinematic, soft highlight roll-off"},{id:"red-8k",label:"Modular 8K Digital",hint:"ultra sharp, high dynamic range"},{id:"film-35",label:"35mm Film",hint:"film grain, warm halation"},{id:"tilt-lens",label:"Creative Tilt Lens",hint:"tilt-shift miniature focus"},{id:"anamorphic",label:"Anamorphic",hint:"oval bokeh, horizontal flares"},{id:"macro",label:"Macro 100mm",hint:"extreme close-up detail"},{id:"wide-24",label:"Wide 24mm",hint:"expansive, slight distortion"},{id:"tele-85",label:"Portrait 85mm",hint:"compressed background, creamy bokeh"}],ne=[{id:"script",label:"Viết kịch bản",prompt:"Giúp tôi viết kịch bản video ngắn. Ý tưởng/yêu cầu: [chủ đề, sản phẩm, khán giả, thời lượng]"},{id:"product-ad",label:"Quảng cáo sản phẩm",prompt:"Giúp tôi làm video quảng cáo sản phẩm. Thông tin sản phẩm: [tên, USP, khách hàng mục tiêu]"},{id:"ugc",label:"UGC review",prompt:"Tạo video UGC tự nhiên, chân thật, nêu bật lợi ích chính của sản phẩm. Sản phẩm: [...]"},{id:"batch",label:"Tạo hàng loạt",prompt:"Giúp tôi tạo một bộ video hàng loạt. Yêu cầu hoặc tư liệu: [chủ đề, số lượng, biến thể]"},{id:"micro-film",label:"Phim ngắn AI",prompt:"Tạo phim ngắn AI với hook cuốn hút, hình ảnh điện ảnh, xung đột cảm xúc và kết thúc đáng nhớ. Ý tưởng: [...]"},{id:"microdrama",label:"Microdrama",prompt:"Tạo microdrama nhịp nhanh với hook ngay lập tức, xung đột nhân vật mạnh và twist cảm xúc. Ý tưởng: [...]"},{id:"launch",label:"Ra mắt sản phẩm",prompt:"Tạo video ra mắt sản phẩm với mở đầu mạnh, làm nổi bật tính năng và kêu gọi hành động. Sản phẩm: [...]"},{id:"explainer",label:"Video giải thích",prompt:"Tạo video giải thích rõ ràng, giới thiệu chủ đề và chia nhỏ ý chính từng bước. Chủ đề: [...]"},{id:"social-ad",label:"Ads mạng xã hội",prompt:"Tạo quảng cáo dọc 15 giây với hook đậm trong 2 giây đầu, nhịp nhanh. Sản phẩm: [...]"},{id:"brand-story",label:"Câu chuyện thương hiệu",prompt:"Tạo video ngắn kể câu chuyện thương hiệu: chúng tôi là ai, giải quyết vấn đề gì, vì sao khách hàng chọn. Thương hiệu: [...]"},{id:"livestream",label:"Teaser livestream",prompt:"Tạo teaser 10 giây cho buổi livestream bán hàng. Sản phẩm/ưu đãi: [...]"},{id:"wedding",label:"Highlight đám cưới",prompt:"Tạo video highlight đám cưới cảm xúc từ các ảnh tham chiếu. Phong cách: [...]"},{id:"character",label:"Thiết kế nhân vật",prompt:"Thiết kế character sheet nhất quán (mặt trước, nghiêng, sau, biểu cảm) cho nhân vật: [...]"},{id:"poster",label:"Thiết kế poster",prompt:"Thiết kế poster nổi bật với hệ thống phân cấp rõ, tiêu đề cuốn hút. Nội dung: [...]"},{id:"thumbnail",label:"Thumbnail video",prompt:"Thiết kế thumbnail video có điểm nhấn rõ, chữ đậm dễ đọc, tương phản mạnh. Chủ đề: [...]"},{id:"music",label:"Thiết kế nhạc",prompt:"Thiết kế nhạc nền cho video, hợp mood, nhịp và các điểm chuyển cảnh. Mô tả video: [...]"}],oe=[{group:"Cơ bản",items:[["Xoá","⌫"],["Undo","⌘ Z"],["Redo","⇧ ⌘ Z"],["Copy","⌘ C"],["Paste","⌘ V"],["Duplicate","⌘ D"],["Multi-select","⇧ + click"]]},{group:"Di chuyển",items:[["Pan","Space + kéo"],["Pan","Chuột giữa / cuộn"]]},{group:"Zoom",items:[["Zoom in","⌘ +"],["Zoom out","⌘ −"],["Zoom","⌘ + cuộn"],["Fit to screen","⇧ 1"],["Zoom to selection","⇧ 2"]]},{group:"Khác",items:[["Select tool","V"],["Hand tool","H"],["Duplicate node","⌥ + kéo"],["Canvas Agent","/"],["Phím tắt","?"]]}],R="clipoox.settings",g=(n=null,i=null)=>({generator:n,resolution:i}),v={lineage:"selected",agent:{image:g("openai:gpt-image","1K"),omni:g("muapi:seedance-2.5","480p"),frames:g("muapi:seedance-2.5","480p"),music:T.audio},user:{image:g(T.image,"1K"),video:g(T.video,"480p")}};function q(){try{const n=localStorage.getItem(R);if(!n)return v;const i=JSON.parse(n);return{lineage:["none","selected","all"].includes(i.lineage)?i.lineage:v.lineage,agent:{...v.agent,...i.agent||{}},user:{...v.user,...i.user||{}}}}catch{return v}}function Z(n){try{localStorage.setItem(R,JSON.stringify(n))}catch{}}const H={open:!1,mode:"video",refs:[],prompt:"",generator:null,resolution:"720p",quality:"Medium",duration:$.default,aspectRatio:"Adaptive",count:1,instrumental:!1,lyrics:"",transparent:!1,complexity:"",videoMode:"omni",draft:!1,camera:null,camerawork:null,palette:null,lighting:null,camBody:null,camLens:null,focal:null,aperture:null,looks:{},paletteColors:[],tempo:null,pose:null,anchor:null,targetId:null};let z=1;const ie=V((n,i)=>({user:void 0,wallet:null,setUser:e=>n({user:e}),setWallet:e=>n({wallet:e}),canvasId:null,title:"",saveState:"idle",saveError:null,saveRetry:0,retrySave:()=>n(e=>({saveRetry:e.saveRetry+1})),view:"canvas",tool:"select",generators:[],setCanvasMeta:e=>n(e),setView:e=>n({view:e}),setTool:e=>n({tool:e}),setGenerators:e=>n({generators:e}),past:[],future:[],pushHistory:e=>n(t=>({past:[...t.past.slice(-49),e],future:[]})),popUndo:e=>{const{past:t,future:o}=i();if(!t.length)return null;const r=t[t.length-1];return n({past:t.slice(0,-1),future:[e,...o].slice(0,50)}),r},popRedo:e=>{const{past:t,future:o}=i();if(!o.length)return null;const r=o[0];return n({future:o.slice(1),past:[...t,e].slice(-50)}),r},composer:H,openComposer:(e={})=>n(t=>{const o=e.mode||t.composer.mode,r=t.generators.filter(c=>c.kind===o&&!c.tool),a=o==="image"?t.settings.user.image:o==="video"?t.settings.user.video:null,l=e.generator||(t.composer.mode===o&&t.composer.generator&&r.some(c=>c.name===t.composer.generator&&c.available)?t.composer.generator:null)||a?.generator&&r.find(c=>c.name===a.generator&&c.available)?.name||r.find(c=>c.name===T[o]&&c.available)?.name||r.find(c=>c.available)?.name||r[0]?.name||null,u=e.resolution||(t.composer.mode===o&&t.composer.generator?t.composer.resolution:null)||a?.resolution||(o==="image"?"1K":"720p"),s=e.aspectRatio||(o==="image"?"16:9":"Adaptive"),m=o==="world"||o==="model"?1:e.count??t.composer.count;return{composer:{...t.composer,...e,open:!0,mode:o,generator:l,resolution:u,aspectRatio:s,count:m,targetId:e.targetId??null,anchor:e.anchor??null,draft:e.draft??!1}}}),closeComposer:()=>n(e=>({composer:{...e.composer,open:!1}})),patchComposer:e=>n(t=>({composer:{...t.composer,...e}})),toggleRef:e=>n(t=>{const o=t.composer.refs.includes(e)?t.composer.refs.filter(r=>r!==e):[...t.composer.refs,e];return{composer:{...t.composer,refs:o}}}),panels:{agent:!1,history:!1,assets:!1,shortcuts:!1,settings:!1,minimap:!1,lineage:!1,snapping:!0,chatgpt:!1},settings:q(),setSettings:e=>n(t=>{const o=typeof e=="function"?e(t.settings):{...t.settings,...e};return Z(o),{settings:o}}),togglePanel:(e,t)=>n(o=>({panels:{...o.panels,[e]:t??!o.panels[e]}})),clipEdit:{open:!1,nodeId:null,tool:"edit"},openClipEdit:(e,t="edit")=>n(o=>({clipEdit:{open:!0,nodeId:e,tool:t},composer:{...o.composer,open:!1}})),closeClipEdit:()=>n(e=>({clipEdit:{...e.clipEdit,open:!1}})),selected:[],setSelected:e=>n({selected:e}),contextMenu:null,setContextMenu:e=>n({contextMenu:e}),agent:{messages:[],busy:!1,model:(()=>{try{return localStorage.getItem("clipoox.agent.model")}catch{return null}})(),models:[],provider:null},pushAgentMessage:e=>n(t=>({agent:{...t.agent,messages:[...t.agent.messages,e]}})),setAgentBusy:e=>n(t=>({agent:{...t.agent,busy:e}})),setAgentModel:e=>{try{e&&localStorage.setItem("clipoox.agent.model",e)}catch{}n(t=>({agent:{...t.agent,model:e}}))},setAgentModels:(e,t,o)=>n(r=>({agent:{...r.agent,models:e,provider:t,model:r.agent.model&&e.includes(r.agent.model)?r.agent.model:o}})),clearAgent:()=>n(e=>({agent:{...e.agent,messages:[]}})),timelineTracks:{},setTimelineTracks:e=>n({timelineTracks:e}),timelineFormat:{...K},setTimelineFormat:e=>n({timelineFormat:e}),timelineCamera:null,timelineLook:null,setTimelineLook:e=>n({timelineLook:e}),timelinePalette:[],setTimelinePalette:e=>n({timelinePalette:e}),timelineBrand:null,setTimelineBrand:e=>n({timelineBrand:e}),timelineMotion:null,setTimelineMotion:e=>n({timelineMotion:e}),timelinePins:[],setTimelinePins:e=>n(t=>({timelinePins:typeof e=="function"?e(t.timelinePins):e})),timelineVideoType:null,setTimelineVideoType:e=>n({timelineVideoType:e}),timelineExportRange:null,setTimelineExportRange:e=>n({timelineExportRange:e}),timelineComments:[],setTimelineComments:e=>n(t=>({timelineComments:typeof e=="function"?e(t.timelineComments):e})),setTimelineCamera:e=>n({timelineCamera:e}),timelineMedia:[],setTimelineMedia:e=>n(t=>({timelineMedia:typeof e=="function"?e(t.timelineMedia):e})),clips:[],timelineCompPath:[],setClips:e=>n(t=>({clips:N(t.clips,G(typeof e=="function"?e(t.clips):e),t.timelineTracks)})),toasts:[],toast:(e,t="info")=>{const o=z++;n(r=>({toasts:[...r.toasts,{id:o,text:e,kind:t}]})),setTimeout(()=>i().dismissToast(o),t==="error"?6e3:3200)},dismissToast:e=>n(t=>({toasts:t.toasts.filter(o=>o.id!==e)}))}));export{ee as A,te as C,v as D,S as L,X as Q,W as R,ne as S,$ as V,Q as a,oe as b,V as c,Y as f,G as r,j as s,ie as u};
1
+ import{d5 as A,ea as O,fu as w,ec as b,k as K,n0 as N}from"./titleFrameBudget-3MFHWIT6.js";import{R as y}from"./api-BsKbf3l3.js";const E=n=>{let i;const e=new Set,t=(s,m)=>{const c=typeof s=="function"?s(i):s;if(!Object.is(c,i)){const d=i;i=m??(typeof c!="object"||c===null)?c:Object.assign({},i,c),e.forEach(h=>h(i,d))}},o=()=>i,l={setState:t,getState:o,getInitialState:()=>u,subscribe:s=>(e.add(s),()=>e.delete(s))},u=i=n(t,o,l);return l},U=(n=>n?E(n):E),D=n=>n;function F(n,i=D){const e=y.useSyncExternalStore(n.subscribe,y.useCallback(()=>i(n.getState()),[n,i]),y.useCallback(()=>i(n.getInitialState()),[n,i]));return y.useDebugValue(e),e}const C=n=>{const i=U(n),e=t=>F(i,t);return Object.assign(e,i),e},V=(n=>n?C(n):C),S=Object.freeze(["x","y","zoom","sx","sy","rot","opacity","depth","tiltX","tiltY","trimStart","trimEnd","reveal"]),f=Object.freeze({links:8,factor:100,offset:1e4,delay:30,chain:12}),k=n=>Math.round(n*1e4)/1e4,M=(n,i)=>Math.max(w[n].min,Math.min(w[n].max,i));function _(n,i){if(!Array.isArray(n)||n.length>f.links)throw Error(`Links: at most ${f.links}`);const e=new Set;return n.map(t=>{if(!t||typeof t!="object")throw Error("Invalid link");const o=t.fromProp??t.prop;if(!S.includes(t.prop)||!S.includes(o))throw Error(`Link property must be one of ${S.join(", ")}`);if(typeof t.from!="string"||!t.from||t.from===i)throw Error("A link needs another layer (from)");if(e.has(t.prop))throw Error(`Property "${t.prop}" is linked twice`);e.add(t.prop);const r={prop:t.prop,from:t.from};o!==t.prop&&(r.fromProp=o);for(const[a,l]of[["factor",f.factor],["offset",f.offset],["delay",f.delay]])if(t[a]!==void 0){if(!Number.isFinite(t[a])||Math.abs(t[a])>l||a==="delay"&&t[a]<0)throw Error(`Invalid link ${a}`);t[a]!==(a==="factor"?1:0)&&(r[a]=k(t[a]))}if(t.add!==void 0){if(typeof t.add!="boolean")throw Error("Invalid link add");t.add&&(r.add=!0)}return r})}function x(n,i,e){const t=e.fromProp??e.prop,o=e.factor??1,r=e.offset??0,a=i.start+(e.delay??0)-n.start,l=O(i,t),u=w[e.prop].base(n),s=l.length?l[0].value:b(i,t,0),m=e.add?p=>k(M(e.prop,u+(p-s)*o+r)):p=>k(M(e.prop,p*o+r));if(!l.length)return[{time:0,value:m(b(i,t,0))}];const c=l.map(p=>({...p,time:k(p.time+a),value:m(p.value)})),d=c.filter(p=>p.time>=0&&p.time<=n.duration+1e-6),h=c.filter(p=>p.time<0);if(h.length){const p=m(b(i,t,-a));(!d.length||d[0].time>1e-6)&&d.unshift({...h.at(-1),time:0,value:p})}return d.length?d.map(({time:p,value:L,ease:I})=>({time:p,value:L,...I!==void 0?{ease:I}:{}})):[{time:0,value:m(b(i,t,Math.max(0,Math.min(i.duration,n.duration-a))))}]}function j(n,i,e){if(!e||!e.length)return{links:void 0};const t=_(e,i.id),o=new Map(n.map(l=>[l.id,l]));for(const l of t){if(!o.get(l.from))throw Error(`Link source "${l.from}" not found`);if(P(n,i.id,l.from))throw Error("Links would loop")}let r={...i,links:t},a={links:t};for(const l of t){const u=A(r,l.prop,x(r,o.get(l.from),l));r={...r,...u},a={...a,...u}}return a}function P(n,i,e){const t=new Map(n.map(a=>[a.id,a])),o=[e],r=new Set;for(;o.length;){const a=o.pop();if(a===i)return!0;if(!(r.has(a)||r.size>200)){r.add(a);for(const l of t.get(a)?.links??[])o.push(l.from)}}return!1}function G(n){if(!n.some(a=>a.links?.length))return n;const i=new Map(n.map(a=>[a.id,a])),e=new Map,t=[],o=(a,l=0)=>{if(!(e.has(a.id)||l>f.chain)){e.set(a.id,!0);for(const u of a.links??[]){const s=i.get(u.from);s&&o(s,l+1)}t.push(a)}};for(const a of n)a.links?.length&&o(a);let r=!1;for(const a of t){if(!a.links?.length)continue;const l=i.get(a.id),u=l.links.filter(m=>i.has(m.from)&&!P([...i.values()],l.id,m.from));let s={...l,...u.length?{links:u}:{links:void 0}};for(const m of u)s={...s,...A(s,m.prop,x(s,i.get(m.from),m))};JSON.stringify(s)!==JSON.stringify(l)&&(i.set(a.id,s),r=!0)}return r?n.map(a=>i.get(a.id)):n}function Y(n,i,e,t=["x","y","rot"],o=.08){if(!Array.isArray(e)||!e.length||e.length>f.chain)throw Error(`Follow chain: 1–${f.chain} layers`);if(!Number.isFinite(o)||o<0||o>2)throw Error("Follow chain delay: 0–2 s");const r=new Map(n.map(s=>[s.id,s])),a={};let l=i,u=[...n];for(const s of e){const m=r.get(s);if(!m||s===l)throw Error(`Layer "${s}" not found`);const c=(m.links??[]).filter(h=>!t.includes(h.prop)),d=j(u,m,[...c,...t.map(h=>({prop:h,from:l,delay:o,add:!0}))]);a[s]=d,u=u.map(h=>h.id===s?{...h,...d}:h),l=s}return a}const Q={image:["16:9","9:16","1:1","4:3","3:4","3:2","2:3","4:5","5:4","21:9","9:21","2:1","1:2"],video:["Adaptive","16:9","9:16","1:1","4:3","3:4","21:9"],audio:[],world:[],model:[]},W={image:["1K","2K","4K"],video:["720p","1080p"],audio:[],world:[],model:[]},X=["Low","Medium","High"],$={min:3,max:30,default:5},ee={min:10,max:120},T={image:"muapi:nano-banana-2",video:"kling:3.0-turbo",audio:"muapi:minimax-music",world:"worldlabs:marble-1.1",model:"muapi:tripo-h31-text-3d"},te=[{id:"arri-alexa",label:"ARRI Alexa 35",hint:"cinematic, soft highlight roll-off"},{id:"red-8k",label:"Modular 8K Digital",hint:"ultra sharp, high dynamic range"},{id:"film-35",label:"35mm Film",hint:"film grain, warm halation"},{id:"tilt-lens",label:"Creative Tilt Lens",hint:"tilt-shift miniature focus"},{id:"anamorphic",label:"Anamorphic",hint:"oval bokeh, horizontal flares"},{id:"macro",label:"Macro 100mm",hint:"extreme close-up detail"},{id:"wide-24",label:"Wide 24mm",hint:"expansive, slight distortion"},{id:"tele-85",label:"Portrait 85mm",hint:"compressed background, creamy bokeh"}],ne=[{id:"script",label:"Viết kịch bản",prompt:"Giúp tôi viết kịch bản video ngắn. Ý tưởng/yêu cầu: [chủ đề, sản phẩm, khán giả, thời lượng]"},{id:"product-ad",label:"Quảng cáo sản phẩm",prompt:"Giúp tôi làm video quảng cáo sản phẩm. Thông tin sản phẩm: [tên, USP, khách hàng mục tiêu]"},{id:"ugc",label:"UGC review",prompt:"Tạo video UGC tự nhiên, chân thật, nêu bật lợi ích chính của sản phẩm. Sản phẩm: [...]"},{id:"batch",label:"Tạo hàng loạt",prompt:"Giúp tôi tạo một bộ video hàng loạt. Yêu cầu hoặc tư liệu: [chủ đề, số lượng, biến thể]"},{id:"micro-film",label:"Phim ngắn AI",prompt:"Tạo phim ngắn AI với hook cuốn hút, hình ảnh điện ảnh, xung đột cảm xúc và kết thúc đáng nhớ. Ý tưởng: [...]"},{id:"microdrama",label:"Microdrama",prompt:"Tạo microdrama nhịp nhanh với hook ngay lập tức, xung đột nhân vật mạnh và twist cảm xúc. Ý tưởng: [...]"},{id:"launch",label:"Ra mắt sản phẩm",prompt:"Tạo video ra mắt sản phẩm với mở đầu mạnh, làm nổi bật tính năng và kêu gọi hành động. Sản phẩm: [...]"},{id:"explainer",label:"Video giải thích",prompt:"Tạo video giải thích rõ ràng, giới thiệu chủ đề và chia nhỏ ý chính từng bước. Chủ đề: [...]"},{id:"social-ad",label:"Ads mạng xã hội",prompt:"Tạo quảng cáo dọc 15 giây với hook đậm trong 2 giây đầu, nhịp nhanh. Sản phẩm: [...]"},{id:"brand-story",label:"Câu chuyện thương hiệu",prompt:"Tạo video ngắn kể câu chuyện thương hiệu: chúng tôi là ai, giải quyết vấn đề gì, vì sao khách hàng chọn. Thương hiệu: [...]"},{id:"livestream",label:"Teaser livestream",prompt:"Tạo teaser 10 giây cho buổi livestream bán hàng. Sản phẩm/ưu đãi: [...]"},{id:"wedding",label:"Highlight đám cưới",prompt:"Tạo video highlight đám cưới cảm xúc từ các ảnh tham chiếu. Phong cách: [...]"},{id:"character",label:"Thiết kế nhân vật",prompt:"Thiết kế character sheet nhất quán (mặt trước, nghiêng, sau, biểu cảm) cho nhân vật: [...]"},{id:"poster",label:"Thiết kế poster",prompt:"Thiết kế poster nổi bật với hệ thống phân cấp rõ, tiêu đề cuốn hút. Nội dung: [...]"},{id:"thumbnail",label:"Thumbnail video",prompt:"Thiết kế thumbnail video có điểm nhấn rõ, chữ đậm dễ đọc, tương phản mạnh. Chủ đề: [...]"},{id:"music",label:"Thiết kế nhạc",prompt:"Thiết kế nhạc nền cho video, hợp mood, nhịp và các điểm chuyển cảnh. Mô tả video: [...]"}],oe=[{group:"Cơ bản",items:[["Xoá","⌫"],["Undo","⌘ Z"],["Redo","⇧ ⌘ Z"],["Copy","⌘ C"],["Paste","⌘ V"],["Duplicate","⌘ D"],["Multi-select","⇧ + click"]]},{group:"Di chuyển",items:[["Pan","Space + kéo"],["Pan","Chuột giữa / cuộn"]]},{group:"Zoom",items:[["Zoom in","⌘ +"],["Zoom out","⌘ −"],["Zoom","⌘ + cuộn"],["Fit to screen","⇧ 1"],["Zoom to selection","⇧ 2"]]},{group:"Khác",items:[["Select tool","V"],["Hand tool","H"],["Duplicate node","⌥ + kéo"],["Canvas Agent","/"],["Phím tắt","?"]]}],R="clipoox.settings",g=(n=null,i=null)=>({generator:n,resolution:i}),v={lineage:"selected",agent:{image:g("openai:gpt-image","1K"),omni:g("muapi:seedance-2.5","480p"),frames:g("muapi:seedance-2.5","480p"),music:T.audio},user:{image:g(T.image,"1K"),video:g(T.video,"480p")}};function q(){try{const n=localStorage.getItem(R);if(!n)return v;const i=JSON.parse(n);return{lineage:["none","selected","all"].includes(i.lineage)?i.lineage:v.lineage,agent:{...v.agent,...i.agent||{}},user:{...v.user,...i.user||{}}}}catch{return v}}function Z(n){try{localStorage.setItem(R,JSON.stringify(n))}catch{}}const H={open:!1,mode:"video",refs:[],prompt:"",generator:null,resolution:"720p",quality:"Medium",duration:$.default,aspectRatio:"Adaptive",count:1,instrumental:!1,lyrics:"",transparent:!1,complexity:"",videoMode:"omni",draft:!1,camera:null,camerawork:null,palette:null,lighting:null,camBody:null,camLens:null,focal:null,aperture:null,looks:{},paletteColors:[],tempo:null,pose:null,anchor:null,targetId:null};let z=1;const ie=V((n,i)=>({user:void 0,wallet:null,setUser:e=>n({user:e}),setWallet:e=>n({wallet:e}),canvasId:null,title:"",saveState:"idle",saveError:null,saveRetry:0,retrySave:()=>n(e=>({saveRetry:e.saveRetry+1})),view:"canvas",tool:"select",generators:[],setCanvasMeta:e=>n(e),setView:e=>n({view:e}),setTool:e=>n({tool:e}),setGenerators:e=>n({generators:e}),past:[],future:[],pushHistory:e=>n(t=>({past:[...t.past.slice(-49),e],future:[]})),popUndo:e=>{const{past:t,future:o}=i();if(!t.length)return null;const r=t[t.length-1];return n({past:t.slice(0,-1),future:[e,...o].slice(0,50)}),r},popRedo:e=>{const{past:t,future:o}=i();if(!o.length)return null;const r=o[0];return n({future:o.slice(1),past:[...t,e].slice(-50)}),r},composer:H,openComposer:(e={})=>n(t=>{const o=e.mode||t.composer.mode,r=t.generators.filter(c=>c.kind===o&&!c.tool),a=o==="image"?t.settings.user.image:o==="video"?t.settings.user.video:null,l=e.generator||(t.composer.mode===o&&t.composer.generator&&r.some(c=>c.name===t.composer.generator&&c.available)?t.composer.generator:null)||a?.generator&&r.find(c=>c.name===a.generator&&c.available)?.name||r.find(c=>c.name===T[o]&&c.available)?.name||r.find(c=>c.available)?.name||r[0]?.name||null,u=e.resolution||(t.composer.mode===o&&t.composer.generator?t.composer.resolution:null)||a?.resolution||(o==="image"?"1K":"720p"),s=e.aspectRatio||(o==="image"?"16:9":"Adaptive"),m=o==="world"||o==="model"?1:e.count??t.composer.count;return{composer:{...t.composer,...e,open:!0,mode:o,generator:l,resolution:u,aspectRatio:s,count:m,targetId:e.targetId??null,anchor:e.anchor??null,draft:e.draft??!1}}}),closeComposer:()=>n(e=>({composer:{...e.composer,open:!1}})),patchComposer:e=>n(t=>({composer:{...t.composer,...e}})),toggleRef:e=>n(t=>{const o=t.composer.refs.includes(e)?t.composer.refs.filter(r=>r!==e):[...t.composer.refs,e];return{composer:{...t.composer,refs:o}}}),panels:{agent:!1,history:!1,assets:!1,shortcuts:!1,settings:!1,minimap:!1,lineage:!1,snapping:!0,chatgpt:!1},settings:q(),setSettings:e=>n(t=>{const o=typeof e=="function"?e(t.settings):{...t.settings,...e};return Z(o),{settings:o}}),togglePanel:(e,t)=>n(o=>({panels:{...o.panels,[e]:t??!o.panels[e]}})),clipEdit:{open:!1,nodeId:null,tool:"edit"},openClipEdit:(e,t="edit")=>n(o=>({clipEdit:{open:!0,nodeId:e,tool:t},composer:{...o.composer,open:!1}})),closeClipEdit:()=>n(e=>({clipEdit:{...e.clipEdit,open:!1}})),selected:[],setSelected:e=>n({selected:e}),contextMenu:null,setContextMenu:e=>n({contextMenu:e}),agent:{messages:[],busy:!1,model:(()=>{try{return localStorage.getItem("clipoox.agent.model")}catch{return null}})(),models:[],provider:null},pushAgentMessage:e=>n(t=>({agent:{...t.agent,messages:[...t.agent.messages,e]}})),setAgentBusy:e=>n(t=>({agent:{...t.agent,busy:e}})),setAgentModel:e=>{try{e&&localStorage.setItem("clipoox.agent.model",e)}catch{}n(t=>({agent:{...t.agent,model:e}}))},setAgentModels:(e,t,o)=>n(r=>({agent:{...r.agent,models:e,provider:t,model:r.agent.model&&e.includes(r.agent.model)?r.agent.model:o}})),clearAgent:()=>n(e=>({agent:{...e.agent,messages:[]}})),timelineTracks:{},setTimelineTracks:e=>n({timelineTracks:e}),timelineFormat:{...K},setTimelineFormat:e=>n({timelineFormat:e}),timelineCamera:null,timelineLook:null,setTimelineLook:e=>n({timelineLook:e}),timelinePalette:[],setTimelinePalette:e=>n({timelinePalette:e}),timelineBrand:null,setTimelineBrand:e=>n({timelineBrand:e}),timelineMotion:null,setTimelineMotion:e=>n({timelineMotion:e}),timelinePins:[],setTimelinePins:e=>n(t=>({timelinePins:typeof e=="function"?e(t.timelinePins):e})),timelineVideoType:null,setTimelineVideoType:e=>n({timelineVideoType:e}),timelineExportRange:null,setTimelineExportRange:e=>n({timelineExportRange:e}),timelineComments:[],setTimelineComments:e=>n(t=>({timelineComments:typeof e=="function"?e(t.timelineComments):e})),setTimelineCamera:e=>n({timelineCamera:e}),timelineMedia:[],setTimelineMedia:e=>n(t=>({timelineMedia:typeof e=="function"?e(t.timelineMedia):e})),clips:[],timelineCompPath:[],setClips:e=>n(t=>({clips:N(t.clips,G(typeof e=="function"?e(t.clips):e),t.timelineTracks)})),toasts:[],toast:(e,t="info")=>{const o=z++;n(r=>({toasts:[...r.toasts,{id:o,text:e,kind:t}]})),setTimeout(()=>i().dismissToast(o),t==="error"?6e3:3200)},dismissToast:e=>n(t=>({toasts:t.toasts.filter(o=>o.id!==e)}))}));export{ee as A,te as C,v as D,S as L,X as Q,W as R,ne as S,$ as V,Q as a,oe as b,V as c,Y as f,G as r,j as s,ie as u};
@@ -1 +1 @@
1
- import{bf as C,dD as D,nc as I,nd as j}from"./titleFrameBudget-BjW--v_T.js";const e=160;async function H(p,g,x,y){const u=g.frames;if(!u.length)return null;const t=Object.assign(document.createElement("video"),{muted:!0,playsInline:!0,preload:"auto",crossOrigin:"anonymous"});t.src=x;try{await new Promise((a,d)=>{t.onloadeddata=()=>a(),t.onerror=()=>d(Error("video"))});const r=Math.max(2,Math.round(e*t.videoHeight/t.videoWidth)),E=Object.assign(document.createElement("canvas"),{width:e,height:r}),w=E.getContext("2d",{willReadFrequently:!0}),o=p.crop||{left:0,right:0,top:0,bottom:0},S=1-o.left-o.right,T=1-o.top-o.bottom,s=u[0][0],M=u.at(-1)[0],m=Math.max(1/6,(M-s)/80),O=Math.max(1,Math.floor((M-s)/m+1e-6)+1),b=[];for(let a=0;a<O;a++){if(y?.aborted)throw new DOMException("cancelled","AbortError");const d=s+a*m,v=Math.min(t.duration-1/60,C(p,d));Math.abs(t.currentTime-v)>1e-4&&await new Promise((n,c)=>{const i=window.setTimeout(()=>c(Error("seek")),8e3);t.onseeked=()=>{window.clearTimeout(i),n()},t.currentTime=v}),w.drawImage(t,0,0,e,r);const l=w.getImageData(0,0,e,r).data,k=(n,c)=>{const i=Math.round(n),h=Math.round(c);if(i<0||h<0||i>=e||h>=r)return null;const f=(h*e+i)*4;return[l[f]/255,l[f+1]/255,l[f+2]/255]},A=D(g,d).map(([n,c])=>[(o.left+n*S)*e,(o.top+c*T)*r]);b.push(I(k,A))}return j(b,s,m)}finally{t.removeAttribute("src"),t.load()}}export{H as measureSurfaceLight};
1
+ import{bf as C,dD as D,nc as I,nd as j}from"./titleFrameBudget-3MFHWIT6.js";const e=160;async function H(p,g,x,y){const u=g.frames;if(!u.length)return null;const t=Object.assign(document.createElement("video"),{muted:!0,playsInline:!0,preload:"auto",crossOrigin:"anonymous"});t.src=x;try{await new Promise((a,d)=>{t.onloadeddata=()=>a(),t.onerror=()=>d(Error("video"))});const r=Math.max(2,Math.round(e*t.videoHeight/t.videoWidth)),E=Object.assign(document.createElement("canvas"),{width:e,height:r}),w=E.getContext("2d",{willReadFrequently:!0}),o=p.crop||{left:0,right:0,top:0,bottom:0},S=1-o.left-o.right,T=1-o.top-o.bottom,s=u[0][0],M=u.at(-1)[0],m=Math.max(1/6,(M-s)/80),O=Math.max(1,Math.floor((M-s)/m+1e-6)+1),b=[];for(let a=0;a<O;a++){if(y?.aborted)throw new DOMException("cancelled","AbortError");const d=s+a*m,v=Math.min(t.duration-1/60,C(p,d));Math.abs(t.currentTime-v)>1e-4&&await new Promise((n,c)=>{const i=window.setTimeout(()=>c(Error("seek")),8e3);t.onseeked=()=>{window.clearTimeout(i),n()},t.currentTime=v}),w.drawImage(t,0,0,e,r);const l=w.getImageData(0,0,e,r).data,k=(n,c)=>{const i=Math.round(n),h=Math.round(c);if(i<0||h<0||i>=e||h>=r)return null;const f=(h*e+i)*4;return[l[f]/255,l[f+1]/255,l[f+2]/255]},A=D(g,d).map(([n,c])=>[(o.left+n*S)*e,(o.top+c*T)*r]);b.push(I(k,A))}return j(b,s,m)}finally{t.removeAttribute("src"),t.load()}}export{H as measureSurfaceLight};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pendingMatte-q35zVaiB.js","assets/titleFrameBudget-3MFHWIT6.js","assets/remote-sTZauTqM.js","assets/api-BsKbf3l3.js","assets/three.module-Bx43vjkH.js","assets/GLTFLoader-Dy6SrZg8.js","assets/store-BSSbvpzr.js","assets/rotoMaskStore-pxpRt5Cj.js","assets/textAnimators-Cihw35O8.js","assets/timelineComp-CRRzLazc.js","assets/rigTrack-Bx9QHlFv.js","assets/main-M1vRa-gd.js","assets/spark.module-BRT8yMS4.js","assets/userFonts-BZ4QL-zq.js","assets/lottieLayer-CfUPParC.js","assets/desktop-BWhFnYwd.js","assets/timeline3d-BEuZZOxM.js","assets/RoomEnvironment-Dmv_G5ka.js","assets/exportEncode-CaKEPgsy.js","assets/captionLayout-CNgb471H.js","assets/timelineText-CkoUgWcY.js","assets/titleArt-CcTdJuOC.js","assets/rotoMatte-DyXlW4jK.js","assets/distortGL-BklPDXPq.js","assets/motionBlur-uAm030t9.js","assets/main-BPmr0TOL.css"])))=>i.map(i=>d[i]);
2
+ import{b_ as L,c0 as ft,mL as j,dF as pt,dD as dt,mM as gt,mN as R,mO as yt,mP as ct,dK as wt,dP as kt,dS as tt,b$ as V,mQ as Mt,mR as bt,dT as xt,fp as vt,mS as St,dR as Pt,mT as Tt,_ as Ft,a7 as At,bY as Et,bZ as _t,dz as qt,mU as Ct,mV as It,mW as Ot}from"./titleFrameBudget-3MFHWIT6.js";import{T as lt,U as Dt,V as Nt,X as Rt,Y as Vt,Z as Kt,_ as et}from"./main-M1vRa-gd.js";import{h_ as Bt,h$ as Qt}from"./remote-sTZauTqM.js";import{measureSurfaceLight as Ut}from"./surfaceLight-CMaBhZ_d.js";import{u as C}from"./store-BSSbvpzr.js";import{F as Y,J as Z,I as nt,U as zt,V as Gt}from"./rotoMaskStore-pxpRt5Cj.js";import{t as A}from"./api-BsKbf3l3.js";import"./three.module-Bx43vjkH.js";import"./spark.module-BRT8yMS4.js";import"./timelineComp-CRRzLazc.js";import"./textAnimators-Cihw35O8.js";import"./userFonts-BZ4QL-zq.js";import"./lottieLayer-CfUPParC.js";import"./rigTrack-Bx9QHlFv.js";import"./desktop-BWhFnYwd.js";import"./timeline3d-BEuZZOxM.js";import"./GLTFLoader-Dy6SrZg8.js";import"./RoomEnvironment-Dmv_G5ka.js";import"./exportEncode-CaKEPgsy.js";import"./captionLayout-CNgb471H.js";import"./timelineText-CkoUgWcY.js";import"./titleArt-CcTdJuOC.js";import"./rotoMatte-DyXlW4jK.js";import"./distortGL-BklPDXPq.js";import"./motionBlur-uAm030t9.js";const rt=(t,a,m,n,e)=>{if(n<0||e<0||n>a-1.001||e>m-1.001)return NaN;const h=Math.floor(n),o=Math.floor(e),i=n-h,c=e-o,r=o*a+h;return(t[r]*(1-i)+t[r+1]*i)*(1-c)+(t[r+a]*(1-i)+t[r+a+1]*i)*c};function ot(t,a,m,n,e,h,{radius:o=10,samples:i=28,min:c=10,sign:r=null}={}){const s=Math.hypot(e[0]-n[0],e[1]-n[1]);if(s<8)return null;const f=[(e[0]-n[0])/s,(e[1]-n[1])/s];let u=[-f[1],f[0]];const l=[(n[0]+e[0])/2,(n[1]+e[1])/2];(l[0]-h[0])*u[0]+(l[1]-h[1])*u[1]<0&&(u=[-u[0],-u[1]]);const p={drop:[],rise:[]};for(let S=0;S<i;S++){const F=.08+.84*S/(i-1),x=[n[0]+(e[0]-n[0])*F,n[1]+(e[1]-n[1])*F];let k=null,M=null;for(let v=-o;v<=o;v+=.5){const _=x[0]+u[0]*v,q=x[1]+u[1]*v,P=rt(t,a,m,_+u[0],q+u[1])-rt(t,a,m,_-u[0],q-u[1]);if(!Number.isFinite(P)||Math.abs(P)<c)continue;const E=Math.abs(P)*(1-.7*Math.abs(v)/o);P<0&&(!k||E>k.score)&&(k={x:_,y:q,score:E}),P>0&&(!M||E>M.score)&&(M={x:_,y:q,score:E})}k&&p.drop.push(k),M&&p.rise.push(M)}const g=S=>S.reduce((F,x)=>F+x.score,0),d=r?p[r]:g(p.drop)*1.25>=g(p.rise)?p.drop:p.rise;if(d.length<i*.5)return null;const w=(S,F,x)=>{const k=x.x-F.x,M=x.y-F.y,v=Math.hypot(k,M)||1;return Math.abs((S.x-F.x)*M-(S.y-F.y)*k)/v};let y=null;for(let S=0;S<d.length;S++)for(let F=S+2;F<d.length;F++){const x=d.filter(k=>w(k,d[S],d[F])<=1.2);(!y||x.length>y.length||x.length===y.length&&x.reduce((k,M)=>k+M.score,0)>y.reduce((k,M)=>k+M.score,0))&&(y=x)}if(!y||y.length<i*.4)return null;const b=Ht(y);return b&&{...b,inliers:y.length/i}}function Ht(t){if(t.length<2)return null;let a=0,m=0;for(const i of t)a+=i.x,m+=i.y;a/=t.length,m/=t.length;let n=0,e=0,h=0;for(const i of t){const c=i.x-a,r=i.y-m;n+=c*c,e+=c*r,h+=r*r}const o=.5*Math.atan2(2*e,n-h);return{p:[a,m],d:[Math.cos(o),Math.sin(o)]}}const H=(t,a)=>{const m=t.d[0]*a.d[1]-t.d[1]*a.d[0];if(Math.abs(m)<1e-6)return null;const n=((a.p[0]-t.p[0])*a.d[1]-(a.p[1]-t.p[1])*a.d[0])/m;return[t.p[0]+t.d[0]*n,t.p[1]+t.d[1]*n]},$t=t=>{let a=0;for(let m=0;m<4;m++){const n=t[m],e=t[(m+1)%4],h=t[(m+2)%4],o=(e[0]-n[0])*(h[1]-e[1])-(e[1]-n[1])*(h[0]-e[0]);if(!o||a&&Math.sign(o)!==a)return!1;a=Math.sign(o)}return!0};function at(t,a,m,n,e={}){const h=e.radius??10,o=[n.reduce((l,p)=>l+p[0],0)/4,n.reduce((l,p)=>l+p[1],0)/4],i=l=>[0,1,2,3].map(p=>ot(t,a,m,n[p],n[(p+1)%4],o,{...e,sign:l})),c=l=>l.every(Boolean)?l.reduce((p,g)=>p+g.inliers,0):-1,r=i("drop"),s=i("rise"),f=c(r)*1.15>=c(s)?r:s;if(f.some(l=>!l))return null;const u=[H(f[3],f[0]),H(f[0],f[1]),H(f[1],f[2]),H(f[2],f[3])];if(u.some(l=>!l)||!$t(u)||u.some((l,p)=>Math.hypot(l[0]-n[p][0],l[1]-n[p][1])>2*h))return null;if(e.clean){const l=f===r?"drop":"rise",p=[u.reduce((d,w)=>d+w[0],0)/4,u.reduce((d,w)=>d+w[1],0)/4],g=[0,1,2,3].map(d=>ot(t,a,m,u[d],u[(d+1)%4],p,{...e,radius:Math.min(h,4),samples:48,sign:l}));if(g.some(d=>!d)||g.filter(d=>d.inliers>=.97).length<3||g.some(d=>d.inliers<.6))return null}return u}function Lt(t,a,{jump:m=3}={}){const n=t.length,e=t.map((i,c)=>i??null);for(let i=0;i<n;i++)if(!e[i]){let c=i-1;for(;c>=0&&!t[c];)c--;let r=i+1;for(;r<n&&!t[r];)r++;e[i]=c>=0&&r<n?t[c].map((s,f)=>s.map((u,l)=>u+(t[r][f][l]-u)*(i-c)/(r-c))):c>=0?t[c]:r<n?t[r]:a[i]}const h=e.map((i,c)=>i.map((r,s)=>r.map((f,u)=>{const l=[];for(let p=-2;p<=2;p++){const g=e[Math.min(n-1,Math.max(0,c+p))];l.push(g[s][u])}return l.sort((p,g)=>p-g),l[2]}))),o=e.map((i,c)=>i.map((r,s)=>Math.hypot(r[0]-h[c][s][0],r[1]-h[c][s][1])>m?h[c][s]:r));return o.map((i,c)=>i.map((r,s)=>r.map((f,u)=>{let l=0,p=0;for(let g=-1;g<=1;g++){const d=o[c+g];d&&(l+=d[s][u],p++)}return l/p})))}const it=[15,100],st=46,K=(t,a)=>t[0]*a[0]+t[1]*a[1]+t[2]*a[2],mt=t=>Math.hypot(...t),z=t=>{const a=mt(t)||1;return t.map(m=>m/a)},W=(t,a)=>[t[1]*a[2]-t[2]*a[1],t[2]*a[0]-t[0]*a[2],t[0]*a[1]-t[1]*a[0]],J=(t,a)=>t.map(m=>[0,1,2].map(n=>m[0]*a[0][n]+m[1]*a[1][n]+m[2]*a[2][n])),Wt=t=>[0,1,2].map(a=>[0,1,2].map(m=>t[m][a]));function Xt(t){const a=t.map(n=>[...n]),m=[[1,0,0],[0,1,0],[0,0,1]];for(let n=0;n<60;n++){let e=0,h=1;if(Math.abs(a[0][2])>Math.abs(a[e][h])&&(e=0,h=2),Math.abs(a[1][2])>Math.abs(a[e][h])&&(e=1,h=2),Math.abs(a[e][h])<1e-15)break;const o=(a[h][h]-a[e][e])/(2*a[e][h]),i=(o>=0?1:-1)/(Math.abs(o)+Math.sqrt(o*o+1)),c=1/Math.sqrt(i*i+1),r=i*c;for(let s=0;s<3;s++){const f=a[s][e],u=a[s][h];a[s][e]=c*f-r*u,a[s][h]=r*f+c*u}for(let s=0;s<3;s++){const f=a[e][s],u=a[h][s];a[e][s]=c*f-r*u,a[h][s]=r*f+c*u}for(let s=0;s<3;s++){const f=m[s][e],u=m[s][h];m[s][e]=c*f-r*u,m[s][h]=r*f+c*u}}return[0,1,2].map(n=>({v:a[n][n],e:[m[0][n],m[1][n],m[2][n]]})).sort((n,e)=>e.v-n.v)}function Yt(t){const a=J(Wt(t),t),[m,n,e]=Xt(a),h=Math.sqrt(Math.max(1e-18,n.v)),o=m.v/(h*h),i=e.v/(h*h);if(o-i<2e-4)return null;const c=Math.sqrt(o-i),r=Math.sqrt(Math.max(0,1-i)),s=Math.sqrt(Math.max(0,o-1)),f=m.e.map((p,g)=>(r*p+s*e.e[g])/c),u=m.e.map((p,g)=>(r*p-s*e.e[g])/c),l=[W(n.e,f),W(n.e,u)].map(p=>(p=z(p),p[2]<0?p.map(g=>-g):p));return l.w=o-i,l}const Zt=t=>[[t[0],t[1],t[2]],[t[3],t[4],t[5]],[t[6],t[7],t[8]]];function Jt(t){let a={cost:1/0,n:null};for(const m of t[0]){const n=t.map(c=>c.w*c.w),e=n.reduce((c,r)=>c+r,0)||1,h=t.map(c=>c.reduce((r,s)=>K(r,m)>K(s,m)?r:s)),o=z(h.reduce((c,r,s)=>c.map((f,u)=>f+r[u]*n[s]),[0,0,0])),i=h.reduce((c,r,s)=>c+n[s]*Math.acos(Math.max(-1,Math.min(1,K(r,o)))),0)/e;i<a.cost&&(a={cost:i,n:o})}return a}function jt(t,a,m,n){const e=t.planar,h=e.frames.filter(l=>Math.abs(l[0]-n)>1/20),o=Math.min(30,h.length);if(o<2)return null;const i=l=>l.map(([p,g])=>[p-a/2,g-m/2]),c=i(j(t,n,a,m)),r=Array.from({length:o},(l,p)=>h[Math.round(p*(h.length-1)/Math.max(1,o-1))]).map(l=>pt(c,i(j(t,l[0],a,m)))).filter(Boolean);if(r.length<2)return null;const s=l=>{const p=m/2/Math.tan(l*Math.PI/360),g=[[p,0,0],[0,p,0],[0,0,1]],d=[[1/p,0,0],[0,1/p,0],[0,0,1]],w=r.map(b=>Yt(J(J(d,Zt(b)),g))).filter(Boolean);if(w.length<2)return null;const y=Jt(w);return{...y,cost:y.cost+.008*((l-st)/30)**2,raw:y.cost}};let f=null,u=st;for(let l=it[0];l<=it[1];l+=1){const p=s(l);p&&(!f||p.cost<f.cost)&&(f=p,u=l)}if(!f)return null;for(let l=u-1;l<=u+1;l+=.1){const p=s(l);p&&p.cost<f.cost&&(f=p,u=l)}return{fov:+u.toFixed(2),n:f.n,spread:+f.raw.toFixed(5)}}function te(t,a,m,n,e){const h=jt(t,a,m,n);if(!h)return null;const o=m/2/Math.tan(h.fov*Math.PI/360),i=h.n,{mw:c,mh:r}=t.planar,s=e.map(([x,k])=>{const M=L(t,x,k,n,a,m,c,r),v=[(M.px-a/2)/o,(M.py-m/2)/o,1],_=K(i,v);return _>1e-6?v.map(q=>q/_):null});if(s.some(x=>!x))return null;const f=W(i,[0,-1,0]),u=mt(f)>.15?z(f[0]<0?f.map(x=>-x):f):z([1-i[0]*i[0],-i[0]*i[1],-i[0]*i[2]]);let l=z(W(i,u));l[1]<0&&(l=l.map(x=>-x));const p=s.map(x=>K(x,u)),g=s.map(x=>K(x,l)),d=(p[0]+p[3])/2,w=(p[1]+p[2])/2,y=(g[0]+g[1])/2,b=(g[2]+g[3])/2;if(!(w>d&&b>y))return null;const S=(x,k)=>i.map((M,v)=>M+x*u[v]+k*l[v]),F=[[d,y],[w,y],[w,b],[d,b]].map(([x,k])=>{const M=S(x,k),v=ft(t,o*M[0]/M[2]+a/2,o*M[1]/M[2]+m/2,n,a,m,c,r);return[+v.u.toFixed(5),+v.v.toFixed(5)]});return{fov:h.fov,surface:F,n:i}}const $=new Map,ee=1/30;async function ht(t,a,m,n,e=null){const h=[];let o=0,i=0;for(const[c,r]of[[1,n.fwd],[-1,n.back]])if(!(Math.abs(r-n.from)<ee))try{const s=await Vt({clip:t,url:a,quad:m,mode:"perspective",from:n.from,to:r,scene:e});o=s.mw,i=s.mh,h.push({dir:c,frames:s.frames,lostAt:s.lostAt,expected:Math.round(Math.abs(r-n.from)*30)})}catch(s){if(s.message!=="FLAT")throw s;h.push({dir:c,frames:[],lostAt:n.from,expected:Math.round(Math.abs(r-n.from)*30)})}return{runs:h,mw:o,mh:i,quality:Ot(h)}}const U=new Map;function ne(t,a,m){const n=[t.id,a,t.start,t.inPoint??0,t.duration,t.playbackRate??1,m.from,m.back,m.fwd].join("|"),e=Date.now();for(const[o,i]of U)e-i.at>6e4&&U.delete(o);let h=U.get(n);return h||(h={at:e,p:ht(t,a,R(ct),m)},U.set(n,h),h.p.catch(()=>U.delete(n))),h.p}async function re(t,a,m,n){const e=await lt(t,a);try{const h=await e.grab(n),o=r=>qt(h,e.w,e.h,R(r).map(([s,f])=>{const u=e.toPx(s,f);return[u.x,u.y]}),"perspective").features.length,i=o(m);if(i>=Ct)return{region:m,score:i,moved:!1};let c={region:m,score:i,moved:!1};for(const r of It(m)){const s=o(r);s>c.score&&(c={region:r,score:s,moved:!0})}return c}finally{e.close()}}async function ut(t,a,m,n,e){let h;const o={clip:t,url:a,u:m.x+m.w/2,v:m.y+m.h/2,from:n,to:e},i=r=>r?r.lostAt??e:-1,c=await Kt(o).catch(r=>{if(r.name==="AbortError")throw r;return null});if(c&&c.lostAt===null)h=c;else if(c&&i(c)>=n+.6*(e-n)){const r=c.track.points.at(-1),s=r[0]<e-.1?await et({...o,u:r[1],v:r[2],from:r[0]}).catch(f=>{if(f.name==="AbortError")throw f;return null}):null;h=s&&s.track.points.length>1?{track:{...c.track,points:[...c.track.points,...s.track.points.filter(f=>f[0]>r[0]+1e-4)]},lostAt:s.lostAt}:c}else{const r=await et(o).catch(s=>{if(s.name==="AbortError"||!c)throw s;return null});h=r&&i(r)>=i(c)?r:c}return h}async function oe(t,a,m,n,e,h){const o=Math.max(0,n.at-a.start),i=Math.min(a.duration,t.start+t.duration-a.start),c=n.region;let r;try{r=await ut(a,m,c,o,i)}catch(w){if(w.name==="AbortError")throw w;return e(A("“{0}”: không bám được vật này — chọn chỗ có nhiều chi tiết hơn.",[t.label]))}const s=C.getState(),f=s.clips.find(w=>w.id===t.id),u=s.clips.find(w=>w.id===a.id);if(!f||f.pendingPin!==n||!u)return{clipId:t.id,ok:!1,message:A("Timeline đã thay đổi. Hãy thử lại.")};const{width:l,height:p}=V(s.timelineFormat),g=r.track.points.map(([w,y,b])=>{const S=L(u,y,b,w,l,p,r.track.mw,r.track.mh);return[u.start+w-f.start,S.px,S.py]}).filter(w=>w[0]>=-1e-6);if(g.length<2)return e(A("“{0}”: không bám được vật này — chọn chỗ có nhiều chi tiết hơn.",[t.label]));const d=Bt(f,g,l,p);return h?.(),C.setState(w=>({clips:w.clips.map(y=>y.id===f.id?{...y,...d}:y)})),{clipId:f.id,ok:!0,path:"region",message:r.lostAt!==null?A("Vệt theo vật: bám được tới giây {0}.",[r.lostAt.toFixed(2)]):A("Vệt theo vật: đã bám {0} khung.",[g.length])}}async function ae(t,a,m,n,e,h){let o=a;const i=Math.max(0,n.at-o.start),c=Math.min(o.duration,t.start+t.duration-o.start),{width:r,height:s}=V(C.getState().timelineFormat);let f;try{if(n.person){const w=()=>{const k=C.getState().clips,M=k.find(v=>v.id===o.id);return M?.person&&M.person.src!=="object"?M.person:k.find(v=>v.id!==o.id&&v.kind==="video"&&v.url===o.url&&v.person&&v.person.src!=="object")?.person};let y=w();for(let k=0;k<1200&&!y&&C.getState().clips.some(M=>M.url===o.url&&M.personPending);k++)await new Promise(M=>setTimeout(M,500)),y=w();if(!y){const{segmentClipMatte:k}=await Ft(async()=>{const{segmentClipMatte:M}=await import("./pendingMatte-q35zVaiB.js");return{segmentClipMatte:M}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]));y=await k(o)}if(!y)return e(A("“{0}”: chưa tách người trên clip này — mở Roto → Tách người, hoặc chọn điểm người chạy.",[t.label]));const b=await At(y),S=1/30,F=[],x=y;for(let k=i;k<=c+1e-6;k+=S){const M=Rt(Et(b,x,_t(o,k)),x.w,x.h);if(!M)continue;const v=L(o,M.x+M.w/2,M.y+M.h*.42,k,r,s,x.mw,x.mh);F.push([k,v.px/r,v.py/s])}f=F.map((k,M)=>{const v=F.slice(Math.max(0,M-2),M+3);return[k[0],v.reduce((_,q)=>_+q[1],0)/v.length,v.reduce((_,q)=>_+q[2],0)/v.length]})}else{const w=await ut(o,m,n.region,i,c);f=w.track.points.map(([y,b,S])=>{const F=L(o,b,S,y,r,s,w.track.mw,w.track.mh);return[y,F.px/r,F.py/s]})}}catch(w){if(w.name==="AbortError")throw w;return e(A("“{0}”: không bám được vật này — chọn chỗ có nhiều chi tiết hơn.",[t.label]))}const u=C.getState(),l=u.clips.find(w=>w.id===t.id),p=u.clips.find(w=>w.id===o.id);if(!l||l.pendingPin!==n||!p)return{clipId:t.id,ok:!1,message:A("Timeline đã thay đổi. Hãy thử lại.")};const g=f.map(([w,y,b])=>[p.start+w-l.start,y,b]).filter(w=>w[0]>=-1e-6);if(g.length<2)return e(A("“{0}”: không bám được vật này — chọn chỗ có nhiều chi tiết hơn.",[t.label]));const d=Qt(l,g);return h?.(),C.setState(w=>({clips:w.clips.map(y=>y.id===l.id?{...y,...d}:y)})),{clipId:l.id,ok:!0,path:"region",message:A("Vệt sét: đã bám {0} khung.",[g.length])}}async function ie(t,a,m,n,e,h){let o;try{o=await Nt(a,m)}catch(y){if(y.name==="AbortError")throw y;return e(A("“{0}”: video quá ít chi tiết để dựng camera 3D — thử một cảnh có nhiều mái nhà, đường, cây.",[t.label]))}const i=C.getState(),c=i.clips.find(y=>y.id===t.id),r=i.clips.find(y=>y.id===a.id);if(!c||c.pendingPin!==n||!r)return{clipId:t.id,ok:!1,message:A("Timeline đã thay đổi. Hãy thử lại.")};const{width:s,height:f}=V(i.timelineFormat),u=n.at-r.start,l=n.region,[p,g]=Y(o,r,l.x+l.w/2,l.y+l.h/2);let d,w=i.timelineCamera;if(c.kind==="model"){if(o.mode!=="free")return e(A("“{0}”: máy quay chỉ xoay tại chỗ — toà nhà 3D cần cảnh máy bay / di chuyển.",[c.label]));const y=Z(o,p,g,u)??nt(o,p,g,u),b=Z(o,...Y(o,r,l.x,l.y+l.h/2),u),S=Z(o,...Y(o,r,l.x+l.w,l.y+l.h/2),u),F=zt(o,r,y,s,f,{size:b&&S?Math.hypot(b[0]-S[0],b[1]-S[1],b[2]-S[2]):null,fill:.8});w=F.camera,d={pendingPin:void 0,pin:void 0,...F.place}}else d={pendingPin:void 0,pin:void 0,...Gt(c,r,o,nt(o,p,g,u),s,f)};return h?.(),C.setState(y=>({timelineCamera:w,clips:y.clips.map(b=>b.id===r.id?{...b,sceneTrack:o}:b.id===c.id?{...b,...d}:b)})),{clipId:c.id,ok:!0,path:"scene",message:A("“{0}” đã dính vào cảnh 3D của video (camera dựng từ {1} khung, như 3D Camera Tracker).",[c.label,o.frames.length])}}async function se(t,a,m,n){if(!m.frames.length)return null;const e=await lt(t,a);try{const h=Math.max(6,Math.round(e.w*.025)),o=[],i=[],c=g=>e.grab(g+.002);for(const g of m.frames){const d=dt(m,g[0]).map(([w,y])=>{const b=e.toPx(w,y);return[b.x,b.y]});o.push(d),i.push(at(await c(g[0]),e.w,e.h,d,{radius:h}))}if(i.filter(Boolean).length<i.length*.6)return null;const r=m.frames.map(g=>g[0]),s=m.frames.map(g=>g[9]);if(n){const g=.03333333333333333,d=async(P,E)=>{const N=[];let O=P<0?i.findIndex(Boolean):i.length-1-[...i].reverse().findIndex(Boolean),B=i[O],D=r[O];for(let G=0;G<600&&(D=+(D+P*g).toFixed(4),!(P<0?D<E-1e-6:D>E+1e-6));G++){const Q=at(await c(D),e.w,e.h,B,{radius:h,clean:!0});if(!Q)break;N.push({t:D,q:Q}),B=Q}return{k:O,out:N}},w=await d(-1,Math.max(0,n.back)),y=await d(1,Math.min(t.duration,n.fwd)),b=w.out.reverse(),S=y.out,F=w.k,x=y.k,k=P=>P>=F&&P<=x,M=[...b.map(P=>P.t),...r.filter((P,E)=>k(E)),...S.map(P=>P.t)],v=[...b.map(P=>P.q),...i.filter((P,E)=>k(E)),...S.map(P=>P.q)],_=[...b.map(P=>P.q),...o.filter((P,E)=>k(E)),...S.map(P=>P.q)],q=[...b.map(()=>.9),...s.filter((P,E)=>k(E)),...S.map(()=>.9)];r.splice(0,r.length,...M),i.splice(0,i.length,...v),o.splice(0,o.length,..._),s.splice(0,s.length,...q)}const f=Lt(i,o).map(g=>g.map(([d,w])=>{const y=e.toUv(d,w);return[+y.u.toFixed(5),+y.v.toFixed(5)]})),u=r.map((g,d)=>[g,...f[d].flat(),s[d]]),l=m.surface?.t??u[0][0];let p=0;return u.forEach((g,d)=>{Math.abs(g[0]-l)<Math.abs(u[p][0]-l)&&(p=d)}),{...m,frames:u,surface:{t:u[p][0],pts:f[p]}}}finally{e.close()}}async function ce(t,a){const m=C.getState(),n=m.clips.find(s=>s.id===t),e=n?.pendingPin;if(!n||!e)return{clipId:t,ok:!1,message:A("Không còn lớp cần gắn.")};const h=s=>(C.setState(f=>({clips:f.clips.map(u=>u.id===t&&u.pendingPin===e?{...u,pendingPin:void 0}:u)})),{clipId:t,ok:!1,message:s}),o=m.clips.find(s=>s.id===e.source);if(!o||o.kind!=="video")return h(A("“{0}”: không tìm thấy video để bám.",[n.label]));const i=document.querySelector(`video[data-clip-media="${o.id}"]`)?.currentSrc||o.url;if(e.mode==="scene")return ie(n,o,i,e,h,a);if(e.mode==="trail")return oe(n,o,i,e,h,a);if(e.mode==="bolt")return ae(n,o,i,e,h,a);const c=gt(n,o,e.at),r=R(e.region);try{const s=await re(o,i,e.region,c.from);let f=s.moved?"nearby":"region";const u=o.sceneTrack?.mode==="free"&&o.sceneTrack.key===Dt(o,i)?o.sceneTrack:null;let l=s.score>=yt||u?await ht(o,i,R(s.region),c,u):null,p=R(s.region);const g={plane:l?.quality??null};if((e.mode==="camera3d"||e.mode==="point")&&(!l||l.quality.weak)){const T=await ne(o,i,c);g.frame=T.quality,(!l||T.quality.score>l.quality.score*1.25+.05)&&(l=T,p=R(ct),f="frame")}if(!l||!l.mw||!l.runs.some(T=>T.frames.length))throw Error("FLAT");let d=wt({v:1,mw:l.mw,mh:l.mh,mode:"perspective",frames:[]},c.from,p);for(const T of l.runs)d=kt(d,T.frames,c.from,T.dir);f!=="region"&&(d=tt(d,c.from,r));const{width:w,height:y}=V(C.getState().timelineFormat),b=te({...o,planar:d},w,y,c.from,r);if(b&&(d=tt(d,c.from,b.surface)),e.mode==="plane"){const T=await se(o,i,d,c).catch(()=>null);T&&(d=T)}const S=C.getState(),F=S.clips.find(T=>T.id===t),x=S.clips.find(T=>T.id===o.id);if(!F||F.pendingPin!==e||!x)return{clipId:t,ok:!1,message:A("Timeline đã thay đổi. Hãy thử lại.")};const{patch:k,solve:M,follow:v}=Mt(F,x.id,e.mode);if(k.pin?.scene){const T=await Ut(x,d,i).catch(()=>null);k.pin={...k.pin,...b?{lens:b.fov}:{},...T?{light:T}:{}}}const _=C.getState(),q=_.clips.find(T=>T.id===t),P=_.clips.find(T=>T.id===o.id);if(!q||q.pendingPin!==e||!P)return{clipId:t,ok:!1,message:A("Timeline đã thay đổi. Hãy thử lại.")};let E=k,N=_.timelineCamera;if(v){const{width:T,height:I}=V(_.timelineFormat);E={...k,...bt(q,{...P,planar:d},T,I)}}if(M){const{width:T,height:I}=V(_.timelineFormat),X=xt({...P,planar:d},T,I,N,b?{zoom:I/2/Math.tan(b.fov*Math.PI/360)/(5*vt(T,I))}:{});N?.motionKeys?.length||(N=X.camera),E={...k,...q.kind==="model"?St(X.plane,T,I):Pt(X.plane,T,{fill:.6})}}const O=k.pin&&!k.pin.scene?Tt({...q,...E},P,d,_.timelineFormat?.fps||30):null;O&&(E={...E,...O}),a?.(),C.setState(T=>({timelineCamera:N,clips:T.clips.map(I=>I.id===P.id&&!v?{...I,planar:d}:I.id===t?{...I,...E}:I)}));const B=l.runs.find(T=>T.lostAt!==null&&T.frames.length),D=d.frames.length,G=f==="region"?"":f==="nearby"?A(" (vùng được dời sang chỗ nhiều chi tiết hơn)"):A(" (bám theo chuyển động cả khung hình)"),Q=O?A(" Lớp hiện từ giây {0} đến {1} — đúng các khung thấy trọn mặt phẳng.",[O.start.toFixed(2),(O.start+O.duration).toFixed(2)]):"";return{clipId:t,ok:!0,path:f,quality:g,message:(B&&!O?A("“{0}” đã dính vào cảnh ({1} khung) — mất mặt phẳng ở giây {2}; sửa góc ở tab Roto rồi track tiếp.",[n.label,D,(B.lostAt+o.start).toFixed(2)]):A("“{0}” đã dính vào cảnh: track {1} khung trên “{2}”.",[n.label,D,o.label]))+G+Q}}catch(s){const f=s.message,u=f==="FLAT"?A("vùng này quá trơn để track — chọn mặt phẳng có nhiều chi tiết hơn"):["NO_TRACK","NOT_PERSPECTIVE","DEGENERATE","OUT_OF_RANGE"].includes(f)?A("không dựng được camera 3D từ track ({0})",[f]):f;return h(A("“{0}” chưa dính vào cảnh: {1}.",[n.label,u]))}}function Oe({ids:t,checkpoint:a,skipRunning:m=!1}={}){const n=C.getState().clips.filter(e=>e.pendingPin&&(!t||t.includes(e.id))&&!(m&&$.has(e.id))).map(e=>e.id);return Promise.all(n.map(e=>{let h=$.get(e);return h||(h=ce(e,a).finally(()=>$.delete(e)),$.set(e,h)),h}))}export{Oe as runSurfacePins,se as snapPlanarToEdges};
@@ -0,0 +1 @@
1
+ import{mB as se}from"./titleFrameBudget-3MFHWIT6.js";const oe=[{family:"Inter",category:"Sans serif"},{family:"Be Vietnam Pro",category:"Sans serif"},{family:"Roboto",category:"Sans serif"},{family:"Open Sans",category:"Sans serif"},{family:"Montserrat",category:"Sans serif"},{family:"Manrope",category:"Sans serif"},{family:"Lexend",category:"Sans serif"},{family:"Archivo",category:"Sans serif"},{family:"Barlow",category:"Sans serif"},{family:"Noto Sans",category:"Sans serif"},{family:"Noto Serif",category:"Serif"},{family:"Playfair Display",category:"Serif"},{family:"Oswald",category:"Display"},{family:"Anton",category:"Display"},{family:"Bungee",category:"Display"},{family:"Dancing Script",category:"Handwriting"},{family:"Arial",category:"System"},{family:"Georgia",category:"System"},{family:"Courier New",category:"System"}],ce=oe.map(e=>e.family),ae=e=>ce.includes(e),fe=/^u:[A-Za-z0-9_-]{8,40}$/,ne=e=>typeof e=="string"&&fe.test(e),de=e=>ae(e)||ne(e);function ve(e){const n=new Set,i=new WeakSet,t=r=>{if(typeof r=="string"){ne(r)&&n.add(r);return}if(!(!r||typeof r!="object"||i.has(r))){i.add(r);for(const s of Array.isArray(r)?r:Object.values(r))t(s)}};return t(e),[...n]}const T=["linear","easeOutCubic","easeOutQuart","easeOutExpo","easeInOutCubic","easeOutBack","easeOutElastic","easeOutBounce"],R=["line","word","char"],Z=6,Y=["forward","reverse","center","random"],A={opacity:1,x:0,y:0,scale:1,scaleX:1,scaleY:1,reveal:1,wipeX:1,wipeY:1,brightness:1,blur:0,rotate:0,spread:0,glitch:0,flicker:0,count:1},le=["x","y","rotate","blur","spread","glitch","flicker"],F={opacity:[0,1],x:[-4,4],y:[-4,4],scale:[0,4],scaleX:[0,4],scaleY:[0,4],reveal:[0,1],wipeX:[0,1],wipeY:[0,1],brightness:[0,1],blur:[0,1],rotate:[-180,180],spread:[-.2,1.5],glitch:[0,1],flicker:[0,1],count:[0,20]},te={linear:e=>e,easeOutCubic:e=>1-(1-e)**3,easeOutQuart:e=>1-(1-e)**4,easeOutExpo:e=>e>=1?1:1-2**(-10*e),easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeOutBack:e=>1+2.70158*(e-1)**3+1.70158*(e-1)**2,easeOutElastic:e=>e<=0?0:e>=1?1:2**(-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375};function ge(e,n){m(e,n),g(e,["lines","unit","start","duration","stagger","order","easing","from","mask","at"],n),e.mask!==void 0&&typeof e.mask!="boolean"&&a(n+".mask","true/false"),R.includes(e.unit??"line")||a(n+".unit",R.join("/")),e.order!==void 0&&!Y.includes(e.order)&&a(n+".order",Y.join("/")),e.easing!==void 0&&!T.includes(e.easing)&&a(n+".easing",T.join("/"));let i=null;e.lines!==void 0&&e.lines!==null&&((!Array.isArray(e.lines)||!e.lines.length||e.lines.length>8||e.lines.some(o=>!Number.isInteger(o)||o<0||o>7))&&a(n+".lines","mảng chỉ số dòng 0–7"),i=[...new Set(e.lines)]);let t=null;e.at!==void 0&&((!Array.isArray(e.at)||!e.at.length||e.at.length>60)&&a(n+".at","cần 1–60 mốc giây"),t=e.at.map((o,f)=>c(o,0,10,`${n}.at[${f}]`)));const r=m(e.from??{},n+".from");g(r,Object.keys(A),n+".from"),Object.keys(r).length||a(n+".from","cần ít nhất 1 thuộc tính");const s={};for(const[o,f]of Object.entries(r))s[o]=c(f,F[o][0],F[o][1],`${n}.from.${o}`);return{lines:i,unit:e.unit??"line",start:c(e.start,0,10,n+".start",0),duration:c(e.duration,.02,5,n+".duration",.4),stagger:c(e.stagger,0,2,n+".stagger",0),order:e.order??"forward",easing:e.easing??"easeOutCubic",from:s,mask:e.mask===!0,...t?{at:t}:{}}}function en(e,n="animation"){return m(e,n),g(e,["version","in","out","outSpeed"],n),e.version!==void 0&&e.version!==1&&a(n+".version","chỉ hỗ trợ version 1"),(!Array.isArray(e.in)||!e.in.length||e.in.length>Z)&&a(n+".in",`cần 1–${Z} track`),e.out!==void 0&&!["reverse","none"].includes(e.out)&&a(n+".out","reverse hoặc none"),{version:1,in:e.in.map((i,t)=>ge(i,`${n}.in[${t}]`)),out:e.out??"reverse",outSpeed:c(e.outSpeed,.25,4,n+".outSpeed",1.5)}}function me(e,n){const i=[...Array(e).keys()];let t=n||1;for(let r=e-1;r>0;r--){t=t*16807%2147483647;const s=t%(r+1);[i[r],i[s]]=[i[s],i[r]]}return i}function _(e,n,i){return i==="reverse"?n-1-e:i==="center"?Math.abs(e-(n-1)/2)*2|0:i==="random"?me(n,n*7919).indexOf(e):e}function ue(e,n){let i=0;for(const t of e.in)for(const[r,s]of n.entries()){if(t.lines&&!t.lines.includes(r))continue;const o=t.unit==="line"?1:s[t.unit];for(let f=0;f<o;f++)i=Math.max(i,re(t,f,o)+t.duration)}return i}function re(e,n,i){if(e.at){const t=_(n,i,e.order),r=Math.min(t,e.at.length-1);return e.at[r]+e.stagger*(t-r)}return e.start+e.stagger*_(n,i,e.order)}function ye(e,n,i,t){const r=re(e,n,i);return te[e.easing](Math.min(1,Math.max(0,(t-r)/e.duration)))}function nn(e,n,i,t,r=0){const s=Math.max(r,ue(e,n)),o=s/e.outSpeed;return e.out==="reverse"&&Number.isFinite(t)&&i>Math.max(s,t-o)?(t-i)*e.outSpeed:i}function tn(e,n,i,t,r,s){const o={...A,masked:!1};for(const f of e.in){if(f.unit!==n||f.lines&&!f.lines.includes(i))continue;const l=ye(f,t,r,s);f.mask&&l<1&&(o.masked=!0);for(const[d,b]of Object.entries(f.from)){const k=b+(A[d]-b)*l;le.includes(d)?o[d]+=k:o[d]*=k}}return o}const rn=Object.freeze({...A});function H(e,n){m(e,n),g(e,["start","duration","easing","from","spin","origin","stagger"],n),e.easing!==void 0&&!T.includes(e.easing)&&a(n+".easing",T.join("/")),e.origin!==void 0&&!["center","left","right","top","bottom"].includes(e.origin)&&a(n+".origin","center/left/right/top/bottom");const i=m(e.from??{},n+".from");g(i,["opacity","x","y","scale","scaleX","scaleY","rotate","wipeX","wipeY"],n+".from");const t={};for(const[r,s]of Object.entries(i))t[r]=c(s,F[r][0],F[r][1],`${n}.from.${r}`);return{start:c(e.start,0,10,n+".start",0),duration:c(e.duration,.02,5,n+".duration",.6),easing:e.easing??"easeOutCubic",from:t,spin:c(e.spin,-720,720,n+".spin",0),origin:e.origin??"center",...e.stagger?{stagger:c(e.stagger,0,2,n+".stagger")}:{}}}function sn(e,n=1){let i=0;for(const t of e?.layers||[])t.motion&&(i=Math.max(i,t.motion.start+t.motion.duration+(t.motion.stagger||0)*Math.max(0,n-1)));return i}function on(e,n){const i={...A};if(!e)return i;const t=te[e.easing](Math.min(1,Math.max(0,(n-e.start)/e.duration)));for(const[r,s]of Object.entries(e.from))i[r]=s+(A[r]-s)*t;return i.rotate+=e.spin*Math.max(0,n-e.start),i}function cn(e,n){return n===1?e:e.replace(/\d[\d.,]*\d|\d/,i=>{const t=/^\d{1,3}([.,]\d{3})+$/.test(i)?i.match(/[.,]/)[0]:"";if(!t&&/[.,]/.test(i)){const s=i.split(/[.,]/)[1].length;return Math.max(0,Number(i.replace(",","."))*n).toFixed(s).replace(".",i.includes(",")?",":".")}const r=String(Math.max(0,Math.round(Number(i.replace(/[.,]/g,""))*n)));return t?r.replace(/\B(?=(\d{3})+(?!\d))/g,t):r})}const he=Object.freeze({sparkle:["m12 2 2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4L12 2Z","m19 17 1 3 3 1-3 1-1 3-1-3-3-1 3-1 1-3Z"],pen:["M5 16 16 5l3 3L8 19H5v-3Z","m14 7 3 3M4 20h16"],target:["M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0Z","M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z","M12 1v4m0 14v4M1 12h4m14 0h4"],play:["M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2Z","m10 9 5 3-5 3V9Z"],bolt:["m13 2-8 11h6l-1 9 9-12h-6l0-8Z"],navigate:["M4 17 10 3l3 9 7-3-6 12-3-7-7 3Z"],chip:["M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2Z","M9 9h6v6h-6Z","M8 1v3m8-3v3M8 20v3m8-3v3M1 8h3m-3 8h3m16-8h3m-3 8h3"],data:["M4 6h16M4 12h10M4 18h16","m17 10 4 2-4 2"],building:["M3 21V8l9-5 9 5v13H3Z","M9 21v-7h6v7M8 9h1m6 0h1"],signal:["M4 16a8 8 0 0 1 16 0M7 16a5 5 0 0 1 10 0M10 16a2 2 0 0 1 4 0M12 20h.01"],office:["M3 21V4h11v17M14 9h7v12H3M7 8h3m-3 4h3m-3 4h3m10-3h-2m2 4h-2"],cloud:["M4 15a4 4 0 0 1 1-8 7 7 0 0 1 13 1 4 4 0 0 1 1 8H4Z","m9 19 3 3 3-3M12 13v9"],skyline:["M3 21V9l5-3v15M8 21V4l6-2v19m0-11 7-3v14M3 21h18"],network:["M2 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z","M18 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z","M18 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z","m6 11 12-4M6 13l12 4"],video:["M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2Z","m10 9 5 3-5 3V9Z","M7 22h10"],home:["m3 11 9-8 9 8v10H3V11Z","M9 21v-7h6v7M8 10h.01m8 0h.01"],compass:["M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0Z","m12 4 3 8-3 8-3-8 3-8ZM4 12h16"],grid:["M3 3h18v18H3V3ZM3 9h18M9 3v18M15 9v12"],chart:["M3 20h18M5 17l5-6 4 3 5-8","m16 6 3 0 0 3"],pin:["M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z","M9.5 10a2.5 2.5 0 1 0 5.0 0a2.5 2.5 0 1 0 -5.0 0Z"]}),we=Object.keys(he),be=/^#[0-9a-f]{6}$/i,ke=e=>[1,3,5].map(n=>parseInt(e.slice(n,n+2),16)/255),pe=e=>"#"+e.map(n=>Math.round(Math.max(0,Math.min(1,n))*255).toString(16).padStart(2,"0")).join("");function Me(e){const[n,i,t]=ke(e),r=Math.max(n,i,t),s=Math.min(n,i,t),o=(r+s)/2,f=r-s;if(!f)return[0,0,o];const l=f/(1-Math.abs(2*o-1));return[(r===n?((i-t)/f+6)%6:r===i?(t-n)/f+2:(n-i)/f+4)*60,l,o]}function P(e,n,i){const t=(1-Math.abs(2*i-1))*n,r=t*(1-Math.abs(e/60%2-1)),s=i-t/2,[o,f,l]=e<60?[t,r,0]:e<120?[r,t,0]:e<180?[0,t,r]:e<240?[0,r,t]:e<300?[r,0,t]:[t,0,r];return pe([o+s,f+s,l+s])}const p={yellow:55,cyan:185,magenta:315};function xe(e,n){if(n==="yellow")return p.yellow;if(n==="cyan")return p.cyan;if(n==="pink")return p.magenta;const i=(t,r)=>Math.abs((t-r+540)%360-180);for(const t of Object.values(p))if(i(e,t)<=15)return t;return e>=345||e<135?p.yellow:e<255?p.cyan:p.magenta}function Ae(e,{white:n=!1,toward:i="auto"}={}){if(!be.test(e))throw new Error("màu gốc phải là #rrggbb");const[t,r,s]=Me(e);if(r<.15)return s<.35?{type:"radial",gradient:["#5c5c5c","#0d0d0d"]}:{type:"radial",gradient:["#ffffff",n?"#d6d6d6":"#8a8a8a"],stops:[.25,1]};const o=P(t,Math.max(.75,r),Math.min(.5,Math.max(.32,s))),f=P(xe(t,i),1,.58);return n?{gradient:["#ffffff",f,o],stops:[0,.38,1],angle:90}:{gradient:[f,o],angle:90}}const Se=/^auto(\+white)?(?:-(yellow|cyan|pink))?:(#[0-9a-f]{6})$/i;function Oe(e){const n=typeof e=="string"?Se.exec(e):null;return n?Ae(n[3].toLowerCase(),{white:!!n[1],toward:(n[2]||"auto").toLowerCase()}):null}const B=8,I=["condensed","semi-condensed","normal","semi-expanded","expanded"],G=["halftone","lines","grain"],z=["atop","cut","keep"],$e=/^#[0-9a-f]{6}$/i,a=(e,n)=>{throw new Error(`${e}: ${n}`)},m=(e,n)=>((!e||typeof e!="object"||Array.isArray(e))&&a(n,"phải là object"),e),c=(e,n,i,t,r)=>e===void 0?r:((typeof e!="number"||!Number.isFinite(e)||e<n||e>i)&&a(t,`phải là số từ ${n} đến ${i}`),e),D=(e,n,i,{required:t=!1,fallback:r=""}={})=>e===void 0&&!t?r:((typeof e!="string"||t&&!e.trim()||e.length>n)&&a(i,`cần chuỗi tối đa ${n} ký tự`),e.trim()),Ee=["{color}","{accent}","{accent-hi}","{accent-lo}","{accent-bright}","{accent-deep}","{color-lo}","transparent"],u=(e,n)=>{if(Ee.includes(e)||typeof e=="string"&&$e.test(e))return e;a(n,"màu phải là #rrggbb, {color}, {accent}, {accent-hi}, {accent-lo}, {accent-bright}, {accent-deep}, {color-lo} hoặc transparent")},g=(e,n,i)=>{for(const t of Object.keys(e))n.includes(t)||a(i,`trường lạ "${t}"`)};function je(e,n){(!Array.isArray(e)||e.length!==4)&&a(n,"[x, y, w, h] theo tỉ lệ khung");const[i,t,r,s]=e.map((o,f)=>c(o,f<2?-.5:0,f<2?1.5:2,`${n}[${f}]`));return[i,t,r,s]}function x(e,n){if(typeof e=="string")return Oe(e)??u(e,n);m(e,n),g(e,["gradient","angle","type","stops"],n),(!Array.isArray(e.gradient)||e.gradient.length<2||e.gradient.length>4)&&a(n+".gradient","cần 2–4 màu"),e.type!==void 0&&!["linear","radial"].includes(e.type)&&a(n+".type","linear hoặc radial");const i={gradient:e.gradient.map((t,r)=>u(t,`${n}.gradient[${r}]`))};return e.type==="radial"?i.type="radial":i.angle=c(e.angle,0,360,n+".angle",90),e.stops!==void 0&&((!Array.isArray(e.stops)||e.stops.length!==i.gradient.length)&&a(n+".stops","mỗi màu một vị trí 0–1"),i.stops=e.stops.map((t,r)=>c(t,0,1,`${n}.stops[${r}]`)),i.stops.some((t,r)=>r&&t<i.stops[r-1])&&a(n+".stops","vị trí phải tăng dần")),i}function Te(e,n){if(e!==void 0)return(!Array.isArray(e)||!e.length||e.length>8||e.some(i=>!Number.isInteger(i)||i<0||i>7))&&a(n,"mảng chỉ số dòng 0–7"),[...new Set(e)]}function q(e,n){const i=m(e,n);return g(i,["color","blur","x","y"],n),{color:u(i.color??"#000000",n+".color"),blur:c(i.blur,0,1,n+".blur",.15),x:c(i.x,-.5,.5,n+".x",0),y:c(i.y,-.5,.5,n+".y",0)}}function X(e,n){const i=Te(e.lines,n+".lines");return{...i?{lines:i}:{},...e.motion!==void 0?{motion:H(e.motion,n+".motion")}:{}}}function Fe(e,n){m(e,n);const i={opacity:c(e.opacity,0,1,n+".opacity",1)};switch(e.type){case"box":{g(e,["type","fill","radius","padX","padY","opacity","per","stroke","shadow","skewX","lines","motion"],n),e.per!==void 0&&!["line","block"].includes(e.per)&&a(n+".per","line hoặc block");const t={type:"box",fill:x(e.fill??"{accent}",n+".fill"),radius:c(e.radius,0,1,n+".radius",.15),padX:c(e.padX,0,1.5,n+".padX",.3),padY:c(e.padY,0,1,n+".padY",.12),per:e.per||"line",...i};if(e.stroke!==void 0){const r=m(e.stroke,n+".stroke");g(r,["color","width"],n+".stroke"),t.stroke={color:u(r.color??"{accent}",n+".stroke.color"),width:c(r.width,.01,.3,n+".stroke.width",.05)}}return e.shadow!==void 0&&(t.shadow=q(e.shadow,n+".shadow")),e.skewX!==void 0&&(t.skewX=c(e.skewX,-30,30,n+".skewX")),{...t,...X(e,n)}}case"text":{g(e,["type","fill","lineFills","stroke","shadow","offset","opacity","shine","flicker","lines","motion","reflection","innerGlow","highlights"],n);const t={type:"text",fill:x(e.fill??"{color}",n+".fill"),...i,...X(e,n)};if(e.shine!==void 0){const r=m(e.shine,n+".shine");g(r,["color","width","angle","start","duration","every"],n+".shine"),t.shine={color:u(r.color??"#ffffff",n+".shine.color"),width:c(r.width,.1,4,n+".shine.width",.8),angle:c(r.angle,-60,60,n+".shine.angle",20),start:c(r.start,0,10,n+".shine.start",.6),duration:c(r.duration,.1,5,n+".shine.duration",.8),every:c(r.every,0,10,n+".shine.every",0)}}if(e.flicker!==void 0&&(t.flicker=c(e.flicker,0,1,n+".flicker")),e.lineFills!==void 0&&((!Array.isArray(e.lineFills)||!e.lineFills.length||e.lineFills.length>4)&&a(n+".lineFills","cần 1–4 màu"),t.lineFills=e.lineFills.map((r,s)=>u(r,`${n}.lineFills[${s}]`))),e.stroke!==void 0){const r=m(e.stroke,n+".stroke");g(r,["color","width"],n+".stroke"),t.stroke={color:u(r.color??"{accent}",n+".stroke.color"),width:c(r.width,.01,.3,n+".stroke.width",.08)}}if(e.shadow!==void 0&&(t.shadow=q(e.shadow,n+".shadow")),e.offset!==void 0){const r=m(e.offset,n+".offset");g(r,["x","y"],n+".offset"),t.offset={x:c(r.x,-.5,.5,n+".offset.x",0),y:c(r.y,-.5,.5,n+".offset.y",0)}}if(e.reflection!==void 0){const r=m(e.reflection,n+".reflection");g(r,["opacity","gap","fade"],n+".reflection"),t.reflection={opacity:c(r.opacity,.05,1,n+".reflection.opacity",.35),gap:c(r.gap,-.3,.6,n+".reflection.gap",.04),fade:c(r.fade,.15,1,n+".reflection.fade",.7)}}if(e.innerGlow!==void 0){const r=m(e.innerGlow,n+".innerGlow");g(r,["color","blur"],n+".innerGlow"),t.innerGlow={color:u(r.color??"#ffffff",n+".innerGlow.color"),blur:c(r.blur,.02,.5,n+".innerGlow.blur",.12)}}return e.highlights!==void 0&&((!Array.isArray(e.highlights)||!e.highlights.length||e.highlights.length>4)&&a(n+".highlights","cần 1–4 nhóm từ"),t.highlights=e.highlights.map((r,s)=>{const o=`${n}.highlights[${s}]`;return m(r,o),g(r,["words","fill"],o),(!Array.isArray(r.words)||!r.words.length||r.words.length>40||r.words.some(f=>!Number.isInteger(f)||f<0||f>199))&&a(o+".words","số thứ tự từ 0–199"),{words:[...new Set(r.words)],fill:x(r.fill??"{accent}",o+".fill")}})),t}case"underline":return g(e,["type","fill","height","width","offsetY","opacity","line","style","lines","motion"],n),e.line!==void 0&&!["last","all"].includes(e.line)&&a(n+".line","last hoặc all"),e.style!==void 0&&!["bar","swash"].includes(e.style)&&a(n+".style","bar hoặc swash"),{type:"underline",fill:x(e.fill??"{accent}",n+".fill"),height:c(e.height,.02,.4,n+".height",.07),width:c(e.width,.1,1.4,n+".width",1),offsetY:c(e.offsetY,-1.2,1.2,n+".offsetY",.55),line:e.line||"last",...e.style==="swash"?{style:"swash"}:{},...i,...X(e,n)};case"shape":{g(e,["type","shape","box","fill","stroke","radius","skewX","rotate","blur","opacity","motion"],n),["rect","ellipse","glow"].includes(e.shape)||a(n+".shape","rect/ellipse/glow");const t={type:"shape",shape:e.shape,box:je(e.box,n+".box"),radius:c(e.radius,0,.5,n+".radius",0),skewX:c(e.skewX,-45,45,n+".skewX",0),rotate:c(e.rotate,-180,180,n+".rotate",0),blur:c(e.blur,0,.2,n+".blur",0),...i};if(e.fill!==void 0&&(t.fill=x(e.fill,n+".fill")),e.stroke!==void 0){const r=m(e.stroke,n+".stroke");g(r,["color","width","dash"],n+".stroke"),t.stroke={color:u(r.color??"{accent}",n+".stroke.color"),width:c(r.width,.5,12,n+".stroke.width",1.5)},r.dash!==void 0&&((!Array.isArray(r.dash)||r.dash.length!==2)&&a(n+".stroke.dash","[nét, khoảng]"),t.stroke.dash=r.dash.map((s,o)=>c(s,1,60,`${n}.stroke.dash[${o}]`)))}return!t.fill&&!t.stroke&&a(n,"shape cần fill hoặc stroke"),e.motion!==void 0&&(t.motion=H(e.motion,n+".motion")),t}case"icon":{g(e,["type","name","center","size","color","width","badge","badgeFill","badgeStroke","glow","rotate","opacity","motion"],n),we.includes(e.name)||a(n+".name","icon không có trong bộ dựng sẵn"),(!Array.isArray(e.center)||e.center.length!==2)&&a(n+".center","[x, y]"),e.badge!==void 0&&!["none","circle","square","rounded","diamond"].includes(e.badge)&&a(n+".badge","none/circle/square/rounded/diamond");const t={type:"icon",name:e.name,center:e.center.map((r,s)=>c(r,-.2,1.2,`${n}.center[${s}]`)),size:c(e.size,.02,.4,n+".size",.12),color:u(e.color??"{accent}",n+".color"),width:c(e.width,.5,4,n+".width",2),badge:e.badge??"none",rotate:c(e.rotate,-180,180,n+".rotate",0),glow:c(e.glow,0,1,n+".glow",0),...i};return e.badgeFill!==void 0&&(t.badgeFill=u(e.badgeFill,n+".badgeFill")),e.badgeStroke!==void 0&&(t.badgeStroke=u(e.badgeStroke,n+".badgeStroke")),e.motion!==void 0&&(t.motion=H(e.motion,n+".motion")),t}case"texture":return g(e,["type","pattern","mode","color","scale","size","angle","fade","fadeAngle","opacity"],n),G.includes(e.pattern)||a(n+".pattern",G.join("/")),e.mode!==void 0&&!z.includes(e.mode)&&a(n+".mode",z.join("/")),{type:"texture",pattern:e.pattern,mode:e.mode??"atop",color:u(e.color??"#000000",n+".color"),scale:c(e.scale,2,60,n+".scale",8),size:c(e.size,.05,1,n+".size",.5),angle:c(e.angle,-90,90,n+".angle",45),fade:c(e.fade,0,1,n+".fade",0),fadeAngle:c(e.fadeAngle,-180,180,n+".fadeAngle",90),...i};default:a(n+".type","chỉ hỗ trợ box, text, underline, shape, icon, texture")}}const ie=[400,500,600,700,800,900],Ie=["left","center","right"];function Ne(e,n){return m(e,n),g(e,["scale","fill","font","italic","weight","tracking","stretch","x","y","rotate","align","side","label","labelEn"],n),e.align!==void 0&&!Ie.includes(e.align)&&a(n+".align","left/center/right"),e.side!==void 0&&!["left","right"].includes(e.side)&&a(n+".side","left/right"),e.font!==void 0&&!de(e.font)&&a(n+".font","font không có trong danh sách Timeline hay font của bạn"),e.italic!==void 0&&typeof e.italic!="boolean"&&a(n+".italic","true/false"),e.weight!==void 0&&!ie.includes(e.weight)&&a(n+".weight","400–900"),e.stretch!==void 0&&!I.includes(e.stretch)&&a(n+".stretch",I.join("/")),{scale:c(e.scale,.2,3,n+".scale",1),...e.fill!==void 0?{fill:x(e.fill,n+".fill")}:{},...e.font!==void 0?{font:e.font}:{},...e.italic?{italic:!0}:{},...e.weight!==void 0?{weight:e.weight}:{},...e.tracking!==void 0?{tracking:c(e.tracking,-.15,.6,n+".tracking")}:{},...e.stretch!==void 0?{stretch:e.stretch}:{},...e.x!==void 0?{x:c(e.x,-4,4,n+".x")}:{},...e.y!==void 0?{y:c(e.y,-4,4,n+".y")}:{},...e.rotate!==void 0?{rotate:c(e.rotate,-30,30,n+".rotate")}:{},...e.align!==void 0?{align:e.align}:{},...e.side!==void 0?{side:e.side}:{},...e.label!==void 0?{label:D(e.label,24,n+".label",{required:!0})}:{},...e.labelEn!==void 0?{labelEn:D(e.labelEn,24,n+".labelEn",{required:!0})}:{}}}function an(e,n="design"){m(e,n),g(e,["weight","lineHeight","uppercase","layers","lines","stack","gap","stretch","tracking","shiftY","shiftX","maxWidth","wrap","linesFrom","path"],n),e.wrap!==void 0&&!["char","word"].includes(e.wrap)&&a(n+".wrap","char hoặc word"),e.linesFrom!==void 0&&!["start","end"].includes(e.linesFrom)&&a(n+".linesFrom","start hoặc end"),e.stack!==void 0&&!["center","ink"].includes(e.stack)&&a(n+".stack","center hoặc ink"),e.stretch!==void 0&&!I.includes(e.stretch)&&a(n+".stretch",I.join("/"));let i;return e.lines!==void 0&&((!Array.isArray(e.lines)||!e.lines.length||e.lines.length>8)&&a(n+".lines","cần 1–8 dòng"),i=e.lines.map((t,r)=>Ne(t,`${n}.lines[${r}]`))),(!Array.isArray(e.layers)||!e.layers.length||e.layers.length>B)&&a(n+".layers",`cần 1–${B} lớp`),e.layers.some(t=>t?.type==="text")||a(n+".layers","cần ít nhất 1 lớp text"),e.weight!==void 0&&!ie.includes(e.weight)&&a(n+".weight","400–900"),e.uppercase!==void 0&&typeof e.uppercase!="boolean"&&a(n+".uppercase","true/false"),{weight:e.weight??700,lineHeight:c(e.lineHeight,1.25,2,n+".lineHeight",1.32),uppercase:e.uppercase??!1,layers:e.layers.map((t,r)=>Fe(t,`${n}.layers[${r}]`)),...i?{lines:i}:{},...e.stack?{stack:e.stack}:{},...e.gap!==void 0?{gap:c(e.gap,0,.5,n+".gap")}:{},...e.stretch?{stretch:e.stretch}:{},...e.tracking!==void 0?{tracking:c(e.tracking,-.15,.6,n+".tracking")}:{},...e.shiftY!==void 0?{shiftY:c(e.shiftY,-.3,.3,n+".shiftY")}:{},...e.shiftX!==void 0?{shiftX:c(e.shiftX,-.3,.3,n+".shiftX")}:{},...e.maxWidth!==void 0?{maxWidth:c(e.maxWidth,.15,.9,n+".maxWidth")}:{},...e.wrap==="word"?{wrap:"word"}:{},...e.linesFrom==="end"?{linesFrom:"end"}:{},...e.path!=null?{path:se(e.path,n+".path")}:{}}}function fn(e,n,i){const t=e?.lines;if(t)return t[e.linesFrom==="end"?t.length-(i-n):n]}const U=["chars","charsNoSpace","words","lines"],W=["square","rampUp","rampDown","triangle","round","smooth"],V=["add","subtract","intersect"],K=["linear","easeIn","easeOut","easeInOut","hold"],Q=8,Xe=["start","end","offset","amount"],He=/^#[0-9a-f]{6}$/i,$={x:[-2e3,2e3],y:[-2e3,2e3],scale:[0,1e3],rotate:[-3600,3600],opacity:[0,100],tracking:[-200,500],fill:null,stroke:[0,50],strokeColor:null,blur:[0,200],skew:[-85,85]},Ce=(e,n,i,t)=>((!Array.isArray(e)||e.length>60)&&a(n,"cần mảng ≤ 60 key"),e.map((s,o)=>(m(s,`${n}[${o}]`),g(s,["time","value","ease"],`${n}[${o}]`),s.ease!==void 0&&!K.includes(s.ease)&&a(`${n}[${o}].ease`,K.join("/")),{time:c(s.time,0,600,`${n}[${o}].time`),value:c(s.value,i,t,`${n}[${o}].value`),...s.ease&&s.ease!=="linear"?{ease:s.ease}:{}})).sort((s,o)=>s.time-o.time));function Le(e,n){m(e,n);const i=e.type??"range";["range","wiggly"].includes(i)||a(n+".type","range/wiggly"),e.basedOn!==void 0&&!U.includes(e.basedOn)&&a(n+".basedOn",U.join("/")),e.mode!==void 0&&!V.includes(e.mode)&&a(n+".mode",V.join("/"));const t={type:i,basedOn:e.basedOn??"chars",mode:e.mode??(i==="wiggly"?"intersect":"add"),seed:c(e.seed,0,1e6,n+".seed",1)};if(Number.isInteger(t.seed)||a(n+".seed","số nguyên"),i==="wiggly")return g(e,["type","basedOn","mode","seed","maxAmount","minAmount","wiggles","correlation"],n),{...t,maxAmount:c(e.maxAmount,-100,100,n+".maxAmount",100),minAmount:c(e.minAmount,-100,100,n+".minAmount",-100),wiggles:c(e.wiggles,0,30,n+".wiggles",2),correlation:c(e.correlation,0,100,n+".correlation",50)};g(e,["type","basedOn","mode","seed","start","end","offset","amount","shape","easeHigh","easeLow","smoothness","random","keys","loop"],n),e.shape!==void 0&&!W.includes(e.shape)&&a(n+".shape",W.join("/")),e.random!==void 0&&typeof e.random!="boolean"&&a(n+".random","true/false"),e.loop!==void 0&&typeof e.loop!="boolean"&&a(n+".loop","true/false");const r={...t,start:c(e.start,0,100,n+".start",0),end:c(e.end,0,100,n+".end",100),offset:c(e.offset,-200,200,n+".offset",0),amount:c(e.amount,-100,100,n+".amount",100),shape:e.shape??"square",easeHigh:c(e.easeHigh,-100,100,n+".easeHigh",0),easeLow:c(e.easeLow,-100,100,n+".easeLow",0),smoothness:c(e.smoothness,0,100,n+".smoothness",100),random:e.random===!0,...e.loop===!0?{loop:!0}:{}};if(e.keys!==void 0&&e.keys!==null){m(e.keys,n+".keys"),g(e.keys,Xe,n+".keys");const s={};for(const[o,f]of Object.entries(e.keys)){const l=o==="offset"?[-200,200]:o==="amount"?[-100,100]:[0,100],d=Ce(f,`${n}.keys.${o}`,l[0],l[1]);d.length&&(s[o]=d)}Object.keys(s).length&&(r.keys=s)}return r}function Re(e,n="animator"){m(e,n),g(e,["name","properties","selectors"],n),e.name!==void 0&&(typeof e.name!="string"||e.name.length>40)&&a(n+".name","chuỗi ≤ 40 ký tự");const i=m(e.properties??{},n+".properties");g(i,Object.keys($),n+".properties");const t={};for(const[s,o]of Object.entries(i))o!=null&&($[s]?t[s]=c(o,$[s][0],$[s][1],`${n}.properties.${s}`):((typeof o!="string"||!He.test(o))&&a(`${n}.properties.${s}`,"#RRGGBB"),t[s]=o.toLowerCase()));Object.keys(t).some(s=>s!=="strokeColor")||a(n+".properties","cần ít nhất 1 thuộc tính");const r=e.selectors??[{}];return(!Array.isArray(r)||!r.length||r.length>4)&&a(n+".selectors","cần 1–4 selector"),{...e.name?{name:e.name}:{},properties:t,selectors:r.map((s,o)=>Le(s,`${n}.selectors[${o}]`))}}function Ze(e,n="animators"){return e==null?[]:((!Array.isArray(e)||e.length>Q)&&a(n,`cần mảng ≤ ${Q} animator`),e.map((i,t)=>Re(i,`${n}[${t}]`)))}const J=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter("vi",{granularity:"grapheme"}):null;function Ye(e){const n=String(e??"").normalize("NFC");if(J)return Array.from(J.segment(n),t=>t.segment);const i=[];for(const t of Array.from(n))i.length&&/\p{M}/u.test(t)?i[i.length-1]+=t:i.push(t);return i}function dn(e){const n=[];let i=0,t=-1,r=-1;return e.forEach((s,o)=>{let f=!1;for(const l of Ye(s)){const d=!/\S/u.test(l);d?f=!1:(t++,f||(r++,f=!0)),n.push({row:o,text:l,space:d,chars:i++,charsNoSpace:Math.max(0,t),words:Math.max(0,r),lines:o})}}),{units:n,counts:{chars:i,charsNoSpace:t+1,words:r+1,lines:e.length}}}const _e={linear:e=>e,easeIn:e=>e*e*e,easeOut:e=>1-(1-e)**3,easeInOut:e=>e<.5?4*e**3:1-(-2*e+2)**3/2};function E(e,n,i,t=!1){if(!e?.length)return i;if(t&&e.length>1){const r=e[0].time,s=e.at(-1).time-r;s>1e-6&&n>r&&(n=r+(n-r)%s)}if(n<=e[0].time)return e[0].value;for(let r=1;r<e.length;r++){const s=e[r-1],o=e[r];if(n<=o.time){if(s.ease==="hold")return s.value;const f=(n-s.time)/Math.max(1e-9,o.time-s.time);return s.value+(o.value-s.value)*_e[s.ease??"linear"](f)}}return e.at(-1).value}const Pe=e=>()=>{e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296},j=new Map;function Be(e,n){const i=e+":"+n;let t=j.get(i);if(t)return t;const r=Pe(n*7919+17);t=[...Array(e).keys()];for(let s=e-1;s>0;s--){const o=Math.floor(r()*(s+1));[t[s],t[o]]=[t[o],t[s]]}return j.size>200&&j.clear(),j.set(i,t),t}const M=e=>Math.min(1,Math.max(0,e));function Ge(e,n,i){const t=n/100,r=i/100;return e=t>=0?e**(1+2*t):1-(1-e)**(1-2*t),r>=0?1-(1-e)**(1+2*r):e**(1-2*r)}function ze(e,n,i,t){if(i<=0)return 0;const r=e.random?Be(i,e.seed)[n]:n,s=e.keys||{},o=!!e.loop,f=E(s.start,t,e.start,o)/100,l=E(s.end,t,e.end,o)/100,d=E(s.offset,t,e.offset,o)/100,b=E(s.amount,t,e.amount,o)/100,k=Math.min(f,l)+d,L=Math.max(f,l)+d;let h;if(e.shape==="square"){const S=r/i,O=(r+1)/i,y=M((Math.min(O,L)-Math.max(S,k))*i),N=e.smoothness/100;h=N>=1?y:N<=0?y>.5+1e-9?1:y<.5-1e-9?0:.5:M((y-.5)/N+.5)}else{const S=(r+.5)/i,O=L-k,y=O>1e-9?(S-k)/O:S<k?-1:2;e.shape==="rampUp"?h=M(y):e.shape==="rampDown"?h=1-M(y):y<0||y>1?h=0:e.shape==="triangle"?h=1-Math.abs(2*y-1):e.shape==="round"?h=Math.sqrt(Math.max(0,1-(2*y-1)**2)):h=(1-Math.cos(2*Math.PI*y))/2}return(e.easeHigh||e.easeLow)&&(h=Ge(M(h),e.easeLow,e.easeHigh)),h*b}const v=(e,n)=>{const i=Math.sin(e*127.1+n*311.7)*43758.5453;return(i-Math.floor(i))*2-1},ee=(e,n)=>{const i=Math.floor(e),t=e-i,r=t*t*(3-2*t);return v(i,n)*(1-r)+v(i+1,n)*r};function De(e,n,i,t){const r=t*e.wiggles,s=e.correlation/100,o=s*ee(r,e.seed)+(1-s)*ee(r+n*3.17,e.seed+1+n*13.7);return(e.minAmount+(o+1)/2*(e.maxAmount-e.minAmount))/100}function qe(e,n,i,t){let r=0;return e.selectors.forEach((s,o)=>{const f=i[s.basedOn],l=n[s.basedOn],d=s.type==="wiggly"?De(s,l,f,t):ze(s,l,f,t);r=o===0?d:s.mode==="intersect"?r*d:s.mode==="subtract"?r-d:r+d}),Math.max(-1,Math.min(1,r))}const Ue=Object.freeze({x:0,y:0,scale:1,rotate:0,opacity:1,tracking:0,blur:0,skew:0,stroke:0,strokeColor:null,fill:null,fillAmount:0}),We=(e,n,i)=>{const t=parseInt(e.slice(1),16),r=parseInt(n.slice(1),16);return"#"+[16,8,0].map(s=>Math.round((t>>s&255)+((r>>s&255)-(t>>s&255))*i).toString(16).padStart(2,"0")).join("")};function ln(e,n,i){const{units:t,counts:r}=n;return t.map(s=>{const o={...Ue};for(const f of e){const l=qe(f,s,r,i);if(Math.abs(l)<1e-6)continue;const d=f.properties;if(d.x&&(o.x+=d.x*l),d.y&&(o.y+=d.y*l),d.rotate&&(o.rotate+=d.rotate*l),d.tracking&&(o.tracking+=d.tracking*l),d.blur&&(o.blur+=d.blur*l),d.skew&&(o.skew+=d.skew*l),d.stroke&&(o.stroke+=d.stroke*l,o.strokeColor=d.strokeColor??o.strokeColor??"#000000"),d.scale!==void 0&&(o.scale*=Math.max(0,1+(d.scale/100-1)*l)),d.opacity!==void 0&&(o.opacity*=M(1+(d.opacity/100-1)*l)),d.fill){const b=M(Math.abs(l));o.fill=o.fill?We(o.fill,d.fill,b):d.fill,o.fillAmount=o.fillAmount+(1-o.fillAmount)*b}}return o.blur=Math.max(0,o.blur),o.stroke=Math.max(0,o.stroke),o})}const Ve=e=>Math.round(e*1e3)/1e3,Ke=e=>Ve(Math.max(.3,Math.min(1.6,(e||2)*.5))),w=(e,n,i,t)=>[{time:0,value:e,...t?{ease:t}:{}},{time:i,value:n}],C={"type-on":e=>[{name:"Type on",properties:{opacity:0},selectors:[{basedOn:"chars",shape:"square",smoothness:0,start:0,end:100,keys:{start:w(0,100,e)}}]}],"fade-up-chars":e=>[{name:"Fade up",properties:{opacity:0,y:18},selectors:[{basedOn:"charsNoSpace",shape:"rampUp",start:0,end:25,keys:{offset:w(-25,100,e,"easeOut")}}]}],"cascade-bottom":e=>[{name:"Cascade",properties:{y:160,opacity:0,rotate:12},selectors:[{basedOn:"charsNoSpace",shape:"rampUp",start:0,end:35,easeHigh:60,keys:{offset:w(-35,100,e,"easeOut")}}]}],"scale-pop-words":e=>[{name:"Pop in",properties:{scale:0,opacity:0},selectors:[{basedOn:"words",shape:"rampUp",start:0,end:20,keys:{offset:w(-20,100,e)}}]},{name:"Overshoot",properties:{scale:135},selectors:[{basedOn:"words",shape:"triangle",start:0,end:30,keys:{offset:w(-45,100,e)}}]}],"blur-in":e=>[{name:"Blur in",properties:{blur:22,opacity:0,scale:125},selectors:[{basedOn:"charsNoSpace",shape:"rampUp",start:0,end:40,keys:{offset:w(-40,100,e,"easeOut")}}]}],"tracking-in":e=>[{name:"Tracking in",properties:{tracking:48,opacity:0},selectors:[{basedOn:"chars",shape:"square",start:0,end:100,keys:{amount:w(100,0,e,"easeOut")}}]}],"random-fade":e=>[{name:"Random fade",properties:{opacity:0},selectors:[{basedOn:"charsNoSpace",shape:"square",random:!0,seed:7,start:0,end:100,keys:{start:w(0,100,e)}}]}],wave:e=>[{name:"Wave",properties:{y:-28},selectors:[{basedOn:"chars",shape:"smooth",start:0,end:34,loop:!0,keys:{offset:w(-34,100,Math.max(1.2,Math.min(2.4,e*2)))}}]}]},Qe=Object.freeze(Object.keys(C));function gn(e,n=2){return Object.hasOwn(C,e)||a("preset",Qe.join("/")),Ze(C[e](Ke(n)),`preset.${e}`)}export{he as A,U as B,tn as C,$e as H,Q as M,$ as P,rn as R,W as S,oe as T,Ae as a,Qe as b,V as c,m as d,g as e,a as f,ae as g,en as h,ne as i,an as j,E as k,fn as l,ue as m,c as n,sn as o,gn as p,de as q,Re as r,D as s,Ze as t,ve as u,nn as v,dn as w,ln as x,on as y,cn as z};
@@ -1 +1 @@
1
- import{it as h,dI as y,ez as o0,fo as l0,eB as n0,eU as i0,iu as s0,iv as f0,eF as c0,eq as d0,eu as h0}from"./remote-DXG553d8.js";const G=(e,a,l,t)=>({p:[e,a,l,t]}),b0={thien:{shapes:[{e:[0,.68,.17,.22],dim:!0},{p:[[-.47,.03],[.47,.03],[.36,.2],[.2,.3],[-.2,.3],[-.36,.2]]},{e:[-.33,.11,.13,.08]},{e:[.33,.11,.13,.08]},{p:[[-.21,.22],[.21,.22],[.25,.5],[.18,.65],[-.18,.65],[-.25,.5]]},{e:[0,.62,.25,.055]},G([-.27,.64],[-.17,.62],[-.19,.42],[-.3,.44]),G([.27,.64],[.17,.62],[.19,.42],[.3,.44]),G([-.3,.44],[-.19,.41],[-.015,.49],[-.03,.56]),G([.3,.44],[.19,.41],[.015,.49],[.03,.56]),{e:[0,.55,.036,.08]},G([-.045,.64],[.045,.64],[.04,.72],[-.04,.72]),{e:[0,.78,.074,.094]},{e:[0,.885,.034,.036]}],eyes:[[-.028,.785],[.028,.785]],brow:[0,.825],head:[0,.79],chest:[0,.52],heart:[0,.48],folds:[[[-.4,.08],[-.15,.2],[0,.12]],[[.4,.08],[.15,.2],[0,.12]],[[-.12,.62],[0,.5],[.12,.62]],[[-.2,.3],[0,.34],[.2,.3]],[[-.24,.48],[-.2,.36],[-.12,.3]],[[.24,.48],[.2,.36],[.12,.3]]]},dung:{shapes:[{e:[0,.76,.13,.16],dim:!0},{p:[[-.24,0],[.24,0],[.15,.42],[-.15,.42]]},{p:[[-.14,.4],[.14,.4],[.18,.7],[-.18,.7]]},{e:[0,.705,.18,.04]},G([-.17,.73],[-.12,.67],[-.4,.53],[-.43,.59]),G([.17,.73],[.12,.67],[.4,.53],[.43,.59]),{p:[[-.28,.63],[-.5,.58],[-.49,.36],[-.34,.47]]},{p:[[.28,.63],[.5,.58],[.49,.36],[.34,.47]]},G([-.035,.72],[.035,.72],[.032,.79],[-.032,.79]),{e:[0,.845,.055,.07]},{e:[0,.925,.026,.026]}],eyes:[[-.02,.848],[.02,.848]],brow:[0,.875],head:[0,.85],chest:[0,.6],heart:[0,.58],folds:[[[-.08,.7],[0,.6],[.08,.7]],[[-.15,.42],[0,.45],[.15,.42]],[[-.08,.4],[-.12,.2],[-.18,.02]],[[.08,.4],[.12,.2],[.18,.02]],[[-.3,.6],[-.4,.48],[-.47,.4]],[[.3,.6],[.4,.48],[.47,.4]]]},ban_than:{shapes:[{e:[0,.6,.32,.33],dim:!0},{p:[[-.49,0],[.49,0],[.44,.28],[.24,.41],[-.24,.41],[-.44,.28]]},G([-.4,.22],[-.3,.12],[-.03,.12],[-.05,.22]),G([.4,.22],[.3,.12],[.03,.12],[.05,.22]),{e:[0,.2,.055,.14]},G([-.07,.39],[.07,.39],[.065,.5],[-.065,.5]),{e:[0,.64,.14,.17]},{e:[0,.83,.05,.05]}],eyes:[[-.052,.65],[.052,.65]],brow:[0,.715],head:[0,.66],chest:[0,.3],heart:[0,.27],beads:[[-.17,.37],[-.085,.335],[0,.32],[.085,.335],[.17,.37]],folds:[[[-.22,.41],[0,.26],[.22,.41]],[[-.44,.28],[-.36,.14],[-.3,0]],[[.44,.28],[.36,.14],[.3,0]]]}},q=256,j=7;function H(e,a,l,t,o){const r=e.createRadialGradient(a,l,0,a,l,t);for(const[n,s]of o)r.addColorStop(n,`rgba(255,255,255,${s})`);e.fillStyle=r,e.beginPath(),e.arc(a,l,t,0,h),e.fill()}const m0=(e,a)=>H(e,a,a,a,[[0,1],[.12,.75],[.3,.3],[.55,.09],[.8,.02],[1,0]]);function u0(e,a){H(e,a,a,a*.5,[[0,1],[.25,.7],[.6,.15],[1,0]]),e.globalCompositeOperation="lighter";for(const[l,t,o]of[[0,.98,5],[Math.PI/2,.98,5],[Math.PI/4,.5,2.5],[-Math.PI/4,.5,2.5]]){e.save(),e.translate(a,a),e.rotate(l);const r=e.createLinearGradient(-a*t,0,a*t,0);r.addColorStop(0,"rgba(255,255,255,0)"),r.addColorStop(.5,"rgba(255,255,255,0.95)"),r.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=r,e.beginPath(),e.ellipse(0,0,a*t,o,0,0,h),e.fill(),e.restore()}e.globalCompositeOperation="source-over"}function V(e,a,l,t=5){let o=0,r=.5,n=0,s=1;const i=d=>d*d*(3-2*d);for(let d=0;d<t;d++){const u=e*s,T=a*s,f=Math.floor(u),p=Math.floor(T),P=i(u-f),b=i(T-p),x=(v,c)=>y(l+d*131,(v&1023)*1024+(c&1023),7),m=x(f,p)+(x(f+1,p)-x(f,p))*P,S=x(f,p+1)+(x(f+1,p+1)-x(f,p+1))*P;o+=(m+(S-m)*b)*r,n+=r,r*=.5,s*=2.03}return o/n}function S0(e,a){const l=a*2,t=e.createImageData(l,l),o=Array.from({length:9},(n,s)=>{const i=y(23,s,1)*h,d=s===0?0:.18+.2*y(23,s,2);return[Math.cos(i)*d,Math.sin(i)*d*.8+.04,.3+.16*y(23,s,3)]}),r=(n,s)=>{let i=0;for(const[d,u,T]of o){const f=((n-d)**2+(s-u)**2)/(T*T);f<1&&(i=Math.max(i,(1-f)**1.3))}return i};for(let n=0;n<l;n++)for(let s=0;s<l;s++){const i=(s/l-.5)*2,d=(n/l-.5)*2,u=V(i*2.2+4,d*2.2+4,11),T=V(i*5+9,d*5+9,17,3),f=r(i+(u-.5)*.35,d+(T-.5)*.25),p=Math.min(1,Math.max(0,(f*1.35+(u-.5)*.9-.12)*1.6))*Math.max(0,1-Math.hypot(i,d)**6),P=r(i,d-.07),b=Math.min(1,Math.max(.35,.68+(f-P)*1.6+(.5-d*.5)*.22+(u-.5)*.35)),x=(n*l+s)*4,m=p*(.55+.45*T);t.data[x]=t.data[x+1]=t.data[x+2]=Math.round(b*255),t.data[x+3]=Math.round(Math.min(1,m)*255)}e.putImageData(t,0,0)}function p0(e,a,l=.12,t=.8){const o=e.createRadialGradient(a,a,0,a,a,a),r=t;o.addColorStop(0,"rgba(255,255,255,0)"),o.addColorStop(Math.max(0,r-l*2.2),"rgba(255,255,255,0.02)"),o.addColorStop(Math.max(0,r-l*.6),"rgba(255,255,255,0.6)"),o.addColorStop(r,"rgba(255,255,255,1)"),o.addColorStop(Math.min(1,r+l*.6),"rgba(255,255,255,0.5)"),o.addColorStop(Math.min(1,r+l*1.4),"rgba(255,255,255,0)"),o.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=o,e.fillRect(0,0,a*2,a*2)}function M0(e,a){const l=e.createRadialGradient(a,a,0,a,a,a);l.addColorStop(0,"rgba(255,255,255,0)"),l.addColorStop(.5,"rgba(255,255,255,0.05)"),l.addColorStop(.72,"rgba(255,255,255,0.22)"),l.addColorStop(.88,"rgba(255,255,255,0.95)"),l.addColorStop(.94,"rgba(255,255,255,0.4)"),l.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=l,e.fillRect(0,0,a*2,a*2)}function v0(e,a){e.save(),e.translate(a,a);const l=new Path2D;l.moveTo(0,a*.86),l.bezierCurveTo(a*.62,a*.5,a*.62,-a*.46,a*.1,-a*.88),l.lineTo(0,-a*.7),l.lineTo(-a*.1,-a*.88),l.bezierCurveTo(-a*.62,-a*.46,-a*.62,a*.5,0,a*.86);const t=e.createLinearGradient(0,a*.86,0,-a*.88);t.addColorStop(0,"rgba(210,210,210,1)"),t.addColorStop(.5,"rgba(255,255,255,1)"),t.addColorStop(1,"rgba(235,235,235,1)"),e.fillStyle=t,e.fill(l),e.strokeStyle="rgba(190,190,190,0.7)",e.lineWidth=3,e.beginPath(),e.moveTo(0,a*.8),e.quadraticCurveTo(a*.04,0,0,-a*.62),e.stroke(),e.restore()}function T0(e,a){e.save(),e.translate(a,a);const l=new Path2D;l.moveTo(0,a*.9),l.bezierCurveTo(a*.7,a*.45,a*.62,-a*.4,0,-a*.92),l.bezierCurveTo(-a*.62,-a*.4,-a*.7,a*.45,0,a*.9);const t=e.createLinearGradient(-a*.5,0,a*.5,0);t.addColorStop(0,"rgba(225,225,225,1)"),t.addColorStop(.5,"rgba(255,255,255,1)"),t.addColorStop(1,"rgba(205,205,205,1)"),e.fillStyle=t,e.fill(l),e.strokeStyle="rgba(170,170,170,0.9)",e.lineWidth=4,e.beginPath(),e.moveTo(0,a*.88),e.lineTo(0,-a*.8),e.stroke(),e.lineWidth=2;for(let o=0;o<5;o++){const r=a*(.6-o*.28);e.beginPath(),e.moveTo(0,r),e.lineTo(a*.4,r-a*.2),e.moveTo(0,r),e.lineTo(-a*.4,r-a*.2),e.stroke()}e.restore()}function P0(e,a){const l=a*2,t=a*2,o=e.createImageData(l,t);for(let r=0;r<t;r++)for(let n=0;n<l;n++){const s=(n/l-.5)*2,i=r/t,d=Math.exp(-s*s*7.5),u=Math.pow(Math.max(0,1-i),1.6)*Math.min(1,i*14+.05),T=Math.max(0,Math.min(1,d*u)),f=(r*l+n)*4;o.data[f]=255,o.data[f+1]=255,o.data[f+2]=255,o.data[f+3]=Math.round(T*255)}e.putImageData(o,0,0)}function C0(e,a){H(e,a,a,a*.35,[[0,1],[.3,.6],[1,0]]),e.globalCompositeOperation="lighter";for(let l=0;l<6;l++){e.save(),e.translate(a,a),e.rotate(l*Math.PI/6);const t=e.createLinearGradient(-a,0,a,0);t.addColorStop(0,"rgba(255,255,255,0)"),t.addColorStop(.5,`rgba(255,255,255,${l%2?.45:.85})`),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.beginPath(),e.ellipse(0,0,a*(l%2?.7:.97),l%2?2:3.5,0,0,h),e.fill(),e.restore()}e.globalCompositeOperation="source-over"}function y0(e,a){const l=e.createImageData(a*2,a*2);for(let t=0;t<a*2;t++)for(let o=0;o<a*2;o++){const r=(o/(a*2)-.5)*2,n=1-t/(a*2),s=.72+.5*(V(r*1.6+3,n*4+1,5,4)-.5)*(.4+n),i=Math.sqrt(Math.max(0,1-n))*(.62-.1*n)*(.7+.3*Math.sin(n*9+y(3,0,1)*6))*s,d=1-Math.abs(r)/Math.max(.02,i),u=Math.max(0,d)**.8*Math.min(1,n*6+.15),T=.5+.5*Math.sin(n*17+r*5+1.3),f=Math.min(1,u*(.75+.25*T)*(1-n*.35)),p=(t*a*2+o)*4,P=Math.min(1,.55+.45*(1-n));l.data[p]=l.data[p+1]=l.data[p+2]=Math.round(P*255),l.data[p+3]=Math.round(f*255)}e.putImageData(l,0,0)}function k0(e,a){H(e,a,a,a,[[0,1],[.1,.95],[.2,.55],[.38,.14],[.65,.03],[1,0]])}function x0(e,a){e.save(),e.translate(a,a);const l=e.createLinearGradient(-a,0,a,0);l.addColorStop(0,"rgba(255,255,255,0)"),l.addColorStop(.5,"rgba(255,255,255,1)"),l.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=l,e.beginPath(),e.moveTo(-a*.95,a*.1),e.quadraticCurveTo(0,-a*.9,a*.95,a*.1),e.quadraticCurveTo(0,-a*.45,-a*.95,a*.1),e.fill(),e.restore()}function W0(e,a){H(e,a,a,a*.3,[[0,1],[1,0]]),e.save(),e.translate(a,a),e.fillStyle="rgba(255,255,255,0.95)",e.beginPath();for(let l=0;l<8;l++){const t=l%2?a*.12:a*.95,o=l*Math.PI/4;e.lineTo(Math.cos(o)*t,Math.sin(o)*t)}e.closePath(),e.fill(),e.restore()}const K=[(e,a,l,t,o)=>{e.strokeRect(a+t*.12,l+o*.15,t*.76,o*.7)},(e,a,l,t,o)=>{for(let r=0;r<3;r++){const n=l+o*(.18+r*.32);e.moveTo(a+t*(r===1?.2:.08),n),e.lineTo(a+t*(r===1?.8:.92),n)}},(e,a,l,t,o)=>{e.moveTo(a+t*.05,l+o*.45),e.lineTo(a+t*.95,l+o*.45),e.moveTo(a+t*.5,l+o*.05),e.lineTo(a+t*.5,l+o*.95)},(e,a,l,t,o)=>{e.moveTo(a+t*.15,l+o*.12),e.lineTo(a+t*.85,l+o*.12),e.moveTo(a+t*.55,l+o*.12),e.lineTo(a+t*.55,l+o*.88),e.lineTo(a+t*.3,l+o*.74)},(e,a,l,t,o)=>{e.moveTo(a+t*.5,l+o*.02),e.lineTo(a+t*.5,l+o*.2),e.moveTo(a+t*.1,l+o*.5),e.lineTo(a+t*.1,l+o*.28),e.lineTo(a+t*.9,l+o*.28),e.lineTo(a+t*.9,l+o*.5),e.moveTo(a+t*.25,l+o*.65),e.lineTo(a+t*.75,l+o*.65),e.moveTo(a+t*.5,l+o*.5),e.lineTo(a+t*.5,l+o*.95)},(e,a,l,t,o)=>{e.moveTo(a+t*.5,l+o*.1),e.quadraticCurveTo(a+t*.42,l+o*.6,a+t*.08,l+o*.92),e.moveTo(a+t*.5,l+o*.4),e.quadraticCurveTo(a+t*.62,l+o*.75,a+t*.94,l+o*.9)},(e,a,l,t,o)=>{for(let r=0;r<3;r++){const n=l+o*(.15+r*.3);e.moveTo(a+t*.25,n),e.lineTo(a+t*.55,n+o*.12)}e.moveTo(a+t*.2,l+o*.95),e.lineTo(a+t*.6,l+o*.7)},(e,a,l,t,o)=>{e.strokeRect(a+t*.15,l+o*.08,t*.7,o*.84),e.moveTo(a+t*.15,l+o*.36),e.lineTo(a+t*.85,l+o*.36),e.moveTo(a+t*.15,l+o*.64),e.lineTo(a+t*.85,l+o*.64)}];function $(e){return(a,l)=>{a.save(),a.translate(l,l),a.strokeStyle="#fff",a.fillStyle="#fff",a.lineCap="square",a.lineJoin="miter",a.shadowColor="rgba(255,255,255,0.95)",a.shadowBlur=l*.1,a.lineWidth=l*.085;const t=l*1.5,o=-t/2,r=-t/2,n=i=>K[Math.floor(y(e,i,7)*K.length)],s=y(e,0,3);if(a.beginPath(),s<.4){const i=.38+.08*y(e,0,4);n(1)(a,o,r,t*i,t),n(2)(a,o+t*(i+.04),r,t*(.96-i),t)}else if(s<.75){const i=.4+.1*y(e,0,5);n(3)(a,o,r,t,t*i),n(4)(a,o,r+t*(i+.04),t,t*(.96-i))}else a.moveTo(o+t*.05,r+t),a.lineTo(o+t*.05,r+t*.05),a.lineTo(o+t*.95,r+t*.05),a.lineTo(o+t*.95,r+t*.92),a.lineTo(o+t*.8,r+t*.86),n(5)(a,o+t*.2,r+t*.22,t*.6,t*.66);a.stroke(),a.restore()}}function I0(e,a){e.save(),e.shadowColor="rgba(255,255,255,0.9)",e.shadowBlur=a*.15,e.fillStyle="#fff",e.beginPath(),e.arc(a,a,a*.72,0,h),e.fill(),e.globalCompositeOperation="destination-out",e.shadowBlur=0,e.beginPath(),e.arc(a*1.36,a*.82,a*.66,0,h),e.fill(),e.restore()}function U(e){return(a,l)=>{const t=e==="ring"?l*.5:l*.82;a.save(),a.translate(l,l),e==="ring"&&(a.strokeStyle="rgba(255,255,255,0.75)",a.lineWidth=l*.06,a.beginPath(),a.ellipse(0,0,l*.95,l*.24,-.35,Math.PI,h),a.stroke()),a.beginPath(),a.arc(0,0,t,0,h),a.save(),a.clip();const o=a.createRadialGradient(-t*.35,-t*.35,t*.1,0,0,t);if(o.addColorStop(0,"#fff"),o.addColorStop(.7,"#9a9a9a"),o.addColorStop(1,"#2a2a2a"),a.fillStyle=o,a.fillRect(-t,-t,t*2,t*2),a.globalCompositeOperation="multiply",e==="world")for(let n=0;n<9;n++)a.fillStyle="rgba(120,120,120,0.9)",a.beginPath(),a.ellipse((y(5,n,1)-.5)*t*1.4,(y(5,n,2)-.5)*t*1.4,t*(.15+y(5,n,3)*.3),t*(.1+y(5,n,4)*.2),y(5,n,5)*3,0,h),a.fill();else for(let n=0;n<7;n++)a.fillStyle=`rgba(150,150,150,${.4+.5*y(9,n,1)})`,a.fillRect(-t,-t+(n+.3*y(9,n,2))*t*.3,t*2,t*(.08+.1*y(9,n,3)));a.restore(),a.globalCompositeOperation="source-over",e==="ring"&&(a.strokeStyle="rgba(255,255,255,0.85)",a.lineWidth=l*.06,a.beginPath(),a.ellipse(0,0,l*.95,l*.24,-.35,0,Math.PI),a.stroke());const r=a.createRadialGradient(0,0,t*.85,0,0,t*1.12);r.addColorStop(0,"rgba(255,255,255,0)"),r.addColorStop(.5,"rgba(255,255,255,0.35)"),r.addColorStop(1,"rgba(255,255,255,0)"),a.fillStyle=r,a.beginPath(),a.arc(0,0,t*1.12,0,h),a.fill(),a.restore()}}function R0(e,a){e.save(),e.translate(a,a*1.1),e.strokeStyle="#fff",e.fillStyle="rgba(255,255,255,0.32)",e.lineWidth=a*.05,e.lineCap="round",e.shadowColor="#fff",e.shadowBlur=a*.08;const l=[[-.42,.02,.26],[0,-.16,.36],[.4,.04,.24]];e.beginPath();for(const[t,o,r]of l)e.moveTo(t*a+r*a,o*a),e.arc(t*a,o*a,r*a,0,h);e.fill();for(const[t,o,r]of l)e.beginPath(),e.arc(t*a,o*a,r*a,Math.PI*.9,Math.PI*2.15),e.stroke(),e.beginPath(),e.arc(t*a+r*a*.2,o*a+r*a*.05,r*a*.45,Math.PI,Math.PI*2.3),e.stroke();e.beginPath(),e.moveTo(-.85*a,.2*a),e.quadraticCurveTo(0,.32*a,.85*a,.2*a),e.stroke(),e.restore()}function w0(e,a){const l=a*2,t=e.createImageData(l,l),o=(r,n)=>{const s=.62*Math.pow(Math.max(0,1-n),.6)*Math.min(1,.55+n*3)*(1+.14*Math.sin(n*7.5)),i=.16*Math.sin(n*3.1)*n;if(Math.abs(r-i)<s&&n>.04)return!0;const d=(u,T,f)=>{const p=r-u,P=n-T;return p*p/(f*f*.35)+P*P/(f*f*1.6)<1};return d(-.36,.5,.22)||d(.34,.42,.2)||d(i+.08,.9,.12)};for(let r=0;r<l;r++)for(let n=0;n<l;n++){let s=0;for(const[d,u]of[[.25,.25],[.75,.25],[.25,.75],[.75,.75]])o(((n+d)/l-.5)*2,1-(r+u)/l)&&s++;const i=(r*l+n)*4;t.data[i]=t.data[i+1]=t.data[i+2]=255,t.data[i+3]=Math.round(s/4*255)}e.putImageData(t,0,0)}function A0(e,a){e.fillStyle="#fff",e.beginPath(),e.moveTo(a*.6,a*1.9),e.bezierCurveTo(a*.1,a*1.3,a*.5,a*.35,a*1.35,a*.12),e.bezierCurveTo(a*.95,a*.5,a*.8,a*1.1,a*1.05,a*1.55),e.bezierCurveTo(a*.95,a*1.75,a*.8,a*1.9,a*.6,a*1.9),e.fill()}function G0(e,a){const l=[[0,.1,.42],[-.42,.22,.3],[.42,.24,.32],[-.2,-.28,.32],[.26,-.3,.3],[-.5,-.12,.22],[.55,-.08,.22]],t=(o,r=0,n=0)=>{e.beginPath();for(const[s,i,d]of l)e.moveTo(a+(s+r)*a*o+d*a*o,a+(i+n)*a*o),e.arc(a+(s+r)*a*o,a+(i+n)*a*o,d*a*o,0,Math.PI*2)};e.fillStyle="#b8c0c8",t(.9),e.fill(),e.save(),t(.9),e.clip(),e.fillStyle="#ffffff",t(.9,-.07,-.08),e.fill(),e.restore()}const E0=[m0,u0,S0,(e,a)=>p0(e,a),v0,T0,P0,C0,k0,x0,M0,W0,y0,...[3,7,12,21,30,44,53,61,77,85,92,108,117,131,140,156].map($),I0,U("band"),U("world"),U("ring"),R0,w0,A0,G0];let N=null;function D0(){if(N)return N;const e=document.createElement("canvas");e.width=e.height=q*j;const a=e.getContext("2d");return E0.forEach((l,t)=>{const o=document.createElement("canvas");o.width=o.height=q;const r=o.getContext("2d");l(r,q/2),a.drawImage(o,t%j*q,Math.floor(t/j)*q)}),N=e}const J=q,Q=j;function O0(e,a,l,t){const o=[];for(let s=0;s<5;s++)for(let i=0;i<3;i++)o.push([(i-1)*t*.32,(s-2)*t*.2]);const r=2+Math.floor(y(a,l,1)*3);e.beginPath();let n=Math.floor(y(a,l,2)*o.length);for(let s=0;s<r;s++){const i=(n+1+Math.floor(y(a,l,3+s)*(o.length-1)))%o.length;e.moveTo(...o[n]),e.lineTo(...o[i]),n=i}e.stroke(),y(a,l,9)>.6&&(e.beginPath(),e.arc(0,-t*.5,t*.05,0,h),e.fill())}function E(e,a,l,t,o=0){e.beginPath();for(let r=0;r<=a;r++){const n=o+r*l*h/a,s=Math.cos(n)*t,i=Math.sin(n)*t;r?e.lineTo(s,i):e.moveTo(s,i)}e.closePath(),e.stroke()}function Z(e){const t=document.createElement("canvas");t.width=t.height=1024;const o=t.getContext("2d");o.translate(512,512),o.strokeStyle="#fff",o.fillStyle="#fff",o.lineCap="round",o.lineJoin="round";const r=(i,d,u=1)=>{o.globalAlpha=u,o.lineWidth=d,o.beginPath(),o.arc(0,0,i,0,h),o.stroke(),o.globalAlpha=1},n=(i,d,u,T)=>{for(let f=0;f<u;f++)o.save(),o.rotate(f/u*h),o.translate(0,-(i+d)/2),o.lineWidth=5,O0(o,T,f,d-i),o.restore()};if(o.shadowColor="rgba(255,255,255,0.9)",o.shadowBlur=14,e==="a"){r(512*.97,10),r(512*.93,3.5),r(512*.7,6),r(512*.665,3),n(512*.72,512*.91,28,3);for(let i=0;i<12;i++)o.save(),o.rotate(i/12*h),o.fillRect(-4,-512*.955,8,512*.025),o.restore();o.lineWidth=6,E(o,6,2,512*.665,-Math.PI/2),E(o,6,1,512*.665,-Math.PI/2),r(512*.38,7),r(512*.34,3),o.lineWidth=5,E(o,3,1,512*.34,-Math.PI/2),E(o,3,1,512*.34,Math.PI/2),n(512*.4,512*.52,12,5);for(let i=0;i<6;i++)o.save(),o.rotate(i/6*h-Math.PI/2),o.beginPath(),o.arc(512*.665,0,14,0,h),o.fill(),o.restore();o.beginPath(),o.arc(0,0,22,0,h),o.fill(),r(52,5)}else{r(512*.98,6),r(512*.94,12),r(512*.88,3),o.lineWidth=6;for(let i=0;i<96;i++)o.save(),o.rotate(i/96*h),o.fillRect(-2,-512*.9,4,i%4?512*.025:512*.05),o.restore();n(512*.62,512*.82,24,11),r(512*.6,5),r(512*.56,8),o.lineWidth=6,E(o,8,3,512*.56,0),E(o,8,1,512*.56,Math.PI/8);for(let i=0;i<8;i++)o.save(),o.rotate(i/8*h),o.beginPath(),o.arc(512*.56,0,18,0,h),o.stroke(),o.beginPath(),o.arc(512*.56,0,6,0,h),o.fill(),o.restore();r(512*.3,6),o.lineWidth=5,E(o,4,1,512*.3,Math.PI/4),E(o,4,1,512*.3,0),n(512*.32,512*.44,8,17);for(let i=0;i<4;i++)o.save(),o.rotate(i/4*h),o.beginPath(),o.arc(0,-512*.1,512*.07,.3,Math.PI-.3),o.stroke(),o.restore();o.beginPath(),o.arc(0,0,16,0,h),o.fill()}o.setTransform(1,0,0,1,0,0),o.shadowBlur=0;const s=o.getImageData(0,0,1024,1024);for(let i=0;i<s.data.length;i+=4){const d=Math.max(s.data[i+3],0);s.data[i]=255,s.data[i+1]=255,s.data[i+2]=255,s.data[i+3]=d}return o.putImageData(s,0,0),t}function z(e,a,l){e.setTransform(1,0,0,1,0,0),e.shadowBlur=0;const t=e.getImageData(0,0,a,l);for(let o=0;o<t.data.length;o+=4){const r=Math.max(t.data[o],t.data[o+1],t.data[o+2])*t.data[o+3]/255;t.data[o]=t.data[o+1]=t.data[o+2]=255,t.data[o+3]=r}e.putImageData(t,0,0)}function B(e,a){const l=document.createElement("canvas");return l.width=e,l.height=a,[l,l.getContext("2d")]}function L0(){const[l,t]=B(1024,1024),o=512*.5;t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.shadowColor="#fff",t.shadowBlur=18,t.strokeStyle="#fff",t.lineCap="round",t.fillStyle="rgb(26,26,26)",t.beginPath(),t.arc(0,0,o,0,h),t.fill(),t.fillStyle="#fff",t.beginPath(),t.arc(0,0,o,-Math.PI/2,Math.PI/2),t.arc(0,o/2,o/2,Math.PI/2,-Math.PI/2,!0),t.arc(0,-o/2,o/2,Math.PI/2,-Math.PI/2),t.fill(),t.fillStyle="rgb(26,26,26)",t.beginPath(),t.arc(0,-o/2,o*.13,0,h),t.fill(),t.fillStyle="#fff",t.beginPath(),t.arc(0,o/2,o*.13,0,h),t.fill(),t.lineWidth=9,t.beginPath(),t.arc(0,0,o,0,h),t.stroke(),t.lineWidth=4,t.beginPath(),t.arc(0,0,o*1.08,0,h),t.stroke();for(let r=0;r<8;r++){t.save(),t.rotate(r/8*h),t.lineWidth=15;for(let n=0;n<3;n++){const s=-(o*1.3+n*30),i=o*.34,d=r+1>>n&1;t.beginPath(),d?(t.moveTo(-i,s),t.lineTo(-i*.18,s),t.moveTo(i*.18,s),t.lineTo(i,s)):(t.moveTo(-i,s),t.lineTo(i,s)),t.stroke()}t.restore()}t.lineWidth=5,t.beginPath(),t.arc(0,0,512*.9,0,h),t.stroke(),t.lineWidth=12,t.beginPath(),t.arc(0,0,512*.95,0,h),t.stroke();for(let r=0;r<64;r++)t.save(),t.rotate(r/64*h),t.fillStyle="#fff",t.fillRect(-2.5,-512*.9,5,r%8?14:30),t.restore();return z(t,1024,1024),l}function _0(){const[l,t]=B(512,1536);t.fillStyle="#000",t.fillRect(0,0,512,1536),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=16;const o=46,r=466,n=230,s=1386;t.globalAlpha=.07,t.fillRect(o,n,r-o,s-n),t.globalAlpha=1,t.lineWidth=10,t.strokeRect(o,n,r-o,s-n),t.lineWidth=4,t.strokeRect(o+22,n+22,r-o-44,s-n-44),t.lineWidth=9,t.beginPath(),t.moveTo(o-10,n),t.bezierCurveTo(o,60,r,60,r+10,n),t.stroke(),t.lineWidth=5;for(const d of[-1,1])t.beginPath(),t.arc(512/2+d*120,150,34,0,h*.8),t.stroke(),t.beginPath(),t.arc(512/2+d*60,118,22,Math.PI,h*.9),t.stroke();t.beginPath(),t.arc(512/2,112,26,0,h),t.fill(),t.lineWidth=4,t.beginPath(),t.arc(512/2,112,44,0,h),t.stroke();const i=[3,7,12,21,30,44,53,61,77,85];for(let d=0;d<3;d++)for(let u=0;u<13;u++){const T=o+92+d*118,f=n+90+u*86,p=i[(d*13+u)%i.length]+u*3+d;y(p,1,99)<.08||(t.save(),t.translate(T-40,f-40),t.scale(80/256,80/256),$(p)(t,128),t.restore())}t.lineWidth=6;for(let d=-3;d<=3;d++)t.beginPath(),t.ellipse(512/2+d*52,s+62,30,58,d*.22,Math.PI,h),t.stroke();return t.lineWidth=8,t.beginPath(),t.moveTo(o-20,s+70),t.lineTo(r+20,s+70),t.stroke(),z(t,512,1536),l}function q0(){const[l,t]=B(1024,1024);t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.shadowColor="#fff",t.shadowBlur=12;const o=(r,n)=>{t.lineWidth=n,t.beginPath(),t.arc(0,0,r,0,h),t.stroke()};o(512*.98,5),o(512*.95,12),o(512*.79,4),o(512*.76,8),o(512*.5,6),o(512*.46,3),o(512*.2,6);for(let r=0;r<24;r++)t.save(),t.rotate(r/24*h),t.translate(0,-512*.865),t.scale(60/256,60/256),$(100+r)(t,128),t.restore();for(let r=0;r<180;r++)t.save(),t.rotate(r/180*h),t.fillRect(-1.5,-512*.76,3,r%15?10:26),t.restore();for(let r=0;r<12;r++)t.save(),t.rotate(r/12*h),t.lineWidth=3,t.beginPath(),t.moveTo(0,-512*.2),t.lineTo(0,-512*.74),t.stroke(),t.beginPath(),t.arc(0,-512*.62,20,0,h),t.stroke(),t.beginPath(),t.arc(0,-512*.62,7,0,h),t.fill(),t.restore();t.lineWidth=4,E(t,12,5,512*.46,0),E(t,4,1,512*.46,Math.PI/4);for(let r=0;r<16;r++)t.save(),t.rotate(r/16*h),t.beginPath(),t.moveTo(-12,-512*.06),t.lineTo(0,-512*.19),t.lineTo(12,-512*.06),t.fill(),t.restore();return t.beginPath(),t.arc(0,0,512*.07,0,h),t.fill(),z(t,1024,1024),l}function z0(){const[l,t]=B(512,512),o=256*.86;t.fillStyle="#000",t.fillRect(0,0,512,512);const r=t.createRadialGradient(256-o*.25,256-o*.25,o*.1,256,256,o);r.addColorStop(0,"#fff"),r.addColorStop(.8,"#e6e6e6"),r.addColorStop(1,"#a8a8a8"),t.fillStyle=r,t.beginPath(),t.arc(256,256,o,0,h),t.fill(),t.save(),t.beginPath(),t.arc(256,256,o,0,h),t.clip();for(let n=0;n<18;n++){const s=y(17,n,1)*h,i=Math.sqrt(y(17,n,2))*o*.75,d=o*(.08+y(17,n,3)*.22),u=t.createRadialGradient(256+Math.cos(s)*i,256+Math.sin(s)*i,0,256+Math.cos(s)*i,256+Math.sin(s)*i,d);u.addColorStop(0,"rgba(0,0,0,0.32)"),u.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=u,t.fillRect(0,0,512,512)}return t.restore(),z(t,512,512),l}function X(e){const[l,t]=B(1024,1024),o=b0[e],r=f=>(.5+f)*1024,n=f=>(1-f)*1024;t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.lineJoin="round",t.lineCap="round";const s=f=>{t.beginPath(),"e"in f&&f.e?t.ellipse(r(f.e[0]),n(f.e[1]),f.e[2]*1024,f.e[3]*1024,0,0,h):(f.p.forEach(([P,b],x)=>x?t.lineTo(r(P),n(b)):t.moveTo(r(P),n(b))),t.closePath())},i=t.createRadialGradient(r(o.heart[0]),n(o.heart[1]),1024*.02,r(o.heart[0]),n(o.heart[1]),1024*.6);i.addColorStop(0,"rgba(255,255,255,0.55)"),i.addColorStop(1,"rgba(255,255,255,0.22)");for(const f of o.shapes)s(f),t.fillStyle=f.dim?"rgba(255,255,255,0.12)":i,t.fill();t.shadowColor="#fff",t.shadowBlur=18;for(const f of o.shapes)s(f),t.strokeStyle=f.dim?"rgba(255,255,255,0.35)":"rgba(255,255,255,0.9)",t.lineWidth=f.dim?3:5,t.stroke();t.lineWidth=4,t.strokeStyle="rgba(255,255,255,0.75)";for(const[f,p,P]of o.folds)t.beginPath(),t.moveTo(r(f[0]),n(f[1])),t.quadraticCurveTo(r(p[0]),n(p[1]),r(P[0]),n(P[1])),t.stroke();const[d,u]=o.eyes[1],T=d*1024;t.lineWidth=4,t.strokeStyle="rgba(255,255,255,0.9)";for(const f of[-1,1])t.beginPath(),t.moveTo(r(f*d*.4),n(u+.022)),t.quadraticCurveTo(r(f*d*1.1),n(u+.035),r(f*d*1.8),n(u+.02)),t.stroke();t.beginPath(),t.moveTo(r(-d*.5),n(u-.055)),t.quadraticCurveTo(r(0),n(u-.062),r(d*.5),n(u-.055)),t.stroke(),t.fillStyle="#fff",t.beginPath(),t.ellipse(r(o.brow[0]),n(o.brow[1]),T*.12,T*.3,0,0,h),t.fill(),t.lineWidth=3,t.strokeStyle="rgba(255,255,255,0.4)";for(let f=0;f<14;f++){const p=(f/13-.5)*2,P=o.head[0]+p*.05,b=o.head[1]+.06;t.beginPath(),t.moveTo(r(P),n(b)),t.bezierCurveTo(r(P+p*.08),n(b+.08),r(P+p*.2+.03*Math.sin(f)),n(b+.02),r(P+p*.3),n(b+.1+.04*y(4,f,1))),t.stroke()}if("beads"in o&&o.beads)for(const[f,p]of o.beads)t.fillStyle="#fff",t.beginPath(),t.arc(r(f),n(p),1024*.022,0,h),t.fill();return z(t,1024,1024),l}function B0(){const[l,t]=B(1024,1024);t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=14;const o=(r,n)=>{t.lineWidth=n,t.beginPath(),t.arc(0,0,r,0,h),t.stroke()};o(512*.97,4),o(512*.93,9),o(512*.6,4),o(512*.56,2),t.lineWidth=4,t.beginPath();for(let r=0;r<3;r++){const n=-Math.PI/2+r*h/3;t.lineTo(Math.cos(n)*512*.92,Math.sin(n)*512*.92)}t.closePath(),t.stroke(),t.lineWidth=3,t.beginPath(),t.moveTo(0,-512*.93),t.lineTo(0,512*.93),t.moveTo(-512*.93,0),t.lineTo(512*.93,0),t.stroke();for(const[r,n]of[[-.55,.5],[.55,.5],[-.62,-.28],[.62,-.28]])for(let s=0;s<3;s++)for(let i=1;i<=3;i++)t.lineWidth=3,t.beginPath(),t.arc((r+(s-1)*.12)*512,n*512,i*512*.035,Math.PI,h),t.stroke();for(const[r,n,s]of[[0,-.72,61],[-.68,.16,92],[.68,.16,140]])t.lineWidth=6,t.beginPath(),t.arc(r*512,n*512,512*.15,0,h),t.stroke(),t.lineWidth=2,t.beginPath(),t.arc(r*512,n*512,512*.18,0,h),t.stroke(),t.save(),t.translate(r*512-512*.11,n*512-512*.11),t.scale(512*.22/256,512*.22/256),$(s)(t,128),t.restore();for(let r=0;r<72;r++)t.save(),t.rotate(r/72*h),t.fillRect(-2,-512*.93,4,r%6?12:26),t.restore();return t.save(),t.translate(-512*.16,-512*.16),t.scale(512*.32/256,512*.32/256),$(185)(t,128),t.restore(),z(t,1024,1024),l}const F0={rune0:()=>Z("a"),rune1:()=>Z("b"),taiji:L0,stele:_0,wheel:q0,moon:z0,fig_thien:()=>X("thien"),fig_dung:()=>X("dung"),fig_ban_than:()=>X("ban_than"),seal:B0},g=new Map;function $0(e){let a=g.get(e);return a||(a=F0[e](),g.set(e,a)),a}const H0=e=>({...J0(e),...o0[e.preset]?.thumb}),J0=e=>e.attach==="path"||e.attach==="gun"?{x0:-.6,x1:8.6,y0:-.2,y1:3.3,axis:"z"}:e.attach==="sky"?{x0:-2.5,x1:2.5,y0:-.2,y1:9.2,axis:"x"}:e.attach==="area"?{x0:-4,x1:4,y0:-.2,y1:4.8,axis:"x"}:{x0:-2.4,x1:2.4,y0:-.2,y1:3,axis:"x"},t0=new Map;function r0(e){let a=t0.get(e.id);if(!a){const l=l0(e,3),t=n0(l,{color:e.color,size:1});a={entry:e,layers:t,bufs:t.map(o=>o.k==="particles"?s0(o.max):o.k==="segments"?f0(o.max):o.k==="swords"?new Float32Array(o.max*16+o.max):new Float32Array(0)),view:H0(e),dur:Math.min(e.duration,4),tail:i0(e.preset)},t0.set(e.id,a)}return a}const Y=e=>Math.round(255*Math.min(1,Math.pow(Math.max(0,e),1/2.2))),I=(e,a,l,t)=>`rgba(${Y(e)},${Y(a)},${Y(l)},${Math.max(0,Math.min(1,t))})`,j0=13,e0=new Map;function a0(e,a,l,t,o){const r=x=>Math.round(Math.min(1,x)*15),n=`${e}|${a}|${r(l)}|${r(t)}|${r(o)}`;let s=e0.get(n);if(s)return s;const i=e==="atlas",d=i?D0():$0(e),u=i?a%Q*J:0,T=i?Math.floor(a/Q)*J:0,f=i?J:d.width,p=i?J:d.height,P=Math.min(1,256/Math.max(f,p));s=document.createElement("canvas"),s.width=Math.max(1,Math.round(f*P)),s.height=Math.max(1,Math.round(p*P));const b=s.getContext("2d");return b.drawImage(d,u,T,f,p,0,0,s.width,s.height),b.globalCompositeOperation="source-in",b.fillStyle=I(r(l)/15,r(t)/15,r(o)/15,1),b.fillRect(0,0,s.width,s.height),e0.set(n,s),s}function U0(e,a,l,t,o){const r=r0(a),n=r.view,s=Math.min(t/(n.x1-n.x0),o/(n.y1-n.y0)),i=(t-s*(n.x1-n.x0))/2,d=o-(o-s*(n.y1-n.y0))/2,u=n.tilt??0,T=b=>i+((n.axis==="z"?b[2]:b[0])-n.x0)*s,f=b=>d-(b[1]-(n.axis==="z"?-b[0]:b[2])*u-n.y0)*s,p=e.createLinearGradient(0,0,0,o);p.addColorStop(0,"#0a0e14"),p.addColorStop(1,"#141b22"),e.globalCompositeOperation="source-over",e.fillStyle=p,e.fillRect(0,0,t,o),e.fillStyle="rgba(255,255,255,.07)",e.fillRect(0,f([0,0,0]),t,1),e.globalCompositeOperation="lighter";const P=c0([0,0,0],0,1);r.layers.forEach((b,x)=>{const m=r.bufs[x];if(e.globalCompositeOperation=b.blend==="alpha"?"source-over":"lighter",b.k==="particles"){const S=b.eval(l,P,m);for(let v=0;v<S;v++){const c=v*d0,C=T([m[c],m[c+1],m[c+2]]),M=f([m[c],m[c+1],m[c+2]]),k=Math.max(.8,m[c+3]*s*.5),W=m[c+9],L=Math.floor(m[c+13]);if(W<.01)continue;const D=Math.max(m[c+6],m[c+7],m[c+8],1),A=m[c+6]/D,R=m[c+7]/D,O=m[c+8]/D;if(b.tex!=="atlas"||L>=j0){const _=a0(b.tex,b.tex==="atlas"?L:0,A,R,O),w=m[c+3]*s,F=m[c+4]*s;e.save(),e.globalAlpha=Math.min(1,W*(D>1.5?1.2:1)),e.translate(C,M),b.facing===1&&e.scale(1,.22),e.rotate(-m[c+5]),e.drawImage(_,-w/2,-F/2,w,F),e.restore();continue}if(b.facing===3){const _=n.axis==="z"?m[c+12]:m[c+10],w=m[c+11],F=m[c+4]*s;e.strokeStyle=I(A,R,O,W*.9),e.lineWidth=Math.max(1,m[c+3]*s),e.beginPath(),e.moveTo(C,M),e.lineTo(C-_*F,M+w*F),e.stroke()}else if(b.facing===1){const _=L===3||b.tex!=="atlas";if(e.save(),e.translate(C,M),e.scale(1,.22),_)e.strokeStyle=I(A,R,O,W*.9),e.lineWidth=Math.max(1,k*.06),e.beginPath(),e.arc(0,0,k,0,6.3),e.stroke();else{const w=e.createRadialGradient(0,0,0,0,0,k);w.addColorStop(0,I(A,R,O,W*.8)),w.addColorStop(1,I(A,R,O,0)),e.fillStyle=w,e.beginPath(),e.arc(0,0,k,0,6.3),e.fill()}e.restore()}else{if(L===3||L===10){e.strokeStyle=I(A,R,O,W*.8),e.lineWidth=Math.max(1,k*.1),e.beginPath(),e.arc(C,M,k*.8,0,6.3),e.stroke();return}const w=e.createRadialGradient(C,M,0,C,M,k);w.addColorStop(0,I(A,R,O,Math.min(1,W*(D>1.5?1.2:.9)))),w.addColorStop(.35,I(A,R,O,W*.35)),w.addColorStop(1,I(A,R,O,0)),e.fillStyle=w,e.beginPath(),e.arc(C,M,k,0,6.3),e.fill()}}}else if(b.k==="segments"){const S=b.eval(l,P,m);for(let v=0;v<S;v++){const c=v*h0,C=m[c+11];if(C<.01)continue;const M=Math.max(m[c+8],m[c+9],m[c+10],1);e.strokeStyle=I(m[c+8]/M,m[c+9]/M,m[c+10]/M,C),e.lineWidth=Math.max(1,m[c+6]*s*1.6),e.lineCap="round",e.beginPath(),e.moveTo(T([m[c],m[c+1],m[c+2]]),f([m[c],m[c+1],m[c+2]])),e.lineTo(T([m[c+3],m[c+4],m[c+5]]),f([m[c+3],m[c+4],m[c+5]])),e.stroke()}}else if(b.k==="swords"){const S=m.subarray(0,b.max*16),v=m.subarray(b.max*16),c=b.eval(l,P,S,v);e.strokeStyle="rgba(210,235,255,.95)",e.lineWidth=Math.max(1,.035*s*2),e.lineCap="round";for(let C=0;C<c;C++){const M=C*16,k=[S[M+12],S[M+13],S[M+14]],W=[k[0]+S[M+4]*.78,k[1]+S[M+5]*.78,k[2]+S[M+6]*.78];e.beginPath(),e.moveTo(T(k),f(k)),e.lineTo(T(W),f(W)),e.stroke()}}else if(b.k==="water"){if(!b.eval(l,P))return;e.fillStyle="rgba(70,150,200,.35)",e.beginPath(),e.moveTo(0,o);for(let v=0;v<=t;v+=4){const c=v/t;e.lineTo(v,o*.62+Math.sin(c*14+l*3)*4+Math.sin(c*31-l*2)*1.5-(b.mode==="wave"?Math.max(0,Math.sin(Math.min(1,c-.2+l*.2)*3))*o*.35:0))}e.lineTo(t,o),e.closePath(),e.fill()}else if(b.k==="props"){const S=new Float32Array(b.max*16),v=new Float32Array(b.max*3),c=b.eval(l,P,S,v);for(let C=0;C<c;C++){const M=C*16,k=T([S[M+12],S[M+13],S[M+14]]),W=f([S[M+12],S[M+13],S[M+14]]);e.fillStyle=I(v[C*3]+.25,v[C*3+1]+.2,v[C*3+2]+.15,.95),e.fillRect(k-1.5,W-1.5,3,3)}}else if(b.k==="ghost"){const S=b.eval(l,P);if(S&&S.alpha>.01){const v=a0("fig_"+b.figure,0,Math.min(1,S.color[0]),Math.min(1,S.color[1]),Math.min(1,S.color[2])),c=1.75*S.scale*(b.figure==="thien"?.62:1)*s,C=T([S.offset[0],0,S.offset[2]]),M=f([S.offset[0],S.offset[1],S.offset[2]]);e.save(),e.globalAlpha=Math.min(1,S.alpha)*.9,e.drawImage(v,C-c/2,M-c,c,c),e.restore()}}else if(b.k==="shell"){const S=b.eval(l,P);for(const v of Array.isArray(S)?S:S?[S]:[]){const c=v.color,C=Math.min(1,v.alpha*.9),M=Math.max(c[0],c[1],c[2],1);if(b.shape==="dome")e.strokeStyle=I(c[0]/M,c[1]/M,c[2]/M,C*.9),e.lineWidth=1.5,e.beginPath(),e.arc(T(v.pos),f(v.pos),v.scale[0]*s,0,6.3),e.stroke();else{const k=T(v.pos),W=f(v.pos),L=v.scale[0]*s*2,D=v.scale[1]*s,A=v.dir[1]>.7,R=e.createLinearGradient(0,W,0,W-D);R.addColorStop(0,I(c[0]/M,c[1]/M,c[2]/M,C*.6)),R.addColorStop(1,I(c[0]/M,c[1]/M,c[2]/M,0)),e.fillStyle=R,A&&e.fillRect(k-L/2,W-D,L,D)}}}}),e.globalCompositeOperation="source-over"}const N0=e=>o0[e.preset]?.thumb?.at??Math.min(e.duration,4)*.42,X0=e=>{const a=r0(e);return a.dur+a.tail*.5},V0=Object.freeze(Object.defineProperty({__proto__:null,drawThumb:U0,thumbLoopLength:X0,thumbRestTime:N0},Symbol.toStringTag,{value:"Module"}));export{Q as A,N0 as a,$0 as b,D0 as c,U0 as d,V0 as e,X0 as t};
1
+ import{ic as h,du as y,el as o0,fa as l0,en as n0,eG as i0,id as s0,ie as f0,er as c0,ec as d0,eg as h0}from"./remote-sTZauTqM.js";const G=(e,a,l,t)=>({p:[e,a,l,t]}),b0={thien:{shapes:[{e:[0,.68,.17,.22],dim:!0},{p:[[-.47,.03],[.47,.03],[.36,.2],[.2,.3],[-.2,.3],[-.36,.2]]},{e:[-.33,.11,.13,.08]},{e:[.33,.11,.13,.08]},{p:[[-.21,.22],[.21,.22],[.25,.5],[.18,.65],[-.18,.65],[-.25,.5]]},{e:[0,.62,.25,.055]},G([-.27,.64],[-.17,.62],[-.19,.42],[-.3,.44]),G([.27,.64],[.17,.62],[.19,.42],[.3,.44]),G([-.3,.44],[-.19,.41],[-.015,.49],[-.03,.56]),G([.3,.44],[.19,.41],[.015,.49],[.03,.56]),{e:[0,.55,.036,.08]},G([-.045,.64],[.045,.64],[.04,.72],[-.04,.72]),{e:[0,.78,.074,.094]},{e:[0,.885,.034,.036]}],eyes:[[-.028,.785],[.028,.785]],brow:[0,.825],head:[0,.79],chest:[0,.52],heart:[0,.48],folds:[[[-.4,.08],[-.15,.2],[0,.12]],[[.4,.08],[.15,.2],[0,.12]],[[-.12,.62],[0,.5],[.12,.62]],[[-.2,.3],[0,.34],[.2,.3]],[[-.24,.48],[-.2,.36],[-.12,.3]],[[.24,.48],[.2,.36],[.12,.3]]]},dung:{shapes:[{e:[0,.76,.13,.16],dim:!0},{p:[[-.24,0],[.24,0],[.15,.42],[-.15,.42]]},{p:[[-.14,.4],[.14,.4],[.18,.7],[-.18,.7]]},{e:[0,.705,.18,.04]},G([-.17,.73],[-.12,.67],[-.4,.53],[-.43,.59]),G([.17,.73],[.12,.67],[.4,.53],[.43,.59]),{p:[[-.28,.63],[-.5,.58],[-.49,.36],[-.34,.47]]},{p:[[.28,.63],[.5,.58],[.49,.36],[.34,.47]]},G([-.035,.72],[.035,.72],[.032,.79],[-.032,.79]),{e:[0,.845,.055,.07]},{e:[0,.925,.026,.026]}],eyes:[[-.02,.848],[.02,.848]],brow:[0,.875],head:[0,.85],chest:[0,.6],heart:[0,.58],folds:[[[-.08,.7],[0,.6],[.08,.7]],[[-.15,.42],[0,.45],[.15,.42]],[[-.08,.4],[-.12,.2],[-.18,.02]],[[.08,.4],[.12,.2],[.18,.02]],[[-.3,.6],[-.4,.48],[-.47,.4]],[[.3,.6],[.4,.48],[.47,.4]]]},ban_than:{shapes:[{e:[0,.6,.32,.33],dim:!0},{p:[[-.49,0],[.49,0],[.44,.28],[.24,.41],[-.24,.41],[-.44,.28]]},G([-.4,.22],[-.3,.12],[-.03,.12],[-.05,.22]),G([.4,.22],[.3,.12],[.03,.12],[.05,.22]),{e:[0,.2,.055,.14]},G([-.07,.39],[.07,.39],[.065,.5],[-.065,.5]),{e:[0,.64,.14,.17]},{e:[0,.83,.05,.05]}],eyes:[[-.052,.65],[.052,.65]],brow:[0,.715],head:[0,.66],chest:[0,.3],heart:[0,.27],beads:[[-.17,.37],[-.085,.335],[0,.32],[.085,.335],[.17,.37]],folds:[[[-.22,.41],[0,.26],[.22,.41]],[[-.44,.28],[-.36,.14],[-.3,0]],[[.44,.28],[.36,.14],[.3,0]]]}},q=256,j=7;function H(e,a,l,t,o){const r=e.createRadialGradient(a,l,0,a,l,t);for(const[n,s]of o)r.addColorStop(n,`rgba(255,255,255,${s})`);e.fillStyle=r,e.beginPath(),e.arc(a,l,t,0,h),e.fill()}const m0=(e,a)=>H(e,a,a,a,[[0,1],[.12,.75],[.3,.3],[.55,.09],[.8,.02],[1,0]]);function u0(e,a){H(e,a,a,a*.5,[[0,1],[.25,.7],[.6,.15],[1,0]]),e.globalCompositeOperation="lighter";for(const[l,t,o]of[[0,.98,5],[Math.PI/2,.98,5],[Math.PI/4,.5,2.5],[-Math.PI/4,.5,2.5]]){e.save(),e.translate(a,a),e.rotate(l);const r=e.createLinearGradient(-a*t,0,a*t,0);r.addColorStop(0,"rgba(255,255,255,0)"),r.addColorStop(.5,"rgba(255,255,255,0.95)"),r.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=r,e.beginPath(),e.ellipse(0,0,a*t,o,0,0,h),e.fill(),e.restore()}e.globalCompositeOperation="source-over"}function V(e,a,l,t=5){let o=0,r=.5,n=0,s=1;const i=d=>d*d*(3-2*d);for(let d=0;d<t;d++){const u=e*s,T=a*s,f=Math.floor(u),p=Math.floor(T),P=i(u-f),b=i(T-p),x=(v,c)=>y(l+d*131,(v&1023)*1024+(c&1023),7),m=x(f,p)+(x(f+1,p)-x(f,p))*P,S=x(f,p+1)+(x(f+1,p+1)-x(f,p+1))*P;o+=(m+(S-m)*b)*r,n+=r,r*=.5,s*=2.03}return o/n}function S0(e,a){const l=a*2,t=e.createImageData(l,l),o=Array.from({length:9},(n,s)=>{const i=y(23,s,1)*h,d=s===0?0:.18+.2*y(23,s,2);return[Math.cos(i)*d,Math.sin(i)*d*.8+.04,.3+.16*y(23,s,3)]}),r=(n,s)=>{let i=0;for(const[d,u,T]of o){const f=((n-d)**2+(s-u)**2)/(T*T);f<1&&(i=Math.max(i,(1-f)**1.3))}return i};for(let n=0;n<l;n++)for(let s=0;s<l;s++){const i=(s/l-.5)*2,d=(n/l-.5)*2,u=V(i*2.2+4,d*2.2+4,11),T=V(i*5+9,d*5+9,17,3),f=r(i+(u-.5)*.35,d+(T-.5)*.25),p=Math.min(1,Math.max(0,(f*1.35+(u-.5)*.9-.12)*1.6))*Math.max(0,1-Math.hypot(i,d)**6),P=r(i,d-.07),b=Math.min(1,Math.max(.35,.68+(f-P)*1.6+(.5-d*.5)*.22+(u-.5)*.35)),x=(n*l+s)*4,m=p*(.55+.45*T);t.data[x]=t.data[x+1]=t.data[x+2]=Math.round(b*255),t.data[x+3]=Math.round(Math.min(1,m)*255)}e.putImageData(t,0,0)}function p0(e,a,l=.12,t=.8){const o=e.createRadialGradient(a,a,0,a,a,a),r=t;o.addColorStop(0,"rgba(255,255,255,0)"),o.addColorStop(Math.max(0,r-l*2.2),"rgba(255,255,255,0.02)"),o.addColorStop(Math.max(0,r-l*.6),"rgba(255,255,255,0.6)"),o.addColorStop(r,"rgba(255,255,255,1)"),o.addColorStop(Math.min(1,r+l*.6),"rgba(255,255,255,0.5)"),o.addColorStop(Math.min(1,r+l*1.4),"rgba(255,255,255,0)"),o.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=o,e.fillRect(0,0,a*2,a*2)}function M0(e,a){const l=e.createRadialGradient(a,a,0,a,a,a);l.addColorStop(0,"rgba(255,255,255,0)"),l.addColorStop(.5,"rgba(255,255,255,0.05)"),l.addColorStop(.72,"rgba(255,255,255,0.22)"),l.addColorStop(.88,"rgba(255,255,255,0.95)"),l.addColorStop(.94,"rgba(255,255,255,0.4)"),l.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=l,e.fillRect(0,0,a*2,a*2)}function v0(e,a){e.save(),e.translate(a,a);const l=new Path2D;l.moveTo(0,a*.86),l.bezierCurveTo(a*.62,a*.5,a*.62,-a*.46,a*.1,-a*.88),l.lineTo(0,-a*.7),l.lineTo(-a*.1,-a*.88),l.bezierCurveTo(-a*.62,-a*.46,-a*.62,a*.5,0,a*.86);const t=e.createLinearGradient(0,a*.86,0,-a*.88);t.addColorStop(0,"rgba(210,210,210,1)"),t.addColorStop(.5,"rgba(255,255,255,1)"),t.addColorStop(1,"rgba(235,235,235,1)"),e.fillStyle=t,e.fill(l),e.strokeStyle="rgba(190,190,190,0.7)",e.lineWidth=3,e.beginPath(),e.moveTo(0,a*.8),e.quadraticCurveTo(a*.04,0,0,-a*.62),e.stroke(),e.restore()}function T0(e,a){e.save(),e.translate(a,a);const l=new Path2D;l.moveTo(0,a*.9),l.bezierCurveTo(a*.7,a*.45,a*.62,-a*.4,0,-a*.92),l.bezierCurveTo(-a*.62,-a*.4,-a*.7,a*.45,0,a*.9);const t=e.createLinearGradient(-a*.5,0,a*.5,0);t.addColorStop(0,"rgba(225,225,225,1)"),t.addColorStop(.5,"rgba(255,255,255,1)"),t.addColorStop(1,"rgba(205,205,205,1)"),e.fillStyle=t,e.fill(l),e.strokeStyle="rgba(170,170,170,0.9)",e.lineWidth=4,e.beginPath(),e.moveTo(0,a*.88),e.lineTo(0,-a*.8),e.stroke(),e.lineWidth=2;for(let o=0;o<5;o++){const r=a*(.6-o*.28);e.beginPath(),e.moveTo(0,r),e.lineTo(a*.4,r-a*.2),e.moveTo(0,r),e.lineTo(-a*.4,r-a*.2),e.stroke()}e.restore()}function P0(e,a){const l=a*2,t=a*2,o=e.createImageData(l,t);for(let r=0;r<t;r++)for(let n=0;n<l;n++){const s=(n/l-.5)*2,i=r/t,d=Math.exp(-s*s*7.5),u=Math.pow(Math.max(0,1-i),1.6)*Math.min(1,i*14+.05),T=Math.max(0,Math.min(1,d*u)),f=(r*l+n)*4;o.data[f]=255,o.data[f+1]=255,o.data[f+2]=255,o.data[f+3]=Math.round(T*255)}e.putImageData(o,0,0)}function C0(e,a){H(e,a,a,a*.35,[[0,1],[.3,.6],[1,0]]),e.globalCompositeOperation="lighter";for(let l=0;l<6;l++){e.save(),e.translate(a,a),e.rotate(l*Math.PI/6);const t=e.createLinearGradient(-a,0,a,0);t.addColorStop(0,"rgba(255,255,255,0)"),t.addColorStop(.5,`rgba(255,255,255,${l%2?.45:.85})`),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.beginPath(),e.ellipse(0,0,a*(l%2?.7:.97),l%2?2:3.5,0,0,h),e.fill(),e.restore()}e.globalCompositeOperation="source-over"}function y0(e,a){const l=e.createImageData(a*2,a*2);for(let t=0;t<a*2;t++)for(let o=0;o<a*2;o++){const r=(o/(a*2)-.5)*2,n=1-t/(a*2),s=.72+.5*(V(r*1.6+3,n*4+1,5,4)-.5)*(.4+n),i=Math.sqrt(Math.max(0,1-n))*(.62-.1*n)*(.7+.3*Math.sin(n*9+y(3,0,1)*6))*s,d=1-Math.abs(r)/Math.max(.02,i),u=Math.max(0,d)**.8*Math.min(1,n*6+.15),T=.5+.5*Math.sin(n*17+r*5+1.3),f=Math.min(1,u*(.75+.25*T)*(1-n*.35)),p=(t*a*2+o)*4,P=Math.min(1,.55+.45*(1-n));l.data[p]=l.data[p+1]=l.data[p+2]=Math.round(P*255),l.data[p+3]=Math.round(f*255)}e.putImageData(l,0,0)}function k0(e,a){H(e,a,a,a,[[0,1],[.1,.95],[.2,.55],[.38,.14],[.65,.03],[1,0]])}function x0(e,a){e.save(),e.translate(a,a);const l=e.createLinearGradient(-a,0,a,0);l.addColorStop(0,"rgba(255,255,255,0)"),l.addColorStop(.5,"rgba(255,255,255,1)"),l.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=l,e.beginPath(),e.moveTo(-a*.95,a*.1),e.quadraticCurveTo(0,-a*.9,a*.95,a*.1),e.quadraticCurveTo(0,-a*.45,-a*.95,a*.1),e.fill(),e.restore()}function W0(e,a){H(e,a,a,a*.3,[[0,1],[1,0]]),e.save(),e.translate(a,a),e.fillStyle="rgba(255,255,255,0.95)",e.beginPath();for(let l=0;l<8;l++){const t=l%2?a*.12:a*.95,o=l*Math.PI/4;e.lineTo(Math.cos(o)*t,Math.sin(o)*t)}e.closePath(),e.fill(),e.restore()}const K=[(e,a,l,t,o)=>{e.strokeRect(a+t*.12,l+o*.15,t*.76,o*.7)},(e,a,l,t,o)=>{for(let r=0;r<3;r++){const n=l+o*(.18+r*.32);e.moveTo(a+t*(r===1?.2:.08),n),e.lineTo(a+t*(r===1?.8:.92),n)}},(e,a,l,t,o)=>{e.moveTo(a+t*.05,l+o*.45),e.lineTo(a+t*.95,l+o*.45),e.moveTo(a+t*.5,l+o*.05),e.lineTo(a+t*.5,l+o*.95)},(e,a,l,t,o)=>{e.moveTo(a+t*.15,l+o*.12),e.lineTo(a+t*.85,l+o*.12),e.moveTo(a+t*.55,l+o*.12),e.lineTo(a+t*.55,l+o*.88),e.lineTo(a+t*.3,l+o*.74)},(e,a,l,t,o)=>{e.moveTo(a+t*.5,l+o*.02),e.lineTo(a+t*.5,l+o*.2),e.moveTo(a+t*.1,l+o*.5),e.lineTo(a+t*.1,l+o*.28),e.lineTo(a+t*.9,l+o*.28),e.lineTo(a+t*.9,l+o*.5),e.moveTo(a+t*.25,l+o*.65),e.lineTo(a+t*.75,l+o*.65),e.moveTo(a+t*.5,l+o*.5),e.lineTo(a+t*.5,l+o*.95)},(e,a,l,t,o)=>{e.moveTo(a+t*.5,l+o*.1),e.quadraticCurveTo(a+t*.42,l+o*.6,a+t*.08,l+o*.92),e.moveTo(a+t*.5,l+o*.4),e.quadraticCurveTo(a+t*.62,l+o*.75,a+t*.94,l+o*.9)},(e,a,l,t,o)=>{for(let r=0;r<3;r++){const n=l+o*(.15+r*.3);e.moveTo(a+t*.25,n),e.lineTo(a+t*.55,n+o*.12)}e.moveTo(a+t*.2,l+o*.95),e.lineTo(a+t*.6,l+o*.7)},(e,a,l,t,o)=>{e.strokeRect(a+t*.15,l+o*.08,t*.7,o*.84),e.moveTo(a+t*.15,l+o*.36),e.lineTo(a+t*.85,l+o*.36),e.moveTo(a+t*.15,l+o*.64),e.lineTo(a+t*.85,l+o*.64)}];function $(e){return(a,l)=>{a.save(),a.translate(l,l),a.strokeStyle="#fff",a.fillStyle="#fff",a.lineCap="square",a.lineJoin="miter",a.shadowColor="rgba(255,255,255,0.95)",a.shadowBlur=l*.1,a.lineWidth=l*.085;const t=l*1.5,o=-t/2,r=-t/2,n=i=>K[Math.floor(y(e,i,7)*K.length)],s=y(e,0,3);if(a.beginPath(),s<.4){const i=.38+.08*y(e,0,4);n(1)(a,o,r,t*i,t),n(2)(a,o+t*(i+.04),r,t*(.96-i),t)}else if(s<.75){const i=.4+.1*y(e,0,5);n(3)(a,o,r,t,t*i),n(4)(a,o,r+t*(i+.04),t,t*(.96-i))}else a.moveTo(o+t*.05,r+t),a.lineTo(o+t*.05,r+t*.05),a.lineTo(o+t*.95,r+t*.05),a.lineTo(o+t*.95,r+t*.92),a.lineTo(o+t*.8,r+t*.86),n(5)(a,o+t*.2,r+t*.22,t*.6,t*.66);a.stroke(),a.restore()}}function I0(e,a){e.save(),e.shadowColor="rgba(255,255,255,0.9)",e.shadowBlur=a*.15,e.fillStyle="#fff",e.beginPath(),e.arc(a,a,a*.72,0,h),e.fill(),e.globalCompositeOperation="destination-out",e.shadowBlur=0,e.beginPath(),e.arc(a*1.36,a*.82,a*.66,0,h),e.fill(),e.restore()}function N(e){return(a,l)=>{const t=e==="ring"?l*.5:l*.82;a.save(),a.translate(l,l),e==="ring"&&(a.strokeStyle="rgba(255,255,255,0.75)",a.lineWidth=l*.06,a.beginPath(),a.ellipse(0,0,l*.95,l*.24,-.35,Math.PI,h),a.stroke()),a.beginPath(),a.arc(0,0,t,0,h),a.save(),a.clip();const o=a.createRadialGradient(-t*.35,-t*.35,t*.1,0,0,t);if(o.addColorStop(0,"#fff"),o.addColorStop(.7,"#9a9a9a"),o.addColorStop(1,"#2a2a2a"),a.fillStyle=o,a.fillRect(-t,-t,t*2,t*2),a.globalCompositeOperation="multiply",e==="world")for(let n=0;n<9;n++)a.fillStyle="rgba(120,120,120,0.9)",a.beginPath(),a.ellipse((y(5,n,1)-.5)*t*1.4,(y(5,n,2)-.5)*t*1.4,t*(.15+y(5,n,3)*.3),t*(.1+y(5,n,4)*.2),y(5,n,5)*3,0,h),a.fill();else for(let n=0;n<7;n++)a.fillStyle=`rgba(150,150,150,${.4+.5*y(9,n,1)})`,a.fillRect(-t,-t+(n+.3*y(9,n,2))*t*.3,t*2,t*(.08+.1*y(9,n,3)));a.restore(),a.globalCompositeOperation="source-over",e==="ring"&&(a.strokeStyle="rgba(255,255,255,0.85)",a.lineWidth=l*.06,a.beginPath(),a.ellipse(0,0,l*.95,l*.24,-.35,0,Math.PI),a.stroke());const r=a.createRadialGradient(0,0,t*.85,0,0,t*1.12);r.addColorStop(0,"rgba(255,255,255,0)"),r.addColorStop(.5,"rgba(255,255,255,0.35)"),r.addColorStop(1,"rgba(255,255,255,0)"),a.fillStyle=r,a.beginPath(),a.arc(0,0,t*1.12,0,h),a.fill(),a.restore()}}function R0(e,a){e.save(),e.translate(a,a*1.1),e.strokeStyle="#fff",e.fillStyle="rgba(255,255,255,0.32)",e.lineWidth=a*.05,e.lineCap="round",e.shadowColor="#fff",e.shadowBlur=a*.08;const l=[[-.42,.02,.26],[0,-.16,.36],[.4,.04,.24]];e.beginPath();for(const[t,o,r]of l)e.moveTo(t*a+r*a,o*a),e.arc(t*a,o*a,r*a,0,h);e.fill();for(const[t,o,r]of l)e.beginPath(),e.arc(t*a,o*a,r*a,Math.PI*.9,Math.PI*2.15),e.stroke(),e.beginPath(),e.arc(t*a+r*a*.2,o*a+r*a*.05,r*a*.45,Math.PI,Math.PI*2.3),e.stroke();e.beginPath(),e.moveTo(-.85*a,.2*a),e.quadraticCurveTo(0,.32*a,.85*a,.2*a),e.stroke(),e.restore()}function w0(e,a){const l=a*2,t=e.createImageData(l,l),o=(r,n)=>{const s=.62*Math.pow(Math.max(0,1-n),.6)*Math.min(1,.55+n*3)*(1+.14*Math.sin(n*7.5)),i=.16*Math.sin(n*3.1)*n;if(Math.abs(r-i)<s&&n>.04)return!0;const d=(u,T,f)=>{const p=r-u,P=n-T;return p*p/(f*f*.35)+P*P/(f*f*1.6)<1};return d(-.36,.5,.22)||d(.34,.42,.2)||d(i+.08,.9,.12)};for(let r=0;r<l;r++)for(let n=0;n<l;n++){let s=0;for(const[d,u]of[[.25,.25],[.75,.25],[.25,.75],[.75,.75]])o(((n+d)/l-.5)*2,1-(r+u)/l)&&s++;const i=(r*l+n)*4;t.data[i]=t.data[i+1]=t.data[i+2]=255,t.data[i+3]=Math.round(s/4*255)}e.putImageData(t,0,0)}function A0(e,a){e.fillStyle="#fff",e.beginPath(),e.moveTo(a*.6,a*1.9),e.bezierCurveTo(a*.1,a*1.3,a*.5,a*.35,a*1.35,a*.12),e.bezierCurveTo(a*.95,a*.5,a*.8,a*1.1,a*1.05,a*1.55),e.bezierCurveTo(a*.95,a*1.75,a*.8,a*1.9,a*.6,a*1.9),e.fill()}function G0(e,a){const l=[[0,.1,.42],[-.42,.22,.3],[.42,.24,.32],[-.2,-.28,.32],[.26,-.3,.3],[-.5,-.12,.22],[.55,-.08,.22]],t=(o,r=0,n=0)=>{e.beginPath();for(const[s,i,d]of l)e.moveTo(a+(s+r)*a*o+d*a*o,a+(i+n)*a*o),e.arc(a+(s+r)*a*o,a+(i+n)*a*o,d*a*o,0,Math.PI*2)};e.fillStyle="#b8c0c8",t(.9),e.fill(),e.save(),t(.9),e.clip(),e.fillStyle="#ffffff",t(.9,-.07,-.08),e.fill(),e.restore()}const E0=[m0,u0,S0,(e,a)=>p0(e,a),v0,T0,P0,C0,k0,x0,M0,W0,y0,...[3,7,12,21,30,44,53,61,77,85,92,108,117,131,140,156].map($),I0,N("band"),N("world"),N("ring"),R0,w0,A0,G0];let U=null;function D0(){if(U)return U;const e=document.createElement("canvas");e.width=e.height=q*j;const a=e.getContext("2d");return E0.forEach((l,t)=>{const o=document.createElement("canvas");o.width=o.height=q;const r=o.getContext("2d");l(r,q/2),a.drawImage(o,t%j*q,Math.floor(t/j)*q)}),U=e}const J=q,Q=j;function O0(e,a,l,t){const o=[];for(let s=0;s<5;s++)for(let i=0;i<3;i++)o.push([(i-1)*t*.32,(s-2)*t*.2]);const r=2+Math.floor(y(a,l,1)*3);e.beginPath();let n=Math.floor(y(a,l,2)*o.length);for(let s=0;s<r;s++){const i=(n+1+Math.floor(y(a,l,3+s)*(o.length-1)))%o.length;e.moveTo(...o[n]),e.lineTo(...o[i]),n=i}e.stroke(),y(a,l,9)>.6&&(e.beginPath(),e.arc(0,-t*.5,t*.05,0,h),e.fill())}function E(e,a,l,t,o=0){e.beginPath();for(let r=0;r<=a;r++){const n=o+r*l*h/a,s=Math.cos(n)*t,i=Math.sin(n)*t;r?e.lineTo(s,i):e.moveTo(s,i)}e.closePath(),e.stroke()}function Z(e){const t=document.createElement("canvas");t.width=t.height=1024;const o=t.getContext("2d");o.translate(512,512),o.strokeStyle="#fff",o.fillStyle="#fff",o.lineCap="round",o.lineJoin="round";const r=(i,d,u=1)=>{o.globalAlpha=u,o.lineWidth=d,o.beginPath(),o.arc(0,0,i,0,h),o.stroke(),o.globalAlpha=1},n=(i,d,u,T)=>{for(let f=0;f<u;f++)o.save(),o.rotate(f/u*h),o.translate(0,-(i+d)/2),o.lineWidth=5,O0(o,T,f,d-i),o.restore()};if(o.shadowColor="rgba(255,255,255,0.9)",o.shadowBlur=14,e==="a"){r(512*.97,10),r(512*.93,3.5),r(512*.7,6),r(512*.665,3),n(512*.72,512*.91,28,3);for(let i=0;i<12;i++)o.save(),o.rotate(i/12*h),o.fillRect(-4,-512*.955,8,512*.025),o.restore();o.lineWidth=6,E(o,6,2,512*.665,-Math.PI/2),E(o,6,1,512*.665,-Math.PI/2),r(512*.38,7),r(512*.34,3),o.lineWidth=5,E(o,3,1,512*.34,-Math.PI/2),E(o,3,1,512*.34,Math.PI/2),n(512*.4,512*.52,12,5);for(let i=0;i<6;i++)o.save(),o.rotate(i/6*h-Math.PI/2),o.beginPath(),o.arc(512*.665,0,14,0,h),o.fill(),o.restore();o.beginPath(),o.arc(0,0,22,0,h),o.fill(),r(52,5)}else{r(512*.98,6),r(512*.94,12),r(512*.88,3),o.lineWidth=6;for(let i=0;i<96;i++)o.save(),o.rotate(i/96*h),o.fillRect(-2,-512*.9,4,i%4?512*.025:512*.05),o.restore();n(512*.62,512*.82,24,11),r(512*.6,5),r(512*.56,8),o.lineWidth=6,E(o,8,3,512*.56,0),E(o,8,1,512*.56,Math.PI/8);for(let i=0;i<8;i++)o.save(),o.rotate(i/8*h),o.beginPath(),o.arc(512*.56,0,18,0,h),o.stroke(),o.beginPath(),o.arc(512*.56,0,6,0,h),o.fill(),o.restore();r(512*.3,6),o.lineWidth=5,E(o,4,1,512*.3,Math.PI/4),E(o,4,1,512*.3,0),n(512*.32,512*.44,8,17);for(let i=0;i<4;i++)o.save(),o.rotate(i/4*h),o.beginPath(),o.arc(0,-512*.1,512*.07,.3,Math.PI-.3),o.stroke(),o.restore();o.beginPath(),o.arc(0,0,16,0,h),o.fill()}o.setTransform(1,0,0,1,0,0),o.shadowBlur=0;const s=o.getImageData(0,0,1024,1024);for(let i=0;i<s.data.length;i+=4){const d=Math.max(s.data[i+3],0);s.data[i]=255,s.data[i+1]=255,s.data[i+2]=255,s.data[i+3]=d}return o.putImageData(s,0,0),t}function z(e,a,l){e.setTransform(1,0,0,1,0,0),e.shadowBlur=0;const t=e.getImageData(0,0,a,l);for(let o=0;o<t.data.length;o+=4){const r=Math.max(t.data[o],t.data[o+1],t.data[o+2])*t.data[o+3]/255;t.data[o]=t.data[o+1]=t.data[o+2]=255,t.data[o+3]=r}e.putImageData(t,0,0)}function B(e,a){const l=document.createElement("canvas");return l.width=e,l.height=a,[l,l.getContext("2d")]}function L0(){const[l,t]=B(1024,1024),o=512*.5;t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.shadowColor="#fff",t.shadowBlur=18,t.strokeStyle="#fff",t.lineCap="round",t.fillStyle="rgb(26,26,26)",t.beginPath(),t.arc(0,0,o,0,h),t.fill(),t.fillStyle="#fff",t.beginPath(),t.arc(0,0,o,-Math.PI/2,Math.PI/2),t.arc(0,o/2,o/2,Math.PI/2,-Math.PI/2,!0),t.arc(0,-o/2,o/2,Math.PI/2,-Math.PI/2),t.fill(),t.fillStyle="rgb(26,26,26)",t.beginPath(),t.arc(0,-o/2,o*.13,0,h),t.fill(),t.fillStyle="#fff",t.beginPath(),t.arc(0,o/2,o*.13,0,h),t.fill(),t.lineWidth=9,t.beginPath(),t.arc(0,0,o,0,h),t.stroke(),t.lineWidth=4,t.beginPath(),t.arc(0,0,o*1.08,0,h),t.stroke();for(let r=0;r<8;r++){t.save(),t.rotate(r/8*h),t.lineWidth=15;for(let n=0;n<3;n++){const s=-(o*1.3+n*30),i=o*.34,d=r+1>>n&1;t.beginPath(),d?(t.moveTo(-i,s),t.lineTo(-i*.18,s),t.moveTo(i*.18,s),t.lineTo(i,s)):(t.moveTo(-i,s),t.lineTo(i,s)),t.stroke()}t.restore()}t.lineWidth=5,t.beginPath(),t.arc(0,0,512*.9,0,h),t.stroke(),t.lineWidth=12,t.beginPath(),t.arc(0,0,512*.95,0,h),t.stroke();for(let r=0;r<64;r++)t.save(),t.rotate(r/64*h),t.fillStyle="#fff",t.fillRect(-2.5,-512*.9,5,r%8?14:30),t.restore();return z(t,1024,1024),l}function _0(){const[l,t]=B(512,1536);t.fillStyle="#000",t.fillRect(0,0,512,1536),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=16;const o=46,r=466,n=230,s=1386;t.globalAlpha=.07,t.fillRect(o,n,r-o,s-n),t.globalAlpha=1,t.lineWidth=10,t.strokeRect(o,n,r-o,s-n),t.lineWidth=4,t.strokeRect(o+22,n+22,r-o-44,s-n-44),t.lineWidth=9,t.beginPath(),t.moveTo(o-10,n),t.bezierCurveTo(o,60,r,60,r+10,n),t.stroke(),t.lineWidth=5;for(const d of[-1,1])t.beginPath(),t.arc(512/2+d*120,150,34,0,h*.8),t.stroke(),t.beginPath(),t.arc(512/2+d*60,118,22,Math.PI,h*.9),t.stroke();t.beginPath(),t.arc(512/2,112,26,0,h),t.fill(),t.lineWidth=4,t.beginPath(),t.arc(512/2,112,44,0,h),t.stroke();const i=[3,7,12,21,30,44,53,61,77,85];for(let d=0;d<3;d++)for(let u=0;u<13;u++){const T=o+92+d*118,f=n+90+u*86,p=i[(d*13+u)%i.length]+u*3+d;y(p,1,99)<.08||(t.save(),t.translate(T-40,f-40),t.scale(80/256,80/256),$(p)(t,128),t.restore())}t.lineWidth=6;for(let d=-3;d<=3;d++)t.beginPath(),t.ellipse(512/2+d*52,s+62,30,58,d*.22,Math.PI,h),t.stroke();return t.lineWidth=8,t.beginPath(),t.moveTo(o-20,s+70),t.lineTo(r+20,s+70),t.stroke(),z(t,512,1536),l}function q0(){const[l,t]=B(1024,1024);t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.shadowColor="#fff",t.shadowBlur=12;const o=(r,n)=>{t.lineWidth=n,t.beginPath(),t.arc(0,0,r,0,h),t.stroke()};o(512*.98,5),o(512*.95,12),o(512*.79,4),o(512*.76,8),o(512*.5,6),o(512*.46,3),o(512*.2,6);for(let r=0;r<24;r++)t.save(),t.rotate(r/24*h),t.translate(0,-512*.865),t.scale(60/256,60/256),$(100+r)(t,128),t.restore();for(let r=0;r<180;r++)t.save(),t.rotate(r/180*h),t.fillRect(-1.5,-512*.76,3,r%15?10:26),t.restore();for(let r=0;r<12;r++)t.save(),t.rotate(r/12*h),t.lineWidth=3,t.beginPath(),t.moveTo(0,-512*.2),t.lineTo(0,-512*.74),t.stroke(),t.beginPath(),t.arc(0,-512*.62,20,0,h),t.stroke(),t.beginPath(),t.arc(0,-512*.62,7,0,h),t.fill(),t.restore();t.lineWidth=4,E(t,12,5,512*.46,0),E(t,4,1,512*.46,Math.PI/4);for(let r=0;r<16;r++)t.save(),t.rotate(r/16*h),t.beginPath(),t.moveTo(-12,-512*.06),t.lineTo(0,-512*.19),t.lineTo(12,-512*.06),t.fill(),t.restore();return t.beginPath(),t.arc(0,0,512*.07,0,h),t.fill(),z(t,1024,1024),l}function z0(){const[l,t]=B(512,512),o=256*.86;t.fillStyle="#000",t.fillRect(0,0,512,512);const r=t.createRadialGradient(256-o*.25,256-o*.25,o*.1,256,256,o);r.addColorStop(0,"#fff"),r.addColorStop(.8,"#e6e6e6"),r.addColorStop(1,"#a8a8a8"),t.fillStyle=r,t.beginPath(),t.arc(256,256,o,0,h),t.fill(),t.save(),t.beginPath(),t.arc(256,256,o,0,h),t.clip();for(let n=0;n<18;n++){const s=y(17,n,1)*h,i=Math.sqrt(y(17,n,2))*o*.75,d=o*(.08+y(17,n,3)*.22),u=t.createRadialGradient(256+Math.cos(s)*i,256+Math.sin(s)*i,0,256+Math.cos(s)*i,256+Math.sin(s)*i,d);u.addColorStop(0,"rgba(0,0,0,0.32)"),u.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=u,t.fillRect(0,0,512,512)}return t.restore(),z(t,512,512),l}function X(e){const[l,t]=B(1024,1024),o=b0[e],r=f=>(.5+f)*1024,n=f=>(1-f)*1024;t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.lineJoin="round",t.lineCap="round";const s=f=>{t.beginPath(),"e"in f&&f.e?t.ellipse(r(f.e[0]),n(f.e[1]),f.e[2]*1024,f.e[3]*1024,0,0,h):(f.p.forEach(([P,b],x)=>x?t.lineTo(r(P),n(b)):t.moveTo(r(P),n(b))),t.closePath())},i=t.createRadialGradient(r(o.heart[0]),n(o.heart[1]),1024*.02,r(o.heart[0]),n(o.heart[1]),1024*.6);i.addColorStop(0,"rgba(255,255,255,0.55)"),i.addColorStop(1,"rgba(255,255,255,0.22)");for(const f of o.shapes)s(f),t.fillStyle=f.dim?"rgba(255,255,255,0.12)":i,t.fill();t.shadowColor="#fff",t.shadowBlur=18;for(const f of o.shapes)s(f),t.strokeStyle=f.dim?"rgba(255,255,255,0.35)":"rgba(255,255,255,0.9)",t.lineWidth=f.dim?3:5,t.stroke();t.lineWidth=4,t.strokeStyle="rgba(255,255,255,0.75)";for(const[f,p,P]of o.folds)t.beginPath(),t.moveTo(r(f[0]),n(f[1])),t.quadraticCurveTo(r(p[0]),n(p[1]),r(P[0]),n(P[1])),t.stroke();const[d,u]=o.eyes[1],T=d*1024;t.lineWidth=4,t.strokeStyle="rgba(255,255,255,0.9)";for(const f of[-1,1])t.beginPath(),t.moveTo(r(f*d*.4),n(u+.022)),t.quadraticCurveTo(r(f*d*1.1),n(u+.035),r(f*d*1.8),n(u+.02)),t.stroke();t.beginPath(),t.moveTo(r(-d*.5),n(u-.055)),t.quadraticCurveTo(r(0),n(u-.062),r(d*.5),n(u-.055)),t.stroke(),t.fillStyle="#fff",t.beginPath(),t.ellipse(r(o.brow[0]),n(o.brow[1]),T*.12,T*.3,0,0,h),t.fill(),t.lineWidth=3,t.strokeStyle="rgba(255,255,255,0.4)";for(let f=0;f<14;f++){const p=(f/13-.5)*2,P=o.head[0]+p*.05,b=o.head[1]+.06;t.beginPath(),t.moveTo(r(P),n(b)),t.bezierCurveTo(r(P+p*.08),n(b+.08),r(P+p*.2+.03*Math.sin(f)),n(b+.02),r(P+p*.3),n(b+.1+.04*y(4,f,1))),t.stroke()}if("beads"in o&&o.beads)for(const[f,p]of o.beads)t.fillStyle="#fff",t.beginPath(),t.arc(r(f),n(p),1024*.022,0,h),t.fill();return z(t,1024,1024),l}function B0(){const[l,t]=B(1024,1024);t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=14;const o=(r,n)=>{t.lineWidth=n,t.beginPath(),t.arc(0,0,r,0,h),t.stroke()};o(512*.97,4),o(512*.93,9),o(512*.6,4),o(512*.56,2),t.lineWidth=4,t.beginPath();for(let r=0;r<3;r++){const n=-Math.PI/2+r*h/3;t.lineTo(Math.cos(n)*512*.92,Math.sin(n)*512*.92)}t.closePath(),t.stroke(),t.lineWidth=3,t.beginPath(),t.moveTo(0,-512*.93),t.lineTo(0,512*.93),t.moveTo(-512*.93,0),t.lineTo(512*.93,0),t.stroke();for(const[r,n]of[[-.55,.5],[.55,.5],[-.62,-.28],[.62,-.28]])for(let s=0;s<3;s++)for(let i=1;i<=3;i++)t.lineWidth=3,t.beginPath(),t.arc((r+(s-1)*.12)*512,n*512,i*512*.035,Math.PI,h),t.stroke();for(const[r,n,s]of[[0,-.72,61],[-.68,.16,92],[.68,.16,140]])t.lineWidth=6,t.beginPath(),t.arc(r*512,n*512,512*.15,0,h),t.stroke(),t.lineWidth=2,t.beginPath(),t.arc(r*512,n*512,512*.18,0,h),t.stroke(),t.save(),t.translate(r*512-512*.11,n*512-512*.11),t.scale(512*.22/256,512*.22/256),$(s)(t,128),t.restore();for(let r=0;r<72;r++)t.save(),t.rotate(r/72*h),t.fillRect(-2,-512*.93,4,r%6?12:26),t.restore();return t.save(),t.translate(-512*.16,-512*.16),t.scale(512*.32/256,512*.32/256),$(185)(t,128),t.restore(),z(t,1024,1024),l}const F0={rune0:()=>Z("a"),rune1:()=>Z("b"),taiji:L0,stele:_0,wheel:q0,moon:z0,fig_thien:()=>X("thien"),fig_dung:()=>X("dung"),fig_ban_than:()=>X("ban_than"),seal:B0},g=new Map;function $0(e){let a=g.get(e);return a||(a=F0[e](),g.set(e,a)),a}const H0=e=>({...J0(e),...o0[e.preset]?.thumb}),J0=e=>e.attach==="path"||e.attach==="gun"?{x0:-.6,x1:8.6,y0:-.2,y1:3.3,axis:"z"}:e.attach==="sky"?{x0:-2.5,x1:2.5,y0:-.2,y1:9.2,axis:"x"}:e.attach==="area"?{x0:-4,x1:4,y0:-.2,y1:4.8,axis:"x"}:{x0:-2.4,x1:2.4,y0:-.2,y1:3,axis:"x"},t0=new Map;function r0(e){let a=t0.get(e.id);if(!a){const l=l0(e,3),t=n0(l,{color:e.color,size:1});a={entry:e,layers:t,bufs:t.map(o=>o.k==="particles"?s0(o.max):o.k==="segments"?f0(o.max):o.k==="swords"?new Float32Array(o.max*16+o.max):new Float32Array(0)),view:H0(e),dur:Math.min(e.duration,4),tail:i0(e.preset)},t0.set(e.id,a)}return a}const Y=e=>Math.round(255*Math.min(1,Math.pow(Math.max(0,e),1/2.2))),I=(e,a,l,t)=>`rgba(${Y(e)},${Y(a)},${Y(l)},${Math.max(0,Math.min(1,t))})`,j0=13,e0=new Map;function a0(e,a,l,t,o){const r=x=>Math.round(Math.min(1,x)*15),n=`${e}|${a}|${r(l)}|${r(t)}|${r(o)}`;let s=e0.get(n);if(s)return s;const i=e==="atlas",d=i?D0():$0(e),u=i?a%Q*J:0,T=i?Math.floor(a/Q)*J:0,f=i?J:d.width,p=i?J:d.height,P=Math.min(1,256/Math.max(f,p));s=document.createElement("canvas"),s.width=Math.max(1,Math.round(f*P)),s.height=Math.max(1,Math.round(p*P));const b=s.getContext("2d");return b.drawImage(d,u,T,f,p,0,0,s.width,s.height),b.globalCompositeOperation="source-in",b.fillStyle=I(r(l)/15,r(t)/15,r(o)/15,1),b.fillRect(0,0,s.width,s.height),e0.set(n,s),s}function N0(e,a,l,t,o){const r=r0(a),n=r.view,s=Math.min(t/(n.x1-n.x0),o/(n.y1-n.y0)),i=(t-s*(n.x1-n.x0))/2,d=o-(o-s*(n.y1-n.y0))/2,u=n.tilt??0,T=b=>i+((n.axis==="z"?b[2]:b[0])-n.x0)*s,f=b=>d-(b[1]-(n.axis==="z"?-b[0]:b[2])*u-n.y0)*s,p=e.createLinearGradient(0,0,0,o);p.addColorStop(0,"#0a0e14"),p.addColorStop(1,"#141b22"),e.globalCompositeOperation="source-over",e.fillStyle=p,e.fillRect(0,0,t,o),e.fillStyle="rgba(255,255,255,.07)",e.fillRect(0,f([0,0,0]),t,1),e.globalCompositeOperation="lighter";const P=c0([0,0,0],0,1);r.layers.forEach((b,x)=>{const m=r.bufs[x];if(e.globalCompositeOperation=b.blend==="alpha"?"source-over":"lighter",b.k==="particles"){const S=b.eval(l,P,m);for(let v=0;v<S;v++){const c=v*d0,C=T([m[c],m[c+1],m[c+2]]),M=f([m[c],m[c+1],m[c+2]]),k=Math.max(.8,m[c+3]*s*.5),W=m[c+9],L=Math.floor(m[c+13]);if(W<.01)continue;const D=Math.max(m[c+6],m[c+7],m[c+8],1),A=m[c+6]/D,R=m[c+7]/D,O=m[c+8]/D;if(b.tex!=="atlas"||L>=j0){const _=a0(b.tex,b.tex==="atlas"?L:0,A,R,O),w=m[c+3]*s,F=m[c+4]*s;e.save(),e.globalAlpha=Math.min(1,W*(D>1.5?1.2:1)),e.translate(C,M),b.facing===1&&e.scale(1,.22),e.rotate(-m[c+5]),e.drawImage(_,-w/2,-F/2,w,F),e.restore();continue}if(b.facing===3){const _=n.axis==="z"?m[c+12]:m[c+10],w=m[c+11],F=m[c+4]*s;e.strokeStyle=I(A,R,O,W*.9),e.lineWidth=Math.max(1,m[c+3]*s),e.beginPath(),e.moveTo(C,M),e.lineTo(C-_*F,M+w*F),e.stroke()}else if(b.facing===1){const _=L===3||b.tex!=="atlas";if(e.save(),e.translate(C,M),e.scale(1,.22),_)e.strokeStyle=I(A,R,O,W*.9),e.lineWidth=Math.max(1,k*.06),e.beginPath(),e.arc(0,0,k,0,6.3),e.stroke();else{const w=e.createRadialGradient(0,0,0,0,0,k);w.addColorStop(0,I(A,R,O,W*.8)),w.addColorStop(1,I(A,R,O,0)),e.fillStyle=w,e.beginPath(),e.arc(0,0,k,0,6.3),e.fill()}e.restore()}else{if(L===3||L===10){e.strokeStyle=I(A,R,O,W*.8),e.lineWidth=Math.max(1,k*.1),e.beginPath(),e.arc(C,M,k*.8,0,6.3),e.stroke();return}const w=e.createRadialGradient(C,M,0,C,M,k);w.addColorStop(0,I(A,R,O,Math.min(1,W*(D>1.5?1.2:.9)))),w.addColorStop(.35,I(A,R,O,W*.35)),w.addColorStop(1,I(A,R,O,0)),e.fillStyle=w,e.beginPath(),e.arc(C,M,k,0,6.3),e.fill()}}}else if(b.k==="segments"){const S=b.eval(l,P,m);for(let v=0;v<S;v++){const c=v*h0,C=m[c+11];if(C<.01)continue;const M=Math.max(m[c+8],m[c+9],m[c+10],1);e.strokeStyle=I(m[c+8]/M,m[c+9]/M,m[c+10]/M,C),e.lineWidth=Math.max(1,m[c+6]*s*1.6),e.lineCap="round",e.beginPath(),e.moveTo(T([m[c],m[c+1],m[c+2]]),f([m[c],m[c+1],m[c+2]])),e.lineTo(T([m[c+3],m[c+4],m[c+5]]),f([m[c+3],m[c+4],m[c+5]])),e.stroke()}}else if(b.k==="swords"){const S=m.subarray(0,b.max*16),v=m.subarray(b.max*16),c=b.eval(l,P,S,v);e.strokeStyle="rgba(210,235,255,.95)",e.lineWidth=Math.max(1,.035*s*2),e.lineCap="round";for(let C=0;C<c;C++){const M=C*16,k=[S[M+12],S[M+13],S[M+14]],W=[k[0]+S[M+4]*.78,k[1]+S[M+5]*.78,k[2]+S[M+6]*.78];e.beginPath(),e.moveTo(T(k),f(k)),e.lineTo(T(W),f(W)),e.stroke()}}else if(b.k==="water"){if(!b.eval(l,P))return;e.fillStyle="rgba(70,150,200,.35)",e.beginPath(),e.moveTo(0,o);for(let v=0;v<=t;v+=4){const c=v/t;e.lineTo(v,o*.62+Math.sin(c*14+l*3)*4+Math.sin(c*31-l*2)*1.5-(b.mode==="wave"?Math.max(0,Math.sin(Math.min(1,c-.2+l*.2)*3))*o*.35:0))}e.lineTo(t,o),e.closePath(),e.fill()}else if(b.k==="props"){const S=new Float32Array(b.max*16),v=new Float32Array(b.max*3),c=b.eval(l,P,S,v);for(let C=0;C<c;C++){const M=C*16,k=T([S[M+12],S[M+13],S[M+14]]),W=f([S[M+12],S[M+13],S[M+14]]);e.fillStyle=I(v[C*3]+.25,v[C*3+1]+.2,v[C*3+2]+.15,.95),e.fillRect(k-1.5,W-1.5,3,3)}}else if(b.k==="ghost"){const S=b.eval(l,P);if(S&&S.alpha>.01){const v=a0("fig_"+b.figure,0,Math.min(1,S.color[0]),Math.min(1,S.color[1]),Math.min(1,S.color[2])),c=1.75*S.scale*(b.figure==="thien"?.62:1)*s,C=T([S.offset[0],0,S.offset[2]]),M=f([S.offset[0],S.offset[1],S.offset[2]]);e.save(),e.globalAlpha=Math.min(1,S.alpha)*.9,e.drawImage(v,C-c/2,M-c,c,c),e.restore()}}else if(b.k==="shell"){const S=b.eval(l,P);for(const v of Array.isArray(S)?S:S?[S]:[]){const c=v.color,C=Math.min(1,v.alpha*.9),M=Math.max(c[0],c[1],c[2],1);if(b.shape==="dome")e.strokeStyle=I(c[0]/M,c[1]/M,c[2]/M,C*.9),e.lineWidth=1.5,e.beginPath(),e.arc(T(v.pos),f(v.pos),v.scale[0]*s,0,6.3),e.stroke();else{const k=T(v.pos),W=f(v.pos),L=v.scale[0]*s*2,D=v.scale[1]*s,A=v.dir[1]>.7,R=e.createLinearGradient(0,W,0,W-D);R.addColorStop(0,I(c[0]/M,c[1]/M,c[2]/M,C*.6)),R.addColorStop(1,I(c[0]/M,c[1]/M,c[2]/M,0)),e.fillStyle=R,A&&e.fillRect(k-L/2,W-D,L,D)}}}}),e.globalCompositeOperation="source-over"}const U0=e=>o0[e.preset]?.thumb?.at??Math.min(e.duration,4)*.42,X0=e=>{const a=r0(e);return a.dur+a.tail*.5},V0=Object.freeze(Object.defineProperty({__proto__:null,drawThumb:N0,thumbLoopLength:X0,thumbRestTime:U0},Symbol.toStringTag,{value:"Module"}));export{Q as A,U0 as a,$0 as b,D0 as c,N0 as d,V0 as e,X0 as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-C5pOWyBM.js","assets/titleFrameBudget-BjW--v_T.js"])))=>i.map(i=>d[i]);
2
- import{PMREMGenerator as ie,SRGBColorSpace as oe,Texture as J,CanvasTexture as ae,Group as M,MeshStandardMaterial as I,Color as Z,BoxGeometry as C,Mesh as l,PlaneGeometry as re,CircleGeometry as $,MeshBasicMaterial as ee,CylinderGeometry as ce,ExtrudeGeometry as de,ShapeGeometry as he,Shape as le,Scene as ue,PerspectiveCamera as pe,Plane as D,WebGLRenderer as me,HemisphereLight as fe,DirectionalLight as we,Box3 as z,Vector3 as p,AnimationMixer as ye,Matrix4 as q,Matrix3 as ge,Quaternion as H,Euler as xe,BufferGeometry as U,BufferAttribute as R,ShaderMaterial as ve,Points as be,GridHelper as Me,Raycaster as Ae,Vector2 as ze,LoopRepeat as Pe,Line as Se,LineBasicMaterial as Ce}from"./three.module-Bx43vjkH.js";import{G as Y}from"./GLTFLoader-Dy6SrZg8.js";import{az as Oe}from"./api-C5pOWyBM.js";import{lJ as O,_ as Te,fy as V,fz as Ee,lK as Ie,lL as We,lM as Fe,lN as Le,lO as _e,lP as De,cb as Re,f7 as Be,f9 as Ge,ec as B,fp as je}from"./titleFrameBudget-BjW--v_T.js";import{R as ke}from"./RoomEnvironment-Dmv_G5ka.js";const qe=new Map;async function He(r){try{const e=await(await Te(async()=>{const{signOutput:t}=await import("./api-C5pOWyBM.js").then(s=>s.c1);return{signOutput:t}},__vite__mapDeps([0,1]))).signOutput({gcsUri:r});return typeof e=="string"&&e?e:null}catch{return null}}function te(r,e,t){const s=new le,n=-r/2,o=-e/2;return t=Math.min(t,r/2,e/2),s.moveTo(n+t,o),s.lineTo(n+r-t,o),s.quadraticCurveTo(n+r,o,n+r,o+t),s.lineTo(n+r,o+e-t),s.quadraticCurveTo(n+r,o+e,n+r-t,o+e),s.lineTo(n+t,o+e),s.quadraticCurveTo(n,o+e,n,o+e-t),s.lineTo(n,o+t),s.quadraticCurveTo(n,o,n+t,o),s}function b(r,e,t){const s=new he(te(r,e,t),12),n=s.attributes.uv,o=s.attributes.position;for(let i=0;i<n.count;i++)n.setXY(i,o.getX(i)/r+.5,o.getY(i)/e+.5);return s}function P(r,e,t,s,n=.012){const o=new de(te(r-n*2,e-n*2,Math.max(.001,s-n)),{depth:t-n*2,bevelEnabled:!0,bevelThickness:n,bevelSize:n,bevelSegments:4,curveSegments:14});return o.translate(0,0,-(t-n*2)/2),o}const g=(r,e=.32)=>new I({color:r,metalness:.85,roughness:e}),E=()=>new I({color:"#050506",metalness:.2,roughness:.08}),X=r=>new I({color:r,metalness:.1,roughness:.75}),W=()=>new ee({color:"#ffffff",toneMapped:!1});function N(r,{w:e,h:t,d:s,r:n,bezel:o,island:i,lenses:a}){const c=new M;c.add(new l(P(e,t,s,n),g(r)));const d=new l(b(e-.012,t-.012,n-.006),E());d.position.z=s/2+.0015,c.add(d);const u=e-o*2,h=t-o*2,f=new l(b(u,h,Math.max(.01,n-o)),W());if(f.position.z=s/2+.003,c.add(f),i){const m=new l(b(u*.3,h*.032,h*.016),new ee({color:"#000"}));m.position.set(0,h/2-h*.035,s/2+.004),c.add(m)}if(a){const m=new l(P(e*.42,e*.42,.02,e*.1,.006),E());m.position.set(-e/2+e*.27,t/2-e*.27,-s/2-.008),c.add(m);for(let y=0;y<a;y++){const x=y*2*Math.PI/Math.max(1,a)+.6,v=new l(new ce(e*.075,e*.08,.018,28),g("#2a2a2c",.2));v.rotation.x=Math.PI/2,v.position.set(m.position.x+Math.cos(x)*e*.09,m.position.y+Math.sin(x)*e*.09,-s/2-.022),c.add(v);const A=new l(new $(e*.05,24),E());A.rotation.y=Math.PI,A.position.set(v.position.x,v.position.y,-s/2-.0315),c.add(A)}}for(const[m,y]of[[t*.22,t*.08],[t*.09,t*.08]]){const x=new l(new C(.008,y,s*.35),g(r));x.position.set(-e/2-.002,m,0),c.add(x)}const w=new l(new C(.008,t*.12,s*.35),g(r));return w.position.set(e/2+.002,t*.14,0),c.add(w),{object:c,screen:f,screenAspect:u/h}}function Ue(r,e){const t=new M,s=1.8,n=1.22,o=.045,i=new l(P(s,n,o,.06),g(r));i.rotation.x=-Math.PI/2,t.add(i);const a=new l(b(s*.86,n*.42,.02),X("#111214"));a.rotation.x=-Math.PI/2,a.position.set(0,o/2+.001,-n*.15),t.add(a);const c=new C(s*.86/15*.82,.006,n*.42/6*.78),d=X("#1b1c1f");for(let L=0;L<6;L++)for(let _=0;_<15;_++){const k=new l(c,d);k.position.set(-s*.43+(_+.5)*s*.86/15,o/2+.004,-n*.15-n*.21+(L+.5)*n*.42/6),t.add(k)}const u=new l(b(s*.36,n*.26,.025),g(r,.5));u.rotation.x=-Math.PI/2,u.position.set(0,o/2+.0012,n*.27),t.add(u);const h=new M;h.position.set(0,o/2,-n/2),t.add(h);const f=1.16,w=.022,m=new M;m.position.set(0,f/2,0),h.add(m),m.add(new l(P(s,f,w,.05),g(r)));const y=new l(b(s-.01,f-.01,.045),E());y.position.z=w/2+.0015,m.add(y);const x=s-.09,v=f-.1,A=new l(b(x,v,.012),W());A.position.set(0,.01,w/2+.003),m.add(A);const F=new l(new $(.07,40),g("#e9e9ea",.15));F.rotation.y=Math.PI,F.position.z=-w/2-.002,m.add(F);const j=Math.max(0,Math.min(1,e));return h.rotation.x=(1-j)*Math.PI/2-j*.26,{object:t,screen:A,screenAspect:x/v}}function Ye(r){const e=new M,t=1.8,s=1.04,n=.035;e.add(new l(P(t,s,n,.02,.006),g(r,.45)));const o=t-.04,i=s-.04,a=new l(b(o,i,.006),W());a.position.z=n/2+.002,e.add(a);const c=new l(new C(.12,.32,.04),g(r,.4));c.position.set(0,-s/2-.14,-.05),e.add(c);const d=new l(P(.62,.26,.025,.08,.006),g(r,.4));return d.rotation.x=-Math.PI/2,d.position.set(0,-s/2-.3,-.02),e.add(d),{object:e,screen:a,screenAspect:o/i}}function Ve(r){const e=new M,t=1.2,s=1.6,n=.42,o=new I({color:new Z(r).multiplyScalar(.62),metalness:0,roughness:.85}),i=new C(t,s,n);e.add(new l(i,o));const a=new l(new re(t*.98,s*.98),W());return a.position.z=n/2+.002,e.add(a),{object:e,screen:a,screenAspect:t/s}}function Xe(r){const e=r.color??(r.type==="box"?O.white:r.type==="tv"?O.black:r.type==="laptop"?O.silver:O.titanium);switch(r.type){case"phone":return N(e,{w:.83,h:1.8,d:.075,r:.13,bezel:.032,island:!0,lenses:3});case"tablet":return N(e,{w:1.35,h:1.8,d:.06,r:.09,bezel:.05,island:!1,lenses:1});case"laptop":return Ue(e,r.open??1);case"tv":return Ye(e);default:return Ve(e)}}const K=new WeakMap;function Ne(r){let e=K.get(r);if(!e){const t=new ie(r);e=t.fromScene(new ke,0,.1,100,{size:64}).texture,t.dispose(),K.set(r,e)}return e}class Ke{constructor(e,t,s){this.mesh=e,this.aspect=t,this.media=s;const n=o=>s.kind==="video"?this.loadVideo(o):this.loadImage(o);this.ready=s?.url?n(s.url).catch(async o=>{const i=s.gcsUri?await He(s.gcsUri):null;if(!i||i===s.url)throw o;return n(i)}):Promise.resolve(),s?.url||e.material.color.set("#0d0f12")}texture=null;video=null;ready;whenReady(){return this.ready}fit(e,t){const s=this.texture,n=e/t;n>this.aspect?(s.repeat.set(this.aspect/n,1),s.offset.set((1-this.aspect/n)/2,0)):(s.repeat.set(1,n/this.aspect),s.offset.set(0,(1-n/this.aspect)/2))}apply(e,t,s){e.colorSpace=oe,e.anisotropy=4,this.texture=e,this.fit(t,s);const n=this.mesh.material;n.map=e,n.needsUpdate=!0}loadImage(e){return new Promise((t,s)=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>{this.apply(new J(n),n.naturalWidth,n.naturalHeight),this.texture.needsUpdate=!0,t()},n.onerror=()=>s(Error("Không tải được ảnh màn hình thiết bị")),n.src=e})}canvas=null;draw(){const e=this.video,t=this.canvas;!e||!t||e.readyState<2||(t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.texture&&(this.texture.needsUpdate=!0))}loadVideo(e){const t=document.createElement("video");return t.crossOrigin="anonymous",t.muted=!0,t.playsInline=!0,t.preload="auto",this.video=t,new Promise((s,n)=>{t.onloadeddata=()=>{const o=Math.min(1,1280/Math.max(t.videoWidth,t.videoHeight)),i=document.createElement("canvas");i.width=Math.max(2,Math.round(t.videoWidth*o)),i.height=Math.max(2,Math.round(t.videoHeight*o)),this.canvas=i,this.apply(new ae(i),t.videoWidth,t.videoHeight),this.draw(),s()},t.onerror=()=>n(Error("Không tải được video màn hình thiết bị")),t.src=e})}async sync(e,t=!1){const s=this.video,n=this.media;if(!s||!n||!this.texture)return;const o=Number.isFinite(s.duration)&&s.duration>0?s.duration:0;let i=(n.inPoint||0)+Math.max(0,e)*(n.speed||1);if(o&&(i=Math.min(i,o-.04)),Math.abs(s.currentTime-i)>(t?.004:.12)){const a=new Promise(c=>{const d=()=>{s.removeEventListener("seeked",d),c()};s.addEventListener("seeked",d),setTimeout(d,t?4e3:600)});if(s.currentTime=i,t)await a;else{a.then(()=>this.draw());return}}this.draw()}dispose(){this.texture?.dispose(),this.video&&(this.video.removeAttribute("src"),this.video.load(),this.video=null)}}const se=new Map,G=new Set,Qe=r=>r?se.get(r):void 0;function Je(r){return G.add(r),()=>{G.delete(r)}}const Q=(r,e)=>r.name||`Animation ${e+1}`,ne=new Map,Ze=r=>r?ne.get(r):void 0,T=600,$e="attribute float aAlpha;attribute float aSize;varying float vA;uniform float uScale;void main(){vA=aAlpha;vec4 mv=modelViewMatrix*vec4(position,1.);gl_PointSize=aSize*uScale/max(.05,-mv.z);gl_Position=projectionMatrix*mv;}",et="uniform vec3 uColor;varying float vA;void main(){vec2 d=gl_PointCoord-.5;float r=length(d);if(r>.5)discard;gl_FragColor=vec4(uColor,vA*smoothstep(.5,.05,r));}",S=Math.PI/180;class tt{canvas;renderer;scene=new ue;camera=new pe(40,1,.01,100);halfY=0;group=new M;disposed=!1;mixer=null;clips=[];action=null;rest=[];width;height;screen=null;pieces=[];dust=null;cut=[new D,new D];guides=null;buildOn=!1;constructor(e,t){this.width=e,this.height=t,this.renderer=new me({alpha:!0,antialias:!0,preserveDrawingBuffer:!0}),this.renderer.setPixelRatio(1),this.renderer.setSize(e,t,!1),this.renderer.setClearColor(0,0),this.canvas=this.renderer.domElement,this.camera.aspect=e/t,this.camera.position.set(0,0,5),this.camera.lookAt(0,0,0),this.camera.updateProjectionMatrix(),this.scene.add(this.group,new fe(16777215,7829367,3));const s=new we(16777215,3);s.position.set(3,5,5),this.scene.add(s)}async load(e){const t=await Oe(e);this.add(await new Y().loadAsync(t),e)}async loadBuffer(e,t){this.add(await new Y().parseAsync(e,""),t)}async loadDevice(e){if(!e.device)throw Error("Không phải thiết bị 3D");const t=Xe(e.device);this.scene.environment=Ne(this.renderer),this.addObject(t.object),!this.disposed&&(this.screen=new Ke(t.screen,t.screenAspect,e.deviceScreen),await this.screen.whenReady())}async prepare(e){await this.screen?.sync(e,!0)}addObject(e){if(this.disposed){this.disposeObject(e);return}const t=new z().setFromObject(e),s=t.getSize(new p),n=Math.max(s.x,s.y,s.z);e.scale.setScalar(1.8/n),e.updateMatrixWorld(!0),this.halfY=s.y*1.8/n/2,e.position.sub(new z().setFromObject(e).getCenter(new p)),e.updateMatrixWorld(!0),this.group.add(e)}add(e,t){if(this.disposed){this.disposeObject(e.scene);return}const n=new z().setFromObject(e.scene).getSize(new p),o=Math.max(n.x,n.y,n.z);if(!Number.isFinite(o)||o<=0)throw Error("GLB không có hình học hợp lệ");e.scene.scale.setScalar(1.8/o),e.scene.updateMatrixWorld(!0);const i=new z().setFromObject(e.scene).getCenter(new p);e.scene.position.sub(i),e.scene.updateMatrixWorld(!0),this.halfY=n.y*1.8/o/2,this.group.add(e.scene),this.clips=e.animations||[],this.clips.length&&(this.mixer=new ye(e.scene),e.scene.traverse(a=>{a!==e.scene&&this.rest.push({o:a,p:a.position.clone(),q:a.quaternion.clone(),s:a.scale.clone()})})),this.collectPieces(e.scene),ne.set(t,this.pieces.length),se.set(t,this.clips.map((a,c)=>({name:Q(a,c),duration:a.duration}))),G.forEach(a=>a())}collectPieces(e){this.group.updateMatrixWorld(!0);const t=[];e.traverse(c=>{c.isMesh&&t.push(c)});const s=new z().setFromObject(e),n=c=>{const d=c.getSize(new p);return d.x*d.y*d.z},o=n(s)*.02,i=s.getSize(new p),a=i.x*i.z;for(const c of t.slice(0,V.maxPieces)){const d=new z().setFromObject(c),u=d.getCenter(new p),h=d.getSize(new p),f=new q().copy(c.parent.matrixWorld).invert();this.pieces.push({o:c,p:c.position.clone(),q:c.quaternion.clone(),s:c.scale.clone(),toParent:new ge().setFromMatrix4(f),box:{bottom:d.min.y,cx:u.x,cz:u.z,h:h.y,r:Math.max(h.x,h.z)/2,big:n(d)>o,base:h.x*h.z>=a*.25&&d.min.y<=s.min.y+i.y*.03}})}}build(e,t){let s=null;try{s=e.modelBuild?Ee(e.modelBuild):null}catch{s=null}const n=new Set;this.group.traverse(i=>{const a=i.material;if(a)for(const c of Array.isArray(a)?a:[a])n.add(c)});const o=[];if(s){const i=Ie(this.pieces.map(d=>d.box),s);this.pieces.forEach((d,u)=>{const h=We(s.style,d.box,i[u],t,u,s.seed);d.o.position.copy(d.p),d.o.quaternion.copy(d.q),d.o.scale.copy(d.s),d.o.visible=h.visible,(h.dx||h.dy||h.dz)&&d.o.position.add(new p(h.dx,h.dy,h.dz).applyMatrix3(d.toParent)),(h.rx||h.ry||h.rz)&&d.o.quaternion.multiply(new H().setFromEuler(new xe(h.rx,h.ry,h.rz)))}),this.group.updateMatrixWorld(!0);const a=new p(0,1,0).applyQuaternion(this.group.getWorldQuaternion(new H)).normalize();Fe(s,t)&&o.push(this.cut[0].setFromNormalAndCoplanarPoint(a,this.group.localToWorld(new p(0,-this.halfY,0))));const c=Le(s,t,this.halfY);c!==null&&o.push(this.cut[1].setFromNormalAndCoplanarPoint(a.clone().negate(),this.group.localToWorld(new p(0,c,0)))),this.dustAt(_e(this.pieces.map(d=>d.box),i,s,t,T),s.dustColor),this.buildOn=!0}else{for(const i of this.pieces)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s),i.o.visible=!0;this.dustAt([],V.dustColor),this.buildOn=!1}this.renderer.localClippingEnabled=o.length>0;for(const i of n){const a=o.length?o:null;i.clippingPlanes!==a&&(i.clippingPlanes?.length||a)&&(i.clippingPlanes=a,i.needsUpdate=!0)}}dustAt(e,t){if(!e.length&&!this.dust)return;if(!this.dust){const a=new U;a.setAttribute("position",new R(new Float32Array(T*3),3)),a.setAttribute("aAlpha",new R(new Float32Array(T),1)),a.setAttribute("aSize",new R(new Float32Array(T),1));const c=new ve({uniforms:{uColor:{value:new Z(t)},uScale:{value:this.height*1.2}},vertexShader:$e,fragmentShader:et,transparent:!0,depthWrite:!1});this.dust=new be(a,c),this.dust.frustumCulled=!1,this.group.add(this.dust)}const s=this.dust.geometry,n=s.getAttribute("position"),o=s.getAttribute("aAlpha"),i=s.getAttribute("aSize");e.forEach((a,c)=>{n.setXYZ(c,a[0],a[1],a[2]),o.setX(c,a[3]),i.setX(c,a[4])}),s.setDrawRange(0,e.length),n.needsUpdate=o.needsUpdate=i.needsUpdate=!0,this.dust.material.uniforms.uColor.value.set(t)}setGuides(e,t=4){if(!e){this.guides&&(this.scene.remove(this.guides),this.disposeObject(this.guides),this.guides=null);return}if(this.guides)return;const s=new M,n=new Me(t,16,6742271,2781056);n.rotation.x=Math.PI/2;for(const i of Array.isArray(n.material)?n.material:[n.material])i.transparent=!0,i.opacity=.85,i.depthWrite=!1;const o=(i,a)=>new Se(new U().setFromPoints([new p,i]),new Ce({color:a}));s.add(n,o(new p(.5,0,0),16731469),o(new p(0,.5,0),5111674),o(new p(0,0,.5),5086207)),this.guides=s,this.scene.add(s)}surfaceAt(e,t){const s=new Ae;s.setFromCamera(new ze(e/this.width*2-1,1-t/this.height*2),this.camera);const n=s.ray.intersectPlane(new D(new p(0,0,1),0),new p);return n?{x:n.x,y:n.y}:null}pose(e,t){if(!this.mixer)return;const s=e.modelAnim,n=s?this.clips.find((i,a)=>Q(i,a)===s.clip):void 0;if(!s||!n){if(this.action){this.mixer.stopAllAction(),this.action=null;for(const i of this.rest)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s)}return}const o=this.mixer.clipAction(n);this.action!==o&&(this.mixer.stopAllAction(),o.setLoop(Pe,1/0),o.play(),this.action=o),o.time=De(s,n.duration,t,e.inPoint||0),this.mixer.update(0)}render(e,t,s=!1,n){const o=Re(e,Math.max(0,t),this.width,this.height),i=o,a=o.depth;if(Be(n)&&e.is3D!==!1){const u=this.width,h=this.height,f=je(u,h),w=Ge(n,e.start+Math.max(0,t),u,h);this.group.position.set(i.x*u/f,-i.y*h/f,a);const m=y=>new p(w.R[0][y],-w.R[1][y],-w.R[2][y]);this.camera.position.set(w.pos[0]/f,-w.pos[1]/f,-w.pos[2]/f),this.camera.quaternion.setFromRotationMatrix(new q().makeBasis(m(0),m(1).negate(),m(2).negate())),this.camera.fov=2*Math.atan(h/2/w.f)/S}else{this.camera.position.set(0,0,5),this.camera.quaternion.identity(),this.camera.fov=40;const h=2*(5-a)*Math.tan(this.camera.fov*S/2);this.group.position.set(i.x*h*this.camera.aspect,-i.y*h,a)}this.camera.updateProjectionMatrix(),this.group.scale.setScalar(i.zoom);const c={x:B(e,"rx",t),y:B(e,"ry",t),z:B(e,"rz",t)},d=e.modelSpin||{x:0,y:0,z:0};this.group.rotation.set((c.x+d.x*((e.inPoint||0)+t))*S,(c.y+d.y*((e.inPoint||0)+t))*S,(c.z+d.z*((e.inPoint||0)+t))*S),e.modelGround&&this.group.position.add(new p(0,1,0).applyEuler(this.group.rotation).multiplyScalar(this.halfY*i.zoom)),this.pose(e,t),(e.modelBuild||this.buildOn)&&this.build(e,t),s&&this.screen?.sync(t),this.renderer.render(this.scene,this.camera),s&&this.publish(e.id)}publish(e){const t=new z().setFromObject(this.group);if(t.isEmpty())return;let s=1/0,n=1/0,o=-1/0,i=-1/0;for(const a of[t.min.x,t.max.x])for(const c of[t.min.y,t.max.y])for(const d of[t.min.z,t.max.z]){const u=new p(a,c,d).project(this.camera),h=(u.x+1)/2*this.width,f=(1-u.y)/2*this.height;s=Math.min(s,h),o=Math.max(o,h),n=Math.min(n,f),i=Math.max(i,f)}qe.set(e,{cx:(s+o)/2,cy:(n+i)/2,w:o-s,h:i-n,angle:0,W:this.width,H:this.height})}async frame(){const e=await new Promise(n=>this.canvas.toBlob(n,"image/webp",.8));if(!e)throw Error("Không xuất được frame 3D");const t=new Uint8Array(await e.arrayBuffer());let s="";for(let n=0;n<t.length;n+=16384)s+=String.fromCharCode(...t.subarray(n,n+16384));return btoa(s)}disposeObject(e){e.traverse(t=>{const s=t;s.geometry?.dispose();for(const n of s.material?Array.isArray(s.material)?s.material:[s.material]:[]){for(const o of Object.values(n))o instanceof J&&o.dispose();n.dispose()}})}dispose(){this.disposed=!0,this.screen?.dispose(),this.screen=null,this.mixer?.stopAllAction(),this.disposeObject(this.group),this.renderer.dispose(),this.canvas.remove()}}const rt=Object.freeze(Object.defineProperty({__proto__:null,Timeline3DScene:tt,modelAnimations:Qe,modelPieces:Ze,onModelAnimations:Je},Symbol.toStringTag,{value:"Module"}));export{tt as T,Ze as a,qe as l,Qe as m,Je as o,rt as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-BsKbf3l3.js","assets/titleFrameBudget-3MFHWIT6.js"])))=>i.map(i=>d[i]);
2
+ import{PMREMGenerator as ie,SRGBColorSpace as oe,Texture as J,CanvasTexture as ae,Group as M,MeshStandardMaterial as I,Color as Z,BoxGeometry as C,Mesh as l,PlaneGeometry as re,CircleGeometry as $,MeshBasicMaterial as ee,CylinderGeometry as ce,ExtrudeGeometry as de,ShapeGeometry as he,Shape as le,Scene as ue,PerspectiveCamera as pe,Plane as D,WebGLRenderer as me,HemisphereLight as fe,DirectionalLight as we,Box3 as z,Vector3 as p,AnimationMixer as ye,Matrix4 as q,Matrix3 as ge,Quaternion as H,Euler as xe,BufferGeometry as U,BufferAttribute as R,ShaderMaterial as ve,Points as be,GridHelper as Me,Raycaster as Ae,Vector2 as ze,LoopRepeat as Pe,Line as Se,LineBasicMaterial as Ce}from"./three.module-Bx43vjkH.js";import{G as Y}from"./GLTFLoader-Dy6SrZg8.js";import{az as Oe}from"./api-BsKbf3l3.js";import{lJ as O,_ as Te,fy as V,fz as Ee,lK as Ie,lL as We,lM as Fe,lN as Le,lO as _e,lP as De,cb as Re,f7 as Be,f9 as Ge,ec as B,fp as je}from"./titleFrameBudget-3MFHWIT6.js";import{R as ke}from"./RoomEnvironment-Dmv_G5ka.js";const qe=new Map;async function He(r){try{const e=await(await Te(async()=>{const{signOutput:t}=await import("./api-BsKbf3l3.js").then(s=>s.c1);return{signOutput:t}},__vite__mapDeps([0,1]))).signOutput({gcsUri:r});return typeof e=="string"&&e?e:null}catch{return null}}function te(r,e,t){const s=new le,n=-r/2,o=-e/2;return t=Math.min(t,r/2,e/2),s.moveTo(n+t,o),s.lineTo(n+r-t,o),s.quadraticCurveTo(n+r,o,n+r,o+t),s.lineTo(n+r,o+e-t),s.quadraticCurveTo(n+r,o+e,n+r-t,o+e),s.lineTo(n+t,o+e),s.quadraticCurveTo(n,o+e,n,o+e-t),s.lineTo(n,o+t),s.quadraticCurveTo(n,o,n+t,o),s}function b(r,e,t){const s=new he(te(r,e,t),12),n=s.attributes.uv,o=s.attributes.position;for(let i=0;i<n.count;i++)n.setXY(i,o.getX(i)/r+.5,o.getY(i)/e+.5);return s}function P(r,e,t,s,n=.012){const o=new de(te(r-n*2,e-n*2,Math.max(.001,s-n)),{depth:t-n*2,bevelEnabled:!0,bevelThickness:n,bevelSize:n,bevelSegments:4,curveSegments:14});return o.translate(0,0,-(t-n*2)/2),o}const g=(r,e=.32)=>new I({color:r,metalness:.85,roughness:e}),E=()=>new I({color:"#050506",metalness:.2,roughness:.08}),X=r=>new I({color:r,metalness:.1,roughness:.75}),W=()=>new ee({color:"#ffffff",toneMapped:!1});function N(r,{w:e,h:t,d:s,r:n,bezel:o,island:i,lenses:a}){const c=new M;c.add(new l(P(e,t,s,n),g(r)));const d=new l(b(e-.012,t-.012,n-.006),E());d.position.z=s/2+.0015,c.add(d);const u=e-o*2,h=t-o*2,f=new l(b(u,h,Math.max(.01,n-o)),W());if(f.position.z=s/2+.003,c.add(f),i){const m=new l(b(u*.3,h*.032,h*.016),new ee({color:"#000"}));m.position.set(0,h/2-h*.035,s/2+.004),c.add(m)}if(a){const m=new l(P(e*.42,e*.42,.02,e*.1,.006),E());m.position.set(-e/2+e*.27,t/2-e*.27,-s/2-.008),c.add(m);for(let y=0;y<a;y++){const x=y*2*Math.PI/Math.max(1,a)+.6,v=new l(new ce(e*.075,e*.08,.018,28),g("#2a2a2c",.2));v.rotation.x=Math.PI/2,v.position.set(m.position.x+Math.cos(x)*e*.09,m.position.y+Math.sin(x)*e*.09,-s/2-.022),c.add(v);const A=new l(new $(e*.05,24),E());A.rotation.y=Math.PI,A.position.set(v.position.x,v.position.y,-s/2-.0315),c.add(A)}}for(const[m,y]of[[t*.22,t*.08],[t*.09,t*.08]]){const x=new l(new C(.008,y,s*.35),g(r));x.position.set(-e/2-.002,m,0),c.add(x)}const w=new l(new C(.008,t*.12,s*.35),g(r));return w.position.set(e/2+.002,t*.14,0),c.add(w),{object:c,screen:f,screenAspect:u/h}}function Ue(r,e){const t=new M,s=1.8,n=1.22,o=.045,i=new l(P(s,n,o,.06),g(r));i.rotation.x=-Math.PI/2,t.add(i);const a=new l(b(s*.86,n*.42,.02),X("#111214"));a.rotation.x=-Math.PI/2,a.position.set(0,o/2+.001,-n*.15),t.add(a);const c=new C(s*.86/15*.82,.006,n*.42/6*.78),d=X("#1b1c1f");for(let L=0;L<6;L++)for(let _=0;_<15;_++){const k=new l(c,d);k.position.set(-s*.43+(_+.5)*s*.86/15,o/2+.004,-n*.15-n*.21+(L+.5)*n*.42/6),t.add(k)}const u=new l(b(s*.36,n*.26,.025),g(r,.5));u.rotation.x=-Math.PI/2,u.position.set(0,o/2+.0012,n*.27),t.add(u);const h=new M;h.position.set(0,o/2,-n/2),t.add(h);const f=1.16,w=.022,m=new M;m.position.set(0,f/2,0),h.add(m),m.add(new l(P(s,f,w,.05),g(r)));const y=new l(b(s-.01,f-.01,.045),E());y.position.z=w/2+.0015,m.add(y);const x=s-.09,v=f-.1,A=new l(b(x,v,.012),W());A.position.set(0,.01,w/2+.003),m.add(A);const F=new l(new $(.07,40),g("#e9e9ea",.15));F.rotation.y=Math.PI,F.position.z=-w/2-.002,m.add(F);const j=Math.max(0,Math.min(1,e));return h.rotation.x=(1-j)*Math.PI/2-j*.26,{object:t,screen:A,screenAspect:x/v}}function Ye(r){const e=new M,t=1.8,s=1.04,n=.035;e.add(new l(P(t,s,n,.02,.006),g(r,.45)));const o=t-.04,i=s-.04,a=new l(b(o,i,.006),W());a.position.z=n/2+.002,e.add(a);const c=new l(new C(.12,.32,.04),g(r,.4));c.position.set(0,-s/2-.14,-.05),e.add(c);const d=new l(P(.62,.26,.025,.08,.006),g(r,.4));return d.rotation.x=-Math.PI/2,d.position.set(0,-s/2-.3,-.02),e.add(d),{object:e,screen:a,screenAspect:o/i}}function Ve(r){const e=new M,t=1.2,s=1.6,n=.42,o=new I({color:new Z(r).multiplyScalar(.62),metalness:0,roughness:.85}),i=new C(t,s,n);e.add(new l(i,o));const a=new l(new re(t*.98,s*.98),W());return a.position.z=n/2+.002,e.add(a),{object:e,screen:a,screenAspect:t/s}}function Xe(r){const e=r.color??(r.type==="box"?O.white:r.type==="tv"?O.black:r.type==="laptop"?O.silver:O.titanium);switch(r.type){case"phone":return N(e,{w:.83,h:1.8,d:.075,r:.13,bezel:.032,island:!0,lenses:3});case"tablet":return N(e,{w:1.35,h:1.8,d:.06,r:.09,bezel:.05,island:!1,lenses:1});case"laptop":return Ue(e,r.open??1);case"tv":return Ye(e);default:return Ve(e)}}const K=new WeakMap;function Ne(r){let e=K.get(r);if(!e){const t=new ie(r);e=t.fromScene(new ke,0,.1,100,{size:64}).texture,t.dispose(),K.set(r,e)}return e}class Ke{constructor(e,t,s){this.mesh=e,this.aspect=t,this.media=s;const n=o=>s.kind==="video"?this.loadVideo(o):this.loadImage(o);this.ready=s?.url?n(s.url).catch(async o=>{const i=s.gcsUri?await He(s.gcsUri):null;if(!i||i===s.url)throw o;return n(i)}):Promise.resolve(),s?.url||e.material.color.set("#0d0f12")}texture=null;video=null;ready;whenReady(){return this.ready}fit(e,t){const s=this.texture,n=e/t;n>this.aspect?(s.repeat.set(this.aspect/n,1),s.offset.set((1-this.aspect/n)/2,0)):(s.repeat.set(1,n/this.aspect),s.offset.set(0,(1-n/this.aspect)/2))}apply(e,t,s){e.colorSpace=oe,e.anisotropy=4,this.texture=e,this.fit(t,s);const n=this.mesh.material;n.map=e,n.needsUpdate=!0}loadImage(e){return new Promise((t,s)=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>{this.apply(new J(n),n.naturalWidth,n.naturalHeight),this.texture.needsUpdate=!0,t()},n.onerror=()=>s(Error("Không tải được ảnh màn hình thiết bị")),n.src=e})}canvas=null;draw(){const e=this.video,t=this.canvas;!e||!t||e.readyState<2||(t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.texture&&(this.texture.needsUpdate=!0))}loadVideo(e){const t=document.createElement("video");return t.crossOrigin="anonymous",t.muted=!0,t.playsInline=!0,t.preload="auto",this.video=t,new Promise((s,n)=>{t.onloadeddata=()=>{const o=Math.min(1,1280/Math.max(t.videoWidth,t.videoHeight)),i=document.createElement("canvas");i.width=Math.max(2,Math.round(t.videoWidth*o)),i.height=Math.max(2,Math.round(t.videoHeight*o)),this.canvas=i,this.apply(new ae(i),t.videoWidth,t.videoHeight),this.draw(),s()},t.onerror=()=>n(Error("Không tải được video màn hình thiết bị")),t.src=e})}async sync(e,t=!1){const s=this.video,n=this.media;if(!s||!n||!this.texture)return;const o=Number.isFinite(s.duration)&&s.duration>0?s.duration:0;let i=(n.inPoint||0)+Math.max(0,e)*(n.speed||1);if(o&&(i=Math.min(i,o-.04)),Math.abs(s.currentTime-i)>(t?.004:.12)){const a=new Promise(c=>{const d=()=>{s.removeEventListener("seeked",d),c()};s.addEventListener("seeked",d),setTimeout(d,t?4e3:600)});if(s.currentTime=i,t)await a;else{a.then(()=>this.draw());return}}this.draw()}dispose(){this.texture?.dispose(),this.video&&(this.video.removeAttribute("src"),this.video.load(),this.video=null)}}const se=new Map,G=new Set,Qe=r=>r?se.get(r):void 0;function Je(r){return G.add(r),()=>{G.delete(r)}}const Q=(r,e)=>r.name||`Animation ${e+1}`,ne=new Map,Ze=r=>r?ne.get(r):void 0,T=600,$e="attribute float aAlpha;attribute float aSize;varying float vA;uniform float uScale;void main(){vA=aAlpha;vec4 mv=modelViewMatrix*vec4(position,1.);gl_PointSize=aSize*uScale/max(.05,-mv.z);gl_Position=projectionMatrix*mv;}",et="uniform vec3 uColor;varying float vA;void main(){vec2 d=gl_PointCoord-.5;float r=length(d);if(r>.5)discard;gl_FragColor=vec4(uColor,vA*smoothstep(.5,.05,r));}",S=Math.PI/180;class tt{canvas;renderer;scene=new ue;camera=new pe(40,1,.01,100);halfY=0;group=new M;disposed=!1;mixer=null;clips=[];action=null;rest=[];width;height;screen=null;pieces=[];dust=null;cut=[new D,new D];guides=null;buildOn=!1;constructor(e,t){this.width=e,this.height=t,this.renderer=new me({alpha:!0,antialias:!0,preserveDrawingBuffer:!0}),this.renderer.setPixelRatio(1),this.renderer.setSize(e,t,!1),this.renderer.setClearColor(0,0),this.canvas=this.renderer.domElement,this.camera.aspect=e/t,this.camera.position.set(0,0,5),this.camera.lookAt(0,0,0),this.camera.updateProjectionMatrix(),this.scene.add(this.group,new fe(16777215,7829367,3));const s=new we(16777215,3);s.position.set(3,5,5),this.scene.add(s)}async load(e){const t=await Oe(e);this.add(await new Y().loadAsync(t),e)}async loadBuffer(e,t){this.add(await new Y().parseAsync(e,""),t)}async loadDevice(e){if(!e.device)throw Error("Không phải thiết bị 3D");const t=Xe(e.device);this.scene.environment=Ne(this.renderer),this.addObject(t.object),!this.disposed&&(this.screen=new Ke(t.screen,t.screenAspect,e.deviceScreen),await this.screen.whenReady())}async prepare(e){await this.screen?.sync(e,!0)}addObject(e){if(this.disposed){this.disposeObject(e);return}const t=new z().setFromObject(e),s=t.getSize(new p),n=Math.max(s.x,s.y,s.z);e.scale.setScalar(1.8/n),e.updateMatrixWorld(!0),this.halfY=s.y*1.8/n/2,e.position.sub(new z().setFromObject(e).getCenter(new p)),e.updateMatrixWorld(!0),this.group.add(e)}add(e,t){if(this.disposed){this.disposeObject(e.scene);return}const n=new z().setFromObject(e.scene).getSize(new p),o=Math.max(n.x,n.y,n.z);if(!Number.isFinite(o)||o<=0)throw Error("GLB không có hình học hợp lệ");e.scene.scale.setScalar(1.8/o),e.scene.updateMatrixWorld(!0);const i=new z().setFromObject(e.scene).getCenter(new p);e.scene.position.sub(i),e.scene.updateMatrixWorld(!0),this.halfY=n.y*1.8/o/2,this.group.add(e.scene),this.clips=e.animations||[],this.clips.length&&(this.mixer=new ye(e.scene),e.scene.traverse(a=>{a!==e.scene&&this.rest.push({o:a,p:a.position.clone(),q:a.quaternion.clone(),s:a.scale.clone()})})),this.collectPieces(e.scene),ne.set(t,this.pieces.length),se.set(t,this.clips.map((a,c)=>({name:Q(a,c),duration:a.duration}))),G.forEach(a=>a())}collectPieces(e){this.group.updateMatrixWorld(!0);const t=[];e.traverse(c=>{c.isMesh&&t.push(c)});const s=new z().setFromObject(e),n=c=>{const d=c.getSize(new p);return d.x*d.y*d.z},o=n(s)*.02,i=s.getSize(new p),a=i.x*i.z;for(const c of t.slice(0,V.maxPieces)){const d=new z().setFromObject(c),u=d.getCenter(new p),h=d.getSize(new p),f=new q().copy(c.parent.matrixWorld).invert();this.pieces.push({o:c,p:c.position.clone(),q:c.quaternion.clone(),s:c.scale.clone(),toParent:new ge().setFromMatrix4(f),box:{bottom:d.min.y,cx:u.x,cz:u.z,h:h.y,r:Math.max(h.x,h.z)/2,big:n(d)>o,base:h.x*h.z>=a*.25&&d.min.y<=s.min.y+i.y*.03}})}}build(e,t){let s=null;try{s=e.modelBuild?Ee(e.modelBuild):null}catch{s=null}const n=new Set;this.group.traverse(i=>{const a=i.material;if(a)for(const c of Array.isArray(a)?a:[a])n.add(c)});const o=[];if(s){const i=Ie(this.pieces.map(d=>d.box),s);this.pieces.forEach((d,u)=>{const h=We(s.style,d.box,i[u],t,u,s.seed);d.o.position.copy(d.p),d.o.quaternion.copy(d.q),d.o.scale.copy(d.s),d.o.visible=h.visible,(h.dx||h.dy||h.dz)&&d.o.position.add(new p(h.dx,h.dy,h.dz).applyMatrix3(d.toParent)),(h.rx||h.ry||h.rz)&&d.o.quaternion.multiply(new H().setFromEuler(new xe(h.rx,h.ry,h.rz)))}),this.group.updateMatrixWorld(!0);const a=new p(0,1,0).applyQuaternion(this.group.getWorldQuaternion(new H)).normalize();Fe(s,t)&&o.push(this.cut[0].setFromNormalAndCoplanarPoint(a,this.group.localToWorld(new p(0,-this.halfY,0))));const c=Le(s,t,this.halfY);c!==null&&o.push(this.cut[1].setFromNormalAndCoplanarPoint(a.clone().negate(),this.group.localToWorld(new p(0,c,0)))),this.dustAt(_e(this.pieces.map(d=>d.box),i,s,t,T),s.dustColor),this.buildOn=!0}else{for(const i of this.pieces)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s),i.o.visible=!0;this.dustAt([],V.dustColor),this.buildOn=!1}this.renderer.localClippingEnabled=o.length>0;for(const i of n){const a=o.length?o:null;i.clippingPlanes!==a&&(i.clippingPlanes?.length||a)&&(i.clippingPlanes=a,i.needsUpdate=!0)}}dustAt(e,t){if(!e.length&&!this.dust)return;if(!this.dust){const a=new U;a.setAttribute("position",new R(new Float32Array(T*3),3)),a.setAttribute("aAlpha",new R(new Float32Array(T),1)),a.setAttribute("aSize",new R(new Float32Array(T),1));const c=new ve({uniforms:{uColor:{value:new Z(t)},uScale:{value:this.height*1.2}},vertexShader:$e,fragmentShader:et,transparent:!0,depthWrite:!1});this.dust=new be(a,c),this.dust.frustumCulled=!1,this.group.add(this.dust)}const s=this.dust.geometry,n=s.getAttribute("position"),o=s.getAttribute("aAlpha"),i=s.getAttribute("aSize");e.forEach((a,c)=>{n.setXYZ(c,a[0],a[1],a[2]),o.setX(c,a[3]),i.setX(c,a[4])}),s.setDrawRange(0,e.length),n.needsUpdate=o.needsUpdate=i.needsUpdate=!0,this.dust.material.uniforms.uColor.value.set(t)}setGuides(e,t=4){if(!e){this.guides&&(this.scene.remove(this.guides),this.disposeObject(this.guides),this.guides=null);return}if(this.guides)return;const s=new M,n=new Me(t,16,6742271,2781056);n.rotation.x=Math.PI/2;for(const i of Array.isArray(n.material)?n.material:[n.material])i.transparent=!0,i.opacity=.85,i.depthWrite=!1;const o=(i,a)=>new Se(new U().setFromPoints([new p,i]),new Ce({color:a}));s.add(n,o(new p(.5,0,0),16731469),o(new p(0,.5,0),5111674),o(new p(0,0,.5),5086207)),this.guides=s,this.scene.add(s)}surfaceAt(e,t){const s=new Ae;s.setFromCamera(new ze(e/this.width*2-1,1-t/this.height*2),this.camera);const n=s.ray.intersectPlane(new D(new p(0,0,1),0),new p);return n?{x:n.x,y:n.y}:null}pose(e,t){if(!this.mixer)return;const s=e.modelAnim,n=s?this.clips.find((i,a)=>Q(i,a)===s.clip):void 0;if(!s||!n){if(this.action){this.mixer.stopAllAction(),this.action=null;for(const i of this.rest)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s)}return}const o=this.mixer.clipAction(n);this.action!==o&&(this.mixer.stopAllAction(),o.setLoop(Pe,1/0),o.play(),this.action=o),o.time=De(s,n.duration,t,e.inPoint||0),this.mixer.update(0)}render(e,t,s=!1,n){const o=Re(e,Math.max(0,t),this.width,this.height),i=o,a=o.depth;if(Be(n)&&e.is3D!==!1){const u=this.width,h=this.height,f=je(u,h),w=Ge(n,e.start+Math.max(0,t),u,h);this.group.position.set(i.x*u/f,-i.y*h/f,a);const m=y=>new p(w.R[0][y],-w.R[1][y],-w.R[2][y]);this.camera.position.set(w.pos[0]/f,-w.pos[1]/f,-w.pos[2]/f),this.camera.quaternion.setFromRotationMatrix(new q().makeBasis(m(0),m(1).negate(),m(2).negate())),this.camera.fov=2*Math.atan(h/2/w.f)/S}else{this.camera.position.set(0,0,5),this.camera.quaternion.identity(),this.camera.fov=40;const h=2*(5-a)*Math.tan(this.camera.fov*S/2);this.group.position.set(i.x*h*this.camera.aspect,-i.y*h,a)}this.camera.updateProjectionMatrix(),this.group.scale.setScalar(i.zoom);const c={x:B(e,"rx",t),y:B(e,"ry",t),z:B(e,"rz",t)},d=e.modelSpin||{x:0,y:0,z:0};this.group.rotation.set((c.x+d.x*((e.inPoint||0)+t))*S,(c.y+d.y*((e.inPoint||0)+t))*S,(c.z+d.z*((e.inPoint||0)+t))*S),e.modelGround&&this.group.position.add(new p(0,1,0).applyEuler(this.group.rotation).multiplyScalar(this.halfY*i.zoom)),this.pose(e,t),(e.modelBuild||this.buildOn)&&this.build(e,t),s&&this.screen?.sync(t),this.renderer.render(this.scene,this.camera),s&&this.publish(e.id)}publish(e){const t=new z().setFromObject(this.group);if(t.isEmpty())return;let s=1/0,n=1/0,o=-1/0,i=-1/0;for(const a of[t.min.x,t.max.x])for(const c of[t.min.y,t.max.y])for(const d of[t.min.z,t.max.z]){const u=new p(a,c,d).project(this.camera),h=(u.x+1)/2*this.width,f=(1-u.y)/2*this.height;s=Math.min(s,h),o=Math.max(o,h),n=Math.min(n,f),i=Math.max(i,f)}qe.set(e,{cx:(s+o)/2,cy:(n+i)/2,w:o-s,h:i-n,angle:0,W:this.width,H:this.height})}async frame(){const e=await new Promise(n=>this.canvas.toBlob(n,"image/webp",.8));if(!e)throw Error("Không xuất được frame 3D");const t=new Uint8Array(await e.arrayBuffer());let s="";for(let n=0;n<t.length;n+=16384)s+=String.fromCharCode(...t.subarray(n,n+16384));return btoa(s)}disposeObject(e){e.traverse(t=>{const s=t;s.geometry?.dispose();for(const n of s.material?Array.isArray(s.material)?s.material:[s.material]:[]){for(const o of Object.values(n))o instanceof J&&o.dispose();n.dispose()}})}dispose(){this.disposed=!0,this.screen?.dispose(),this.screen=null,this.mixer?.stopAllAction(),this.disposeObject(this.group),this.renderer.dispose(),this.canvas.remove()}}const rt=Object.freeze(Object.defineProperty({__proto__:null,Timeline3DScene:tt,modelAnimations:Qe,modelPieces:Ze,onModelAnimations:Je},Symbol.toStringTag,{value:"Module"}));export{tt as T,Ze as a,qe as l,Qe as m,Je as o,rt as t};
@@ -1 +1 @@
1
- import{b$ as w,eO as u,eP as D,eQ as E}from"./titleFrameBudget-BjW--v_T.js";import{T as F}from"./timeline3d-DqXTKdEK.js";import{wantsFrame as s,SKIPPED_FRAME as x}from"./frameSink-CB1EghW0.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-Dy6SrZg8.js";import"./api-C5pOWyBM.js";import"./RoomEnvironment-Dmv_G5ka.js";async function A(n,m,o,c,d){const{width:l,height:p,fps:a}=w(m),f=u(D(n));for(const e of n.filter(t=>t.kind==="model")){if(!s(o,"modelFrames",e.id))continue;if(!e.gcsUri&&!e.device)throw Error("Clip 3D chưa có GLB");const t=Math.ceil(e.duration*a);if(t>3600)throw Error("Mỗi clip 3D tối đa 2 phút khi xuất MP4. Hãy chia clip dài thành nhiều đoạn.");const i=new F(l,p);try{e.device?await i.loadDevice(e):await i.load(e.gcsUri);for(let r=0;r<t;r++){if(c?.aborted)throw new DOMException("Export cancelled","AbortError");if(!s(o,"modelFrames",e.id,r)){await o.push("modelFrames",e.id,x);continue}E(f),await i.prepare(r/a),i.render(e,r/a,!1,d),await o.push("modelFrames",e.id,await i.frame()),r%8===0&&await new Promise(h=>setTimeout(h,0))}}finally{i.dispose()}}}export{A as render3DFrames};
1
+ import{b$ as w,eO as u,eP as D,eQ as E}from"./titleFrameBudget-3MFHWIT6.js";import{T as F}from"./timeline3d-BEuZZOxM.js";import{wantsFrame as s,SKIPPED_FRAME as x}from"./frameSink-Dj71jCRb.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-Dy6SrZg8.js";import"./api-BsKbf3l3.js";import"./RoomEnvironment-Dmv_G5ka.js";async function A(n,m,o,c,d){const{width:l,height:p,fps:a}=w(m),f=u(D(n));for(const e of n.filter(t=>t.kind==="model")){if(!s(o,"modelFrames",e.id))continue;if(!e.gcsUri&&!e.device)throw Error("Clip 3D chưa có GLB");const t=Math.ceil(e.duration*a);if(t>3600)throw Error("Mỗi clip 3D tối đa 2 phút khi xuất MP4. Hãy chia clip dài thành nhiều đoạn.");const i=new F(l,p);try{e.device?await i.loadDevice(e):await i.load(e.gcsUri);for(let r=0;r<t;r++){if(c?.aborted)throw new DOMException("Export cancelled","AbortError");if(!s(o,"modelFrames",e.id,r)){await o.push("modelFrames",e.id,x);continue}E(f),await i.prepare(r/a),i.render(e,r/a,!1,d),await o.push("modelFrames",e.id,await i.frame()),r%8===0&&await new Promise(h=>setTimeout(h,0))}}finally{i.dispose()}}}export{A as render3DFrames};