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.
- package/package.json +1 -1
- package/scripts/render-local.mjs +1480 -1479
- package/web/assets/FxEmbed-BymBArNa.js +1 -0
- package/web/assets/MotionEmbed-PmXWSWe5.js +1 -0
- package/web/assets/PluginStore-BVsm6n6N.js +3 -0
- package/web/assets/{ShotComposer-AHScyNYv.js → ShotComposer-Dprx-Yi7.js} +4 -4
- package/web/assets/TemplateEmbed-CrZXoUk_.js +2 -0
- package/web/assets/{TimelinePlugins-CkP5P9b_.js → TimelinePlugins-B1KGtbmb.js} +3 -3
- package/web/assets/TimelineShotFx-DoLx312Y.js +2 -0
- package/web/assets/TransitionEmbed-C5SUosv2.js +1 -0
- package/web/assets/{Whiteboard-C9Mwa3nF.js → Whiteboard-DybaKCdo.js} +3 -3
- package/web/assets/aerial-DSt_mJNA.js +2 -0
- package/web/assets/agentTools-CxZqRLeR.js +2 -0
- package/web/assets/analyzerRun-DCJwb_-Z.js +1 -0
- package/web/assets/{analyzerSandbox-DQGHjUCa.js → analyzerSandbox-DO5ZTv5q.js} +2 -2
- package/web/assets/{api-C5pOWyBM.js → api-BsKbf3l3.js} +4 -4
- package/web/assets/auraTrack-QR0WqBHp.js +1 -0
- package/web/assets/breakthrough-Dv1bndQb.js +2 -0
- package/web/assets/{cameraPresets-CeStHDvF.js → cameraPresets-B234aNzE.js} +1 -1
- package/web/assets/{captionLayout-BAdmqwdS.js → captionLayout-CNgb471H.js} +1 -1
- package/web/assets/clientExport-NtJmxOYP.js +1 -0
- package/web/assets/{depthEstimate-1OjTo_pb.js → depthEstimate-wVYSJtW8.js} +1 -1
- package/web/assets/directorTools-BqFcShgT.js +1 -0
- package/web/assets/{distortFrames-D39fkQ_H.js → distortFrames-D3TQNcJA.js} +2 -2
- package/web/assets/{distortGL-5uNfls9s.js → distortGL-BklPDXPq.js} +1 -1
- package/web/assets/editTools-BQlG5WB_.js +1 -0
- package/web/assets/exportEncode-CaKEPgsy.js +1 -0
- package/web/assets/exportGlb-DstxwzH5.js +2 -0
- package/web/assets/faceTracker-DWxxieVC.js +1 -0
- package/web/assets/fightDirector-OMlPZgjv.js +1 -0
- package/web/assets/fightDrama-G7bXfpQu.js +2 -0
- package/web/assets/{frameSink-CB1EghW0.js → frameSink-Dj71jCRb.js} +3 -3
- package/web/assets/{gpuCompose-EfzSAeMh.js → gpuCompose-DIxBHlTa.js} +1 -1
- package/web/assets/gpuExport-CPSw_dmq.js +189 -0
- package/web/assets/handMatte-DHsHHz4m.js +1 -0
- package/web/assets/handTracker-D_O-C4Dw.js +2 -0
- package/web/assets/{index-BGZJld3s.js → index-CZn97Ygs.js} +1 -1
- package/web/assets/layer-worker-Bar7WgOA.js +5 -0
- package/web/assets/library-BtBrCaFk.js +1 -0
- package/web/assets/{lottieLayer-BhLbZOpr.js → lottieLayer-CfUPParC.js} +4 -4
- package/web/assets/{lottie_light_canvas-D9fsNLID.js → lottie_light_canvas-7iv3btPX.js} +1 -1
- package/web/assets/main-BPmr0TOL.css +1 -0
- package/web/assets/{main-BNZrzSIG.js → main-M1vRa-gd.js} +32 -32
- package/web/assets/{mapBake-BAG6i5fI.js → mapBake-lPNhNZgv.js} +1 -1
- package/web/assets/maskTrack-D2jUh7aw.js +1 -0
- package/web/assets/matteFixRun-B7tWV9Y1.js +1 -0
- package/web/assets/motionBlur-uAm030t9.js +1 -0
- package/web/assets/{objectLocate-Dhktxe5z.js → objectLocate-BDqfSo9J.js} +1 -1
- package/web/assets/pendingMatte-q35zVaiB.js +2 -0
- package/web/assets/personAi-ZjQVo-80.js +2 -0
- package/web/assets/plateCamera-A2E_WO_x.js +1 -0
- package/web/assets/plateCameraMatch-D41LQrsm.js +2 -0
- package/web/assets/plateFollow-CNfi4xuP.js +2 -0
- package/web/assets/plateMatte-BdIxGhw5.js +2 -0
- package/web/assets/{pluginAutomation-DdZOnpoV.js → pluginAutomation-BtQ_w2TB.js} +1 -1
- package/web/assets/poseTracker-DVX__OK7.js +1 -0
- package/web/assets/productTools-r2RgILaA.js +2 -0
- package/web/assets/{remote-DXG553d8.js → remote-sTZauTqM.js} +77 -77
- package/web/assets/rigTrack-Bx9QHlFv.js +1 -0
- package/web/assets/{rotoMaskStore-DrRawyH9.js → rotoMaskStore-pxpRt5Cj.js} +1 -1
- package/web/assets/{rotoMatte-2EcyuvBX.js → rotoMatte-DyXlW4jK.js} +1 -1
- package/web/assets/rotoscope-GORCSVBr.js +1 -0
- package/web/assets/shot-worker-B8JWkmBz.js +1 -0
- package/web/assets/{shotFxAgent-CETPcjzU.js → shotFxAgent-CzHfe75S.js} +2 -2
- package/web/assets/{skin-BQG1Iz6Q.js → skin-BkaT2QuX.js} +1 -1
- package/web/assets/{spark.module-CMSPLU2n.js → spark.module-BRT8yMS4.js} +10 -10
- package/web/assets/spellDuel-BUy289OT.js +2 -0
- package/web/assets/{store-Dxq3MZF3.js → store-BSSbvpzr.js} +1 -1
- package/web/assets/{surfaceLight-B_OSTxcx.js → surfaceLight-CMaBhZ_d.js} +1 -1
- package/web/assets/surfacePin-DM9b9ubh.js +2 -0
- package/web/assets/textAnimators-Cihw35O8.js +1 -0
- package/web/assets/{thumb-xLFX6lDN.js → thumb-Cs636sYt.js} +1 -1
- package/web/assets/{timeline3d-DqXTKdEK.js → timeline3d-BEuZZOxM.js} +2 -2
- package/web/assets/{timeline3dExport-MWomW4fF.js → timeline3dExport-CmSI_pjv.js} +1 -1
- package/web/assets/timelineComp-CRRzLazc.js +1 -0
- package/web/assets/timelineProps-tN2YsMYN.js +1 -0
- package/web/assets/timelineText-CkoUgWcY.js +1 -0
- package/web/assets/{titleArt-CAOxtyHl.js → titleArt-CcTdJuOC.js} +5 -5
- package/web/assets/{titleFrameBudget-BjW--v_T.js → titleFrameBudget-3MFHWIT6.js} +1 -1
- package/web/assets/titleFrames-w-iWje9N.js +1 -0
- package/web/assets/{tool-DEWWeyCz.js → tool-BhIsq238.js} +1 -1
- package/web/assets/tools-DMUnabc_.js +1 -0
- package/web/assets/toonTools-CICrV3QB.js +2 -0
- package/web/assets/trackAnchor-D2bB5mZE.js +1 -0
- package/web/assets/userFonts-BZ4QL-zq.js +1 -0
- package/web/assets/{vfxAlpha-vbbI-03F.js → vfxAlpha-D3Dk1tfF.js} +2 -2
- package/web/assets/vfxBackground-CHlCg8lb.js +2 -0
- package/web/assets/{vfxTrack-BmxWjlDi.js → vfxTrack-CqiQDEYm.js} +1 -1
- package/web/assets/videoExport-l5MGvMn_.js +1 -0
- package/web/assets/views-BdWnG2xK.js +1 -0
- package/web/assets/weaponDuel-B2wTffPC.js +1 -0
- package/web/assets/{windowFrames-DydW5Al5.js → windowFrames-CoIyWqxr.js} +1 -1
- package/web/layer-worker.html +3 -3
- package/web/assets/FxEmbed-B5TQxKxk.js +0 -1
- package/web/assets/MotionEmbed-Catb_GgA.js +0 -1
- package/web/assets/PluginStore-8TjQawtB.js +0 -3
- package/web/assets/TemplateEmbed-Cao8Z5fY.js +0 -2
- package/web/assets/TimelineShotFx-DvmPZQXM.js +0 -2
- package/web/assets/TransitionEmbed-o4UxJ35e.js +0 -1
- package/web/assets/aerial-BPRLPci2.js +0 -2
- package/web/assets/agentTools-CSnN-LvS.js +0 -2
- package/web/assets/analyzerRun-5zJsmMS1.js +0 -1
- package/web/assets/auraTrack-pF-WhpH3.js +0 -1
- package/web/assets/breakthrough-DQN1i-Pw.js +0 -2
- package/web/assets/clientExport-Ca9a3Jiy.js +0 -1
- package/web/assets/directorTools-CvmghG_6.js +0 -1
- package/web/assets/editTools-CUoVvupD.js +0 -1
- package/web/assets/exportEncode-pFxeatJt.js +0 -1
- package/web/assets/exportGlb-MK05aKqH.js +0 -2
- package/web/assets/faceTracker-_rQOgBvX.js +0 -1
- package/web/assets/fightDirector-Dt60kfbV.js +0 -1
- package/web/assets/fightDrama-py4jxSdn.js +0 -2
- package/web/assets/gpuExport-Cnv2NfEb.js +0 -189
- package/web/assets/handMatte-DZCsuqD2.js +0 -1
- package/web/assets/handTracker-Btr9L-Hu.js +0 -2
- package/web/assets/layer-worker-Rbo-YZv-.js +0 -5
- package/web/assets/library-CdukL2BW.js +0 -1
- package/web/assets/main-By_IEoB_.css +0 -1
- package/web/assets/maskTrack-AZwAVz1c.js +0 -1
- package/web/assets/matteFixRun-wTHGiGGf.js +0 -1
- package/web/assets/pendingMatte-iKz2-XBZ.js +0 -2
- package/web/assets/personAi-BEVyjCii.js +0 -2
- package/web/assets/plateCamera-D_J3-X06.js +0 -1
- package/web/assets/plateCameraMatch-C0peOvBn.js +0 -2
- package/web/assets/plateFollow-BbJMVxfg.js +0 -2
- package/web/assets/plateMatte-u5wKpsUN.js +0 -2
- package/web/assets/poseTracker--VJYw-hX.js +0 -1
- package/web/assets/productTools-DbhbyJxx.js +0 -2
- package/web/assets/rigTrack-CW9_kg5j.js +0 -1
- package/web/assets/rotoscope-_CYT-9ry.js +0 -1
- package/web/assets/shot-worker-BxIzQRZh.js +0 -1
- package/web/assets/spellDuel-eZvRwaxi.js +0 -2
- package/web/assets/surfacePin-CfLBhSrm.js +0 -2
- package/web/assets/timelineProps-KL6XCR4Q.js +0 -1
- package/web/assets/timelineText-DEK2BRyU.js +0 -1
- package/web/assets/titleFrames-WfiLHzjf.js +0 -1
- package/web/assets/tools-CBfIZX8_.js +0 -1
- package/web/assets/toonTools-D7jucq3t.js +0 -2
- package/web/assets/trackAnchor-DFqKIb8a.js +0 -1
- package/web/assets/userFonts-txN4I-eo.js +0 -1
- package/web/assets/vfxBackground-C1dHlJN6.js +0 -2
- package/web/assets/videoExport-DiNI9GY1.js +0 -1
- package/web/assets/views-sH39zgjD.js +0 -1
- package/web/assets/weaponDuel-CEvRDeuE.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-DXG553d8.js","assets/api-C5pOWyBM.js","assets/titleFrameBudget-BjW--v_T.js","assets/three.module-Bx43vjkH.js","assets/GLTFLoader-Dy6SrZg8.js","assets/store-Dxq3MZF3.js","assets/rotoMaskStore-DrRawyH9.js","assets/rigTrack-CW9_kg5j.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as G}from"./titleFrameBudget-BjW--v_T.js";import{jv as st,j5 as J,fv as Q,gS as v,dM as K,fx as B,hM as W,fI as Y,fJ as X,fy as rt,jw as dt,i_ as at,fK as nt,fL as pt,fB as mt,hJ as ut}from"./remote-DXG553d8.js";import{c as ct}from"./cameraPresets-CeStHDvF.js";import"./api-C5pOWyBM.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-Dy6SrZg8.js";import"./store-Dxq3MZF3.js";import"./rotoMaskStore-DrRawyH9.js";import"./rigTrack-CW9_kg5j.js";const gt=s=>{let l=Math.abs(Math.floor(s))%2147483646+1;return()=>(l=l*16807%2147483647)/2147483647},L=s=>st(s)?.keys.find(l=>l.strike)?.t??.4,it={"xx-palm-shield":.22,"xx-teleport":.26,"xx-float-back":.3},z=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 C={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 d=st("xx-air-dash"),_=o+d.duration-.2+L("xx-sky-slam");a.push({time:o,attacker:h,technique:"rush",clip:"xx-air-dash",then:"xx-sky-slam",thenAt:o+d.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(z).filter(d=>d!==P&&d!=="volley"&&d!=="palmSky"));P=w;const x=z[w],I=o+L(x.clip),D=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:D,result:b};if(M&&Object.assign(T,{defence:M,defenceClip:N[M].clip,defenceAt:D-it[N[M].clip],defenceFx:N[M].fx}),b==="clash"){const d=z[c(["palm","twin","sword"])],_=I+x.travel/2,i=_-d.travel/2;Object.assign(T,{counter:{clip:d.clip,fx:h?d.fx:d.twin,start:i-L(d.clip),release:i,travel:d.travel/2},impact:_})}a.push(T);const A=b==="blocked"||b==="evaded";o=Math.max(D,T.defenceAt!=null?T.defenceAt+.9:D)+(A?.25+S()*.25:.6+S()*.5),h=A&&S()<.7||S()<.5?1-h:h}const p=a[a.length-1];return{opening:C,beats:a,end:p.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:z,XIANXIA_SETS:ft,planSpellDuel:lt,releaseAt:L,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 qt(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=>J(j,t))}catch(t){return{ok:!1,error:t.message}}for(const t of u)if(!Q(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 dt(["mc-react-fall-back"])}catch{}let o=j;const C=a+c.end;C>v(o).duration&&(o=tt(o,Math.min(300,Math.ceil(C*10)/10)));const h=v(o).duration,P=v(o),p=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=p.rotation[1],x=[Math.sin(Z(w)),Math.cos(Z(w))],I=[p.position[0]+x[0]*q,p.position[1],p.position[2]+x[1]*q],D=(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(D(u[0].id,p.position,w),D(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:p.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=W(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-DXG553d8.js").then(e=>e.jH);return{runTool:t}},__vite__mapDeps([0,1,2,3,4,5,6,7])),A=[],d=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 d({effect:["hao-quang-lam","hao-quang-tim"][0],attach_to:_(0),start:a+.1,duration:c.opening.until,intensity:.55}),await d({effect:"phap-tran",attach_to:_(0),start:a+.3,duration:c.opening.until,intensity:.5}),s.ambience!==!1&&await d({effect:"dom-linh-vang",at:[(p.position[0]+I[0])/2,1.2,(p.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 d({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 d(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 d({effect:e.fx,attach_to:n,start:f,duration:e.travel+.5,intensity:.7}):e.kind==="ground"&&(await d({effect:"xung-kich",attach_to:n,start:a+e.impact,duration:.7,intensity:.45}),await d({effect:"mat-dat-vo",attach_to:n,start:a+e.impact,duration:1.2,intensity:.5})),e.technique==="rush"&&await d({effect:"luot-chem-loi",attach_to:n,start:a+e.time+.1,duration:.6,intensity:.6}),e.defenceFx&&await d({effect:e.defenceFx,attach_to:r,start:a+e.defenceAt,duration:.7,intensity:.6}),e.result==="blocked"&&await d({effect:"vong-xung-kich",attach_to:r,start:a+e.impact,duration:.35,intensity:.4}),e.counter){await d({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 d({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 d({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),X.light,t.duration),e=Y(e,[a+M.impact],X.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=pt(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 Tt(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=J(c,String(s.name??""))}catch(i){return{ok:!1,error:i.message}}if(!Q(o))return{ok:!1,error:`'${o.name}' is not a person`};const C=v(c),h=Math.max(0,Number(s.time??0)||0),P=Math.min(1,h/C.duration);let p=null;if(s.target!=null)try{p=J(c,String(s.target))}catch(i){return{ok:!1,error:i.message}}else{const i=K(o,C,P).position;p=c.items.filter(m=>m.id!==o.id&&Q(m)&&!m.hidden).map(m=>{const t=K(m,C,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($&&!p)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>C.duration&&(w=tt(w,Math.min(300,Math.ceil((h+q.duration+.5)*10)/10)));const x=v(w).duration;if(p){const i=v(w),m=K(o,{...i,flight:void 0},Math.min(1,h/x)),t=K(p,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=W(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:D}=await G(async()=>{const{runTool:i}=await import("./remote-DXG553d8.js").then(m=>m.jH);return{runTool:i}},__vite__mapDeps([0,1,2,3,4,5,6,7])),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:p.name};else if(i.place==="path")e={...t,from:`${o.name}.hand_right`,to:`${p.name}.chest`};else if(i.place==="ground")e={...t,from:`${o.name}.feet`,to:`${p.name}.feet`};else if(i.place==="area"){const r=v(l.getStage()),f=K(p,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 D("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 d=null;if(p&&(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(p,{...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?.[p.id]||[]).filter(O=>O.time*f<t-1e-6);n={...n,shots:n.shots.map(O=>O.id===r.id?{...O,objectKeys:{...O.objectKeys,[p.id]:[...ht,{id:F(),time:t/f,position:g.position.map(V=>+V.toFixed(3)),rotation:[0,+H.toFixed(1),0],scale:p.scale}]}}:O)},t+e.duration>f&&(n=tt(n,Math.min(300,Math.ceil((t+e.duration+.3)*10)/10)));const R=W(n,p.id,e,{start:t/v(n).duration,newId:F,loop:!1});if(R.ok){if(l.setStage(()=>R.stage),d={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"?X.light:X.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(`${p.name} ${i}: ${R.error}`)}}const _=[];if(s.camera===!0){const i=[["low-hero",o,h,Math.max(h+.4,y)]];p&&$&&i.push(["wide-track",p,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,...p?{target:p.name}:{},start_s:E(h),release_s:E(y),impact_s:E(T),end_s:E(h+q.duration),effects:M,...d?{reaction:d}:{},..._.length?{camera:_}:{},...b.length?{notes:b}:{}}}export{Tt as castTechnique,qt as stageSpellDuel};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pendingMatte-iKz2-XBZ.js","assets/titleFrameBudget-BjW--v_T.js","assets/remote-DXG553d8.js","assets/api-C5pOWyBM.js","assets/three.module-Bx43vjkH.js","assets/GLTFLoader-Dy6SrZg8.js","assets/store-Dxq3MZF3.js","assets/rotoMaskStore-DrRawyH9.js","assets/rigTrack-CW9_kg5j.js","assets/main-BNZrzSIG.js","assets/spark.module-CMSPLU2n.js","assets/userFonts-txN4I-eo.js","assets/lottieLayer-BhLbZOpr.js","assets/desktop-BWhFnYwd.js","assets/timeline3d-DqXTKdEK.js","assets/RoomEnvironment-Dmv_G5ka.js","assets/exportEncode-pFxeatJt.js","assets/captionLayout-BAdmqwdS.js","assets/timelineText-DEK2BRyU.js","assets/titleArt-CAOxtyHl.js","assets/rotoMatte-2EcyuvBX.js","assets/distortGL-5uNfls9s.js","assets/main-By_IEoB_.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{b_ as W,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-BjW--v_T.js";import{T as lt,U as Dt,V as Nt,X as Rt,Y as Vt,Z as Kt,_ as et}from"./main-BNZrzSIG.js";import{id as Bt,ie as Qt}from"./remote-DXG553d8.js";import{measureSurfaceLight as Ut}from"./surfaceLight-B_OSTxcx.js";import{u as C}from"./store-Dxq3MZF3.js";import{F as Y,J as Z,I as nt,U as zt,V as Gt}from"./rotoMaskStore-DrRawyH9.js";import{t as A}from"./api-C5pOWyBM.js";import"./three.module-Bx43vjkH.js";import"./spark.module-CMSPLU2n.js";import"./rigTrack-CW9_kg5j.js";import"./userFonts-txN4I-eo.js";import"./lottieLayer-BhLbZOpr.js";import"./desktop-BWhFnYwd.js";import"./timeline3d-DqXTKdEK.js";import"./GLTFLoader-Dy6SrZg8.js";import"./RoomEnvironment-Dmv_G5ka.js";import"./exportEncode-pFxeatJt.js";import"./captionLayout-BAdmqwdS.js";import"./timelineText-DEK2BRyU.js";import"./titleArt-CAOxtyHl.js";import"./rotoMatte-2EcyuvBX.js";import"./distortGL-5uNfls9s.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]},Lt=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)||!Lt(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 Wt(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)},$=(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])),$t=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($t(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=[$(n.e,f),$(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=W(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=$(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($(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 L=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=W(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-iKz2-XBZ.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]));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=W(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=W(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=Wt(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 qe({ids:t,checkpoint:a,skipRunning:m=!1}={}){const n=C.getState().clips.filter(e=>e.pendingPin&&(!t||t.includes(e.id))&&!(m&&L.has(e.id))).map(e=>e.id);return Promise.all(n.map(e=>{let h=L.get(e);return h||(h=ce(e,a).finally(()=>L.delete(e)),L.set(e,h)),h}))}export{qe as runSurfacePins,se as snapPlanarToEdges};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{dL as k,eN as O,dM as M,ij as F,fP as E,fR as j}from"./remote-DXG553d8.js";import"./api-C5pOWyBM.js";import"./titleFrameBudget-BjW--v_T.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-Dy6SrZg8.js";import"./store-Dxq3MZF3.js";import"./rotoMaskStore-DrRawyH9.js";import"./rigTrack-CW9_kg5j.js";const K=(t,e,i=.1)=>["X","Y","Z"].map((n,s)=>({id:t+s,label:`${e} ${n}`,step:i})),A=[...K("p","Vị trí"),...K("t","Nhìn tới"),{id:"lens",label:"Tiêu cự (mm)",step:1,min:14,max:200},{id:"roll",label:"Nghiêng (°)",step:1}],U=[...K("p","Vị trí"),...K("r","Xoay",1),{id:"s",label:"Kích thước",step:.05,min:.05}],_=K("o","Lệch"),X=[...K("p","Vị trí"),{id:"s",label:"Kích thước",step:.05,min:.05}],p=t=>t.shots.find(e=>e.id===t.activeShot)||t.shots[0];function B(t,e){if(e==="camera")return A;const i=t.items.find(n=>n.id===e);return i?i.kind==="fx"?i.fx?.attach?_:X:U:[]}function J(t,e){return e==="camera"?t.motion==="path"&&!!t.cameraKeys?.length:(t.objectKeys?.[e]?.length??0)>0}const y=t=>+t.slice(1);function q(t,e,i,n){const s=p(t);if(e==="camera"){const c=k(s,n);return i==="lens"?c.lens:i==="roll"?c.roll:(i[0]==="p"?c.position:c.target)[y(i)]}const r=t.items.find(c=>c.id===e);if(!r)return 0;if(i[0]==="o")return O(r,s,n).position[y(i)];const o=M(r,s,n);return i==="s"?o.scale[0]:(i[0]==="p"?o.position:o.rotation)[y(i)]}const C=t=>+t.toFixed(3);function z(t,e,i,n,s,r=()=>crypto.randomUUID()){const o=p(t);if(!o||!Number.isFinite(s))return t;const c=f=>({...t,shots:t.shots.map(l=>l.id===o.id?{...l,...f}:l)});if(e==="camera"){const f=k(o,n),l={position:[...f.position],target:[...f.target],roll:f.roll};return i==="roll"?l.roll=s:i!=="lens"&&((i[0]==="p"?l.position:l.target)[y(i)]=s),c(F(o,n,l,r,i==="lens"?s:void 0))}const a=t.items.find(f=>f.id===e);if(!a||a.locked)return t;if(i[0]==="o"){const f=O(a,o,n).position.slice();if(f[y(i)]=s,E(a,o))return j(t,e,n,{position:f});const l={...a.fx.attach,offset:f};return{...t,items:t.items.map(u=>u.id===e?{...u,fx:{...u.fx,attach:l}}:u)}}const d=M(a,o,n),m={position:[...d.position],rotation:[...d.rotation],scale:[...d.scale]};i==="s"?m.scale=d.scale[0]>1e-6?d.scale.map(f=>C(f*s/d.scale[0])):[s,s,s]:(i[0]==="p"?m.position:m.rotation)[y(i)]=s;const h=o.objectKeys?.[e]||[];if(h.length){const f=h.find(u=>Math.abs(u.time-n)<1e-6),l={...f,id:f?.id??r(),time:n,...m};return c({objectKeys:{...o.objectKeys,[e]:[...h.filter(u=>u.id!==l.id),l].sort((u,R)=>u.time-R.time)}})}return{...t,items:t.items.map(f=>f.id===e?{...f,...m}:f)}}const b=1e-6,P=(t,e)=>e==="camera"?t.motion==="path"?t.cameraKeys||[]:[]:t.objectKeys?.[e]||[];function x(t,e,i){const n=p(t),s=[...i].sort((r,o)=>r.time-o.time);if(e==="camera"){const r=s,o=r[0],c=r[r.length-1],a={cameraKeys:r,motion:r.length?"path":"static",...o&&c?{position:o.position,target:o.target,lens:o.lens,roll:o.roll,endPosition:c.position,endTarget:c.target,endLens:c.lens}:{}};return{...t,shots:t.shots.map(d=>d.id===n.id?{...d,...a}:d)}}return{...t,shots:t.shots.map(r=>r.id===n.id?{...r,objectKeys:{...r.objectKeys,[e]:s}}:r)}}const S=(t,e)=>e!=="camera"&&!!t.items.find(i=>i.id===e)?.locked;function N(t,e,i,n=()=>crypto.randomUUID()){const s=p(t);if(!s||S(t,e))return t;const r=P(s,e);if(r.some(a=>Math.abs(a.time-i)<b))return t;if(e==="camera"){const a=k(s,i);return x(t,e,[...r,{id:n(),time:i,position:a.position,target:a.target,lens:a.lens,roll:a.roll}])}const o=t.items.find(a=>a.id===e);if(!o)return t;if(o.kind==="fx"&&o.fx?.attach)return j(t,e,i,{id:n()});const c=M(o,s,i);return x(t,e,[...r,{id:n(),time:i,position:c.position,rotation:c.rotation,scale:c.scale}])}function G(t,e,i){return["camera",...t.items.filter(n=>!n.hidden).map(n=>n.id)].reduce((n,s)=>N(n,s,e,i),t)}function H(t,e){const i=p(t);return e.flatMap(n=>{const s=P(i,n.row).find(r=>r.id===n.id);return s?[{row:n.row,key:structuredClone(s)}]:[]})}function I(t,e,i,n=()=>crypto.randomUUID()){if(!e.length)return{stage:t,pasted:[]};const s=Math.min(...e.map(c=>c.key.time)),r=[];let o=t;for(const c of new Set(e.map(a=>a.row))){if(S(o,c)||c!=="camera"&&!o.items.some(d=>d.id===c))continue;let a=[...P(p(o),c)];for(const d of e.filter(m=>m.row===c)){const m=Math.min(1,Math.max(0,d.key.time-s+i)),h={...structuredClone(d.key),id:n(),time:m};a=[...a.filter(f=>Math.abs(f.time-m)>=b),h],r.push({row:c,id:h.id})}o=x(o,c,a)}return{stage:o,pasted:r}}function Q(t,e,i){let n=t;for(const s of new Set(e.map(r=>r.row))){if(S(n,s))continue;const r=new Set(e.filter(o=>o.row===s).map(o=>o.id));n=x(n,s,P(p(n),s).map(o=>r.has(o.id)?{...o,ease:i}:o))}return n}function W(t,e,i){let n=t,s=!1;for(const r of new Set(e.map(o=>o.row))){if(S(n,r))continue;const o=new Set(e.filter(m=>m.row===r).map(m=>m.id)),a=P(p(n),r).map(m=>o.has(m.id)?{...m,time:m.time+i}:m);a.every(m=>m.time>=-b&&m.time<=1+b)&&a.every((m,h)=>a.every((f,l)=>h>=l||Math.abs(m.time-f.time)>b))&&(s=!0,n=x(n,r,a.map(m=>({...m,time:Math.min(1,Math.max(0,m.time))}))))}return{stage:n,moved:s}}export{A as CAMERA_PROPS,X as FX_FREE_PROPS,_ as FX_OFFSET_PROPS,U as OBJECT_PROPS,N as addKeyAt,H as copyKeys,Q as easeKeys,G as keyAllAt,W as nudgeKeys,I as pasteKeys,q as readProp,J as rowKeyed,B as rowProps,z as writeProp};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as o}from"./store-Dxq3MZF3.js";import{t as l,c as w}from"./api-C5pOWyBM.js";import{l as v,d as C}from"./titleArt-CAOxtyHl.js";import{i as h}from"./rigTrack-CW9_kg5j.js";import"./titleFrameBudget-BjW--v_T.js";async function y(g){const e=[],m=o.getState().canvasId;for(const t of g){if(!t.title||t.url){e.push(t);continue}const n=document.createElement("canvas");n.width=1280,n.height=720;const a=n.getContext("2d");if(!a)throw Error("Canvas unavailable");const r=await v(t.title),f=r.filter(h),c=r.filter(i=>!h(i));c.length&&o.getState().toast(l("Font {0} chưa tải được (mạng chập chờn) — chữ tạm dùng font thay thế. Chọn lại font để thử lại.",[c.join(", ")]),"info"),f.length&&o.getState().toast(l("Font riêng của chữ này không còn trong tài khoản của bạn — chữ dùng font mặc định. Tải font lên lại (Chữ → Font) hoặc chọn font khác."),"info"),C(a,t.title);const p=await new Promise((i,d)=>n.toBlob(s=>s?i(s):d(Error("Cannot create title")),"image/png")),u=await w(new File([p],"timeline-title.png",{type:"image/png"}));if(o.getState().canvasId!==m)throw Error("Canvas changed while creating text");e.push({...t,...u})}return e}export{y as materializeTitles};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b$ as L,eO as X,eP as q,lQ as z,eT as _,lR as Z,ea as ee,eU as te,eQ as I,ec as K,eS as ae,eX as oe,eW as ie,eY as re,eV as se}from"./titleFrameBudget-BjW--v_T.js";import{l as ne,d as le}from"./titleArt-CAOxtyHl.js";import{i as A,j as he,s as W,d as B,l as de,k as V,f as me,e as k,a as ce,p as pe,t as fe,m as ue}from"./lottieLayer-BhLbZOpr.js";import{wantsFrame as G,SKIPPED_FRAME as we}from"./frameSink-CB1EghW0.js";import{t as J}from"./api-C5pOWyBM.js";import"./rigTrack-CW9_kg5j.js";const ge=a=>ae(a.title)||!!a.shape||!!a.motion||!!a.lottie||!!a.card||!!a.geo,y=4,N=192*1024*1024,c=new Map;let $=0;function Ee(a,n){if(a.geo||a.shape&&A(a.shape)||a.pin?.scene||a.space)return null;const{start:o,track:l,...i}=a;return JSON.stringify([n,i])}function xe(a,n){const o=n.reduce((l,i)=>l+i.length,0);if(!(o>N/4)){c.delete(a),c.set(a,{frames:n,bytes:o}),$+=o;for(const[l,i]of c){if($<=N)break;c.delete(l),$-=i.bytes}}}const Fe=a=>new Promise((n,o)=>a.toBlob(l=>{if(!l)return o(Error("Cannot encode title frame"));const i=new FileReader;i.onload=()=>n(String(i.result).slice(String(i.result).indexOf(",")+1)),i.onerror=()=>o(i.error),i.readAsDataURL(l)},"image/webp",.9));async function Ce(a,n,o,l,i){const{fps:r,width:Q,height:U}=L(n),g=L({...n,resolution:"720p"}),C=a.some(e=>e.shape&&A(e.shape))?X(q(a)):null,P=!!o.wants;for(const e of a.filter(u=>ge(u)&&!u.warped)){if(!G(o,"titleFrames",e.id))continue;const u=t=>G(o,"titleFrames",e.id,t),p=Ee(e,n),F=p?c.get(p):void 0;if(F){c.delete(p),c.set(p,F);for(const t of F.frames){if(l?.aborted)throw new DOMException("Export cancelled","AbortError");await o.push("titleFrames",e.id,t)}continue}const M=[],b=e.title,T=z(e)?1:Math.ceil(e.duration*r);if(Math.ceil(e.duration*r)>3600)throw Error("Mỗi tiêu đề động / Motion tối đa 2 phút khi xuất MP4.");b&&!e.shape&&!e.motion&&!e.lottie&&!e.card&&!e.geo&&await ne(b);const w=e.card?await he(e.card).catch(t=>{throw Error(J("Thẻ HTML “{0}”: {1}",[e.label,t.message]))}):null,[d,m]=w?[w.width,w.height]:e.geo?[g.width,g.height]:e.lottie?[_(e.lottie).W,_(e.lottie).H]:e.motion?[g.width,g.height]:e.shape?[W(e.shape).W,W(e.shape).H]:[1280,720],E=Object.assign(document.createElement("canvas"),{width:d,height:m}),f=E.getContext("2d");if(!f)throw Error("Canvas unavailable");let v="",S=null;const D=(t,s)=>ue({layer:`export:${t.id}`,motion:t.motion,t:se(t,s/r),width:d,height:m,duration:re(t),fps:r,surface:t.pin?.scene?ie(t,a,t.start+s/r,d,m):null,space:t.space?(I(a),oe(t,a,t.start+s/r,d,m,i)):null}),h=[],O="\0same",H="\0skip",R=e.shape&&!e.motion&&!e.card&&!e.lottie&&!e.geo&&!A(e.shape)?Z(e.shape):null,Y=R==null?1/0:Math.max(R,...["trimStart","trimEnd"].flatMap(t=>ee(e,t).map(s=>s.time))),x=async()=>{const t=await h.shift();if(t===H){await o.push("titleFrames",e.id,we);return}if(t===O||t===v){M.push("="),await o.push("titleFrames",e.id,"=");return}v=t,M.push(t),await o.push("titleFrames",e.id,t)};try{for(let t=0;t<T;t++){if(l?.aborted)throw new DOMException("Export cancelled","AbortError");if(!u(t)){h.push(Promise.resolve(H)),h.length>=y&&await x();continue}if(!P&&t>0&&(t-1)/r>Y+1e-6){h.push(Promise.resolve(O)),h.length>=y&&await x();continue}if(f.clearRect(0,0,d,m),e.motion){let s;try{s=await(S??D(e,t)),S=t+1<T&&u(t+1)?D(e,t+1):null}catch(j){throw S?.catch(()=>{}),B(`export:${e.id}`),Error(`Motion “${e.label}”: ${j.message}`)}f.drawImage(s,0,0),s.close()}else if(e.lottie)try{await de(`export:${e.id}`,e.url,{W:d,H:m},te(e,t/r),E)}catch(s){throw V(`export:${e.id}`),Error(`Lottie “${e.label}”: ${s.message}`)}else if(e.geo)try{await me(`export:${e.id}`,e.geo,{W:d,H:m},t/r,E,{wait:2e4,duration:e.duration})}catch(s){throw k(`export:${e.id}`),Error(J("Bản đồ “{0}”: {1}",[e.label,s.message]))}else w?f.drawImage(w,0,0):e.shape?(C&&I(C),ce(f,pe(e,a,t/r,Q,U),{start:K(e,"trimStart",t/r),end:K(e,"trimEnd",t/r),offset:fe(e.shape)},d,m,t/r)):le(f,b,{time:t/r,duration:e.duration});h.push(Fe(E)),h.length>=y&&await x()}for(;h.length;)await x();p&&!P&&xe(p,M)}finally{for(const t of h)t.catch(()=>{})}e.motion&&B(`export:${e.id}`),e.lottie&&V(`export:${e.id}`),e.geo&&k(`export:${e.id}`)}}export{Ee as frameCacheKey,Ce as renderTitleFrames};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as N,c as E,a as _,d as D}from"./shotFxAgent-CETPcjzU.js";import{jp as P,jq as B,gS as h,eQ as L,ev as A,dO as U,dM as X}from"./remote-DXG553d8.js";import"./api-C5pOWyBM.js";import"./titleFrameBudget-BjW--v_T.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-Dy6SrZg8.js";import"./store-Dxq3MZF3.js";import"./rotoMaskStore-DrRawyH9.js";import"./rigTrack-CW9_kg5j.js";const j=(s,n)=>{const o=h(s);return{anchor:n?(c,d,x)=>n.partPointAt(o,x,c.id,d):void 0,items:s.items,shot:o,at:(c,d)=>{const x=s.items.find(b=>b.id===c.id),k=X(x,o,o.duration?Math.max(0,Math.min(1,d/o.duration)):0);return{position:k.position,rotation:k.rotation}},uid:()=>crypto.randomUUID(),restPose:{...U.Đứng}}},v=(s,n,o)=>({...s,shots:s.shots.map(c=>c.id===s.activeShot?{...c,fxTiming:{...c.fxTiming,[n]:o}}:c)}),w=(s,n)=>{const o=A(s,h(n));return{name:s.name,id:s.id,effect:s.fx.cat??s.fx.preset,preset:s.fx.preset,start_s:o.start,end_s:+(o.start+o.duration).toFixed(2),...s.fx.attach?{attach:s.fx.attach}:{},...s.fx.path?{path:s.fx.path}:{}}};function V(s,n,o){const c=o.engine();c&&c.sync(o.getStage(),null);const d=o.getStage();if(s==="add_effect"){const t=N(n,j(d,c));if(!t.ok)return{ok:!1,error:t.error};const e=t.item;if(e.fx&&e.fx.preset in P&&o.userText!=null&&!B(o.userText))return{ok:!1,error:"blood effects are only used when the user asks for blood (máu / blood) in their message — leave it out"};o.setStage(i=>v({...i,items:[...i.items,e]},e.id,t.timing));const f=h(o.getStage());return{ok:!0,...w(e,o.getStage()),...t.timing.start+t.timing.duration>f.duration+.01?{note:"the effect runs past the end of the shot; shorten it or extend the shot with set_duration"}:{},hint:"render_preview / preview_motion at the effect time to check it is readable"}}if(s==="add_destruction"){const t=E(n,j(d,c));if(!t.ok)return{ok:!1,error:t.error};const e=t.item;o.setStage(i=>{const a=v({...i,items:[...i.items,e]},e.id,t.timing);return{...a,shots:a.shots.map(p=>p.id===a.activeShot?{...p,objectKeys:{...p.objectKeys,[e.id]:t.keys}}:p)}});const f=d.items.filter(i=>i.fx?.preset===e.fx.preset&&i.fx?.target?.to===e.fx?.target?.to&&i.id!==e.id).map(i=>i.name);return{ok:!0,...w(e,o.getStage()),target:d.items.find(i=>i.id===e.fx?.target?.to)?.name,recipe:e.fx.params.recipe,...t.keys.length?{sphere_path:t.keys.map(i=>({at_s:+(i.time*h(d).duration).toFixed(2),position:i.position}))}:{mode:e.fx.params.mode},...f.length?{combines_with:f}:{},hint:"render_preview after the sweep / collapse time to see the destruction; remove_effect removes it"}}if(s==="edit_destruction"){const t=_(d.items.filter(m=>m.kind==="fx"&&m.fx?.preset===L),String(n.name));if(!t?.fx)return{ok:!1,error:`no Mix FX named '${String(n.name)}' (add_destruction makes one; scene_summary lists effects)`};const e=h(d),f=e.duration||1,i=[];let a=d;const p=m=>m.map((r,u)=>({id:`${t.id}-k${u}-${Math.round(r.time*1e6)}`,time:r.time,position:r.position,rotation:[...t.rotation],scale:[...t.scale]})),T=m=>{a={...a,shots:a.shots.map(r=>r.id===a.activeShot?{...r,objectKeys:{...r.objectKeys,[t.id]:m}}:r)}};if(n.target!=null){const m=d.items.find(r=>r.name.toLowerCase()===String(n.target).toLowerCase()&&r.kind!=="fx");if(!m)return{ok:!1,error:`no object '${String(n.target)}' to break`};a={...a,items:a.items.map(r=>r.id===t.id?{...r,fx:{...r.fx,target:{to:m.id,part:"center"}}}:r)},i.push(`target ${m.name}`)}if(Array.isArray(n.points)){if(n.points.length<2||n.points.length>24)return{ok:!1,error:"points: 2 to 24 path points"};const m=[];for(const r of n.points){const u=Number(r.time_s),l=r.position;if(!Number.isFinite(u)||u<0||u>f+1e-6)return{ok:!1,error:`time_s ${String(r.time_s)} is outside the shot (0–${f} s)`};if(!Array.isArray(l)||l.length!==3||!l.every(y=>Number.isFinite(Number(y))))return{ok:!1,error:"each point needs position [x, y, z]"};m.push({time:Math.min(1,u/f),position:l.map(Number)})}T(p(m.sort((r,u)=>r.time-u.time))),i.push(`path of ${m.length} points`)}else if(n.sweep===!0){const m=a.items.find(F=>F.id===t.id).fx,r=m.target?.to?c?.objectBounds()[m.target.to]:null;if(!r)return{ok:!1,error:"sweep measures the target: it needs the 3D view (a scene open in the composer or the render machine) and a target"};const u=m.params,l=Number(u.radius)*t.scale[0]+Number(u.falloff)+.3,y=(r.min[1]+r.max[1])/2,$=(r.min[2]+r.max[2])/2,S=A(t,e),K=Math.min(1,S.start/f),M=Math.min(1,(S.start+S.duration)/f);T(p([{time:K,position:[r.min[0]-l,y,$]},{time:M,position:[r.max[0]+l,y,$]}])),i.push("sweep through the target")}if(!i.length)return{ok:!1,error:"give points, sweep or target"};const O=a;return o.setStage(()=>O),{ok:!0,name:t.name,changed:i,path_s:(h(O).objectKeys?.[t.id]||[]).map(m=>+(m.time*f).toFixed(3))}}if(s==="update_effect"){const t=_(d.items.filter(a=>a.kind==="fx"),String(n.name));if(!t?.fx)return{ok:!1,error:`no effect named '${String(n.name)}'; use remove_effect / update_effect with the name returned by add_effect (see scene_summary effects)`};const e=h(d),f=A(t,e),i=D(t,n,{...j(d,c),timing:f});return i.ok?(o.setStage(a=>v({...a,items:a.items.map(p=>p.id===t.id?{...p,...i.itemPatch,fx:i.fx}:p)},t.id,{start:i.timing.start,duration:i.timing.duration,...i.timing.loop?{loop:!0}:{}})),{ok:!0,...w(o.getStage().items.find(a=>a.id===t.id),o.getStage())}):{ok:!1,error:i.error}}const x=Array.isArray(n.names)?n.names.map(String):n.name!=null?[String(n.name)]:[],k=[],b=[],g=new Set;for(const t of x){const e=_(d.items.filter(f=>f.kind==="fx"),t);e?(g.add(e.id),k.push(e.name)):b.push(t)}for(const t of d.items)t.trackAnchor&&g.has(t.trackAnchor.effect)&&g.add(t.id);return o.setStage(t=>({...t,items:t.items.filter(e=>!g.has(e.id)),shots:t.shots.map(e=>({...e,...e.fxTiming?{fxTiming:Object.fromEntries(Object.entries(e.fxTiming).filter(([f])=>!g.has(f)))}:{},...e.objectKeys?{objectKeys:Object.fromEntries(Object.entries(e.objectKeys).filter(([f])=>!g.has(f)))}:{}}))})),{ok:!b.length,removed:k,missing:b}}export{V as runFxTool};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rotoMaskStore-DrRawyH9.js","assets/titleFrameBudget-BjW--v_T.js","assets/api-C5pOWyBM.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as C}from"./titleFrameBudget-BjW--v_T.js";import{gS as O,j5 as j,fv as L,g6 as P,dZ as B,jr as F,js as E,jt as T,fZ as $,g4 as D,g5 as I}from"./remote-DXG553d8.js";import"./api-C5pOWyBM.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-Dy6SrZg8.js";import"./store-Dxq3MZF3.js";import"./rotoMaskStore-DrRawyH9.js";import"./rigTrack-CW9_kg5j.js";const U=["twos","snap","anticipation","exaggerate","squash","smear"],A=t=>Array.isArray(t)&&t.length===3&&t.every(p=>Number.isFinite(Number(p)))?t.map(Number):null,K=t=>t==="left"?"L":t==="both"?"both":"R",w=t=>Math.round(t*1e3)/1e3;function W(t,p){const c=p.getStage(),d=O(c),a=t.on!==!1&&t.on!=="false",s={on:a};if(t.amount!=null){const r=Number(t.amount);if(!Number.isFinite(r))return{ok:!1,error:"amount must be a number 0–1"};s.amount=Math.max(0,Math.min(1,r))}for(const r of U)typeof t[r]=="boolean"&&(s[r]=t[r]);if(t.shot_default){const r=D({...d.toon||I,...s});return p.setStage(m=>({...m,shots:m.shots.map(f=>f.id===d.id?{...f,toon:r}:f)})),{ok:!0,shot_default:r,note:"every person / prop without its own setting uses it (set_toon on a name overrides one object)"}}const o=Array.isArray(t.names)?t.names.map(String):t.name!=null?[String(t.name)]:[];if(!o.length)return{ok:!1,error:"give names (people / props) or shot_default:true"};let l;try{l=o.map(r=>j(c,r))}catch(r){return{ok:!1,error:r.message}}const k=l.filter(r=>!["person","prop","box","sphere","cylinder","model"].includes(r.kind));if(k.length)return{ok:!1,error:`the cartoon style works on people, props and simple objects, not on ${k.map(r=>`'${r.name}' (${r.kind})`).join(", ")}`};const u={};return p.setStage(r=>({...r,items:r.items.map(m=>{if(!l.some(h=>h.id===m.id))return m;const f=D({...D(m.toon)||I,...s});return u[m.name]=f,{...m,toon:f}})})),{ok:!0,toon:u,note:a?"applied at render time on top of the keyed motion (anticipation before strong moves, overshoot + settle after stops, snappy key poses, exaggerated angles, squash & stretch, smears); keys are unchanged":"off: the keyed motion plays exactly as keyed"}}async function J(t,p){const c=p.getStage(),d=O(c),a=String(t.action||"drop");if(!["drop","bounce","hold","throw","catch","dribble"].includes(a))return{ok:!1,error:`unknown action '${a}'; use drop, bounce, hold, throw, catch or dribble`};const s=Math.max(0,Math.min(d.duration,Number(t.time??0)||0));let o;if(t.person!=null){try{o=j(c,String(t.person))}catch(e){return{ok:!1,error:e.message}}if(!L(o))return{ok:!1,error:`'${o.name}' is not a person`}}if(["hold","throw","dribble","catch"].includes(a)&&!o&&a!=="throw")return{ok:!1,error:`${a} needs person`};let l=t.name!=null?c.items.find(e=>e.name===String(t.name)&&e.kind==="prop"&&e.prop?.kind==="ball"):void 0;const k=!l,u=A(t.position),r=P.radius;if(!l){const e=o?[o.position[0]+Math.sin(o.rotation[1]*Math.PI/180)*.6,o.position[1]+r,o.position[2]+Math.cos(o.rotation[1]*Math.PI/180)*.6]:[0,r,0];l=B(c,{kind:"prop",name:String(t.name||"Bóng rổ"),prop:{kind:"ball"},color:"#d8641c",position:u?[u[0],Math.max(r,u[1]),u[2]]:e})}t.toon!==!1&&!l.toon&&(l={...l,toon:{on:!0,amount:Math.max(0,Math.min(1,Number(t.amount??.6)))}}),t.bounciness!=null&&(l={...l,ball:{restitution:Math.max(.3,Math.min(.95,Number(t.bounciness)||P.restitution))}});const m=K(t.hand),f=(d.ball?.[l.id]||[]).filter(e=>e.t<s-1e-6),h=[],y=A(t.velocity);let N=A(t.target),b=null;if(a==="throw"&&!y&&!N&&t.target_person==null){if(b=F((await E(p,c)).colliders,o?.position??l.position),!b&&t.target==="hoop")return{ok:!1,error:"no hoop in the scene: build_set a court with parts named rim / vành rổ and backboard / bảng rổ, or give target [x,y,z]"};b&&(N=[...b.rim])}let v;if(t.target_person!=null)try{v=j(c,String(t.target_person))}catch(e){return{ok:!1,error:e.message}}if(a==="drop"||a==="bounce")h.push({t:s,kind:"launch",from:u??[...l.position],vel:y??(a==="bounce"?[0,3.5,0]:[0,0,0])});else if(a==="hold")h.push({t:s,kind:"hold",by:o.id,hand:m});else if(a==="dribble")h.push({t:s,kind:"dribble",by:o.id,hand:m==="both"?"R":m,period:Math.max(.3,Math.min(1.2,Number(t.period)||.55))});else if(a==="throw"){const e=[...f].reverse().find(g=>g.kind==="hold"||g.kind==="dribble");if(o&&!(e&&"by"in e&&e.by===o.id))h.push({t:Math.max(0,s-.001),kind:"hold",by:o.id,hand:m});else if(!o&&!e)return{ok:!1,error:"throw needs person (or an earlier hold / dribble of this ball)"};const i=t.arrive!=null?Math.max(.2,Number(t.arrive)):void 0;h.push({t:s,kind:"throw",...y?{vel:y}:v?{to:{by:v.id,hand:"both"},arrive:i??.9}:{to:N??[l.position[0],3.05,l.position[2]+4],...i?{arrive:i}:{},apex:Number(t.apex)||(b?1:.9),...b?{net:!0}:{}}}),v&&h.push({t:s+(i??.9),kind:"hold",by:v.id,hand:"both"})}else if(a==="catch"){const e=Math.max(.3,Math.min(3,Number(t.flight)||.9)),i=u??(o?[o.position[0]+Math.sin(o.rotation[1]*Math.PI/180)*4.5,o.position[1]+1.5,o.position[2]+Math.cos(o.rotation[1]*Math.PI/180)*4.5]:[...l.position]);h.push({t:Math.max(0,s-e),kind:"launch",from:i,to:{by:o.id,hand:m}},{t:s,kind:"hold",by:o.id,hand:m})}const x=[...f.filter(e=>!h.some(i=>i.t<=e.t+1e-6)),...h].sort((e,i)=>e.t-i.t),_=l.id,M=l;p.setStage(e=>({...e,items:k?[...e.items,M]:e.items.map(i=>i.id===_?M:i),shots:e.shots.map(i=>i.id===d.id?{...i,ball:{...i.ball,[_]:x}}:i)}));const S=h.find(e=>e.kind==="launch"&&Array.isArray(e.vel)),n=S&&S.kind==="launch"?T(S.from??M.position,S.vel,S.t,d.duration,{radius:r,restitution:M.ball?.restitution}).impacts.slice(0,8).map(e=>w(e.time)):void 0;return{ok:!0,name:M.name,created:k,...b?{hoop:"aimed through the rim centre, drops through the net"}:{},events:x.map(e=>({...e,t:w(e.t)})),...n?{bounce_times:n}:{},note:"the ball moves analytically (ballistic arcs, bounces losing height by its bounciness, squash on each bounce with the cartoon style on); it follows the hand while held / dribbled"}}async function Q(t,p){const c=p.getStage(),d=O(c),a=await C(()=>import("./rotoMaskStore-DrRawyH9.js").then(n=>n.W),__vite__mapDeps([0,1,2]));let s;if(t.all_props===!0)s=c.items.filter(n=>!n.hidden&&["box","sphere","cylinder","prop","proxy","model"].includes(n.kind)&&!a.dropUnavailable(n));else{const n=Array.isArray(t.objects)?t.objects.map(String):Array.isArray(t.names)?t.names.map(String):[];if(!n.length)return{ok:!1,error:"give objects (names) or all_props:true"};try{s=n.map(i=>j(c,i))}catch(i){return{ok:!1,error:i.message}}const e=s.map(i=>[i,a.dropUnavailable(i)]).filter(([,i])=>i);if(e.length)return{ok:!1,error:`cannot drop ${e.map(([i])=>`'${i.name}' (${i.kind}${i.locked?", locked":i.hold?", held":""})`).join(", ")}: physics_drop moves objects and props, not people, effects, sets or the floor`}}if(s=s.filter(n=>!(n.kind==="prop"&&n.prop?.kind==="ball"&&d.ball?.[n.id]?.length)),!s.length)return{ok:!1,error:"nothing to drop (a ball with add_ball motion keeps its own motion)"};if(s.length>a.MAX_PHYSICS_BODIES)return{ok:!1,error:`at most ${a.MAX_PHYSICS_BODIES} objects per drop`};const o=Math.max(0,Math.min(d.duration,Number(t.time??0)||0)),l=d.duration-o;if(l<a.DROP_SECONDS.min)return{ok:!1,error:`time ${w(o)} s is too close to the end of the shot (${d.duration} s)`};const k=Math.min(l,Math.max(1,Math.min(a.DROP_SECONDS.max,Number(t.duration)||a.DROP_SECONDS.default))),u=o/d.duration,r=a.DROP_MODES.includes(t.mode)?t.mode:"above",m=t.bounciness,f=typeof m=="number"||m==="bouncy"||m==="heavy"?m:"normal",h=p.engine(),y=s.map(n=>n.id);h&&h.sync(c,null);const N=h?.physicsShapes(y)??{},b=(await E(p,c)).colliders.filter(n=>!y.includes(n.itemId)),v={},x=s.map(n=>{const e=$(n,d,u),i=[...d.objectKeys?.[n.id]||[]].filter(g=>g.time<u-1e-6).sort((g,R)=>g.time-R.time).pop();return v[n.id]=i,{id:n.id,position:e.position,rotation:e.rotation,shape:a.shapeKind(n),...N[n.id]??a.fallbackShape(n)}}),_=await a.bakeDrop({bodies:x,statics:b,mode:r,bounciness:f,duration:k,start:o,shotDuration:d.duration,height:Number(t.height)||void 0,strength:Number(t.strength)||void 0,velocity:A(t.velocity)??void 0,seed:t.seed!=null?String(t.seed):y.join(","),before:v,seam:d.lockUntil?d.lockUntil/d.duration:null}),M=Object.fromEntries(s.map(n=>[n.id,$(n,d,u).scale]));p.setStage(n=>a.applyDropKeys(n,d.id,_.tracks,{scale:M,lifted:r==="above"}));const S={};for(const n of s){const e=_.tracks[n.id];e&&(S[n.name]={keys:e.keys.length,rest:e.rest,settled_at:e.settledAt==null?null:w(o+e.settledAt)})}return{ok:!0,mode:r,from:w(o),until:w(o+k),objects:S,settled:_.settled,note:"baked into ordinary keys (no physics at playback); their keys after `from` were replaced. Run again with another seed for a different tumble."}}export{J as addBall,Q as physicsDrop,W as setToon};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as w,gS as k,jn as v,dM as S}from"./remote-DXG553d8.js";import{a as $}from"./shotFxAgent-CETPcjzU.js";import{a as F,V as y,b as N}from"./vfxTrack-BmxWjlDi.js";import{Vector3 as _}from"./three.module-Bx43vjkH.js";import"./api-C5pOWyBM.js";import"./titleFrameBudget-BjW--v_T.js";import"./GLTFLoader-Dy6SrZg8.js";import"./store-Dxq3MZF3.js";import"./rotoMaskStore-DrRawyH9.js";import"./rigTrack-CW9_kg5j.js";const M=4,A=1.25;function C(t,c,s){return t.updateMatrixWorld(),new _(c*2-1,1-s*2,.5).unproject(t).sub(t.position).normalize()}function T(t,c,s){const i=k(t),n=Math.max(1e-6,i.duration),f=t.items.find(r=>r.kind==="person"&&!r.hidden);return c.points.map(([r,u,h])=>{const m=Math.max(0,Math.min(1,r/n)),d=v(i,m),a=C(d,u,h);let l=s??NaN;if(!Number.isFinite(l)&&f){const p=S(f,i,m);l=new _(p.position[0],p.position[1]+A*Math.max(.3,p.scale[1]),p.position[2]).sub(d.position).dot(a)}(!Number.isFinite(l)||l<.3)&&(l=M);const b=d.position.clone().addScaledVector(a,l);return{t:m,d:l,position:[b.x,b.y,b.z].map(p=>Math.round(p*1e4)/1e4)}})}function K(t,c,s){const i=k(c).duration;try{if(t.track!=null)return F(t.track,i);const n=String(t.source??"");if(!y.includes(n))return`give track {fps, points} or source ${y.join(" / ")}`;const f=c.plate?.timelineClipId,r=f?s.timelineClip?.(f):void 0;return r?N(r,n,{side:t.side==="left"?"left":"right",point:typeof t.point=="string"?t.point:"palm",...typeof t.object=="string"?{object:t.object}:{},to:i}):"the Timeline clip of this VFX scene is not open in this tab: pass `track` (MCP: shot_run_tool follow_track with timeline {project_id, clip_id} fills it)"}catch(n){return n.message}}function B(t,c){const s=c.getStage();if(!s.plate)return{ok:!1,error:"follow_track needs a VFX scene: one made from a filmed Timeline clip (MCP shot_create_scene with from_clip, or the clip's 3D button)"};const i=$(s.items.filter(o=>o.kind==="fx"),String(t.name??""));if(!i?.fx)return{ok:!1,error:`no effect named '${String(t.name)}' (scene_summary lists the effects)`};const n=s.items.find(o=>o.trackAnchor?.effect===i.id);if(t.stop===!0)return n?(c.setStage(o=>({...o,items:o.items.filter(e=>e.id!==n.id).map(e=>e.id===i.id?{...e,fx:{...e.fx,...e.fx.attach?.to===n.id?{attach:void 0}:{},...e.fx.target?.to===n.id?{target:void 0}:{}}}:e),shots:o.shots.map(e=>({...e,...e.objectKeys?{objectKeys:Object.fromEntries(Object.entries(e.objectKeys).filter(([j])=>j!==n.id))}:{}}))})),{ok:!0,name:i.name,stopped:!0}):{ok:!1,error:`${i.name} follows no track`};const f=K(t,s,c);if(typeof f=="string")return{ok:!1,error:f};const r=t.depth_m==null?void 0:Number(t.depth_m);if(r!==void 0&&!(r>=.3&&r<=200))return{ok:!1,error:"depth_m must be 0.3–200 (metres from the camera)"};const u=t.offset==null?void 0:Array.isArray(t.offset)&&t.offset.length===3&&t.offset.every(o=>Number.isFinite(Number(o))&&Math.abs(Number(o))<=20)?t.offset.map(Number):null;if(u===null)return{ok:!1,error:"offset must be [x, y, z] metres (±20)"};const h=t.role==="target"?"target":"attach",m=T(s,f,r),d=t.track!=null?"given":t.source==="hand"?`hand:${t.side==="left"?"left":"right"}:${typeof t.point=="string"?t.point:"palm"}`:t.source==="object"&&typeof t.object=="string"?`object:${t.object}`:String(t.source),a=n?{...n,trackAnchor:{effect:i.id,source:d}}:{...w("sphere",s.items.length),name:`${i.name} · điểm bám`.slice(0,60),color:"#ffffff",trackAnchor:{effect:i.id,source:d}};a.position=m[0].position,a.rotation=[0,0,0],a.scale=[1,1,1];const l=m.map((o,e)=>({id:`${a.id}-t${e}`,time:o.t,position:o.position,rotation:[0,0,0],scale:[1,1,1]})),b={...i.fx,...h==="attach"?{attach:{to:a.id,follow:"position",...u?{offset:u}:{}}}:{target:{to:a.id,part:"center"}}};c.setStage(o=>({...o,items:[...o.items.filter(e=>e.id!==a.id).map(e=>e.id===i.id?{...e,fx:b}:e),a],shots:o.shots.map(e=>e.id===o.activeShot?{...e,objectKeys:{...e.objectKeys,[a.id]:l}}:e)}));const p=m.map(o=>o.d).sort((o,e)=>o-e),x=k(s).duration;return{ok:!0,name:i.name,anchor:a.name,source:d,role:h,samples:m.length,from_s:+f.points[0][0].toFixed(2),to_s:+f.points.at(-1)[0].toFixed(2),depth_m:+p[p.length>>1].toFixed(2),note:`${i.name} now ${h==="attach"?"rides on":"aims at"} the tracked point (${m.length} keys over ${x.toFixed(1)} s, ${r?`${r} m from the camera`:"at the filmed person's distance (the stand-in; run follow_plate first for a person who walks toward / away from the camera)"}). Re-run after the track changes; stop:true detaches. Export again (export_video vfx) to update the Timeline passes.`}}export{B as followTrack,T as trackWorldPoints};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as f,bY as p,bZ as b,c as S,b_ as _,r as U}from"./api-C5pOWyBM.js";import{u as C}from"./store-Dxq3MZF3.js";import{i as w}from"./rigTrack-CW9_kg5j.js";import"./titleFrameBudget-BjW--v_T.js";let e={fonts:[],loaded:!1,error:null};const l=new Set,c=t=>{e={...e,...t},l.forEach(o=>o())},E=t=>(l.add(t),()=>{l.delete(t)}),N=()=>U.useSyncExternalStore(E,()=>e),O=()=>e,x={ttf:"font/ttf",otf:"font/otf",woff:"font/woff",woff2:"font/woff2"},$=".ttf,.otf,.woff,.woff2,font/ttf,font/otf,font/woff,font/woff2",d=10,u=new Map;function h(t){if(!t.url||u.has(t.family)||typeof FontFace>"u")return;const o=new FontFace(t.family,`url(${JSON.stringify(t.url)})`,{weight:t.wght?`${t.wght[0]} ${t.wght[1]}`:"1 1000",style:"normal",display:"block"});document.fonts.add(o),u.set(t.family,o)}function m(t){const o=u.get(t);o&&(document.fonts.delete(o),u.delete(t))}let a=null,g=!1;function y(t=!1){return g||(g=!0,C.subscribe((o,r)=>{const n=o.user?.uid??null,i=r.user?.uid??null;if(n!==i)if(n)y(!0);else{for(const s of e.fonts)m(s.family);a=Promise.resolve(),c({fonts:[],loaded:!0,error:null})}})),a&&!t||(a=p().then(o=>{const r=(Array.isArray(o?.fonts)?o.fonts:[]).filter(n=>n&&w(n.family)&&typeof n.name=="string");for(const n of e.fonts)r.some(i=>i.family===n.family)||m(n.family);for(const n of r)try{h(n)}catch{}c({fonts:r,loaded:!0,error:null})}).catch(o=>{c({loaded:!0,error:o?.message||"fonts"})})),a}const v=()=>y();function B(t){return t?w(t)?e.fonts.find(o=>o.family===t)?.name??f("Font đã xoá"):t:"Arial"}const P=t=>!!t&&w(t)&&e.loaded&&!e.error&&!e.fonts.some(o=>o.family===t);function z(t){const o=t?.code;return o==="bad_font"?f("File này không phải font dùng được (.ttf, .otf, .woff, .woff2 · không nhận bộ .ttc · tối đa {0} MB).",[String(d)]):o==="font_limit"?f("Tối đa 50 font — xoá bớt font không dùng rồi tải lên lại."):o==="font_rights"?f("Cần xác nhận bạn có quyền dùng font trước khi tải lên."):o==="font_not_found"?f("Không tìm thấy font."):t?.message||String(t)}async function L(t,o){const r=(t.name.match(/\.([a-z0-9]+)$/i)?.[1]||"").toLowerCase(),n=x[r];if(!n)throw new Error(f("Chỉ nhận file font .ttf, .otf, .woff hoặc .woff2"));if(t.size>d*1024*1024)throw new Error(f("Font tối đa {0} MB",[String(d)]));const i=await S(new File([t],t.name,{type:n}),o,"font"),s=await _({gcsUri:i.gcsUri,rightsConfirmed:!0});return h(s.font),c({fonts:[s.font,...e.fonts.filter(F=>F.family!==s.font.family)]}),s}async function Y(t){await b(t.id),m(t.family),c({fonts:e.fonts.filter(o=>o.id!==t.id)})}export{$ as FONT_ACCEPT,d as FONT_MAX_MB,x as FONT_TYPES,z as fontError,B as fontLabel,P as isMissingCustomFont,y as loadUserFonts,Y as removeUserFont,L as uploadUserFont,N as useUserFonts,v as userFontsReady,O as userFontsState};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ShotComposer-AHScyNYv.js","assets/titleFrameBudget-BjW--v_T.js","assets/remote-DXG553d8.js","assets/api-C5pOWyBM.js","assets/three.module-Bx43vjkH.js","assets/GLTFLoader-Dy6SrZg8.js","assets/store-Dxq3MZF3.js","assets/rotoMaskStore-DrRawyH9.js","assets/rigTrack-CW9_kg5j.js","assets/RoomEnvironment-Dmv_G5ka.js","assets/tool-DEWWeyCz.js","assets/timelineProps-KL6XCR4Q.js","assets/thumb-xLFX6lDN.js","assets/shotFxAgent-CETPcjzU.js","assets/cameraPresets-CeStHDvF.js","assets/weaponDuel-CEvRDeuE.js","assets/skin-BQG1Iz6Q.js","assets/views-sH39zgjD.js","assets/library-CdukL2BW.js","assets/ShotComposer-VixLbeMe.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as l}from"./titleFrameBudget-BjW--v_T.js";import{R as h}from"./api-C5pOWyBM.js";import{dx as w}from"./remote-DXG553d8.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-Dy6SrZg8.js";import"./store-Dxq3MZF3.js";import"./rotoMaskStore-DrRawyH9.js";import"./rigTrack-CW9_kg5j.js";let m=Promise.resolve();const d=o=>new Promise(r=>setTimeout(r,o));function b(o,r,{timeoutMs:p=6e4}={}){const i=async()=>{const e=document.createElement("div");Object.assign(e.style,{position:"fixed",left:"-20000px",top:"0",width:"960px",height:"540px",pointerEvents:"none",contain:"strict"}),e.setAttribute("aria-hidden","true"),document.body.appendChild(e);const s=w.createRoot(e);try{const{default:u}=await l(async()=>{const{default:t}=await import("./ShotComposer-AHScyNYv.js");return{default:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]));let n=null;s.render(h.createElement(u,{nodeId:o,background:t=>{n=t}}));const c=Date.now()+p;for(;!n?.ready();){if(Date.now()>c)throw new Error("3D Shot did not start in time");await d(60)}for(;;)try{return await r(n)}catch(t){if(!/chưa tải xong/.test(t.message)||Date.now()>c)throw t;await d(500)}}finally{s.unmount(),e.remove()}},a=m.then(i,i);return m=a.catch(()=>{}),a}export{b as withBackgroundScene};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{gP as S,iZ as z}from"./remote-DXG553d8.js";import{gQ as j}from"./remote-DXG553d8.js";import{bD as C,c as O}from"./id3-BCR9Bqgo.js";import{S as D,B as M,O as P,W as H,a as B,C as I}from"./output-BwZzMbp-.js";import"./api-C5pOWyBM.js";import"./titleFrameBudget-BjW--v_T.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-Dy6SrZg8.js";import"./store-Dxq3MZF3.js";import"./rotoMaskStore-DrRawyH9.js";import"./rigTrack-CW9_kg5j.js";async function K(s,T,h){const{start:d,end:k,fps:a,signal:w,progress:g}=h,r=k-d,n=Math.ceil(r*a);if(!(r>0)||!Number.isFinite(r)||!S.includes(a))throw new Error("Khoảng thời gian hoặc FPS không hợp lệ");const p=new C({bitrate:h.height>=1080?6e6:3e6}),i=h.alpha===!0,f=i?"vp9":"avc",v=i?"webm":"mp4";if(!await O(f,{width:s.width,height:s.height,quality:p}))throw new Error(i?"Trình duyệt chưa hỗ trợ xuất VP9 có kênh trong suốt. Hãy dùng Chrome/Edge mới.":"Trình duyệt chưa hỗ trợ xuất H.264. Hãy dùng Chrome/Edge mới, hoặc thử 720p.");let c,m;const l=`camera-export-${crypto.randomUUID()}.${v}`;let t;const y=async()=>{c&&await c.removeEntry(l).catch(()=>{})};try{let o;if(navigator.storage?.getDirectory)c=await navigator.storage.getDirectory(),m=await c.getFileHandle(l,{create:!0}),o=new D(await m.createWritable(),{chunked:!0,chunkSize:1024*1024});else{if(r*(h.height>=1080?6e6:3e6)/8>1e8)throw new Error("Trình duyệt này thiếu bộ nhớ tạm cho video dài. Dùng Chrome/Edge hoặc xuất một đoạn ngắn hơn.");o=new M}t=new P({format:i?new H:new B({fastStart:"reserve"}),target:o});const u=new I(s,{codec:f,quality:p,...i?{alpha:"keep"}:{}});t.addVideoTrack(u,{frameRate:a,maximumPacketCount:n}),await t.start();for(let e=0;e<n;e++){w.throwIfAborted();const b=e/a,E=Math.min(1/a,r-b);await T(d+(n>1?e/(n-1):0)*r),await u.add(b,E,{keyFrame:e%a===0}),e%6===0&&(g(Math.round((e+1)/n*95)),await new Promise(F=>setTimeout(F,0)))}w.throwIfAborted(),u.close(),await t.finalize();const x=m?await m.getFile():new Blob([o.buffer],{type:i?"video/webm":"video/mp4"});return g(100),{blob:x,cleanup:y}}catch(o){throw t&&t.state!=="finalized"&&t.state!=="canceled"&&await t.cancel().catch(()=>{}),await y(),o}}export{j as MOTION_BLUR,K as encodeCameraVideo,z as shutterTimes};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Bone as k,SkinnedMesh as g,Vector3 as a,Scene as L,Color as M,MeshLambertMaterial as b,HemisphereLight as S,DirectionalLight as h,WebGLRenderer as z,OrthographicCamera as C}from"./three.module-Bx43vjkH.js";import{c as D}from"./GLTFLoader-Dy6SrZg8.js";import{f as E}from"./skin-BQG1Iz6Q.js";import"./remote-DXG553d8.js";import"./api-C5pOWyBM.js";import"./titleFrameBudget-BjW--v_T.js";import"./store-Dxq3MZF3.js";import"./rotoMaskStore-DrRawyH9.js";import"./rigTrack-CW9_kg5j.js";const B=640;function H(y,c=B){const t=D(y);t.position.set(0,0,0),t.quaternion.identity(),t.scale.set(1,1,1);const d=[];t.traverse(e=>{e.userData.rigOverlay&&d.push(e),e instanceof k&&e.quaternion.identity()}),d.forEach(e=>e.parent?.remove(e)),t.traverse(e=>{e instanceof g&&e.skeleton.pose()});const p=E(t),r=p.getCenter(new a),f=p.getSize(new a),n=Math.max(f.x,f.y,f.z)/2*1.08,o=new L;o.background=new M("#ffffff");const m=new b({color:"#8d949b"});o.overrideMaterial=m,o.add(new S("#ffffff","#5a6066",2.2));const l=new h("#ffffff",1.4);l.position.set(.4,1,1),o.add(l);const u=new h("#ffffff",.6);u.position.set(1,.5,.3),o.add(u),o.add(t);const i=new z({antialias:!0,preserveDrawingBuffer:!0});i.setSize(c,c,!1);const s=new C(-n,n,n,-n,.01,100),w=e=>(s.position.copy(r).add(e),s.up.set(0,1,0),s.lookAt(r),s.updateProjectionMatrix(),i.render(o,s),i.domElement.toDataURL("image/jpeg",.88));try{const e=n*4,x=w(new a(0,0,e)),v=w(new a(e,0,0));return{front:x,side:v,frame:{cx:r.x,cy:r.y,cz:r.z,half:n}}}finally{m.dispose(),i.dispose(),i.forceContextLoss(),t.traverse(e=>{e instanceof g&&e.skeleton.dispose()})}}export{B as VIEW_SIZE,H as renderRigViews};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{iG as pt,iH as X,ft as ut,fs as mt,fv as Y,fx as L,hN as kt,b as gt,fy as bt,fI as tt,fJ as et,hJ as Mt,fZ as yt,hM as wt}from"./remote-DXG553d8.js";import{a6 as vt}from"./rigTrack-CW9_kg5j.js";const P=t=>pt(t)??(X(t)?{clip:X(t),pack:{id:"fist"}}:null),st=Object.freeze({spear:{"spear-thrust":"thrust","spear-overhead":"high","spear-sweep":"low","spear-spin":"side","spear-dive-thrust":"thrust"},katana:{"katana-overhead":"high","katana-diagonal":"high","katana-horizontal":"side","katana-rising":"side","katana-thrust":"thrust","katana-spin-cut":"side"},staff:{"staff-jab":"thrust","staff-overhead":"high","staff-sweep":"low","staff-rising":"side","staff-spin":"side"},fist:{"fist-lunge-punch":"thrust","fist-rising-uppercut":"side","fist-flying-kick":"side","fist-ground-slam":"high","fist-low-lunge":"thrust"}}),it={high:"block-high",side:"block-side",thrust:"block-side",low:null},jt=Object.freeze({spear:1.42,katana:.98,staff:1.1,fist:0}),Ot={body:.05,blocked:.22,miss:.18},Kt=1.05,at=new Map,dt=t=>{let e=at.get(t);return e||(e=mt(P(t).clip),at.set(t,e)),e},At=(t,e)=>t[Math.max(0,Math.min(t.length-1,Math.round(e*30)))];function ht(t){const e=P(t).clip.keys.filter(a=>a.strike).at(-1);return e?e.t:0}const Ft=t=>P(t).clip.keys.filter(e=>e.strike).at(-1)?.limb??"handR",ot=(t,e)=>At(dt(t),e).dz??0;function $t(t){const{pack:e}=P(t),a=dt(t),h=ht(t),o=Ft(t);let f=0;for(const l of a){if(Math.abs(l.t-h)>.1)continue;if(e.id==="fist"){const j=vt(l.pose),m=j[o.replace("foot","toe")];f=Math.max(f,m[2]-j.pelvis[2]);continue}const r=ut(l.pose),u=r.front[2]+r.dir[2]*jt[e.id];f=Math.max(f,u)}return f}function St(t){let e=t>>>0||1;return()=>{e=e+1831565813>>>0;let a=Math.imul(e^e>>>15,1|e);return a=a+Math.imul(a^a>>>7,61|a)^a,((a^a>>>14)>>>0)/4294967296}}function Tt(t,e=4,a=1){const h=St(a),o=[];let f=0,l=["",""];for(let r=0;r<e;r++){r>0&&h()<.62&&(f=1-f);const u=t[f],j=t[1-f],m=Object.keys(st[u]).filter(S=>S!==l[f]),g=m[Math.floor(h()*m.length)],C=st[u][g];l[f]=g;const i=h();let y=r===e-1?"body":i<.5?"blocked":i<.78?"miss":"body";y==="blocked"&&!it[C]&&(y="miss");const $=`${j}-${y==="blocked"?it[C]:y==="miss"?"dodge-back":"hit"}`,z=ht(g),O=P($).clip.contact??0,b=Math.max(Kt,$t(g)+Ot[y]+ot(g,z)+ot($,O));o.push({attacker:f,attack:g,defence:$,result:y,strike:z,contact:O,gap:Math.round(b*1e3)/1e3})}return o}const x=[.18,.42],nt=t=>(t.kind==="model"?(t.model?.height??2)/1.8:Mt(t))*(t.scale[1]||1),H=t=>t*Math.PI/180,v=t=>t.shots.find(e=>e.id===t.activeShot);function rt(t,e){const a=v(t),h=a.duration/e,o=l=>l?.map(r=>({...r,time:Math.min(1,r.time*h)})),f={...a,duration:e,cameraKeys:o(a.cameraKeys)??[],objectKeys:Object.fromEntries(Object.entries(a.objectKeys||{}).map(([l,r])=>[l,o(r)||[]])),...a.impacts?{impacts:o(a.impacts)}:{},...a.flight?{flight:Object.fromEntries(Object.entries(a.flight).map(([l,r])=>[l,o(r)||[]]))}:{}};return{...t,shots:t.shots.map(l=>l.id===a.id?f:l)}}const ct=(t,e,a)=>{const h=v(t);return{...t,shots:t.shots.map(o=>o.id===h.id?{...o,objectKeys:{...o.objectKeys,[e]:a(o.objectKeys?.[e]||[],o)}}:o)}},T=(t,e,a)=>{const h=v(t),o=yt(t.items.find(f=>f.id===e.id),h,Math.min(1,a/h.duration));return{position:o.position,yaw:o.rotation[1]}};function Pt(t,e,a){const h=t.items.find(s=>s.id===e.a),o=t.items.find(s=>s.id===e.b);if(!h||!o||!Y(h)||!Y(o))return{ok:!1,error:"two people are needed"};if(h.id===o.id)return{ok:!1,error:"two different people are needed"};const f=Math.max(1,Math.min(10,Math.round(e.exchanges))),l=Tt(e.packs,f,e.seed),r=[h,o],u=[nt(h),nt(o)],j=[],m=Math.max(0,e.start),g=v(t),C=m+.5+l.reduce((s,c)=>s+Math.max(L(c.attack).duration,c.strike-c.contact+L(c.defence).duration)+1.4+x[1],0);let i=C>g.duration?rt(t,Math.min(300,C)):t;const M=T(i,h,m),y=l[0].gap*(u[0]+u[1])/2,$=[Math.sin(H(M.yaw)),0,Math.cos(H(M.yaw))],z=[M.position[0]+$[0]*y,M.position[1],M.position[2]+$[2]*y];for(const[s,c,n]of[[h,M.position,M.yaw],[o,z,M.yaw+180]])i=ct(i,s.id,(d,k)=>[...d.filter(p=>p.time*k.duration<m-1e-6),{id:a(),time:m/k.duration,position:c.map(p=>+p.toFixed(3)),rotation:[0,+n.toFixed(1),0],scale:s.scale}]);const O=(s,c,n)=>{const d=v(i),k=L(c),p=wt(i,r[s].id,k,{start:n/d.duration,newId:a,loop:!1});if(!p.ok)throw new Error(`${r[s].name}: ${p.error}`);return i=p.stage,n+k.duration};let b=m+.35,S=m;const E=[];let q=(e.seed*9301+49297)%233280;const lt=()=>(q=(q*9301+49297)%233280,q/233280);try{l.forEach((s,c)=>{const n=s.attacker,d=1-n,k=(u[0]+u[1])/2,p=()=>{const K=T(i,r[0],b).position,A=T(i,r[1],b).position;return Math.hypot(A[0]-K[0],A[2]-K[2])};for(let K=0;K<3;K++){const A=p()-s.gap*k;if(Math.abs(A)<.3*k)break;A>0?b=O(n,`${e.packs[n]}-advance`,b):b=O(d,`${e.packs[d]}-retreat`,b)}const D=Math.max(0,s.contact-s.strike),w=b+D,I=w+s.strike-s.contact,N=p()-s.gap*k,R=O(n,s.attack,w),ft=O(d,s.defence,I),G=r[n],B=T(i,G,w).yaw,U=[Math.sin(H(B)),Math.cos(H(B))],W=w+s.strike,V=Math.max(-.3,Math.min(.3,N));i=ct(i,G.id,(K,A)=>K.map(F=>{const _=F.time*A.duration;if(_<w-1e-6||_>R+1e-6)return F;const J=Math.min(1,(_-w)/Math.max(.001,s.strike)),Z=J*J*(3-2*J),Q={...F,position:[+(F.position[0]+U[0]*V*Z).toFixed(3),F.position[1],+(F.position[2]+U[1]*V*Z).toFixed(3)]};return F.strike&&Math.abs(_-W)<.06?{...Q,hit:s.result}:Q})),E.push({...s,time:+W.toFixed(2),attackerName:G.name}),S=Math.max(R,ft),b=S+x[0]+(x[1]-x[0])*lt(),c===l.length-1&&j.push(`${r[d].name} dính đòn kết`)})}catch(s){return{ok:!1,error:s.message}}if(v(i).duration>g.duration&&(i=rt(i,Math.max(g.duration,Math.min(300,Math.ceil((S+.6)*10)/10)))),i=kt(i).stage,e.packs.includes("fist")){const s=v(i),c=[],n={};E.forEach((d,k)=>{if(d.result==="miss"||e.packs[d.attacker]!=="fist")return;const p=T(i,r[0],d.time).position,D=T(i,r[1],d.time).position,w=(u[0]+u[1])/2,I=`duelfx-${r[d.attacker].id}-${Math.round(d.time*1e3)}`,N=d.result==="body";c.push({...gt("fx",i.items.length+c.length),id:I,name:`Vòng xung kích ${c.length+1}`,position:[+((p[0]+D[0])/2).toFixed(2),0,+((p[2]+D[2])/2).toFixed(2)],color:N?"#ffd27a":"#9fdcff",fx:{preset:"vong_xung_kich",cat:"vong-xung-kich",intensity:N?.9:.75,seed:500+k,start:d.time,duration:.6,loop:!1,auto:"hit",params:{size:(N?1.05:.85)*w,height:+(1.35*w).toFixed(2),hits:1,gap:.3}}}),n[I]={start:d.time,duration:.6}}),c.length&&(i={...i,items:[...i.items,...c],shots:i.shots.map(d=>d.id===s.id?{...d,fxTiming:{...d.fxTiming,...n}}:d)})}if(e.hitStops!==!1){const s=v(i);let c=bt(s.timing,s.duration);c=tt(c,E.filter(n=>n.result==="blocked").map(n=>n.time),et.light,s.duration),c=tt(c,E.filter(n=>n.result==="body").map(n=>n.time),et.heavy,s.duration),i={...i,shots:i.shots.map(n=>n.id===s.id&&c?{...n,timing:c}:n)}}return{ok:!0,stage:i,plan:E,end:+S.toFixed(2),notes:j}}export{st as D,Pt as s};
|