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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-
|
|
2
|
-
import{PMREMGenerator as he,SRGBColorSpace as ke,Texture as de,CanvasTexture as le,Group as k,MeshStandardMaterial as B,Color as ue,BoxGeometry as q,Mesh as p,PlaneGeometry as Q,CircleGeometry as pe,MeshBasicMaterial as H,CylinderGeometry as Oe,ExtrudeGeometry as Ee,ShapeGeometry as Te,Shape as Fe,Vector3 as l,Euler as Z,Quaternion as A,Matrix4 as $,PerspectiveCamera as me,Raycaster as fe,Vector2 as we,Plane as G,Scene as Le,WebGLRenderer as Ie,HemisphereLight as qe,DirectionalLight as Re,NoToneMapping as De,PCFShadowMap as je,ShadowMaterial as Ve,ACESFilmicToneMapping as Ge,Box3 as P,AnimationMixer as _e,Matrix3 as Be,BufferGeometry as ne,BufferAttribute as X,ShaderMaterial as We,Points as Ue,GridHelper as Ye,LoopRepeat as Xe,Line as Ne,LineBasicMaterial as Qe}from"./three.module-Bx43vjkH.js";import{G as se}from"./GLTFLoader-BHWu1lKg.js";import{az as Ke}from"./api-QBI5GJTZ.js";import{lO as D,_ as Je,ec as N,lP as He,lQ as Ze,f7 as $e,f9 as et,cb as tt,fp as ye,fy as oe,fz as nt,lR as st,lS as ot,lT as it,lU as at,lV as rt,lW as ct,lN as ht}from"./titleFrameBudget-Cml-MO53.js";import{R as ge}from"./RoomEnvironment-Dmv_G5ka.js";const dt=new Map;async function lt(a){try{const e=await(await Je(async()=>{const{signOutput:t}=await import("./api-QBI5GJTZ.js").then(n=>n.c1);return{signOutput:t}},__vite__mapDeps([0,1]))).signOutput({gcsUri:a});return typeof e=="string"&&e?e:null}catch{return null}}function xe(a,e,t){const n=new Fe,s=-a/2,o=-e/2;return t=Math.min(t,a/2,e/2),n.moveTo(s+t,o),n.lineTo(s+a-t,o),n.quadraticCurveTo(s+a,o,s+a,o+t),n.lineTo(s+a,o+e-t),n.quadraticCurveTo(s+a,o+e,s+a-t,o+e),n.lineTo(s+t,o+e),n.quadraticCurveTo(s,o+e,s,o+e-t),n.lineTo(s,o+t),n.quadraticCurveTo(s,o,s+t,o),n}function C(a,e,t){const n=new Te(xe(a,e,t),12),s=n.attributes.uv,o=n.attributes.position;for(let i=0;i<s.count;i++)s.setXY(i,o.getX(i)/a+.5,o.getY(i)/e+.5);return n}function F(a,e,t,n,s=.012){const o=new Ee(xe(a-s*2,e-s*2,Math.max(.001,n-s)),{depth:t-s*2,bevelEnabled:!0,bevelThickness:s,bevelSize:s,bevelSegments:4,curveSegments:14});return o.translate(0,0,-(t-s*2)/2),o}const S=(a,e=.32)=>new B({color:a,metalness:.85,roughness:e}),_=()=>new B({color:"#050506",metalness:.2,roughness:.08}),ie=a=>new B({color:a,metalness:.1,roughness:.75}),W=()=>new H({color:"#ffffff",toneMapped:!1});function ae(a,{w:e,h:t,d:n,r:s,bezel:o,island:i,lenses:r}){const c=new k;c.add(new p(F(e,t,n,s),S(a)));const h=new p(C(e-.012,t-.012,s-.006),_());h.position.z=n/2+.0015,c.add(h);const m=e-o*2,d=t-o*2,f=new p(C(m,d,Math.max(.01,s-o)),W());if(f.position.z=n/2+.003,c.add(f),i){const u=new p(C(m*.3,d*.032,d*.016),new H({color:"#000"}));u.position.set(0,d/2-d*.035,n/2+.004),c.add(u)}if(r){const u=new p(F(e*.42,e*.42,.02,e*.1,.006),_());u.position.set(-e/2+e*.27,t/2-e*.27,-n/2-.008),c.add(u);for(let g=0;g<r;g++){const M=g*2*Math.PI/Math.max(1,r)+.6,x=new p(new Oe(e*.075,e*.08,.018,28),S("#2a2a2c",.2));x.rotation.x=Math.PI/2,x.position.set(u.position.x+Math.cos(M)*e*.09,u.position.y+Math.sin(M)*e*.09,-n/2-.022),c.add(x);const w=new p(new pe(e*.05,24),_());w.rotation.y=Math.PI,w.position.set(x.position.x,x.position.y,-n/2-.0315),c.add(w)}}for(const[u,g]of[[t*.22,t*.08],[t*.09,t*.08]]){const M=new p(new q(.008,g,n*.35),S(a));M.position.set(-e/2-.002,u,0),c.add(M)}const v=new p(new q(.008,t*.12,n*.35),S(a));return v.position.set(e/2+.002,t*.14,0),c.add(v),{object:c,screen:f,screenAspect:m/d}}function ut(a,e){const t=new k,n=1.8,s=1.22,o=.045,i=new p(F(n,s,o,.06),S(a));i.rotation.x=-Math.PI/2,t.add(i);const r=new p(C(n*.86,s*.42,.02),ie("#111214"));r.rotation.x=-Math.PI/2,r.position.set(0,o/2+.001,-s*.15),t.add(r);const c=new q(n*.86/15*.82,.006,s*.42/6*.78),h=ie("#1b1c1f");for(let O=0;O<6;O++)for(let E=0;E<15;E++){const T=new p(c,h);T.position.set(-n*.43+(E+.5)*n*.86/15,o/2+.004,-s*.15-s*.21+(O+.5)*s*.42/6),t.add(T)}const m=new p(C(n*.36,s*.26,.025),S(a,.5));m.rotation.x=-Math.PI/2,m.position.set(0,o/2+.0012,s*.27),t.add(m);const d=new k;d.position.set(0,o/2,-s/2),t.add(d);const f=1.16,v=.022,u=new k;u.position.set(0,f/2,0),d.add(u),u.add(new p(F(n,f,v,.05),S(a)));const g=new p(C(n-.01,f-.01,.045),_());g.position.z=v/2+.0015,u.add(g);const M=n-.09,x=f-.1,w=new p(C(M,x,.012),W());w.position.set(0,.01,v/2+.003),u.add(w);const y=new p(new pe(.07,40),S("#e9e9ea",.15));y.rotation.y=Math.PI,y.position.z=-v/2-.002,u.add(y);const z=Math.max(0,Math.min(1,e));return d.rotation.x=(1-z)*Math.PI/2-z*.26,{object:t,screen:w,screenAspect:M/x}}function pt(a){const e=new k,t=1.8,n=1.04,s=.035;e.add(new p(F(t,n,s,.02,.006),S(a,.45)));const o=t-.04,i=n-.04,r=new p(C(o,i,.006),W());r.position.z=s/2+.002,e.add(r);const c=new p(new q(.12,.32,.04),S(a,.4));c.position.set(0,-n/2-.14,-.05),e.add(c);const h=new p(F(.62,.26,.025,.08,.006),S(a,.4));return h.rotation.x=-Math.PI/2,h.position.set(0,-n/2-.3,-.02),e.add(h),{object:e,screen:r,screenAspect:o/i}}function mt(a){const e=new k,t=1.2,n=1.6,s=.42,o=new B({color:new ue(a).multiplyScalar(.62),metalness:0,roughness:.85}),i=new q(t,n,s);e.add(new p(i,o));const r=new p(new Q(t*.98,n*.98),W());return r.position.z=s/2+.002,e.add(r),{object:e,screen:r,screenAspect:t/n}}function ft(a){const e=a.color??(a.type==="box"?D.white:a.type==="tv"?D.black:a.type==="laptop"?D.silver:D.titanium);switch(a.type){case"phone":return ae(e,{w:.83,h:1.8,d:.075,r:.13,bezel:.032,island:!0,lenses:3});case"tablet":return ae(e,{w:1.35,h:1.8,d:.06,r:.09,bezel:.05,island:!1,lenses:1});case"laptop":return ut(e,a.open??1);case"tv":return pt(e);default:return mt(e)}}const re=new WeakMap;function wt(a){let e=re.get(a);if(!e){const t=new he(a);e=t.fromScene(new ge,0,.1,100,{size:64}).texture,t.dispose(),re.set(a,e)}return e}class yt{constructor(e,t,n){this.mesh=e,this.aspect=t,this.media=n;const s=o=>n.kind==="video"?this.loadVideo(o):this.loadImage(o);this.ready=n?.url?s(n.url).catch(async o=>{const i=n.gcsUri?await lt(n.gcsUri):null;if(!i||i===n.url)throw o;return s(i)}):Promise.resolve(),n?.url||e.material.color.set("#0d0f12")}texture=null;video=null;ready;whenReady(){return this.ready}fit(e,t){const n=this.texture,s=e/t;s>this.aspect?(n.repeat.set(this.aspect/s,1),n.offset.set((1-this.aspect/s)/2,0)):(n.repeat.set(1,s/this.aspect),n.offset.set(0,(1-s/this.aspect)/2))}apply(e,t,n){e.colorSpace=ke,e.anisotropy=4,this.texture=e,this.fit(t,n);const s=this.mesh.material;s.map=e,s.needsUpdate=!0}loadImage(e){return new Promise((t,n)=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>{this.apply(new de(s),s.naturalWidth,s.naturalHeight),this.texture.needsUpdate=!0,t()},s.onerror=()=>n(Error("Không tải được ảnh màn hình thiết bị")),s.src=e})}canvas=null;draw(){const e=this.video,t=this.canvas;!e||!t||e.readyState<2||(t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.texture&&(this.texture.needsUpdate=!0))}loadVideo(e){const t=document.createElement("video");return t.crossOrigin="anonymous",t.muted=!0,t.playsInline=!0,t.preload="auto",this.video=t,new Promise((n,s)=>{t.onloadeddata=()=>{const o=Math.min(1,1280/Math.max(t.videoWidth,t.videoHeight)),i=document.createElement("canvas");i.width=Math.max(2,Math.round(t.videoWidth*o)),i.height=Math.max(2,Math.round(t.videoHeight*o)),this.canvas=i,this.apply(new le(i),t.videoWidth,t.videoHeight),this.draw(),n()},t.onerror=()=>s(Error("Không tải được video màn hình thiết bị")),t.src=e})}async sync(e,t=!1){const n=this.video,s=this.media;if(!n||!s||!this.texture)return;const o=Number.isFinite(n.duration)&&n.duration>0?n.duration:0;let i=(s.inPoint||0)+Math.max(0,e)*(s.speed||1);if(o&&(i=Math.min(i,o-.04)),Math.abs(n.currentTime-i)>(t?.004:.12)){const r=new Promise(c=>{const h=()=>{n.removeEventListener("seeked",h),c()};n.addEventListener("seeked",h),setTimeout(h,t?4e3:600)});if(n.currentTime=i,t)await r;else{r.then(()=>this.draw());return}}this.draw()}dispose(){this.texture?.dispose(),this.video&&(this.video.removeAttribute("src"),this.video.load(),this.video=null)}}const gt=1.8,b=Math.PI/180;function I(a,e,t,n,s){if($e(t)&&a.is3D!==!1){const o=ye(n,s),i=et(t,a.start+Math.max(0,e),n,s),r=c=>new l(i.R[0][c],-i.R[1][c],-i.R[2][c]);return{pos:new l(i.pos[0]/o,-i.pos[1]/o,-i.pos[2]/o),quat:new A().setFromRotationMatrix(new $().makeBasis(r(0),r(1).negate(),r(2).negate())),fov:2*Math.atan(s/2/i.f)/b,on:!0}}return{pos:new l(0,0,5),quat:new A,fov:40,on:!1}}function K(a,e,t,n,s){const o=tt(a,Math.max(0,e),n,s);if(t.on){const r=ye(n,s);return{pos:new l(o.x*n/r,-o.y*s/r,o.depth),zoom:o.zoom}}const i=2*(5-o.depth)*Math.tan(t.fov*b/2);return{pos:new l(o.x*i*(n/s),-o.y*i,o.depth),zoom:o.zoom}}function ve(a){const e=a.modelRotation||{x:0,y:0,z:0};return new l(0,1,0).applyEuler(new Z(e.x*b,e.y*b,e.z*b)).normalize()}function Me(a,e,t,n,s){const o=Math.min(48,Math.max(2,Math.ceil(a.duration/.1)));let i=1/0;for(let r=0;r<=o;r++){const c=a.duration*r/o;i=Math.min(i,K(a,c,I(a,c,t,n,s),n,s).pos.dot(e))}return i}function xt(a,e,t,n,s,o){const i=new me(a.fov,s/o,.01,100);i.position.copy(a.pos),i.quaternion.copy(a.quat),i.updateMatrixWorld(!0),i.updateProjectionMatrix();const r=new fe;return r.setFromCamera(new we(e[0]*2-1,1-e[1]*2),i),r.ray.intersectPlane(new G(t.clone(),-n),new l)}function vt(a,e,t,n,s,o,i){const r=I(a,e,t,n,s),{pos:c,zoom:h}=K(a,e,r,n,s),m={x:N(a,"rx",e),y:N(a,"ry",e),z:N(a,"rz",e)},d=a.modelSpin||{x:0,y:0,z:0},f=(a.inPoint||0)+e,v=new Z((m.x+d.x*f)*b,(m.y+d.y*f)*b,(m.z+d.z*f)*b),u=ve(a),g=gt*h,x=!!a.modelLaunch||!!a.modelLook?i??Me(a,u,t,n,s):null,w=a.modelLaunch,y=w?He(w,e):null;if(w&&y){const E=K(a,w.at,I(a,w.at,t,n,s),n,s).pos,T=E.clone().addScaledVector(u,x-E.dot(u)),ee=xt(I(a,w.at+w.duration,t,n,s),w.to,u,x,n,s)??T.clone(),ze=T.clone().lerp(ee,y.g),L=ee.clone().sub(T);L.addScaledVector(u,-L.dot(u));const Ae=Ze(y,L.length()/g);let R;if(w.face!==!1&&L.lengthSq()>1e-8){const Y=L.normalize(),te=new l().crossVectors(u,Y).normalize(),Ce=new l().crossVectors(Y,te);R=new A().setFromRotationMatrix(new $().makeBasis(te,Ce,Y))}else R=new A().setFromEuler(v);R.multiply(new A().setFromAxisAngle(new l(1,0,0),-Ae*b)).multiply(new A().setFromAxisAngle(new l(0,0,1),y.roll*b));const U=y.jolt*.035*g,Pe=new l(Math.sin(e*91)*U,Math.sin(e*67+1)*U*.6,Math.sin(e*53+2)*U);return{cam:r,pos:ze.addScaledVector(u,o*h+y.h*g).add(Pe),quat:R,zoom:h,N:u,d:x,len:g}}const z=new A().setFromEuler(v),O=c.clone();return a.modelGround&&O.add(new l(0,1,0).applyQuaternion(z).multiplyScalar(o*h)),{cam:r,pos:O,quat:z,zoom:h,N:u,d:x,len:g}}function Mt(a,e,t){const n=new l(1,0,0).applyQuaternion(t.quat),o=e.clone().cross(n).normalize().clone().negate(),i=new l().crossVectors(e,o).normalize(),r=a.azimuth*b,c=a.elevation*b;return o.multiplyScalar(Math.cos(c)*Math.cos(r)).addScaledVector(i,Math.cos(c)*Math.sin(r)).addScaledVector(e,Math.sin(c)).normalize()}const be=new Map,J=new Set,bt=a=>a?be.get(a):void 0;function St(a){return J.add(a),()=>{J.delete(a)}}const ce=(a,e)=>a.name||`Animation ${e+1}`,Se=new Map,zt=a=>a?Se.get(a):void 0,j=600,At="attribute float aAlpha;attribute float aSize;varying float vA;uniform float uScale;void main(){vA=aAlpha;vec4 mv=modelViewMatrix*vec4(position,1.);gl_PointSize=aSize*uScale/max(.05,-mv.z);gl_Position=projectionMatrix*mv;}",Pt="uniform vec3 uColor;varying float vA;void main(){vec2 d=gl_PointCoord-.5;float r=length(d);if(r>.5)discard;gl_FragColor=vec4(uColor,vA*smoothstep(.5,.05,r));}";let V=null;function Ct(){if(V)return V;const a=document.createElement("canvas");a.width=a.height=128;const e=a.getContext("2d"),t=e.createRadialGradient(64,64,0,64,64,64);return t.addColorStop(0,"rgba(0,0,0,1)"),t.addColorStop(.35,"rgba(0,0,0,.75)"),t.addColorStop(.7,"rgba(0,0,0,.22)"),t.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=t,e.fillRect(0,0,128,128),V=new le(a),V}class kt{canvas;renderer;scene=new Le;camera=new me(40,1,.01,100);halfY=0;group=new k;disposed=!1;mixer=null;clips=[];action=null;rest=[];width;height;screen=null;pieces=[];dust=null;cut=[new G,new G];guides=null;buildOn=!1;constructor(e,t){this.width=e,this.height=t,this.renderer=new Ie({alpha:!0,antialias:!0,preserveDrawingBuffer:!0}),this.renderer.setPixelRatio(1),this.renderer.setSize(e,t,!1),this.renderer.setClearColor(0,0),this.canvas=this.renderer.domElement,this.camera.aspect=e/t,this.camera.position.set(0,0,5),this.camera.lookAt(0,0,0),this.camera.updateProjectionMatrix(),this.scene.add(this.group,this.hemi,this.key,this.key.target),this.key.position.set(3,5,5)}hemi=new qe(16777215,7829367,3);key=new Re(16777215,3);catcher=null;contact=null;lookEnv=null;lookOn=!1;groundCache=null;applyLook(e){const t=this.renderer;if(!e){if(!this.lookOn)return;this.lookOn=!1,t.shadowMap.enabled=!1,t.toneMapping=De,t.toneMappingExposure=1,this.hemi.color.set(16777215),this.hemi.groundColor.set(7829367),this.hemi.intensity=3,this.key.color.set(16777215),this.key.intensity=3,this.key.castShadow=!1,this.key.position.set(3,5,5),this.key.target.position.set(0,0,0),this.scene.environment===this.lookEnv&&(this.scene.environment=null),this.catcher&&(this.catcher.visible=!1),this.contact&&(this.contact.visible=!1);return}if(!this.lookOn&&(this.lookOn=!0,t.shadowMap.enabled=!0,t.shadowMap.type=je,this.key.castShadow=!0,this.key.shadow.mapSize.set(2048,2048),this.key.shadow.bias=-4e-4,this.key.shadow.normalBias=.02,this.group.traverse(n=>{const s=n;s.isMesh&&(s.castShadow=!0,s.receiveShadow=!0)}),this.catcher||(this.catcher=new p(new Q(1,1),new Ve({opacity:.4,depthWrite:!1})),this.catcher.receiveShadow=!0,this.catcher.renderOrder=-2,this.scene.add(this.catcher)),this.contact||(this.contact=new p(new Q(1,1),new H({map:Ct(),transparent:!0,depthWrite:!1,color:0})),this.contact.renderOrder=-1,this.scene.add(this.contact)),!this.lookEnv&&!this.screen)){const n=new he(t);this.lookEnv=n.fromScene(new ge,.04,.1,100,{size:128}).texture,n.dispose()}t.toneMapping=Ge,t.toneMappingExposure=e.exposure,!this.screen&&this.lookEnv&&(this.scene.environment=this.lookEnv),this.scene.environmentIntensity=e.env,this.hemi.color.set(e.ambient),this.hemi.groundColor.set(e.ambient).multiplyScalar(.45),this.hemi.intensity=e.ambientIntensity,this.key.color.set(e.color),this.key.intensity=e.intensity,this.key.shadow.radius=1+e.softness*9,this.key.shadow.blurSamples=8+Math.round(e.softness*16),this.catcher.material.opacity=e.shadow,this.catcher.visible=e.shadow>0}groundFor(e,t){const n=JSON.stringify([e.id,e.start,e.duration,e.posX,e.posY,e.spatialDepth,e.modelDepth,e.scale,e.motionKeys,e.modelRotation,e.parentId,t?JSON.stringify(t):""]);if(this.groundCache?.key===n)return this.groundCache.d;const s=Me(e,ve(e),t,this.width,this.height);return this.groundCache={key:n,d:s},s}async load(e){const t=await Ke(e);this.add(await new se().loadAsync(t),e)}async loadBuffer(e,t){this.add(await new se().parseAsync(e,""),t)}async loadDevice(e){if(!e.device)throw Error("Không phải thiết bị 3D");const t=ft(e.device);this.scene.environment=wt(this.renderer),this.addObject(t.object),!this.disposed&&(this.screen=new yt(t.screen,t.screenAspect,e.deviceScreen),await this.screen.whenReady())}async prepare(e){await this.screen?.sync(e,!0)}addObject(e){if(this.disposed){this.disposeObject(e);return}const t=new P().setFromObject(e),n=t.getSize(new l),s=Math.max(n.x,n.y,n.z);e.scale.setScalar(1.8/s),e.updateMatrixWorld(!0),this.halfY=n.y*1.8/s/2,e.position.sub(new P().setFromObject(e).getCenter(new l)),e.updateMatrixWorld(!0),this.group.add(e)}add(e,t){if(this.disposed){this.disposeObject(e.scene);return}const s=new P().setFromObject(e.scene).getSize(new l),o=Math.max(s.x,s.y,s.z);if(!Number.isFinite(o)||o<=0)throw Error("GLB không có hình học hợp lệ");e.scene.scale.setScalar(1.8/o),e.scene.updateMatrixWorld(!0);const i=new P().setFromObject(e.scene).getCenter(new l);e.scene.position.sub(i),e.scene.updateMatrixWorld(!0),this.halfY=s.y*1.8/o/2,this.group.add(e.scene),this.clips=e.animations||[],this.clips.length&&(this.mixer=new _e(e.scene),e.scene.traverse(r=>{r!==e.scene&&this.rest.push({o:r,p:r.position.clone(),q:r.quaternion.clone(),s:r.scale.clone()})})),this.collectPieces(e.scene),Se.set(t,this.pieces.length),be.set(t,this.clips.map((r,c)=>({name:ce(r,c),duration:r.duration}))),J.forEach(r=>r())}collectPieces(e){this.group.updateMatrixWorld(!0);const t=[];e.traverse(c=>{c.isMesh&&t.push(c)});const n=new P().setFromObject(e),s=c=>{const h=c.getSize(new l);return h.x*h.y*h.z},o=s(n)*.02,i=n.getSize(new l),r=i.x*i.z;for(const c of t.slice(0,oe.maxPieces)){const h=new P().setFromObject(c),m=h.getCenter(new l),d=h.getSize(new l),f=new $().copy(c.parent.matrixWorld).invert();this.pieces.push({o:c,p:c.position.clone(),q:c.quaternion.clone(),s:c.scale.clone(),toParent:new Be().setFromMatrix4(f),box:{bottom:h.min.y,cx:m.x,cz:m.z,h:d.y,r:Math.max(d.x,d.z)/2,big:s(h)>o,base:d.x*d.z>=r*.25&&h.min.y<=n.min.y+i.y*.03}})}}build(e,t){let n=null;try{n=e.modelBuild?nt(e.modelBuild):null}catch{n=null}const s=new Set;this.group.traverse(i=>{const r=i.material;if(r)for(const c of Array.isArray(r)?r:[r])s.add(c)});const o=[];if(n){const i=st(this.pieces.map(h=>h.box),n);this.pieces.forEach((h,m)=>{const d=ot(n.style,h.box,i[m],t,m,n.seed);h.o.position.copy(h.p),h.o.quaternion.copy(h.q),h.o.scale.copy(h.s),h.o.visible=d.visible,(d.dx||d.dy||d.dz)&&h.o.position.add(new l(d.dx,d.dy,d.dz).applyMatrix3(h.toParent)),(d.rx||d.ry||d.rz)&&h.o.quaternion.multiply(new A().setFromEuler(new Z(d.rx,d.ry,d.rz)))}),this.group.updateMatrixWorld(!0);const r=new l(0,1,0).applyQuaternion(this.group.getWorldQuaternion(new A)).normalize();it(n,t)&&o.push(this.cut[0].setFromNormalAndCoplanarPoint(r,this.group.localToWorld(new l(0,-this.halfY,0))));const c=at(n,t,this.halfY);c!==null&&o.push(this.cut[1].setFromNormalAndCoplanarPoint(r.clone().negate(),this.group.localToWorld(new l(0,c,0)))),this.dustAt(rt(this.pieces.map(h=>h.box),i,n,t,j),n.dustColor),this.buildOn=!0}else{for(const i of this.pieces)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s),i.o.visible=!0;this.dustAt([],oe.dustColor),this.buildOn=!1}this.renderer.localClippingEnabled=o.length>0;for(const i of s){const r=o.length?o:null;i.clippingPlanes!==r&&(i.clippingPlanes?.length||r)&&(i.clippingPlanes=r,i.needsUpdate=!0)}}dustAt(e,t){if(!e.length&&!this.dust)return;if(!this.dust){const r=new ne;r.setAttribute("position",new X(new Float32Array(j*3),3)),r.setAttribute("aAlpha",new X(new Float32Array(j),1)),r.setAttribute("aSize",new X(new Float32Array(j),1));const c=new We({uniforms:{uColor:{value:new ue(t)},uScale:{value:this.height*1.2}},vertexShader:At,fragmentShader:Pt,transparent:!0,depthWrite:!1});this.dust=new Ue(r,c),this.dust.frustumCulled=!1,this.group.add(this.dust)}const n=this.dust.geometry,s=n.getAttribute("position"),o=n.getAttribute("aAlpha"),i=n.getAttribute("aSize");e.forEach((r,c)=>{s.setXYZ(c,r[0],r[1],r[2]),o.setX(c,r[3]),i.setX(c,r[4])}),n.setDrawRange(0,e.length),s.needsUpdate=o.needsUpdate=i.needsUpdate=!0,this.dust.material.uniforms.uColor.value.set(t)}setGuides(e,t=4){if(!e){this.guides&&(this.scene.remove(this.guides),this.disposeObject(this.guides),this.guides=null);return}if(this.guides)return;const n=new k,s=new Ye(t,16,6742271,2781056);s.rotation.x=Math.PI/2;for(const i of Array.isArray(s.material)?s.material:[s.material])i.transparent=!0,i.opacity=.85,i.depthWrite=!1;const o=(i,r)=>new Ne(new ne().setFromPoints([new l,i]),new Qe({color:r}));n.add(s,o(new l(.5,0,0),16731469),o(new l(0,.5,0),5111674),o(new l(0,0,.5),5086207)),this.guides=n,this.scene.add(n)}surfaceAt(e,t){const n=new fe;n.setFromCamera(new we(e/this.width*2-1,1-t/this.height*2),this.camera);const s=n.ray.intersectPlane(new G(new l(0,0,1),0),new l);return s?{x:s.x,y:s.y}:null}pose(e,t){if(!this.mixer)return;const n=e.modelAnim,s=n?this.clips.find((i,r)=>ce(i,r)===n.clip):void 0;if(!n||!s){if(this.action){this.mixer.stopAllAction(),this.action=null;for(const i of this.rest)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s)}return}const o=this.mixer.clipAction(s);this.action!==o&&(this.mixer.stopAllAction(),o.setLoop(Xe,1/0),o.play(),this.action=o),o.time=ct(n,s.duration,t,e.inPoint||0),this.mixer.update(0)}render(e,t,n=!1,s){const o=e.modelLook?ht(e.modelLook):null;this.applyLook(o);const i=this.width,r=this.height,c=e.modelLook||e.modelLaunch?this.groundFor(e,s):void 0,h=vt(e,t,s,i,r,this.halfY,c);this.camera.position.copy(h.cam.pos),this.camera.quaternion.copy(h.cam.quat),this.camera.fov=h.cam.fov,this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(!0),this.group.scale.setScalar(h.zoom),this.group.quaternion.copy(h.quat),this.group.position.copy(h.pos),this.pose(e,t),(e.modelBuild||this.buildOn)&&this.build(e,t),o&&this.placeShadows(e,o,h.N,h.d??0,h.len,s),n&&this.screen?.sync(t),this.renderer.render(this.scene,this.camera),n&&this.publish(e.id)}placeShadows(e,t,n,s,o,i){const r=this.group.getWorldPosition(new l),c=r.dot(n)-s,h=r.clone().addScaledVector(n,-c),m=new A().setFromUnitVectors(new l(0,0,1),n),d=Math.max(0,c-this.halfY*this.group.scale.x),f=Math.max(6*o,d*4+3*o);this.catcher.position.copy(h).addScaledVector(n,.001*o),this.catcher.quaternion.copy(m),this.catcher.scale.set(f,f,1);const v=new P().setFromObject(this.group),u=v.getSize(new l),g=Math.max(.2*o,Math.hypot(u.x,u.y,u.z)-Math.abs(u.clone().dot(n)))*.62,M=Math.max(0,1-d/(.8*o));this.contact.visible=t.contact>0&&M>0,this.contact.position.copy(h).addScaledVector(n,.002*o),this.contact.quaternion.copy(m),this.contact.scale.set(g*(1+d/o),g*.75*(1+d/o),1),this.contact.material.opacity=t.contact*.85*M;const x=Mt(t,n,I(e,0,i,this.width,this.height)),w=12*o;this.key.target.position.copy(h),this.key.position.copy(h).addScaledVector(x,w),this.key.target.updateMatrixWorld();const y=this.key.shadow.camera,z=f*.6;y.left=-z,y.right=z,y.top=z,y.bottom=-z,y.near=Math.max(.01,w-4*o-d),y.far=w+4*o+d,y.updateProjectionMatrix()}publish(e){const t=new P().setFromObject(this.group);if(t.isEmpty())return;let n=1/0,s=1/0,o=-1/0,i=-1/0;for(const r of[t.min.x,t.max.x])for(const c of[t.min.y,t.max.y])for(const h of[t.min.z,t.max.z]){const m=new l(r,c,h).project(this.camera),d=(m.x+1)/2*this.width,f=(1-m.y)/2*this.height;n=Math.min(n,d),o=Math.max(o,d),s=Math.min(s,f),i=Math.max(i,f)}dt.set(e,{cx:(n+o)/2,cy:(s+i)/2,w:o-n,h:i-s,angle:0,W:this.width,H:this.height})}async frame(e){const t=await new Promise(o=>(e??this.canvas).toBlob(o,"image/webp",.8));if(!t)throw Error("Không xuất được frame 3D");const n=new Uint8Array(await t.arrayBuffer());let s="";for(let o=0;o<n.length;o+=16384)s+=String.fromCharCode(...n.subarray(o,o+16384));return btoa(s)}disposeObject(e){e.traverse(t=>{const n=t;n.geometry?.dispose();for(const s of n.material?Array.isArray(n.material)?n.material:[n.material]:[]){for(const o of Object.values(s))o instanceof de&&o.dispose();s.dispose()}})}dispose(){this.disposed=!0,this.screen?.dispose(),this.screen=null,this.mixer?.stopAllAction(),this.disposeObject(this.group),this.renderer.dispose(),this.canvas.remove()}}const It=Object.freeze(Object.defineProperty({__proto__:null,Timeline3DScene:kt,modelAnimations:bt,modelPieces:zt,onModelAnimations:St},Symbol.toStringTag,{value:"Module"}));export{kt as T,zt as a,dt as l,bt as m,St as o,It as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-DUp403BK.js","assets/titleFrameBudget-BYRZAQPs.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{PMREMGenerator as he,SRGBColorSpace as ke,Texture as de,CanvasTexture as le,Group as k,MeshStandardMaterial as B,Color as ue,BoxGeometry as q,Mesh as p,PlaneGeometry as N,CircleGeometry as pe,MeshBasicMaterial as Z,CylinderGeometry as Oe,ExtrudeGeometry as Ee,ShapeGeometry as Fe,Shape as Te,Vector3 as l,Euler as $,Quaternion as A,Matrix4 as H,PerspectiveCamera as me,Raycaster as fe,Vector2 as we,Plane as _,Scene as Le,WebGLRenderer as Ie,HemisphereLight as qe,DirectionalLight as De,NoToneMapping as Re,PCFShadowMap as je,ShadowMaterial as Ve,ACESFilmicToneMapping as _e,Box3 as P,AnimationMixer as Ge,Matrix3 as Be,BufferGeometry as ne,BufferAttribute as X,ShaderMaterial as We,Points as Ue,GridHelper as Ye,LoopRepeat as Xe,Line as Ke,LineBasicMaterial as Ne}from"./three.module-Bx43vjkH.js";import{G as se}from"./GLTFLoader-BHWu1lKg.js";import{az as Qe}from"./api-DUp403BK.js";import{lW as R,_ as Je,ee as K,lX as Ze,lY as $e,f9 as He,fb as et,cd as tt,fr as ye,fA as oe,fB as nt,lZ as st,l_ as ot,l$ as it,m0 as at,m1 as rt,m2 as ct,lV as ht}from"./titleFrameBudget-BYRZAQPs.js";import{R as ge}from"./RoomEnvironment-Dmv_G5ka.js";const dt=new Map;async function lt(a){try{const e=await(await Je(async()=>{const{signOutput:t}=await import("./api-DUp403BK.js").then(n=>n.c2);return{signOutput:t}},__vite__mapDeps([0,1]))).signOutput({gcsUri:a});return typeof e=="string"&&e?e:null}catch{return null}}function xe(a,e,t){const n=new Te,s=-a/2,o=-e/2;return t=Math.min(t,a/2,e/2),n.moveTo(s+t,o),n.lineTo(s+a-t,o),n.quadraticCurveTo(s+a,o,s+a,o+t),n.lineTo(s+a,o+e-t),n.quadraticCurveTo(s+a,o+e,s+a-t,o+e),n.lineTo(s+t,o+e),n.quadraticCurveTo(s,o+e,s,o+e-t),n.lineTo(s,o+t),n.quadraticCurveTo(s,o,s+t,o),n}function C(a,e,t){const n=new Fe(xe(a,e,t),12),s=n.attributes.uv,o=n.attributes.position;for(let i=0;i<s.count;i++)s.setXY(i,o.getX(i)/a+.5,o.getY(i)/e+.5);return n}function T(a,e,t,n,s=.012){const o=new Ee(xe(a-s*2,e-s*2,Math.max(.001,n-s)),{depth:t-s*2,bevelEnabled:!0,bevelThickness:s,bevelSize:s,bevelSegments:4,curveSegments:14});return o.translate(0,0,-(t-s*2)/2),o}const S=(a,e=.32)=>new B({color:a,metalness:.85,roughness:e}),G=()=>new B({color:"#050506",metalness:.2,roughness:.08}),ie=a=>new B({color:a,metalness:.1,roughness:.75}),W=()=>new Z({color:"#ffffff",toneMapped:!1});function ae(a,{w:e,h:t,d:n,r:s,bezel:o,island:i,lenses:r}){const c=new k;c.add(new p(T(e,t,n,s),S(a)));const h=new p(C(e-.012,t-.012,s-.006),G());h.position.z=n/2+.0015,c.add(h);const m=e-o*2,d=t-o*2,f=new p(C(m,d,Math.max(.01,s-o)),W());if(f.position.z=n/2+.003,c.add(f),i){const u=new p(C(m*.3,d*.032,d*.016),new Z({color:"#000"}));u.position.set(0,d/2-d*.035,n/2+.004),c.add(u)}if(r){const u=new p(T(e*.42,e*.42,.02,e*.1,.006),G());u.position.set(-e/2+e*.27,t/2-e*.27,-n/2-.008),c.add(u);for(let g=0;g<r;g++){const M=g*2*Math.PI/Math.max(1,r)+.6,x=new p(new Oe(e*.075,e*.08,.018,28),S("#2a2a2c",.2));x.rotation.x=Math.PI/2,x.position.set(u.position.x+Math.cos(M)*e*.09,u.position.y+Math.sin(M)*e*.09,-n/2-.022),c.add(x);const w=new p(new pe(e*.05,24),G());w.rotation.y=Math.PI,w.position.set(x.position.x,x.position.y,-n/2-.0315),c.add(w)}}for(const[u,g]of[[t*.22,t*.08],[t*.09,t*.08]]){const M=new p(new q(.008,g,n*.35),S(a));M.position.set(-e/2-.002,u,0),c.add(M)}const v=new p(new q(.008,t*.12,n*.35),S(a));return v.position.set(e/2+.002,t*.14,0),c.add(v),{object:c,screen:f,screenAspect:m/d}}function ut(a,e){const t=new k,n=1.8,s=1.22,o=.045,i=new p(T(n,s,o,.06),S(a));i.rotation.x=-Math.PI/2,t.add(i);const r=new p(C(n*.86,s*.42,.02),ie("#111214"));r.rotation.x=-Math.PI/2,r.position.set(0,o/2+.001,-s*.15),t.add(r);const c=new q(n*.86/15*.82,.006,s*.42/6*.78),h=ie("#1b1c1f");for(let O=0;O<6;O++)for(let E=0;E<15;E++){const F=new p(c,h);F.position.set(-n*.43+(E+.5)*n*.86/15,o/2+.004,-s*.15-s*.21+(O+.5)*s*.42/6),t.add(F)}const m=new p(C(n*.36,s*.26,.025),S(a,.5));m.rotation.x=-Math.PI/2,m.position.set(0,o/2+.0012,s*.27),t.add(m);const d=new k;d.position.set(0,o/2,-s/2),t.add(d);const f=1.16,v=.022,u=new k;u.position.set(0,f/2,0),d.add(u),u.add(new p(T(n,f,v,.05),S(a)));const g=new p(C(n-.01,f-.01,.045),G());g.position.z=v/2+.0015,u.add(g);const M=n-.09,x=f-.1,w=new p(C(M,x,.012),W());w.position.set(0,.01,v/2+.003),u.add(w);const y=new p(new pe(.07,40),S("#e9e9ea",.15));y.rotation.y=Math.PI,y.position.z=-v/2-.002,u.add(y);const z=Math.max(0,Math.min(1,e));return d.rotation.x=(1-z)*Math.PI/2-z*.26,{object:t,screen:w,screenAspect:M/x}}function pt(a){const e=new k,t=1.8,n=1.04,s=.035;e.add(new p(T(t,n,s,.02,.006),S(a,.45)));const o=t-.04,i=n-.04,r=new p(C(o,i,.006),W());r.position.z=s/2+.002,e.add(r);const c=new p(new q(.12,.32,.04),S(a,.4));c.position.set(0,-n/2-.14,-.05),e.add(c);const h=new p(T(.62,.26,.025,.08,.006),S(a,.4));return h.rotation.x=-Math.PI/2,h.position.set(0,-n/2-.3,-.02),e.add(h),{object:e,screen:r,screenAspect:o/i}}function mt(a){const e=new k,t=1.2,n=1.6,s=.42,o=new B({color:new ue(a).multiplyScalar(.62),metalness:0,roughness:.85}),i=new q(t,n,s);e.add(new p(i,o));const r=new p(new N(t*.98,n*.98),W());return r.position.z=s/2+.002,e.add(r),{object:e,screen:r,screenAspect:t/n}}function ft(a){const e=a.color??(a.type==="box"?R.white:a.type==="tv"?R.black:a.type==="laptop"?R.silver:R.titanium);switch(a.type){case"phone":return ae(e,{w:.83,h:1.8,d:.075,r:.13,bezel:.032,island:!0,lenses:3});case"tablet":return ae(e,{w:1.35,h:1.8,d:.06,r:.09,bezel:.05,island:!1,lenses:1});case"laptop":return ut(e,a.open??1);case"tv":return pt(e);default:return mt(e)}}const re=new WeakMap;function wt(a){let e=re.get(a);if(!e){const t=new he(a);e=t.fromScene(new ge,0,.1,100,{size:64}).texture,t.dispose(),re.set(a,e)}return e}class yt{constructor(e,t,n){this.mesh=e,this.aspect=t,this.media=n;const s=o=>n.kind==="video"?this.loadVideo(o):this.loadImage(o);this.ready=n?.url?s(n.url).catch(async o=>{const i=n.gcsUri?await lt(n.gcsUri):null;if(!i||i===n.url)throw o;return s(i)}):Promise.resolve(),n?.url||e.material.color.set("#0d0f12")}texture=null;video=null;ready;whenReady(){return this.ready}fit(e,t){const n=this.texture,s=e/t;s>this.aspect?(n.repeat.set(this.aspect/s,1),n.offset.set((1-this.aspect/s)/2,0)):(n.repeat.set(1,s/this.aspect),n.offset.set(0,(1-s/this.aspect)/2))}apply(e,t,n){e.colorSpace=ke,e.anisotropy=4,this.texture=e,this.fit(t,n);const s=this.mesh.material;s.map=e,s.needsUpdate=!0}loadImage(e){return new Promise((t,n)=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>{this.apply(new de(s),s.naturalWidth,s.naturalHeight),this.texture.needsUpdate=!0,t()},s.onerror=()=>n(Error("Không tải được ảnh màn hình thiết bị")),s.src=e})}canvas=null;draw(){const e=this.video,t=this.canvas;!e||!t||e.readyState<2||(t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.texture&&(this.texture.needsUpdate=!0))}loadVideo(e){const t=document.createElement("video");return t.crossOrigin="anonymous",t.muted=!0,t.playsInline=!0,t.preload="auto",this.video=t,new Promise((n,s)=>{t.onloadeddata=()=>{const o=Math.min(1,1280/Math.max(t.videoWidth,t.videoHeight)),i=document.createElement("canvas");i.width=Math.max(2,Math.round(t.videoWidth*o)),i.height=Math.max(2,Math.round(t.videoHeight*o)),this.canvas=i,this.apply(new le(i),t.videoWidth,t.videoHeight),this.draw(),n()},t.onerror=()=>s(Error("Không tải được video màn hình thiết bị")),t.src=e})}async sync(e,t=!1){const n=this.video,s=this.media;if(!n||!s||!this.texture)return;const o=Number.isFinite(n.duration)&&n.duration>0?n.duration:0;let i=(s.inPoint||0)+Math.max(0,e)*(s.speed||1);if(o&&(i=Math.min(i,o-.04)),Math.abs(n.currentTime-i)>(t?.004:.12)){const r=new Promise(c=>{const h=()=>{n.removeEventListener("seeked",h),c()};n.addEventListener("seeked",h),setTimeout(h,t?4e3:600)});if(n.currentTime=i,t)await r;else{r.then(()=>this.draw());return}}this.draw()}dispose(){this.texture?.dispose(),this.video&&(this.video.removeAttribute("src"),this.video.load(),this.video=null)}}const gt=1.8,b=Math.PI/180;function I(a,e,t,n,s){if(He(t)&&a.is3D!==!1){const o=ye(n,s),i=et(t,a.start+Math.max(0,e),n,s),r=c=>new l(i.R[0][c],-i.R[1][c],-i.R[2][c]);return{pos:new l(i.pos[0]/o,-i.pos[1]/o,-i.pos[2]/o),quat:new A().setFromRotationMatrix(new H().makeBasis(r(0),r(1).negate(),r(2).negate())),fov:2*Math.atan(s/2/i.f)/b,on:!0}}return{pos:new l(0,0,5),quat:new A,fov:40,on:!1}}function Q(a,e,t,n,s){const o=tt(a,Math.max(0,e),n,s);if(t.on){const r=ye(n,s);return{pos:new l(o.x*n/r,-o.y*s/r,o.depth),zoom:o.zoom}}const i=2*(5-o.depth)*Math.tan(t.fov*b/2);return{pos:new l(o.x*i*(n/s),-o.y*i,o.depth),zoom:o.zoom}}function ve(a){const e=a.modelRotation||{x:0,y:0,z:0};return new l(0,1,0).applyEuler(new $(e.x*b,e.y*b,e.z*b)).normalize()}function Me(a,e,t,n,s){const o=Math.min(48,Math.max(2,Math.ceil(a.duration/.1)));let i=1/0;for(let r=0;r<=o;r++){const c=a.duration*r/o;i=Math.min(i,Q(a,c,I(a,c,t,n,s),n,s).pos.dot(e))}return i}function xt(a,e,t,n,s,o){const i=new me(a.fov,s/o,.01,100);i.position.copy(a.pos),i.quaternion.copy(a.quat),i.updateMatrixWorld(!0),i.updateProjectionMatrix();const r=new fe;return r.setFromCamera(new we(e[0]*2-1,1-e[1]*2),i),r.ray.intersectPlane(new _(t.clone(),-n),new l)}function vt(a,e,t,n,s,o,i){const r=I(a,e,t,n,s),{pos:c,zoom:h}=Q(a,e,r,n,s),m={x:K(a,"rx",e),y:K(a,"ry",e),z:K(a,"rz",e)},d=a.modelSpin||{x:0,y:0,z:0},f=(a.inPoint||0)+e,v=new $((m.x+d.x*f)*b,(m.y+d.y*f)*b,(m.z+d.z*f)*b),u=ve(a),g=gt*h,x=!!a.modelLaunch||!!a.modelLook?i??Me(a,u,t,n,s):null,w=a.modelLaunch,y=w?Ze(w,e):null;if(w&&y){const E=Q(a,w.at,I(a,w.at,t,n,s),n,s).pos,F=E.clone().addScaledVector(u,x-E.dot(u)),ee=xt(I(a,w.at+w.duration,t,n,s),w.to,u,x,n,s)??F.clone(),ze=F.clone().lerp(ee,y.g),L=ee.clone().sub(F);L.addScaledVector(u,-L.dot(u));const Ae=$e(y,L.length()/g);let D;if(w.face!==!1&&L.lengthSq()>1e-8){const Y=L.normalize(),te=new l().crossVectors(u,Y).normalize(),Ce=new l().crossVectors(Y,te);D=new A().setFromRotationMatrix(new H().makeBasis(te,Ce,Y))}else D=new A().setFromEuler(v);D.multiply(new A().setFromAxisAngle(new l(1,0,0),-Ae*b)).multiply(new A().setFromAxisAngle(new l(0,0,1),y.roll*b));const U=y.jolt*.035*g,Pe=new l(Math.sin(e*91)*U,Math.sin(e*67+1)*U*.6,Math.sin(e*53+2)*U);return{cam:r,pos:ze.addScaledVector(u,o*h+y.h*g).add(Pe),quat:D,zoom:h,N:u,d:x,len:g}}const z=new A().setFromEuler(v),O=c.clone();return a.modelGround&&O.add(new l(0,1,0).applyQuaternion(z).multiplyScalar(o*h)),{cam:r,pos:O,quat:z,zoom:h,N:u,d:x,len:g}}function Mt(a,e,t){const n=new l(1,0,0).applyQuaternion(t.quat),o=e.clone().cross(n).normalize().clone().negate(),i=new l().crossVectors(e,o).normalize(),r=a.azimuth*b,c=a.elevation*b;return o.multiplyScalar(Math.cos(c)*Math.cos(r)).addScaledVector(i,Math.cos(c)*Math.sin(r)).addScaledVector(e,Math.sin(c)).normalize()}const be=new Map,J=new Set,bt=a=>a?be.get(a):void 0;function St(a){return J.add(a),()=>{J.delete(a)}}const ce=(a,e)=>a.name||`Animation ${e+1}`,Se=new Map,zt=a=>a?Se.get(a):void 0,j=600,At="attribute float aAlpha;attribute float aSize;varying float vA;uniform float uScale;void main(){vA=aAlpha;vec4 mv=modelViewMatrix*vec4(position,1.);gl_PointSize=aSize*uScale/max(.05,-mv.z);gl_Position=projectionMatrix*mv;}",Pt="uniform vec3 uColor;varying float vA;void main(){vec2 d=gl_PointCoord-.5;float r=length(d);if(r>.5)discard;gl_FragColor=vec4(uColor,vA*smoothstep(.5,.05,r));}";let V=null;function Ct(){if(V)return V;const a=document.createElement("canvas");a.width=a.height=128;const e=a.getContext("2d"),t=e.createRadialGradient(64,64,0,64,64,64);return t.addColorStop(0,"rgba(0,0,0,1)"),t.addColorStop(.35,"rgba(0,0,0,.75)"),t.addColorStop(.7,"rgba(0,0,0,.22)"),t.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=t,e.fillRect(0,0,128,128),V=new le(a),V}class kt{canvas;renderer;scene=new Le;camera=new me(40,1,.01,100);halfY=0;group=new k;disposed=!1;mixer=null;clips=[];action=null;rest=[];width;height;screen=null;pieces=[];dust=null;cut=[new _,new _];guides=null;buildOn=!1;constructor(e,t){this.width=e,this.height=t,this.renderer=new Ie({alpha:!0,antialias:!0,preserveDrawingBuffer:!0}),this.renderer.setPixelRatio(1),this.renderer.setSize(e,t,!1),this.renderer.setClearColor(0,0),this.canvas=this.renderer.domElement,this.camera.aspect=e/t,this.camera.position.set(0,0,5),this.camera.lookAt(0,0,0),this.camera.updateProjectionMatrix(),this.scene.add(this.group,this.hemi,this.key,this.key.target),this.key.position.set(3,5,5)}hemi=new qe(16777215,7829367,3);key=new De(16777215,3);catcher=null;contact=null;lookEnv=null;lookOn=!1;groundCache=null;applyLook(e){const t=this.renderer;if(!e){if(!this.lookOn)return;this.lookOn=!1,t.shadowMap.enabled=!1,t.toneMapping=Re,t.toneMappingExposure=1,this.hemi.color.set(16777215),this.hemi.groundColor.set(7829367),this.hemi.intensity=3,this.key.color.set(16777215),this.key.intensity=3,this.key.castShadow=!1,this.key.position.set(3,5,5),this.key.target.position.set(0,0,0),this.scene.environment===this.lookEnv&&(this.scene.environment=null),this.catcher&&(this.catcher.visible=!1),this.contact&&(this.contact.visible=!1);return}if(!this.lookOn&&(this.lookOn=!0,t.shadowMap.enabled=!0,t.shadowMap.type=je,this.key.castShadow=!0,this.key.shadow.mapSize.set(2048,2048),this.key.shadow.bias=-4e-4,this.key.shadow.normalBias=.02,this.group.traverse(n=>{const s=n;s.isMesh&&(s.castShadow=!0,s.receiveShadow=!0)}),this.catcher||(this.catcher=new p(new N(1,1),new Ve({opacity:.4,depthWrite:!1})),this.catcher.receiveShadow=!0,this.catcher.renderOrder=-2,this.scene.add(this.catcher)),this.contact||(this.contact=new p(new N(1,1),new Z({map:Ct(),transparent:!0,depthWrite:!1,color:0})),this.contact.renderOrder=-1,this.scene.add(this.contact)),!this.lookEnv&&!this.screen)){const n=new he(t);this.lookEnv=n.fromScene(new ge,.04,.1,100,{size:128}).texture,n.dispose()}t.toneMapping=_e,t.toneMappingExposure=e.exposure,!this.screen&&this.lookEnv&&(this.scene.environment=this.lookEnv),this.scene.environmentIntensity=e.env,this.hemi.color.set(e.ambient),this.hemi.groundColor.set(e.ambient).multiplyScalar(.45),this.hemi.intensity=e.ambientIntensity,this.key.color.set(e.color),this.key.intensity=e.intensity,this.key.shadow.radius=1+e.softness*9,this.key.shadow.blurSamples=8+Math.round(e.softness*16),this.catcher.material.opacity=e.shadow,this.catcher.visible=e.shadow>0}groundFor(e,t){const n=JSON.stringify([e.id,e.start,e.duration,e.posX,e.posY,e.spatialDepth,e.modelDepth,e.scale,e.motionKeys,e.modelRotation,e.parentId,t?JSON.stringify(t):""]);if(this.groundCache?.key===n)return this.groundCache.d;const s=Me(e,ve(e),t,this.width,this.height);return this.groundCache={key:n,d:s},s}async load(e){const t=await Qe(e);this.add(await new se().loadAsync(t),e)}async loadBuffer(e,t){this.add(await new se().parseAsync(e,""),t)}async loadDevice(e){if(!e.device)throw Error("Không phải thiết bị 3D");const t=ft(e.device);this.scene.environment=wt(this.renderer),this.addObject(t.object),!this.disposed&&(this.screen=new yt(t.screen,t.screenAspect,e.deviceScreen),await this.screen.whenReady())}async prepare(e){await this.screen?.sync(e,!0)}addObject(e){if(this.disposed){this.disposeObject(e);return}const t=new P().setFromObject(e),n=t.getSize(new l),s=Math.max(n.x,n.y,n.z);e.scale.setScalar(1.8/s),e.updateMatrixWorld(!0),this.halfY=n.y*1.8/s/2,e.position.sub(new P().setFromObject(e).getCenter(new l)),e.updateMatrixWorld(!0),this.group.add(e)}add(e,t){if(this.disposed){this.disposeObject(e.scene);return}const s=new P().setFromObject(e.scene).getSize(new l),o=Math.max(s.x,s.y,s.z);if(!Number.isFinite(o)||o<=0)throw Error("GLB không có hình học hợp lệ");e.scene.scale.setScalar(1.8/o),e.scene.updateMatrixWorld(!0);const i=new P().setFromObject(e.scene).getCenter(new l);e.scene.position.sub(i),e.scene.updateMatrixWorld(!0),this.halfY=s.y*1.8/o/2,this.group.add(e.scene),this.clips=e.animations||[],this.clips.length&&(this.mixer=new Ge(e.scene),e.scene.traverse(r=>{r!==e.scene&&this.rest.push({o:r,p:r.position.clone(),q:r.quaternion.clone(),s:r.scale.clone()})})),this.collectPieces(e.scene),Se.set(t,this.pieces.length),be.set(t,this.clips.map((r,c)=>({name:ce(r,c),duration:r.duration}))),J.forEach(r=>r())}collectPieces(e){this.group.updateMatrixWorld(!0);const t=[];e.traverse(c=>{c.isMesh&&t.push(c)});const n=new P().setFromObject(e),s=c=>{const h=c.getSize(new l);return h.x*h.y*h.z},o=s(n)*.02,i=n.getSize(new l),r=i.x*i.z;for(const c of t.slice(0,oe.maxPieces)){const h=new P().setFromObject(c),m=h.getCenter(new l),d=h.getSize(new l),f=new H().copy(c.parent.matrixWorld).invert();this.pieces.push({o:c,p:c.position.clone(),q:c.quaternion.clone(),s:c.scale.clone(),toParent:new Be().setFromMatrix4(f),box:{bottom:h.min.y,cx:m.x,cz:m.z,h:d.y,r:Math.max(d.x,d.z)/2,big:s(h)>o,base:d.x*d.z>=r*.25&&h.min.y<=n.min.y+i.y*.03}})}}build(e,t){let n=null;try{n=e.modelBuild?nt(e.modelBuild):null}catch{n=null}const s=new Set;this.group.traverse(i=>{const r=i.material;if(r)for(const c of Array.isArray(r)?r:[r])s.add(c)});const o=[];if(n){const i=st(this.pieces.map(h=>h.box),n);this.pieces.forEach((h,m)=>{const d=ot(n.style,h.box,i[m],t,m,n.seed);h.o.position.copy(h.p),h.o.quaternion.copy(h.q),h.o.scale.copy(h.s),h.o.visible=d.visible,(d.dx||d.dy||d.dz)&&h.o.position.add(new l(d.dx,d.dy,d.dz).applyMatrix3(h.toParent)),(d.rx||d.ry||d.rz)&&h.o.quaternion.multiply(new A().setFromEuler(new $(d.rx,d.ry,d.rz)))}),this.group.updateMatrixWorld(!0);const r=new l(0,1,0).applyQuaternion(this.group.getWorldQuaternion(new A)).normalize();it(n,t)&&o.push(this.cut[0].setFromNormalAndCoplanarPoint(r,this.group.localToWorld(new l(0,-this.halfY,0))));const c=at(n,t,this.halfY);c!==null&&o.push(this.cut[1].setFromNormalAndCoplanarPoint(r.clone().negate(),this.group.localToWorld(new l(0,c,0)))),this.dustAt(rt(this.pieces.map(h=>h.box),i,n,t,j),n.dustColor),this.buildOn=!0}else{for(const i of this.pieces)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s),i.o.visible=!0;this.dustAt([],oe.dustColor),this.buildOn=!1}this.renderer.localClippingEnabled=o.length>0;for(const i of s){const r=o.length?o:null;i.clippingPlanes!==r&&(i.clippingPlanes?.length||r)&&(i.clippingPlanes=r,i.needsUpdate=!0)}}dustAt(e,t){if(!e.length&&!this.dust)return;if(!this.dust){const r=new ne;r.setAttribute("position",new X(new Float32Array(j*3),3)),r.setAttribute("aAlpha",new X(new Float32Array(j),1)),r.setAttribute("aSize",new X(new Float32Array(j),1));const c=new We({uniforms:{uColor:{value:new ue(t)},uScale:{value:this.height*1.2}},vertexShader:At,fragmentShader:Pt,transparent:!0,depthWrite:!1});this.dust=new Ue(r,c),this.dust.frustumCulled=!1,this.group.add(this.dust)}const n=this.dust.geometry,s=n.getAttribute("position"),o=n.getAttribute("aAlpha"),i=n.getAttribute("aSize");e.forEach((r,c)=>{s.setXYZ(c,r[0],r[1],r[2]),o.setX(c,r[3]),i.setX(c,r[4])}),n.setDrawRange(0,e.length),s.needsUpdate=o.needsUpdate=i.needsUpdate=!0,this.dust.material.uniforms.uColor.value.set(t)}setGuides(e,t=4){if(!e){this.guides&&(this.scene.remove(this.guides),this.disposeObject(this.guides),this.guides=null);return}if(this.guides)return;const n=new k,s=new Ye(t,16,6742271,2781056);s.rotation.x=Math.PI/2;for(const i of Array.isArray(s.material)?s.material:[s.material])i.transparent=!0,i.opacity=.85,i.depthWrite=!1;const o=(i,r)=>new Ke(new ne().setFromPoints([new l,i]),new Ne({color:r}));n.add(s,o(new l(.5,0,0),16731469),o(new l(0,.5,0),5111674),o(new l(0,0,.5),5086207)),this.guides=n,this.scene.add(n)}surfaceAt(e,t){const n=new fe;n.setFromCamera(new we(e/this.width*2-1,1-t/this.height*2),this.camera);const s=n.ray.intersectPlane(new _(new l(0,0,1),0),new l);return s?{x:s.x,y:s.y}:null}pose(e,t){if(!this.mixer)return;const n=e.modelAnim,s=n?this.clips.find((i,r)=>ce(i,r)===n.clip):void 0;if(!n||!s){if(this.action){this.mixer.stopAllAction(),this.action=null;for(const i of this.rest)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s)}return}const o=this.mixer.clipAction(s);this.action!==o&&(this.mixer.stopAllAction(),o.setLoop(Xe,1/0),o.play(),this.action=o),o.time=ct(n,s.duration,t,e.inPoint||0),this.mixer.update(0)}render(e,t,n=!1,s){const o=e.modelLook?ht(e.modelLook):null;this.applyLook(o);const i=this.width,r=this.height,c=e.modelLook||e.modelLaunch?this.groundFor(e,s):void 0,h=vt(e,t,s,i,r,this.halfY,c);this.camera.position.copy(h.cam.pos),this.camera.quaternion.copy(h.cam.quat),this.camera.fov=h.cam.fov,this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(!0),this.group.scale.setScalar(h.zoom),this.group.quaternion.copy(h.quat),this.group.position.copy(h.pos),this.pose(e,t),(e.modelBuild||this.buildOn)&&this.build(e,t),o&&this.placeShadows(e,o,h.N,h.d??0,h.len,s),n&&this.screen?.sync(t),this.renderer.render(this.scene,this.camera),n&&this.publish(e.id)}placeShadows(e,t,n,s,o,i){const r=this.group.getWorldPosition(new l),c=r.dot(n)-s,h=r.clone().addScaledVector(n,-c),m=new A().setFromUnitVectors(new l(0,0,1),n),d=Math.max(0,c-this.halfY*this.group.scale.x),f=Math.max(6*o,d*4+3*o);this.catcher.position.copy(h).addScaledVector(n,.001*o),this.catcher.quaternion.copy(m),this.catcher.scale.set(f,f,1);const v=new P().setFromObject(this.group),u=v.getSize(new l),g=Math.max(.2*o,Math.hypot(u.x,u.y,u.z)-Math.abs(u.clone().dot(n)))*.62,M=Math.max(0,1-d/(.8*o));this.contact.visible=t.contact>0&&M>0,this.contact.position.copy(h).addScaledVector(n,.002*o),this.contact.quaternion.copy(m),this.contact.scale.set(g*(1+d/o),g*.75*(1+d/o),1),this.contact.material.opacity=t.contact*.85*M;const x=Mt(t,n,I(e,0,i,this.width,this.height)),w=12*o;this.key.target.position.copy(h),this.key.position.copy(h).addScaledVector(x,w),this.key.target.updateMatrixWorld();const y=this.key.shadow.camera,z=f*.6;y.left=-z,y.right=z,y.top=z,y.bottom=-z,y.near=Math.max(.01,w-4*o-d),y.far=w+4*o+d,y.updateProjectionMatrix()}publish(e){const t=new P().setFromObject(this.group);if(t.isEmpty())return;let n=1/0,s=1/0,o=-1/0,i=-1/0;for(const r of[t.min.x,t.max.x])for(const c of[t.min.y,t.max.y])for(const h of[t.min.z,t.max.z]){const m=new l(r,c,h).project(this.camera),d=(m.x+1)/2*this.width,f=(1-m.y)/2*this.height;n=Math.min(n,d),o=Math.max(o,d),s=Math.min(s,f),i=Math.max(i,f)}dt.set(e,{cx:(n+o)/2,cy:(s+i)/2,w:o-n,h:i-s,angle:0,W:this.width,H:this.height})}async frame(e){const t=await new Promise(o=>(e??this.canvas).toBlob(o,"image/webp",.8));if(!t)throw Error("Không xuất được frame 3D");const n=new Uint8Array(await t.arrayBuffer());let s="";for(let o=0;o<n.length;o+=16384)s+=String.fromCharCode(...n.subarray(o,o+16384));return btoa(s)}disposeObject(e){e.traverse(t=>{const n=t;n.geometry?.dispose();for(const s of n.material?Array.isArray(n.material)?n.material:[n.material]:[]){for(const o of Object.values(s))o instanceof de&&o.dispose();s.dispose()}})}dispose(){this.disposed=!0,this.screen?.dispose(),this.screen=null,this.mixer?.stopAllAction(),this.disposeObject(this.group),this.renderer.dispose(),this.canvas.remove()}}const It=Object.freeze(Object.defineProperty({__proto__:null,Timeline3DScene:kt,modelAnimations:bt,modelPieces:zt,onModelAnimations:St},Symbol.toStringTag,{value:"Module"}));export{kt as T,zt as a,dt as l,bt as m,St as o,It as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c1 as E,eQ as M,eR as D,lV as F,eS as v}from"./titleFrameBudget-BYRZAQPs.js";import{T as C}from"./timeline3d-246tBEJl.js";import{wantsFrame as u,SKIPPED_FRAME as L}from"./frameSink-BvOXjLuw.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./api-DUp403BK.js";import"./RoomEnvironment-Dmv_G5ka.js";const d=6;async function T(p,w,a,g,f){const{width:s,height:c,fps:r}=E(w),b=M(D(p));for(const e of p.filter(l=>l.kind==="model")){if(!u(a,"modelFrames",e.id))continue;if(!e.gcsUri&&!e.device)throw Error("Clip 3D chưa có GLB");const l=Math.ceil(e.duration*r);if(l>3600)throw Error("Mỗi clip 3D tối đa 2 phút khi xuất MP4. Hãy chia clip dài thành nhiều đoạn.");const o=new C(s,c),h=e.modelLook?F(e.modelLook).blur:e.motionBlur?.5:0,m=h>0?Object.assign(document.createElement("canvas"),{width:s,height:c}):null,t=m?.getContext("2d");try{e.device?await o.loadDevice(e):await o.load(e.gcsUri);for(let i=0;i<l;i++){if(g?.aborted)throw new DOMException("Export cancelled","AbortError");if(!u(a,"modelFrames",e.id,i)){await a.push("modelFrames",e.id,L);continue}if(v(b),await o.prepare(i/r),m&&t){t.globalCompositeOperation="copy",t.clearRect(0,0,s,c),t.globalCompositeOperation="lighter",t.globalAlpha=1/d;for(let n=0;n<d;n++){const x=Math.max(0,Math.min(e.duration,i/r+(n/(d-1)-.5)*h/r));o.render(e,x,!1,f),t.drawImage(o.canvas,0,0)}t.globalAlpha=1,t.globalCompositeOperation="source-over",await a.push("modelFrames",e.id,await o.frame(m))}else o.render(e,i/r,!1,f),await a.push("modelFrames",e.id,await o.frame());i%8===0&&await new Promise(n=>setTimeout(n,0))}}finally{o.dispose()}}}export{T as render3DFrames};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as R,au as b,ik as C,eO as nt,eP as ot,eQ as Mt,jb as bt,i7 as F,F as vt,fn as _t,gT as it,ec as L,g$ as at,h3 as St,gU as Pt,gW as $t,fs as tt,jf as rt,m as E,l as A,gS as st,fc as J,lI as ut,lJ as K,iq as et,ea as q,d5 as dt,lK as lt,h as U,s as pt,h$ as Ot,i0 as Et}from"./titleFrameBudget-Cml-MO53.js";const $=1/vt,w=1e-6,X=t=>typeof t=="number"&&Number.isFinite(t);function jt(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t)||Object.keys(t).some(i=>i!=="in"&&i!=="out")||!X(t.in)||!X(t.out))throw Error("Invalid export range");const n=b(t.in),e=b(t.out);if(n<0||e>R||e-n<$-w)throw Error("Invalid export range");return{in:n,out:e}}function B(t,n){if(t==null&&n==null)return null;const e=jt({in:t??0,out:n??R});return e.in<=w&&e.out>=R-w?null:e}function Gt(t,n,e){const i=Math.max(0,Math.min(R,b(e))),o=t?.in??0,s=t?.out??R;try{return n==="in"?i>=R-$+w?void 0:B(i,i>=s-w?null:s):i<$-w?void 0:B(i<=o+w?null:o,i)}catch{return}}function Qt(t,n,e,i){if(!(i>=$))return t??null;const o=t?.in??0,s=t?.out??R;try{if(n==="in")return B(Math.max(0,Math.min(b(e),b(Math.min(s,i)-$))),s>=R-w?null:s);const f=Math.max(b(o+$),Math.min(b(e),i));return B(o,f>=i-w?null:f)}catch{return t??null}}function Zt(t,n){if(!t||!X(t.in)||!X(t.out)||!(n>0))return null;const e=Math.max(0,Math.min(n,t.in)),i=Math.max(0,Math.min(n,t.out));return i-e<$-w||e<=w&&i>=n-w?null:{in:e,out:i}}function Rt(t,n,e){if(!t||!Array.isArray(t.motionKeys)||!t.motionKeys.length)return t;let i={...t,motionKeys:[]};for(const o of St){const s=Pt(t,o);if(!s.length)continue;const f=s.some(a=>a.time<n-w),l=s.some(a=>a.time>e+w),p=[...s].reverse().find(a=>a.time<=n+w);i=$t(i,o,[...f?[{time:0,value:tt(t,o,n),...p?.ease!==void 0?{ease:p.ease}:{}}]:[],...s.filter(a=>(f?a.time>n+w:a.time>=n-w)&&(l?a.time<e-w:a.time<=e+w)).map(a=>({...a,time:Math.max(0,b(a.time-n))})),...l?[{time:b(e-n),value:tt(t,o,e)}]:[]])}return i}const At=t=>[...t.parentId?[t.parentId]:[],...Array.isArray(t.shape?.items)?t.shape.items.flatMap(n=>n?.pins&&typeof n.pins=="object"?Object.values(n.pins):[]):[]];function Tt(t,n,e,i,o,s){const f=n.find(I=>I.id===t.id)??t,l=t.start+t.duration<=e+w?t.duration:0,p=_t(f,l,o,s),a=p.sx??1,r=p.sy??1,v=it("image",t.track)?t.track:0;return{...at({id:t.id,track:v,start:0,duration:i,label:String(t.label||"Null").slice(0,160)}),posX:p.x,posY:p.y,scale:p.zoom,rotation:p.rot,anchorX:L(t,"ax",l),anchorY:L(t,"ay",l),...a!==1||r!==1?{motionKeys:[{time:0,sx:a,sy:r}]}:{}}}function G({clips:t,camera:n=null},e,{W:i=1280,H:o=720}={}){if(!e||!Array.isArray(t))return{clips:t,camera:n};const s=e.in,f=e.out,l=b(f-s),p=[];for(const m of t){if(m.start+m.duration<=s+w||m.start>=f-w)continue;let k=m;if(k.start<s-w){const x=b(s-k.start);if(k.duration-x<$-w)continue;if(x>=$-w){const _=C(k,s,`${m.id}~in`);_.length===2&&(k={..._[1],id:m.id})}}if(k.start+k.duration>f+w){const x=b(f-k.start);if(x<$-w)continue;k.duration-x>=$-w&&(k=C(k,f,`${m.id}~out`)[0])}p.push({...k,start:Math.max(0,b(k.start-s))})}const a=new Set(p.map(m=>m.id)),r=new Map(t.map(m=>[m.id,m])),v=[...new Set(p.flatMap(At))].filter(m=>!a.has(m)&&r.get(m)&&!r.get(m).disabled&&r.get(m).kind!=="audio");let I=[];if(v.length){const m=nt(ot(t.filter(k=>!k.disabled)));Mt(m),I=v.map(k=>Tt(r.get(k),m,s,l,i,o))}const y=new Set([...a,...I.map(m=>m.id)]);return{clips:[...p.map(m=>{const k=r.get(m.id),x=[];let _=m;if(m.parentId&&!y.has(m.parentId)&&x.push("parentId"),m.matte&&!a.has(m.matte.source)&&(x.push("matte"),m.matte.mode?.endsWith("-inverted")||(_={...m,opacity:0,motionKeys:bt(m,"opacity",[])})),m.transition&&k&&F(t,k)&&!F(p,m)&&x.push("transition"),m.join&&k&&F(t,k)&&!F(p,m)&&x.push("join"),!x.length)return _;_={..._};for(const T of x)delete _[T];return _}),...I],camera:Rt(n,s,f)}}const j=t=>!!t&&!!t.comp&&Array.isArray(t.comp.clips),D=">",Q=t=>j(t)?1+Math.max(0,...t.comp.clips.map(Q)):0,mt=t=>j(t)?t.comp.clips.reduce((n,e)=>n+1+mt(e),0):0,Ft=t=>j(t)?Math.max(0,...t.comp.clips.map(n=>n.start+n.duration)):0,ft=t=>{let n=1;for(;t.some(e=>e.label===`Comp ${n}`);)n++;return`Comp ${n}`},z=t=>String(t).padStart(3,"0"),V=["x","y","zoom","rot","ax","ay"],Kt={x:0,y:0,zoom:1,rot:0,ax:0,ay:0};function Z(t){return t.parentId||V.some(n=>q(t,n).length||Math.abs(L(t,n,0)-Kt[n])>1e-9)?!0:["enter","exit"].some(n=>t[n]&&t[n].type!=="fade")}const ct=t=>q(t,"opacity").length>0||["enter","exit"].some(n=>t[n]&&(t[n].type==="fade"||t[n].fade!==!1));function ht(t,n){const e=[];for(const o of t.motionKeys||[]){const s={time:o.time};for(const l of V)Number.isFinite(o[l])&&(s[l]=o[l]);if(Object.keys(s).length===1)continue;const f=o.ease&&Object.fromEntries(Object.entries(o.ease).filter(([l])=>V.includes(l)));f&&Object.keys(f).length&&(s.ease=f),e.push(s)}const i=Object.fromEntries(["posX","posY","scale","rotation","anchorX","anchorY","parentId","zIndex","enter","exit"].filter(o=>t[o]!==void 0).map(o=>[o,t[o]]));return{...at({id:n,track:t.track,start:t.start,duration:t.duration,label:t.label}),...i,motionKeys:e,_comp:t.id}}function zt(t,n){if(Math.abs(n-1)<1e-9)return t;const e=q(t,"opacity"),i={...t,opacity:(t.opacity??1)*n};return e.length?{...i,...dt(i,"opacity",e.map(o=>({...o,value:o.value*n})))}:i}function Nt(t,n){const e=Math.max(1,Math.ceil(t.duration*60-1e-6)),i=[];for(let o=0;o<=e;o++){const s=Math.min(t.duration,o/60);i.push({time:+s.toFixed(6),value:Math.max(0,Math.min(1,L(t,"opacity",s)*n(s)))})}return{...t,...dt(t,"opacity",i)}}function W(t,n){const e={...t},i=o=>n(o);if(e.parentId!==void 0){const o=i(e.parentId);o?e.parentId=o:delete e.parentId}if(e.matte?.source!==void 0){const o=i(e.matte.source);o?e.matte={...e.matte,source:o}:delete e.matte}e._virtual!==void 0&&(e._virtual=i(e._virtual)??e._virtual),typeof e.space=="string"&&(e.space=i(e.space)??e.space);for(const o of["bend","vfx"])typeof e[o]?.source=="string"&&(e[o]={...e[o],source:i(e[o].source)??e[o].source});return Array.isArray(e.shape?.items)&&e.shape.items.some(o=>o?.pins)&&(e.shape={...e.shape,items:e.shape.items.map(o=>o?.pins&&typeof o.pins=="object"?{...o,pins:Object.fromEntries(Object.entries(o.pins).map(([s,f])=>[s,i(f)??f]))}:o)}),e}const Dt=t=>{if(t.transition===void 0&&t.join===void 0)return t;const{transition:n,join:e,...i}=t;return i};function H(t){const n=t.comp.tracks||{};return t.comp.clips.filter(e=>!e.disabled&&!(e.kind!=="audio"&&n[e.track]?.hidden)).map(e=>n[e.track]?.muted?{...e,volume:0}:e)}function kt(t,n,e,i){const o=t.inPoint||0,s=t.start-o;return G({clips:n},{in:o,out:o+t.duration},{W:e,H:i}).clips.map(l=>{const p={...l,start:b(t.start+l.start)};for(const a of["_txIn","_txOut"])p[a]&&(p[a]={...p[a],t0:p[a].t0+s});return p})}function Lt(t,n){const e=t.inPoint||0;if(U(t)&&!t.reverse)return e+pt(t,Math.max(0,Math.min(t.duration,n)));const i=t.playbackRate||1,o=Math.max(0,Math.min(t.duration,n));return e+(t.reverse?Math.max(0,t.duration-o-1/30):o)*i}function yt(t){const n=t.inPoint||0,e=U(t)&&!t.reverse?pt(t,t.duration):t.duration*(t.playbackRate||1);return{from:n,to:n+e}}function wt(t){const n=H(t),e=new Set(n.map(o=>o.id)),i=`${t.id}${D}`;return n.map(o=>({...W(o,s=>e.has(s)?i+s:null),id:i+o.id}))}function It(t,{W:n=1280,H:e=720}={}){const{from:i,to:o}=yt(t);return G({clips:wt(t)},{in:i,out:o},{W:n,H:e}).clips.map(s=>({...s,volume:0}))}function Ut(t,{W:n=1280,H:e=720}={}){const i=[],o=(s,f)=>{for(const l of s)if(l?._group&&j(l)&&f<K){const p=N(It(l,{W:n,H:e}),{W:n,H:e});i.push(p),o(p,f+1)}};return o(N(t||[],{W:n,H:e}),0),i}function Xt(t,n,e,i){if(t.reverse||U(t))return[];const o=t.playbackRate||1,s=t.inPoint||0,f=`${t.id}${D}`,l=N(H(t),{W:e,H:i,depth:n+1}).filter(a=>a.url&&(a.volume??1)>0&&(a.kind==="audio"||a.kind==="video"&&!a.freeze&&!a.reverse));return G({clips:l},{in:s,out:s+t.duration*o},{W:e,H:i}).clips.flatMap(a=>{const r=(a.playbackRate||1)*o;return r>8||U(a)&&o!==1?[]:[{...Object.fromEntries(["nodeId","url","gcsUri","label","inPoint","sourceDuration","audioFx","duck","muffle"].filter(I=>a[I]!==void 0).map(I=>[I,a[I]])),id:`${f}${a.id}~a`,kind:"audio",track:a.kind==="audio"?a.track:st[0],start:b(t.start+a.start/o),duration:Math.max(1/30,b(a.duration/o)),volume:(a.volume??1)*(t.volume??1),...r!==1?{playbackRate:r}:{},...a.speedRamp&&o===1?{speedRamp:a.speedRamp}:{},...a.audioFadeIn?{audioFadeIn:a.audioFadeIn/o}:{},...a.audioFadeOut?{audioFadeOut:a.audioFadeOut/o}:{},_comp:t.id,_slot:`§a${f}${a.id}`}]})}function gt(t,n,e){let i=n;return n.kind!=="audio"&&!n.nullLayer&&(i=e!==null?zt(i,e):Nt(i,o=>J(t,i.start-t.start+o).opacity)),t.volume!==void 0&&t.volume!==1&&(n.kind==="video"||n.kind==="audio")&&(i={...i,volume:(i.volume??1)*t.volume}),t.lookBypass&&(i={...i,lookBypass:!0}),i}function Bt(t,n,e,i,o){if(n>=K)return[];t={...t,...rt(t)};let s=nt(ot(H(t))).map(Dt);s=N(s,{W:e,H:i,depth:n+1});const f=kt(t,s,e,i),l=new Set(f.map(y=>y.id)),p=`${t.id}${D}`,a=o?`${p}~comp`:null,r=ct(t)?null:J(t,0).opacity,v=[...new Set(f.filter(y=>y.kind!=="audio").map(y=>`${z((y.zIndex??0)+200)}:${z(E(y.track)+1)}`))].sort(),I=f.map(y=>{let g=W(y,m=>l.has(m)?p+m:null);return g={...gt(t,g,r),id:p+y.id,_comp:t.id,...g.parentId===void 0&&a&&y.kind!=="audio"?{parentId:a}:{}},y.kind!=="audio"?(g.track=t.track,g._slot=`§${z(v.indexOf(`${z((y.zIndex??0)+200)}:${z(E(y.track)+1)}`))}${y._slot??""}`,t.zIndex!==void 0?g.zIndex=t.zIndex:delete g.zIndex):g._slot=`§${y._slot??""}${y.id}`,g});return I.sort((y,g)=>y._slot<g._slot?-1:y._slot>g._slot?1:0),a?[ht(t,a),...I]:I}function N(t,{W:n=1280,H:e=720,depth:i=0}={}){if(!Array.isArray(t)||!t.some(r=>j(r)&&!r._group))return t;const o=new Set(t.filter(r=>r.transition).map(r=>F(t,r)?.id).filter(Boolean)),s=r=>lt(r)||o.has(r.id),f=new Set(t.filter(r=>r.parentId).map(r=>r.parentId)),l=new Set(t.filter(r=>j(r)&&!s(r)).map(r=>r.id)),p=new Map,a=[];for(const r of t){if(!j(r)||r._group){a.push(r);continue}if(r.disabled)continue;if(s(r)){i<K&&a.push({...r,_group:!0},...Xt(r,i,n,e));continue}const v=Z(r)||f.has(r.id);v&&p.set(r.id,`${r.id}${D}~comp`),a.push(...Bt(r,i,n,e,v))}return a.map(r=>{if(r.parentId&&p.has(r.parentId))return{...r,parentId:p.get(r.parentId)};if(r.matte&&l.has(r.matte.source)){const{matte:v,...I}=r;return I}return r})}function Yt(t,n,{id:e,label:i,tracks:o={},W:s=1280,H:f=720}={}){const l=new Set(n||[]),p=t.filter(u=>l.has(u.id));if(!p.length)throw Error("Precompose: select at least one layer");if(!p.some(u=>u.kind!=="audio"))throw Error("Precompose needs at least one picture layer");if(p.some(u=>o[u.track]?.locked))throw Error("Track đã khóa");if(1+Math.max(0,...p.map(Q))>K)throw Error(`Comps nest at most ${K} deep`);const a=t.filter(u=>!l.has(u.id)),r=[...p.filter(u=>u.matte&&!l.has(u.matte.source)),...a.filter(u=>u.matte&&l.has(u.matte.source))];if(r.length)throw Error(`Precompose: the track matte of "${r[0].label||r[0].id}" crosses the comp's edge — take the matte layer in too, or remove the matte`);const v=b(Math.min(...p.map(u=>u.start))),I=b(Math.max(...p.map(u=>u.start+u.duration))),y=Math.max(1/30,b(I-v)),g=u=>a.some(c=>c.track===u&&c.kind!=="audio"&&c.start<I-1e-6&&c.start+c.duration>v+1e-6)||o[u]?.locked,m=[...new Set(p.filter(u=>u.kind!=="audio").map(u=>u.track))].sort((u,c)=>E(c)-E(u));let k=m.find(u=>!g(u));for(let u=E(m[0])+1;k===void 0;u++)g(A(u))||(k=A(u));const x=u=>F(t,u),_=p.map(u=>{let c={...u};return c.parentId&&!l.has(c.parentId)&&(c={...c,...et(t,u,null,0,s,f)}),c.transition&&!l.has(x(u)?.id)&&delete c.transition,c.join&&!l.has(x(u)?.id)&&delete c.join,c.parentId===void 0&&delete c.parentId,{...c,start:b(u.start-v)}}),T=a.map(u=>{let c=u;return u.parentId&&l.has(u.parentId)&&(c={...c,...et(t,u,null,0,s,f)},c.parentId===void 0&&(c={...c},delete c.parentId)),(c.transition||c.join)&&l.has(x(u)?.id)&&(c={...c},delete c.transition,delete c.join),c}),O=[...new Set(p.map(u=>u.track))].filter(u=>o[u]?.hidden||o[u]?.muted),Y=Object.fromEntries(O.map(u=>[u,{...o[u].hidden?{hidden:!0}:{},...o[u].muted?{muted:!0}:{}}])),P={id:e||`comp-${Date.now().toString(36)}`,nodeId:"",kind:"image",url:"",label:i||ft(t),track:k,start:v,duration:y,inPoint:0,sourceDuration:y,motionV:2,comp:{clips:_,...O.length?{tracks:Y}:{}}};return{clips:[...T,P],id:P.id,track:k}}function Vt(t,n,{tracks:e={},W:i=1280,H:o=720,newId:s=()=>`null-${Math.random().toString(36).slice(2,9)}`}={}){const f=t.find(d=>d.id===n);if(!j(f))throw Error("Uncompose needs a comp layer");if(e[f.track]?.locked)throw Error("Track đã khóa");const l={...f,...rt(f)},p=t.filter(d=>d.id!==n),a=new Set(p.map(d=>d.id)),r=l.comp.tracks||{},v=l.comp.clips.map(d=>({...d,...r[d.track]?.hidden&&d.kind!=="audio"?{disabled:!0}:{},...r[d.track]?.muted?{volume:0}:{}})),I=kt(l,v,i,o),y=new Map;for(const d of I){let h=d.id,M=2;for(;a.has(h)||[...y.values()].includes(h);)h=`${d.id}-${M++}`;y.set(d.id,h)}const g=[...p],m=(d,h)=>!e[d]?.locked&&!g.some(M=>M.track===d&&h.some(S=>M.start<S.start+S.duration-1e-6&&M.start+M.duration>S.start+1e-6)),k=new Map,x=[...new Set(I.filter(d=>d.kind!=="audio").map(d=>d.track))].sort((d,h)=>E(d)-E(h)),_=d=>I.filter(h=>h.kind!=="audio"&&h.track===d),T=x.every(d=>m(d,_(d)));let O=T?E(x.at(-1)??l.track)+1:E(l.track);for(const d of x){const h=_(d);if(T){k.set(d,d),g.push(...h);continue}for(;!m(A(O),h);)O++;k.set(d,A(O)),g.push(...h.map(M=>({...M,track:A(O)}))),O++}for(const d of[...new Set(I.filter(h=>h.kind==="audio").map(h=>h.track))]){const h=I.filter(S=>S.kind==="audio"&&S.track===d),M=[d,...st.filter(S=>S!==d)].find(S=>m(S,h));if(M===void 0)throw Error("Uncompose: no free audio row for the comp's sounds");k.set(d,M),g.push(...h.map(S=>({...S,track:M})))}const Y=Z(l)||p.some(d=>d.parentId===n);let P=null;if(Y){let d=O;const h=[{start:l.start,duration:l.duration}];for(;!m(A(d),h);)d++;let M=s();for(;a.has(M);)M=s();const{_comp:S,...xt}=ht(l,M);P={...xt,track:A(d),label:l.label||"Null"}}const u=ct(l)?null:J(l,0).opacity,c=I.map(d=>{let h=W(d,M=>y.get(M)??null);if(h={...gt(l,h,u),id:y.get(d.id),track:k.get(d.track)??d.track},h.parentId===void 0&&P&&d.kind!=="audio"&&(h.parentId=P.id),!it(h.kind,h.track))throw Error("Uncompose: no free row");return h});return{clips:[...p.map(d=>d.parentId===n?P?{...d,parentId:P.id}:(({parentId:h,...M})=>M)(d):d),...P?[P]:[],...c],ids:c.map(d=>d.id),nullId:P?.id??null,dropped:ut(f)}}const Wt=Object.freeze(Object.defineProperty({__proto__:null,COMP_DEPTH:K,COMP_SEP:D,compBlockers:Ot,compClipCount:mt,compContentEnd:Ft,compDepth:Q,compGrouped:lt,compInner:wt,compLabel:ft,compMoves:Z,compPictureFields:ut,compRange:yt,compRenderLevel:It,compTime:Lt,expandComps:N,groupedLevels:Ut,isComp:j,precompose:Yt,stripComp:Et,uncompose:Vt},Symbol.toStringTag,{value:"Module"}));export{wt as a,Lt as b,Ft as c,Zt as d,N as e,ft as f,mt as g,Qt as h,j as i,Gt as j,B as m,Yt as p,G as s,Wt as t,Vt as u};
|
|
1
|
+
import{f as R,au as b,io as C,eQ as nt,eR as ot,eS as Mt,jh as bt,ia as T,F as vt,fp as _t,gV as it,ee as L,h1 as at,h5 as St,gW as Pt,gY as Ot,fu as tt,jl as rt,m as E,l as A,gU as st,fe as Q,lQ as ut,lR as z,it as et,ec as G,d7 as dt,lS as lt,h as U,s as pt,i2 as $t,i3 as Et}from"./titleFrameBudget-BYRZAQPs.js";const O=1/vt,w=1e-6,X=t=>typeof t=="number"&&Number.isFinite(t);function jt(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t)||Object.keys(t).some(i=>i!=="in"&&i!=="out")||!X(t.in)||!X(t.out))throw Error("Invalid export range");const n=b(t.in),e=b(t.out);if(n<0||e>R||e-n<O-w)throw Error("Invalid export range");return{in:n,out:e}}function Y(t,n){if(t==null&&n==null)return null;const e=jt({in:t??0,out:n??R});return e.in<=w&&e.out>=R-w?null:e}function Jt(t,n,e){const i=Math.max(0,Math.min(R,b(e))),o=t?.in??0,s=t?.out??R;try{return n==="in"?i>=R-O+w?void 0:Y(i,i>=s-w?null:s):i<O-w?void 0:Y(i<=o+w?null:o,i)}catch{return}}function qt(t,n,e,i){if(!(i>=O))return t??null;const o=t?.in??0,s=t?.out??R;try{if(n==="in")return Y(Math.max(0,Math.min(b(e),b(Math.min(s,i)-O))),s>=R-w?null:s);const f=Math.max(b(o+O),Math.min(b(e),i));return Y(o,f>=i-w?null:f)}catch{return t??null}}function Zt(t,n){if(!t||!X(t.in)||!X(t.out)||!(n>0))return null;const e=Math.max(0,Math.min(n,t.in)),i=Math.max(0,Math.min(n,t.out));return i-e<O-w||e<=w&&i>=n-w?null:{in:e,out:i}}function Rt(t,n,e){if(!t||!Array.isArray(t.motionKeys)||!t.motionKeys.length)return t;let i={...t,motionKeys:[]};for(const o of St){const s=Pt(t,o);if(!s.length)continue;const f=s.some(a=>a.time<n-w),l=s.some(a=>a.time>e+w),p=[...s].reverse().find(a=>a.time<=n+w);i=Ot(i,o,[...f?[{time:0,value:tt(t,o,n),...p?.ease!==void 0?{ease:p.ease}:{}}]:[],...s.filter(a=>(f?a.time>n+w:a.time>=n-w)&&(l?a.time<e-w:a.time<=e+w)).map(a=>({...a,time:Math.max(0,b(a.time-n))})),...l?[{time:b(e-n),value:tt(t,o,e)}]:[]])}return i}const At=t=>[...t.parentId?[t.parentId]:[],...Array.isArray(t.shape?.items)?t.shape.items.flatMap(n=>n?.pins&&typeof n.pins=="object"?Object.values(n.pins):[]):[]];function Ft(t,n,e,i,o,s){const f=n.find(I=>I.id===t.id)??t,l=t.start+t.duration<=e+w?t.duration:0,p=_t(f,l,o,s),a=p.sx??1,r=p.sy??1,v=it("image",t.track)?t.track:0;return{...at({id:t.id,track:v,start:0,duration:i,label:String(t.label||"Null").slice(0,160)}),posX:p.x,posY:p.y,scale:p.zoom,rotation:p.rot,anchorX:L(t,"ax",l),anchorY:L(t,"ay",l),...a!==1||r!==1?{motionKeys:[{time:0,sx:a,sy:r}]}:{}}}function J({clips:t,camera:n=null},e,{W:i=1280,H:o=720}={}){if(!e||!Array.isArray(t))return{clips:t,camera:n};const s=e.in,f=e.out,l=b(f-s),p=[];for(const m of t){if(m.start+m.duration<=s+w||m.start>=f-w)continue;let k=m;if(k.start<s-w){const g=b(s-k.start);if(k.duration-g<O-w)continue;if(g>=O-w){const _=C(k,s,`${m.id}~in`);_.length===2&&(k={..._[1],id:m.id})}}if(k.start+k.duration>f+w){const g=b(f-k.start);if(g<O-w)continue;k.duration-g>=O-w&&(k=C(k,f,`${m.id}~out`)[0])}p.push({...k,start:Math.max(0,b(k.start-s))})}const a=new Set(p.map(m=>m.id)),r=new Map(t.map(m=>[m.id,m])),v=[...new Set(p.flatMap(At))].filter(m=>!a.has(m)&&r.get(m)&&!r.get(m).disabled&&r.get(m).kind!=="audio");let I=[];if(v.length){const m=nt(ot(t.filter(k=>!k.disabled)));Mt(m),I=v.map(k=>Ft(r.get(k),m,s,l,i,o))}const y=new Set([...a,...I.map(m=>m.id)]);return{clips:[...p.map(m=>{const k=r.get(m.id),g=[];let _=m;if(m.parentId&&!y.has(m.parentId)&&g.push("parentId"),m.matte&&!a.has(m.matte.source)&&(g.push("matte"),m.matte.mode?.endsWith("-inverted")||(_={...m,opacity:0,motionKeys:bt(m,"opacity",[])})),m.transition&&k&&T(t,k)&&!T(p,m)&&g.push("transition"),m.join&&k&&T(t,k)&&!T(p,m)&&g.push("join"),!g.length)return _;_={..._};for(const F of g)delete _[F];return _}),...I],camera:Rt(n,s,f)}}const j=t=>!!t&&!!t.comp&&Array.isArray(t.comp.clips),D=">",q=t=>j(t)?1+Math.max(0,...t.comp.clips.map(q)):0,mt=t=>j(t)?t.comp.clips.reduce((n,e)=>n+1+mt(e),0):0,Tt=t=>j(t)?Math.max(0,...t.comp.clips.map(n=>n.start+n.duration)):0,ft=t=>{let n=1;for(;t.some(e=>e.label===`Comp ${n}`);)n++;return`Comp ${n}`},K=t=>String(t).padStart(3,"0"),V=["x","y","zoom","rot","ax","ay"],zt={x:0,y:0,zoom:1,rot:0,ax:0,ay:0};function Z(t){return t.parentId||V.some(n=>G(t,n).length||Math.abs(L(t,n,0)-zt[n])>1e-9)?!0:["enter","exit"].some(n=>t[n]&&t[n].type!=="fade")}const ct=t=>G(t,"opacity").length>0||["enter","exit"].some(n=>t[n]&&(t[n].type==="fade"||t[n].fade!==!1));function ht(t,n){const e=[];for(const o of t.motionKeys||[]){const s={time:o.time};for(const l of V)Number.isFinite(o[l])&&(s[l]=o[l]);if(Object.keys(s).length===1)continue;const f=o.ease&&Object.fromEntries(Object.entries(o.ease).filter(([l])=>V.includes(l)));f&&Object.keys(f).length&&(s.ease=f),e.push(s)}const i=Object.fromEntries(["posX","posY","scale","rotation","anchorX","anchorY","parentId","zIndex","enter","exit"].filter(o=>t[o]!==void 0).map(o=>[o,t[o]]));return{...at({id:n,track:t.track,start:t.start,duration:t.duration,label:t.label}),...i,motionKeys:e,_comp:t.id}}function Kt(t,n){if(Math.abs(n-1)<1e-9)return t;const e=G(t,"opacity"),i={...t,opacity:(t.opacity??1)*n};return e.length?{...i,...dt(i,"opacity",e.map(o=>({...o,value:o.value*n})))}:i}function Nt(t,n){const e=Math.max(1,Math.ceil(t.duration*60-1e-6)),i=[];for(let o=0;o<=e;o++){const s=Math.min(t.duration,o/60);i.push({time:+s.toFixed(6),value:Math.max(0,Math.min(1,L(t,"opacity",s)*n(s)))})}return{...t,...dt(t,"opacity",i)}}function W(t,n){const e={...t},i=o=>n(o);if(e.parentId!==void 0){const o=i(e.parentId);o?e.parentId=o:delete e.parentId}if(e.matte?.source!==void 0){const o=i(e.matte.source);o?e.matte={...e.matte,source:o}:delete e.matte}e._virtual!==void 0&&(e._virtual=i(e._virtual)??e._virtual),typeof e.space=="string"&&(e.space=i(e.space)??e.space);for(const o of["bend","vfx"])typeof e[o]?.source=="string"&&(e[o]={...e[o],source:i(e[o].source)??e[o].source});return Array.isArray(e.shape?.items)&&e.shape.items.some(o=>o?.pins)&&(e.shape={...e.shape,items:e.shape.items.map(o=>o?.pins&&typeof o.pins=="object"?{...o,pins:Object.fromEntries(Object.entries(o.pins).map(([s,f])=>[s,i(f)??f]))}:o)}),e}const Dt=t=>{if(t.transition===void 0&&t.join===void 0)return t;const{transition:n,join:e,...i}=t;return i};function H(t){const n=t.comp.tracks||{};return t.comp.clips.filter(e=>!e.disabled&&!(e.kind!=="audio"&&n[e.track]?.hidden)).map(e=>n[e.track]?.muted?{...e,volume:0}:e)}function kt(t,n,e,i){const o=t.inPoint||0,s=t.start-o;return J({clips:n},{in:o,out:o+t.duration},{W:e,H:i}).clips.map(l=>{const p={...l,start:b(t.start+l.start)};for(const a of["_txIn","_txOut"])p[a]&&(p[a]={...p[a],t0:p[a].t0+s});return p})}function Lt(t,n){const e=t.inPoint||0;if(U(t)&&!t.reverse)return e+pt(t,Math.max(0,Math.min(t.duration,n)));const i=t.playbackRate||1,o=Math.max(0,Math.min(t.duration,n));return e+(t.reverse?Math.max(0,t.duration-o-1/30):o)*i}function yt(t){const n=t.inPoint||0,e=U(t)&&!t.reverse?pt(t,t.duration):t.duration*(t.playbackRate||1);return{from:n,to:n+e}}function wt(t){const n=H(t),e=new Set(n.map(o=>o.id)),i=`${t.id}${D}`;return n.map(o=>({...W(o,s=>e.has(s)?i+s:null),id:i+o.id}))}function It(t,{W:n=1280,H:e=720}={}){const{from:i,to:o}=yt(t);return J({clips:wt(t)},{in:i,out:o},{W:n,H:e}).clips.map(s=>({...s,volume:0}))}function Ut(t,{W:n=1280,H:e=720}={}){const i=[],o=(s,f)=>{for(const l of s)if(l?._group&&j(l)&&f<z){const p=N(It(l,{W:n,H:e}),{W:n,H:e});i.push(p),o(p,f+1)}};return o(N(t||[],{W:n,H:e}),0),i}function Xt(t,n,e,i){if(t.reverse||U(t))return[];const o=t.playbackRate||1,s=t.inPoint||0,f=`${t.id}${D}`,l=N(H(t),{W:e,H:i,depth:n+1}).filter(a=>a.url&&(a.volume??1)>0&&(a.kind==="audio"||a.kind==="video"&&!a.freeze&&!a.reverse));return J({clips:l},{in:s,out:s+t.duration*o},{W:e,H:i}).clips.flatMap(a=>{const r=(a.playbackRate||1)*o;return r>8||U(a)&&o!==1?[]:[{...Object.fromEntries(["nodeId","url","gcsUri","label","inPoint","sourceDuration","audioFx","duck","muffle"].filter(I=>a[I]!==void 0).map(I=>[I,a[I]])),id:`${f}${a.id}~a`,kind:"audio",track:a.kind==="audio"?a.track:st[0],start:b(t.start+a.start/o),duration:Math.max(1/30,b(a.duration/o)),volume:(a.volume??1)*(t.volume??1),...r!==1?{playbackRate:r}:{},...a.speedRamp&&o===1?{speedRamp:a.speedRamp}:{},...a.audioFadeIn?{audioFadeIn:a.audioFadeIn/o}:{},...a.audioFadeOut?{audioFadeOut:a.audioFadeOut/o}:{},_comp:t.id,_slot:`§a${f}${a.id}`}]})}function xt(t,n,e){let i=n;return n.kind!=="audio"&&!n.nullLayer&&(i=e!==null?Kt(i,e):Nt(i,o=>Q(t,i.start-t.start+o).opacity)),t.volume!==void 0&&t.volume!==1&&(n.kind==="video"||n.kind==="audio")&&(i={...i,volume:(i.volume??1)*t.volume}),t.lookBypass&&(i={...i,lookBypass:!0}),i}function Yt(t,n,e,i,o){if(n>=z)return[];t={...t,...rt(t)};let s=nt(ot(H(t))).map(Dt);s=N(s,{W:e,H:i,depth:n+1});const f=kt(t,s,e,i),l=new Set(f.map(y=>y.id)),p=`${t.id}${D}`,a=o?`${p}~comp`:null,r=ct(t)?null:Q(t,0).opacity,v=[...new Set(f.filter(y=>y.kind!=="audio").map(y=>`${K((y.zIndex??0)+200)}:${K(E(y.track)+1)}`))].sort(),I=f.map(y=>{let x=W(y,m=>l.has(m)?p+m:null);return x={...xt(t,x,r),id:p+y.id,_comp:t.id,...x.parentId===void 0&&a&&y.kind!=="audio"?{parentId:a}:{}},y.kind!=="audio"?(x.track=t.track,x._slot=`§${K(v.indexOf(`${K((y.zIndex??0)+200)}:${K(E(y.track)+1)}`))}${y._slot??""}`,t.zIndex!==void 0?x.zIndex=t.zIndex:delete x.zIndex):x._slot=`§${y._slot??""}${y.id}`,x});return I.sort((y,x)=>y._slot<x._slot?-1:y._slot>x._slot?1:0),a?[ht(t,a),...I]:I}function N(t,{W:n=1280,H:e=720,depth:i=0}={}){if(!Array.isArray(t)||!t.some(r=>j(r)&&!r._group))return t;const o=new Set(t.filter(r=>r.transition).map(r=>T(t,r)?.id).filter(Boolean)),s=r=>lt(r)||o.has(r.id),f=new Set(t.filter(r=>r.parentId).map(r=>r.parentId)),l=new Set(t.filter(r=>j(r)&&!s(r)).map(r=>r.id)),p=new Map,a=[];for(const r of t){if(!j(r)||r._group){a.push(r);continue}if(r.disabled)continue;if(s(r)){i<z&&a.push({...r,_group:!0},...Xt(r,i,n,e));continue}const v=Z(r)||f.has(r.id);v&&p.set(r.id,`${r.id}${D}~comp`),a.push(...Yt(r,i,n,e,v))}return a.map(r=>{if(r.parentId&&p.has(r.parentId))return{...r,parentId:p.get(r.parentId)};if(r.matte&&l.has(r.matte.source)){const{matte:v,...I}=r;return I}return r})}function Bt(t,n,{id:e,label:i,tracks:o={},W:s=1280,H:f=720}={}){const l=new Set(n||[]),p=t.filter(u=>l.has(u.id));if(!p.length)throw Error("Precompose: select at least one layer");if(!p.some(u=>u.kind!=="audio"))throw Error("Precompose needs at least one picture layer");if(p.some(u=>o[u.track]?.locked))throw Error("Track đã khóa");if(1+Math.max(0,...p.map(q))>z)throw Error(`Comps nest at most ${z} deep`);const a=t.filter(u=>!l.has(u.id)),r=[...p.filter(u=>u.matte&&!l.has(u.matte.source)),...a.filter(u=>u.matte&&l.has(u.matte.source))];if(r.length)throw Error(`Precompose: the track matte of "${r[0].label||r[0].id}" crosses the comp's edge — take the matte layer in too, or remove the matte`);const v=b(Math.min(...p.map(u=>u.start))),I=b(Math.max(...p.map(u=>u.start+u.duration))),y=Math.max(1/30,b(I-v)),x=u=>a.some(c=>c.track===u&&c.kind!=="audio"&&c.start<I-1e-6&&c.start+c.duration>v+1e-6)||o[u]?.locked,m=[...new Set(p.filter(u=>u.kind!=="audio").map(u=>u.track))].sort((u,c)=>E(c)-E(u));let k=m.find(u=>!x(u));for(let u=E(m[0])+1;k===void 0;u++)x(A(u))||(k=A(u));const g=u=>T(t,u),_=p.map(u=>{let c={...u};return c.parentId&&!l.has(c.parentId)&&(c={...c,...et(t,u,null,0,s,f)}),c.transition&&!l.has(g(u)?.id)&&delete c.transition,c.join&&!l.has(g(u)?.id)&&delete c.join,c.parentId===void 0&&delete c.parentId,{...c,start:b(u.start-v)}}),F=a.map(u=>{let c=u;return u.parentId&&l.has(u.parentId)&&(c={...c,...et(t,u,null,0,s,f)},c.parentId===void 0&&(c={...c},delete c.parentId)),(c.transition||c.join)&&l.has(g(u)?.id)&&(c={...c},delete c.transition,delete c.join),c}),$=[...new Set(p.map(u=>u.track))].filter(u=>o[u]?.hidden||o[u]?.muted),B=Object.fromEntries($.map(u=>[u,{...o[u].hidden?{hidden:!0}:{},...o[u].muted?{muted:!0}:{}}])),P={id:e||`comp-${Date.now().toString(36)}`,nodeId:"",kind:"image",url:"",label:i||ft(t),track:k,start:v,duration:y,inPoint:0,sourceDuration:y,motionV:2,comp:{clips:_,...$.length?{tracks:B}:{}}};return{clips:[...F,P],id:P.id,track:k}}function Vt(t,n,{tracks:e={},W:i=1280,H:o=720,newId:s=()=>`null-${Math.random().toString(36).slice(2,9)}`}={}){const f=t.find(d=>d.id===n);if(!j(f))throw Error("Uncompose needs a comp layer");if(e[f.track]?.locked)throw Error("Track đã khóa");const l={...f,...rt(f)},p=t.filter(d=>d.id!==n),a=new Set(p.map(d=>d.id)),r=l.comp.tracks||{},v=l.comp.clips.map(d=>({...d,...r[d.track]?.hidden&&d.kind!=="audio"?{disabled:!0}:{},...r[d.track]?.muted?{volume:0}:{}})),I=kt(l,v,i,o),y=new Map;for(const d of I){let h=d.id,M=2;for(;a.has(h)||[...y.values()].includes(h);)h=`${d.id}-${M++}`;y.set(d.id,h)}const x=[...p],m=(d,h)=>!e[d]?.locked&&!x.some(M=>M.track===d&&h.some(S=>M.start<S.start+S.duration-1e-6&&M.start+M.duration>S.start+1e-6)),k=new Map,g=[...new Set(I.filter(d=>d.kind!=="audio").map(d=>d.track))].sort((d,h)=>E(d)-E(h)),_=d=>I.filter(h=>h.kind!=="audio"&&h.track===d),F=g.every(d=>m(d,_(d)));let $=F?E(g.at(-1)??l.track)+1:E(l.track);for(const d of g){const h=_(d);if(F){k.set(d,d),x.push(...h);continue}for(;!m(A($),h);)$++;k.set(d,A($)),x.push(...h.map(M=>({...M,track:A($)}))),$++}for(const d of[...new Set(I.filter(h=>h.kind==="audio").map(h=>h.track))]){const h=I.filter(S=>S.kind==="audio"&&S.track===d),M=[d,...st.filter(S=>S!==d)].find(S=>m(S,h));if(M===void 0)throw Error("Uncompose: no free audio row for the comp's sounds");k.set(d,M),x.push(...h.map(S=>({...S,track:M})))}const B=Z(l)||p.some(d=>d.parentId===n);let P=null;if(B){let d=$;const h=[{start:l.start,duration:l.duration}];for(;!m(A(d),h);)d++;let M=s();for(;a.has(M);)M=s();const{_comp:S,...gt}=ht(l,M);P={...gt,track:A(d),label:l.label||"Null"}}const u=ct(l)?null:Q(l,0).opacity,c=I.map(d=>{let h=W(d,M=>y.get(M)??null);if(h={...xt(l,h,u),id:y.get(d.id),track:k.get(d.track)??d.track},h.parentId===void 0&&P&&d.kind!=="audio"&&(h.parentId=P.id),!it(h.kind,h.track))throw Error("Uncompose: no free row");return h});return{clips:[...p.map(d=>d.parentId===n?P?{...d,parentId:P.id}:(({parentId:h,...M})=>M)(d):d),...P?[P]:[],...c],ids:c.map(d=>d.id),nullId:P?.id??null,dropped:ut(f)}}const Wt=Object.freeze(Object.defineProperty({__proto__:null,COMP_DEPTH:z,COMP_SEP:D,compBlockers:$t,compClipCount:mt,compContentEnd:Tt,compDepth:q,compGrouped:lt,compInner:wt,compLabel:ft,compMoves:Z,compPictureFields:ut,compRange:yt,compRenderLevel:It,compTime:Lt,expandComps:N,groupedLevels:Ut,isComp:j,precompose:Bt,stripComp:Et,uncompose:Vt},Symbol.toStringTag,{value:"Module"}));export{wt as a,Lt as b,Tt as c,Zt as d,N as e,ft as f,mt as g,qt as h,j as i,Jt as j,Y as m,Bt as p,J as s,Wt as t,Vt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dG as P,eI as O,dH as M,id as R,fK as E,fM as j}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 K=(t,e,i=.1)=>["X","Y","Z"].map((o,s)=>({id:t+s,label:`${e} ${o}`,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 H(t,e){if(e==="camera")return A;const i=t.items.find(o=>o.id===e);return i?i.kind==="fx"?i.fx?.attach?_:X:U:[]}function I(t,e){return e==="camera"?t.motion==="path"&&!!t.cameraKeys?.length:(t.objectKeys?.[e]?.length??0)>0}const y=t=>+t.slice(1);function J(t,e,i,o){const s=p(t);if(e==="camera"){const c=P(s,o);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,o).position[y(i)];const n=M(r,s,o);return i==="s"?n.scale[0]:(i[0]==="p"?n.position:n.rotation)[y(i)]}const C=t=>+t.toFixed(3);function q(t,e,i,o,s,r=()=>crypto.randomUUID()){const n=p(t);if(!n||!Number.isFinite(s))return t;const c=f=>({...t,shots:t.shots.map(l=>l.id===n.id?{...l,...f}:l)});if(e==="camera"){const f=P(n,o),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(R(n,o,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,n,o).position.slice();if(f[y(i)]=s,E(a,n))return j(t,e,o,{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,n,o),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=n.objectKeys?.[e]||[];if(h.length){const f=h.find(u=>Math.abs(u.time-o)<1e-6),l={...f,id:f?.id??r(),time:o,...m};return c({objectKeys:{...n.objectKeys,[e]:[...h.filter(u=>u.id!==l.id),l].sort((u,F)=>u.time-F.time)}})}return{...t,items:t.items.map(f=>f.id===e?{...f,...m}:f)}}const b=1e-6,S=(t,e)=>e==="camera"?t.motion==="path"?t.cameraKeys||[]:[]:t.objectKeys?.[e]||[];function x(t,e,i){const o=p(t),s=[...i].sort((r,n)=>r.time-n.time);if(e==="camera"){const r=s,n=r[0],c=r[r.length-1],a={cameraKeys:r,motion:r.length?"path":"static",...n&&c?{position:n.position,target:n.target,lens:n.lens,roll:n.roll,endPosition:c.position,endTarget:c.target,endLens:c.lens}:{}};return{...t,shots:t.shots.map(d=>d.id===o.id?{...d,...a}:d)}}return{...t,shots:t.shots.map(r=>r.id===o.id?{...r,objectKeys:{...r.objectKeys,[e]:s}}:r)}}const k=(t,e)=>e!=="camera"&&!!t.items.find(i=>i.id===e)?.locked;function T(t,e,i,o=()=>crypto.randomUUID()){const s=p(t);if(!s||k(t,e))return t;const r=S(s,e);if(r.some(a=>Math.abs(a.time-i)<b))return t;if(e==="camera"){const a=P(s,i);return x(t,e,[...r,{id:o(),time:i,position:a.position,target:a.target,lens:a.lens,roll:a.roll}])}const n=t.items.find(a=>a.id===e);if(!n)return t;if(n.kind==="fx"&&n.fx?.attach)return j(t,e,i,{id:o()});const c=M(n,s,i);return x(t,e,[...r,{id:o(),time:i,position:c.position,rotation:c.rotation,scale:c.scale}])}function z(t,e,i){return["camera",...t.items.filter(o=>!o.hidden).map(o=>o.id)].reduce((o,s)=>T(o,s,e,i),t)}function Q(t,e){const i=p(t);return e.flatMap(o=>{const s=S(i,o.row).find(r=>r.id===o.id);return s?[{row:o.row,key:structuredClone(s)}]:[]})}function W(t,e,i,o=()=>crypto.randomUUID()){if(!e.length)return{stage:t,pasted:[]};const s=Math.min(...e.map(c=>c.key.time)),r=[];let n=t;for(const c of new Set(e.map(a=>a.row))){if(k(n,c)||c!=="camera"&&!n.items.some(d=>d.id===c))continue;let a=[...S(p(n),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:o(),time:m};a=[...a.filter(f=>Math.abs(f.time-m)>=b),h],r.push({row:c,id:h.id})}n=x(n,c,a)}return{stage:n,pasted:r}}function v(t,e,i){let o=t;for(const s of new Set(e.map(r=>r.row))){if(k(o,s))continue;const r=new Set(e.filter(n=>n.row===s).map(n=>n.id));o=x(o,s,S(p(o),s).map(n=>r.has(n.id)?{...n,ease:i}:n))}return o}function g(t,e,i){let o=t,s=!1;for(const r of new Set(e.map(n=>n.row))){if(k(o,r))continue;const n=new Set(e.filter(m=>m.row===r).map(m=>m.id)),a=S(p(o),r).map(m=>n.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,o=x(o,r,a.map(m=>({...m,time:Math.min(1,Math.max(0,m.time))}))))}return{stage:o,moved:s}}export{A as CAMERA_PROPS,X as FX_FREE_PROPS,_ as FX_OFFSET_PROPS,U as OBJECT_PROPS,T as addKeyAt,Q as copyKeys,v as easeKeys,z as keyAllAt,g as nudgeKeys,W as pasteKeys,J as readProp,I as rowKeyed,H as rowProps,q as writeProp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as o}from"./store-
|
|
1
|
+
import{u as o}from"./store-75tQUvPT.js";import{t as l,c as w}from"./api-DUp403BK.js";import{l as v,d as C}from"./titleArt-B8DVR58F.js";import{i as h}from"./textAnimators-nVSz_sZo.js";import"./titleFrameBudget-BYRZAQPs.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};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/userFonts-DzY0A4bD.js","assets/api-DUp403BK.js","assets/titleFrameBudget-BYRZAQPs.js","assets/store-75tQUvPT.js","assets/textAnimators-nVSz_sZo.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as rt,mP as it}from"./titleFrameBudget-BYRZAQPs.js";import{u as lt,v as ht,o as ft,R as dt,w as Ne,x as Ue,y as Ee,z as pt,l as qe,A as ut,C as gt,a as ct}from"./textAnimators-nVSz_sZo.js";const Ye=(e,t)=>typeof document<"u"?Object.assign(document.createElement("canvas"),{width:e,height:t}):new OffscreenCanvas(e,t),re=1280,ie=720,ue=new Map,wt=8,He=()=>Ye(re,ie);function Xe(e,t,s){const r=s*Math.PI/180,a=Math.cos(r),h=Math.sin(r),u=(Math.abs(a)*re+Math.abs(h)*ie)/2;return Math.min(1,Math.max(0,((e-re/2)*a+(t-ie/2)*h+u)/(2*u)))}function mt(e){return()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function yt(e,t){const s=He(),r=s.getContext("2d"),{scale:a,size:h,fade:u,fadeAngle:g}=e;if(r.fillStyle=t,e.pattern==="grain"){const w=Math.max(1,Math.round(a/4)),m=Math.ceil(re/w),v=Math.ceil(ie/w),T=mt(1729);for(let c=0;c<v;c++)for(let A=0;A<m;A++){const p=A*w,S=c*w,z=h*(1-u*Xe(p,S,g));T()<z&&r.fillRect(p,S,w,w)}return s}const l=e.angle*Math.PI/180,f=Math.cos(l),i=Math.sin(l),d=Math.hypot(re,ie)/2+a;r.beginPath();for(let w=-d;w<=d;w+=a){if(e.pattern==="lines"){for(let m=-d;m<d;m+=a*2){const v=re/2+(m+a)*f-w*i,T=ie/2+(m+a)*i+w*f,c=a*h*(1-u*Xe(v,T,g))/2;if(c<.15)continue;const A=[[m,w-c],[m+a*2,w-c],[m+a*2,w+c],[m,w+c]].map(([p,S])=>[re/2+p*f-S*i,ie/2+p*i+S*f]);r.moveTo(A[0][0],A[0][1]);for(const[p,S]of A.slice(1))r.lineTo(p,S);r.closePath()}continue}for(let m=-d;m<=d;m+=a){const v=re/2+m*f-w*i,T=ie/2+m*i+w*f;if(v<-a||T<-a||v>re+a||T>ie+a)continue;const c=a*.6*h*(1-u*Xe(v,T,g));c<.3||(r.moveTo(v+c,T),r.arc(v,T,c,0,Math.PI*2))}}return r.fill(),s}function bt(e,t,s){const r=JSON.stringify([e.pattern,e.scale,e.size,e.angle,e.fade,e.fadeAngle,t,s]);let a=ue.get(r);if(a)return ue.delete(r),ue.set(r,a),a;if(a=yt(e,s?"#000000":t),s){const h=He(),u=h.getContext("2d");u.fillStyle="#000000",u.fillRect(0,0,re,ie),u.globalCompositeOperation="destination-out",u.drawImage(a,0,0),a=h}return ue.set(r,a),ue.size>wt&&ue.delete(ue.keys().next().value),a}function Mt(e,t,s){e.save(),e.setTransform(1,0,0,1,0,0),e.filter="none",e.shadowBlur=0,e.globalAlpha=t.opacity,e.globalCompositeOperation=t.mode==="atop"?"source-atop":"destination-out",e.drawImage(bt(t,s,t.mode==="keep"),0,0),e.restore()}const ee={width:1280,height:720};let kt=null;const St=()=>kt??=Ye(ee.width,ee.height);function Tt(e,t){const s=[];for(const r of t.split(`
|
|
3
|
+
`)){let a="";for(const h of Array.from(r))a&&e.measureText(a+h).width>1050&&(s.push(a),a=""),a+=h;s.push(a)}return s}function Rt(e,t,s){if(t.design){if(!t.design.layers.some(S=>S.type==="texture"))return Je(e,t,t.design,s);const A=St(),p=A.getContext("2d");p.setTransform(1,0,0,1,0,0),p.globalAlpha=1,p.globalCompositeOperation="source-over",p.clearRect(0,0,ee.width,ee.height),Je(p,t,t.design,s),e.drawImage(A,0,0);return}const{text:r,fontSize:a,color:h,placement:u,fontFamily:g="Arial",align:l="center",styleId:f="classic",accentColor:i="#32d8cd"}=t,d=f!=="classic",w=d?800:600;e.font=`${w} ${a}px "${g}", sans-serif`,e.textAlign=l,e.textBaseline="middle";const m=Tt(e,r),v=a*(d?1.12:1.3);if(m.length*v>560)throw Error("Text is too long for the frame; reduce copy or font size");const T=m.length*v,c=u==="top"?80+T/2:u==="lower"?640-T/2:360;m.forEach((A,p)=>{const S=l==="left"?90:l==="right"?1190:640,z=c+(p-(m.length-1)/2)*v,Y=e.measureText(A).width;if(e.save(),f==="accent-bar"){const I=l==="left"?S-18:l==="right"?S-Y-18:S-Y/2-18;e.fillStyle=i,e.beginPath(),e.roundRect(I,z-a*.56,Y+36,a*1.12,10),e.fill()}if(f==="tape-label"){const I=a*.45,_=Y+I*2,F=a*1.32,W=l==="left"?S+Y/2:l==="right"?S-Y/2:S,G=(p%2?1:-1)*.028,V=6;e.save(),e.translate(W,z),e.rotate(G),e.beginPath(),e.moveTo(-_/2,-F/2),e.lineTo(_/2,-F/2);for(let E=1;E<=V;E++)e.lineTo(_/2+(E%2?a*.07:0),-F/2+F*E/V);e.lineTo(-_/2,F/2);for(let E=V-1;E>=0;E--)e.lineTo(-_/2-(E%2?a*.07:0),-F/2+F*E/V);e.closePath(),e.shadowColor="rgba(0,0,0,0.22)",e.shadowBlur=a*.12,e.shadowOffsetY=a*.04,e.globalAlpha=.94,e.fillStyle=i,e.fill(),e.shadowColor="transparent",e.globalAlpha=.07,e.strokeStyle="#5a4a30",e.lineWidth=1;for(let E=1;E<5;E++){const ae=-F/2+F*E/5;e.beginPath(),e.moveTo(-_/2,ae),e.lineTo(_/2,ae+(E%2?1.5:-1.5)),e.stroke()}e.restore(),e.save(),e.translate(W,z),e.rotate(G),e.translate(-W,-z)}if(f==="echo-stack"&&(e.fillStyle=i,e.globalAlpha=.82,e.fillText(A,S+13,z+13),e.globalAlpha=1),f==="outline-punch"&&(e.lineWidth=Math.max(4,a*.11),e.lineJoin="round",e.strokeStyle=i,e.strokeText(A,S,z)),f==="neon-edge"&&(e.shadowColor=i,e.shadowBlur=25,e.strokeStyle=i,e.lineWidth=Math.max(3,a*.07),e.lineJoin="round",e.strokeText(A,S,z),e.shadowBlur=12),f==="classic"&&(e.shadowColor="#000000",e.shadowBlur=8),e.fillStyle=f==="duotone-stack"&&p%2?i:h,e.fillText(A,S,z),f==="tape-label"&&e.restore(),f==="duotone-stack"&&p===m.length-1){const I=l==="left"?S:l==="right"?S-Y:S-Y/2;e.fillStyle=i,e.fillRect(I,z+a*.55,Math.min(Y,760),Math.max(4,a*.07))}e.restore()})}const _e=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter("vi",{granularity:"grapheme"}):null,he=e=>_e?Array.from(_e.segment(e),t=>t.segment):Array.from(e);function be(e,t){if(t>=.999||!/^#[0-9a-f]{6}$/i.test(e))return e;const s=parseInt(e.slice(1),16),r=Math.max(0,t);return`rgb(${Math.round((s>>16&255)*r)},${Math.round((s>>8&255)*r)},${Math.round((s&255)*r)})`}function Re(e,t,s){if(!/^#[0-9a-f]{6}$/i.test(e))return e;const r=parseInt(e.slice(1),16);return"#"+[r>>16&255,r>>8&255,r&255].map(a=>Math.round(a+(t-a)*s).toString(16).padStart(2,"0")).join("")}const Le=e=>{if(!/^#[0-9a-f]{6}$/i.test(e))return[e,e];const t=ct(e.toLowerCase()).gradient;return[t[0],t.at(-1)]};function Ke(e,t,s,r,a,h,u){const g=s+a/2,l=r+h/2;let f;if(t.type==="radial")f=e.createRadialGradient(g,l,0,g,l,Math.max(a,h)/2);else{const i=(t.angle??90)*Math.PI/180,d=Math.cos(i)*a/2,w=Math.sin(i)*h/2;f=e.createLinearGradient(g-d,l-w,g+d,l+w)}return t.gradient.forEach((i,d)=>f.addColorStop(t.stops?.[d]??d/(t.gradient.length-1),u(i))),f}const Pt=e=>typeof e=="string"?e:e.type==="radial"?e.gradient[0]:e.gradient.at(-1),Te=(e,t)=>{if(!/^#[0-9a-f]{6}$/i.test(e))return`rgba(255,255,255,${t})`;const s=parseInt(e.slice(1),16);return`rgba(${s>>16&255},${s>>8&255},${s&255},${t})`};function Qe(e,t,s,r){const a=r?.stretch??e.stretch;return`${r?.italic?"italic ":""}${r?.weight??e.weight} ${a&&a!=="normal"?a+" ":""}${t}px "${r?.font??s}", sans-serif`}function Pe(e,t,s,r,a){e.font=Qe(t,s,r,a),"letterSpacing"in e&&(e.letterSpacing=`${((a?.tracking??t.tracking??0)*s).toFixed(2)}px`)}const Me=e=>{const t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)},At="#ff2a1f";function Ct(e,t,s,r,a,h,u){const g=Math.max(a*.3,e.measureText(t).width),l=Math.floor(u*14),f=Math.round(2+h*8),i=e.globalAlpha;e.save(),e.shadowColor="transparent",e.filter="none";for(let d=0;d<f;d++){const w=c=>Me(d*13.71+c*3.17+s*.0137+l*.731),m=Math.round(a*(.07+.2*w(1))),v=s-a*.25+(g+a*.5)*w(2)-m/2,T=r-a*1.05+a*1.25*w(3)-m/2;e.globalAlpha=i*Math.min(1,h*1.6)*(.65+.35*w(4)),e.fillStyle=d%3===2?"#ffffff":At,e.fillRect(Math.round(v),Math.round(T),m,m)}e.restore()}function Ze(e,t,s,r){const{fontSize:a,placement:h,fontFamily:u="Arial",align:g="center"}=t,l=s.stack==="ink";e.textBaseline=l?"alphabetic":"middle",e.textAlign="left";const f=!!s.lines,i=s.maxWidth?s.maxWidth*ee.width:1050,d=!!s.lines?.some(T=>T.side||T.x||T.y||T.align),w=T=>{const c=[],A=r.split(`
|
|
4
|
+
`);A.forEach((y,N)=>{const H=qe(s,N,A.length);let te=a*(H?.scale??1)*T;if(Pe(e,s,te,u,H),f){const k=d?i*T:i,M=e.measureText(y||" ").width;M>k&&(te*=k/M,Pe(e,s,te,u,H))}const o=[];let b="";if(f)o.push(y);else if(s.wrap==="word"){for(const k of y.split(/(\s+)/))if(b&&b.trim()&&e.measureText(b+k).width>i&&k.trim()&&(o.push(b.trimEnd()),b=""),!(!b&&!k.trim()))if(e.measureText(k).width>i)for(const M of he(k))b&&e.measureText(b+M).width>i&&(o.push(b),b=""),b+=M;else b+=k;o.push(b.trimEnd())}else{for(const k of he(y))b&&e.measureText(b+k).width>i&&(o.push(b),b=""),b+=k;o.push(b)}for(const k of o){const M=e.measureText(k||" ");c.push({text:k,paragraph:N,size:te,fill:H?.fill,style:H,width:M.width,left:0,center:0,ascent:l?M.actualBoundingBoxAscent:te*.56,descent:l?M.actualBoundingBoxDescent:te*.56})}});const p=c.map(y=>l?y.ascent+y.descent:y.size*s.lineHeight),S=c.map(y=>l?(s.gap??.08)*y.size:0),z=y=>!!y.style?.side,Y=c.map((y,N)=>N).filter(y=>!z(c[y]));let I=0;Y.forEach((y,N)=>{I+=p[y]+(N?S[y]:0)});const _=(h==="top"?80:h==="lower"?640-I:ee.height/2-I/2)+(s.shiftY??0)*ee.height,F=(g==="left"?90:g==="right"?1190:ee.width/2)+(s.shiftX??0)*ee.width,W=Math.max(0,...Y.map(y=>c[y].width)),G=g==="left"?F:g==="right"?F-W:F-W/2;let V=_;if(Y.forEach((y,N)=>{const H=c[y];N&&(V+=S[y]),H.center=V+p[y]/2,V+=p[y];const te=H.style?.align??g;H.left=te==="left"?G:te==="right"?G+W-H.width:G+(W-H.width)/2}),!d)return{rows:c,heights:p,gaps:S,total:I,box:{x:G,y:_,w:W,h:I},extras:d,ink:l};const E=a*T;for(const y of c)z(y)&&(y.center=_+I/2,y.left=y.style.side==="left"?G-.12*E-y.width:G+W+.12*E),y.left+=(y.style?.x??0)*E,y.center+=(y.style?.y??0)*E;const ae=Math.min(...c.map(y=>y.left)),ge=Math.max(...c.map(y=>y.left+y.width)),se=Math.min(...c.map((y,N)=>y.center-p[N]/2)),ke=Math.max(...c.map((y,N)=>y.center+p[N]/2)),Ae=g==="left"?F-ae:g==="right"?F-ge:F-(ae+ge)/2,ce=(h==="top"?80:h==="lower"?640-(ke-se):ee.height/2-(ke-se)/2)+(s.shiftY??0)*ee.height-se;for(const y of c)y.left+=Ae,y.center+=ce;return{rows:c,heights:p,gaps:S,total:I,box:{x:ae+Ae,y:se+ce,w:ge-ae,h:ke-se},extras:d,ink:l}};let m=w(1),v=1;for(let T=0;T<4;T++){const c=m.extras?m.box.h:m.total,A=Math.max(c/560,m.extras?m.box.w/i:0);if(A<=1)break;v*=.98/A,m=w(v)}if((m.extras?m.box.h:m.total)>560)throw Error("Text is too long for the frame; reduce copy or font size");return m}const xe=(e,t)=>(t.uppercase?e.text.toLocaleUpperCase("vi"):e.text).normalize("NFC");function Et(e){const t=Ye(1,1).getContext("2d");if(!t)return[];if(!e.design){const s=e.text.split(`
|
|
5
|
+
`).length,r=Math.min(560,s*e.fontSize*1.3);return[{paragraph:-1,x:115,y:e.placement==="top"?80:e.placement==="lower"?640-r:360-r/2,w:1050,h:r,rotate:0}]}try{const s=Ze(t,e,e.design,xe(e,e.design));return s.rows.map((r,a)=>({paragraph:r.paragraph,x:r.left,y:r.center-s.heights[a]/2,w:r.width,h:s.heights[a],rotate:r.style?.rotate??0}))}catch{return[]}}function vt(e,t,s,r,a,h){const u=[[t,s+h*.1],[t+r*.55,s+h*.2],[t+r,s-h*.26]],g=28,l=[],f=[];for(let i=0;i<=g;i++){const d=i/g,w=(1-d)*(1-d),m=2*(1-d)*d,v=d*d,T=w*u[0][0]+m*u[1][0]+v*u[2][0],c=w*u[0][1]+m*u[1][1]+v*u[2][1],A=2*(1-d)*(u[1][0]-u[0][0])+2*d*(u[2][0]-u[1][0]),p=2*(1-d)*(u[1][1]-u[0][1])+2*d*(u[2][1]-u[1][1]),S=Math.hypot(A,p)||1,z=a*Math.pow(Math.sin(Math.PI*d),.55)*(1.25-.55*d)/2;l.push([T-p/S*z,c+A/S*z]),f.push([T+p/S*z,c-A/S*z])}e.beginPath(),e.moveTo(l[0][0],l[0][1]);for(const i of l.slice(1))e.lineTo(i[0],i[1]);for(const i of f.reverse())e.lineTo(i[0],i[1]);e.closePath()}function Ge(e,t,s,r,a){if(e.globalAlpha*=Math.min(1,Math.max(0,t.opacity)),e.globalAlpha<.002)return!1;const h=a*.3;if(t.wipeX<1){const l=(s.w+2*h)*Math.max(0,t.wipeX);e.beginPath(),e.rect(r==="right"?s.x+s.w+h-l:s.x-h,s.y-a*2,l,s.h+a*4),e.clip()}if(t.wipeY<1){const l=(s.h+2*h)*Math.max(0,t.wipeY);e.beginPath(),e.rect(s.x-a*2,r==="bottom"?s.y+s.h+h-l:s.y-h,s.w+a*4,l),e.clip()}const u=r==="left"?s.x:r==="right"?s.x+s.w:s.x+s.w/2,g=r==="top"?s.y:r==="bottom"?s.y+s.h:s.y+s.h/2;return e.translate(u+t.x*a,g+t.y*a),e.rotate(t.rotate*Math.PI/180),e.scale(t.scale*t.scaleX,t.scale*t.scaleY),e.translate(-u,-g),!0}const je=[];function De(e,t,s){let r=je[e];return(!r||r.width!==t||r.height!==s)&&(r=typeof document<"u"?Object.assign(document.createElement("canvas"),{width:t,height:s}):new OffscreenCanvas(t,s),je[e]=r),r.getContext("2d")}function zt(e,t,s,r){const a=e.canvas.width,h=e.canvas.height,u=e.getTransform(),g=De(0,a,h),l=De(1,a,h),f=i=>{i.font=e.font,i.textAlign=e.textAlign,i.textBaseline=e.textBaseline;const d=i,w=e;for(const m of["letterSpacing","fontStretch","fontKerning"])m in w&&(d[m]=w[m])};g.setTransform(1,0,0,1,0,0),g.globalCompositeOperation="source-over",g.clearRect(0,0,a,h),g.fillStyle=s,g.fillRect(0,0,a,h),g.setTransform(u),f(g),g.globalCompositeOperation="destination-out",g.fillStyle="#000",t(g),l.setTransform(1,0,0,1,0,0),l.globalCompositeOperation="source-over",l.clearRect(0,0,a,h),l.filter=`blur(${Math.max(.5,r).toFixed(1)}px)`,l.drawImage(g.canvas,0,0),l.filter="none",l.setTransform(u),f(l),l.globalCompositeOperation="destination-in",l.fillStyle="#000",t(l),e.save(),e.setTransform(1,0,0,1,0,0),e.shadowColor="transparent",e.filter="none",e.drawImage(l.canvas,0,0),e.restore()}function It(e,t,s,r,a,h){const{fontSize:u,fontFamily:g="Arial"}=t,l=qe(s,0,1),f=u*(l?.scale??1);Pe(e,s,f,g,l);const i=he(r.replace(/\s*\n\s*/g," ")),d=i.map(p=>e.measureText(p).width),w=h?h.time:0,m=it(s.path,d,w,ee),v=i.length,T=h&&t.animation?Math.min(.8,Math.max(.1,h.duration*.4)):0,c=p=>{if(typeof p=="string")return a(p);const S=f*.5,z=(p.angle??90)*Math.PI/180,Y=Math.cos(z)*S,I=Math.sin(z)*S,_=p.type==="radial"?e.createRadialGradient(0,0,0,0,0,f*.6):e.createLinearGradient(-Y,-I,Y,I);return p.gradient.forEach((F,W)=>_.addColorStop(p.stops?.[W]??W/Math.max(1,p.gradient.length-1),a(F))),_};e.textAlign="center",e.textBaseline="middle";const A=h&&t.animators?.length?Ue(t.animators,Ne([i.join("")]),h.time):null;for(const p of s.layers){if(p.type!=="text")continue;e.save(),e.globalAlpha=p.opacity,p.shadow&&(e.shadowColor=a(p.shadow.color),e.shadowBlur=p.shadow.blur*f,e.shadowOffsetX=p.shadow.x*f,e.shadowOffsetY=p.shadow.y*f);const S=(p.offset?.x||0)*f,z=(p.offset?.y||0)*f;i.forEach((Y,I)=>{const _=m[I];if(!_.visible||!Y.trim())return;const F=T?Math.min(1,Math.max(0,(w-I/Math.max(1,v)*T)/.15)):1;if(F<=0)return;const W=A?.[I];if(W&&(W.opacity<=.002||W.scale<=1e-4))return;e.save(),e.globalAlpha*=F,e.translate(_.x+S,_.y+z),e.rotate(_.angle);const G=()=>{p.stroke&&(e.strokeStyle=a(p.stroke.color),e.lineWidth=Math.max(1.5,p.stroke.width*f),e.strokeText(Y,0,0)),e.fillStyle=c(p.fill),e.fillText(Y,0,0)};W?et(e,W,0,0,G,V=>V==="fill"?e.fillText(Y,0,0):e.strokeText(Y,0,0)):G(),e.restore()}),e.restore()}}const ve=new Map;function $t(e,t,s){const r=e.font+"|"+(e.letterSpacing??"")+"|"+t;let a=ve.get(r);if(!a){let h="";a=[0];for(const u of s)h+=u,a.push(e.measureText(h).width);ve.size>400&&ve.clear(),ve.set(r,a)}return a}function et(e,t,s,r,a,h){e.globalAlpha*=t.opacity,e.translate(s+t.x,r+t.y),t.rotate&&e.rotate(t.rotate*Math.PI/180),t.skew&&e.transform(1,0,Math.tan(-t.skew*Math.PI/180),1,0,0),t.scale!==1&&e.scale(t.scale,t.scale),e.translate(-s,-r),t.blur>.05&&(e.filter=`blur(${t.blur.toFixed(1)}px)`),t.stroke>.05&&t.strokeColor&&(e.save(),e.lineWidth=t.stroke*2,e.lineJoin="round",e.strokeStyle=t.strokeColor,h("stroke"),e.restore()),a(),t.fill&&t.fillAmount>.002&&(e.save(),e.shadowColor="transparent",e.globalAlpha*=t.fillAmount,e.fillStyle=t.fill,h("fill"),e.restore())}function Je(e,t,s,r){const{fontSize:a,color:h,fontFamily:u="Arial",align:g="center",accentColor:l="#dfff00"}=t,f=xe(t,s),i=o=>o==="{color}"?h:o==="{accent}"?l:o==="{accent-hi}"?Re(l,255,.5):o==="{accent-lo}"?Re(l,0,.45):o==="{accent-bright}"?Le(l)[0]:o==="{accent-deep}"?Le(l)[1]:o==="{color-lo}"?Re(h,0,.45):o==="transparent"?"rgba(0,0,0,0)":o;if(e.lineJoin="round",s.path){It(e,t,s,f,i,r);return}const{rows:d,heights:w,total:m,box:v,extras:T,ink:c}=Ze(e,t,s,f),A=o=>c?o.center+(o.ascent-o.descent)/2:o.center,p=o=>c?w[o]:d[o].size*1.12,S=Math.max(...d.map(o=>o.paragraph))+1,z=r&&t.animation?t.animation:void 0,Y=z?Array.from({length:S},(o,b)=>{const k=d.filter(M=>M.paragraph===b).map(M=>M.text).join(" ");return{word:Math.max(1,k.split(/\s+/).filter(Boolean).length),char:Math.max(1,he(k.replace(/\s/g,"")).length)}}):[],I=z&&r?ht(z,Y,r.time,r.duration,ft(s,d.length)):r?r.time:1e6,_={...dt,masked:!1},F=(o,b,k,M)=>z?gt(z,o,b,k,M,I):_,W=(o,b,k,M,n,oe)=>typeof o=="string"?be(i(o),oe):Ke(e,o,b,k,M,n,Q=>be(i(Q),oe));let G=0,V=0;const E=(o,b,k,M,n,oe=b-4e3,Q=8e3)=>{if(e.globalAlpha*=Math.min(1,Math.max(0,o.opacity)),o.flicker>0&&Me(Math.floor(I*24)+b*.01)<o.flicker&&(e.globalAlpha=0),o.reveal<1||o.masked){const $=Math.max(0,M*o.reveal);e.beginPath(),e.rect(-4e3,k-$,8e3,$*2),e.clip()}o.wipeX<1&&(e.beginPath(),e.rect(oe-n*.1,k-M*1.6,(Q+n*.2)*Math.max(0,o.wipeX),M*3.2),e.clip()),o.wipeY<1&&(e.beginPath(),e.rect(-4e3,k-M*1.2,8e3,M*2.4*Math.max(0,o.wipeY)),e.clip());const j=o.glitch>0?o.glitch*n*.35*(Me(Math.floor(I*18)+k*.01)*2-1):0;G=Math.max(G,o.glitch),V=Math.max(V,o.pixels);const O=o.scatter>0?o.scatter*n*(Me(b*.0173+k*.0071+1.3)*2-1):0,K=o.scatter>0?o.scatter*n*.7*(Me(b*.0119+k*.0153+7.9)*2-1):0;return e.translate(b+o.x*n+j+O,k+o.y*n+K),e.rotate(o.rotate*Math.PI/180),e.scale(o.scale*o.scaleX,o.scale*o.scaleY),e.translate(-b,-k),o.blur>0&&(e.filter=`blur(${(o.blur*n).toFixed(1)}px)`),o.brightness},ae=o=>{Pe(e,s,o.size,u,o.style);const b=d.filter(O=>O.paragraph===o.paragraph&&d.indexOf(O)<d.indexOf(o));let k=he(b.map(O=>O.text).join("").replace(/\s/g,"")).length,M=b.map(O=>O.text).join(" ").split(/\s+/).filter(Boolean).length;const n=[];let oe=M-1,Q=!0,j="";for(const O of he(o.text)){const K=e.measureText(j).width;if(j+=O,/\s/.test(O)){Q=!0;continue}Q&&(oe++,Q=!1),n.push({text:O,x:o.left+K,w:e.measureText(j).width-K,char:k++,word:oe})}return n},ge=(o,b)=>!!z?.in.some(k=>k.unit===b&&(!k.lines||k.lines.includes(o))),se=o=>Y[o]||{word:1,char:1},ke=Array.from({length:S},(o,b)=>d.filter(k=>k.paragraph===b).map(k=>k.text).join(" ").split(/\s+/).filter(Boolean).length),Ae=o=>ke.slice(0,o).reduce((b,k)=>b+k,0),ce=o=>o.style?.align??g,y=r&&t.animators?.length?t.animators:null,N=y?Ne(d.map(o=>o.text)):null,H=y&&N?Ue(y,N,r.time):null,te=[];if(N){let o=0;for(let b=0;b<d.length;b++)te.push(o),o+=he(d[b].text).length}for(const o of s.layers){if(o.type==="texture"){Mt(e,o,i(o.color));continue}if(o.type==="shape"||o.type==="icon"){e.save(),Ft(e,o,I,i),e.restore();continue}if(e.save(),e.globalAlpha=o.opacity,o.type==="box"&&o.per==="block"){const M=d[0],n=F("line",M.paragraph,M.paragraph,S),oe=o.padX*a,Q=o.padY*a,j=(T?v.x:Math.min(...d.map(L=>L.left)))-oe,O=(T?v.y:d[0].center-p(0)/2)-Q,K=(T?v.w:Math.max(...d.map(L=>L.width)))+oe*2,$=(T?v.h:m-(w[0]-p(0))/2-(w.at(-1)-p(d.length-1))/2)+Q*2,U=E(n,j+K/2,O+$/2,$/2,a);(!o.motion||Ge(e,Ee(o.motion,I),{x:j,y:O,w:K,h:$},o.motion.origin,a))&&(o.skewX&&(e.translate(j+K/2,O+$/2),e.transform(1,0,Math.tan(-o.skewX*Math.PI/180),1,0,0),e.translate(-j-K/2,-O-$/2)),o.shadow&&(e.shadowColor=i(o.shadow.color),e.shadowBlur=o.shadow.blur*a,e.shadowOffsetX=o.shadow.x*a,e.shadowOffsetY=o.shadow.y*a),e.fillStyle=W(o.fill,j,O,K,$,U),e.beginPath(),e.roundRect(j,O,K,$,o.radius*a),e.fill(),o.stroke&&(e.strokeStyle=be(i(o.stroke.color),U),e.lineWidth=Math.max(1.5,o.stroke.width*a),e.stroke())),e.restore();continue}const b=d.map((M,n)=>o.lines?o.lines.includes(M.paragraph):o.type==="underline"?o.line==="all"||n===d.length-1:!0);let k=0;for(const[M,n]of d.entries()){if(!b[M])continue;const oe=k++;e.save();const Q=n.left+n.width/2;n.style?.rotate&&(e.translate(Q,n.center),e.rotate(n.style.rotate*Math.PI/180),e.translate(-Q,-n.center));const j=F("line",n.paragraph,n.paragraph,S);G=0,V=0;const O=E(j,Q,n.center,w[M]/2+n.size*.1,n.size,n.left,n.width),K=$=>!o.motion||Ge(e,Ee(o.motion,I-(o.motion.stagger??0)*oe),$,o.motion.origin,n.size);if(o.type==="box"){const $=o.padX*n.size,U=o.padY*n.size,L=n.left-$,B=n.center-p(M)/2-U,D=n.width+$*2,fe=p(M)+U*2;K({x:L,y:B,w:D,h:fe})&&(o.skewX&&(e.translate(L+D/2,B+fe/2),e.transform(1,0,Math.tan(-o.skewX*Math.PI/180),1,0,0),e.translate(-L-D/2,-B-fe/2)),o.shadow&&(e.shadowColor=i(o.shadow.color),e.shadowBlur=o.shadow.blur*n.size,e.shadowOffsetX=o.shadow.x*n.size,e.shadowOffsetY=o.shadow.y*n.size),e.fillStyle=W(o.fill,L,B,D,fe,O),e.beginPath(),e.roundRect(L,B,D,fe,o.radius*n.size),e.fill(),o.stroke&&(e.strokeStyle=be(i(o.stroke.color),O),e.lineWidth=Math.max(1.5,o.stroke.width*n.size),e.stroke()))}if(o.type==="underline"){const $=n.width*o.width,U=ce(n),L=U==="left"?n.left:U==="right"?n.left+n.width-$:n.left+(n.width-$)/2,B=n.center+o.offsetY*n.size,D=Math.max(3,o.height*n.size);K({x:L,y:B-(o.style==="swash"?n.size*.3:0),w:$,h:D+(o.style==="swash"?n.size*.5:0)})&&(e.fillStyle=W(o.fill,L,B,$,D,O),o.style==="swash"?(vt(e,L,B,$,D,n.size),e.fill()):e.fillRect(L,B,$,D))}if(o.type==="text"){Pe(e,s,n.size,u,n.style);const $=j.count!==1?pt(n.text,j.count):n.text;let U=n.left,L=n.width;if($!==n.text){L=e.measureText($).width;const P=ce(n);U=P==="left"?n.left:P==="right"?n.left+n.width-L:n.left+(n.width-L)/2}const B=(o.offset?.x||0)*n.size,D=(o.offset?.y||0)*n.size;if(r&&o.flicker&&Me(Math.floor(I*12)*1.37+5)<o.flicker&&(e.globalAlpha*=.18),!K({x:U+B-n.size*.05,y:n.center-p(M)/2+D-n.size*.12,w:L+n.size*.1,h:p(M)+n.size*.24})){e.restore();continue}o.shadow&&(e.shadowColor=i(o.shadow.color),e.shadowBlur=o.shadow.blur*n.size,e.shadowOffsetX=o.shadow.x*n.size,e.shadowOffsetY=o.shadow.y*n.size);const fe=o.lineFills?o.lineFills[M%o.lineFills.length]:void 0;let we=null;if(r&&o.shine){const P=o.shine;let X=I-P.start;X>=0&&P.every>0&&(X%=P.every);const q=X/P.duration;if(X>=0&&q<1){const C=P.width*n.size,R=U-C+(L+C*2)*q,Z=P.angle*Math.PI/180,x=i(P.color);we=e.createLinearGradient(R-C*Math.cos(Z),n.center-C*Math.sin(Z),R+C*Math.cos(Z),n.center+C*Math.sin(Z)),we.addColorStop(0,Te(x,0)),we.addColorStop(.5,Te(x,1)),we.addColorStop(1,Te(x,0))}}const tt=fe??(n.fill&&o.fill==="{color}"?n.fill:o.fill),ot=n.center-p(M)/2+D,at=(P,X)=>W(P,U+B,ot,L,p(M),X),nt=o.reflection?A(n)+D+e.measureText($).actualBoundingBoxDescent:0,Se=(P,X,q,C)=>{const R=A(n)+D,Z=C??tt;if(V>.02&&Ct(e,P,X+B,R,n.size,V,I),G>.02){const x=e.globalAlpha,ne=G*n.size*.08;e.globalAlpha=x*.85,e.fillStyle="#fd436a",e.fillText(P,X+B+ne,R),e.fillStyle="#37eaff",e.fillText(P,X+B-ne,R),e.globalAlpha=x}if(o.stroke&&(e.strokeStyle=be(i(o.stroke.color),q),e.lineWidth=Math.max(2,o.stroke.width*n.size),e.strokeText(P,X+B,R)),e.fillStyle=at(Z,q),e.fillText(P,X+B,R),o.innerGlow){const x=e.getTransform();zt(e,ne=>ne.fillText(P,X+B,R),be(i(o.innerGlow.color),q),o.innerGlow.blur*n.size*Math.hypot(x.a,x.b))}if(we&&(e.save(),e.shadowColor="transparent",e.fillStyle=we,e.fillText(P,X+B,R),e.restore()),o.reflection){const x=o.reflection,ne=nt+x.gap*n.size,Oe=p(M)*x.fade,J=i(Pt(Z)),de=!/^#[0-9a-f]{6}$/i.test(J),pe=de&&o.stroke?i(o.stroke.color):J;e.save(),e.shadowColor="transparent",e.filter="none",e.translate(0,2*ne),e.scale(1,-1);const ye=e.createLinearGradient(0,ne,0,ne-Oe);ye.addColorStop(0,Te(pe,x.opacity)),ye.addColorStop(1,Te(pe,0)),de&&o.stroke?(e.strokeStyle=ye,e.lineWidth=Math.max(2,o.stroke.width*n.size),e.strokeText(P,X+B,R)):(e.fillStyle=ye,e.fillText(P,X+B,R)),e.restore()}},me=new Map;for(const P of o.highlights??[])for(const X of P.words)me.set(X,P.fill);const ze=Ae(n.paragraph),Ie=ge(n.paragraph,"word"),$e=ge(n.paragraph,"char"),Fe=j.spread;if(H){const P=he(n.text),X=$t(e,n.text,P),q=te[M],C=ae(n);let R=0;for(let J=0;J<P.length;J++)R+=H[q+J].tracking;const Z=ce(n);let ne=Z==="left"?0:Z==="right"?-R:-R/2,Oe=0;for(let J=0;J<P.length;J++){const de=H[q+J],pe=n.left+X[J],ye=X[J+1]-X[J],We=!/\S/u.test(P[J]),le=We?null:C[Oe++],Ce=ne;if(ne+=de.tracking,We||!le||de.opacity<=.002||de.scale<=1e-4)continue;e.save();let Be=O;Ie&&(Be*=E(F("word",n.paragraph,le.word,se(n.paragraph).word),le.x+le.w/2,n.center,w[M]/2+n.size*.1,n.size)),$e&&(Be*=E(F("char",n.paragraph,le.char,se(n.paragraph).char),le.x+le.w/2,n.center,w[M]/2+n.size*.1,n.size)),e.globalAlpha>.002&&et(e,de,pe+Ce+B+ye/2,n.center,()=>Se(P[J],pe+Ce,Be,me.get(ze+le.word)),st=>st==="fill"?e.fillText(P[J],pe+Ce+B,A(n)+D):e.strokeText(P[J],pe+Ce+B,A(n)+D)),e.restore()}}else if(!Ie&&!$e&&!Fe)if(!me.size||$!==n.text)Se($,U,O);else{const P=new Map;for(const C of ae(n)){const R=ze+C.word,Z=P.get(R);P.set(R,Z?{x0:Math.min(Z.x0,C.x),x1:Math.max(Z.x1,C.x+C.w)}:{x0:C.x,x1:C.x+C.w})}const X=[...P].filter(([C])=>me.has(C)),q=n.size*.04;e.save(),e.beginPath(),e.rect(-1e5,-1e5,2e5,2e5);for(const[,C]of X)e.rect(C.x0+B-q,-1e5,C.x1-C.x0+q*2,2e5);e.clip("evenodd"),Se($,U,O),e.restore();for(const[C,R]of X)e.save(),e.beginPath(),e.rect(R.x0+B-q,-1e5,R.x1-R.x0+q*2,2e5),e.clip(),Se($,U,O,me.get(C)),e.restore()}else{const P=ae(n),X=(P.length-1)/2;for(const[q,C]of P.entries()){e.save(),Fe&&e.translate((q-X)*Fe*n.size,0);let R=O;Ie&&(R*=E(F("word",n.paragraph,C.word,se(n.paragraph).word),C.x+C.w/2,n.center,w[M]/2+n.size*.1,n.size)),$e&&(R*=E(F("char",n.paragraph,C.char,se(n.paragraph).char),C.x+C.w/2,n.center,w[M]/2+n.size*.1,n.size)),e.globalAlpha>.002&&Se(C.text,C.x,R,me.get(ze+C.word)),e.restore()}}}e.restore()}e.restore()}}function Ft(e,t,s,r){const a=ee.width,h=ee.height,u=Ee(t.motion,s);if(e.globalAlpha=t.opacity*Math.min(1,Math.max(0,u.opacity)),e.globalAlpha<.002)return;let g,l,f,i;t.type==="shape"?(g=(t.box[0]+t.box[2]/2)*a,l=(t.box[1]+t.box[3]/2)*h,f=t.box[2]*a,i=t.box[3]*h):(f=i=t.size*h,g=t.center[0]*a,l=t.center[1]*h);const d=t.motion?.origin??"center",w=d==="left"?g-f/2:d==="right"?g+f/2:g,m=d==="top"?l-i/2:d==="bottom"?l+i/2:l;if(u.wipeX<1&&(e.beginPath(),e.rect(g-f/2-8,l-i/2-8,(f+16)*Math.max(0,u.wipeX),i+16),e.clip()),u.wipeY<1&&(e.beginPath(),e.rect(g-f/2-8,l-i/2-8,f+16,(i+16)*Math.max(0,u.wipeY)),e.clip()),e.translate(w+u.x*a,m+u.y*h),e.scale(u.scale*u.scaleX,u.scale*u.scaleY),e.translate(g-w,l-m),e.rotate(((t.rotate||0)+u.rotate)*Math.PI/180),t.type==="shape"){if(t.skewX&&e.transform(1,0,Math.tan(t.skewX*Math.PI/180),1,0,0),t.blur&&(e.filter=`blur(${(t.blur*h).toFixed(1)}px)`),t.shape==="glow"){const c=typeof t.fill=="string"?r(t.fill):r(t.stroke?.color??"{accent}"),A=Math.max(f,i)/2;e.scale(f/2/A,i/2/A);const p=e.createRadialGradient(0,0,0,0,0,A);p.addColorStop(0,c),p.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=p,e.beginPath(),e.arc(0,0,A,0,Math.PI*2),e.fill();return}e.beginPath(),t.shape==="rect"?e.roundRect(-f/2,-i/2,f,i,Math.min(f,i)/2*Math.min(1,t.radius*2)):e.ellipse(0,0,f/2,i/2,0,0,Math.PI*2),t.fill&&(typeof t.fill=="string"?e.fillStyle=r(t.fill):e.fillStyle=Ke(e,t.fill,-f/2,-i/2,f,i,r),e.fill()),t.stroke&&(e.strokeStyle=r(t.stroke.color),e.lineWidth=t.stroke.width,e.setLineDash(t.stroke.dash??[]),e.stroke());return}if(t.glow&&(e.shadowColor=r(t.color),e.shadowBlur=t.glow*f*.5),t.badge!=="none"){e.save(),t.badge==="diamond"&&e.rotate(Math.PI/4);const c=t.badge==="diamond"?f*.72:f;e.beginPath(),t.badge==="circle"?e.arc(0,0,f/2,0,Math.PI*2):e.roundRect(-c/2,-c/2,c,c,t.badge==="square"?0:c*.22),t.badgeFill&&(e.fillStyle=r(t.badgeFill),e.fill()),t.badgeStroke&&(e.strokeStyle=r(t.badgeStroke),e.lineWidth=2,e.stroke()),e.restore()}e.shadowBlur=0;const v=f*.6,T=v/24;e.translate(-v/2,-v/2),e.scale(T,T),e.strokeStyle=r(t.color),e.lineWidth=t.width,e.lineCap="round",e.lineJoin="round";for(const c of ut[t.name]??[])e.stroke(new Path2D(c))}function Ot(e){const t=[];for(const s of Array.from(document.styleSheets)){let r;try{r=s.cssRules}catch{continue}for(const a of Array.from(r))if(a instanceof CSSFontFaceRule&&a.style.getPropertyValue("font-family").replace(/['"]/g,"").trim()===e){const h=a.style.getPropertyValue("src");if(!h)continue;t.push(new FontFace(e,h,{weight:a.style.getPropertyValue("font-weight")||"normal",stretch:a.style.getPropertyValue("font-stretch")||"normal",style:a.style.getPropertyValue("font-style")||"normal"}))}}return t}const Ve=async(e,t)=>{try{return await document.fonts.load(e,t),!0}catch{}await new Promise(r=>setTimeout(r,400));const s=e.match(/"([^"]+)"/)?.[1]??"";try{const r=Ot(s);return r.length?(await Promise.all(r.map(a=>a.load().then(()=>document.fonts.add(a)))),!0):!1}catch{return!1}};async function Yt(e){const t=lt(e),s=[];if(t.length){const l=await rt(()=>import("./userFonts-DzY0A4bD.js"),__vite__mapDeps([0,1,2,3,4]));await l.userFontsReady();for(const f of t)l.isMissingCustomFont(f)&&s.push(f)}const r=e.design?.weight??(e.styleId&&e.styleId!=="classic"?800:600),a=e.design?.stretch&&e.design.stretch!=="normal"?e.design.stretch+" ":"",h=e.fontFamily||"Arial",u=[];await Ve(`${r} ${a}${e.fontSize}px "${h}"`,e.text)||u.push(h);const g=e.design;if(g?.lines?.some(l=>l.font||l.weight||l.italic||l.stretch)){const l=[...new Set(g.lines.map(i=>Qe(g,e.fontSize,h,i).replace(/ sans-serif$/,"").replace(/,$/,"")))],f=await Promise.all(l.map(i=>Ve(i,e.text)));l.forEach((i,d)=>{f[d]||u.push(i.replace(/^.*?"([^"]+)".*$/,"$1"))})}return[...new Set([...u.filter(l=>!s.includes(l)),...s])]}export{Rt as d,Yt as l,Et as t};
|