clipoox-render 0.3.0 → 0.4.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/dist/server-text/titleRaster.js +23 -4
- package/package.json +1 -1
- package/scripts/render-local.mjs +229 -229
- package/shared/transitionStarterPack.json +355 -0
- package/web/assets/{FxEmbed-D7k1ThAF.js → FxEmbed-CGqGi2Lw.js} +1 -1
- package/web/assets/{MotionEmbed-DFni5IAh.js → MotionEmbed-C3CZ3_y_.js} +1 -1
- package/web/assets/{PluginStore-BrupM_8E.js → PluginStore-DKXZ-jBj.js} +1 -1
- package/web/assets/{ShotComposer-BLztjSKy.js → ShotComposer-DFfaYLoV.js} +4 -4
- package/web/assets/{TemplateEmbed-BbAimhLj.js → TemplateEmbed-C8pXcPsc.js} +1 -1
- package/web/assets/{TimelinePlugins-BI1bE9pX.js → TimelinePlugins-DnkV3i4G.js} +3 -3
- package/web/assets/{TimelineShotFx-CQN3WIfN.js → TimelineShotFx-foiuuogg.js} +2 -2
- package/web/assets/{TransitionEmbed-CmoIrHVr.js → TransitionEmbed-BueDilY0.js} +1 -1
- package/web/assets/{Whiteboard-DMk0unYK.js → Whiteboard-zBsNHh5h.js} +1 -1
- package/web/assets/aerial-z34Nww_T.js +2 -0
- package/web/assets/{agentTools-qOww5RUs.js → agentTools-ALxghYpf.js} +2 -2
- package/web/assets/{analyzerRun-B2FLUp4G.js → analyzerRun-DNwryAlU.js} +1 -1
- package/web/assets/{analyzerSandbox-CJVsEhrg.js → analyzerSandbox-A1oFsCrO.js} +1 -1
- package/web/assets/{api-QBI5GJTZ.js → api-DUp403BK.js} +57 -57
- package/web/assets/auraTrack-BKVZCwNt.js +1 -0
- package/web/assets/breakthrough-Cwt8gEwK.js +2 -0
- package/web/assets/{cameraPresets-4pFeF2YG.js → cameraPresets-DSOPj4oy.js} +1 -1
- package/web/assets/{captionLayout-C67EMVI1.js → captionLayout-EuB59pN_.js} +1 -1
- package/web/assets/clientExport-BL1XMTF0.js +1 -0
- package/web/assets/{depthEstimate-mnXDZMW-.js → depthEstimate-DOvsY8mn.js} +1 -1
- package/web/assets/{directorTools-BOHZjcww.js → directorTools-BkbNYbSq.js} +1 -1
- package/web/assets/{distortFrames-Csuj2jHE.js → distortFrames-Drch0LhT.js} +2 -2
- package/web/assets/{distortGL-BaXfN0IK.js → distortGL-BlmBZKRU.js} +2 -2
- package/web/assets/{editTools-m0VGPmfF.js → editTools-BcGinqHC.js} +1 -1
- package/web/assets/exportEncode-MUwVTI52.js +1 -0
- package/web/assets/{exportGlb-CLfTnbMG.js → exportGlb-SIXFRRJM.js} +1 -1
- package/web/assets/{faceTracker-W0iZSiMe.js → faceTracker-DCbZbLMc.js} +1 -1
- package/web/assets/fightDirector-hlF1JS_z.js +1 -0
- package/web/assets/fightDrama-fHN5EXk3.js +2 -0
- package/web/assets/{frameSink-BGRj7wqY.js → frameSink-BvOXjLuw.js} +3 -3
- package/web/assets/{gpuCompose-CIEoLFem.js → gpuCompose-CNkLwpbZ.js} +1 -1
- package/web/assets/gpuExport-DQB6x4eh.js +194 -0
- package/web/assets/{handMatte-mHxZwLZD.js → handMatte-BD7OE3Zc.js} +1 -1
- package/web/assets/{handTracker-dTVeSUzt.js → handTracker-BumGtRCW.js} +2 -2
- package/web/assets/{index-D7M5t2re.js → index-CuaB7Y0L.js} +1 -1
- package/web/assets/{layer-worker-Cp0pjurp.js → layer-worker-DxPMMKIZ.js} +3 -3
- package/web/assets/library-CyjJ8nGG.js +1 -0
- package/web/assets/{lottieLayer-CDCGeJyv.js → lottieLayer-1ET89OUr.js} +5 -5
- package/web/assets/{lottie_light_canvas-BblLU4nU.js → lottie_light_canvas-DD9pkFL8.js} +1 -1
- package/web/assets/{main-CVRIuDW2.js → main-BKjBWQik.js} +91 -91
- package/web/assets/{main-BQ8IY0WV.css → main-Ca_CVxMz.css} +1 -1
- package/web/assets/mapBake-DLoBt_k5.js +1 -0
- package/web/assets/{maskTrack-Dtv6Jr06.js → maskTrack-C2SJbDGO.js} +1 -1
- package/web/assets/{matteFixRun-BLDH2AjH.js → matteFixRun-BdHKC3m5.js} +1 -1
- package/web/assets/{objectLocate-Cy3IFBSF.js → objectLocate-bZtc5AJo.js} +1 -1
- package/web/assets/{pendingMatte-C2AWApuv.js → pendingMatte-mlyLLZCT.js} +2 -2
- package/web/assets/{personAi-DPUnoymj.js → personAi-CUNQeseG.js} +2 -2
- package/web/assets/plateCamera-_jP1xXnj.js +1 -0
- package/web/assets/{plateCameraMatch-Chk-ZjDi.js → plateCameraMatch-rr0oUwQ2.js} +2 -2
- package/web/assets/{plateFollow-B9_QTgvo.js → plateFollow-BjvtcT8q.js} +2 -2
- package/web/assets/{plateMatte-BiqyI_8x.js → plateMatte-BqyL8cQZ.js} +2 -2
- package/web/assets/{pluginAutomation-5DYldFrb.js → pluginAutomation-Dp188qm7.js} +1 -1
- package/web/assets/{poseTracker-PuI8vWpR.js → poseTracker-DDGDhhMF.js} +1 -1
- package/web/assets/{productTools-B1h5cgyt.js → productTools-CRgI88-O.js} +2 -2
- package/web/assets/remote-Dva2qg58.js +1241 -0
- package/web/assets/{rigTrack-CUt4O67J.js → rigTrack-UYZU4P-e.js} +1 -1
- package/web/assets/{rotoMaskStore-DIi45swK.js → rotoMaskStore-BxyxB2bD.js} +1 -1
- package/web/assets/{rotoMatte-013RKqHu.js → rotoMatte-BdYa8FSB.js} +1 -1
- package/web/assets/{rotoscope-d_TUxa-J.js → rotoscope-DDixNQCt.js} +1 -1
- package/web/assets/{shot-worker-B1iZT6F5.js → shot-worker-D9sZS6bn.js} +1 -1
- package/web/assets/{shotFxAgent-BDfe73TP.js → shotFxAgent-7RQNtEe4.js} +2 -2
- package/web/assets/{skin-GDY3QPkV.js → skin-CVwmK130.js} +1 -1
- package/web/assets/{spark.module-DdwuJ_hb.js → spark.module-B34aiScb.js} +1 -1
- package/web/assets/{spellDuel-DjNN00bv.js → spellDuel-BkweL6pI.js} +2 -2
- package/web/assets/{store-2zneEhhu.js → store-75tQUvPT.js} +1 -1
- package/web/assets/surfaceLight-DhU-zgNL.js +1 -0
- package/web/assets/{surfacePin-zDPmq-hH.js → surfacePin-ObK6QgDm.js} +2 -2
- package/web/assets/textAnimators-nVSz_sZo.js +1 -0
- package/web/assets/{thumb-byAKvhQP.js → thumb-r6dlZprA.js} +1 -1
- package/web/assets/{timeline3d-YIIk_Kn2.js → timeline3d-246tBEJl.js} +2 -2
- package/web/assets/timeline3dExport-T57qnWi9.js +1 -0
- package/web/assets/{timelineComp-B73i_8vD.js → timelineComp-BcewYGR2.js} +1 -1
- package/web/assets/{timelineProps-B2pnudeT.js → timelineProps-CJzzAWWO.js} +1 -1
- package/web/assets/{timelineText-BcL4Pw3C.js → timelineText-BzUhNWPB.js} +1 -1
- package/web/assets/titleArt-B8DVR58F.js +5 -0
- package/web/assets/{titleFrameBudget-Cml-MO53.js → titleFrameBudget-BYRZAQPs.js} +260 -260
- package/web/assets/titleFrames-BVgm601q.js +1 -0
- package/web/assets/{tool-Bt9bclIf.js → tool-CAGU3dUa.js} +1 -1
- package/web/assets/{tools-BXeJbgZJ.js → tools-DVaOkokV.js} +1 -1
- package/web/assets/{toonTools-u7Y9fdEZ.js → toonTools-CfGTR_H1.js} +2 -2
- package/web/assets/{trackAnchor-9MnVHe4S.js → trackAnchor-DzUt1r5Q.js} +1 -1
- package/web/assets/{userFonts-BHduCNtc.js → userFonts-DzY0A4bD.js} +1 -1
- package/web/assets/{vfxAlpha-DpV4rbI-.js → vfxAlpha-DQJOaZ9v.js} +2 -2
- package/web/assets/{vfxBackground-Ddviync5.js → vfxBackground-DiktQFOD.js} +2 -2
- package/web/assets/{videoExport-z5WjM0hw.js → videoExport-Ce0ElSQR.js} +1 -1
- package/web/assets/{views-CsrYzCSR.js → views-V3si1lOz.js} +1 -1
- package/web/assets/weaponDuel-D6sLVGmG.js +1 -0
- package/web/assets/{windowFrames-BQEWQkEs.js → windowFrames-D_2QJCJJ.js} +1 -1
- package/web/layer-worker.html +3 -3
- package/web/assets/aerial-DT_gUtSh.js +0 -2
- package/web/assets/auraTrack-CEs_Q9EP.js +0 -1
- package/web/assets/breakthrough-DvkxvNK9.js +0 -2
- package/web/assets/clientExport-C4VgAJtO.js +0 -1
- package/web/assets/exportEncode-D9OT7_5k.js +0 -1
- package/web/assets/fightDirector-CECPf2iH.js +0 -1
- package/web/assets/fightDrama-CqNoa5XI.js +0 -2
- package/web/assets/gpuExport-uyOAyrhm.js +0 -190
- package/web/assets/library-Dsz_MLyd.js +0 -1
- package/web/assets/mapBake-CNMOKXA7.js +0 -1
- package/web/assets/plateCamera-C96L5GKm.js +0 -1
- package/web/assets/remote-BJdzzFZg.js +0 -1241
- package/web/assets/surfaceLight-B_SYg_f8.js +0 -1
- package/web/assets/textAnimators-Bdt5LWXk.js +0 -1
- package/web/assets/timeline3dExport-CEH1RjNf.js +0 -1
- package/web/assets/titleArt-hb_T45WJ.js +0 -5
- package/web/assets/titleFrames-Dw0PEBdV.js +0 -1
- package/web/assets/weaponDuel-CLLgv5A4.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c1 as T,eQ as ot,eR as rt,m3 as nt,eV as B,m4 as it,ec as st,eW as lt,eS as O,ee as V,eU as Q,eZ as X,eY as Z,e_ as q,eX as z}from"./titleFrameBudget-BYRZAQPs.js";import{l as ht,d as dt}from"./titleArt-B8DVR58F.js";import{i as R,j as mt,s as k,d as P,l as ct,k as j,f as ft,e as G,a as ut,p as pt,t as wt,m as tt}from"./lottieLayer-1ET89OUr.js";import{wantsFrame as J,SKIPPED_FRAME as gt}from"./frameSink-BvOXjLuw.js";import{t as N}from"./api-DUp403BK.js";import"./textAnimators-nVSz_sZo.js";import"./rigTrack-UYZU4P-e.js";const xt=e=>Q(e.title)||!!e.shape||!!e.motion||!!e.lottie||!!e.card||!!e.geo,U=e=>e.kind==="image"&&!!e.title?.text&&!e.url&&!Q(e.title),H=4,Y=192*1024*1024,g=new Map;let A=0;function Et(e,s){if(e.geo||e.shape&&R(e.shape)||e.pin?.scene||e.space)return null;const{start:i,track:h,...n}=e;return JSON.stringify([s,n])}function Mt(e,s){const i=s.reduce((h,n)=>h+n.length,0);if(!(i>Y/4)){g.delete(e),g.set(e,{frames:s,bytes:i}),A+=i;for(const[h,n]of g){if(A<=Y)break;g.delete(h),A-=n.bytes}}}function Tt(){g.clear(),A=0}const bt=e=>new Promise((s,i)=>e.toBlob(h=>{if(!h)return i(Error("Cannot encode title frame"));const n=new FileReader;n.onload=()=>s(String(n.result).slice(String(n.result).indexOf(",")+1)),n.onerror=()=>i(n.error),n.readAsDataURL(h)},"image/webp",.9));async function Pt(e,s,i,h,n){const{fps:o,width:f,height:S}=T(s),u=T({...s,resolution:"720p"}),y=e.some(t=>t.shape&&R(t.shape))?ot(rt(e)):null,$=!!i.wants;for(const t of e.filter(d=>(xt(d)||U(d))&&!d.warped)){if(!J(i,"titleFrames",t.id))continue;const d=a=>J(i,"titleFrames",t.id,a),m=Et(t,s),r=m?g.get(m):void 0;if(r){g.delete(m),g.set(m,r);for(const a of r.frames){if(h?.aborted)throw new DOMException("Export cancelled","AbortError");await i.push("titleFrames",t.id,a)}continue}const x=[],E=t.title,M=nt(t)||U(t)?1:Math.ceil(t.duration*o);if(M>1&&Math.ceil(t.duration*o)>3600)throw Error("Mỗi tiêu đề động / Motion tối đa 2 phút khi xuất MP4.");E&&!t.shape&&!t.motion&&!t.lottie&&!t.card&&!t.geo&&await ht(E);const b=t.card?await mt(t.card).catch(a=>{throw Error(N("Thẻ HTML “{0}”: {1}",[t.label,a.message]))}):null,[p,w]=b?[b.width,b.height]:t.geo?[u.width,u.height]:t.lottie?[B(t.lottie).W,B(t.lottie).H]:t.motion?[u.width,u.height]:t.shape?[k(t.shape).W,k(t.shape).H]:[1280,720],C=Object.assign(document.createElement("canvas"),{width:p,height:w}),F=C.getContext("2d");if(!F)throw Error("Canvas unavailable");let _="",D=null;const I=(a,l)=>tt({layer:`export:${a.id}`,motion:a.motion,t:z(a,l/o),width:p,height:w,duration:q(a),fps:o,surface:a.pin?.scene?Z(a,e,a.start+l/o,p,w):null,space:a.space?(O(e),X(a,e,a.start+l/o,p,w,n)):null}),c=[],L="\0same",W="\0skip",K=t.shape&&!t.motion&&!t.card&&!t.lottie&&!t.geo&&!R(t.shape)?it(t.shape):null,et=K==null?1/0:Math.max(K,...["trimStart","trimEnd"].flatMap(a=>st(t,a).map(l=>l.time))),v=async()=>{const a=await c.shift();if(a===W){await i.push("titleFrames",t.id,gt);return}if(a===L||a===_){x.push("="),await i.push("titleFrames",t.id,"=");return}_=a,x.push(a),await i.push("titleFrames",t.id,a)};try{for(let a=0;a<M;a++){if(h?.aborted)throw new DOMException("Export cancelled","AbortError");if(!d(a)){c.push(Promise.resolve(W)),c.length>=H&&await v();continue}if(!$&&a>0&&(a-1)/o>et+1e-6){c.push(Promise.resolve(L)),c.length>=H&&await v();continue}if(F.clearRect(0,0,p,w),t.motion){let l;try{l=await(D??I(t,a)),D=a+1<M&&d(a+1)?I(t,a+1):null}catch(at){throw D?.catch(()=>{}),P(`export:${t.id}`),Error(`Motion “${t.label}”: ${at.message}`)}F.drawImage(l,0,0),l.close()}else if(t.lottie)try{await ct(`export:${t.id}`,t.url,{W:p,H:w},lt(t,a/o),C)}catch(l){throw j(`export:${t.id}`),Error(`Lottie “${t.label}”: ${l.message}`)}else if(t.geo)try{await ft(`export:${t.id}`,t.geo,{W:p,H:w},a/o,C,{wait:2e4,duration:t.duration})}catch(l){throw G(`export:${t.id}`),Error(N("Bản đồ “{0}”: {1}",[t.label,l.message]))}else b?F.drawImage(b,0,0):t.shape?(y&&O(y),ut(F,pt(t,e,a/o,f,S),{start:V(t,"trimStart",a/o),end:V(t,"trimEnd",a/o),offset:wt(t.shape)},p,w,a/o)):dt(F,E,{time:a/o,duration:t.duration});c.push(bt(C)),c.length>=H&&await v()}for(;c.length;)await v();m&&!$&&Mt(m,x)}finally{for(const a of c)a.catch(()=>{})}t.motion&&P(`export:${t.id}`),t.lottie&&j(`export:${t.id}`),t.geo&&G(`export:${t.id}`)}}function Dt(e,s,i,h){const{fps:n}=T(i),{width:o,height:f}=T({...i,resolution:"720p"}),S=Math.ceil(e.duration*n)-1,u=Object.assign(document.createElement("canvas"),{width:o,height:f}),y=u.getContext("2d");if(!y)throw Error("Canvas unavailable");const $=r=>tt({layer:`export:${e.id}`,motion:e.motion,t:z(e,r/n),width:o,height:f,duration:q(e),fps:n,surface:e.pin?.scene?Z(e,s,e.start+r/n,o,f):null,space:e.space?(O(s),X(e,s,e.start+r/n,o,f,h)):null});let t=null,d=-1;const m=r=>{r?.p.then(x=>x.close(),()=>{})};return{W:o,H:f,async frame(r){if(r=Math.max(0,Math.min(S,r)),r===d)return u;for(;t&&t.i<r;){const M=t;t=null,await M.p.then(b=>b.close(),()=>{})}const x=t&&t.i===r?t.p:$(r);t&&t.i!==r&&m(t),t=null;let E;try{E=await x}catch(M){throw P(`export:${e.id}`),Error(`Motion “${e.label}”: ${M.message}`)}return t=r<S?{i:r+1,p:$(r+1)}:null,y.clearRect(0,0,o,f),y.drawImage(E,0,0),E.close(),d=r,u},close(){m(t),t=null,P(`export:${e.id}`)}}}export{Tt as clearFrameCache,Et as frameCacheKey,Dt as liveMotion,Pt as renderTitleFrames};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GLTFExporter-BuGYM-Ik.js","assets/three.module-Bx43vjkH.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{
|
|
2
|
+
import{dU as P}from"./remote-Dva2qg58.js";import{_ as R}from"./titleFrameBudget-BYRZAQPs.js";import{Vector3 as S,WebGLRenderer as O,NeutralToneMapping as D,SRGBColorSpace as B,Scene as F,Color as k,HemisphereLight as G,DirectionalLight as C,PerspectiveCamera as $,Mesh as q,Group as _,BufferGeometry as U,BufferAttribute as x,InstancedMesh as W,Matrix4 as Z,MeshPhysicalMaterial as V,DoubleSide as Y,FrontSide as X}from"./three.module-Bx43vjkH.js";const f=Object.freeze({code:24e3,triangles:3e5,instanceTriangles:3e6,meshes:64,instances:2e4,params:12,timeoutMs:8e3,size:500}),J=String.raw`
|
|
3
3
|
const __codeModel = (() => {
|
|
4
4
|
const LIM = ${JSON.stringify(f)}
|
|
5
5
|
let seed = 1, noiseSeed = 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as N,c as E,a as _,d as D}from"./shotFxAgent-
|
|
1
|
+
import{b as N,c as E,a as _,d as D}from"./shotFxAgent-7RQNtEe4.js";import{jj as P,jk as B,gM as h,eL as L,eq as A,dJ as U,dH as X}from"./remote-Dva2qg58.js";import"./api-DUp403BK.js";import"./titleFrameBudget-BYRZAQPs.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-75tQUvPT.js";import"./rotoMaskStore-BxyxB2bD.js";import"./textAnimators-nVSz_sZo.js";import"./timelineComp-BcewYGR2.js";import"./rigTrack-UYZU4P-e.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}}},w=(s,n,o)=>({...s,shots:s.shots.map(c=>c.id===s.activeShot?{...c,fxTiming:{...c.fxTiming,[n]:o}}:c)}),v=(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 Y(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=>w({...i,items:[...i.items,e]},e.id,t.timing));const f=h(o.getStage());return{ok:!0,...v(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=w({...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,...v(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,K=(r.min[2]+r.max[2])/2,S=A(t,e),M=Math.min(1,S.start/f),O=Math.min(1,(S.start+S.duration)/f);T(p([{time:M,position:[r.min[0]-l,y,K]},{time:O,position:[r.max[0]+l,y,K]}])),i.push("sweep through the target")}if(!i.length)return{ok:!1,error:"give points, sweep or target"};const $=a;return o.setStage(()=>$),{ok:!0,name:t.name,changed:i,path_s:(h($).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=>w({...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,...v(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{Y as runFxTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rotoMaskStore-
|
|
2
|
-
import{_ as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rotoMaskStore-BxyxB2bD.js","assets/titleFrameBudget-BYRZAQPs.js","assets/api-DUp403BK.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as U}from"./titleFrameBudget-BYRZAQPs.js";import{gM as O,iY as j,fq as C,g1 as P,dU as L,jl as B,jm as E,jn as F,fU as $,f$ as D,g0 as I}from"./remote-Dva2qg58.js";import"./api-DUp403BK.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-75tQUvPT.js";import"./rotoMaskStore-BxyxB2bD.js";import"./textAnimators-nVSz_sZo.js";import"./timelineComp-BcewYGR2.js";import"./rigTrack-UYZU4P-e.js";const T=["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,q=t=>t==="left"?"L":t==="both"?"both":"R",w=t=>Math.round(t*1e3)/1e3;function Z(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 T)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 tt(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(!C(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=L(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=q(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=B((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"?F(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 et(t,p){const c=p.getStage(),d=O(c),a=await U(()=>import("./rotoMaskStore-BxyxB2bD.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{tt as addBall,et as physicsDrop,Z as setToon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as v,gM as b,je as j,dH as $,jg as F,jh as y,ji as N}from"./remote-Dva2qg58.js";import{a as A}from"./shotFxAgent-7RQNtEe4.js";import{Vector3 as _}from"./three.module-Bx43vjkH.js";import"./api-DUp403BK.js";import"./titleFrameBudget-BYRZAQPs.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-75tQUvPT.js";import"./rotoMaskStore-BxyxB2bD.js";import"./textAnimators-nVSz_sZo.js";import"./timelineComp-BcewYGR2.js";import"./rigTrack-UYZU4P-e.js";const C=4,T=1.25;function w(t,c,r){return t.updateMatrixWorld(),new _(c*2-1,1-r*2,.5).unproject(t).sub(t.position).normalize()}function M(t,c,r){const o=b(t),s=Math.max(1e-6,o.duration),f=t.items.find(n=>n.kind==="person"&&!n.hidden);return c.points.map(([n,d,l])=>{const m=Math.max(0,Math.min(1,n/s)),p=j(o,m),a=w(p,d,l);let u=r??NaN;if(!Number.isFinite(u)&&f){const h=$(f,o,m);u=new _(h.position[0],h.position[1]+T*Math.max(.3,h.scale[1]),h.position[2]).sub(p.position).dot(a)}(!Number.isFinite(u)||u<.3)&&(u=C);const k=p.position.clone().addScaledVector(a,u);return{t:m,d:u,position:[k.x,k.y,k.z].map(h=>Math.round(h*1e4)/1e4)}})}function B(t,c,r,o,s){const f=b(t),n=Math.max(1e-6,f.duration),d=j(f,Math.max(0,Math.min(1,c/n))),l=w(d,r,o);if(s&&l.y<-.01){const m=-d.position.y/l.y;if(m>.3&&m<80){const p=d.position.clone().addScaledVector(l,m);return[p.x,0,p.z].map(a=>Math.round(a*1e4)/1e4)}}return M(t,{points:[[Math.max(0,Math.min(n,c)),r,o]]})[0].position}function K(t,c,r){const o=b(c).duration;try{if(t.track!=null)return F(t.track,o);const s=String(t.source??"");if(!y.includes(s))return`give track {fps, points} or source ${y.join(" / ")}`;const f=c.plate?.timelineClipId,n=f?r.timelineClip?.(f):void 0;return n?N(n,s,{side:t.side==="left"?"left":"right",point:typeof t.point=="string"?t.point:"palm",...typeof t.object=="string"?{object:t.object}:{},to:o}):"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(s){return s.message}}function L(t,c){const r=c.getStage();if(!r.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 o=A(r.items.filter(i=>i.kind==="fx"),String(t.name??""));if(!o?.fx)return{ok:!1,error:`no effect named '${String(t.name)}' (scene_summary lists the effects)`};const s=r.items.find(i=>i.trackAnchor?.effect===o.id);if(t.stop===!0)return s?(c.setStage(i=>({...i,items:i.items.filter(e=>e.id!==s.id).map(e=>e.id===o.id?{...e,fx:{...e.fx,...e.fx.attach?.to===s.id?{attach:void 0}:{},...e.fx.target?.to===s.id?{target:void 0}:{}}}:e),shots:i.shots.map(e=>({...e,...e.objectKeys?{objectKeys:Object.fromEntries(Object.entries(e.objectKeys).filter(([S])=>S!==s.id))}:{}}))})),{ok:!0,name:o.name,stopped:!0}):{ok:!1,error:`${o.name} follows no track`};const f=K(t,r,c);if(typeof f=="string")return{ok:!1,error:f};const n=t.depth_m==null?void 0:Number(t.depth_m);if(n!==void 0&&!(n>=.3&&n<=200))return{ok:!1,error:"depth_m must be 0.3–200 (metres from the camera)"};const d=t.offset==null?void 0:Array.isArray(t.offset)&&t.offset.length===3&&t.offset.every(i=>Number.isFinite(Number(i))&&Math.abs(Number(i))<=20)?t.offset.map(Number):null;if(d===null)return{ok:!1,error:"offset must be [x, y, z] metres (±20)"};const l=t.role==="target"?"target":"attach",m=M(r,f,n),p=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=s?{...s,trackAnchor:{effect:o.id,source:p}}:{...v("sphere",r.items.length),name:`${o.name} · điểm bám`.slice(0,60),color:"#ffffff",trackAnchor:{effect:o.id,source:p}};a.position=m[0].position,a.rotation=[0,0,0],a.scale=[1,1,1];const u=m.map((i,e)=>({id:`${a.id}-t${e}`,time:i.t,position:i.position,rotation:[0,0,0],scale:[1,1,1]})),k={...o.fx,...l==="attach"?{attach:{to:a.id,follow:"position",...d?{offset:d}:{}}}:{target:{to:a.id,part:"center"}}};c.setStage(i=>({...i,items:[...i.items.filter(e=>e.id!==a.id).map(e=>e.id===o.id?{...e,fx:k}:e),a],shots:i.shots.map(e=>e.id===i.activeShot?{...e,objectKeys:{...e.objectKeys,[a.id]:u}}:e)}));const h=m.map(i=>i.d).sort((i,e)=>i-e),x=b(r).duration;return{ok:!0,name:o.name,anchor:a.name,source:p,role:l,samples:m.length,from_s:+f.points[0][0].toFixed(2),to_s:+f.points.at(-1)[0].toFixed(2),depth_m:+h[h.length>>1].toFixed(2),note:`${o.name} now ${l==="attach"?"rides on":"aims at"} the tracked point (${m.length} keys over ${x.toFixed(1)} s, ${n?`${n} 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{L as followTrack,B as scenePoint,M as trackWorldPoints};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as f,
|
|
1
|
+
import{t as f,bZ as p,b_ as b,c as S,b$ as _,r as U}from"./api-DUp403BK.js";import{u as C}from"./store-75tQUvPT.js";import{i as w}from"./textAnimators-nVSz_sZo.js";import"./titleFrameBudget-BYRZAQPs.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)}),$=()=>U.useSyncExternalStore(E,()=>e),N=()=>e,x={ttf:"font/ttf",otf:"font/otf",woff:"font/woff",woff2:"font/woff2"},O=".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 q(t){await b(t.id),m(t.family),c({fonts:e.fonts.filter(o=>o.id!==t.id)})}export{O as FONT_ACCEPT,d as FONT_MAX_MB,x as FONT_TYPES,z as fontError,B as fontLabel,P as isMissingCustomFont,y as loadUserFonts,q as removeUserFont,L as uploadUserFont,$ as useUserFonts,v as userFontsReady,N as userFontsState};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ic as D}from"./remote-Dva2qg58.js";import{FramebufferTexture as F,ShaderMaterial as S,Color as w,WebGLRenderTarget as k,NoColorSpace as O,HalfFloatType as A,UnsignedByteType as I}from"./three.module-Bx43vjkH.js";import"./api-DUp403BK.js";import"./titleFrameBudget-BYRZAQPs.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-75tQUvPT.js";import"./rotoMaskStore-BxyxB2bD.js";import"./textAnimators-nVSz_sZo.js";import"./timelineComp-BcewYGR2.js";import"./rigTrack-UYZU4P-e.js";const U=new S({uniforms:{tC:{value:null},tB:{value:null},tW:{value:null},uOcc:{value:0}},vertexShader:"varying vec2 vUv; void main() { vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }",fragmentShader:`uniform sampler2D tC, tB, tW; uniform float uOcc; varying vec2 vUv;
|
|
2
2
|
void main() {
|
|
3
3
|
vec3 b = texture2D(tB, vUv).rgb, w = texture2D(tW, vUv).rgb;
|
|
4
4
|
float occ = clamp(1.0 - max(max(w.r - b.r, w.g - b.g), w.b - b.b), 0.0, 1.0);
|
|
@@ -6,4 +6,4 @@ import{i4 as D}from"./remote-BJdzzFZg.js";import{FramebufferTexture as F,ShaderM
|
|
|
6
6
|
vec3 c = texture2D(tC, vUv).rgb;
|
|
7
7
|
float a = max(occ, max(max(c.r, c.g), c.b));
|
|
8
8
|
gl_FragColor = vec4(a > 0.002 ? clamp(c / a, 0.0, 1.0) : vec3(0.0), a);
|
|
9
|
-
}`,depthTest:!1,depthWrite:!1}),n=(t,
|
|
9
|
+
}`,depthTest:!1,depthWrite:!1}),n=(t,c,e)=>new k(t,c,{type:e?A:I,depthBuffer:e,samples:e?4:0,colorSpace:O});function j(t,c,e){const v=n(c,e,!0),i=n(c,e,!0),f=n(c,e,!1),g=new F(c,e),y=new D(U),T=new Uint8Array(c*e*4),B=new w(0,0,0),M=new w(1,1,1),C=(o,u,s,r)=>{const a=o.background,l=t.getRenderTarget();try{o.background=B,t.setRenderTarget(s),t.clear(),t.render(o,u),o.background=M,t.setRenderTarget(r),t.clear(),t.render(o,u)}finally{o.background=a,t.setRenderTarget(l)}},R=(o,u,s,r)=>{const a=U.uniforms;a.tB.value=u.texture,a.tW.value=s.texture,a.tC.value=g,a.uOcc.value=o?1:0,t.setRenderTarget(r),y.render(t),t.setRenderTarget(null)};return{frame(o,u,s){t.setRenderTarget(null),t.copyFramebufferToTexture(g),C(o,u,v,i),R(!1,v,i,f),t.readRenderTargetPixels(f,0,0,c,e,T);const r=s.createImageData(c,e),a=c*4;for(let l=0;l<e;l++)r.data.set(T.subarray((e-1-l)*a,(e-l)*a),l*a);s.putImageData(r,0,0)},occlusion(o,u,s=8){const r=Math.max(16,Math.round(c/s)),a=Math.max(16,Math.round(e/s)),l=n(r,a,!0),b=n(r,a,!0),x=n(r,a,!1),d=new Uint8Array(r*a*4);try{C(o,u,l,b),R(!0,l,b,x),t.readRenderTargetPixels(x,0,0,r,a,d);const m=[];for(let p=0;p<d.length;p+=4)m.push(d[p]);return m.sort((p,W)=>p-W),m[Math.floor(m.length*.98)]/255}finally{l.dispose(),b.dispose(),x.dispose()}},dispose(){v.dispose(),i.dispose(),f.dispose(),g.dispose(),y.dispose()}}}export{j as createVfxAlpha};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ShotComposer-
|
|
2
|
-
import{_ as l}from"./titleFrameBudget-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ShotComposer-DFfaYLoV.js","assets/titleFrameBudget-BYRZAQPs.js","assets/remote-Dva2qg58.js","assets/api-DUp403BK.js","assets/three.module-Bx43vjkH.js","assets/GLTFLoader-BHWu1lKg.js","assets/store-75tQUvPT.js","assets/rotoMaskStore-BxyxB2bD.js","assets/textAnimators-nVSz_sZo.js","assets/timelineComp-BcewYGR2.js","assets/rigTrack-UYZU4P-e.js","assets/RoomEnvironment-Dmv_G5ka.js","assets/tool-CAGU3dUa.js","assets/timelineProps-CJzzAWWO.js","assets/thumb-r6dlZprA.js","assets/shotFxAgent-7RQNtEe4.js","assets/cameraPresets-DSOPj4oy.js","assets/weaponDuel-D6sLVGmG.js","assets/skin-CVwmK130.js","assets/views-V3si1lOz.js","assets/motionBlur-uAm030t9.js","assets/library-CyjJ8nGG.js","assets/ShotComposer-VixLbeMe.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as l}from"./titleFrameBudget-BYRZAQPs.js";import{R as h}from"./api-DUp403BK.js";import{ds as w}from"./remote-Dva2qg58.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-75tQUvPT.js";import"./rotoMaskStore-BxyxB2bD.js";import"./textAnimators-nVSz_sZo.js";import"./timelineComp-BcewYGR2.js";import"./rigTrack-UYZU4P-e.js";let m=Promise.resolve();const p=o=>new Promise(r=>setTimeout(r,o));function R(o,r,{timeoutMs:d=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-DFfaYLoV.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,20,21,22]));let n=null;s.render(h.createElement(u,{nodeId:o,background:t=>{n=t}}));const c=Date.now()+d;for(;!n?.ready();){if(Date.now()>c)throw new Error("3D Shot did not start in time");await p(60)}for(;;)try{return await r(n)}catch(t){if(!/chưa tải xong/.test(t.message)||Date.now()>c)throw t;await p(500)}}finally{s.unmount(),e.remove()}},a=m.then(i,i);return m=a.catch(()=>{}),a}export{R as withBackgroundScene};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{gK as S}from"./remote-Dva2qg58.js";import{s as U}from"./motionBlur-uAm030t9.js";import{M as Y}from"./motionBlur-uAm030t9.js";import{bD as C,c as M}from"./id3-BCR9Bqgo.js";import{S as O,B as D,O as H,W as P,a as B,C as I}from"./output-BwZzMbp-.js";import"./api-DUp403BK.js";import"./titleFrameBudget-BYRZAQPs.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-75tQUvPT.js";import"./rotoMaskStore-BxyxB2bD.js";import"./textAnimators-nVSz_sZo.js";import"./timelineComp-BcewYGR2.js";import"./rigTrack-UYZU4P-e.js";async function G(s,T,h){const{start:d,end:k,fps:a,signal:w,progress:p}=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 g=new C({bitrate:h.height>=1080?6e6:3e6}),o=h.alpha===!0,f=o?"vp9":"avc",v=o?"webm":"mp4";if(!await M(f,{width:s.width,height:s.height,quality:g}))throw new Error(o?"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 m,c;const l=`camera-export-${crypto.randomUUID()}.${v}`;let t;const y=async()=>{m&&await m.removeEntry(l).catch(()=>{})};try{let i;if(navigator.storage?.getDirectory)m=await navigator.storage.getDirectory(),c=await m.getFileHandle(l,{create:!0}),i=new O(await c.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.");i=new D}t=new H({format:o?new P:new B({fastStart:"reserve"}),target:i});const u=new I(s,{codec:f,quality:g,...o?{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&&(p(Math.round((e+1)/n*95)),await new Promise(F=>setTimeout(F,0)))}w.throwIfAborted(),u.close(),await t.finalize();const x=c?await c.getFile():new Blob([i.buffer],{type:o?"video/webm":"video/mp4"});return p(100),{blob:x,cleanup:y}}catch(i){throw t&&t.state!=="finalized"&&t.state!=="canceled"&&await t.cancel().catch(()=>{}),await y(),i}}export{Y as MOTION_BLUR,G as encodeCameraVideo,U as shutterTimes};
|
|
@@ -1 +1 @@
|
|
|
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-BHWu1lKg.js";import{f as E}from"./skin-
|
|
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-BHWu1lKg.js";import{f as E}from"./skin-CVwmK130.js";import"./remote-Dva2qg58.js";import"./api-DUp403BK.js";import"./titleFrameBudget-BYRZAQPs.js";import"./store-75tQUvPT.js";import"./rotoMaskStore-BxyxB2bD.js";import"./textAnimators-nVSz_sZo.js";import"./timelineComp-BcewYGR2.js";import"./rigTrack-UYZU4P-e.js";const B=640;function U(y,c=B){const t=D(y);t.position.set(0,0,0),t.quaternion.identity(),t.scale.set(1,1,1);const p=[];t.traverse(e=>{e.userData.rigOverlay&&p.push(e),e instanceof k&&e.quaternion.identity()}),p.forEach(e=>e.parent?.remove(e)),t.traverse(e=>{e instanceof g&&e.skeleton.pose()});const d=E(t),n=d.getCenter(new a),f=d.getSize(new a),r=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(-r,r,r,-r,.01,100),w=e=>(s.position.copy(n).add(e),s.up.set(0,1,0),s.lookAt(n),s.updateProjectionMatrix(),i.render(o,s),i.domElement.toDataURL("image/jpeg",.88));try{const e=r*4,x=w(new a(0,0,e)),v=w(new a(e,0,0));return{front:x,side:v,frame:{cx:n.x,cy:n.y,cz:n.z,half:r}}}finally{m.dispose(),i.dispose(),i.forceContextLoss(),t.traverse(e=>{e instanceof g&&e.skeleton.dispose()})}}export{B as VIEW_SIZE,U as renderRigViews};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{iC as pt,iD as Y,fo as ut,fn as mt,fq as Z,fs as R,hH as kt,b as gt,ft as bt,fD as tt,fE as et,hD as Mt,fU as yt,hG as wt}from"./remote-Dva2qg58.js";import{F as vt}from"./rigTrack-UYZU4P-e.js";const P=t=>pt(t)??(Y(t)?{clip:Y(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},Ft=1.05,at=new Map,dt=t=>{let e=at.get(t);return e||(e=mt(P(t).clip),at.set(t,e)),e},Kt=(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 At=t=>P(t).clip.keys.filter(e=>e.strike).at(-1)?.limb??"handR",ot=(t,e)=>Kt(dt(t),e).dz??0;function $t(t){const{pack:e}=P(t),a=dt(t),h=ht(t),o=At(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 Dt(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 St(t,e=4,a=1){const h=Dt(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(D=>D!==l[f]),g=m[Math.floor(h()*m.length)],T=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[T]&&(y="miss");const $=`${j}-${y==="blocked"?it[T]:y==="miss"?"dodge-back":"hit"}`,z=ht(g),O=P($).clip.contact??0,b=Math.max(Ft,$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 q=[.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)}},S=(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||!Z(h)||!Z(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=St(e.packs,f,e.seed),r=[h,o],u=[nt(h),nt(o)],j=[],m=Math.max(0,e.start),g=v(t),T=m+.5+l.reduce((s,c)=>s+Math.max(R(c.attack).duration,c.strike-c.contact+R(c.defence).duration)+1.4+q[1],0);let i=T>g.duration?rt(t,Math.min(300,T)):t;const M=S(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=R(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,D=m;const C=[];let x=(e.seed*9301+49297)%233280;const lt=()=>(x=(x*9301+49297)%233280,x/233280);try{l.forEach((s,c)=>{const n=s.attacker,d=1-n,k=(u[0]+u[1])/2,p=()=>{const F=S(i,r[0],b).position,K=S(i,r[1],b).position;return Math.hypot(K[0]-F[0],K[2]-F[2])};for(let F=0;F<3;F++){const K=p()-s.gap*k;if(Math.abs(K)<.3*k)break;K>0?b=O(n,`${e.packs[n]}-advance`,b):b=O(d,`${e.packs[d]}-retreat`,b)}const N=Math.max(0,s.contact-s.strike),w=b+N,_=w+s.strike-s.contact,E=p()-s.gap*k,U=O(n,s.attack,w),ft=O(d,s.defence,_),G=r[n],B=S(i,G,w).yaw,W=[Math.sin(H(B)),Math.cos(H(B))],J=w+s.strike,V=Math.max(-.3,Math.min(.3,E));i=ct(i,G.id,(F,K)=>F.map(A=>{const I=A.time*K.duration;if(I<w-1e-6||I>U+1e-6)return A;const L=Math.min(1,(I-w)/Math.max(.001,s.strike)),Q=L*L*(3-2*L),X={...A,position:[+(A.position[0]+W[0]*V*Q).toFixed(3),A.position[1],+(A.position[2]+W[1]*V*Q).toFixed(3)]};return A.strike&&Math.abs(I-J)<.06?{...X,hit:s.result}:X})),C.push({...s,time:+J.toFixed(2),attackerName:G.name}),D=Math.max(U,ft),b=D+q[0]+(q[1]-q[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((D+.6)*10)/10)))),i=kt(i).stage,e.packs.includes("fist")){const s=v(i),c=[],n={};C.forEach((d,k)=>{if(d.result==="miss"||e.packs[d.attacker]!=="fist")return;const p=S(i,r[0],d.time).position,N=S(i,r[1],d.time).position,w=(u[0]+u[1])/2,_=`duelfx-${r[d.attacker].id}-${Math.round(d.time*1e3)}`,E=d.result==="body";c.push({...gt("fx",i.items.length+c.length),id:_,name:`Vòng xung kích ${c.length+1}`,position:[+((p[0]+N[0])/2).toFixed(2),0,+((p[2]+N[2])/2).toFixed(2)],color:E?"#ffd27a":"#9fdcff",fx:{preset:"vong_xung_kich",cat:"vong-xung-kich",intensity:E?.9:.75,seed:500+k,start:d.time,duration:.6,loop:!1,auto:"hit",params:{size:(E?1.05:.85)*w,height:+(1.35*w).toFixed(2),hits:1,gap:.3}}}),n[_]={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,C.filter(n=>n.result==="blocked").map(n=>n.time),et.light,s.duration),c=tt(c,C.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:C,end:+D.toFixed(2),notes:j}}export{st as D,Pt as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{mR as P,a7 as b,U as W,$ as y,Z as E,a0 as F,lG as x}from"./titleFrameBudget-BYRZAQPs.js";import"./rotoMatte-BdYa8FSB.js";import"./api-DUp403BK.js";import"./store-75tQUvPT.js";const R=e=>P(e).length>0,O=new Map;function D(e){const r=e.face??e.colorPerson??e.person??e.roto??e.mask;if(r?.mw&&r?.mh)return Promise.resolve(r.mh/r.mw);let o=O.get(e.url);return o||(o=new Promise(n=>{if(e.kind==="image"){const a=new Image;a.crossOrigin="anonymous",a.onload=()=>n(a.naturalHeight/Math.max(1,a.naturalWidth)),a.onerror=()=>n(9/16),a.src=e.url;return}const t=document.createElement("video");t.preload="metadata",t.muted=!0,t.crossOrigin="anonymous",t.onloadedmetadata=()=>{n(t.videoHeight/Math.max(1,t.videoWidth)),t.removeAttribute("src"),t.load()},t.onerror=()=>n(9/16),t.src=e.url}),O.set(e.url,o)),o}function I(e,r,o,n,t,a,g){const i=W(e.grade)[r],h=e.colorPerson?E(e.colorPerson):null,f=F(i,e,o,a,h),c=g??document.createElement("canvas");(c.width!==n||c.height!==t)&&Object.assign(c,{width:n,height:t});const l=c.getContext("2d"),d=l.createImageData(n,t);for(let w=0;w<t;w++)for(let u=0;u<n;u++){const m=(w*n+u)*4,s=Math.round(f((u+.5)/n,(w+.5)/t,0,0,0)*255);d.data[m]=d.data[m+1]=d.data[m+2]=s,d.data[m+3]=255}return l.putImageData(d,0,0),c}async function U(e,r,o,n){const t=document.createElement("canvas");for(const{key:a,k:g,clip:i}of P(e)){if(o.wants&&!o.wants("windowFrames",a))continue;i.colorPerson&&await b(i.colorPerson);const h=await D(i),f=x,c=Math.max(2,Math.min(x*2,Math.round(f*h))),l=W(i.grade)[g],d=Math.ceil(i.duration*r),w=!!l.motion;let u="",m="";for(let s=0;s<d;s++){if(n?.aborted)throw new DOMException("Export cancelled","AbortError");if(o.wants&&!o.wants("windowFrames",a,s)){await o.push("windowFrames",a,""),m="";continue}if(w){const p=JSON.stringify(y(l,i,s/r));if(s&&p===m){await o.push("windowFrames",a,"=");continue}m=p}I(i,g,s/r,f,c,h,t);const M=t.toDataURL("image/webp",.9),v=M.slice(M.indexOf(",")+1);if(v===u){await o.push("windowFrames",a,"=");continue}u=v,await o.push("windowFrames",a,v),s%5===0&&await new Promise(p=>setTimeout(p,0))}}}export{R as hasMovingWindows,D as pictureAspect,U as renderWindowFrames,I as windowMatteImage};
|
package/web/layer-worker.html
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="robots" content="noindex" />
|
|
6
6
|
<title>Timeline layer worker</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/layer-worker-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="/assets/titleFrameBudget-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="/assets/frameSink-
|
|
7
|
+
<script type="module" crossorigin src="/assets/layer-worker-DxPMMKIZ.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/assets/titleFrameBudget-BYRZAQPs.js">
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/frameSink-BvOXjLuw.js">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
</body>
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-BJdzzFZg.js","assets/api-QBI5GJTZ.js","assets/titleFrameBudget-Cml-MO53.js","assets/three.module-Bx43vjkH.js","assets/GLTFLoader-BHWu1lKg.js","assets/store-2zneEhhu.js","assets/rotoMaskStore-DIi45swK.js","assets/textAnimators-Bdt5LWXk.js","assets/timelineComp-B73i_8vD.js","assets/rigTrack-CUt4O67J.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as et}from"./titleFrameBudget-Cml-MO53.js";import{jj as q,iQ as B,fi as J,gE as k,dz as b,fk as Q,jk as at,iJ as ot,hy as V,fB as it,fv as nt,fw as G,fl as rt,hv as st,iO as ct}from"./remote-BJdzzFZg.js";import{c as mt}from"./cameraPresets-4pFeF2YG.js";import"./api-QBI5GJTZ.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-2zneEhhu.js";import"./rotoMaskStore-DIi45swK.js";import"./textAnimators-Bdt5LWXk.js";import"./timelineComp-B73i_8vD.js";import"./rigTrack-CUt4O67J.js";const F=()=>crypto.randomUUID(),u=o=>Math.round(o*100)/100,lt=o=>st(o)*(o.scale[1]||1);function W(o,c){const a=k(o),y=a.duration/c,e=l=>l?.map(i=>({...i,time:Math.min(1,i.time*y)})),s={...a,duration:c,cameraKeys:e(a.cameraKeys)??[],objectKeys:Object.fromEntries(Object.entries(a.objectKeys||{}).map(([l,i])=>[l,e(i)||[]])),...a.flight?{flight:Object.fromEntries(Object.entries(a.flight).map(([l,i])=>[l,e(i)||[]]))}:{}};return{...o,shots:o.shots.map(l=>l.id===a.id?s:l)}}function C(o,c,a,y,e){const s=k(o),l=s.duration,i=(s.objectKeys?.[c.id]||[]).filter(p=>p.time*l<a-1e-6);return{...o,shots:o.shots.map(p=>p.id===s.id?{...p,objectKeys:{...p.objectKeys,[c.id]:[...i,{id:F(),time:a/l,position:y.map(_=>+_.toFixed(3)),rotation:[0,+e.toFixed(1),0],scale:c.scale}]}}:p)}}const X=(o,c)=>Math.atan2(c[0]-o[0],c[2]-o[2])*180/Math.PI;async function St(o,c){const a=q.find(t=>t.id===String(o.move??""));if(!a)return{ok:!1,error:`unknown move; use one of ${q.map(t=>t.id).join(", ")}`};const y=c.getStage();let e,s;try{e=B(y,String(o.name??""))}catch(t){return{ok:!1,error:t.message}}if(!J(e))return{ok:!1,error:`'${e.name}' is not a person`};const l=k(y),i=Math.max(0,Number(o.time??0)||0);if(o.target!=null)try{s=B(y,String(o.target))}catch(t){return{ok:!1,error:t.message}}else{const t=b(e,l,Math.min(1,i/l.duration)).position,m=y.items.filter(n=>n.id!==e.id&&J(n)&&!n.hidden).map(n=>{const r=b(n,l,Math.min(1,i/l.duration)).position;return{i:n,d:Math.hypot(r[0]-t[0],r[2]-t[2])}}).sort((n,r)=>n.d-r.d)[0];if(!m)return{ok:!1,error:"no target: put another person in the scene or give target"};s=m.i}const p=Q(a.id),_=at(a.id);if(!p||!_)return{ok:!1,error:`the clip ${a.id} is missing`};const M=[];let h=y;i+p.duration+1.6>l.duration&&(h=W(h,Math.min(300,Math.ceil((i+p.duration+1.8)*10)/10)));let S=k(h),w=S.duration;const j=i+_.at,$=j+(a.ranged?a.travel??.6:0),g=b(e,{...S,flight:void 0},Math.min(1,i/w)).position,v=b(s,{...S,flight:void 0},Math.min(1,$/w)).position,H=X(g,v);let x=g;if(!a.ranged){const t=(_.dz+(a.reach??.8))*lt(e),m=Math.hypot(v[0]-g[0],v[2]-g[2])||1,n=(g[0]-v[0])/m,r=(g[2]-v[2])/m;x=[v[0]+n*t,g[1],v[2]+r*t];const f=Math.hypot(x[0]-g[0],x[2]-g[2]);if(f>.3&&i>.25){const d=Math.min(.8,Math.max(.2,f/6),i);h=C(h,e,i-d,g,H),M.push(`${e.name} closes ${u(f)} m in ${u(d)} s before the strike${f>3?" (for a longer approach play ac-superman-glide / ac-burst-dash before)":""}`)}}h=C(h,e,i,x,H);const R=(t,m,n)=>{const r=k(n),f=r.flight?.[t.id];return!!f?.length&&ct(f,Math.min(1,m/r.duration),r.duration).air>.5};a.land&&R(e,i,h)&&(S=k(h),w=S.duration,h={...h,shots:h.shots.map(t=>t.id===S.id?{...t,flight:{...t.flight,[e.id]:ot(t.flight?.[e.id],{time:j/w,on:!1})}}:t)},M.push(`${e.name} lands on the strike (flight off at ${u(j)} s)`));const K=V(h,e.id,p,{start:i/k(h).duration,newId:F,loop:!1});if(!K.ok)return{ok:!1,error:K.error};c.setStage(()=>K.stage);const{runTool:Y}=await et(async()=>{const{runTool:t}=await import("./remote-BJdzzFZg.js").then(m=>m.js);return{runTool:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),L=[];for(const t of a.fx){const m=t.at==="strike"?j:i,n={effect:t.fx,start:u(m),duration:t.duration,...t.params?{params:t.params}:{},...o.color?{color:o.color}:{}},r=it(t.fx)?.attach==="path",f=t.place==="self"?{...n,attach_to:e.name}:t.place==="target"?{...n,at:`${s.name}.chest`}:t.place==="trail"?{...n,from:`${e.name}.chest`,to:`${s.name}.chest`}:t.place==="path"?{...n,from:`${e.name}.hand_right`,to:`${s.name}.chest`}:r?{...n,from:`${e.name}.feet`,to:`${s.name}.feet`}:{...n,at:`${s.name}.feet`},d=await Y("add_effect",f,c);d.ok?L.push({effect:t.fx,start_s:u(m)}):M.push(`${t.fx}: ${String(d.error)}`)}const O=String(o.react??"hit");let T=null;if(O!=="none"){const t=R(s,$,c.getStage()),[m,n]=O==="block"?t?["ac-air-block",.16]:["xx-palm-shield",.22]:O==="evade"?t?a.heavy?["ac-backflip-evade",.3]:["ac-corkscrew-dodge",.2]:["xx-teleport",.26]:t?[a.heavy?"ac-air-knocked-spin":"ac-air-recoil",0]:[(a.heavy,"xx-knocked-flying"),0],r=Math.max(0,$-n),f=Q(m);if(f){let d=c.getStage();const A=k(d),D=A.duration,N=b(s,{...A,flight:void 0},Math.min(1,r/D)).position,Z=b(e,A,Math.min(1,r/D)).position;d=C(d,s,r,N,X(N,Z)),r+f.duration+.3>D&&(d=W(d,Math.min(300,Math.ceil((r+f.duration+.4)*10)/10)));const P=V(d,s.id,f,{start:r/k(d).duration,newId:F,loop:!1});if(P.ok){if(c.setStage(()=>P.stage),T={motion:m,at_s:u(r)},O==="hit"&&o.timing!==!1){const I=k(c.getStage()),tt=nt(rt(I.timing,I.duration),[$],a.heavy?G.heavy:G.medium,I.duration);c.setStage(U=>({...U,shots:U.shots.map(z=>z.id===I.id?{...z,timing:tt??void 0}:z)}))}}else M.push(`${s.name} ${m}: ${P.error}`)}}const E=[];if(o.camera===!0){const t=[["wide-track",e,i,$+.2]];a.heavy&&t.push(["low-hero",s,$+.2,$+1.4]);for(const[m,n,r,f]of t){const d=mt(c.getStage(),{preset:m,subject:n.id,start:r,end:f});d.ok&&(c.setStage(()=>d.stage),E.push(`${m} ${u(r)}–${u(f)} s`))}}return{ok:!0,move:a.id,attacker:e.name,target:s.name,start_s:u(i),strike_s:u(j),impact_s:u($),end_s:u(i+p.duration),effects:L,...T?{reaction:T}:{},...E.length?{camera:E}:{},...M.length?{notes:M}:{}}}export{St as aerialStrike};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{trackPose as S}from"./poseTracker-PuI8vWpR.js";import{i1 as v,i2 as w,i3 as T}from"./remote-BJdzzFZg.js";import{b$ as q,b_ as x}from"./titleFrameBudget-Cml-MO53.js";import{u as z}from"./store-2zneEhhu.js";import{t as l}from"./api-QBI5GJTZ.js";import"./main-CVRIuDW2.js";import"./three.module-Bx43vjkH.js";import"./spark.module-DdwuJ_hb.js";import"./timelineComp-B73i_8vD.js";import"./rotoMaskStore-DIi45swK.js";import"./textAnimators-Bdt5LWXk.js";import"./userFonts-BHduCNtc.js";import"./lottieLayer-CDCGeJyv.js";import"./rigTrack-CUt4O67J.js";import"./timeline3d-YIIk_Kn2.js";import"./GLTFLoader-BHWu1lKg.js";import"./RoomEnvironment-Dmv_G5ka.js";import"./exportEncode-D9OT7_5k.js";import"./captionLayout-C67EMVI1.js";import"./timelineText-BcL4Pw3C.js";import"./titleArt-hb_T45WJ.js";import"./rotoMatte-013RKqHu.js";import"./distortGL-BaXfN0IK.js";import"./motionBlur-uAm030t9.js";async function Z(p,f){const m=f.params??{},s=z.getState(),r=s.clips.find(t=>t.id===m.source);if(!r||r.kind!=="video")throw Error(l("Không tìm thấy clip video để bám dáng người"));const g=document.querySelector(`video[data-clip-media="${r.id}"]`)?.currentSrc||r.url,a=m.from??0,y=m.duration??p.duration,{frames:c,aspect:b}=await S({clip:r,url:g,from:a,duration:y,fps:v.fps,person:m.person??1});if(!c.some(t=>t.lm))throw Error(l("Không thấy người trong đoạn này để gắn aura"));const{width:u,height:d}=q(s.timelineFormat),k=Math.round(b*1e3),A=1e3,M=w(c.map(t=>({t:t.t,lm:t.lm})),([t,e])=>[t,e]).map(t=>{const e=a+t[0],n=[t[0]];for(let i=1;i<t.length;i+=2){if(t[i]<0){n.push(-1,-1);continue}const h=x(r,t[i],t[i+1],e,u,d,k,A);n.push(Math.round(h.px/u*1e3)/1e3,Math.round(h.py/d*1e3)/1e3)}return n}),o=p.motion?.params??{};return{motion:T(M,{look:o.look,color:o.color,hot:o.hot,size:o.size,intensity:o.intensity,wind:[Number(o.windX)||0,Number(o.windY)||0],speed:o.speed,stretch:o.stretch,taper:o.taper})}}export{Z as runAuraTrack};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-BJdzzFZg.js","assets/api-QBI5GJTZ.js","assets/titleFrameBudget-Cml-MO53.js","assets/three.module-Bx43vjkH.js","assets/GLTFLoader-BHWu1lKg.js","assets/store-2zneEhhu.js","assets/rotoMaskStore-DIi45swK.js","assets/textAnimators-Bdt5LWXk.js","assets/timelineComp-B73i_8vD.js","assets/rigTrack-CUt4O67J.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as R}from"./titleFrameBudget-Cml-MO53.js";import{iQ as q,fi as B,gE as S,jl as U,iJ as N,fx as z,fl as F,fk as G,hy as H}from"./remote-BJdzzFZg.js";import{c as J}from"./cameraPresets-4pFeF2YG.js";import"./api-QBI5GJTZ.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-2zneEhhu.js";import"./rotoMaskStore-DIi45swK.js";import"./textAnimators-Bdt5LWXk.js";import"./timelineComp-B73i_8vD.js";import"./rigTrack-CUt4O67J.js";const Q=()=>crypto.randomUUID(),s=i=>Math.round(i*100)/100,P={"luyen-khi":{color:"#e6f2ff",tiers:9,core:!1,name:"Luyện khí"},"truc-co":{color:"#5cff9a",tiers:3,core:!1,name:"Trúc cơ"},"ket-dan":{color:"#ffcf4a",tiers:9,core:!0,name:"Kết đan"},"nguyen-anh":{color:"#b066ff",tiers:12,core:!0,name:"Nguyên anh"},"hoa-than":{color:"#5cc8ff",tiers:12,core:!0,name:"Hoá thần"}};function V(i,c){const e=S(i),$=e.duration/c,u=n=>n?.map(f=>({...f,time:Math.min(1,f.time*$)})),m={...e,duration:c,cameraKeys:u(e.cameraKeys)??[],objectKeys:Object.fromEntries(Object.entries(e.objectKeys||{}).map(([n,f])=>[n,u(f)||[]])),...e.flight?{flight:Object.fromEntries(Object.entries(e.flight).map(([n,f])=>[n,u(f)||[]]))}:{}};return{...i,shots:i.shots.map(n=>n.id===e.id?m:n)}}async function nt(i,c){let e;try{e=q(c.getStage(),String(i.name??""))}catch(t){return{ok:!1,error:t.message}}if(!B(e))return{ok:!1,error:`'${e.name}' is not a person`};const $=String(i.realm??"ket-dan"),u=P[$];if(!u)return{ok:!1,error:`unknown realm; use one of ${Object.keys(P).join(", ")}`};const m=i.outcome==="fail",n=i.tribulation!==!1,f=Math.max(1,Math.min(9,Number(i.strikes??4)||4)),v=Math.max(.8,Math.min(12,Number(i.height??2)||2)),y=Math.max(0,Number(i.start??0)||0),A=String(i.color??u.color),j=y+2.6,g=j+3.2,E=g+1.2,M=n?1.6+f*1.05:0,C=g+2.4+M,h=C,p=h+1.6,_=p+2.2,w=m?h+2.6:_+2.6;let l=c.getStage();w+.5>S(l).duration&&(l=V(l,Math.min(300,Math.ceil((w+.6)*10)/10)));const x=[],O=[],k=(t,r,o=!1)=>{const a=G(t);if(!a){x.push(`${t} missing`);return}const d=H(l,e.id,a,{start:r/S(l).duration,newId:Q,loop:o});d.ok?(l=d.stage,O.push({motion:t,at_s:s(r)})):x.push(`${t}: ${d.error}`)};k("xx-seal-seated",y),k("xx-bt-gather",j,!0),k("xx-bt-strain",g,!0);const T=E,D=n?U(M+1.2,f).map(t=>T+t):[];for(const t of D)k("xx-bt-endure",Math.max(g,t-.12));if(m)k("xx-bt-backlash",h);else{const t=S(l),r=t.duration;let o=N(t.flight?.[e.id],{time:h/r,on:!0,height:v});o=N(o,{time:(_+1.4)/r,on:!1}),l={...l,shots:l.shots.map(a=>a.id===t.id?{...a,flight:{...a.flight,[e.id]:o}}:a)},k("xx-bt-lotus-air",h,!0),k("xx-bt-roar",p),k("xx-bt-settle",_)}c.setStage(()=>l);const{runTool:L}=await R(async()=>{const{runTool:t}=await import("./remote-BJdzzFZg.js").then(r=>r.js);return{runTool:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),I=[],b=async(t,r,o,a={})=>{const d=await L("add_effect",{effect:t,attach_to:e.name,start:s(r),duration:o,color:A,...a},c);d.ok?I.push({effect:t,start_s:s(r)}):x.push(`${t}: ${String(d.error)}`)};if(await b("linh-khi-quy-nguyen",y+.6,g-y+1),await b("kinh-mach-kim",j+.8,4),await b("canh-gioi-ket-dan",g-.4,2.4+M+.8,{params:{tiers:u.tiers}}),n&&await b(m?"kiep-van-huyet":"kiep-van-thien-loi",T,M+1.2,{params:{strikes:f},color:m?"#ff3040":"#9fd8ff"}),m)await b("huyet-vu",h+.5,1.6);else if(u.core&&await b("kim-dan-thanh",h+.2,1.8,{params:{seated:1,lift:v}}),await b("thien-quang-tru-kim",p+.62,3.2),await b("dot-pha-song-kim",p+.62,2.4,{params:{seated:1,lift:v}}),i.timing!==!1){const t=S(c.getStage()),r=z(F(t.timing,t.duration),p+.7,.45,.35,t.duration);c.setStage(o=>({...o,shots:o.shots.map(a=>a.id===t.id?{...a,timing:r??void 0}:a)}))}const K=[];if(i.camera!==!1){const t=[["orbit-180",y,g],["wide-track",g,E+.4],["low-hero",E+.4,m?w:p],...m?[]:[["wide-track",p,p+2.2],["orbit-180",_,w]]];for(const[r,o,a]of t){if(a-o<.4)continue;const d=J(c.getStage(),{preset:r,subject:e.id,start:o,end:a});d.ok&&(c.setStage(()=>d.stage),K.push(`${r} ${s(o)}–${s(a)} s`))}}return{ok:!0,name:e.name,realm:u.name,outcome:m?"fail":"success",start_s:s(y),gather_s:s(j),tribulation_s:n?s(T):null,strikes_s:D.map(s),...m?{backlash_s:s(h)}:{rise_s:s(h),burst_s:s(p+.62),landed_s:s(_+1.4)},end_s:s(w),moves:O,effects:I,...K.length?{camera:K}:{},...x.length?{notes:x}:{}}}export{P as REALMS,nt as stageBreakthrough};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b$ as p,f7 as b,f8 as y,lf as k,eO as x,cK as w,e_ as E,ii as O,lg as S,fD as _,eG as A,eH as D,eK as v,ea as h,ec as g,lh as B,U as T,W as $,li as I,hR as R,bJ as L}from"./titleFrameBudget-Cml-MO53.js";import{e as P,a as j}from"./timelineComp-B73i_8vD.js";const z=new Set(["opacity","x","y","zoom","blur","exposure","dirBlur","zoomBlur","rgbSplit","invert","glitch","rot","spinBlur","dirBlurV"]),F=e=>!(e?.dirBlur&&(e.zoom||e.blur||e.zoomBlur))&&!(e?.zoomBlur&&(e.x||e.y||e.blur||e.dirBlur)),K=new Set(["id","name","category","duration","tags","version","sortOrder","a","b","flash","light","mask","zoomAt"]),M=["colorPerson","matte","shocks","impacts","smoothSlow","reverse","revealType","rotFit","is3D","space","bend","bendStrip","device","deviceScreen","join","audioFx","audioTools","muffle","trail","path","links","element","modelGround","modelRotation","modelSpin","modelAnim","modelDepth","spatialDepth","pendingPin","personPending","samPending","gen","clientJobs","mapAnno","seam","warped"],X={rx:0,ry:0,rz:0,ax:0,ay:0,depth:0,tiltX:0,tiltY:0},H=new Set(["rot","sx","sy","depth","tiltX","tiltY"]),J=new Set(["is3D","spatialDepth"]),N=new Set(["blur","glow","light-burst","rgb-split","pixelate","sepia","invert","mono","duotone","luma-invert",...Object.keys(L)]),c=e=>e!=null&&e!==!1&&!(Array.isArray(e)&&!e.length);function C(e,{camera:s=null,W:r=1280,H:f=720}={}){const o=[];if(w(e))return[];if(e.kind==="model")return[];if(!["image","video","audio"].includes(e.kind))return[`${e.kind} layer`];const a=e.kind!=="audio"&&b(s)&&y(e),d=!a&&e.is3D===!0&&!c(e.spatialDepth);for(const t of M){if(t==="clientJobs"){Array.isArray(e.clientJobs)&&e.clientJobs.some(n=>n?.state==="pending"||n?.state==="running")&&o.push(t);continue}c(e[t])&&!(a&&J.has(t))&&!(d&&t==="is3D")&&o.push(t)}if(e.pin?.scene&&o.push("scene pin"),e.timeRemap?.blend&&e.timeRemap.blend!=="none"&&o.push("time remap frame blending"),e.kind!=="audio"&&E(e,r||1280).some(t=>t.sigma>42)&&o.push("wide shadow"),O(e)&&S(e)&&o.push("shadow on an adjustment layer"),e.motionBlur&&e.kind!=="audio"&&((e.effects||[]).some(t=>!t.off)||e.pin||e.parentId||_(e)||e.layout!==void 0||e.rotFit||a)&&o.push("motion blur"),e.kind!=="audio"&&A(e)){const t=D(e),n=v(t);t.cover<.999||t.comet||t.crackle?o.push("edge arc"):Math.max(n.band,n.glow)>42&&o.push("wide edge")}!a&&e.kind!=="audio"&&(h(e,"rot").length>1||Math.abs(g(e,"rot",0))>1e-9)&&((e.effects||[]).some(t=>!t.off)||e.layout!==void 0||e.rotFit)&&o.push("rot"),a&&(e.transition||e._txIn||e._txOut)&&o.push("transition on a 3D layer");for(const[t,n]of Object.entries(X))!(a&&H.has(t))&&(h(e,t).length>1||Math.abs(g(e,t,0)-n)>1e-9)&&o.push(t);e.grade&&!e.colorBypass&&(e.grade.lut||B(e.grade).length)&&o.push("grade"),e.grade&&!e.colorBypass&&T(e.grade).some(t=>$(t)&&(t.window?.type==="person"||t.qualifier&&(t.window?.type==="polygon"||t.motion||t.window?.type==="face")))&&o.push("grade window");for(const t of Array.isArray(e.effects)?e.effects:[])!t.off&&!N.has(t.type)&&o.push(`effect ${t.type}`);if(I(e,"T")&&o.push("reveal"),e.transition){const t=e.transition.spec||{},n=i=>!!e.transition.ramp||F(i);(Object.keys(t).some(i=>!K.has(i))||["a","b"].some(i=>t[i]&&(Object.keys(t[i]).some(l=>!z.has(l))||!n(t[i]))))&&o.push(`transition ${e.transition.id}`)}return e.kind==="video"&&R(e)&&o.push("title on video"),o}function V(e,s={}){const{reasons:r}=u(e,s);return{ok:r.length===0,reasons:r}}function W(e,s={}){return[...new Set(u(e,s).codes)].sort()}function u(e,{format:s,camera:r,look:f}={}){const o=[],a=[];e=P((e||[]).filter(n=>!n.disabled),{W:p(s).width,H:p(s).height});const d=b(r)?r:null,{width:m,height:t}=p(s);d&&(e||[]).some(n=>!n.disabled&&n.kind!=="audio"&&y(n))&&d.parentId&&(o.push("camera on a parent"),a.push("camera on a parent")),k(f)&&(o.push("look"),a.push("look"));for(const n of e||[]){if(n.disabled)continue;if(n._group&&n.comp){const l=u(j(n),{format:s});l.reasons.length&&(o.push(`${n.label||n.id} (comp): ${l.reasons.join("; ")}`),a.push(...l.codes))}const i=C(n,{camera:d,W:m,H:t});i.length&&(o.push(`${n.label||n.id}: ${i.join(", ")}`),a.push(...i))}if(!o.length)for(const n of x((e||[]).filter(i=>!i.disabled))){const i=l=>{o.push(`${n.label||n.id}: ${l}`),a.push(l)};n.speedRamp&&(n._txIn||n._txOut)&&i("speed ramp in a transition"),n.timeRemap&&(n._txIn||n._txOut)&&!n._ramp&&i("time remap in a transition"),n.motionBlur&&(n._txIn||n._txOut)&&i("motion blur in a transition")}return{reasons:o,codes:a}}const Y=(e,s,r)=>(s==="video encode"||s==="finalize")&&r?.codec!=="hevc"&&e?.name!=="AbortError"&&/^(OperationError|EncodingError)$/.test(e?.name||""),q=e=>!(typeof DOMException<"u"&&e instanceof DOMException)&&!(e instanceof TypeError)&&!(e instanceof Error&&/^media \d{3}$/.test(e.message))?"":(e.message||"").replace(/\b(?:https?|blob|data):\S*/gi,"").replace(/\s+/g," ").trim();export{M as HEAVY_FIELDS,V as clientExportCheck,W as clientExportCodes,C as clipBlockers,q as gpuErrorText,Y as softwareRetry};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bS as $,bT as C}from"./api-QBI5GJTZ.js";import{lF as T,lG as q,hG as O,hH as _,lH as G,ai as D,lv as N}from"./titleFrameBudget-Cml-MO53.js";const A=Object.freeze({fisheye:.45,dispersion:.018,burst:.5,streak:.32,taps:8}),H=t=>[1+2.2*t,.88+1.8*t,.55+.9*t].map(n=>+n.toFixed(4));function v(t,n,o){const e=Math.max(t,Math.trunc(t*o/2)*2),r=Math.max(n,Math.trunc(n*o/2)*2);return{sw:e,sh:r,ox:Math.trunc((e-t)/2),oy:Math.trunc((r-n)/2)}}const W=(t,n)=>({w:Math.max(2,Math.trunc(t/4)*2),h:Math.max(2,Math.trunc(n/4)*2)}),j=(t,n=A.taps)=>Array.from({length:n},(o,e)=>1+t*e/(n-1));function K(t){const n=+(A.fisheye*t).toFixed(4);let o=1+n;for(let e=0;e<20;e++)o-=(o*o*o-o*o-n)/(3*o*o-2*o);return{K:n,m:+o.toFixed(4)}}function b(t,n,o,e,r,a){const d=Math.max(0,Math.min(n-1.001,e)),l=Math.max(0,Math.min(o-1.001,r)),f=d|0,m=l|0,i=d-f,u=l-m,h=(m*n+f)*4+a,c=h+4,s=h+n*4,x=s+4;return(t[h]*(1-i)+t[c]*i)*(1-u)+(t[s]*(1-i)+t[x]*i)*u}const z=(t,n,o,e,r)=>[(e+t.ox+.5)*n/t.sw-.5,(r+t.oy+.5)*o/t.sh-.5];function X(t,n,o,e){const r=j(e).map(l=>v(n,o,l)),a=new Uint8ClampedArray(t.length),d=r.length;for(let l=0;l<o;l++)for(let f=0;f<n;f++){const m=(l*n+f)*4,i=[0,0,0,0];for(const u of r){const[h,c]=z(u,n,o,f,l);for(let s=0;s<4;s++)i[s]+=b(t,n,o,h,c,s)}for(let u=0;u<4;u++)a[m+u]=Math.round(i[u]/d)}return a}function tt(t,n,o,e,r){if(!(n>.001))return!1;const a=new Uint8ClampedArray(o);if(t==="fisheye"){const{K:d,m:l}=K(n),f=v(e,r,l),m=e/2,i=r/2,u=4/(e*e+r*r),h=new Uint8ClampedArray(a.length);for(let c=0;c<r;c++)for(let s=0;s<e;s++){const x=s-m,M=c-i,L=1+d*(x*x+M*M)*u,y=(c*e+s)*4,E=m+x*L+.5,F=i+M*L+.5;if(E>=0&&F>=0&&E<=e-1&&F<=r-1)for(let g=0;g<4;g++)h[y+g]=b(a,e,r,E,F,g)}for(let c=0;c<r;c++)for(let s=0;s<e;s++){const[x,M]=z(f,e,r,s,c),L=(c*e+s)*4;for(let y=0;y<4;y++)o[L+y]=b(h,e,r,x,M,y)}return!0}if(t==="dispersion"){const d=A.dispersion*n,l=v(e,r,1+2*d),f=v(e,r,1+d);for(let m=0;m<r;m++)for(let i=0;i<e;i++){const u=(m*e+i)*4,[h,c]=z(l,e,r,i,m),[s,x]=z(f,e,r,i,m);o[u]=b(a,e,r,h,c,0),o[u+1]=b(a,e,r,s,x,1)}return!0}return t==="zoom-streak"?(o.set(X(a,e,r,A.streak*n)),!0):!1}const w=new Map,k=new Map,P=new Map,S=new Set;async function et(t){if(t.size>4e7)throw Error("File LUT tối đa 40 MB");const n=O(_(await t.text())),o=(n.title||t.name.replace(/\.cube$/i,"")).slice(0,80),e=await C({name:o,...G(n)});return w.set(e.id,n),S.forEach(r=>r()),e}function Y(t){if(w.has(t))return Promise.resolve(w.get(t));let n=k.get(t);return n||(n=$(t).then(o=>{const e=T(o);return w.set(t,e),S.forEach(r=>r()),e}).finally(()=>k.delete(t)),k.set(t,n)),n}function I(t){const n=w.get(t.id);if(!n)return Y(t.id).catch(()=>{}),null;const o=`${t.id}:${t.mix??1}`;let e=P.get(o);return e||(e=q(n,t.mix??1),P.set(o,e)),e}const p=new Map;function nt(t){if(!t)return null;const n=t.lut?I(t.lut):null;if(t.lut&&!n)return null;if(!D(t.mixer))return n;const o=`${t.lut?`${t.lut.id}:${t.lut.mix??1}`:"-"}|${JSON.stringify(t.mixer)}`;let e=p.get(o);return e||(e=N(t.mixer,n),p.set(o,e),p.size>24&&p.delete(p.keys().next().value)),e}const U=Object.freeze({codec:"h264",quality:"recommended",container:"mp4"}),B={h264:{low:4,recommended:8,high:16},hevc:{low:2.5,recommended:5,high:10}};function J(t,{width:n,height:o,fps:e}){const r=t??U,a=n*o/(1920*1080)*(e/30);return Math.round(B[r.codec][r.quality]*1e6*Math.max(.2,a))}const ot=(t,n,o)=>Math.round((J(t,n)+16e4)*Math.max(0,o)/8),Q={low:.5,recommended:1,high:2};function rt(t,{width:n,height:o,fps:e},r){const a=t??U;return Math.round(Math.min(4e7,Math.max(5e5,r(n,o,e)*Q[a.quality]*(a.codec==="hevc"?B.hevc.recommended/B.h264.recommended:1))))}export{U as D,A as L,tt as a,H as b,W as c,v as d,ot as e,rt as f,nt as g,Y as h,et as i,I as l,j as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{fy as Q,gE as V,iW as tt,iX as T,iY as et,iZ as U,i_ as H,i$ as ot,j0 as st,j1 as it,dy as nt,is as at,hv as rt,j2 as ct,j3 as mt}from"./remote-BJdzzFZg.js";import{N as L}from"./rigTrack-CUt4O67J.js";import"./api-QBI5GJTZ.js";import"./titleFrameBudget-Cml-MO53.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-2zneEhhu.js";import"./rotoMaskStore-DIi45swK.js";import"./textAnimators-Bdt5LWXk.js";import"./timelineComp-B73i_8vD.js";const ft=()=>crypto.randomUUID(),N=C=>Math.round(C*1e3)/1e3;function At(C,l){const F=Q(C,{fighters:l.fighters,start:l.start,end:l.end,focal_length_mm:l.focal_length_mm}),u=F.stage,k=V(u),c=k.duration,[h,g]=l.fighters.map(t=>u.items.find(e=>e.name===t)),{start:M,end:j}=F.result,b=tt(l.beats,M,j),R=t=>{const e=nt(k,Math.max(0,Math.min(1,t/c)));return{position:[...e.position],target:[...e.target],lens:e.lens}},x=(t,e)=>{const m=at(u,t,e);return{key:{pose:m.pose,position:m.position,yaw:m.rotation[1]},scale:rt(m)}},W=(t,e)=>{const m=t.attacker===h.name?h:g,w=m===h?g:h,f=x(m,e),s=x(w,e),A=t.limb&&/^(hand|foot)[LR]$/.test(t.limb)?t.limb:"handR",i=ct(f.key,A,f.scale),n=mt(s.key,s.scale),p=n.head.a.map((P,G)=>P+(n.head.b[G]-P)*.75),a=s.key.position[0]-f.key.position[0],r=s.key.position[2]-f.key.position[2],o=Math.hypot(a,r)||1,d=[a/o,0,r/o],y=[d[2],0,-d[0]],_=R(e).position,E=(f.key.position[0]+s.key.position[0])/2,Z=(f.key.position[2]+s.key.position[2])/2,O=(_[0]-E)*y[0]+(_[2]-Z)*y[2]>=0?1:-1,q=[Math.sin(s.key.yaw*Math.PI/180),0,Math.cos(s.key.yaw*Math.PI/180)];return{contact:i,foot:A.startsWith("foot"),atk:f.key.position,def:s.key.position,defHead:p,defFace:q,axis:d,side:[y[0]*O,0,y[2]*O],sep:o}},I=(t,e)=>({id:ft(),time:t/c,position:e.position.map(N),target:e.target.map(N),lens:Math.round(e.lens*100)/100,roll:0}),K=t=>t.time*c>=M-1e-6&&t.time*c<=j+1e-6,X=(k.cameraKeys||[]).filter(K),$=(k.cameraKeys||[]).filter(t=>!K(t)),v=[];for(const t of b){const e=t.to-.001;if(t.kind==="wide"||!t.beat){v.push(I(t.from,R(t.from)),...X.filter(i=>i.time*c>t.from+1e-6&&i.time*c<e-1e-6),I(e,R(e)));continue}const m=t.kind==="insert"?t.beat.time:Math.min(e,t.beat.time+(t.kind==="reaction"?.15:.6)),w=[];for(let i=t.from;i<=e+1e-6;i+=1/30)for(const n of[h,g]){const p=x(n,i),a=L(p.key.pose,p.key.position,p.key.yaw,p.scale);w.push(...Object.values(a))}const f=W(t.beat,m);let s=T(t.kind,f);if(t.kind==="insert"){const i=[];for(const p of[-2/30,0,2/30])for(const a of[h,g]){const r=x(a,m+p),o=L(r.key.pose,r.key.position,r.key.yaw,r.scale);i.push(...Object.values(o));for(const[d,y]of[["headA","headB"],["torsoA","torsoB"]])o[d]&&o[y]&&i.push(o[d].map((_,E)=>(_+o[y][E])/2))}let n=null;for(const p of et){const a=U(T("insert",f,{...H,insertAxis:p}),w),r=a.near??1/0,o=r>=H.clearance-1e-6,d=ot(a.position,a.target,i);(!n||o&&!n.ok||o===n.ok&&(o?d<n.n:r>n.near))&&(n={ok:o,n:d,near:r,cam:a})}s=n.cam}const A=t.kind==="insert"?s:U(s,w);v.push(I(t.from,A),I(e,A))}const S=[...$,...v].sort((t,e)=>t.time-e.time),z=S[0],D=S[S.length-1],J=b.map(t=>({from:t.from/c,to:t.to/c,kind:t.kind,frames:t.kind==="insert"&&t.beat?[t.beat.attacker]:t.kind==="reaction"&&t.beat?[t.beat.target]:[h.name,g.name]})),Y=(k.cuts||[]).filter(t=>t.to*c<=M+1e-6||t.from*c>=j-1e-6),B={...k,cameraKeys:S,position:z.position,target:z.target,lens:z.lens,endPosition:D.position,endTarget:D.target,endLens:D.lens,cuts:[...Y,...J].sort((t,e)=>t.from-e.from)};return{stage:{...u,items:it(u.items,B),shots:u.shots.map(t=>t.id===k.id?B:t)},result:{ok:!0,fighters:[h.name,g.name],start:M,end:j,cuts:b.length-1,shots:b.map(t=>({kind:t.kind,from:+t.from.toFixed(2),to:+t.to.toFixed(2)})),stats:st(b,l.beats),method:"the two-shot cut on the beats: a close-up on the striking limb from 0.08 s before each impact, a reaction over the striker's shoulder after it, the wide between, the finisher held low and still (shared/fightDirector.js, measured on a reference fight)"}}}export{At as fightDirector};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editTools-m0VGPmfF.js","assets/remote-BJdzzFZg.js","assets/api-QBI5GJTZ.js","assets/titleFrameBudget-Cml-MO53.js","assets/three.module-Bx43vjkH.js","assets/GLTFLoader-BHWu1lKg.js","assets/store-2zneEhhu.js","assets/rotoMaskStore-DIi45swK.js","assets/textAnimators-Bdt5LWXk.js","assets/timelineComp-B73i_8vD.js","assets/rigTrack-CUt4O67J.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as H}from"./titleFrameBudget-Cml-MO53.js";import{gE as A,iJ as V,iK as at,hw as L,iL as it,iM as ot,hz as rt,fl as st,fv as B,fw as U,fx as J,fy as ht,dz as ct,iN as Y,hv as dt,iO as lt,iP as mt}from"./remote-BJdzzFZg.js";import{c as ut}from"./cameraPresets-4pFeF2YG.js";import"./api-QBI5GJTZ.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-2zneEhhu.js";import"./rotoMaskStore-DIi45swK.js";import"./textAnimators-Bdt5LWXk.js";import"./timelineComp-B73i_8vD.js";import"./rigTrack-CUt4O67J.js";const q=()=>crypto.randomUUID(),M=o=>Math.round(o*100)/100,ft=o=>(o.kind==="model"?(o.model?.height??2)/1.8:dt(o))*(o.scale[1]||1),Z={none:{hit:"va-cham-anime",heavy:"va-cham-huyet",aura:"",dash:"",burst:"vong-xung-kich"},lightning:{hit:"va-cham-dien",heavy:"hoa-loi-xanh",aura:"hao-quang-lam",dash:"luot-chem-loi",burst:"vong-xung-kich"},fire:{hit:"va-cham-anime",heavy:"va-cham-huyet",aura:"hao-quang-do",dash:"cot-lua-hoat-hinh",burst:"vong-xung-kich"},dark:{hit:"va-cham-huyet",heavy:"vong-xung-kich-tim",aura:"hao-quang-tim",dash:"luot-chem-loi",burst:"vong-xung-kich-tim"}};function gt(o,g){const k=(Array.isArray(o)?o:[]).slice(0,5).map(T=>{const u=T||{};return{seconds:Math.max(1.5,Math.min(20,Number(u.seconds)||2.5)),tempo:Math.max(0,Math.min(1,Number(u.tempo??.8))),ending:["none","launch","knockdown","throw"].includes(String(u.ending))?String(u.ending):"none",...u.blocks!=null?{blocks:Number(u.blocks)}:{},...u.kicks!=null?{kicks:Number(u.kicks)}:{},...u.evades!=null?{evades:Number(u.evades)}:{},...u.air?{air:!0,height:Math.max(1.5,Math.min(12,Number(u.height)||3))}:{}}});return k.length?(k[k.length-1].ending==="launch"&&k.push({seconds:2.5,tempo:1,ending:"knockdown"}),k):[{seconds:g*.42,tempo:.75,ending:"launch"},{seconds:g*.58,tempo:1,ending:"knockdown"}]}async function Et(o,g,k,T,u,tt){const G=g.getStage(),et=A(G),S=et.duration,R=gt(o.rounds,u-T),P=(t,n,s)=>{const r=A(n),e=ct(n.items.find(a=>a.id===t.id),{...r,flight:void 0},Math.min(1,s/r.duration));return{id:t.id,name:t.name,position:[...e.position],yaw:e.rotation[1],scale:ft(t),pose:e.pose}},z=(t,n)=>({time:t.time-n,pose:t.pose,position:t.position,yaw:t.yaw,...t.plant?{plant:t.plant}:{},...t.air?{air:!0}:{},...t.pitch!=null?{pitch:t.pitch}:{},...t.strike?{strike:t.strike}:{},...t.hit?{hit:t.hit}:{}});let h=G,x=T,_=[k[0],k[1]],I;const l=[],E=[],j=[];for(let t=0;t<R.length;t++){const n=R[t],s=t===R.length-1,r=n.ending==="throw",e=s?u:Math.min(u-2,x+n.seconds+(n.ending==="launch"?1.2:r?1.6:0)),a=r?e-(s?2.2:1.6):e;if(a-x<1.5){j.push(`round ${t+1} skipped: no time left (extend the shot)`);break}const b=!!n.air,v=b?x+.8:x,w=b?a-.8:a;if(b){const i=A(h);for(const c of _){const d=P(c,h,x).position[1];let m=V(i.flight?.[c.id],{time:x/S,on:!0,height:n.height??3,ground:d});m=V(m,{time:Math.min(1,e/S),on:!1}),h={...h,shots:h.shots.map(f=>f.id===i.id?{...f,flight:{...f.flight,[c.id]:m}}:f)}}}const O=(i,c)=>{const d=A(h),m=d.flight?.[i];if(!m?.length)return null;const f=lt(m,c/d.duration,d.duration);return f.air>0?{pose:N=>mt(N,f,c),lift:f.altitude}:null},K=_.map(i=>({...P(i,h,v),...b?{airborne:!0}:{}})),y=at(K.map(({pose:i,...c})=>c),v,w,{style:tt,seed:(Number(o.seed)||7)+t*101,intensity:Math.max(0,Math.min(1,Number(o.intensity??.85))),finisher:r?"none":s?n.ending==="none"?o.finisher==="knockdown"?"knockdown":"none":n.ending:n.ending==="launch"?"launch":"none",kicks:n.kicks??Number(o.kicks??0),evades:n.evades??Number(o.evades??0),blocks:n.blocks??Number(o.blocks??.2),tempo:n.tempo,clipKeys:i=>Y(i),...I!=null?{openAt:I}:{},airOf:O,debug:o.debug===!0});if(!y.beats.length){j.push(`round ${t+1}: ${y.notes.join("; ")||"no exchange planned"}`);break}for(const i of _)h=L(h,i.id,(y.tracks[i.id]||[]).map(c=>z(c,v)),v/S,q,{replace:"span"}).stage;l.push(...y.beats.map(i=>({...i,round:t+1}))),j.push(...y.notes.map(i=>`round ${t+1}: ${i}`));let p=y.beats[y.beats.length-1];if(r){const i=_.find(f=>f.name===p.attacker)??_[0],c=_.find(f=>f.id!==i.id),d=Math.max(p.time+.35,a-.1),m=it({atk:P(i,h,d),def:P(c,h,d),start:d});h=L(h,i.id,m.atk.map(f=>z(f,d)),d/S,q,{replace:"span"}).stage,h=L(h,c.id,m.def.map(f=>z(f,d)),d/S,q,{replace:"span"}).stage,p={...p,time:m.slam,attacker:i.name,target:c.name,clip:"throw",limb:"footR",zone:"body",planned:"body",cls:"throw"},l.push({...p,round:t+1})}const X=n.ending==="launch"&&p.planned!=="miss"&&p.planned!=="blocked";let F=e;if(b&&X){F=Math.min(e,p.time+1.3);const i=A(h);for(const c of _){const d=(i.flight?.[c.id]||[]).filter(m=>m.time<=p.time/S+1e-6);h={...h,shots:h.shots.map(m=>m.id===i.id?{...m,flight:{...m.flight,[c.id]:V(d,{time:Math.min(1,(F+(c.name===p.target?0:.25))/S),on:!1})}}:m)}}}if((X||r)&&!s){const i=_.find($=>$.name===p.target),c=_.find($=>$.id!==i.id),d=Math.max(p.time+(r?.75:1.05),b?F+.1:0),m=P(i,h,d),f=P(c,h,d+2),N=ot({charger:m,target:f,start:d,hold:Math.max(.4,Math.min(1.4,Number(o.charge_hold??.75))),clipKeys:$=>Y($)});h=L(h,i.id,N.keys.map($=>z($,d)),d/S,q,{replace:"span"}).stage,E.push({launch:p.time,landed:p.time+(r?0:.55),charge:N.chargeAt,dash:N.dashAt,arrive:N.arrive,who:i.name}),_=[i,c],x=N.arrive,I=N.arrive}else x=e,I=void 0}if(!l.length)return{ok:!1,error:`no fight could be planned (${j.join("; ")||"too short"})`};const Q=rt(h);h=Q.stage,g.setStage(()=>h);const W=o.land!==!1?(await H(async()=>{const{landBlows:t}=await import("./editTools-m0VGPmfF.js");return{landBlows:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))).landBlows(g,l):null;if(o.timing!==!1){const t=A(g.getStage()),n=l[l.length-1];let s=st(t.timing,t.duration);const r=[...E.map(e=>e.launch),n.time];s=B(s,l.filter(e=>e.planned!=="blocked"&&!r.includes(e.time)).map(e=>e.time),U.light,t.duration),s=B(s,l.filter(e=>e.planned==="blocked").map(e=>e.time),U.light*.7,t.duration),s=B(s,r,U.heavy,t.duration);for(const e of E)s=J(s,e.launch+.12,.3,.35,t.duration),s=J(s,e.arrive+.1,.18,.5,t.duration);o.finisher!=="none"&&(s=J(s,n.time+.05,.25,.35,t.duration)),g.setStage(e=>({...e,shots:e.shots.map(a=>a.id===t.id?{...a,timing:s??void 0}:a)}))}const C=[];if(o.vfx===!0){const{runTool:t}=await H(async()=>{const{runTool:e}=await import("./remote-BJdzzFZg.js").then(a=>a.js);return{runTool:e}},__vite__mapDeps([1,2,3,4,5,6,7,8,9,10])),n=Z[String(o.element??"none")]??Z.none,s=l[l.length-1].time,r=async e=>{(await t("add_effect",e,g)).ok&&C.push(String(e.effect))};for(const e of l){if(e.planned==="miss")continue;const a=e.time===s||E.some(b=>b.launch===e.time);await r({effect:e.planned==="blocked"?n.burst:a?n.heavy:n.hit,attach_to:e.target,start:e.time,duration:a?.4:.26,intensity:a?.32:.26})}for(const e of E)await r({effect:"bui-hoat-hinh",attach_to:e.who,start:e.landed,duration:.7,intensity:.4,params:{power:.6,puffs:8,tint:.9}}),await r({effect:"mat-dat-vo",attach_to:e.who,start:e.charge,duration:1.2,intensity:.45}),n.aura&&await r({effect:n.aura,attach_to:e.who,start:e.charge,duration:e.dash-e.charge+.3,intensity:.6}),n.dash&&await r({effect:n.dash,attach_to:e.who,start:e.dash,duration:.45,intensity:.7}),await r({effect:"xung-kich",attach_to:e.who,start:e.arrive,duration:.5,intensity:.3});o.finisher!=="none"&&String(o.element)==="lightning"&&await r({effect:"loi-kiep",from:`${l[l.length-1].attacker}.hand_right`,to:`${l[l.length-1].target}.chest`,start:s-.05,duration:.45,intensity:.4})}let D=null;if(o.director_camera===!0){const t=l[l.length-1],n=[],s=(a,b)=>{const v=new Map;for(const w of l)w.time>=a&&w.time<=b&&v.set(w.attacker,(v.get(w.attacker)??0)+1);return[...v.entries()].sort((w,O)=>O[1]-w[1])[0]?.[0]??k[0].name};let r=T;for(const a of E)n.push(["punch-beats",s(r,a.launch),r,a.launch+.12],["side-track",a.who,a.launch+.12,a.charge],["low-hero",a.who,a.charge,a.arrive]),r=a.arrive;t.time-.5-r>.4&&n.push(["punch-beats",s(r,t.time),r,t.time-.5]),n.push(["orbit-180",t.attacker,Math.max(r,t.time-.5),u]);const e=[];for(const[a,b,v,w]of n){if(w-v<.25)continue;const O=k.find(y=>y.name===b)??k[0],K=ut(g.getStage(),{preset:a,subject:O.id,start:v,end:w});K.ok&&(g.setStage(()=>K.stage),e.push(`${a} ${M(v)}–${M(w)} s on ${b}`))}D={director:e}}else if(o.camera!==!1)try{const t=ht(g.getStage(),{fighters:k.map(n=>n.name),start:T,end:u,focal_length_mm:Number(o.focal_length_mm)||32});g.setStage(()=>t.stage),D=t.result}catch(t){D={error:t.message}}const nt=A(g.getStage());return{ok:!0,fighters:k.map(t=>t.name),rounds:R.map((t,n)=>({round:n+1,tempo:t.tempo,ending:t.ending,beats:l.filter(s=>s.round===n+1).length})),...W?.length?{contact:W}:{},exchange:l.map(t=>({time_s:M(t.time),round:t.round,attacker:t.attacker,target:t.target,strike:t.cls,result:t.planned})),drama:E.map(t=>({launched:t.who,launch_s:M(t.launch),landed_s:M(t.landed),charge_s:M(t.charge),dash_s:M(t.dash),arrive_s:M(t.arrive)})),resolved:Q.outcomes.slice(0,30).map(t=>({time_s:t.time_s,attacker:t.attacker,result:t.result,gap_m:t.gap_m})),video_s:M((await H(async()=>{const{outputDuration:t}=await import("./remote-BJdzzFZg.js").then(n=>n.jq);return{outputDuration:t}},__vite__mapDeps([1,2,3,4,5,6,7,8,9,10]))).outputDuration(nt)),...C.length?{effects:C.length}:{},...j.length?{notes:j}:{},...D?{camera:D}:{},hint:"camera_preset per round (punch-beats / action-director on the exchanges, low-hero / orbit-180 on the charge and the finisher) reads better than one fight camera; add_effect on the drama times for more"}}export{gt as normalizeRounds,Et as stageFightRounds};
|