clipoox-render 0.2.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 +1413 -0
- package/package.json +5 -3
- package/scripts/render-local.mjs +1514 -1379
- package/shared/transitionStarterPack.json +616 -0
- package/web/assets/{FxEmbed-BymBArNa.js → FxEmbed-CGqGi2Lw.js} +1 -1
- package/web/assets/{GLTFLoader-Dy6SrZg8.js → GLTFLoader-BHWu1lKg.js} +1 -1
- package/web/assets/{MotionEmbed-PmXWSWe5.js → MotionEmbed-C3CZ3_y_.js} +1 -1
- package/web/assets/PluginStore-DKXZ-jBj.js +3 -0
- package/web/assets/{ShotComposer-Dprx-Yi7.js → ShotComposer-DFfaYLoV.js} +4 -4
- package/web/assets/TemplateEmbed-C8pXcPsc.js +2 -0
- package/web/assets/TimelinePlugins-DYarX9RK.css +1 -0
- package/web/assets/TimelinePlugins-DnkV3i4G.js +5 -0
- package/web/assets/TimelineShotFx-foiuuogg.js +2 -0
- package/web/assets/TransitionEmbed-BueDilY0.js +1 -0
- package/web/assets/{Whiteboard-DybaKCdo.js → Whiteboard-zBsNHh5h.js} +3 -3
- package/web/assets/aerial-z34Nww_T.js +2 -0
- package/web/assets/{agentTools-CxZqRLeR.js → agentTools-ALxghYpf.js} +2 -2
- package/web/assets/analyzerRun-DNwryAlU.js +1 -0
- package/web/assets/{analyzerSandbox-DO5ZTv5q.js → analyzerSandbox-A1oFsCrO.js} +2 -2
- package/web/assets/{api-BsKbf3l3.js → api-DUp403BK.js} +158 -158
- package/web/assets/auraTrack-BKVZCwNt.js +1 -0
- package/web/assets/breakthrough-Cwt8gEwK.js +2 -0
- package/web/assets/{cameraPresets-B234aNzE.js → cameraPresets-DSOPj4oy.js} +1 -1
- package/web/assets/{captionLayout-CNgb471H.js → captionLayout-EuB59pN_.js} +1 -1
- package/web/assets/clientExport-BL1XMTF0.js +1 -0
- package/web/assets/depthEstimate-DOvsY8mn.js +1 -0
- package/web/assets/{directorTools-BqFcShgT.js → directorTools-BkbNYbSq.js} +1 -1
- package/web/assets/{distortFrames-D3TQNcJA.js → distortFrames-Drch0LhT.js} +2 -2
- package/web/assets/{distortGL-BklPDXPq.js → distortGL-BlmBZKRU.js} +2 -2
- package/web/assets/{editTools-BQlG5WB_.js → editTools-BcGinqHC.js} +1 -1
- package/web/assets/{exportEncode-CaKEPgsy.js → exportEncode-MUwVTI52.js} +1 -1
- package/web/assets/{exportGlb-DstxwzH5.js → exportGlb-SIXFRRJM.js} +1 -1
- package/web/assets/faceTracker-DCbZbLMc.js +1 -0
- package/web/assets/fightDirector-hlF1JS_z.js +1 -0
- package/web/assets/fightDrama-fHN5EXk3.js +2 -0
- package/web/assets/{frameSink-Dj71jCRb.js → frameSink-BvOXjLuw.js} +3 -3
- package/web/assets/{gpuCompose-DIxBHlTa.js → gpuCompose-CNkLwpbZ.js} +1 -1
- package/web/assets/gpuExport-DQB6x4eh.js +194 -0
- package/web/assets/handMatte-BD7OE3Zc.js +1 -0
- package/web/assets/handTracker-BumGtRCW.js +2 -0
- package/web/assets/{index-CZn97Ygs.js → index-CuaB7Y0L.js} +1 -1
- package/web/assets/layer-worker-DxPMMKIZ.js +5 -0
- package/web/assets/library-CyjJ8nGG.js +1 -0
- package/web/assets/{lottieLayer-CfUPParC.js → lottieLayer-1ET89OUr.js} +5 -5
- package/web/assets/{lottie_light_canvas-7iv3btPX.js → lottie_light_canvas-DD9pkFL8.js} +1 -1
- package/web/assets/main-BKjBWQik.js +309 -0
- package/web/assets/{main-BPmr0TOL.css → main-Ca_CVxMz.css} +1 -1
- package/web/assets/mapBake-DLoBt_k5.js +1 -0
- package/web/assets/maskTrack-C2SJbDGO.js +1 -0
- package/web/assets/matteFixRun-BdHKC3m5.js +1 -0
- package/web/assets/{objectLocate-BDqfSo9J.js → objectLocate-bZtc5AJo.js} +1 -1
- package/web/assets/{objectTrack.worker-ENzKeSiV.js → objectTrack.worker-BlZkgpOX.js} +483 -352
- package/web/assets/pendingMatte-mlyLLZCT.js +2 -0
- package/web/assets/personAi-CUNQeseG.js +2 -0
- package/web/assets/plateCamera-_jP1xXnj.js +1 -0
- package/web/assets/{plateCameraMatch-D41LQrsm.js → plateCameraMatch-rr0oUwQ2.js} +2 -2
- package/web/assets/{plateFollow-CNfi4xuP.js → plateFollow-BjvtcT8q.js} +2 -2
- package/web/assets/plateMatte-BqyL8cQZ.js +2 -0
- package/web/assets/{pluginAutomation-BtQ_w2TB.js → pluginAutomation-Dp188qm7.js} +1 -1
- package/web/assets/poseTracker-DDGDhhMF.js +1 -0
- package/web/assets/{productTools-r2RgILaA.js → productTools-CRgI88-O.js} +2 -2
- package/web/assets/remote-Dva2qg58.js +1241 -0
- package/web/assets/{rigTrack-Bx9QHlFv.js → rigTrack-UYZU4P-e.js} +1 -1
- package/web/assets/{rotoMaskStore-pxpRt5Cj.js → rotoMaskStore-BxyxB2bD.js} +1 -1
- package/web/assets/{rotoMatte-DyXlW4jK.js → rotoMatte-BdYa8FSB.js} +1 -1
- package/web/assets/{rotoscope-GORCSVBr.js → rotoscope-DDixNQCt.js} +1 -1
- package/web/assets/{sceneTrack.worker-CEvCN5OB.js → sceneTrack.worker-CT4uoTKn.js} +475 -344
- package/web/assets/{shot-worker-B8JWkmBz.js → shot-worker-D9sZS6bn.js} +1 -1
- package/web/assets/{shotFxAgent-CzHfe75S.js → shotFxAgent-7RQNtEe4.js} +2 -2
- package/web/assets/{skin-BkaT2QuX.js → skin-CVwmK130.js} +1 -1
- package/web/assets/{spark.module-BRT8yMS4.js → spark.module-B34aiScb.js} +1 -1
- package/web/assets/{spellDuel-BUy289OT.js → spellDuel-BkweL6pI.js} +2 -2
- package/web/assets/{store-BSSbvpzr.js → store-75tQUvPT.js} +1 -1
- package/web/assets/{surfaceLight-CMaBhZ_d.js → surfaceLight-DhU-zgNL.js} +1 -1
- package/web/assets/surfacePin-ObK6QgDm.js +2 -0
- package/web/assets/textAnimators-nVSz_sZo.js +1 -0
- package/web/assets/{thumb-Cs636sYt.js → thumb-r6dlZprA.js} +1 -1
- package/web/assets/timeline3d-246tBEJl.js +2 -0
- package/web/assets/timeline3dExport-T57qnWi9.js +1 -0
- package/web/assets/{timelineComp-CRRzLazc.js → timelineComp-BcewYGR2.js} +1 -1
- package/web/assets/{timelineProps-tN2YsMYN.js → timelineProps-CJzzAWWO.js} +1 -1
- package/web/assets/{timelineText-CkoUgWcY.js → timelineText-BzUhNWPB.js} +1 -1
- package/web/assets/titleArt-B8DVR58F.js +5 -0
- package/web/assets/{titleFrameBudget-3MFHWIT6.js → titleFrameBudget-BYRZAQPs.js} +970 -839
- package/web/assets/titleFrames-BVgm601q.js +1 -0
- package/web/assets/{tool-BhIsq238.js → tool-CAGU3dUa.js} +1 -1
- package/web/assets/{tools-DMUnabc_.js → tools-DVaOkokV.js} +1 -1
- package/web/assets/{toonTools-CICrV3QB.js → toonTools-CfGTR_H1.js} +2 -2
- package/web/assets/trackAnchor-DzUt1r5Q.js +1 -0
- package/web/assets/{userFonts-BZ4QL-zq.js → userFonts-DzY0A4bD.js} +1 -1
- package/web/assets/{vfxAlpha-D3Dk1tfF.js → vfxAlpha-DQJOaZ9v.js} +2 -2
- package/web/assets/vfxBackground-DiktQFOD.js +2 -0
- package/web/assets/{videoExport-l5MGvMn_.js → videoExport-Ce0ElSQR.js} +1 -1
- package/web/assets/{views-BdWnG2xK.js → views-V3si1lOz.js} +1 -1
- package/web/assets/{weaponDuel-B2wTffPC.js → weaponDuel-D6sLVGmG.js} +1 -1
- package/web/assets/{windowFrames-CoIyWqxr.js → windowFrames-D_2QJCJJ.js} +1 -1
- package/web/layer-worker.html +3 -3
- package/web/assets/PluginStore-BVsm6n6N.js +0 -3
- package/web/assets/TemplateEmbed-CrZXoUk_.js +0 -2
- package/web/assets/TimelinePlugins-B1KGtbmb.js +0 -5
- package/web/assets/TimelinePlugins-B5WmAawO.css +0 -1
- package/web/assets/TimelineShotFx-DoLx312Y.js +0 -2
- package/web/assets/TransitionEmbed-C5SUosv2.js +0 -1
- package/web/assets/aerial-DSt_mJNA.js +0 -2
- package/web/assets/analyzerRun-DCJwb_-Z.js +0 -1
- package/web/assets/auraTrack-QR0WqBHp.js +0 -1
- package/web/assets/breakthrough-Dv1bndQb.js +0 -2
- package/web/assets/clientExport-NtJmxOYP.js +0 -1
- package/web/assets/depthEstimate-wVYSJtW8.js +0 -1
- package/web/assets/desktop-BWhFnYwd.js +0 -1
- package/web/assets/faceTracker-DWxxieVC.js +0 -1
- package/web/assets/fightDirector-OMlPZgjv.js +0 -1
- package/web/assets/fightDrama-G7bXfpQu.js +0 -2
- package/web/assets/gpuExport-CPSw_dmq.js +0 -189
- package/web/assets/handMatte-DHsHHz4m.js +0 -1
- package/web/assets/handTracker-D_O-C4Dw.js +0 -2
- package/web/assets/layer-worker-Bar7WgOA.js +0 -5
- package/web/assets/library-BtBrCaFk.js +0 -1
- package/web/assets/main-M1vRa-gd.js +0 -309
- package/web/assets/mapBake-lPNhNZgv.js +0 -1
- package/web/assets/maskTrack-D2jUh7aw.js +0 -1
- package/web/assets/matteFixRun-B7tWV9Y1.js +0 -1
- package/web/assets/pendingMatte-q35zVaiB.js +0 -2
- package/web/assets/personAi-ZjQVo-80.js +0 -2
- package/web/assets/plateCamera-A2E_WO_x.js +0 -1
- package/web/assets/plateMatte-BdIxGhw5.js +0 -2
- package/web/assets/poseTracker-DVX__OK7.js +0 -1
- package/web/assets/remote-sTZauTqM.js +0 -1220
- package/web/assets/surfacePin-DM9b9ubh.js +0 -2
- package/web/assets/textAnimators-Cihw35O8.js +0 -1
- package/web/assets/timeline3d-BEuZZOxM.js +0 -2
- package/web/assets/timeline3dExport-CmSI_pjv.js +0 -1
- package/web/assets/titleArt-CcTdJuOC.js +0 -5
- package/web/assets/titleFrames-w-iWje9N.js +0 -1
- package/web/assets/trackAnchor-D2bB5mZE.js +0 -1
- package/web/assets/vfxBackground-CHlCg8lb.js +0 -2
- package/web/assets/vfxTrack-CqiQDEYm.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ic as h,du as y,el as o0,fa as l0,en as n0,eG as i0,id as s0,ie as f0,er as c0,ec as d0,eg as h0}from"./remote-sTZauTqM.js";const G=(e,a,l,t)=>({p:[e,a,l,t]}),b0={thien:{shapes:[{e:[0,.68,.17,.22],dim:!0},{p:[[-.47,.03],[.47,.03],[.36,.2],[.2,.3],[-.2,.3],[-.36,.2]]},{e:[-.33,.11,.13,.08]},{e:[.33,.11,.13,.08]},{p:[[-.21,.22],[.21,.22],[.25,.5],[.18,.65],[-.18,.65],[-.25,.5]]},{e:[0,.62,.25,.055]},G([-.27,.64],[-.17,.62],[-.19,.42],[-.3,.44]),G([.27,.64],[.17,.62],[.19,.42],[.3,.44]),G([-.3,.44],[-.19,.41],[-.015,.49],[-.03,.56]),G([.3,.44],[.19,.41],[.015,.49],[.03,.56]),{e:[0,.55,.036,.08]},G([-.045,.64],[.045,.64],[.04,.72],[-.04,.72]),{e:[0,.78,.074,.094]},{e:[0,.885,.034,.036]}],eyes:[[-.028,.785],[.028,.785]],brow:[0,.825],head:[0,.79],chest:[0,.52],heart:[0,.48],folds:[[[-.4,.08],[-.15,.2],[0,.12]],[[.4,.08],[.15,.2],[0,.12]],[[-.12,.62],[0,.5],[.12,.62]],[[-.2,.3],[0,.34],[.2,.3]],[[-.24,.48],[-.2,.36],[-.12,.3]],[[.24,.48],[.2,.36],[.12,.3]]]},dung:{shapes:[{e:[0,.76,.13,.16],dim:!0},{p:[[-.24,0],[.24,0],[.15,.42],[-.15,.42]]},{p:[[-.14,.4],[.14,.4],[.18,.7],[-.18,.7]]},{e:[0,.705,.18,.04]},G([-.17,.73],[-.12,.67],[-.4,.53],[-.43,.59]),G([.17,.73],[.12,.67],[.4,.53],[.43,.59]),{p:[[-.28,.63],[-.5,.58],[-.49,.36],[-.34,.47]]},{p:[[.28,.63],[.5,.58],[.49,.36],[.34,.47]]},G([-.035,.72],[.035,.72],[.032,.79],[-.032,.79]),{e:[0,.845,.055,.07]},{e:[0,.925,.026,.026]}],eyes:[[-.02,.848],[.02,.848]],brow:[0,.875],head:[0,.85],chest:[0,.6],heart:[0,.58],folds:[[[-.08,.7],[0,.6],[.08,.7]],[[-.15,.42],[0,.45],[.15,.42]],[[-.08,.4],[-.12,.2],[-.18,.02]],[[.08,.4],[.12,.2],[.18,.02]],[[-.3,.6],[-.4,.48],[-.47,.4]],[[.3,.6],[.4,.48],[.47,.4]]]},ban_than:{shapes:[{e:[0,.6,.32,.33],dim:!0},{p:[[-.49,0],[.49,0],[.44,.28],[.24,.41],[-.24,.41],[-.44,.28]]},G([-.4,.22],[-.3,.12],[-.03,.12],[-.05,.22]),G([.4,.22],[.3,.12],[.03,.12],[.05,.22]),{e:[0,.2,.055,.14]},G([-.07,.39],[.07,.39],[.065,.5],[-.065,.5]),{e:[0,.64,.14,.17]},{e:[0,.83,.05,.05]}],eyes:[[-.052,.65],[.052,.65]],brow:[0,.715],head:[0,.66],chest:[0,.3],heart:[0,.27],beads:[[-.17,.37],[-.085,.335],[0,.32],[.085,.335],[.17,.37]],folds:[[[-.22,.41],[0,.26],[.22,.41]],[[-.44,.28],[-.36,.14],[-.3,0]],[[.44,.28],[.36,.14],[.3,0]]]}},q=256,j=7;function H(e,a,l,t,o){const r=e.createRadialGradient(a,l,0,a,l,t);for(const[n,s]of o)r.addColorStop(n,`rgba(255,255,255,${s})`);e.fillStyle=r,e.beginPath(),e.arc(a,l,t,0,h),e.fill()}const m0=(e,a)=>H(e,a,a,a,[[0,1],[.12,.75],[.3,.3],[.55,.09],[.8,.02],[1,0]]);function u0(e,a){H(e,a,a,a*.5,[[0,1],[.25,.7],[.6,.15],[1,0]]),e.globalCompositeOperation="lighter";for(const[l,t,o]of[[0,.98,5],[Math.PI/2,.98,5],[Math.PI/4,.5,2.5],[-Math.PI/4,.5,2.5]]){e.save(),e.translate(a,a),e.rotate(l);const r=e.createLinearGradient(-a*t,0,a*t,0);r.addColorStop(0,"rgba(255,255,255,0)"),r.addColorStop(.5,"rgba(255,255,255,0.95)"),r.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=r,e.beginPath(),e.ellipse(0,0,a*t,o,0,0,h),e.fill(),e.restore()}e.globalCompositeOperation="source-over"}function V(e,a,l,t=5){let o=0,r=.5,n=0,s=1;const i=d=>d*d*(3-2*d);for(let d=0;d<t;d++){const u=e*s,T=a*s,f=Math.floor(u),p=Math.floor(T),P=i(u-f),b=i(T-p),x=(v,c)=>y(l+d*131,(v&1023)*1024+(c&1023),7),m=x(f,p)+(x(f+1,p)-x(f,p))*P,S=x(f,p+1)+(x(f+1,p+1)-x(f,p+1))*P;o+=(m+(S-m)*b)*r,n+=r,r*=.5,s*=2.03}return o/n}function S0(e,a){const l=a*2,t=e.createImageData(l,l),o=Array.from({length:9},(n,s)=>{const i=y(23,s,1)*h,d=s===0?0:.18+.2*y(23,s,2);return[Math.cos(i)*d,Math.sin(i)*d*.8+.04,.3+.16*y(23,s,3)]}),r=(n,s)=>{let i=0;for(const[d,u,T]of o){const f=((n-d)**2+(s-u)**2)/(T*T);f<1&&(i=Math.max(i,(1-f)**1.3))}return i};for(let n=0;n<l;n++)for(let s=0;s<l;s++){const i=(s/l-.5)*2,d=(n/l-.5)*2,u=V(i*2.2+4,d*2.2+4,11),T=V(i*5+9,d*5+9,17,3),f=r(i+(u-.5)*.35,d+(T-.5)*.25),p=Math.min(1,Math.max(0,(f*1.35+(u-.5)*.9-.12)*1.6))*Math.max(0,1-Math.hypot(i,d)**6),P=r(i,d-.07),b=Math.min(1,Math.max(.35,.68+(f-P)*1.6+(.5-d*.5)*.22+(u-.5)*.35)),x=(n*l+s)*4,m=p*(.55+.45*T);t.data[x]=t.data[x+1]=t.data[x+2]=Math.round(b*255),t.data[x+3]=Math.round(Math.min(1,m)*255)}e.putImageData(t,0,0)}function p0(e,a,l=.12,t=.8){const o=e.createRadialGradient(a,a,0,a,a,a),r=t;o.addColorStop(0,"rgba(255,255,255,0)"),o.addColorStop(Math.max(0,r-l*2.2),"rgba(255,255,255,0.02)"),o.addColorStop(Math.max(0,r-l*.6),"rgba(255,255,255,0.6)"),o.addColorStop(r,"rgba(255,255,255,1)"),o.addColorStop(Math.min(1,r+l*.6),"rgba(255,255,255,0.5)"),o.addColorStop(Math.min(1,r+l*1.4),"rgba(255,255,255,0)"),o.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=o,e.fillRect(0,0,a*2,a*2)}function M0(e,a){const l=e.createRadialGradient(a,a,0,a,a,a);l.addColorStop(0,"rgba(255,255,255,0)"),l.addColorStop(.5,"rgba(255,255,255,0.05)"),l.addColorStop(.72,"rgba(255,255,255,0.22)"),l.addColorStop(.88,"rgba(255,255,255,0.95)"),l.addColorStop(.94,"rgba(255,255,255,0.4)"),l.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=l,e.fillRect(0,0,a*2,a*2)}function v0(e,a){e.save(),e.translate(a,a);const l=new Path2D;l.moveTo(0,a*.86),l.bezierCurveTo(a*.62,a*.5,a*.62,-a*.46,a*.1,-a*.88),l.lineTo(0,-a*.7),l.lineTo(-a*.1,-a*.88),l.bezierCurveTo(-a*.62,-a*.46,-a*.62,a*.5,0,a*.86);const t=e.createLinearGradient(0,a*.86,0,-a*.88);t.addColorStop(0,"rgba(210,210,210,1)"),t.addColorStop(.5,"rgba(255,255,255,1)"),t.addColorStop(1,"rgba(235,235,235,1)"),e.fillStyle=t,e.fill(l),e.strokeStyle="rgba(190,190,190,0.7)",e.lineWidth=3,e.beginPath(),e.moveTo(0,a*.8),e.quadraticCurveTo(a*.04,0,0,-a*.62),e.stroke(),e.restore()}function T0(e,a){e.save(),e.translate(a,a);const l=new Path2D;l.moveTo(0,a*.9),l.bezierCurveTo(a*.7,a*.45,a*.62,-a*.4,0,-a*.92),l.bezierCurveTo(-a*.62,-a*.4,-a*.7,a*.45,0,a*.9);const t=e.createLinearGradient(-a*.5,0,a*.5,0);t.addColorStop(0,"rgba(225,225,225,1)"),t.addColorStop(.5,"rgba(255,255,255,1)"),t.addColorStop(1,"rgba(205,205,205,1)"),e.fillStyle=t,e.fill(l),e.strokeStyle="rgba(170,170,170,0.9)",e.lineWidth=4,e.beginPath(),e.moveTo(0,a*.88),e.lineTo(0,-a*.8),e.stroke(),e.lineWidth=2;for(let o=0;o<5;o++){const r=a*(.6-o*.28);e.beginPath(),e.moveTo(0,r),e.lineTo(a*.4,r-a*.2),e.moveTo(0,r),e.lineTo(-a*.4,r-a*.2),e.stroke()}e.restore()}function P0(e,a){const l=a*2,t=a*2,o=e.createImageData(l,t);for(let r=0;r<t;r++)for(let n=0;n<l;n++){const s=(n/l-.5)*2,i=r/t,d=Math.exp(-s*s*7.5),u=Math.pow(Math.max(0,1-i),1.6)*Math.min(1,i*14+.05),T=Math.max(0,Math.min(1,d*u)),f=(r*l+n)*4;o.data[f]=255,o.data[f+1]=255,o.data[f+2]=255,o.data[f+3]=Math.round(T*255)}e.putImageData(o,0,0)}function C0(e,a){H(e,a,a,a*.35,[[0,1],[.3,.6],[1,0]]),e.globalCompositeOperation="lighter";for(let l=0;l<6;l++){e.save(),e.translate(a,a),e.rotate(l*Math.PI/6);const t=e.createLinearGradient(-a,0,a,0);t.addColorStop(0,"rgba(255,255,255,0)"),t.addColorStop(.5,`rgba(255,255,255,${l%2?.45:.85})`),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.beginPath(),e.ellipse(0,0,a*(l%2?.7:.97),l%2?2:3.5,0,0,h),e.fill(),e.restore()}e.globalCompositeOperation="source-over"}function y0(e,a){const l=e.createImageData(a*2,a*2);for(let t=0;t<a*2;t++)for(let o=0;o<a*2;o++){const r=(o/(a*2)-.5)*2,n=1-t/(a*2),s=.72+.5*(V(r*1.6+3,n*4+1,5,4)-.5)*(.4+n),i=Math.sqrt(Math.max(0,1-n))*(.62-.1*n)*(.7+.3*Math.sin(n*9+y(3,0,1)*6))*s,d=1-Math.abs(r)/Math.max(.02,i),u=Math.max(0,d)**.8*Math.min(1,n*6+.15),T=.5+.5*Math.sin(n*17+r*5+1.3),f=Math.min(1,u*(.75+.25*T)*(1-n*.35)),p=(t*a*2+o)*4,P=Math.min(1,.55+.45*(1-n));l.data[p]=l.data[p+1]=l.data[p+2]=Math.round(P*255),l.data[p+3]=Math.round(f*255)}e.putImageData(l,0,0)}function k0(e,a){H(e,a,a,a,[[0,1],[.1,.95],[.2,.55],[.38,.14],[.65,.03],[1,0]])}function x0(e,a){e.save(),e.translate(a,a);const l=e.createLinearGradient(-a,0,a,0);l.addColorStop(0,"rgba(255,255,255,0)"),l.addColorStop(.5,"rgba(255,255,255,1)"),l.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=l,e.beginPath(),e.moveTo(-a*.95,a*.1),e.quadraticCurveTo(0,-a*.9,a*.95,a*.1),e.quadraticCurveTo(0,-a*.45,-a*.95,a*.1),e.fill(),e.restore()}function W0(e,a){H(e,a,a,a*.3,[[0,1],[1,0]]),e.save(),e.translate(a,a),e.fillStyle="rgba(255,255,255,0.95)",e.beginPath();for(let l=0;l<8;l++){const t=l%2?a*.12:a*.95,o=l*Math.PI/4;e.lineTo(Math.cos(o)*t,Math.sin(o)*t)}e.closePath(),e.fill(),e.restore()}const K=[(e,a,l,t,o)=>{e.strokeRect(a+t*.12,l+o*.15,t*.76,o*.7)},(e,a,l,t,o)=>{for(let r=0;r<3;r++){const n=l+o*(.18+r*.32);e.moveTo(a+t*(r===1?.2:.08),n),e.lineTo(a+t*(r===1?.8:.92),n)}},(e,a,l,t,o)=>{e.moveTo(a+t*.05,l+o*.45),e.lineTo(a+t*.95,l+o*.45),e.moveTo(a+t*.5,l+o*.05),e.lineTo(a+t*.5,l+o*.95)},(e,a,l,t,o)=>{e.moveTo(a+t*.15,l+o*.12),e.lineTo(a+t*.85,l+o*.12),e.moveTo(a+t*.55,l+o*.12),e.lineTo(a+t*.55,l+o*.88),e.lineTo(a+t*.3,l+o*.74)},(e,a,l,t,o)=>{e.moveTo(a+t*.5,l+o*.02),e.lineTo(a+t*.5,l+o*.2),e.moveTo(a+t*.1,l+o*.5),e.lineTo(a+t*.1,l+o*.28),e.lineTo(a+t*.9,l+o*.28),e.lineTo(a+t*.9,l+o*.5),e.moveTo(a+t*.25,l+o*.65),e.lineTo(a+t*.75,l+o*.65),e.moveTo(a+t*.5,l+o*.5),e.lineTo(a+t*.5,l+o*.95)},(e,a,l,t,o)=>{e.moveTo(a+t*.5,l+o*.1),e.quadraticCurveTo(a+t*.42,l+o*.6,a+t*.08,l+o*.92),e.moveTo(a+t*.5,l+o*.4),e.quadraticCurveTo(a+t*.62,l+o*.75,a+t*.94,l+o*.9)},(e,a,l,t,o)=>{for(let r=0;r<3;r++){const n=l+o*(.15+r*.3);e.moveTo(a+t*.25,n),e.lineTo(a+t*.55,n+o*.12)}e.moveTo(a+t*.2,l+o*.95),e.lineTo(a+t*.6,l+o*.7)},(e,a,l,t,o)=>{e.strokeRect(a+t*.15,l+o*.08,t*.7,o*.84),e.moveTo(a+t*.15,l+o*.36),e.lineTo(a+t*.85,l+o*.36),e.moveTo(a+t*.15,l+o*.64),e.lineTo(a+t*.85,l+o*.64)}];function $(e){return(a,l)=>{a.save(),a.translate(l,l),a.strokeStyle="#fff",a.fillStyle="#fff",a.lineCap="square",a.lineJoin="miter",a.shadowColor="rgba(255,255,255,0.95)",a.shadowBlur=l*.1,a.lineWidth=l*.085;const t=l*1.5,o=-t/2,r=-t/2,n=i=>K[Math.floor(y(e,i,7)*K.length)],s=y(e,0,3);if(a.beginPath(),s<.4){const i=.38+.08*y(e,0,4);n(1)(a,o,r,t*i,t),n(2)(a,o+t*(i+.04),r,t*(.96-i),t)}else if(s<.75){const i=.4+.1*y(e,0,5);n(3)(a,o,r,t,t*i),n(4)(a,o,r+t*(i+.04),t,t*(.96-i))}else a.moveTo(o+t*.05,r+t),a.lineTo(o+t*.05,r+t*.05),a.lineTo(o+t*.95,r+t*.05),a.lineTo(o+t*.95,r+t*.92),a.lineTo(o+t*.8,r+t*.86),n(5)(a,o+t*.2,r+t*.22,t*.6,t*.66);a.stroke(),a.restore()}}function I0(e,a){e.save(),e.shadowColor="rgba(255,255,255,0.9)",e.shadowBlur=a*.15,e.fillStyle="#fff",e.beginPath(),e.arc(a,a,a*.72,0,h),e.fill(),e.globalCompositeOperation="destination-out",e.shadowBlur=0,e.beginPath(),e.arc(a*1.36,a*.82,a*.66,0,h),e.fill(),e.restore()}function N(e){return(a,l)=>{const t=e==="ring"?l*.5:l*.82;a.save(),a.translate(l,l),e==="ring"&&(a.strokeStyle="rgba(255,255,255,0.75)",a.lineWidth=l*.06,a.beginPath(),a.ellipse(0,0,l*.95,l*.24,-.35,Math.PI,h),a.stroke()),a.beginPath(),a.arc(0,0,t,0,h),a.save(),a.clip();const o=a.createRadialGradient(-t*.35,-t*.35,t*.1,0,0,t);if(o.addColorStop(0,"#fff"),o.addColorStop(.7,"#9a9a9a"),o.addColorStop(1,"#2a2a2a"),a.fillStyle=o,a.fillRect(-t,-t,t*2,t*2),a.globalCompositeOperation="multiply",e==="world")for(let n=0;n<9;n++)a.fillStyle="rgba(120,120,120,0.9)",a.beginPath(),a.ellipse((y(5,n,1)-.5)*t*1.4,(y(5,n,2)-.5)*t*1.4,t*(.15+y(5,n,3)*.3),t*(.1+y(5,n,4)*.2),y(5,n,5)*3,0,h),a.fill();else for(let n=0;n<7;n++)a.fillStyle=`rgba(150,150,150,${.4+.5*y(9,n,1)})`,a.fillRect(-t,-t+(n+.3*y(9,n,2))*t*.3,t*2,t*(.08+.1*y(9,n,3)));a.restore(),a.globalCompositeOperation="source-over",e==="ring"&&(a.strokeStyle="rgba(255,255,255,0.85)",a.lineWidth=l*.06,a.beginPath(),a.ellipse(0,0,l*.95,l*.24,-.35,0,Math.PI),a.stroke());const r=a.createRadialGradient(0,0,t*.85,0,0,t*1.12);r.addColorStop(0,"rgba(255,255,255,0)"),r.addColorStop(.5,"rgba(255,255,255,0.35)"),r.addColorStop(1,"rgba(255,255,255,0)"),a.fillStyle=r,a.beginPath(),a.arc(0,0,t*1.12,0,h),a.fill(),a.restore()}}function R0(e,a){e.save(),e.translate(a,a*1.1),e.strokeStyle="#fff",e.fillStyle="rgba(255,255,255,0.32)",e.lineWidth=a*.05,e.lineCap="round",e.shadowColor="#fff",e.shadowBlur=a*.08;const l=[[-.42,.02,.26],[0,-.16,.36],[.4,.04,.24]];e.beginPath();for(const[t,o,r]of l)e.moveTo(t*a+r*a,o*a),e.arc(t*a,o*a,r*a,0,h);e.fill();for(const[t,o,r]of l)e.beginPath(),e.arc(t*a,o*a,r*a,Math.PI*.9,Math.PI*2.15),e.stroke(),e.beginPath(),e.arc(t*a+r*a*.2,o*a+r*a*.05,r*a*.45,Math.PI,Math.PI*2.3),e.stroke();e.beginPath(),e.moveTo(-.85*a,.2*a),e.quadraticCurveTo(0,.32*a,.85*a,.2*a),e.stroke(),e.restore()}function w0(e,a){const l=a*2,t=e.createImageData(l,l),o=(r,n)=>{const s=.62*Math.pow(Math.max(0,1-n),.6)*Math.min(1,.55+n*3)*(1+.14*Math.sin(n*7.5)),i=.16*Math.sin(n*3.1)*n;if(Math.abs(r-i)<s&&n>.04)return!0;const d=(u,T,f)=>{const p=r-u,P=n-T;return p*p/(f*f*.35)+P*P/(f*f*1.6)<1};return d(-.36,.5,.22)||d(.34,.42,.2)||d(i+.08,.9,.12)};for(let r=0;r<l;r++)for(let n=0;n<l;n++){let s=0;for(const[d,u]of[[.25,.25],[.75,.25],[.25,.75],[.75,.75]])o(((n+d)/l-.5)*2,1-(r+u)/l)&&s++;const i=(r*l+n)*4;t.data[i]=t.data[i+1]=t.data[i+2]=255,t.data[i+3]=Math.round(s/4*255)}e.putImageData(t,0,0)}function A0(e,a){e.fillStyle="#fff",e.beginPath(),e.moveTo(a*.6,a*1.9),e.bezierCurveTo(a*.1,a*1.3,a*.5,a*.35,a*1.35,a*.12),e.bezierCurveTo(a*.95,a*.5,a*.8,a*1.1,a*1.05,a*1.55),e.bezierCurveTo(a*.95,a*1.75,a*.8,a*1.9,a*.6,a*1.9),e.fill()}function G0(e,a){const l=[[0,.1,.42],[-.42,.22,.3],[.42,.24,.32],[-.2,-.28,.32],[.26,-.3,.3],[-.5,-.12,.22],[.55,-.08,.22]],t=(o,r=0,n=0)=>{e.beginPath();for(const[s,i,d]of l)e.moveTo(a+(s+r)*a*o+d*a*o,a+(i+n)*a*o),e.arc(a+(s+r)*a*o,a+(i+n)*a*o,d*a*o,0,Math.PI*2)};e.fillStyle="#b8c0c8",t(.9),e.fill(),e.save(),t(.9),e.clip(),e.fillStyle="#ffffff",t(.9,-.07,-.08),e.fill(),e.restore()}const E0=[m0,u0,S0,(e,a)=>p0(e,a),v0,T0,P0,C0,k0,x0,M0,W0,y0,...[3,7,12,21,30,44,53,61,77,85,92,108,117,131,140,156].map($),I0,N("band"),N("world"),N("ring"),R0,w0,A0,G0];let U=null;function D0(){if(U)return U;const e=document.createElement("canvas");e.width=e.height=q*j;const a=e.getContext("2d");return E0.forEach((l,t)=>{const o=document.createElement("canvas");o.width=o.height=q;const r=o.getContext("2d");l(r,q/2),a.drawImage(o,t%j*q,Math.floor(t/j)*q)}),U=e}const J=q,Q=j;function O0(e,a,l,t){const o=[];for(let s=0;s<5;s++)for(let i=0;i<3;i++)o.push([(i-1)*t*.32,(s-2)*t*.2]);const r=2+Math.floor(y(a,l,1)*3);e.beginPath();let n=Math.floor(y(a,l,2)*o.length);for(let s=0;s<r;s++){const i=(n+1+Math.floor(y(a,l,3+s)*(o.length-1)))%o.length;e.moveTo(...o[n]),e.lineTo(...o[i]),n=i}e.stroke(),y(a,l,9)>.6&&(e.beginPath(),e.arc(0,-t*.5,t*.05,0,h),e.fill())}function E(e,a,l,t,o=0){e.beginPath();for(let r=0;r<=a;r++){const n=o+r*l*h/a,s=Math.cos(n)*t,i=Math.sin(n)*t;r?e.lineTo(s,i):e.moveTo(s,i)}e.closePath(),e.stroke()}function Z(e){const t=document.createElement("canvas");t.width=t.height=1024;const o=t.getContext("2d");o.translate(512,512),o.strokeStyle="#fff",o.fillStyle="#fff",o.lineCap="round",o.lineJoin="round";const r=(i,d,u=1)=>{o.globalAlpha=u,o.lineWidth=d,o.beginPath(),o.arc(0,0,i,0,h),o.stroke(),o.globalAlpha=1},n=(i,d,u,T)=>{for(let f=0;f<u;f++)o.save(),o.rotate(f/u*h),o.translate(0,-(i+d)/2),o.lineWidth=5,O0(o,T,f,d-i),o.restore()};if(o.shadowColor="rgba(255,255,255,0.9)",o.shadowBlur=14,e==="a"){r(512*.97,10),r(512*.93,3.5),r(512*.7,6),r(512*.665,3),n(512*.72,512*.91,28,3);for(let i=0;i<12;i++)o.save(),o.rotate(i/12*h),o.fillRect(-4,-512*.955,8,512*.025),o.restore();o.lineWidth=6,E(o,6,2,512*.665,-Math.PI/2),E(o,6,1,512*.665,-Math.PI/2),r(512*.38,7),r(512*.34,3),o.lineWidth=5,E(o,3,1,512*.34,-Math.PI/2),E(o,3,1,512*.34,Math.PI/2),n(512*.4,512*.52,12,5);for(let i=0;i<6;i++)o.save(),o.rotate(i/6*h-Math.PI/2),o.beginPath(),o.arc(512*.665,0,14,0,h),o.fill(),o.restore();o.beginPath(),o.arc(0,0,22,0,h),o.fill(),r(52,5)}else{r(512*.98,6),r(512*.94,12),r(512*.88,3),o.lineWidth=6;for(let i=0;i<96;i++)o.save(),o.rotate(i/96*h),o.fillRect(-2,-512*.9,4,i%4?512*.025:512*.05),o.restore();n(512*.62,512*.82,24,11),r(512*.6,5),r(512*.56,8),o.lineWidth=6,E(o,8,3,512*.56,0),E(o,8,1,512*.56,Math.PI/8);for(let i=0;i<8;i++)o.save(),o.rotate(i/8*h),o.beginPath(),o.arc(512*.56,0,18,0,h),o.stroke(),o.beginPath(),o.arc(512*.56,0,6,0,h),o.fill(),o.restore();r(512*.3,6),o.lineWidth=5,E(o,4,1,512*.3,Math.PI/4),E(o,4,1,512*.3,0),n(512*.32,512*.44,8,17);for(let i=0;i<4;i++)o.save(),o.rotate(i/4*h),o.beginPath(),o.arc(0,-512*.1,512*.07,.3,Math.PI-.3),o.stroke(),o.restore();o.beginPath(),o.arc(0,0,16,0,h),o.fill()}o.setTransform(1,0,0,1,0,0),o.shadowBlur=0;const s=o.getImageData(0,0,1024,1024);for(let i=0;i<s.data.length;i+=4){const d=Math.max(s.data[i+3],0);s.data[i]=255,s.data[i+1]=255,s.data[i+2]=255,s.data[i+3]=d}return o.putImageData(s,0,0),t}function z(e,a,l){e.setTransform(1,0,0,1,0,0),e.shadowBlur=0;const t=e.getImageData(0,0,a,l);for(let o=0;o<t.data.length;o+=4){const r=Math.max(t.data[o],t.data[o+1],t.data[o+2])*t.data[o+3]/255;t.data[o]=t.data[o+1]=t.data[o+2]=255,t.data[o+3]=r}e.putImageData(t,0,0)}function B(e,a){const l=document.createElement("canvas");return l.width=e,l.height=a,[l,l.getContext("2d")]}function L0(){const[l,t]=B(1024,1024),o=512*.5;t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.shadowColor="#fff",t.shadowBlur=18,t.strokeStyle="#fff",t.lineCap="round",t.fillStyle="rgb(26,26,26)",t.beginPath(),t.arc(0,0,o,0,h),t.fill(),t.fillStyle="#fff",t.beginPath(),t.arc(0,0,o,-Math.PI/2,Math.PI/2),t.arc(0,o/2,o/2,Math.PI/2,-Math.PI/2,!0),t.arc(0,-o/2,o/2,Math.PI/2,-Math.PI/2),t.fill(),t.fillStyle="rgb(26,26,26)",t.beginPath(),t.arc(0,-o/2,o*.13,0,h),t.fill(),t.fillStyle="#fff",t.beginPath(),t.arc(0,o/2,o*.13,0,h),t.fill(),t.lineWidth=9,t.beginPath(),t.arc(0,0,o,0,h),t.stroke(),t.lineWidth=4,t.beginPath(),t.arc(0,0,o*1.08,0,h),t.stroke();for(let r=0;r<8;r++){t.save(),t.rotate(r/8*h),t.lineWidth=15;for(let n=0;n<3;n++){const s=-(o*1.3+n*30),i=o*.34,d=r+1>>n&1;t.beginPath(),d?(t.moveTo(-i,s),t.lineTo(-i*.18,s),t.moveTo(i*.18,s),t.lineTo(i,s)):(t.moveTo(-i,s),t.lineTo(i,s)),t.stroke()}t.restore()}t.lineWidth=5,t.beginPath(),t.arc(0,0,512*.9,0,h),t.stroke(),t.lineWidth=12,t.beginPath(),t.arc(0,0,512*.95,0,h),t.stroke();for(let r=0;r<64;r++)t.save(),t.rotate(r/64*h),t.fillStyle="#fff",t.fillRect(-2.5,-512*.9,5,r%8?14:30),t.restore();return z(t,1024,1024),l}function _0(){const[l,t]=B(512,1536);t.fillStyle="#000",t.fillRect(0,0,512,1536),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=16;const o=46,r=466,n=230,s=1386;t.globalAlpha=.07,t.fillRect(o,n,r-o,s-n),t.globalAlpha=1,t.lineWidth=10,t.strokeRect(o,n,r-o,s-n),t.lineWidth=4,t.strokeRect(o+22,n+22,r-o-44,s-n-44),t.lineWidth=9,t.beginPath(),t.moveTo(o-10,n),t.bezierCurveTo(o,60,r,60,r+10,n),t.stroke(),t.lineWidth=5;for(const d of[-1,1])t.beginPath(),t.arc(512/2+d*120,150,34,0,h*.8),t.stroke(),t.beginPath(),t.arc(512/2+d*60,118,22,Math.PI,h*.9),t.stroke();t.beginPath(),t.arc(512/2,112,26,0,h),t.fill(),t.lineWidth=4,t.beginPath(),t.arc(512/2,112,44,0,h),t.stroke();const i=[3,7,12,21,30,44,53,61,77,85];for(let d=0;d<3;d++)for(let u=0;u<13;u++){const T=o+92+d*118,f=n+90+u*86,p=i[(d*13+u)%i.length]+u*3+d;y(p,1,99)<.08||(t.save(),t.translate(T-40,f-40),t.scale(80/256,80/256),$(p)(t,128),t.restore())}t.lineWidth=6;for(let d=-3;d<=3;d++)t.beginPath(),t.ellipse(512/2+d*52,s+62,30,58,d*.22,Math.PI,h),t.stroke();return t.lineWidth=8,t.beginPath(),t.moveTo(o-20,s+70),t.lineTo(r+20,s+70),t.stroke(),z(t,512,1536),l}function q0(){const[l,t]=B(1024,1024);t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.shadowColor="#fff",t.shadowBlur=12;const o=(r,n)=>{t.lineWidth=n,t.beginPath(),t.arc(0,0,r,0,h),t.stroke()};o(512*.98,5),o(512*.95,12),o(512*.79,4),o(512*.76,8),o(512*.5,6),o(512*.46,3),o(512*.2,6);for(let r=0;r<24;r++)t.save(),t.rotate(r/24*h),t.translate(0,-512*.865),t.scale(60/256,60/256),$(100+r)(t,128),t.restore();for(let r=0;r<180;r++)t.save(),t.rotate(r/180*h),t.fillRect(-1.5,-512*.76,3,r%15?10:26),t.restore();for(let r=0;r<12;r++)t.save(),t.rotate(r/12*h),t.lineWidth=3,t.beginPath(),t.moveTo(0,-512*.2),t.lineTo(0,-512*.74),t.stroke(),t.beginPath(),t.arc(0,-512*.62,20,0,h),t.stroke(),t.beginPath(),t.arc(0,-512*.62,7,0,h),t.fill(),t.restore();t.lineWidth=4,E(t,12,5,512*.46,0),E(t,4,1,512*.46,Math.PI/4);for(let r=0;r<16;r++)t.save(),t.rotate(r/16*h),t.beginPath(),t.moveTo(-12,-512*.06),t.lineTo(0,-512*.19),t.lineTo(12,-512*.06),t.fill(),t.restore();return t.beginPath(),t.arc(0,0,512*.07,0,h),t.fill(),z(t,1024,1024),l}function z0(){const[l,t]=B(512,512),o=256*.86;t.fillStyle="#000",t.fillRect(0,0,512,512);const r=t.createRadialGradient(256-o*.25,256-o*.25,o*.1,256,256,o);r.addColorStop(0,"#fff"),r.addColorStop(.8,"#e6e6e6"),r.addColorStop(1,"#a8a8a8"),t.fillStyle=r,t.beginPath(),t.arc(256,256,o,0,h),t.fill(),t.save(),t.beginPath(),t.arc(256,256,o,0,h),t.clip();for(let n=0;n<18;n++){const s=y(17,n,1)*h,i=Math.sqrt(y(17,n,2))*o*.75,d=o*(.08+y(17,n,3)*.22),u=t.createRadialGradient(256+Math.cos(s)*i,256+Math.sin(s)*i,0,256+Math.cos(s)*i,256+Math.sin(s)*i,d);u.addColorStop(0,"rgba(0,0,0,0.32)"),u.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=u,t.fillRect(0,0,512,512)}return t.restore(),z(t,512,512),l}function X(e){const[l,t]=B(1024,1024),o=b0[e],r=f=>(.5+f)*1024,n=f=>(1-f)*1024;t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.lineJoin="round",t.lineCap="round";const s=f=>{t.beginPath(),"e"in f&&f.e?t.ellipse(r(f.e[0]),n(f.e[1]),f.e[2]*1024,f.e[3]*1024,0,0,h):(f.p.forEach(([P,b],x)=>x?t.lineTo(r(P),n(b)):t.moveTo(r(P),n(b))),t.closePath())},i=t.createRadialGradient(r(o.heart[0]),n(o.heart[1]),1024*.02,r(o.heart[0]),n(o.heart[1]),1024*.6);i.addColorStop(0,"rgba(255,255,255,0.55)"),i.addColorStop(1,"rgba(255,255,255,0.22)");for(const f of o.shapes)s(f),t.fillStyle=f.dim?"rgba(255,255,255,0.12)":i,t.fill();t.shadowColor="#fff",t.shadowBlur=18;for(const f of o.shapes)s(f),t.strokeStyle=f.dim?"rgba(255,255,255,0.35)":"rgba(255,255,255,0.9)",t.lineWidth=f.dim?3:5,t.stroke();t.lineWidth=4,t.strokeStyle="rgba(255,255,255,0.75)";for(const[f,p,P]of o.folds)t.beginPath(),t.moveTo(r(f[0]),n(f[1])),t.quadraticCurveTo(r(p[0]),n(p[1]),r(P[0]),n(P[1])),t.stroke();const[d,u]=o.eyes[1],T=d*1024;t.lineWidth=4,t.strokeStyle="rgba(255,255,255,0.9)";for(const f of[-1,1])t.beginPath(),t.moveTo(r(f*d*.4),n(u+.022)),t.quadraticCurveTo(r(f*d*1.1),n(u+.035),r(f*d*1.8),n(u+.02)),t.stroke();t.beginPath(),t.moveTo(r(-d*.5),n(u-.055)),t.quadraticCurveTo(r(0),n(u-.062),r(d*.5),n(u-.055)),t.stroke(),t.fillStyle="#fff",t.beginPath(),t.ellipse(r(o.brow[0]),n(o.brow[1]),T*.12,T*.3,0,0,h),t.fill(),t.lineWidth=3,t.strokeStyle="rgba(255,255,255,0.4)";for(let f=0;f<14;f++){const p=(f/13-.5)*2,P=o.head[0]+p*.05,b=o.head[1]+.06;t.beginPath(),t.moveTo(r(P),n(b)),t.bezierCurveTo(r(P+p*.08),n(b+.08),r(P+p*.2+.03*Math.sin(f)),n(b+.02),r(P+p*.3),n(b+.1+.04*y(4,f,1))),t.stroke()}if("beads"in o&&o.beads)for(const[f,p]of o.beads)t.fillStyle="#fff",t.beginPath(),t.arc(r(f),n(p),1024*.022,0,h),t.fill();return z(t,1024,1024),l}function B0(){const[l,t]=B(1024,1024);t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=14;const o=(r,n)=>{t.lineWidth=n,t.beginPath(),t.arc(0,0,r,0,h),t.stroke()};o(512*.97,4),o(512*.93,9),o(512*.6,4),o(512*.56,2),t.lineWidth=4,t.beginPath();for(let r=0;r<3;r++){const n=-Math.PI/2+r*h/3;t.lineTo(Math.cos(n)*512*.92,Math.sin(n)*512*.92)}t.closePath(),t.stroke(),t.lineWidth=3,t.beginPath(),t.moveTo(0,-512*.93),t.lineTo(0,512*.93),t.moveTo(-512*.93,0),t.lineTo(512*.93,0),t.stroke();for(const[r,n]of[[-.55,.5],[.55,.5],[-.62,-.28],[.62,-.28]])for(let s=0;s<3;s++)for(let i=1;i<=3;i++)t.lineWidth=3,t.beginPath(),t.arc((r+(s-1)*.12)*512,n*512,i*512*.035,Math.PI,h),t.stroke();for(const[r,n,s]of[[0,-.72,61],[-.68,.16,92],[.68,.16,140]])t.lineWidth=6,t.beginPath(),t.arc(r*512,n*512,512*.15,0,h),t.stroke(),t.lineWidth=2,t.beginPath(),t.arc(r*512,n*512,512*.18,0,h),t.stroke(),t.save(),t.translate(r*512-512*.11,n*512-512*.11),t.scale(512*.22/256,512*.22/256),$(s)(t,128),t.restore();for(let r=0;r<72;r++)t.save(),t.rotate(r/72*h),t.fillRect(-2,-512*.93,4,r%6?12:26),t.restore();return t.save(),t.translate(-512*.16,-512*.16),t.scale(512*.32/256,512*.32/256),$(185)(t,128),t.restore(),z(t,1024,1024),l}const F0={rune0:()=>Z("a"),rune1:()=>Z("b"),taiji:L0,stele:_0,wheel:q0,moon:z0,fig_thien:()=>X("thien"),fig_dung:()=>X("dung"),fig_ban_than:()=>X("ban_than"),seal:B0},g=new Map;function $0(e){let a=g.get(e);return a||(a=F0[e](),g.set(e,a)),a}const H0=e=>({...J0(e),...o0[e.preset]?.thumb}),J0=e=>e.attach==="path"||e.attach==="gun"?{x0:-.6,x1:8.6,y0:-.2,y1:3.3,axis:"z"}:e.attach==="sky"?{x0:-2.5,x1:2.5,y0:-.2,y1:9.2,axis:"x"}:e.attach==="area"?{x0:-4,x1:4,y0:-.2,y1:4.8,axis:"x"}:{x0:-2.4,x1:2.4,y0:-.2,y1:3,axis:"x"},t0=new Map;function r0(e){let a=t0.get(e.id);if(!a){const l=l0(e,3),t=n0(l,{color:e.color,size:1});a={entry:e,layers:t,bufs:t.map(o=>o.k==="particles"?s0(o.max):o.k==="segments"?f0(o.max):o.k==="swords"?new Float32Array(o.max*16+o.max):new Float32Array(0)),view:H0(e),dur:Math.min(e.duration,4),tail:i0(e.preset)},t0.set(e.id,a)}return a}const Y=e=>Math.round(255*Math.min(1,Math.pow(Math.max(0,e),1/2.2))),I=(e,a,l,t)=>`rgba(${Y(e)},${Y(a)},${Y(l)},${Math.max(0,Math.min(1,t))})`,j0=13,e0=new Map;function a0(e,a,l,t,o){const r=x=>Math.round(Math.min(1,x)*15),n=`${e}|${a}|${r(l)}|${r(t)}|${r(o)}`;let s=e0.get(n);if(s)return s;const i=e==="atlas",d=i?D0():$0(e),u=i?a%Q*J:0,T=i?Math.floor(a/Q)*J:0,f=i?J:d.width,p=i?J:d.height,P=Math.min(1,256/Math.max(f,p));s=document.createElement("canvas"),s.width=Math.max(1,Math.round(f*P)),s.height=Math.max(1,Math.round(p*P));const b=s.getContext("2d");return b.drawImage(d,u,T,f,p,0,0,s.width,s.height),b.globalCompositeOperation="source-in",b.fillStyle=I(r(l)/15,r(t)/15,r(o)/15,1),b.fillRect(0,0,s.width,s.height),e0.set(n,s),s}function N0(e,a,l,t,o){const r=r0(a),n=r.view,s=Math.min(t/(n.x1-n.x0),o/(n.y1-n.y0)),i=(t-s*(n.x1-n.x0))/2,d=o-(o-s*(n.y1-n.y0))/2,u=n.tilt??0,T=b=>i+((n.axis==="z"?b[2]:b[0])-n.x0)*s,f=b=>d-(b[1]-(n.axis==="z"?-b[0]:b[2])*u-n.y0)*s,p=e.createLinearGradient(0,0,0,o);p.addColorStop(0,"#0a0e14"),p.addColorStop(1,"#141b22"),e.globalCompositeOperation="source-over",e.fillStyle=p,e.fillRect(0,0,t,o),e.fillStyle="rgba(255,255,255,.07)",e.fillRect(0,f([0,0,0]),t,1),e.globalCompositeOperation="lighter";const P=c0([0,0,0],0,1);r.layers.forEach((b,x)=>{const m=r.bufs[x];if(e.globalCompositeOperation=b.blend==="alpha"?"source-over":"lighter",b.k==="particles"){const S=b.eval(l,P,m);for(let v=0;v<S;v++){const c=v*d0,C=T([m[c],m[c+1],m[c+2]]),M=f([m[c],m[c+1],m[c+2]]),k=Math.max(.8,m[c+3]*s*.5),W=m[c+9],L=Math.floor(m[c+13]);if(W<.01)continue;const D=Math.max(m[c+6],m[c+7],m[c+8],1),A=m[c+6]/D,R=m[c+7]/D,O=m[c+8]/D;if(b.tex!=="atlas"||L>=j0){const _=a0(b.tex,b.tex==="atlas"?L:0,A,R,O),w=m[c+3]*s,F=m[c+4]*s;e.save(),e.globalAlpha=Math.min(1,W*(D>1.5?1.2:1)),e.translate(C,M),b.facing===1&&e.scale(1,.22),e.rotate(-m[c+5]),e.drawImage(_,-w/2,-F/2,w,F),e.restore();continue}if(b.facing===3){const _=n.axis==="z"?m[c+12]:m[c+10],w=m[c+11],F=m[c+4]*s;e.strokeStyle=I(A,R,O,W*.9),e.lineWidth=Math.max(1,m[c+3]*s),e.beginPath(),e.moveTo(C,M),e.lineTo(C-_*F,M+w*F),e.stroke()}else if(b.facing===1){const _=L===3||b.tex!=="atlas";if(e.save(),e.translate(C,M),e.scale(1,.22),_)e.strokeStyle=I(A,R,O,W*.9),e.lineWidth=Math.max(1,k*.06),e.beginPath(),e.arc(0,0,k,0,6.3),e.stroke();else{const w=e.createRadialGradient(0,0,0,0,0,k);w.addColorStop(0,I(A,R,O,W*.8)),w.addColorStop(1,I(A,R,O,0)),e.fillStyle=w,e.beginPath(),e.arc(0,0,k,0,6.3),e.fill()}e.restore()}else{if(L===3||L===10){e.strokeStyle=I(A,R,O,W*.8),e.lineWidth=Math.max(1,k*.1),e.beginPath(),e.arc(C,M,k*.8,0,6.3),e.stroke();return}const w=e.createRadialGradient(C,M,0,C,M,k);w.addColorStop(0,I(A,R,O,Math.min(1,W*(D>1.5?1.2:.9)))),w.addColorStop(.35,I(A,R,O,W*.35)),w.addColorStop(1,I(A,R,O,0)),e.fillStyle=w,e.beginPath(),e.arc(C,M,k,0,6.3),e.fill()}}}else if(b.k==="segments"){const S=b.eval(l,P,m);for(let v=0;v<S;v++){const c=v*h0,C=m[c+11];if(C<.01)continue;const M=Math.max(m[c+8],m[c+9],m[c+10],1);e.strokeStyle=I(m[c+8]/M,m[c+9]/M,m[c+10]/M,C),e.lineWidth=Math.max(1,m[c+6]*s*1.6),e.lineCap="round",e.beginPath(),e.moveTo(T([m[c],m[c+1],m[c+2]]),f([m[c],m[c+1],m[c+2]])),e.lineTo(T([m[c+3],m[c+4],m[c+5]]),f([m[c+3],m[c+4],m[c+5]])),e.stroke()}}else if(b.k==="swords"){const S=m.subarray(0,b.max*16),v=m.subarray(b.max*16),c=b.eval(l,P,S,v);e.strokeStyle="rgba(210,235,255,.95)",e.lineWidth=Math.max(1,.035*s*2),e.lineCap="round";for(let C=0;C<c;C++){const M=C*16,k=[S[M+12],S[M+13],S[M+14]],W=[k[0]+S[M+4]*.78,k[1]+S[M+5]*.78,k[2]+S[M+6]*.78];e.beginPath(),e.moveTo(T(k),f(k)),e.lineTo(T(W),f(W)),e.stroke()}}else if(b.k==="water"){if(!b.eval(l,P))return;e.fillStyle="rgba(70,150,200,.35)",e.beginPath(),e.moveTo(0,o);for(let v=0;v<=t;v+=4){const c=v/t;e.lineTo(v,o*.62+Math.sin(c*14+l*3)*4+Math.sin(c*31-l*2)*1.5-(b.mode==="wave"?Math.max(0,Math.sin(Math.min(1,c-.2+l*.2)*3))*o*.35:0))}e.lineTo(t,o),e.closePath(),e.fill()}else if(b.k==="props"){const S=new Float32Array(b.max*16),v=new Float32Array(b.max*3),c=b.eval(l,P,S,v);for(let C=0;C<c;C++){const M=C*16,k=T([S[M+12],S[M+13],S[M+14]]),W=f([S[M+12],S[M+13],S[M+14]]);e.fillStyle=I(v[C*3]+.25,v[C*3+1]+.2,v[C*3+2]+.15,.95),e.fillRect(k-1.5,W-1.5,3,3)}}else if(b.k==="ghost"){const S=b.eval(l,P);if(S&&S.alpha>.01){const v=a0("fig_"+b.figure,0,Math.min(1,S.color[0]),Math.min(1,S.color[1]),Math.min(1,S.color[2])),c=1.75*S.scale*(b.figure==="thien"?.62:1)*s,C=T([S.offset[0],0,S.offset[2]]),M=f([S.offset[0],S.offset[1],S.offset[2]]);e.save(),e.globalAlpha=Math.min(1,S.alpha)*.9,e.drawImage(v,C-c/2,M-c,c,c),e.restore()}}else if(b.k==="shell"){const S=b.eval(l,P);for(const v of Array.isArray(S)?S:S?[S]:[]){const c=v.color,C=Math.min(1,v.alpha*.9),M=Math.max(c[0],c[1],c[2],1);if(b.shape==="dome")e.strokeStyle=I(c[0]/M,c[1]/M,c[2]/M,C*.9),e.lineWidth=1.5,e.beginPath(),e.arc(T(v.pos),f(v.pos),v.scale[0]*s,0,6.3),e.stroke();else{const k=T(v.pos),W=f(v.pos),L=v.scale[0]*s*2,D=v.scale[1]*s,A=v.dir[1]>.7,R=e.createLinearGradient(0,W,0,W-D);R.addColorStop(0,I(c[0]/M,c[1]/M,c[2]/M,C*.6)),R.addColorStop(1,I(c[0]/M,c[1]/M,c[2]/M,0)),e.fillStyle=R,A&&e.fillRect(k-L/2,W-D,L,D)}}}}),e.globalCompositeOperation="source-over"}const U0=e=>o0[e.preset]?.thumb?.at??Math.min(e.duration,4)*.42,X0=e=>{const a=r0(e);return a.dur+a.tail*.5},V0=Object.freeze(Object.defineProperty({__proto__:null,drawThumb:N0,thumbLoopLength:X0,thumbRestTime:U0},Symbol.toStringTag,{value:"Module"}));export{Q as A,U0 as a,$0 as b,D0 as c,N0 as d,V0 as e,X0 as t};
|
|
1
|
+
import{ip as h,dD as y,eu as o0,fj as l0,ew as n0,eP as i0,iq as s0,ir as f0,eA as c0,el as d0,ep as h0}from"./remote-Dva2qg58.js";const G=(e,a,l,t)=>({p:[e,a,l,t]}),b0={thien:{shapes:[{e:[0,.68,.17,.22],dim:!0},{p:[[-.47,.03],[.47,.03],[.36,.2],[.2,.3],[-.2,.3],[-.36,.2]]},{e:[-.33,.11,.13,.08]},{e:[.33,.11,.13,.08]},{p:[[-.21,.22],[.21,.22],[.25,.5],[.18,.65],[-.18,.65],[-.25,.5]]},{e:[0,.62,.25,.055]},G([-.27,.64],[-.17,.62],[-.19,.42],[-.3,.44]),G([.27,.64],[.17,.62],[.19,.42],[.3,.44]),G([-.3,.44],[-.19,.41],[-.015,.49],[-.03,.56]),G([.3,.44],[.19,.41],[.015,.49],[.03,.56]),{e:[0,.55,.036,.08]},G([-.045,.64],[.045,.64],[.04,.72],[-.04,.72]),{e:[0,.78,.074,.094]},{e:[0,.885,.034,.036]}],eyes:[[-.028,.785],[.028,.785]],brow:[0,.825],head:[0,.79],chest:[0,.52],heart:[0,.48],folds:[[[-.4,.08],[-.15,.2],[0,.12]],[[.4,.08],[.15,.2],[0,.12]],[[-.12,.62],[0,.5],[.12,.62]],[[-.2,.3],[0,.34],[.2,.3]],[[-.24,.48],[-.2,.36],[-.12,.3]],[[.24,.48],[.2,.36],[.12,.3]]]},dung:{shapes:[{e:[0,.76,.13,.16],dim:!0},{p:[[-.24,0],[.24,0],[.15,.42],[-.15,.42]]},{p:[[-.14,.4],[.14,.4],[.18,.7],[-.18,.7]]},{e:[0,.705,.18,.04]},G([-.17,.73],[-.12,.67],[-.4,.53],[-.43,.59]),G([.17,.73],[.12,.67],[.4,.53],[.43,.59]),{p:[[-.28,.63],[-.5,.58],[-.49,.36],[-.34,.47]]},{p:[[.28,.63],[.5,.58],[.49,.36],[.34,.47]]},G([-.035,.72],[.035,.72],[.032,.79],[-.032,.79]),{e:[0,.845,.055,.07]},{e:[0,.925,.026,.026]}],eyes:[[-.02,.848],[.02,.848]],brow:[0,.875],head:[0,.85],chest:[0,.6],heart:[0,.58],folds:[[[-.08,.7],[0,.6],[.08,.7]],[[-.15,.42],[0,.45],[.15,.42]],[[-.08,.4],[-.12,.2],[-.18,.02]],[[.08,.4],[.12,.2],[.18,.02]],[[-.3,.6],[-.4,.48],[-.47,.4]],[[.3,.6],[.4,.48],[.47,.4]]]},ban_than:{shapes:[{e:[0,.6,.32,.33],dim:!0},{p:[[-.49,0],[.49,0],[.44,.28],[.24,.41],[-.24,.41],[-.44,.28]]},G([-.4,.22],[-.3,.12],[-.03,.12],[-.05,.22]),G([.4,.22],[.3,.12],[.03,.12],[.05,.22]),{e:[0,.2,.055,.14]},G([-.07,.39],[.07,.39],[.065,.5],[-.065,.5]),{e:[0,.64,.14,.17]},{e:[0,.83,.05,.05]}],eyes:[[-.052,.65],[.052,.65]],brow:[0,.715],head:[0,.66],chest:[0,.3],heart:[0,.27],beads:[[-.17,.37],[-.085,.335],[0,.32],[.085,.335],[.17,.37]],folds:[[[-.22,.41],[0,.26],[.22,.41]],[[-.44,.28],[-.36,.14],[-.3,0]],[[.44,.28],[.36,.14],[.3,0]]]}},q=256,J=7;function j(e,a,l,t,o){const r=e.createRadialGradient(a,l,0,a,l,t);for(const[n,s]of o)r.addColorStop(n,`rgba(255,255,255,${s})`);e.fillStyle=r,e.beginPath(),e.arc(a,l,t,0,h),e.fill()}const m0=(e,a)=>j(e,a,a,a,[[0,1],[.12,.75],[.3,.3],[.55,.09],[.8,.02],[1,0]]);function u0(e,a){j(e,a,a,a*.5,[[0,1],[.25,.7],[.6,.15],[1,0]]),e.globalCompositeOperation="lighter";for(const[l,t,o]of[[0,.98,5],[Math.PI/2,.98,5],[Math.PI/4,.5,2.5],[-Math.PI/4,.5,2.5]]){e.save(),e.translate(a,a),e.rotate(l);const r=e.createLinearGradient(-a*t,0,a*t,0);r.addColorStop(0,"rgba(255,255,255,0)"),r.addColorStop(.5,"rgba(255,255,255,0.95)"),r.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=r,e.beginPath(),e.ellipse(0,0,a*t,o,0,0,h),e.fill(),e.restore()}e.globalCompositeOperation="source-over"}function V(e,a,l,t=5){let o=0,r=.5,n=0,s=1;const i=d=>d*d*(3-2*d);for(let d=0;d<t;d++){const u=e*s,T=a*s,f=Math.floor(u),p=Math.floor(T),P=i(u-f),b=i(T-p),x=(v,c)=>y(l+d*131,(v&1023)*1024+(c&1023),7),m=x(f,p)+(x(f+1,p)-x(f,p))*P,S=x(f,p+1)+(x(f+1,p+1)-x(f,p+1))*P;o+=(m+(S-m)*b)*r,n+=r,r*=.5,s*=2.03}return o/n}function S0(e,a){const l=a*2,t=e.createImageData(l,l),o=Array.from({length:9},(n,s)=>{const i=y(23,s,1)*h,d=s===0?0:.18+.2*y(23,s,2);return[Math.cos(i)*d,Math.sin(i)*d*.8+.04,.3+.16*y(23,s,3)]}),r=(n,s)=>{let i=0;for(const[d,u,T]of o){const f=((n-d)**2+(s-u)**2)/(T*T);f<1&&(i=Math.max(i,(1-f)**1.3))}return i};for(let n=0;n<l;n++)for(let s=0;s<l;s++){const i=(s/l-.5)*2,d=(n/l-.5)*2,u=V(i*2.2+4,d*2.2+4,11),T=V(i*5+9,d*5+9,17,3),f=r(i+(u-.5)*.35,d+(T-.5)*.25),p=Math.min(1,Math.max(0,(f*1.35+(u-.5)*.9-.12)*1.6))*Math.max(0,1-Math.hypot(i,d)**6),P=r(i,d-.07),b=Math.min(1,Math.max(.35,.68+(f-P)*1.6+(.5-d*.5)*.22+(u-.5)*.35)),x=(n*l+s)*4,m=p*(.55+.45*T);t.data[x]=t.data[x+1]=t.data[x+2]=Math.round(b*255),t.data[x+3]=Math.round(Math.min(1,m)*255)}e.putImageData(t,0,0)}function p0(e,a,l=.12,t=.8){const o=e.createRadialGradient(a,a,0,a,a,a),r=t;o.addColorStop(0,"rgba(255,255,255,0)"),o.addColorStop(Math.max(0,r-l*2.2),"rgba(255,255,255,0.02)"),o.addColorStop(Math.max(0,r-l*.6),"rgba(255,255,255,0.6)"),o.addColorStop(r,"rgba(255,255,255,1)"),o.addColorStop(Math.min(1,r+l*.6),"rgba(255,255,255,0.5)"),o.addColorStop(Math.min(1,r+l*1.4),"rgba(255,255,255,0)"),o.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=o,e.fillRect(0,0,a*2,a*2)}function M0(e,a){const l=e.createRadialGradient(a,a,0,a,a,a);l.addColorStop(0,"rgba(255,255,255,0)"),l.addColorStop(.5,"rgba(255,255,255,0.05)"),l.addColorStop(.72,"rgba(255,255,255,0.22)"),l.addColorStop(.88,"rgba(255,255,255,0.95)"),l.addColorStop(.94,"rgba(255,255,255,0.4)"),l.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=l,e.fillRect(0,0,a*2,a*2)}function v0(e,a){e.save(),e.translate(a,a);const l=new Path2D;l.moveTo(0,a*.86),l.bezierCurveTo(a*.62,a*.5,a*.62,-a*.46,a*.1,-a*.88),l.lineTo(0,-a*.7),l.lineTo(-a*.1,-a*.88),l.bezierCurveTo(-a*.62,-a*.46,-a*.62,a*.5,0,a*.86);const t=e.createLinearGradient(0,a*.86,0,-a*.88);t.addColorStop(0,"rgba(210,210,210,1)"),t.addColorStop(.5,"rgba(255,255,255,1)"),t.addColorStop(1,"rgba(235,235,235,1)"),e.fillStyle=t,e.fill(l),e.strokeStyle="rgba(190,190,190,0.7)",e.lineWidth=3,e.beginPath(),e.moveTo(0,a*.8),e.quadraticCurveTo(a*.04,0,0,-a*.62),e.stroke(),e.restore()}function T0(e,a){e.save(),e.translate(a,a);const l=new Path2D;l.moveTo(0,a*.9),l.bezierCurveTo(a*.7,a*.45,a*.62,-a*.4,0,-a*.92),l.bezierCurveTo(-a*.62,-a*.4,-a*.7,a*.45,0,a*.9);const t=e.createLinearGradient(-a*.5,0,a*.5,0);t.addColorStop(0,"rgba(225,225,225,1)"),t.addColorStop(.5,"rgba(255,255,255,1)"),t.addColorStop(1,"rgba(205,205,205,1)"),e.fillStyle=t,e.fill(l),e.strokeStyle="rgba(170,170,170,0.9)",e.lineWidth=4,e.beginPath(),e.moveTo(0,a*.88),e.lineTo(0,-a*.8),e.stroke(),e.lineWidth=2;for(let o=0;o<5;o++){const r=a*(.6-o*.28);e.beginPath(),e.moveTo(0,r),e.lineTo(a*.4,r-a*.2),e.moveTo(0,r),e.lineTo(-a*.4,r-a*.2),e.stroke()}e.restore()}function P0(e,a){const l=a*2,t=a*2,o=e.createImageData(l,t);for(let r=0;r<t;r++)for(let n=0;n<l;n++){const s=(n/l-.5)*2,i=r/t,d=Math.exp(-s*s*7.5),u=Math.pow(Math.max(0,1-i),1.6)*Math.min(1,i*14+.05),T=Math.max(0,Math.min(1,d*u)),f=(r*l+n)*4;o.data[f]=255,o.data[f+1]=255,o.data[f+2]=255,o.data[f+3]=Math.round(T*255)}e.putImageData(o,0,0)}function C0(e,a){j(e,a,a,a*.35,[[0,1],[.3,.6],[1,0]]),e.globalCompositeOperation="lighter";for(let l=0;l<6;l++){e.save(),e.translate(a,a),e.rotate(l*Math.PI/6);const t=e.createLinearGradient(-a,0,a,0);t.addColorStop(0,"rgba(255,255,255,0)"),t.addColorStop(.5,`rgba(255,255,255,${l%2?.45:.85})`),t.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=t,e.beginPath(),e.ellipse(0,0,a*(l%2?.7:.97),l%2?2:3.5,0,0,h),e.fill(),e.restore()}e.globalCompositeOperation="source-over"}function y0(e,a){const l=e.createImageData(a*2,a*2);for(let t=0;t<a*2;t++)for(let o=0;o<a*2;o++){const r=(o/(a*2)-.5)*2,n=1-t/(a*2),s=.72+.5*(V(r*1.6+3,n*4+1,5,4)-.5)*(.4+n),i=Math.sqrt(Math.max(0,1-n))*(.62-.1*n)*(.7+.3*Math.sin(n*9+y(3,0,1)*6))*s,d=1-Math.abs(r)/Math.max(.02,i),u=Math.max(0,d)**.8*Math.min(1,n*6+.15),T=.5+.5*Math.sin(n*17+r*5+1.3),f=Math.min(1,u*(.75+.25*T)*(1-n*.35)),p=(t*a*2+o)*4,P=Math.min(1,.55+.45*(1-n));l.data[p]=l.data[p+1]=l.data[p+2]=Math.round(P*255),l.data[p+3]=Math.round(f*255)}e.putImageData(l,0,0)}function k0(e,a){j(e,a,a,a,[[0,1],[.1,.95],[.2,.55],[.38,.14],[.65,.03],[1,0]])}function x0(e,a){e.save(),e.translate(a,a);const l=e.createLinearGradient(-a,0,a,0);l.addColorStop(0,"rgba(255,255,255,0)"),l.addColorStop(.5,"rgba(255,255,255,1)"),l.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=l,e.beginPath(),e.moveTo(-a*.95,a*.1),e.quadraticCurveTo(0,-a*.9,a*.95,a*.1),e.quadraticCurveTo(0,-a*.45,-a*.95,a*.1),e.fill(),e.restore()}function W0(e,a){j(e,a,a,a*.3,[[0,1],[1,0]]),e.save(),e.translate(a,a),e.fillStyle="rgba(255,255,255,0.95)",e.beginPath();for(let l=0;l<8;l++){const t=l%2?a*.12:a*.95,o=l*Math.PI/4;e.lineTo(Math.cos(o)*t,Math.sin(o)*t)}e.closePath(),e.fill(),e.restore()}const K=[(e,a,l,t,o)=>{e.strokeRect(a+t*.12,l+o*.15,t*.76,o*.7)},(e,a,l,t,o)=>{for(let r=0;r<3;r++){const n=l+o*(.18+r*.32);e.moveTo(a+t*(r===1?.2:.08),n),e.lineTo(a+t*(r===1?.8:.92),n)}},(e,a,l,t,o)=>{e.moveTo(a+t*.05,l+o*.45),e.lineTo(a+t*.95,l+o*.45),e.moveTo(a+t*.5,l+o*.05),e.lineTo(a+t*.5,l+o*.95)},(e,a,l,t,o)=>{e.moveTo(a+t*.15,l+o*.12),e.lineTo(a+t*.85,l+o*.12),e.moveTo(a+t*.55,l+o*.12),e.lineTo(a+t*.55,l+o*.88),e.lineTo(a+t*.3,l+o*.74)},(e,a,l,t,o)=>{e.moveTo(a+t*.5,l+o*.02),e.lineTo(a+t*.5,l+o*.2),e.moveTo(a+t*.1,l+o*.5),e.lineTo(a+t*.1,l+o*.28),e.lineTo(a+t*.9,l+o*.28),e.lineTo(a+t*.9,l+o*.5),e.moveTo(a+t*.25,l+o*.65),e.lineTo(a+t*.75,l+o*.65),e.moveTo(a+t*.5,l+o*.5),e.lineTo(a+t*.5,l+o*.95)},(e,a,l,t,o)=>{e.moveTo(a+t*.5,l+o*.1),e.quadraticCurveTo(a+t*.42,l+o*.6,a+t*.08,l+o*.92),e.moveTo(a+t*.5,l+o*.4),e.quadraticCurveTo(a+t*.62,l+o*.75,a+t*.94,l+o*.9)},(e,a,l,t,o)=>{for(let r=0;r<3;r++){const n=l+o*(.15+r*.3);e.moveTo(a+t*.25,n),e.lineTo(a+t*.55,n+o*.12)}e.moveTo(a+t*.2,l+o*.95),e.lineTo(a+t*.6,l+o*.7)},(e,a,l,t,o)=>{e.strokeRect(a+t*.15,l+o*.08,t*.7,o*.84),e.moveTo(a+t*.15,l+o*.36),e.lineTo(a+t*.85,l+o*.36),e.moveTo(a+t*.15,l+o*.64),e.lineTo(a+t*.85,l+o*.64)}];function $(e){return(a,l)=>{a.save(),a.translate(l,l),a.strokeStyle="#fff",a.fillStyle="#fff",a.lineCap="square",a.lineJoin="miter",a.shadowColor="rgba(255,255,255,0.95)",a.shadowBlur=l*.1,a.lineWidth=l*.085;const t=l*1.5,o=-t/2,r=-t/2,n=i=>K[Math.floor(y(e,i,7)*K.length)],s=y(e,0,3);if(a.beginPath(),s<.4){const i=.38+.08*y(e,0,4);n(1)(a,o,r,t*i,t),n(2)(a,o+t*(i+.04),r,t*(.96-i),t)}else if(s<.75){const i=.4+.1*y(e,0,5);n(3)(a,o,r,t,t*i),n(4)(a,o,r+t*(i+.04),t,t*(.96-i))}else a.moveTo(o+t*.05,r+t),a.lineTo(o+t*.05,r+t*.05),a.lineTo(o+t*.95,r+t*.05),a.lineTo(o+t*.95,r+t*.92),a.lineTo(o+t*.8,r+t*.86),n(5)(a,o+t*.2,r+t*.22,t*.6,t*.66);a.stroke(),a.restore()}}function I0(e,a){e.save(),e.shadowColor="rgba(255,255,255,0.9)",e.shadowBlur=a*.15,e.fillStyle="#fff",e.beginPath(),e.arc(a,a,a*.72,0,h),e.fill(),e.globalCompositeOperation="destination-out",e.shadowBlur=0,e.beginPath(),e.arc(a*1.36,a*.82,a*.66,0,h),e.fill(),e.restore()}function N(e){return(a,l)=>{const t=e==="ring"?l*.5:l*.82;a.save(),a.translate(l,l),e==="ring"&&(a.strokeStyle="rgba(255,255,255,0.75)",a.lineWidth=l*.06,a.beginPath(),a.ellipse(0,0,l*.95,l*.24,-.35,Math.PI,h),a.stroke()),a.beginPath(),a.arc(0,0,t,0,h),a.save(),a.clip();const o=a.createRadialGradient(-t*.35,-t*.35,t*.1,0,0,t);if(o.addColorStop(0,"#fff"),o.addColorStop(.7,"#9a9a9a"),o.addColorStop(1,"#2a2a2a"),a.fillStyle=o,a.fillRect(-t,-t,t*2,t*2),a.globalCompositeOperation="multiply",e==="world")for(let n=0;n<9;n++)a.fillStyle="rgba(120,120,120,0.9)",a.beginPath(),a.ellipse((y(5,n,1)-.5)*t*1.4,(y(5,n,2)-.5)*t*1.4,t*(.15+y(5,n,3)*.3),t*(.1+y(5,n,4)*.2),y(5,n,5)*3,0,h),a.fill();else for(let n=0;n<7;n++)a.fillStyle=`rgba(150,150,150,${.4+.5*y(9,n,1)})`,a.fillRect(-t,-t+(n+.3*y(9,n,2))*t*.3,t*2,t*(.08+.1*y(9,n,3)));a.restore(),a.globalCompositeOperation="source-over",e==="ring"&&(a.strokeStyle="rgba(255,255,255,0.85)",a.lineWidth=l*.06,a.beginPath(),a.ellipse(0,0,l*.95,l*.24,-.35,0,Math.PI),a.stroke());const r=a.createRadialGradient(0,0,t*.85,0,0,t*1.12);r.addColorStop(0,"rgba(255,255,255,0)"),r.addColorStop(.5,"rgba(255,255,255,0.35)"),r.addColorStop(1,"rgba(255,255,255,0)"),a.fillStyle=r,a.beginPath(),a.arc(0,0,t*1.12,0,h),a.fill(),a.restore()}}function R0(e,a){e.save(),e.translate(a,a*1.1),e.strokeStyle="#fff",e.fillStyle="rgba(255,255,255,0.32)",e.lineWidth=a*.05,e.lineCap="round",e.shadowColor="#fff",e.shadowBlur=a*.08;const l=[[-.42,.02,.26],[0,-.16,.36],[.4,.04,.24]];e.beginPath();for(const[t,o,r]of l)e.moveTo(t*a+r*a,o*a),e.arc(t*a,o*a,r*a,0,h);e.fill();for(const[t,o,r]of l)e.beginPath(),e.arc(t*a,o*a,r*a,Math.PI*.9,Math.PI*2.15),e.stroke(),e.beginPath(),e.arc(t*a+r*a*.2,o*a+r*a*.05,r*a*.45,Math.PI,Math.PI*2.3),e.stroke();e.beginPath(),e.moveTo(-.85*a,.2*a),e.quadraticCurveTo(0,.32*a,.85*a,.2*a),e.stroke(),e.restore()}function w0(e,a){const l=a*2,t=e.createImageData(l,l),o=(r,n)=>{const s=.62*Math.pow(Math.max(0,1-n),.6)*Math.min(1,.55+n*3)*(1+.14*Math.sin(n*7.5)),i=.16*Math.sin(n*3.1)*n;if(Math.abs(r-i)<s&&n>.04)return!0;const d=(u,T,f)=>{const p=r-u,P=n-T;return p*p/(f*f*.35)+P*P/(f*f*1.6)<1};return d(-.36,.5,.22)||d(.34,.42,.2)||d(i+.08,.9,.12)};for(let r=0;r<l;r++)for(let n=0;n<l;n++){let s=0;for(const[d,u]of[[.25,.25],[.75,.25],[.25,.75],[.75,.75]])o(((n+d)/l-.5)*2,1-(r+u)/l)&&s++;const i=(r*l+n)*4;t.data[i]=t.data[i+1]=t.data[i+2]=255,t.data[i+3]=Math.round(s/4*255)}e.putImageData(t,0,0)}function A0(e,a){e.fillStyle="#fff",e.beginPath(),e.moveTo(a*.6,a*1.9),e.bezierCurveTo(a*.1,a*1.3,a*.5,a*.35,a*1.35,a*.12),e.bezierCurveTo(a*.95,a*.5,a*.8,a*1.1,a*1.05,a*1.55),e.bezierCurveTo(a*.95,a*1.75,a*.8,a*1.9,a*.6,a*1.9),e.fill()}function G0(e,a){const l=[[0,.1,.42],[-.42,.22,.3],[.42,.24,.32],[-.2,-.28,.32],[.26,-.3,.3],[-.5,-.12,.22],[.55,-.08,.22]],t=(o,r=0,n=0)=>{e.beginPath();for(const[s,i,d]of l)e.moveTo(a+(s+r)*a*o+d*a*o,a+(i+n)*a*o),e.arc(a+(s+r)*a*o,a+(i+n)*a*o,d*a*o,0,Math.PI*2)};e.fillStyle="#b8c0c8",t(.9),e.fill(),e.save(),t(.9),e.clip(),e.fillStyle="#ffffff",t(.9,-.07,-.08),e.fill(),e.restore()}const D0=[m0,u0,S0,(e,a)=>p0(e,a),v0,T0,P0,C0,k0,x0,M0,W0,y0,...[3,7,12,21,30,44,53,61,77,85,92,108,117,131,140,156].map($),I0,N("band"),N("world"),N("ring"),R0,w0,A0,G0];let U=null;function E0(){if(U)return U;const e=document.createElement("canvas");e.width=e.height=q*J;const a=e.getContext("2d");return D0.forEach((l,t)=>{const o=document.createElement("canvas");o.width=o.height=q;const r=o.getContext("2d");l(r,q/2),a.drawImage(o,t%J*q,Math.floor(t/J)*q)}),U=e}const H=q,Q=J;function O0(e,a,l,t){const o=[];for(let s=0;s<5;s++)for(let i=0;i<3;i++)o.push([(i-1)*t*.32,(s-2)*t*.2]);const r=2+Math.floor(y(a,l,1)*3);e.beginPath();let n=Math.floor(y(a,l,2)*o.length);for(let s=0;s<r;s++){const i=(n+1+Math.floor(y(a,l,3+s)*(o.length-1)))%o.length;e.moveTo(...o[n]),e.lineTo(...o[i]),n=i}e.stroke(),y(a,l,9)>.6&&(e.beginPath(),e.arc(0,-t*.5,t*.05,0,h),e.fill())}function D(e,a,l,t,o=0){e.beginPath();for(let r=0;r<=a;r++){const n=o+r*l*h/a,s=Math.cos(n)*t,i=Math.sin(n)*t;r?e.lineTo(s,i):e.moveTo(s,i)}e.closePath(),e.stroke()}function Z(e){const t=document.createElement("canvas");t.width=t.height=1024;const o=t.getContext("2d");o.translate(512,512),o.strokeStyle="#fff",o.fillStyle="#fff",o.lineCap="round",o.lineJoin="round";const r=(i,d,u=1)=>{o.globalAlpha=u,o.lineWidth=d,o.beginPath(),o.arc(0,0,i,0,h),o.stroke(),o.globalAlpha=1},n=(i,d,u,T)=>{for(let f=0;f<u;f++)o.save(),o.rotate(f/u*h),o.translate(0,-(i+d)/2),o.lineWidth=5,O0(o,T,f,d-i),o.restore()};if(o.shadowColor="rgba(255,255,255,0.9)",o.shadowBlur=14,e==="a"){r(512*.97,10),r(512*.93,3.5),r(512*.7,6),r(512*.665,3),n(512*.72,512*.91,28,3);for(let i=0;i<12;i++)o.save(),o.rotate(i/12*h),o.fillRect(-4,-512*.955,8,512*.025),o.restore();o.lineWidth=6,D(o,6,2,512*.665,-Math.PI/2),D(o,6,1,512*.665,-Math.PI/2),r(512*.38,7),r(512*.34,3),o.lineWidth=5,D(o,3,1,512*.34,-Math.PI/2),D(o,3,1,512*.34,Math.PI/2),n(512*.4,512*.52,12,5);for(let i=0;i<6;i++)o.save(),o.rotate(i/6*h-Math.PI/2),o.beginPath(),o.arc(512*.665,0,14,0,h),o.fill(),o.restore();o.beginPath(),o.arc(0,0,22,0,h),o.fill(),r(52,5)}else{r(512*.98,6),r(512*.94,12),r(512*.88,3),o.lineWidth=6;for(let i=0;i<96;i++)o.save(),o.rotate(i/96*h),o.fillRect(-2,-512*.9,4,i%4?512*.025:512*.05),o.restore();n(512*.62,512*.82,24,11),r(512*.6,5),r(512*.56,8),o.lineWidth=6,D(o,8,3,512*.56,0),D(o,8,1,512*.56,Math.PI/8);for(let i=0;i<8;i++)o.save(),o.rotate(i/8*h),o.beginPath(),o.arc(512*.56,0,18,0,h),o.stroke(),o.beginPath(),o.arc(512*.56,0,6,0,h),o.fill(),o.restore();r(512*.3,6),o.lineWidth=5,D(o,4,1,512*.3,Math.PI/4),D(o,4,1,512*.3,0),n(512*.32,512*.44,8,17);for(let i=0;i<4;i++)o.save(),o.rotate(i/4*h),o.beginPath(),o.arc(0,-512*.1,512*.07,.3,Math.PI-.3),o.stroke(),o.restore();o.beginPath(),o.arc(0,0,16,0,h),o.fill()}o.setTransform(1,0,0,1,0,0),o.shadowBlur=0;const s=o.getImageData(0,0,1024,1024);for(let i=0;i<s.data.length;i+=4){const d=Math.max(s.data[i+3],0);s.data[i]=255,s.data[i+1]=255,s.data[i+2]=255,s.data[i+3]=d}return o.putImageData(s,0,0),t}function z(e,a,l){e.setTransform(1,0,0,1,0,0),e.shadowBlur=0;const t=e.getImageData(0,0,a,l);for(let o=0;o<t.data.length;o+=4){const r=Math.max(t.data[o],t.data[o+1],t.data[o+2])*t.data[o+3]/255;t.data[o]=t.data[o+1]=t.data[o+2]=255,t.data[o+3]=r}e.putImageData(t,0,0)}function B(e,a){const l=document.createElement("canvas");return l.width=e,l.height=a,[l,l.getContext("2d")]}function L0(){const[l,t]=B(1024,1024),o=512*.5;t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.shadowColor="#fff",t.shadowBlur=18,t.strokeStyle="#fff",t.lineCap="round",t.fillStyle="rgb(26,26,26)",t.beginPath(),t.arc(0,0,o,0,h),t.fill(),t.fillStyle="#fff",t.beginPath(),t.arc(0,0,o,-Math.PI/2,Math.PI/2),t.arc(0,o/2,o/2,Math.PI/2,-Math.PI/2,!0),t.arc(0,-o/2,o/2,Math.PI/2,-Math.PI/2),t.fill(),t.fillStyle="rgb(26,26,26)",t.beginPath(),t.arc(0,-o/2,o*.13,0,h),t.fill(),t.fillStyle="#fff",t.beginPath(),t.arc(0,o/2,o*.13,0,h),t.fill(),t.lineWidth=9,t.beginPath(),t.arc(0,0,o,0,h),t.stroke(),t.lineWidth=4,t.beginPath(),t.arc(0,0,o*1.08,0,h),t.stroke();for(let r=0;r<8;r++){t.save(),t.rotate(r/8*h),t.lineWidth=15;for(let n=0;n<3;n++){const s=-(o*1.3+n*30),i=o*.34,d=r+1>>n&1;t.beginPath(),d?(t.moveTo(-i,s),t.lineTo(-i*.18,s),t.moveTo(i*.18,s),t.lineTo(i,s)):(t.moveTo(-i,s),t.lineTo(i,s)),t.stroke()}t.restore()}t.lineWidth=5,t.beginPath(),t.arc(0,0,512*.9,0,h),t.stroke(),t.lineWidth=12,t.beginPath(),t.arc(0,0,512*.95,0,h),t.stroke();for(let r=0;r<64;r++)t.save(),t.rotate(r/64*h),t.fillStyle="#fff",t.fillRect(-2.5,-512*.9,5,r%8?14:30),t.restore();return z(t,1024,1024),l}function _0(){const[l,t]=B(512,1536);t.fillStyle="#000",t.fillRect(0,0,512,1536),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=16;const o=46,r=466,n=230,s=1386;t.globalAlpha=.07,t.fillRect(o,n,r-o,s-n),t.globalAlpha=1,t.lineWidth=10,t.strokeRect(o,n,r-o,s-n),t.lineWidth=4,t.strokeRect(o+22,n+22,r-o-44,s-n-44),t.lineWidth=9,t.beginPath(),t.moveTo(o-10,n),t.bezierCurveTo(o,60,r,60,r+10,n),t.stroke(),t.lineWidth=5;for(const d of[-1,1])t.beginPath(),t.arc(512/2+d*120,150,34,0,h*.8),t.stroke(),t.beginPath(),t.arc(512/2+d*60,118,22,Math.PI,h*.9),t.stroke();t.beginPath(),t.arc(512/2,112,26,0,h),t.fill(),t.lineWidth=4,t.beginPath(),t.arc(512/2,112,44,0,h),t.stroke();const i=[3,7,12,21,30,44,53,61,77,85];for(let d=0;d<3;d++)for(let u=0;u<13;u++){const T=o+92+d*118,f=n+90+u*86,p=i[(d*13+u)%i.length]+u*3+d;y(p,1,99)<.08||(t.save(),t.translate(T-40,f-40),t.scale(80/256,80/256),$(p)(t,128),t.restore())}t.lineWidth=6;for(let d=-3;d<=3;d++)t.beginPath(),t.ellipse(512/2+d*52,s+62,30,58,d*.22,Math.PI,h),t.stroke();return t.lineWidth=8,t.beginPath(),t.moveTo(o-20,s+70),t.lineTo(r+20,s+70),t.stroke(),z(t,512,1536),l}function q0(){const[l,t]=B(1024,1024);t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.shadowColor="#fff",t.shadowBlur=12;const o=(r,n)=>{t.lineWidth=n,t.beginPath(),t.arc(0,0,r,0,h),t.stroke()};o(512*.98,5),o(512*.95,12),o(512*.79,4),o(512*.76,8),o(512*.5,6),o(512*.46,3),o(512*.2,6);for(let r=0;r<24;r++)t.save(),t.rotate(r/24*h),t.translate(0,-512*.865),t.scale(60/256,60/256),$(100+r)(t,128),t.restore();for(let r=0;r<180;r++)t.save(),t.rotate(r/180*h),t.fillRect(-1.5,-512*.76,3,r%15?10:26),t.restore();for(let r=0;r<12;r++)t.save(),t.rotate(r/12*h),t.lineWidth=3,t.beginPath(),t.moveTo(0,-512*.2),t.lineTo(0,-512*.74),t.stroke(),t.beginPath(),t.arc(0,-512*.62,20,0,h),t.stroke(),t.beginPath(),t.arc(0,-512*.62,7,0,h),t.fill(),t.restore();t.lineWidth=4,D(t,12,5,512*.46,0),D(t,4,1,512*.46,Math.PI/4);for(let r=0;r<16;r++)t.save(),t.rotate(r/16*h),t.beginPath(),t.moveTo(-12,-512*.06),t.lineTo(0,-512*.19),t.lineTo(12,-512*.06),t.fill(),t.restore();return t.beginPath(),t.arc(0,0,512*.07,0,h),t.fill(),z(t,1024,1024),l}function z0(){const[l,t]=B(512,512),o=256*.86;t.fillStyle="#000",t.fillRect(0,0,512,512);const r=t.createRadialGradient(256-o*.25,256-o*.25,o*.1,256,256,o);r.addColorStop(0,"#fff"),r.addColorStop(.8,"#e6e6e6"),r.addColorStop(1,"#a8a8a8"),t.fillStyle=r,t.beginPath(),t.arc(256,256,o,0,h),t.fill(),t.save(),t.beginPath(),t.arc(256,256,o,0,h),t.clip();for(let n=0;n<18;n++){const s=y(17,n,1)*h,i=Math.sqrt(y(17,n,2))*o*.75,d=o*(.08+y(17,n,3)*.22),u=t.createRadialGradient(256+Math.cos(s)*i,256+Math.sin(s)*i,0,256+Math.cos(s)*i,256+Math.sin(s)*i,d);u.addColorStop(0,"rgba(0,0,0,0.32)"),u.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=u,t.fillRect(0,0,512,512)}return t.restore(),z(t,512,512),l}function X(e){const[l,t]=B(1024,1024),o=b0[e],r=f=>(.5+f)*1024,n=f=>(1-f)*1024;t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.lineJoin="round",t.lineCap="round";const s=f=>{t.beginPath(),"e"in f&&f.e?t.ellipse(r(f.e[0]),n(f.e[1]),f.e[2]*1024,f.e[3]*1024,0,0,h):(f.p.forEach(([P,b],x)=>x?t.lineTo(r(P),n(b)):t.moveTo(r(P),n(b))),t.closePath())},i=t.createRadialGradient(r(o.heart[0]),n(o.heart[1]),1024*.02,r(o.heart[0]),n(o.heart[1]),1024*.6);i.addColorStop(0,"rgba(255,255,255,0.55)"),i.addColorStop(1,"rgba(255,255,255,0.22)");for(const f of o.shapes)s(f),t.fillStyle=f.dim?"rgba(255,255,255,0.12)":i,t.fill();t.shadowColor="#fff",t.shadowBlur=18;for(const f of o.shapes)s(f),t.strokeStyle=f.dim?"rgba(255,255,255,0.35)":"rgba(255,255,255,0.9)",t.lineWidth=f.dim?3:5,t.stroke();t.lineWidth=4,t.strokeStyle="rgba(255,255,255,0.75)";for(const[f,p,P]of o.folds)t.beginPath(),t.moveTo(r(f[0]),n(f[1])),t.quadraticCurveTo(r(p[0]),n(p[1]),r(P[0]),n(P[1])),t.stroke();const[d,u]=o.eyes[1],T=d*1024;t.lineWidth=4,t.strokeStyle="rgba(255,255,255,0.9)";for(const f of[-1,1])t.beginPath(),t.moveTo(r(f*d*.4),n(u+.022)),t.quadraticCurveTo(r(f*d*1.1),n(u+.035),r(f*d*1.8),n(u+.02)),t.stroke();t.beginPath(),t.moveTo(r(-d*.5),n(u-.055)),t.quadraticCurveTo(r(0),n(u-.062),r(d*.5),n(u-.055)),t.stroke(),t.fillStyle="#fff",t.beginPath(),t.ellipse(r(o.brow[0]),n(o.brow[1]),T*.12,T*.3,0,0,h),t.fill(),t.lineWidth=3,t.strokeStyle="rgba(255,255,255,0.4)";for(let f=0;f<14;f++){const p=(f/13-.5)*2,P=o.head[0]+p*.05,b=o.head[1]+.06;t.beginPath(),t.moveTo(r(P),n(b)),t.bezierCurveTo(r(P+p*.08),n(b+.08),r(P+p*.2+.03*Math.sin(f)),n(b+.02),r(P+p*.3),n(b+.1+.04*y(4,f,1))),t.stroke()}if("beads"in o&&o.beads)for(const[f,p]of o.beads)t.fillStyle="#fff",t.beginPath(),t.arc(r(f),n(p),1024*.022,0,h),t.fill();return z(t,1024,1024),l}function B0(){const[l,t]=B(1024,1024);t.fillStyle="#000",t.fillRect(0,0,1024,1024),t.translate(512,512),t.strokeStyle="#fff",t.fillStyle="#fff",t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=14;const o=(r,n)=>{t.lineWidth=n,t.beginPath(),t.arc(0,0,r,0,h),t.stroke()};o(512*.97,4),o(512*.93,9),o(512*.6,4),o(512*.56,2),t.lineWidth=4,t.beginPath();for(let r=0;r<3;r++){const n=-Math.PI/2+r*h/3;t.lineTo(Math.cos(n)*512*.92,Math.sin(n)*512*.92)}t.closePath(),t.stroke(),t.lineWidth=3,t.beginPath(),t.moveTo(0,-512*.93),t.lineTo(0,512*.93),t.moveTo(-512*.93,0),t.lineTo(512*.93,0),t.stroke();for(const[r,n]of[[-.55,.5],[.55,.5],[-.62,-.28],[.62,-.28]])for(let s=0;s<3;s++)for(let i=1;i<=3;i++)t.lineWidth=3,t.beginPath(),t.arc((r+(s-1)*.12)*512,n*512,i*512*.035,Math.PI,h),t.stroke();for(const[r,n,s]of[[0,-.72,61],[-.68,.16,92],[.68,.16,140]])t.lineWidth=6,t.beginPath(),t.arc(r*512,n*512,512*.15,0,h),t.stroke(),t.lineWidth=2,t.beginPath(),t.arc(r*512,n*512,512*.18,0,h),t.stroke(),t.save(),t.translate(r*512-512*.11,n*512-512*.11),t.scale(512*.22/256,512*.22/256),$(s)(t,128),t.restore();for(let r=0;r<72;r++)t.save(),t.rotate(r/72*h),t.fillRect(-2,-512*.93,4,r%6?12:26),t.restore();return t.save(),t.translate(-512*.16,-512*.16),t.scale(512*.32/256,512*.32/256),$(185)(t,128),t.restore(),z(t,1024,1024),l}const F0={rune0:()=>Z("a"),rune1:()=>Z("b"),taiji:L0,stele:_0,wheel:q0,moon:z0,fig_thien:()=>X("thien"),fig_dung:()=>X("dung"),fig_ban_than:()=>X("ban_than"),seal:B0},g=new Map;function $0(e){let a=g.get(e);return a||(a=F0[e](),g.set(e,a)),a}const j0=e=>({...H0(e),...o0[e.preset]?.thumb}),H0=e=>e.attach==="path"||e.attach==="gun"?{x0:-.6,x1:8.6,y0:-.2,y1:3.3,axis:"z"}:e.attach==="sky"?{x0:-2.5,x1:2.5,y0:-.2,y1:9.2,axis:"x"}:e.attach==="area"?{x0:-4,x1:4,y0:-.2,y1:4.8,axis:"x"}:{x0:-2.4,x1:2.4,y0:-.2,y1:3,axis:"x"},t0=new Map;function r0(e){let a=t0.get(e.id);if(!a){const l=l0(e,3),t=n0(l,{color:e.color,size:1});a={entry:e,layers:t,bufs:t.map(o=>o.k==="particles"?s0(o.max):o.k==="segments"?f0(o.max):o.k==="swords"?new Float32Array(o.max*16+o.max):new Float32Array(0)),view:j0(e),dur:Math.min(e.duration,4),tail:i0(e.preset)},t0.set(e.id,a)}return a}const Y=e=>Math.round(255*Math.min(1,Math.pow(Math.max(0,e),1/2.2))),I=(e,a,l,t)=>`rgba(${Y(e)},${Y(a)},${Y(l)},${Math.max(0,Math.min(1,t))})`,J0=13,e0=new Map;function a0(e,a,l,t,o){const r=x=>Math.round(Math.min(1,x)*15),n=`${e}|${a}|${r(l)}|${r(t)}|${r(o)}`;let s=e0.get(n);if(s)return s;const i=e==="atlas",d=i?E0():$0(e),u=i?a%Q*H:0,T=i?Math.floor(a/Q)*H:0,f=i?H:d.width,p=i?H:d.height,P=Math.min(1,256/Math.max(f,p));s=document.createElement("canvas"),s.width=Math.max(1,Math.round(f*P)),s.height=Math.max(1,Math.round(p*P));const b=s.getContext("2d");return b.drawImage(d,u,T,f,p,0,0,s.width,s.height),b.globalCompositeOperation="source-in",b.fillStyle=I(r(l)/15,r(t)/15,r(o)/15,1),b.fillRect(0,0,s.width,s.height),e0.set(n,s),s}function N0(e,a,l,t,o){const r=r0(a),n=r.view,s=Math.min(t/(n.x1-n.x0),o/(n.y1-n.y0)),i=(t-s*(n.x1-n.x0))/2,d=o-(o-s*(n.y1-n.y0))/2,u=n.tilt??0,T=b=>i+((n.axis==="z"?b[2]:b[0])-n.x0)*s,f=b=>d-(b[1]-(n.axis==="z"?-b[0]:b[2])*u-n.y0)*s,p=e.createLinearGradient(0,0,0,o);p.addColorStop(0,"#0a0e14"),p.addColorStop(1,"#141b22"),e.globalCompositeOperation="source-over",e.fillStyle=p,e.fillRect(0,0,t,o),e.fillStyle="rgba(255,255,255,.07)",e.fillRect(0,f([0,0,0]),t,1),e.globalCompositeOperation="lighter";const P=c0([0,0,0],0,1);r.layers.forEach((b,x)=>{const m=r.bufs[x];if(e.globalCompositeOperation=b.blend==="alpha"?"source-over":"lighter",b.k==="particles"){const S=b.eval(l,P,m);for(let v=0;v<S;v++){const c=v*d0,C=T([m[c],m[c+1],m[c+2]]),M=f([m[c],m[c+1],m[c+2]]),k=Math.max(.8,m[c+3]*s*.5),W=m[c+9],L=Math.floor(m[c+13]);if(W<.01)continue;const E=Math.max(m[c+6],m[c+7],m[c+8],1),A=m[c+6]/E,R=m[c+7]/E,O=m[c+8]/E;if(b.tex!=="atlas"||L>=J0){const _=a0(b.tex,b.tex==="atlas"?L:0,A,R,O),w=m[c+3]*s,F=m[c+4]*s;e.save(),e.globalAlpha=Math.min(1,W*(E>1.5?1.2:1)),e.translate(C,M),b.facing===1&&e.scale(1,.22),e.rotate(-m[c+5]),e.drawImage(_,-w/2,-F/2,w,F),e.restore();continue}if(b.facing===3){const _=n.axis==="z"?m[c+12]:m[c+10],w=m[c+11],F=m[c+4]*s;e.strokeStyle=I(A,R,O,W*.9),e.lineWidth=Math.max(1,m[c+3]*s),e.beginPath(),e.moveTo(C,M),e.lineTo(C-_*F,M+w*F),e.stroke()}else if(b.facing===1){const _=L===3||b.tex!=="atlas";if(e.save(),e.translate(C,M),e.scale(1,.22),_)e.strokeStyle=I(A,R,O,W*.9),e.lineWidth=Math.max(1,k*.06),e.beginPath(),e.arc(0,0,k,0,6.3),e.stroke();else{const w=e.createRadialGradient(0,0,0,0,0,k);w.addColorStop(0,I(A,R,O,W*.8)),w.addColorStop(1,I(A,R,O,0)),e.fillStyle=w,e.beginPath(),e.arc(0,0,k,0,6.3),e.fill()}e.restore()}else{if(L===3||L===10){e.strokeStyle=I(A,R,O,W*.8),e.lineWidth=Math.max(1,k*.1),e.beginPath(),e.arc(C,M,k*.8,0,6.3),e.stroke();return}const w=e.createRadialGradient(C,M,0,C,M,k);w.addColorStop(0,I(A,R,O,Math.min(1,W*(E>1.5?1.2:.9)))),w.addColorStop(.35,I(A,R,O,W*.35)),w.addColorStop(1,I(A,R,O,0)),e.fillStyle=w,e.beginPath(),e.arc(C,M,k,0,6.3),e.fill()}}}else if(b.k==="segments"){const S=b.eval(l,P,m);for(let v=0;v<S;v++){const c=v*h0,C=m[c+11];if(C<.01)continue;const M=Math.max(m[c+8],m[c+9],m[c+10],1);e.strokeStyle=I(m[c+8]/M,m[c+9]/M,m[c+10]/M,C),e.lineWidth=Math.max(1,m[c+6]*s*1.6),e.lineCap="round",e.beginPath(),e.moveTo(T([m[c],m[c+1],m[c+2]]),f([m[c],m[c+1],m[c+2]])),e.lineTo(T([m[c+3],m[c+4],m[c+5]]),f([m[c+3],m[c+4],m[c+5]])),e.stroke()}}else if(b.k==="swords"){const S=m.subarray(0,b.max*16),v=m.subarray(b.max*16),c=b.eval(l,P,S,v);e.strokeStyle="rgba(210,235,255,.95)",e.lineWidth=Math.max(1,.035*s*2),e.lineCap="round";for(let C=0;C<c;C++){const M=C*16,k=[S[M+12],S[M+13],S[M+14]],W=[k[0]+S[M+4]*.78,k[1]+S[M+5]*.78,k[2]+S[M+6]*.78];e.beginPath(),e.moveTo(T(k),f(k)),e.lineTo(T(W),f(W)),e.stroke()}}else if(b.k==="water"){if(!b.eval(l,P))return;e.fillStyle="rgba(70,150,200,.35)",e.beginPath(),e.moveTo(0,o);for(let v=0;v<=t;v+=4){const c=v/t;e.lineTo(v,o*.62+Math.sin(c*14+l*3)*4+Math.sin(c*31-l*2)*1.5-(b.mode==="wave"?Math.max(0,Math.sin(Math.min(1,c-.2+l*.2)*3))*o*.35:0))}e.lineTo(t,o),e.closePath(),e.fill()}else if(b.k==="props"){const S=new Float32Array(b.max*16),v=new Float32Array(b.max*3),c=b.eval(l,P,S,v);for(let C=0;C<c;C++){const M=C*16,k=T([S[M+12],S[M+13],S[M+14]]),W=f([S[M+12],S[M+13],S[M+14]]);e.fillStyle=I(v[C*3]+.25,v[C*3+1]+.2,v[C*3+2]+.15,.95),e.fillRect(k-1.5,W-1.5,3,3)}}else if(b.k==="ghost"){const S=b.eval(l,P);if(S&&S.alpha>.01){const v=a0("fig_"+b.figure,0,Math.min(1,S.color[0]),Math.min(1,S.color[1]),Math.min(1,S.color[2])),c=1.75*S.scale*(b.figure==="thien"?.62:1)*s,C=T([S.offset[0],0,S.offset[2]]),M=f([S.offset[0],S.offset[1],S.offset[2]]);e.save(),e.globalAlpha=Math.min(1,S.alpha)*.9,e.drawImage(v,C-c/2,M-c,c,c),e.restore()}}else if(b.k==="shell"){const S=b.eval(l,P);for(const v of Array.isArray(S)?S:S?[S]:[]){const c=v.color,C=Math.min(1,v.alpha*.9),M=Math.max(c[0],c[1],c[2],1);if(b.shape==="dome")e.strokeStyle=I(c[0]/M,c[1]/M,c[2]/M,C*.9),e.lineWidth=1.5,e.beginPath(),e.arc(T(v.pos),f(v.pos),v.scale[0]*s,0,6.3),e.stroke();else{const k=T(v.pos),W=f(v.pos),L=v.scale[0]*s*2,E=v.scale[1]*s,A=v.dir[1]>.7,R=e.createLinearGradient(0,W,0,W-E);R.addColorStop(0,I(c[0]/M,c[1]/M,c[2]/M,C*.6)),R.addColorStop(1,I(c[0]/M,c[1]/M,c[2]/M,0)),e.fillStyle=R,A&&e.fillRect(k-L/2,W-E,L,E)}}}}),e.globalCompositeOperation="source-over"}const U0=e=>o0[e.preset]?.thumb?.at??Math.min(e.duration,4)*.42,X0=e=>{const a=r0(e);return a.dur+a.tail*.5},V0=Object.freeze(Object.defineProperty({__proto__:null,drawThumb:N0,thumbLoopLength:X0,thumbRestTime:U0},Symbol.toStringTag,{value:"Module"}));export{Q as A,U0 as a,$0 as b,E0 as c,N0 as d,V0 as e,X0 as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
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,ji as bt,i7 as T,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,jh as rt,m as E,l as A,gS as st,fc as G,lE as ut,lF as z,iq as et,ea as q,d5 as dt,lG as lt,h as U,s as pt,h$ as Ot,i0 as Et}from"./titleFrameBudget-3MFHWIT6.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 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-$+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 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 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=>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),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&&T(t,k)&&!T(p,m)&&x.push("transition"),m.join&&k&&T(t,k)&&!T(p,m)&&x.push("join"),!x.length)return _;_={..._};for(const F of x)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=>q(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=>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 Kt(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 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 gt(t,n,e){let i=n;return n.kind!=="audio"&&!n.nullLayer&&(i=e!==null?Kt(i,e):Nt(i,o=>G(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>=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:G(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 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=`§${K(v.indexOf(`${K((y.zIndex??0)+200)}:${K(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=>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(...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))>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)),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=>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(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)}}),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(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:[...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 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),F=x.every(d=>m(d,_(d)));let O=F?E(x.at(-1)??l.track)+1:E(l.track);for(const d of x){const h=_(d);if(F){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:G(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:z,COMP_SEP:D,compBlockers:Ot,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:Yt,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,B as m,Yt as p,J 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};
|