clipoox-render 0.2.0 → 0.3.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 +1394 -0
- package/package.json +5 -3
- package/scripts/render-local.mjs +1514 -1379
- package/shared/transitionStarterPack.json +261 -0
- package/web/assets/{FxEmbed-BymBArNa.js → FxEmbed-D7k1ThAF.js} +1 -1
- package/web/assets/{GLTFLoader-Dy6SrZg8.js → GLTFLoader-BHWu1lKg.js} +1 -1
- package/web/assets/{MotionEmbed-PmXWSWe5.js → MotionEmbed-DFni5IAh.js} +1 -1
- package/web/assets/PluginStore-BrupM_8E.js +3 -0
- package/web/assets/{ShotComposer-Dprx-Yi7.js → ShotComposer-BLztjSKy.js} +4 -4
- package/web/assets/TemplateEmbed-BbAimhLj.js +2 -0
- package/web/assets/TimelinePlugins-BI1bE9pX.js +5 -0
- package/web/assets/TimelinePlugins-DYarX9RK.css +1 -0
- package/web/assets/TimelineShotFx-CQN3WIfN.js +2 -0
- package/web/assets/TransitionEmbed-CmoIrHVr.js +1 -0
- package/web/assets/{Whiteboard-DybaKCdo.js → Whiteboard-DMk0unYK.js} +3 -3
- package/web/assets/aerial-DT_gUtSh.js +2 -0
- package/web/assets/{agentTools-CxZqRLeR.js → agentTools-qOww5RUs.js} +2 -2
- package/web/assets/analyzerRun-B2FLUp4G.js +1 -0
- package/web/assets/{analyzerSandbox-DO5ZTv5q.js → analyzerSandbox-CJVsEhrg.js} +2 -2
- package/web/assets/{api-BsKbf3l3.js → api-QBI5GJTZ.js} +148 -148
- package/web/assets/auraTrack-CEs_Q9EP.js +1 -0
- package/web/assets/{breakthrough-Dv1bndQb.js → breakthrough-DvkxvNK9.js} +2 -2
- package/web/assets/{cameraPresets-B234aNzE.js → cameraPresets-4pFeF2YG.js} +1 -1
- package/web/assets/{captionLayout-CNgb471H.js → captionLayout-C67EMVI1.js} +1 -1
- package/web/assets/{clientExport-NtJmxOYP.js → clientExport-C4VgAJtO.js} +1 -1
- package/web/assets/{depthEstimate-wVYSJtW8.js → depthEstimate-mnXDZMW-.js} +1 -1
- package/web/assets/{directorTools-BqFcShgT.js → directorTools-BOHZjcww.js} +1 -1
- package/web/assets/{distortFrames-D3TQNcJA.js → distortFrames-Csuj2jHE.js} +2 -2
- package/web/assets/{distortGL-BklPDXPq.js → distortGL-BaXfN0IK.js} +2 -2
- package/web/assets/{editTools-BQlG5WB_.js → editTools-m0VGPmfF.js} +1 -1
- package/web/assets/{exportEncode-CaKEPgsy.js → exportEncode-D9OT7_5k.js} +1 -1
- package/web/assets/{exportGlb-DstxwzH5.js → exportGlb-CLfTnbMG.js} +1 -1
- package/web/assets/faceTracker-W0iZSiMe.js +1 -0
- package/web/assets/fightDirector-CECPf2iH.js +1 -0
- package/web/assets/{fightDrama-G7bXfpQu.js → fightDrama-CqNoa5XI.js} +2 -2
- package/web/assets/{frameSink-Dj71jCRb.js → frameSink-BGRj7wqY.js} +3 -3
- package/web/assets/{gpuCompose-DIxBHlTa.js → gpuCompose-CIEoLFem.js} +1 -1
- package/web/assets/gpuExport-uyOAyrhm.js +190 -0
- package/web/assets/handMatte-mHxZwLZD.js +1 -0
- package/web/assets/handTracker-dTVeSUzt.js +2 -0
- package/web/assets/{index-CZn97Ygs.js → index-D7M5t2re.js} +1 -1
- package/web/assets/layer-worker-Cp0pjurp.js +5 -0
- package/web/assets/library-Dsz_MLyd.js +1 -0
- package/web/assets/{lottieLayer-CfUPParC.js → lottieLayer-CDCGeJyv.js} +5 -5
- package/web/assets/{lottie_light_canvas-7iv3btPX.js → lottie_light_canvas-BblLU4nU.js} +1 -1
- package/web/assets/main-BQ8IY0WV.css +1 -0
- package/web/assets/{main-M1vRa-gd.js → main-CVRIuDW2.js} +76 -76
- package/web/assets/{mapBake-lPNhNZgv.js → mapBake-CNMOKXA7.js} +1 -1
- package/web/assets/maskTrack-Dtv6Jr06.js +1 -0
- package/web/assets/matteFixRun-BLDH2AjH.js +1 -0
- package/web/assets/{objectLocate-BDqfSo9J.js → objectLocate-Cy3IFBSF.js} +1 -1
- package/web/assets/{objectTrack.worker-ENzKeSiV.js → objectTrack.worker-BlZkgpOX.js} +483 -352
- package/web/assets/pendingMatte-C2AWApuv.js +2 -0
- package/web/assets/personAi-DPUnoymj.js +2 -0
- package/web/assets/plateCamera-C96L5GKm.js +1 -0
- package/web/assets/{plateCameraMatch-D41LQrsm.js → plateCameraMatch-Chk-ZjDi.js} +2 -2
- package/web/assets/{plateFollow-CNfi4xuP.js → plateFollow-B9_QTgvo.js} +2 -2
- package/web/assets/plateMatte-BiqyI_8x.js +2 -0
- package/web/assets/{pluginAutomation-BtQ_w2TB.js → pluginAutomation-5DYldFrb.js} +1 -1
- package/web/assets/poseTracker-PuI8vWpR.js +1 -0
- package/web/assets/{productTools-r2RgILaA.js → productTools-B1h5cgyt.js} +2 -2
- package/web/assets/remote-BJdzzFZg.js +1241 -0
- package/web/assets/{rigTrack-Bx9QHlFv.js → rigTrack-CUt4O67J.js} +1 -1
- package/web/assets/{rotoMaskStore-pxpRt5Cj.js → rotoMaskStore-DIi45swK.js} +1 -1
- package/web/assets/{rotoMatte-DyXlW4jK.js → rotoMatte-013RKqHu.js} +1 -1
- package/web/assets/{rotoscope-GORCSVBr.js → rotoscope-d_TUxa-J.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-B1iZT6F5.js} +1 -1
- package/web/assets/{shotFxAgent-CzHfe75S.js → shotFxAgent-BDfe73TP.js} +2 -2
- package/web/assets/{skin-BkaT2QuX.js → skin-GDY3QPkV.js} +1 -1
- package/web/assets/{spark.module-BRT8yMS4.js → spark.module-DdwuJ_hb.js} +1 -1
- package/web/assets/{spellDuel-BUy289OT.js → spellDuel-DjNN00bv.js} +2 -2
- package/web/assets/{store-BSSbvpzr.js → store-2zneEhhu.js} +1 -1
- package/web/assets/{surfaceLight-CMaBhZ_d.js → surfaceLight-B_SYg_f8.js} +1 -1
- package/web/assets/surfacePin-zDPmq-hH.js +2 -0
- package/web/assets/{textAnimators-Cihw35O8.js → textAnimators-Bdt5LWXk.js} +1 -1
- package/web/assets/{thumb-Cs636sYt.js → thumb-byAKvhQP.js} +1 -1
- package/web/assets/timeline3d-YIIk_Kn2.js +2 -0
- package/web/assets/timeline3dExport-CEH1RjNf.js +1 -0
- package/web/assets/{timelineComp-CRRzLazc.js → timelineComp-B73i_8vD.js} +1 -1
- package/web/assets/{timelineProps-tN2YsMYN.js → timelineProps-B2pnudeT.js} +1 -1
- package/web/assets/{timelineText-CkoUgWcY.js → timelineText-BcL4Pw3C.js} +1 -1
- package/web/assets/{titleArt-CcTdJuOC.js → titleArt-hb_T45WJ.js} +5 -5
- package/web/assets/{titleFrameBudget-3MFHWIT6.js → titleFrameBudget-Cml-MO53.js} +970 -839
- package/web/assets/titleFrames-Dw0PEBdV.js +1 -0
- package/web/assets/{tool-BhIsq238.js → tool-Bt9bclIf.js} +1 -1
- package/web/assets/{tools-DMUnabc_.js → tools-BXeJbgZJ.js} +1 -1
- package/web/assets/{toonTools-CICrV3QB.js → toonTools-u7Y9fdEZ.js} +2 -2
- package/web/assets/trackAnchor-9MnVHe4S.js +1 -0
- package/web/assets/{userFonts-BZ4QL-zq.js → userFonts-BHduCNtc.js} +1 -1
- package/web/assets/{vfxAlpha-D3Dk1tfF.js → vfxAlpha-DpV4rbI-.js} +1 -1
- package/web/assets/vfxBackground-Ddviync5.js +2 -0
- package/web/assets/{videoExport-l5MGvMn_.js → videoExport-z5WjM0hw.js} +1 -1
- package/web/assets/{views-BdWnG2xK.js → views-CsrYzCSR.js} +1 -1
- package/web/assets/weaponDuel-CLLgv5A4.js +1 -0
- package/web/assets/{windowFrames-CoIyWqxr.js → windowFrames-BQEWQkEs.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/desktop-BWhFnYwd.js +0 -1
- package/web/assets/faceTracker-DWxxieVC.js +0 -1
- package/web/assets/fightDirector-OMlPZgjv.js +0 -1
- 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-BPmr0TOL.css +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/timeline3d-BEuZZOxM.js +0 -2
- package/web/assets/timeline3dExport-CmSI_pjv.js +0 -1
- 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
- package/web/assets/weaponDuel-B2wTffPC.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mB as se}from"./titleFrameBudget-3MFHWIT6.js";const oe=[{family:"Inter",category:"Sans serif"},{family:"Be Vietnam Pro",category:"Sans serif"},{family:"Roboto",category:"Sans serif"},{family:"Open Sans",category:"Sans serif"},{family:"Montserrat",category:"Sans serif"},{family:"Manrope",category:"Sans serif"},{family:"Lexend",category:"Sans serif"},{family:"Archivo",category:"Sans serif"},{family:"Barlow",category:"Sans serif"},{family:"Noto Sans",category:"Sans serif"},{family:"Noto Serif",category:"Serif"},{family:"Playfair Display",category:"Serif"},{family:"Oswald",category:"Display"},{family:"Anton",category:"Display"},{family:"Bungee",category:"Display"},{family:"Dancing Script",category:"Handwriting"},{family:"Arial",category:"System"},{family:"Georgia",category:"System"},{family:"Courier New",category:"System"}],ce=oe.map(e=>e.family),ae=e=>ce.includes(e),fe=/^u:[A-Za-z0-9_-]{8,40}$/,ne=e=>typeof e=="string"&&fe.test(e),de=e=>ae(e)||ne(e);function ve(e){const n=new Set,i=new WeakSet,t=r=>{if(typeof r=="string"){ne(r)&&n.add(r);return}if(!(!r||typeof r!="object"||i.has(r))){i.add(r);for(const s of Array.isArray(r)?r:Object.values(r))t(s)}};return t(e),[...n]}const T=["linear","easeOutCubic","easeOutQuart","easeOutExpo","easeInOutCubic","easeOutBack","easeOutElastic","easeOutBounce"],R=["line","word","char"],Z=6,Y=["forward","reverse","center","random"],A={opacity:1,x:0,y:0,scale:1,scaleX:1,scaleY:1,reveal:1,wipeX:1,wipeY:1,brightness:1,blur:0,rotate:0,spread:0,glitch:0,flicker:0,count:1},le=["x","y","rotate","blur","spread","glitch","flicker"],F={opacity:[0,1],x:[-4,4],y:[-4,4],scale:[0,4],scaleX:[0,4],scaleY:[0,4],reveal:[0,1],wipeX:[0,1],wipeY:[0,1],brightness:[0,1],blur:[0,1],rotate:[-180,180],spread:[-.2,1.5],glitch:[0,1],flicker:[0,1],count:[0,20]},te={linear:e=>e,easeOutCubic:e=>1-(1-e)**3,easeOutQuart:e=>1-(1-e)**4,easeOutExpo:e=>e>=1?1:1-2**(-10*e),easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeOutBack:e=>1+2.70158*(e-1)**3+1.70158*(e-1)**2,easeOutElastic:e=>e<=0?0:e>=1?1:2**(-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375};function ge(e,n){m(e,n),g(e,["lines","unit","start","duration","stagger","order","easing","from","mask","at"],n),e.mask!==void 0&&typeof e.mask!="boolean"&&a(n+".mask","true/false"),R.includes(e.unit??"line")||a(n+".unit",R.join("/")),e.order!==void 0&&!Y.includes(e.order)&&a(n+".order",Y.join("/")),e.easing!==void 0&&!T.includes(e.easing)&&a(n+".easing",T.join("/"));let i=null;e.lines!==void 0&&e.lines!==null&&((!Array.isArray(e.lines)||!e.lines.length||e.lines.length>8||e.lines.some(o=>!Number.isInteger(o)||o<0||o>7))&&a(n+".lines","mảng chỉ số dòng 0–7"),i=[...new Set(e.lines)]);let t=null;e.at!==void 0&&((!Array.isArray(e.at)||!e.at.length||e.at.length>60)&&a(n+".at","cần 1–60 mốc giây"),t=e.at.map((o,f)=>c(o,0,10,`${n}.at[${f}]`)));const r=m(e.from??{},n+".from");g(r,Object.keys(A),n+".from"),Object.keys(r).length||a(n+".from","cần ít nhất 1 thuộc tính");const s={};for(const[o,f]of Object.entries(r))s[o]=c(f,F[o][0],F[o][1],`${n}.from.${o}`);return{lines:i,unit:e.unit??"line",start:c(e.start,0,10,n+".start",0),duration:c(e.duration,.02,5,n+".duration",.4),stagger:c(e.stagger,0,2,n+".stagger",0),order:e.order??"forward",easing:e.easing??"easeOutCubic",from:s,mask:e.mask===!0,...t?{at:t}:{}}}function en(e,n="animation"){return m(e,n),g(e,["version","in","out","outSpeed"],n),e.version!==void 0&&e.version!==1&&a(n+".version","chỉ hỗ trợ version 1"),(!Array.isArray(e.in)||!e.in.length||e.in.length>Z)&&a(n+".in",`cần 1–${Z} track`),e.out!==void 0&&!["reverse","none"].includes(e.out)&&a(n+".out","reverse hoặc none"),{version:1,in:e.in.map((i,t)=>ge(i,`${n}.in[${t}]`)),out:e.out??"reverse",outSpeed:c(e.outSpeed,.25,4,n+".outSpeed",1.5)}}function me(e,n){const i=[...Array(e).keys()];let t=n||1;for(let r=e-1;r>0;r--){t=t*16807%2147483647;const s=t%(r+1);[i[r],i[s]]=[i[s],i[r]]}return i}function _(e,n,i){return i==="reverse"?n-1-e:i==="center"?Math.abs(e-(n-1)/2)*2|0:i==="random"?me(n,n*7919).indexOf(e):e}function ue(e,n){let i=0;for(const t of e.in)for(const[r,s]of n.entries()){if(t.lines&&!t.lines.includes(r))continue;const o=t.unit==="line"?1:s[t.unit];for(let f=0;f<o;f++)i=Math.max(i,re(t,f,o)+t.duration)}return i}function re(e,n,i){if(e.at){const t=_(n,i,e.order),r=Math.min(t,e.at.length-1);return e.at[r]+e.stagger*(t-r)}return e.start+e.stagger*_(n,i,e.order)}function ye(e,n,i,t){const r=re(e,n,i);return te[e.easing](Math.min(1,Math.max(0,(t-r)/e.duration)))}function nn(e,n,i,t,r=0){const s=Math.max(r,ue(e,n)),o=s/e.outSpeed;return e.out==="reverse"&&Number.isFinite(t)&&i>Math.max(s,t-o)?(t-i)*e.outSpeed:i}function tn(e,n,i,t,r,s){const o={...A,masked:!1};for(const f of e.in){if(f.unit!==n||f.lines&&!f.lines.includes(i))continue;const l=ye(f,t,r,s);f.mask&&l<1&&(o.masked=!0);for(const[d,b]of Object.entries(f.from)){const k=b+(A[d]-b)*l;le.includes(d)?o[d]+=k:o[d]*=k}}return o}const rn=Object.freeze({...A});function H(e,n){m(e,n),g(e,["start","duration","easing","from","spin","origin","stagger"],n),e.easing!==void 0&&!T.includes(e.easing)&&a(n+".easing",T.join("/")),e.origin!==void 0&&!["center","left","right","top","bottom"].includes(e.origin)&&a(n+".origin","center/left/right/top/bottom");const i=m(e.from??{},n+".from");g(i,["opacity","x","y","scale","scaleX","scaleY","rotate","wipeX","wipeY"],n+".from");const t={};for(const[r,s]of Object.entries(i))t[r]=c(s,F[r][0],F[r][1],`${n}.from.${r}`);return{start:c(e.start,0,10,n+".start",0),duration:c(e.duration,.02,5,n+".duration",.6),easing:e.easing??"easeOutCubic",from:t,spin:c(e.spin,-720,720,n+".spin",0),origin:e.origin??"center",...e.stagger?{stagger:c(e.stagger,0,2,n+".stagger")}:{}}}function sn(e,n=1){let i=0;for(const t of e?.layers||[])t.motion&&(i=Math.max(i,t.motion.start+t.motion.duration+(t.motion.stagger||0)*Math.max(0,n-1)));return i}function on(e,n){const i={...A};if(!e)return i;const t=te[e.easing](Math.min(1,Math.max(0,(n-e.start)/e.duration)));for(const[r,s]of Object.entries(e.from))i[r]=s+(A[r]-s)*t;return i.rotate+=e.spin*Math.max(0,n-e.start),i}function cn(e,n){return n===1?e:e.replace(/\d[\d.,]*\d|\d/,i=>{const t=/^\d{1,3}([.,]\d{3})+$/.test(i)?i.match(/[.,]/)[0]:"";if(!t&&/[.,]/.test(i)){const s=i.split(/[.,]/)[1].length;return Math.max(0,Number(i.replace(",","."))*n).toFixed(s).replace(".",i.includes(",")?",":".")}const r=String(Math.max(0,Math.round(Number(i.replace(/[.,]/g,""))*n)));return t?r.replace(/\B(?=(\d{3})+(?!\d))/g,t):r})}const he=Object.freeze({sparkle:["m12 2 2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4L12 2Z","m19 17 1 3 3 1-3 1-1 3-1-3-3-1 3-1 1-3Z"],pen:["M5 16 16 5l3 3L8 19H5v-3Z","m14 7 3 3M4 20h16"],target:["M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0Z","M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z","M12 1v4m0 14v4M1 12h4m14 0h4"],play:["M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2Z","m10 9 5 3-5 3V9Z"],bolt:["m13 2-8 11h6l-1 9 9-12h-6l0-8Z"],navigate:["M4 17 10 3l3 9 7-3-6 12-3-7-7 3Z"],chip:["M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2Z","M9 9h6v6h-6Z","M8 1v3m8-3v3M8 20v3m8-3v3M1 8h3m-3 8h3m16-8h3m-3 8h3"],data:["M4 6h16M4 12h10M4 18h16","m17 10 4 2-4 2"],building:["M3 21V8l9-5 9 5v13H3Z","M9 21v-7h6v7M8 9h1m6 0h1"],signal:["M4 16a8 8 0 0 1 16 0M7 16a5 5 0 0 1 10 0M10 16a2 2 0 0 1 4 0M12 20h.01"],office:["M3 21V4h11v17M14 9h7v12H3M7 8h3m-3 4h3m-3 4h3m10-3h-2m2 4h-2"],cloud:["M4 15a4 4 0 0 1 1-8 7 7 0 0 1 13 1 4 4 0 0 1 1 8H4Z","m9 19 3 3 3-3M12 13v9"],skyline:["M3 21V9l5-3v15M8 21V4l6-2v19m0-11 7-3v14M3 21h18"],network:["M2 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z","M18 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z","M18 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z","m6 11 12-4M6 13l12 4"],video:["M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2Z","m10 9 5 3-5 3V9Z","M7 22h10"],home:["m3 11 9-8 9 8v10H3V11Z","M9 21v-7h6v7M8 10h.01m8 0h.01"],compass:["M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0Z","m12 4 3 8-3 8-3-8 3-8ZM4 12h16"],grid:["M3 3h18v18H3V3ZM3 9h18M9 3v18M15 9v12"],chart:["M3 20h18M5 17l5-6 4 3 5-8","m16 6 3 0 0 3"],pin:["M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z","M9.5 10a2.5 2.5 0 1 0 5.0 0a2.5 2.5 0 1 0 -5.0 0Z"]}),we=Object.keys(he),be=/^#[0-9a-f]{6}$/i,ke=e=>[1,3,5].map(n=>parseInt(e.slice(n,n+2),16)/255),pe=e=>"#"+e.map(n=>Math.round(Math.max(0,Math.min(1,n))*255).toString(16).padStart(2,"0")).join("");function Me(e){const[n,i,t]=ke(e),r=Math.max(n,i,t),s=Math.min(n,i,t),o=(r+s)/2,f=r-s;if(!f)return[0,0,o];const l=f/(1-Math.abs(2*o-1));return[(r===n?((i-t)/f+6)%6:r===i?(t-n)/f+2:(n-i)/f+4)*60,l,o]}function P(e,n,i){const t=(1-Math.abs(2*i-1))*n,r=t*(1-Math.abs(e/60%2-1)),s=i-t/2,[o,f,l]=e<60?[t,r,0]:e<120?[r,t,0]:e<180?[0,t,r]:e<240?[0,r,t]:e<300?[r,0,t]:[t,0,r];return pe([o+s,f+s,l+s])}const p={yellow:55,cyan:185,magenta:315};function xe(e,n){if(n==="yellow")return p.yellow;if(n==="cyan")return p.cyan;if(n==="pink")return p.magenta;const i=(t,r)=>Math.abs((t-r+540)%360-180);for(const t of Object.values(p))if(i(e,t)<=15)return t;return e>=345||e<135?p.yellow:e<255?p.cyan:p.magenta}function Ae(e,{white:n=!1,toward:i="auto"}={}){if(!be.test(e))throw new Error("màu gốc phải là #rrggbb");const[t,r,s]=Me(e);if(r<.15)return s<.35?{type:"radial",gradient:["#5c5c5c","#0d0d0d"]}:{type:"radial",gradient:["#ffffff",n?"#d6d6d6":"#8a8a8a"],stops:[.25,1]};const o=P(t,Math.max(.75,r),Math.min(.5,Math.max(.32,s))),f=P(xe(t,i),1,.58);return n?{gradient:["#ffffff",f,o],stops:[0,.38,1],angle:90}:{gradient:[f,o],angle:90}}const Se=/^auto(\+white)?(?:-(yellow|cyan|pink))?:(#[0-9a-f]{6})$/i;function Oe(e){const n=typeof e=="string"?Se.exec(e):null;return n?Ae(n[3].toLowerCase(),{white:!!n[1],toward:(n[2]||"auto").toLowerCase()}):null}const B=8,I=["condensed","semi-condensed","normal","semi-expanded","expanded"],G=["halftone","lines","grain"],z=["atop","cut","keep"],$e=/^#[0-9a-f]{6}$/i,a=(e,n)=>{throw new Error(`${e}: ${n}`)},m=(e,n)=>((!e||typeof e!="object"||Array.isArray(e))&&a(n,"phải là object"),e),c=(e,n,i,t,r)=>e===void 0?r:((typeof e!="number"||!Number.isFinite(e)||e<n||e>i)&&a(t,`phải là số từ ${n} đến ${i}`),e),D=(e,n,i,{required:t=!1,fallback:r=""}={})=>e===void 0&&!t?r:((typeof e!="string"||t&&!e.trim()||e.length>n)&&a(i,`cần chuỗi tối đa ${n} ký tự`),e.trim()),Ee=["{color}","{accent}","{accent-hi}","{accent-lo}","{accent-bright}","{accent-deep}","{color-lo}","transparent"],u=(e,n)=>{if(Ee.includes(e)||typeof e=="string"&&$e.test(e))return e;a(n,"màu phải là #rrggbb, {color}, {accent}, {accent-hi}, {accent-lo}, {accent-bright}, {accent-deep}, {color-lo} hoặc transparent")},g=(e,n,i)=>{for(const t of Object.keys(e))n.includes(t)||a(i,`trường lạ "${t}"`)};function je(e,n){(!Array.isArray(e)||e.length!==4)&&a(n,"[x, y, w, h] theo tỉ lệ khung");const[i,t,r,s]=e.map((o,f)=>c(o,f<2?-.5:0,f<2?1.5:2,`${n}[${f}]`));return[i,t,r,s]}function x(e,n){if(typeof e=="string")return Oe(e)??u(e,n);m(e,n),g(e,["gradient","angle","type","stops"],n),(!Array.isArray(e.gradient)||e.gradient.length<2||e.gradient.length>4)&&a(n+".gradient","cần 2–4 màu"),e.type!==void 0&&!["linear","radial"].includes(e.type)&&a(n+".type","linear hoặc radial");const i={gradient:e.gradient.map((t,r)=>u(t,`${n}.gradient[${r}]`))};return e.type==="radial"?i.type="radial":i.angle=c(e.angle,0,360,n+".angle",90),e.stops!==void 0&&((!Array.isArray(e.stops)||e.stops.length!==i.gradient.length)&&a(n+".stops","mỗi màu một vị trí 0–1"),i.stops=e.stops.map((t,r)=>c(t,0,1,`${n}.stops[${r}]`)),i.stops.some((t,r)=>r&&t<i.stops[r-1])&&a(n+".stops","vị trí phải tăng dần")),i}function Te(e,n){if(e!==void 0)return(!Array.isArray(e)||!e.length||e.length>8||e.some(i=>!Number.isInteger(i)||i<0||i>7))&&a(n,"mảng chỉ số dòng 0–7"),[...new Set(e)]}function q(e,n){const i=m(e,n);return g(i,["color","blur","x","y"],n),{color:u(i.color??"#000000",n+".color"),blur:c(i.blur,0,1,n+".blur",.15),x:c(i.x,-.5,.5,n+".x",0),y:c(i.y,-.5,.5,n+".y",0)}}function X(e,n){const i=Te(e.lines,n+".lines");return{...i?{lines:i}:{},...e.motion!==void 0?{motion:H(e.motion,n+".motion")}:{}}}function Fe(e,n){m(e,n);const i={opacity:c(e.opacity,0,1,n+".opacity",1)};switch(e.type){case"box":{g(e,["type","fill","radius","padX","padY","opacity","per","stroke","shadow","skewX","lines","motion"],n),e.per!==void 0&&!["line","block"].includes(e.per)&&a(n+".per","line hoặc block");const t={type:"box",fill:x(e.fill??"{accent}",n+".fill"),radius:c(e.radius,0,1,n+".radius",.15),padX:c(e.padX,0,1.5,n+".padX",.3),padY:c(e.padY,0,1,n+".padY",.12),per:e.per||"line",...i};if(e.stroke!==void 0){const r=m(e.stroke,n+".stroke");g(r,["color","width"],n+".stroke"),t.stroke={color:u(r.color??"{accent}",n+".stroke.color"),width:c(r.width,.01,.3,n+".stroke.width",.05)}}return e.shadow!==void 0&&(t.shadow=q(e.shadow,n+".shadow")),e.skewX!==void 0&&(t.skewX=c(e.skewX,-30,30,n+".skewX")),{...t,...X(e,n)}}case"text":{g(e,["type","fill","lineFills","stroke","shadow","offset","opacity","shine","flicker","lines","motion","reflection","innerGlow","highlights"],n);const t={type:"text",fill:x(e.fill??"{color}",n+".fill"),...i,...X(e,n)};if(e.shine!==void 0){const r=m(e.shine,n+".shine");g(r,["color","width","angle","start","duration","every"],n+".shine"),t.shine={color:u(r.color??"#ffffff",n+".shine.color"),width:c(r.width,.1,4,n+".shine.width",.8),angle:c(r.angle,-60,60,n+".shine.angle",20),start:c(r.start,0,10,n+".shine.start",.6),duration:c(r.duration,.1,5,n+".shine.duration",.8),every:c(r.every,0,10,n+".shine.every",0)}}if(e.flicker!==void 0&&(t.flicker=c(e.flicker,0,1,n+".flicker")),e.lineFills!==void 0&&((!Array.isArray(e.lineFills)||!e.lineFills.length||e.lineFills.length>4)&&a(n+".lineFills","cần 1–4 màu"),t.lineFills=e.lineFills.map((r,s)=>u(r,`${n}.lineFills[${s}]`))),e.stroke!==void 0){const r=m(e.stroke,n+".stroke");g(r,["color","width"],n+".stroke"),t.stroke={color:u(r.color??"{accent}",n+".stroke.color"),width:c(r.width,.01,.3,n+".stroke.width",.08)}}if(e.shadow!==void 0&&(t.shadow=q(e.shadow,n+".shadow")),e.offset!==void 0){const r=m(e.offset,n+".offset");g(r,["x","y"],n+".offset"),t.offset={x:c(r.x,-.5,.5,n+".offset.x",0),y:c(r.y,-.5,.5,n+".offset.y",0)}}if(e.reflection!==void 0){const r=m(e.reflection,n+".reflection");g(r,["opacity","gap","fade"],n+".reflection"),t.reflection={opacity:c(r.opacity,.05,1,n+".reflection.opacity",.35),gap:c(r.gap,-.3,.6,n+".reflection.gap",.04),fade:c(r.fade,.15,1,n+".reflection.fade",.7)}}if(e.innerGlow!==void 0){const r=m(e.innerGlow,n+".innerGlow");g(r,["color","blur"],n+".innerGlow"),t.innerGlow={color:u(r.color??"#ffffff",n+".innerGlow.color"),blur:c(r.blur,.02,.5,n+".innerGlow.blur",.12)}}return e.highlights!==void 0&&((!Array.isArray(e.highlights)||!e.highlights.length||e.highlights.length>4)&&a(n+".highlights","cần 1–4 nhóm từ"),t.highlights=e.highlights.map((r,s)=>{const o=`${n}.highlights[${s}]`;return m(r,o),g(r,["words","fill"],o),(!Array.isArray(r.words)||!r.words.length||r.words.length>40||r.words.some(f=>!Number.isInteger(f)||f<0||f>199))&&a(o+".words","số thứ tự từ 0–199"),{words:[...new Set(r.words)],fill:x(r.fill??"{accent}",o+".fill")}})),t}case"underline":return g(e,["type","fill","height","width","offsetY","opacity","line","style","lines","motion"],n),e.line!==void 0&&!["last","all"].includes(e.line)&&a(n+".line","last hoặc all"),e.style!==void 0&&!["bar","swash"].includes(e.style)&&a(n+".style","bar hoặc swash"),{type:"underline",fill:x(e.fill??"{accent}",n+".fill"),height:c(e.height,.02,.4,n+".height",.07),width:c(e.width,.1,1.4,n+".width",1),offsetY:c(e.offsetY,-1.2,1.2,n+".offsetY",.55),line:e.line||"last",...e.style==="swash"?{style:"swash"}:{},...i,...X(e,n)};case"shape":{g(e,["type","shape","box","fill","stroke","radius","skewX","rotate","blur","opacity","motion"],n),["rect","ellipse","glow"].includes(e.shape)||a(n+".shape","rect/ellipse/glow");const t={type:"shape",shape:e.shape,box:je(e.box,n+".box"),radius:c(e.radius,0,.5,n+".radius",0),skewX:c(e.skewX,-45,45,n+".skewX",0),rotate:c(e.rotate,-180,180,n+".rotate",0),blur:c(e.blur,0,.2,n+".blur",0),...i};if(e.fill!==void 0&&(t.fill=x(e.fill,n+".fill")),e.stroke!==void 0){const r=m(e.stroke,n+".stroke");g(r,["color","width","dash"],n+".stroke"),t.stroke={color:u(r.color??"{accent}",n+".stroke.color"),width:c(r.width,.5,12,n+".stroke.width",1.5)},r.dash!==void 0&&((!Array.isArray(r.dash)||r.dash.length!==2)&&a(n+".stroke.dash","[nét, khoảng]"),t.stroke.dash=r.dash.map((s,o)=>c(s,1,60,`${n}.stroke.dash[${o}]`)))}return!t.fill&&!t.stroke&&a(n,"shape cần fill hoặc stroke"),e.motion!==void 0&&(t.motion=H(e.motion,n+".motion")),t}case"icon":{g(e,["type","name","center","size","color","width","badge","badgeFill","badgeStroke","glow","rotate","opacity","motion"],n),we.includes(e.name)||a(n+".name","icon không có trong bộ dựng sẵn"),(!Array.isArray(e.center)||e.center.length!==2)&&a(n+".center","[x, y]"),e.badge!==void 0&&!["none","circle","square","rounded","diamond"].includes(e.badge)&&a(n+".badge","none/circle/square/rounded/diamond");const t={type:"icon",name:e.name,center:e.center.map((r,s)=>c(r,-.2,1.2,`${n}.center[${s}]`)),size:c(e.size,.02,.4,n+".size",.12),color:u(e.color??"{accent}",n+".color"),width:c(e.width,.5,4,n+".width",2),badge:e.badge??"none",rotate:c(e.rotate,-180,180,n+".rotate",0),glow:c(e.glow,0,1,n+".glow",0),...i};return e.badgeFill!==void 0&&(t.badgeFill=u(e.badgeFill,n+".badgeFill")),e.badgeStroke!==void 0&&(t.badgeStroke=u(e.badgeStroke,n+".badgeStroke")),e.motion!==void 0&&(t.motion=H(e.motion,n+".motion")),t}case"texture":return g(e,["type","pattern","mode","color","scale","size","angle","fade","fadeAngle","opacity"],n),G.includes(e.pattern)||a(n+".pattern",G.join("/")),e.mode!==void 0&&!z.includes(e.mode)&&a(n+".mode",z.join("/")),{type:"texture",pattern:e.pattern,mode:e.mode??"atop",color:u(e.color??"#000000",n+".color"),scale:c(e.scale,2,60,n+".scale",8),size:c(e.size,.05,1,n+".size",.5),angle:c(e.angle,-90,90,n+".angle",45),fade:c(e.fade,0,1,n+".fade",0),fadeAngle:c(e.fadeAngle,-180,180,n+".fadeAngle",90),...i};default:a(n+".type","chỉ hỗ trợ box, text, underline, shape, icon, texture")}}const ie=[400,500,600,700,800,900],Ie=["left","center","right"];function Ne(e,n){return m(e,n),g(e,["scale","fill","font","italic","weight","tracking","stretch","x","y","rotate","align","side","label","labelEn"],n),e.align!==void 0&&!Ie.includes(e.align)&&a(n+".align","left/center/right"),e.side!==void 0&&!["left","right"].includes(e.side)&&a(n+".side","left/right"),e.font!==void 0&&!de(e.font)&&a(n+".font","font không có trong danh sách Timeline hay font của bạn"),e.italic!==void 0&&typeof e.italic!="boolean"&&a(n+".italic","true/false"),e.weight!==void 0&&!ie.includes(e.weight)&&a(n+".weight","400–900"),e.stretch!==void 0&&!I.includes(e.stretch)&&a(n+".stretch",I.join("/")),{scale:c(e.scale,.2,3,n+".scale",1),...e.fill!==void 0?{fill:x(e.fill,n+".fill")}:{},...e.font!==void 0?{font:e.font}:{},...e.italic?{italic:!0}:{},...e.weight!==void 0?{weight:e.weight}:{},...e.tracking!==void 0?{tracking:c(e.tracking,-.15,.6,n+".tracking")}:{},...e.stretch!==void 0?{stretch:e.stretch}:{},...e.x!==void 0?{x:c(e.x,-4,4,n+".x")}:{},...e.y!==void 0?{y:c(e.y,-4,4,n+".y")}:{},...e.rotate!==void 0?{rotate:c(e.rotate,-30,30,n+".rotate")}:{},...e.align!==void 0?{align:e.align}:{},...e.side!==void 0?{side:e.side}:{},...e.label!==void 0?{label:D(e.label,24,n+".label",{required:!0})}:{},...e.labelEn!==void 0?{labelEn:D(e.labelEn,24,n+".labelEn",{required:!0})}:{}}}function an(e,n="design"){m(e,n),g(e,["weight","lineHeight","uppercase","layers","lines","stack","gap","stretch","tracking","shiftY","shiftX","maxWidth","wrap","linesFrom","path"],n),e.wrap!==void 0&&!["char","word"].includes(e.wrap)&&a(n+".wrap","char hoặc word"),e.linesFrom!==void 0&&!["start","end"].includes(e.linesFrom)&&a(n+".linesFrom","start hoặc end"),e.stack!==void 0&&!["center","ink"].includes(e.stack)&&a(n+".stack","center hoặc ink"),e.stretch!==void 0&&!I.includes(e.stretch)&&a(n+".stretch",I.join("/"));let i;return e.lines!==void 0&&((!Array.isArray(e.lines)||!e.lines.length||e.lines.length>8)&&a(n+".lines","cần 1–8 dòng"),i=e.lines.map((t,r)=>Ne(t,`${n}.lines[${r}]`))),(!Array.isArray(e.layers)||!e.layers.length||e.layers.length>B)&&a(n+".layers",`cần 1–${B} lớp`),e.layers.some(t=>t?.type==="text")||a(n+".layers","cần ít nhất 1 lớp text"),e.weight!==void 0&&!ie.includes(e.weight)&&a(n+".weight","400–900"),e.uppercase!==void 0&&typeof e.uppercase!="boolean"&&a(n+".uppercase","true/false"),{weight:e.weight??700,lineHeight:c(e.lineHeight,1.25,2,n+".lineHeight",1.32),uppercase:e.uppercase??!1,layers:e.layers.map((t,r)=>Fe(t,`${n}.layers[${r}]`)),...i?{lines:i}:{},...e.stack?{stack:e.stack}:{},...e.gap!==void 0?{gap:c(e.gap,0,.5,n+".gap")}:{},...e.stretch?{stretch:e.stretch}:{},...e.tracking!==void 0?{tracking:c(e.tracking,-.15,.6,n+".tracking")}:{},...e.shiftY!==void 0?{shiftY:c(e.shiftY,-.3,.3,n+".shiftY")}:{},...e.shiftX!==void 0?{shiftX:c(e.shiftX,-.3,.3,n+".shiftX")}:{},...e.maxWidth!==void 0?{maxWidth:c(e.maxWidth,.15,.9,n+".maxWidth")}:{},...e.wrap==="word"?{wrap:"word"}:{},...e.linesFrom==="end"?{linesFrom:"end"}:{},...e.path!=null?{path:se(e.path,n+".path")}:{}}}function fn(e,n,i){const t=e?.lines;if(t)return t[e.linesFrom==="end"?t.length-(i-n):n]}const U=["chars","charsNoSpace","words","lines"],W=["square","rampUp","rampDown","triangle","round","smooth"],V=["add","subtract","intersect"],K=["linear","easeIn","easeOut","easeInOut","hold"],Q=8,Xe=["start","end","offset","amount"],He=/^#[0-9a-f]{6}$/i,$={x:[-2e3,2e3],y:[-2e3,2e3],scale:[0,1e3],rotate:[-3600,3600],opacity:[0,100],tracking:[-200,500],fill:null,stroke:[0,50],strokeColor:null,blur:[0,200],skew:[-85,85]},Ce=(e,n,i,t)=>((!Array.isArray(e)||e.length>60)&&a(n,"cần mảng ≤ 60 key"),e.map((s,o)=>(m(s,`${n}[${o}]`),g(s,["time","value","ease"],`${n}[${o}]`),s.ease!==void 0&&!K.includes(s.ease)&&a(`${n}[${o}].ease`,K.join("/")),{time:c(s.time,0,600,`${n}[${o}].time`),value:c(s.value,i,t,`${n}[${o}].value`),...s.ease&&s.ease!=="linear"?{ease:s.ease}:{}})).sort((s,o)=>s.time-o.time));function Le(e,n){m(e,n);const i=e.type??"range";["range","wiggly"].includes(i)||a(n+".type","range/wiggly"),e.basedOn!==void 0&&!U.includes(e.basedOn)&&a(n+".basedOn",U.join("/")),e.mode!==void 0&&!V.includes(e.mode)&&a(n+".mode",V.join("/"));const t={type:i,basedOn:e.basedOn??"chars",mode:e.mode??(i==="wiggly"?"intersect":"add"),seed:c(e.seed,0,1e6,n+".seed",1)};if(Number.isInteger(t.seed)||a(n+".seed","số nguyên"),i==="wiggly")return g(e,["type","basedOn","mode","seed","maxAmount","minAmount","wiggles","correlation"],n),{...t,maxAmount:c(e.maxAmount,-100,100,n+".maxAmount",100),minAmount:c(e.minAmount,-100,100,n+".minAmount",-100),wiggles:c(e.wiggles,0,30,n+".wiggles",2),correlation:c(e.correlation,0,100,n+".correlation",50)};g(e,["type","basedOn","mode","seed","start","end","offset","amount","shape","easeHigh","easeLow","smoothness","random","keys","loop"],n),e.shape!==void 0&&!W.includes(e.shape)&&a(n+".shape",W.join("/")),e.random!==void 0&&typeof e.random!="boolean"&&a(n+".random","true/false"),e.loop!==void 0&&typeof e.loop!="boolean"&&a(n+".loop","true/false");const r={...t,start:c(e.start,0,100,n+".start",0),end:c(e.end,0,100,n+".end",100),offset:c(e.offset,-200,200,n+".offset",0),amount:c(e.amount,-100,100,n+".amount",100),shape:e.shape??"square",easeHigh:c(e.easeHigh,-100,100,n+".easeHigh",0),easeLow:c(e.easeLow,-100,100,n+".easeLow",0),smoothness:c(e.smoothness,0,100,n+".smoothness",100),random:e.random===!0,...e.loop===!0?{loop:!0}:{}};if(e.keys!==void 0&&e.keys!==null){m(e.keys,n+".keys"),g(e.keys,Xe,n+".keys");const s={};for(const[o,f]of Object.entries(e.keys)){const l=o==="offset"?[-200,200]:o==="amount"?[-100,100]:[0,100],d=Ce(f,`${n}.keys.${o}`,l[0],l[1]);d.length&&(s[o]=d)}Object.keys(s).length&&(r.keys=s)}return r}function Re(e,n="animator"){m(e,n),g(e,["name","properties","selectors"],n),e.name!==void 0&&(typeof e.name!="string"||e.name.length>40)&&a(n+".name","chuỗi ≤ 40 ký tự");const i=m(e.properties??{},n+".properties");g(i,Object.keys($),n+".properties");const t={};for(const[s,o]of Object.entries(i))o!=null&&($[s]?t[s]=c(o,$[s][0],$[s][1],`${n}.properties.${s}`):((typeof o!="string"||!He.test(o))&&a(`${n}.properties.${s}`,"#RRGGBB"),t[s]=o.toLowerCase()));Object.keys(t).some(s=>s!=="strokeColor")||a(n+".properties","cần ít nhất 1 thuộc tính");const r=e.selectors??[{}];return(!Array.isArray(r)||!r.length||r.length>4)&&a(n+".selectors","cần 1–4 selector"),{...e.name?{name:e.name}:{},properties:t,selectors:r.map((s,o)=>Le(s,`${n}.selectors[${o}]`))}}function Ze(e,n="animators"){return e==null?[]:((!Array.isArray(e)||e.length>Q)&&a(n,`cần mảng ≤ ${Q} animator`),e.map((i,t)=>Re(i,`${n}[${t}]`)))}const J=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter("vi",{granularity:"grapheme"}):null;function Ye(e){const n=String(e??"").normalize("NFC");if(J)return Array.from(J.segment(n),t=>t.segment);const i=[];for(const t of Array.from(n))i.length&&/\p{M}/u.test(t)?i[i.length-1]+=t:i.push(t);return i}function dn(e){const n=[];let i=0,t=-1,r=-1;return e.forEach((s,o)=>{let f=!1;for(const l of Ye(s)){const d=!/\S/u.test(l);d?f=!1:(t++,f||(r++,f=!0)),n.push({row:o,text:l,space:d,chars:i++,charsNoSpace:Math.max(0,t),words:Math.max(0,r),lines:o})}}),{units:n,counts:{chars:i,charsNoSpace:t+1,words:r+1,lines:e.length}}}const _e={linear:e=>e,easeIn:e=>e*e*e,easeOut:e=>1-(1-e)**3,easeInOut:e=>e<.5?4*e**3:1-(-2*e+2)**3/2};function E(e,n,i,t=!1){if(!e?.length)return i;if(t&&e.length>1){const r=e[0].time,s=e.at(-1).time-r;s>1e-6&&n>r&&(n=r+(n-r)%s)}if(n<=e[0].time)return e[0].value;for(let r=1;r<e.length;r++){const s=e[r-1],o=e[r];if(n<=o.time){if(s.ease==="hold")return s.value;const f=(n-s.time)/Math.max(1e-9,o.time-s.time);return s.value+(o.value-s.value)*_e[s.ease??"linear"](f)}}return e.at(-1).value}const Pe=e=>()=>{e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296},j=new Map;function Be(e,n){const i=e+":"+n;let t=j.get(i);if(t)return t;const r=Pe(n*7919+17);t=[...Array(e).keys()];for(let s=e-1;s>0;s--){const o=Math.floor(r()*(s+1));[t[s],t[o]]=[t[o],t[s]]}return j.size>200&&j.clear(),j.set(i,t),t}const M=e=>Math.min(1,Math.max(0,e));function Ge(e,n,i){const t=n/100,r=i/100;return e=t>=0?e**(1+2*t):1-(1-e)**(1-2*t),r>=0?1-(1-e)**(1+2*r):e**(1-2*r)}function ze(e,n,i,t){if(i<=0)return 0;const r=e.random?Be(i,e.seed)[n]:n,s=e.keys||{},o=!!e.loop,f=E(s.start,t,e.start,o)/100,l=E(s.end,t,e.end,o)/100,d=E(s.offset,t,e.offset,o)/100,b=E(s.amount,t,e.amount,o)/100,k=Math.min(f,l)+d,L=Math.max(f,l)+d;let h;if(e.shape==="square"){const S=r/i,O=(r+1)/i,y=M((Math.min(O,L)-Math.max(S,k))*i),N=e.smoothness/100;h=N>=1?y:N<=0?y>.5+1e-9?1:y<.5-1e-9?0:.5:M((y-.5)/N+.5)}else{const S=(r+.5)/i,O=L-k,y=O>1e-9?(S-k)/O:S<k?-1:2;e.shape==="rampUp"?h=M(y):e.shape==="rampDown"?h=1-M(y):y<0||y>1?h=0:e.shape==="triangle"?h=1-Math.abs(2*y-1):e.shape==="round"?h=Math.sqrt(Math.max(0,1-(2*y-1)**2)):h=(1-Math.cos(2*Math.PI*y))/2}return(e.easeHigh||e.easeLow)&&(h=Ge(M(h),e.easeLow,e.easeHigh)),h*b}const v=(e,n)=>{const i=Math.sin(e*127.1+n*311.7)*43758.5453;return(i-Math.floor(i))*2-1},ee=(e,n)=>{const i=Math.floor(e),t=e-i,r=t*t*(3-2*t);return v(i,n)*(1-r)+v(i+1,n)*r};function De(e,n,i,t){const r=t*e.wiggles,s=e.correlation/100,o=s*ee(r,e.seed)+(1-s)*ee(r+n*3.17,e.seed+1+n*13.7);return(e.minAmount+(o+1)/2*(e.maxAmount-e.minAmount))/100}function qe(e,n,i,t){let r=0;return e.selectors.forEach((s,o)=>{const f=i[s.basedOn],l=n[s.basedOn],d=s.type==="wiggly"?De(s,l,f,t):ze(s,l,f,t);r=o===0?d:s.mode==="intersect"?r*d:s.mode==="subtract"?r-d:r+d}),Math.max(-1,Math.min(1,r))}const Ue=Object.freeze({x:0,y:0,scale:1,rotate:0,opacity:1,tracking:0,blur:0,skew:0,stroke:0,strokeColor:null,fill:null,fillAmount:0}),We=(e,n,i)=>{const t=parseInt(e.slice(1),16),r=parseInt(n.slice(1),16);return"#"+[16,8,0].map(s=>Math.round((t>>s&255)+((r>>s&255)-(t>>s&255))*i).toString(16).padStart(2,"0")).join("")};function ln(e,n,i){const{units:t,counts:r}=n;return t.map(s=>{const o={...Ue};for(const f of e){const l=qe(f,s,r,i);if(Math.abs(l)<1e-6)continue;const d=f.properties;if(d.x&&(o.x+=d.x*l),d.y&&(o.y+=d.y*l),d.rotate&&(o.rotate+=d.rotate*l),d.tracking&&(o.tracking+=d.tracking*l),d.blur&&(o.blur+=d.blur*l),d.skew&&(o.skew+=d.skew*l),d.stroke&&(o.stroke+=d.stroke*l,o.strokeColor=d.strokeColor??o.strokeColor??"#000000"),d.scale!==void 0&&(o.scale*=Math.max(0,1+(d.scale/100-1)*l)),d.opacity!==void 0&&(o.opacity*=M(1+(d.opacity/100-1)*l)),d.fill){const b=M(Math.abs(l));o.fill=o.fill?We(o.fill,d.fill,b):d.fill,o.fillAmount=o.fillAmount+(1-o.fillAmount)*b}}return o.blur=Math.max(0,o.blur),o.stroke=Math.max(0,o.stroke),o})}const Ve=e=>Math.round(e*1e3)/1e3,Ke=e=>Ve(Math.max(.3,Math.min(1.6,(e||2)*.5))),w=(e,n,i,t)=>[{time:0,value:e,...t?{ease:t}:{}},{time:i,value:n}],C={"type-on":e=>[{name:"Type on",properties:{opacity:0},selectors:[{basedOn:"chars",shape:"square",smoothness:0,start:0,end:100,keys:{start:w(0,100,e)}}]}],"fade-up-chars":e=>[{name:"Fade up",properties:{opacity:0,y:18},selectors:[{basedOn:"charsNoSpace",shape:"rampUp",start:0,end:25,keys:{offset:w(-25,100,e,"easeOut")}}]}],"cascade-bottom":e=>[{name:"Cascade",properties:{y:160,opacity:0,rotate:12},selectors:[{basedOn:"charsNoSpace",shape:"rampUp",start:0,end:35,easeHigh:60,keys:{offset:w(-35,100,e,"easeOut")}}]}],"scale-pop-words":e=>[{name:"Pop in",properties:{scale:0,opacity:0},selectors:[{basedOn:"words",shape:"rampUp",start:0,end:20,keys:{offset:w(-20,100,e)}}]},{name:"Overshoot",properties:{scale:135},selectors:[{basedOn:"words",shape:"triangle",start:0,end:30,keys:{offset:w(-45,100,e)}}]}],"blur-in":e=>[{name:"Blur in",properties:{blur:22,opacity:0,scale:125},selectors:[{basedOn:"charsNoSpace",shape:"rampUp",start:0,end:40,keys:{offset:w(-40,100,e,"easeOut")}}]}],"tracking-in":e=>[{name:"Tracking in",properties:{tracking:48,opacity:0},selectors:[{basedOn:"chars",shape:"square",start:0,end:100,keys:{amount:w(100,0,e,"easeOut")}}]}],"random-fade":e=>[{name:"Random fade",properties:{opacity:0},selectors:[{basedOn:"charsNoSpace",shape:"square",random:!0,seed:7,start:0,end:100,keys:{start:w(0,100,e)}}]}],wave:e=>[{name:"Wave",properties:{y:-28},selectors:[{basedOn:"chars",shape:"smooth",start:0,end:34,loop:!0,keys:{offset:w(-34,100,Math.max(1.2,Math.min(2.4,e*2)))}}]}]},Qe=Object.freeze(Object.keys(C));function gn(e,n=2){return Object.hasOwn(C,e)||a("preset",Qe.join("/")),Ze(C[e](Ke(n)),`preset.${e}`)}export{he as A,U as B,tn as C,$e as H,Q as M,$ as P,rn as R,W as S,oe as T,Ae as a,Qe as b,V as c,m as d,g as e,a as f,ae as g,en as h,ne as i,an as j,E as k,fn as l,ue as m,c as n,sn as o,gn as p,de as q,Re as r,D as s,Ze as t,ve as u,nn as v,dn as w,ln as x,on as y,cn as z};
|
|
1
|
+
import{mI as se}from"./titleFrameBudget-Cml-MO53.js";const oe=[{family:"Inter",category:"Sans serif"},{family:"Be Vietnam Pro",category:"Sans serif"},{family:"Roboto",category:"Sans serif"},{family:"Open Sans",category:"Sans serif"},{family:"Montserrat",category:"Sans serif"},{family:"Manrope",category:"Sans serif"},{family:"Lexend",category:"Sans serif"},{family:"Archivo",category:"Sans serif"},{family:"Barlow",category:"Sans serif"},{family:"Noto Sans",category:"Sans serif"},{family:"Noto Serif",category:"Serif"},{family:"Playfair Display",category:"Serif"},{family:"Oswald",category:"Display"},{family:"Anton",category:"Display"},{family:"Bungee",category:"Display"},{family:"Dancing Script",category:"Handwriting"},{family:"Arial",category:"System"},{family:"Georgia",category:"System"},{family:"Courier New",category:"System"}],ce=oe.map(e=>e.family),ae=e=>ce.includes(e),fe=/^u:[A-Za-z0-9_-]{8,40}$/,ne=e=>typeof e=="string"&&fe.test(e),de=e=>ae(e)||ne(e);function ve(e){const n=new Set,i=new WeakSet,t=r=>{if(typeof r=="string"){ne(r)&&n.add(r);return}if(!(!r||typeof r!="object"||i.has(r))){i.add(r);for(const s of Array.isArray(r)?r:Object.values(r))t(s)}};return t(e),[...n]}const T=["linear","easeOutCubic","easeOutQuart","easeOutExpo","easeInOutCubic","easeOutBack","easeOutElastic","easeOutBounce"],R=["line","word","char"],Z=6,Y=["forward","reverse","center","random"],A={opacity:1,x:0,y:0,scale:1,scaleX:1,scaleY:1,reveal:1,wipeX:1,wipeY:1,brightness:1,blur:0,rotate:0,spread:0,glitch:0,flicker:0,count:1},le=["x","y","rotate","blur","spread","glitch","flicker"],F={opacity:[0,1],x:[-4,4],y:[-4,4],scale:[0,4],scaleX:[0,4],scaleY:[0,4],reveal:[0,1],wipeX:[0,1],wipeY:[0,1],brightness:[0,1],blur:[0,1],rotate:[-180,180],spread:[-.2,1.5],glitch:[0,1],flicker:[0,1],count:[0,20]},te={linear:e=>e,easeOutCubic:e=>1-(1-e)**3,easeOutQuart:e=>1-(1-e)**4,easeOutExpo:e=>e>=1?1:1-2**(-10*e),easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeOutBack:e=>1+2.70158*(e-1)**3+1.70158*(e-1)**2,easeOutElastic:e=>e<=0?0:e>=1?1:2**(-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375};function ge(e,n){m(e,n),g(e,["lines","unit","start","duration","stagger","order","easing","from","mask","at"],n),e.mask!==void 0&&typeof e.mask!="boolean"&&a(n+".mask","true/false"),R.includes(e.unit??"line")||a(n+".unit",R.join("/")),e.order!==void 0&&!Y.includes(e.order)&&a(n+".order",Y.join("/")),e.easing!==void 0&&!T.includes(e.easing)&&a(n+".easing",T.join("/"));let i=null;e.lines!==void 0&&e.lines!==null&&((!Array.isArray(e.lines)||!e.lines.length||e.lines.length>8||e.lines.some(o=>!Number.isInteger(o)||o<0||o>7))&&a(n+".lines","mảng chỉ số dòng 0–7"),i=[...new Set(e.lines)]);let t=null;e.at!==void 0&&((!Array.isArray(e.at)||!e.at.length||e.at.length>60)&&a(n+".at","cần 1–60 mốc giây"),t=e.at.map((o,f)=>c(o,0,10,`${n}.at[${f}]`)));const r=m(e.from??{},n+".from");g(r,Object.keys(A),n+".from"),Object.keys(r).length||a(n+".from","cần ít nhất 1 thuộc tính");const s={};for(const[o,f]of Object.entries(r))s[o]=c(f,F[o][0],F[o][1],`${n}.from.${o}`);return{lines:i,unit:e.unit??"line",start:c(e.start,0,10,n+".start",0),duration:c(e.duration,.02,5,n+".duration",.4),stagger:c(e.stagger,0,2,n+".stagger",0),order:e.order??"forward",easing:e.easing??"easeOutCubic",from:s,mask:e.mask===!0,...t?{at:t}:{}}}function en(e,n="animation"){return m(e,n),g(e,["version","in","out","outSpeed"],n),e.version!==void 0&&e.version!==1&&a(n+".version","chỉ hỗ trợ version 1"),(!Array.isArray(e.in)||!e.in.length||e.in.length>Z)&&a(n+".in",`cần 1–${Z} track`),e.out!==void 0&&!["reverse","none"].includes(e.out)&&a(n+".out","reverse hoặc none"),{version:1,in:e.in.map((i,t)=>ge(i,`${n}.in[${t}]`)),out:e.out??"reverse",outSpeed:c(e.outSpeed,.25,4,n+".outSpeed",1.5)}}function me(e,n){const i=[...Array(e).keys()];let t=n||1;for(let r=e-1;r>0;r--){t=t*16807%2147483647;const s=t%(r+1);[i[r],i[s]]=[i[s],i[r]]}return i}function _(e,n,i){return i==="reverse"?n-1-e:i==="center"?Math.abs(e-(n-1)/2)*2|0:i==="random"?me(n,n*7919).indexOf(e):e}function ue(e,n){let i=0;for(const t of e.in)for(const[r,s]of n.entries()){if(t.lines&&!t.lines.includes(r))continue;const o=t.unit==="line"?1:s[t.unit];for(let f=0;f<o;f++)i=Math.max(i,re(t,f,o)+t.duration)}return i}function re(e,n,i){if(e.at){const t=_(n,i,e.order),r=Math.min(t,e.at.length-1);return e.at[r]+e.stagger*(t-r)}return e.start+e.stagger*_(n,i,e.order)}function ye(e,n,i,t){const r=re(e,n,i);return te[e.easing](Math.min(1,Math.max(0,(t-r)/e.duration)))}function nn(e,n,i,t,r=0){const s=Math.max(r,ue(e,n)),o=s/e.outSpeed;return e.out==="reverse"&&Number.isFinite(t)&&i>Math.max(s,t-o)?(t-i)*e.outSpeed:i}function tn(e,n,i,t,r,s){const o={...A,masked:!1};for(const f of e.in){if(f.unit!==n||f.lines&&!f.lines.includes(i))continue;const l=ye(f,t,r,s);f.mask&&l<1&&(o.masked=!0);for(const[d,b]of Object.entries(f.from)){const k=b+(A[d]-b)*l;le.includes(d)?o[d]+=k:o[d]*=k}}return o}const rn=Object.freeze({...A});function H(e,n){m(e,n),g(e,["start","duration","easing","from","spin","origin","stagger"],n),e.easing!==void 0&&!T.includes(e.easing)&&a(n+".easing",T.join("/")),e.origin!==void 0&&!["center","left","right","top","bottom"].includes(e.origin)&&a(n+".origin","center/left/right/top/bottom");const i=m(e.from??{},n+".from");g(i,["opacity","x","y","scale","scaleX","scaleY","rotate","wipeX","wipeY"],n+".from");const t={};for(const[r,s]of Object.entries(i))t[r]=c(s,F[r][0],F[r][1],`${n}.from.${r}`);return{start:c(e.start,0,10,n+".start",0),duration:c(e.duration,.02,5,n+".duration",.6),easing:e.easing??"easeOutCubic",from:t,spin:c(e.spin,-720,720,n+".spin",0),origin:e.origin??"center",...e.stagger?{stagger:c(e.stagger,0,2,n+".stagger")}:{}}}function sn(e,n=1){let i=0;for(const t of e?.layers||[])t.motion&&(i=Math.max(i,t.motion.start+t.motion.duration+(t.motion.stagger||0)*Math.max(0,n-1)));return i}function on(e,n){const i={...A};if(!e)return i;const t=te[e.easing](Math.min(1,Math.max(0,(n-e.start)/e.duration)));for(const[r,s]of Object.entries(e.from))i[r]=s+(A[r]-s)*t;return i.rotate+=e.spin*Math.max(0,n-e.start),i}function cn(e,n){return n===1?e:e.replace(/\d[\d.,]*\d|\d/,i=>{const t=/^\d{1,3}([.,]\d{3})+$/.test(i)?i.match(/[.,]/)[0]:"";if(!t&&/[.,]/.test(i)){const s=i.split(/[.,]/)[1].length;return Math.max(0,Number(i.replace(",","."))*n).toFixed(s).replace(".",i.includes(",")?",":".")}const r=String(Math.max(0,Math.round(Number(i.replace(/[.,]/g,""))*n)));return t?r.replace(/\B(?=(\d{3})+(?!\d))/g,t):r})}const he=Object.freeze({sparkle:["m12 2 2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4L12 2Z","m19 17 1 3 3 1-3 1-1 3-1-3-3-1 3-1 1-3Z"],pen:["M5 16 16 5l3 3L8 19H5v-3Z","m14 7 3 3M4 20h16"],target:["M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0Z","M9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0Z","M12 1v4m0 14v4M1 12h4m14 0h4"],play:["M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2Z","m10 9 5 3-5 3V9Z"],bolt:["m13 2-8 11h6l-1 9 9-12h-6l0-8Z"],navigate:["M4 17 10 3l3 9 7-3-6 12-3-7-7 3Z"],chip:["M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2Z","M9 9h6v6h-6Z","M8 1v3m8-3v3M8 20v3m8-3v3M1 8h3m-3 8h3m16-8h3m-3 8h3"],data:["M4 6h16M4 12h10M4 18h16","m17 10 4 2-4 2"],building:["M3 21V8l9-5 9 5v13H3Z","M9 21v-7h6v7M8 9h1m6 0h1"],signal:["M4 16a8 8 0 0 1 16 0M7 16a5 5 0 0 1 10 0M10 16a2 2 0 0 1 4 0M12 20h.01"],office:["M3 21V4h11v17M14 9h7v12H3M7 8h3m-3 4h3m-3 4h3m10-3h-2m2 4h-2"],cloud:["M4 15a4 4 0 0 1 1-8 7 7 0 0 1 13 1 4 4 0 0 1 1 8H4Z","m9 19 3 3 3-3M12 13v9"],skyline:["M3 21V9l5-3v15M8 21V4l6-2v19m0-11 7-3v14M3 21h18"],network:["M2 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z","M18 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z","M18 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0Z","m6 11 12-4M6 13l12 4"],video:["M5 5h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2Z","m10 9 5 3-5 3V9Z","M7 22h10"],home:["m3 11 9-8 9 8v10H3V11Z","M9 21v-7h6v7M8 10h.01m8 0h.01"],compass:["M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0Z","m12 4 3 8-3 8-3-8 3-8ZM4 12h16"],grid:["M3 3h18v18H3V3ZM3 9h18M9 3v18M15 9v12"],chart:["M3 20h18M5 17l5-6 4 3 5-8","m16 6 3 0 0 3"],pin:["M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z","M9.5 10a2.5 2.5 0 1 0 5.0 0a2.5 2.5 0 1 0 -5.0 0Z"]}),we=Object.keys(he),be=/^#[0-9a-f]{6}$/i,ke=e=>[1,3,5].map(n=>parseInt(e.slice(n,n+2),16)/255),pe=e=>"#"+e.map(n=>Math.round(Math.max(0,Math.min(1,n))*255).toString(16).padStart(2,"0")).join("");function Me(e){const[n,i,t]=ke(e),r=Math.max(n,i,t),s=Math.min(n,i,t),o=(r+s)/2,f=r-s;if(!f)return[0,0,o];const l=f/(1-Math.abs(2*o-1));return[(r===n?((i-t)/f+6)%6:r===i?(t-n)/f+2:(n-i)/f+4)*60,l,o]}function P(e,n,i){const t=(1-Math.abs(2*i-1))*n,r=t*(1-Math.abs(e/60%2-1)),s=i-t/2,[o,f,l]=e<60?[t,r,0]:e<120?[r,t,0]:e<180?[0,t,r]:e<240?[0,r,t]:e<300?[r,0,t]:[t,0,r];return pe([o+s,f+s,l+s])}const p={yellow:55,cyan:185,magenta:315};function xe(e,n){if(n==="yellow")return p.yellow;if(n==="cyan")return p.cyan;if(n==="pink")return p.magenta;const i=(t,r)=>Math.abs((t-r+540)%360-180);for(const t of Object.values(p))if(i(e,t)<=15)return t;return e>=345||e<135?p.yellow:e<255?p.cyan:p.magenta}function Ae(e,{white:n=!1,toward:i="auto"}={}){if(!be.test(e))throw new Error("màu gốc phải là #rrggbb");const[t,r,s]=Me(e);if(r<.15)return s<.35?{type:"radial",gradient:["#5c5c5c","#0d0d0d"]}:{type:"radial",gradient:["#ffffff",n?"#d6d6d6":"#8a8a8a"],stops:[.25,1]};const o=P(t,Math.max(.75,r),Math.min(.5,Math.max(.32,s))),f=P(xe(t,i),1,.58);return n?{gradient:["#ffffff",f,o],stops:[0,.38,1],angle:90}:{gradient:[f,o],angle:90}}const Se=/^auto(\+white)?(?:-(yellow|cyan|pink))?:(#[0-9a-f]{6})$/i;function Oe(e){const n=typeof e=="string"?Se.exec(e):null;return n?Ae(n[3].toLowerCase(),{white:!!n[1],toward:(n[2]||"auto").toLowerCase()}):null}const G=8,I=["condensed","semi-condensed","normal","semi-expanded","expanded"],z=["halftone","lines","grain"],B=["atop","cut","keep"],$e=/^#[0-9a-f]{6}$/i,a=(e,n)=>{throw new Error(`${e}: ${n}`)},m=(e,n)=>((!e||typeof e!="object"||Array.isArray(e))&&a(n,"phải là object"),e),c=(e,n,i,t,r)=>e===void 0?r:((typeof e!="number"||!Number.isFinite(e)||e<n||e>i)&&a(t,`phải là số từ ${n} đến ${i}`),e),D=(e,n,i,{required:t=!1,fallback:r=""}={})=>e===void 0&&!t?r:((typeof e!="string"||t&&!e.trim()||e.length>n)&&a(i,`cần chuỗi tối đa ${n} ký tự`),e.trim()),Ee=["{color}","{accent}","{accent-hi}","{accent-lo}","{accent-bright}","{accent-deep}","{color-lo}","transparent"],u=(e,n)=>{if(Ee.includes(e)||typeof e=="string"&&$e.test(e))return e;a(n,"màu phải là #rrggbb, {color}, {accent}, {accent-hi}, {accent-lo}, {accent-bright}, {accent-deep}, {color-lo} hoặc transparent")},g=(e,n,i)=>{for(const t of Object.keys(e))n.includes(t)||a(i,`trường lạ "${t}"`)};function je(e,n){(!Array.isArray(e)||e.length!==4)&&a(n,"[x, y, w, h] theo tỉ lệ khung");const[i,t,r,s]=e.map((o,f)=>c(o,f<2?-.5:0,f<2?1.5:2,`${n}[${f}]`));return[i,t,r,s]}function x(e,n){if(typeof e=="string")return Oe(e)??u(e,n);m(e,n),g(e,["gradient","angle","type","stops"],n),(!Array.isArray(e.gradient)||e.gradient.length<2||e.gradient.length>4)&&a(n+".gradient","cần 2–4 màu"),e.type!==void 0&&!["linear","radial"].includes(e.type)&&a(n+".type","linear hoặc radial");const i={gradient:e.gradient.map((t,r)=>u(t,`${n}.gradient[${r}]`))};return e.type==="radial"?i.type="radial":i.angle=c(e.angle,0,360,n+".angle",90),e.stops!==void 0&&((!Array.isArray(e.stops)||e.stops.length!==i.gradient.length)&&a(n+".stops","mỗi màu một vị trí 0–1"),i.stops=e.stops.map((t,r)=>c(t,0,1,`${n}.stops[${r}]`)),i.stops.some((t,r)=>r&&t<i.stops[r-1])&&a(n+".stops","vị trí phải tăng dần")),i}function Te(e,n){if(e!==void 0)return(!Array.isArray(e)||!e.length||e.length>8||e.some(i=>!Number.isInteger(i)||i<0||i>7))&&a(n,"mảng chỉ số dòng 0–7"),[...new Set(e)]}function q(e,n){const i=m(e,n);return g(i,["color","blur","x","y"],n),{color:u(i.color??"#000000",n+".color"),blur:c(i.blur,0,1,n+".blur",.15),x:c(i.x,-.5,.5,n+".x",0),y:c(i.y,-.5,.5,n+".y",0)}}function X(e,n){const i=Te(e.lines,n+".lines");return{...i?{lines:i}:{},...e.motion!==void 0?{motion:H(e.motion,n+".motion")}:{}}}function Fe(e,n){m(e,n);const i={opacity:c(e.opacity,0,1,n+".opacity",1)};switch(e.type){case"box":{g(e,["type","fill","radius","padX","padY","opacity","per","stroke","shadow","skewX","lines","motion"],n),e.per!==void 0&&!["line","block"].includes(e.per)&&a(n+".per","line hoặc block");const t={type:"box",fill:x(e.fill??"{accent}",n+".fill"),radius:c(e.radius,0,1,n+".radius",.15),padX:c(e.padX,0,1.5,n+".padX",.3),padY:c(e.padY,0,1,n+".padY",.12),per:e.per||"line",...i};if(e.stroke!==void 0){const r=m(e.stroke,n+".stroke");g(r,["color","width"],n+".stroke"),t.stroke={color:u(r.color??"{accent}",n+".stroke.color"),width:c(r.width,.01,.3,n+".stroke.width",.05)}}return e.shadow!==void 0&&(t.shadow=q(e.shadow,n+".shadow")),e.skewX!==void 0&&(t.skewX=c(e.skewX,-30,30,n+".skewX")),{...t,...X(e,n)}}case"text":{g(e,["type","fill","lineFills","stroke","shadow","offset","opacity","shine","flicker","lines","motion","reflection","innerGlow","highlights"],n);const t={type:"text",fill:x(e.fill??"{color}",n+".fill"),...i,...X(e,n)};if(e.shine!==void 0){const r=m(e.shine,n+".shine");g(r,["color","width","angle","start","duration","every"],n+".shine"),t.shine={color:u(r.color??"#ffffff",n+".shine.color"),width:c(r.width,.1,4,n+".shine.width",.8),angle:c(r.angle,-60,60,n+".shine.angle",20),start:c(r.start,0,10,n+".shine.start",.6),duration:c(r.duration,.1,5,n+".shine.duration",.8),every:c(r.every,0,10,n+".shine.every",0)}}if(e.flicker!==void 0&&(t.flicker=c(e.flicker,0,1,n+".flicker")),e.lineFills!==void 0&&((!Array.isArray(e.lineFills)||!e.lineFills.length||e.lineFills.length>4)&&a(n+".lineFills","cần 1–4 màu"),t.lineFills=e.lineFills.map((r,s)=>u(r,`${n}.lineFills[${s}]`))),e.stroke!==void 0){const r=m(e.stroke,n+".stroke");g(r,["color","width"],n+".stroke"),t.stroke={color:u(r.color??"{accent}",n+".stroke.color"),width:c(r.width,.01,.3,n+".stroke.width",.08)}}if(e.shadow!==void 0&&(t.shadow=q(e.shadow,n+".shadow")),e.offset!==void 0){const r=m(e.offset,n+".offset");g(r,["x","y"],n+".offset"),t.offset={x:c(r.x,-.5,.5,n+".offset.x",0),y:c(r.y,-.5,.5,n+".offset.y",0)}}if(e.reflection!==void 0){const r=m(e.reflection,n+".reflection");g(r,["opacity","gap","fade"],n+".reflection"),t.reflection={opacity:c(r.opacity,.05,1,n+".reflection.opacity",.35),gap:c(r.gap,-.3,.6,n+".reflection.gap",.04),fade:c(r.fade,.15,1,n+".reflection.fade",.7)}}if(e.innerGlow!==void 0){const r=m(e.innerGlow,n+".innerGlow");g(r,["color","blur"],n+".innerGlow"),t.innerGlow={color:u(r.color??"#ffffff",n+".innerGlow.color"),blur:c(r.blur,.02,.5,n+".innerGlow.blur",.12)}}return e.highlights!==void 0&&((!Array.isArray(e.highlights)||!e.highlights.length||e.highlights.length>4)&&a(n+".highlights","cần 1–4 nhóm từ"),t.highlights=e.highlights.map((r,s)=>{const o=`${n}.highlights[${s}]`;return m(r,o),g(r,["words","fill"],o),(!Array.isArray(r.words)||!r.words.length||r.words.length>40||r.words.some(f=>!Number.isInteger(f)||f<0||f>199))&&a(o+".words","số thứ tự từ 0–199"),{words:[...new Set(r.words)],fill:x(r.fill??"{accent}",o+".fill")}})),t}case"underline":return g(e,["type","fill","height","width","offsetY","opacity","line","style","lines","motion"],n),e.line!==void 0&&!["last","all"].includes(e.line)&&a(n+".line","last hoặc all"),e.style!==void 0&&!["bar","swash"].includes(e.style)&&a(n+".style","bar hoặc swash"),{type:"underline",fill:x(e.fill??"{accent}",n+".fill"),height:c(e.height,.02,.4,n+".height",.07),width:c(e.width,.1,1.4,n+".width",1),offsetY:c(e.offsetY,-1.2,1.2,n+".offsetY",.55),line:e.line||"last",...e.style==="swash"?{style:"swash"}:{},...i,...X(e,n)};case"shape":{g(e,["type","shape","box","fill","stroke","radius","skewX","rotate","blur","opacity","motion"],n),["rect","ellipse","glow"].includes(e.shape)||a(n+".shape","rect/ellipse/glow");const t={type:"shape",shape:e.shape,box:je(e.box,n+".box"),radius:c(e.radius,0,.5,n+".radius",0),skewX:c(e.skewX,-45,45,n+".skewX",0),rotate:c(e.rotate,-180,180,n+".rotate",0),blur:c(e.blur,0,.2,n+".blur",0),...i};if(e.fill!==void 0&&(t.fill=x(e.fill,n+".fill")),e.stroke!==void 0){const r=m(e.stroke,n+".stroke");g(r,["color","width","dash"],n+".stroke"),t.stroke={color:u(r.color??"{accent}",n+".stroke.color"),width:c(r.width,.5,12,n+".stroke.width",1.5)},r.dash!==void 0&&((!Array.isArray(r.dash)||r.dash.length!==2)&&a(n+".stroke.dash","[nét, khoảng]"),t.stroke.dash=r.dash.map((s,o)=>c(s,1,60,`${n}.stroke.dash[${o}]`)))}return!t.fill&&!t.stroke&&a(n,"shape cần fill hoặc stroke"),e.motion!==void 0&&(t.motion=H(e.motion,n+".motion")),t}case"icon":{g(e,["type","name","center","size","color","width","badge","badgeFill","badgeStroke","glow","rotate","opacity","motion"],n),we.includes(e.name)||a(n+".name","icon không có trong bộ dựng sẵn"),(!Array.isArray(e.center)||e.center.length!==2)&&a(n+".center","[x, y]"),e.badge!==void 0&&!["none","circle","square","rounded","diamond"].includes(e.badge)&&a(n+".badge","none/circle/square/rounded/diamond");const t={type:"icon",name:e.name,center:e.center.map((r,s)=>c(r,-.2,1.2,`${n}.center[${s}]`)),size:c(e.size,.02,.4,n+".size",.12),color:u(e.color??"{accent}",n+".color"),width:c(e.width,.5,4,n+".width",2),badge:e.badge??"none",rotate:c(e.rotate,-180,180,n+".rotate",0),glow:c(e.glow,0,1,n+".glow",0),...i};return e.badgeFill!==void 0&&(t.badgeFill=u(e.badgeFill,n+".badgeFill")),e.badgeStroke!==void 0&&(t.badgeStroke=u(e.badgeStroke,n+".badgeStroke")),e.motion!==void 0&&(t.motion=H(e.motion,n+".motion")),t}case"texture":return g(e,["type","pattern","mode","color","scale","size","angle","fade","fadeAngle","opacity"],n),z.includes(e.pattern)||a(n+".pattern",z.join("/")),e.mode!==void 0&&!B.includes(e.mode)&&a(n+".mode",B.join("/")),{type:"texture",pattern:e.pattern,mode:e.mode??"atop",color:u(e.color??"#000000",n+".color"),scale:c(e.scale,2,60,n+".scale",8),size:c(e.size,.05,1,n+".size",.5),angle:c(e.angle,-90,90,n+".angle",45),fade:c(e.fade,0,1,n+".fade",0),fadeAngle:c(e.fadeAngle,-180,180,n+".fadeAngle",90),...i};default:a(n+".type","chỉ hỗ trợ box, text, underline, shape, icon, texture")}}const ie=[400,500,600,700,800,900],Ie=["left","center","right"];function Ne(e,n){return m(e,n),g(e,["scale","fill","font","italic","weight","tracking","stretch","x","y","rotate","align","side","label","labelEn"],n),e.align!==void 0&&!Ie.includes(e.align)&&a(n+".align","left/center/right"),e.side!==void 0&&!["left","right"].includes(e.side)&&a(n+".side","left/right"),e.font!==void 0&&!de(e.font)&&a(n+".font","font không có trong danh sách Timeline hay font của bạn"),e.italic!==void 0&&typeof e.italic!="boolean"&&a(n+".italic","true/false"),e.weight!==void 0&&!ie.includes(e.weight)&&a(n+".weight","400–900"),e.stretch!==void 0&&!I.includes(e.stretch)&&a(n+".stretch",I.join("/")),{scale:c(e.scale,.2,3,n+".scale",1),...e.fill!==void 0?{fill:x(e.fill,n+".fill")}:{},...e.font!==void 0?{font:e.font}:{},...e.italic?{italic:!0}:{},...e.weight!==void 0?{weight:e.weight}:{},...e.tracking!==void 0?{tracking:c(e.tracking,-.15,.6,n+".tracking")}:{},...e.stretch!==void 0?{stretch:e.stretch}:{},...e.x!==void 0?{x:c(e.x,-4,4,n+".x")}:{},...e.y!==void 0?{y:c(e.y,-4,4,n+".y")}:{},...e.rotate!==void 0?{rotate:c(e.rotate,-30,30,n+".rotate")}:{},...e.align!==void 0?{align:e.align}:{},...e.side!==void 0?{side:e.side}:{},...e.label!==void 0?{label:D(e.label,24,n+".label",{required:!0})}:{},...e.labelEn!==void 0?{labelEn:D(e.labelEn,24,n+".labelEn",{required:!0})}:{}}}function an(e,n="design"){m(e,n),g(e,["weight","lineHeight","uppercase","layers","lines","stack","gap","stretch","tracking","shiftY","shiftX","maxWidth","wrap","linesFrom","path"],n),e.wrap!==void 0&&!["char","word"].includes(e.wrap)&&a(n+".wrap","char hoặc word"),e.linesFrom!==void 0&&!["start","end"].includes(e.linesFrom)&&a(n+".linesFrom","start hoặc end"),e.stack!==void 0&&!["center","ink"].includes(e.stack)&&a(n+".stack","center hoặc ink"),e.stretch!==void 0&&!I.includes(e.stretch)&&a(n+".stretch",I.join("/"));let i;return e.lines!==void 0&&((!Array.isArray(e.lines)||!e.lines.length||e.lines.length>8)&&a(n+".lines","cần 1–8 dòng"),i=e.lines.map((t,r)=>Ne(t,`${n}.lines[${r}]`))),(!Array.isArray(e.layers)||!e.layers.length||e.layers.length>G)&&a(n+".layers",`cần 1–${G} lớp`),e.layers.some(t=>t?.type==="text")||a(n+".layers","cần ít nhất 1 lớp text"),e.weight!==void 0&&!ie.includes(e.weight)&&a(n+".weight","400–900"),e.uppercase!==void 0&&typeof e.uppercase!="boolean"&&a(n+".uppercase","true/false"),{weight:e.weight??700,lineHeight:c(e.lineHeight,1.25,2,n+".lineHeight",1.32),uppercase:e.uppercase??!1,layers:e.layers.map((t,r)=>Fe(t,`${n}.layers[${r}]`)),...i?{lines:i}:{},...e.stack?{stack:e.stack}:{},...e.gap!==void 0?{gap:c(e.gap,0,.5,n+".gap")}:{},...e.stretch?{stretch:e.stretch}:{},...e.tracking!==void 0?{tracking:c(e.tracking,-.15,.6,n+".tracking")}:{},...e.shiftY!==void 0?{shiftY:c(e.shiftY,-.3,.3,n+".shiftY")}:{},...e.shiftX!==void 0?{shiftX:c(e.shiftX,-.3,.3,n+".shiftX")}:{},...e.maxWidth!==void 0?{maxWidth:c(e.maxWidth,.15,.9,n+".maxWidth")}:{},...e.wrap==="word"?{wrap:"word"}:{},...e.linesFrom==="end"?{linesFrom:"end"}:{},...e.path!=null?{path:se(e.path,n+".path")}:{}}}function fn(e,n,i){const t=e?.lines;if(t)return t[e.linesFrom==="end"?t.length-(i-n):n]}const U=["chars","charsNoSpace","words","lines"],W=["square","rampUp","rampDown","triangle","round","smooth"],V=["add","subtract","intersect"],K=["linear","easeIn","easeOut","easeInOut","hold"],Q=8,Xe=["start","end","offset","amount"],He=/^#[0-9a-f]{6}$/i,$={x:[-2e3,2e3],y:[-2e3,2e3],scale:[0,1e3],rotate:[-3600,3600],opacity:[0,100],tracking:[-200,500],fill:null,stroke:[0,50],strokeColor:null,blur:[0,200],skew:[-85,85]},Ce=(e,n,i,t)=>((!Array.isArray(e)||e.length>60)&&a(n,"cần mảng ≤ 60 key"),e.map((s,o)=>(m(s,`${n}[${o}]`),g(s,["time","value","ease"],`${n}[${o}]`),s.ease!==void 0&&!K.includes(s.ease)&&a(`${n}[${o}].ease`,K.join("/")),{time:c(s.time,0,600,`${n}[${o}].time`),value:c(s.value,i,t,`${n}[${o}].value`),...s.ease&&s.ease!=="linear"?{ease:s.ease}:{}})).sort((s,o)=>s.time-o.time));function Le(e,n){m(e,n);const i=e.type??"range";["range","wiggly"].includes(i)||a(n+".type","range/wiggly"),e.basedOn!==void 0&&!U.includes(e.basedOn)&&a(n+".basedOn",U.join("/")),e.mode!==void 0&&!V.includes(e.mode)&&a(n+".mode",V.join("/"));const t={type:i,basedOn:e.basedOn??"chars",mode:e.mode??(i==="wiggly"?"intersect":"add"),seed:c(e.seed,0,1e6,n+".seed",1)};if(Number.isInteger(t.seed)||a(n+".seed","số nguyên"),i==="wiggly")return g(e,["type","basedOn","mode","seed","maxAmount","minAmount","wiggles","correlation"],n),{...t,maxAmount:c(e.maxAmount,-100,100,n+".maxAmount",100),minAmount:c(e.minAmount,-100,100,n+".minAmount",-100),wiggles:c(e.wiggles,0,30,n+".wiggles",2),correlation:c(e.correlation,0,100,n+".correlation",50)};g(e,["type","basedOn","mode","seed","start","end","offset","amount","shape","easeHigh","easeLow","smoothness","random","keys","loop"],n),e.shape!==void 0&&!W.includes(e.shape)&&a(n+".shape",W.join("/")),e.random!==void 0&&typeof e.random!="boolean"&&a(n+".random","true/false"),e.loop!==void 0&&typeof e.loop!="boolean"&&a(n+".loop","true/false");const r={...t,start:c(e.start,0,100,n+".start",0),end:c(e.end,0,100,n+".end",100),offset:c(e.offset,-200,200,n+".offset",0),amount:c(e.amount,-100,100,n+".amount",100),shape:e.shape??"square",easeHigh:c(e.easeHigh,-100,100,n+".easeHigh",0),easeLow:c(e.easeLow,-100,100,n+".easeLow",0),smoothness:c(e.smoothness,0,100,n+".smoothness",100),random:e.random===!0,...e.loop===!0?{loop:!0}:{}};if(e.keys!==void 0&&e.keys!==null){m(e.keys,n+".keys"),g(e.keys,Xe,n+".keys");const s={};for(const[o,f]of Object.entries(e.keys)){const l=o==="offset"?[-200,200]:o==="amount"?[-100,100]:[0,100],d=Ce(f,`${n}.keys.${o}`,l[0],l[1]);d.length&&(s[o]=d)}Object.keys(s).length&&(r.keys=s)}return r}function Re(e,n="animator"){m(e,n),g(e,["name","properties","selectors"],n),e.name!==void 0&&(typeof e.name!="string"||e.name.length>40)&&a(n+".name","chuỗi ≤ 40 ký tự");const i=m(e.properties??{},n+".properties");g(i,Object.keys($),n+".properties");const t={};for(const[s,o]of Object.entries(i))o!=null&&($[s]?t[s]=c(o,$[s][0],$[s][1],`${n}.properties.${s}`):((typeof o!="string"||!He.test(o))&&a(`${n}.properties.${s}`,"#RRGGBB"),t[s]=o.toLowerCase()));Object.keys(t).some(s=>s!=="strokeColor")||a(n+".properties","cần ít nhất 1 thuộc tính");const r=e.selectors??[{}];return(!Array.isArray(r)||!r.length||r.length>4)&&a(n+".selectors","cần 1–4 selector"),{...e.name?{name:e.name}:{},properties:t,selectors:r.map((s,o)=>Le(s,`${n}.selectors[${o}]`))}}function Ze(e,n="animators"){return e==null?[]:((!Array.isArray(e)||e.length>Q)&&a(n,`cần mảng ≤ ${Q} animator`),e.map((i,t)=>Re(i,`${n}[${t}]`)))}const J=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter("vi",{granularity:"grapheme"}):null;function Ye(e){const n=String(e??"").normalize("NFC");if(J)return Array.from(J.segment(n),t=>t.segment);const i=[];for(const t of Array.from(n))i.length&&/\p{M}/u.test(t)?i[i.length-1]+=t:i.push(t);return i}function dn(e){const n=[];let i=0,t=-1,r=-1;return e.forEach((s,o)=>{let f=!1;for(const l of Ye(s)){const d=!/\S/u.test(l);d?f=!1:(t++,f||(r++,f=!0)),n.push({row:o,text:l,space:d,chars:i++,charsNoSpace:Math.max(0,t),words:Math.max(0,r),lines:o})}}),{units:n,counts:{chars:i,charsNoSpace:t+1,words:r+1,lines:e.length}}}const _e={linear:e=>e,easeIn:e=>e*e*e,easeOut:e=>1-(1-e)**3,easeInOut:e=>e<.5?4*e**3:1-(-2*e+2)**3/2};function E(e,n,i,t=!1){if(!e?.length)return i;if(t&&e.length>1){const r=e[0].time,s=e.at(-1).time-r;s>1e-6&&n>r&&(n=r+(n-r)%s)}if(n<=e[0].time)return e[0].value;for(let r=1;r<e.length;r++){const s=e[r-1],o=e[r];if(n<=o.time){if(s.ease==="hold")return s.value;const f=(n-s.time)/Math.max(1e-9,o.time-s.time);return s.value+(o.value-s.value)*_e[s.ease??"linear"](f)}}return e.at(-1).value}const Pe=e=>()=>{e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296},j=new Map;function Ge(e,n){const i=e+":"+n;let t=j.get(i);if(t)return t;const r=Pe(n*7919+17);t=[...Array(e).keys()];for(let s=e-1;s>0;s--){const o=Math.floor(r()*(s+1));[t[s],t[o]]=[t[o],t[s]]}return j.size>200&&j.clear(),j.set(i,t),t}const M=e=>Math.min(1,Math.max(0,e));function ze(e,n,i){const t=n/100,r=i/100;return e=t>=0?e**(1+2*t):1-(1-e)**(1-2*t),r>=0?1-(1-e)**(1+2*r):e**(1-2*r)}function Be(e,n,i,t){if(i<=0)return 0;const r=e.random?Ge(i,e.seed)[n]:n,s=e.keys||{},o=!!e.loop,f=E(s.start,t,e.start,o)/100,l=E(s.end,t,e.end,o)/100,d=E(s.offset,t,e.offset,o)/100,b=E(s.amount,t,e.amount,o)/100,k=Math.min(f,l)+d,L=Math.max(f,l)+d;let h;if(e.shape==="square"){const S=r/i,O=(r+1)/i,y=M((Math.min(O,L)-Math.max(S,k))*i),N=e.smoothness/100;h=N>=1?y:N<=0?y>.5+1e-9?1:y<.5-1e-9?0:.5:M((y-.5)/N+.5)}else{const S=(r+.5)/i,O=L-k,y=O>1e-9?(S-k)/O:S<k?-1:2;e.shape==="rampUp"?h=M(y):e.shape==="rampDown"?h=1-M(y):y<0||y>1?h=0:e.shape==="triangle"?h=1-Math.abs(2*y-1):e.shape==="round"?h=Math.sqrt(Math.max(0,1-(2*y-1)**2)):h=(1-Math.cos(2*Math.PI*y))/2}return(e.easeHigh||e.easeLow)&&(h=ze(M(h),e.easeLow,e.easeHigh)),h*b}const v=(e,n)=>{const i=Math.sin(e*127.1+n*311.7)*43758.5453;return(i-Math.floor(i))*2-1},ee=(e,n)=>{const i=Math.floor(e),t=e-i,r=t*t*(3-2*t);return v(i,n)*(1-r)+v(i+1,n)*r};function De(e,n,i,t){const r=t*e.wiggles,s=e.correlation/100,o=s*ee(r,e.seed)+(1-s)*ee(r+n*3.17,e.seed+1+n*13.7);return(e.minAmount+(o+1)/2*(e.maxAmount-e.minAmount))/100}function qe(e,n,i,t){let r=0;return e.selectors.forEach((s,o)=>{const f=i[s.basedOn],l=n[s.basedOn],d=s.type==="wiggly"?De(s,l,f,t):Be(s,l,f,t);r=o===0?d:s.mode==="intersect"?r*d:s.mode==="subtract"?r-d:r+d}),Math.max(-1,Math.min(1,r))}const Ue=Object.freeze({x:0,y:0,scale:1,rotate:0,opacity:1,tracking:0,blur:0,skew:0,stroke:0,strokeColor:null,fill:null,fillAmount:0}),We=(e,n,i)=>{const t=parseInt(e.slice(1),16),r=parseInt(n.slice(1),16);return"#"+[16,8,0].map(s=>Math.round((t>>s&255)+((r>>s&255)-(t>>s&255))*i).toString(16).padStart(2,"0")).join("")};function ln(e,n,i){const{units:t,counts:r}=n;return t.map(s=>{const o={...Ue};for(const f of e){const l=qe(f,s,r,i);if(Math.abs(l)<1e-6)continue;const d=f.properties;if(d.x&&(o.x+=d.x*l),d.y&&(o.y+=d.y*l),d.rotate&&(o.rotate+=d.rotate*l),d.tracking&&(o.tracking+=d.tracking*l),d.blur&&(o.blur+=d.blur*l),d.skew&&(o.skew+=d.skew*l),d.stroke&&(o.stroke+=d.stroke*l,o.strokeColor=d.strokeColor??o.strokeColor??"#000000"),d.scale!==void 0&&(o.scale*=Math.max(0,1+(d.scale/100-1)*l)),d.opacity!==void 0&&(o.opacity*=M(1+(d.opacity/100-1)*l)),d.fill){const b=M(Math.abs(l));o.fill=o.fill?We(o.fill,d.fill,b):d.fill,o.fillAmount=o.fillAmount+(1-o.fillAmount)*b}}return o.blur=Math.max(0,o.blur),o.stroke=Math.max(0,o.stroke),o})}const Ve=e=>Math.round(e*1e3)/1e3,Ke=e=>Ve(Math.max(.3,Math.min(1.6,(e||2)*.5))),w=(e,n,i,t)=>[{time:0,value:e,...t?{ease:t}:{}},{time:i,value:n}],C={"type-on":e=>[{name:"Type on",properties:{opacity:0},selectors:[{basedOn:"chars",shape:"square",smoothness:0,start:0,end:100,keys:{start:w(0,100,e)}}]}],"fade-up-chars":e=>[{name:"Fade up",properties:{opacity:0,y:18},selectors:[{basedOn:"charsNoSpace",shape:"rampUp",start:0,end:25,keys:{offset:w(-25,100,e,"easeOut")}}]}],"cascade-bottom":e=>[{name:"Cascade",properties:{y:160,opacity:0,rotate:12},selectors:[{basedOn:"charsNoSpace",shape:"rampUp",start:0,end:35,easeHigh:60,keys:{offset:w(-35,100,e,"easeOut")}}]}],"scale-pop-words":e=>[{name:"Pop in",properties:{scale:0,opacity:0},selectors:[{basedOn:"words",shape:"rampUp",start:0,end:20,keys:{offset:w(-20,100,e)}}]},{name:"Overshoot",properties:{scale:135},selectors:[{basedOn:"words",shape:"triangle",start:0,end:30,keys:{offset:w(-45,100,e)}}]}],"blur-in":e=>[{name:"Blur in",properties:{blur:22,opacity:0,scale:125},selectors:[{basedOn:"charsNoSpace",shape:"rampUp",start:0,end:40,keys:{offset:w(-40,100,e,"easeOut")}}]}],"tracking-in":e=>[{name:"Tracking in",properties:{tracking:48,opacity:0},selectors:[{basedOn:"chars",shape:"square",start:0,end:100,keys:{amount:w(100,0,e,"easeOut")}}]}],"random-fade":e=>[{name:"Random fade",properties:{opacity:0},selectors:[{basedOn:"charsNoSpace",shape:"square",random:!0,seed:7,start:0,end:100,keys:{start:w(0,100,e)}}]}],wave:e=>[{name:"Wave",properties:{y:-28},selectors:[{basedOn:"chars",shape:"smooth",start:0,end:34,loop:!0,keys:{offset:w(-34,100,Math.max(1.2,Math.min(2.4,e*2)))}}]}]},Qe=Object.freeze(Object.keys(C));function gn(e,n=2){return Object.hasOwn(C,e)||a("preset",Qe.join("/")),Ze(C[e](Ke(n)),`preset.${e}`)}export{he as A,U as B,tn as C,$e as H,Q as M,$ as P,rn as R,W as S,oe as T,Ae as a,Qe as b,V as c,m as d,g as e,a as f,ae as g,en as h,ne as i,an as j,E as k,fn as l,ue as m,c as n,sn as o,gn as p,de as q,Re as r,D as s,Ze as t,ve as u,nn as v,dn as w,ln as x,on as y,cn as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{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{ig as d,dv as y,em as o0,fb as l0,eo as n0,eH as i0,ih as s0,ii as f0,es as c0,ed as h0,eh as d0}from"./remote-BJdzzFZg.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,d),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,d),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=h=>h*h*(3-2*h);for(let h=0;h<t;h++){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+h*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)*d,h=s===0?0:.18+.2*y(23,s,2);return[Math.cos(i)*h,Math.sin(i)*h*.8+.04,.3+.16*y(23,s,3)]}),r=(n,s)=>{let i=0;for(const[h,u,T]of o){const f=((n-h)**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,h=(n/l-.5)*2,u=V(i*2.2+4,h*2.2+4,11),T=V(i*5+9,h*5+9,17,3),f=r(i+(u-.5)*.35,h+(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,h)**6),P=r(i,h-.07),b=Math.min(1,Math.max(.35,.68+(f-P)*1.6+(.5-h*.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,h=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,h*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,d),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,h=1-Math.abs(r)/Math.max(.02,i),u=Math.max(0,h)**.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,d),e.fill(),e.globalCompositeOperation="destination-out",e.shadowBlur=0,e.beginPath(),e.arc(a*1.36,a*.82,a*.66,0,d),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,d),a.stroke()),a.beginPath(),a.arc(0,0,t,0,d),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,d),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,d),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,d);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 h=(u,T,f)=>{const p=r-u,P=n-T;return p*p/(f*f*.35)+P*P/(f*f*1.6)<1};return h(-.36,.5,.22)||h(.34,.42,.2)||h(i+.08,.9,.12)};for(let r=0;r<l;r++)for(let n=0;n<l;n++){let s=0;for(const[h,u]of[[.25,.25],[.75,.25],[.25,.75],[.75,.75]])o(((n+h)/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,h]of l)e.moveTo(a+(s+r)*a*o+h*a*o,a+(i+n)*a*o),e.arc(a+(s+r)*a*o,a+(i+n)*a*o,h*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,d),e.fill())}function E(e,a,l,t,o=0){e.beginPath();for(let r=0;r<=a;r++){const n=o+r*l*d/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,h,u=1)=>{o.globalAlpha=u,o.lineWidth=h,o.beginPath(),o.arc(0,0,i,0,d),o.stroke(),o.globalAlpha=1},n=(i,h,u,T)=>{for(let f=0;f<u;f++)o.save(),o.rotate(f/u*d),o.translate(0,-(i+h)/2),o.lineWidth=5,O0(o,T,f,h-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*d),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*d-Math.PI/2),o.beginPath(),o.arc(512*.665,0,14,0,d),o.fill(),o.restore();o.beginPath(),o.arc(0,0,22,0,d),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*d),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*d),o.beginPath(),o.arc(512*.56,0,18,0,d),o.stroke(),o.beginPath(),o.arc(512*.56,0,6,0,d),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*d),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,d),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 h=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]=h}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,d),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,d),t.fill(),t.fillStyle="#fff",t.beginPath(),t.arc(0,o/2,o*.13,0,d),t.fill(),t.lineWidth=9,t.beginPath(),t.arc(0,0,o,0,d),t.stroke(),t.lineWidth=4,t.beginPath(),t.arc(0,0,o*1.08,0,d),t.stroke();for(let r=0;r<8;r++){t.save(),t.rotate(r/8*d),t.lineWidth=15;for(let n=0;n<3;n++){const s=-(o*1.3+n*30),i=o*.34,h=r+1>>n&1;t.beginPath(),h?(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,d),t.stroke(),t.lineWidth=12,t.beginPath(),t.arc(0,0,512*.95,0,d),t.stroke();for(let r=0;r<64;r++)t.save(),t.rotate(r/64*d),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 h of[-1,1])t.beginPath(),t.arc(512/2+h*120,150,34,0,d*.8),t.stroke(),t.beginPath(),t.arc(512/2+h*60,118,22,Math.PI,d*.9),t.stroke();t.beginPath(),t.arc(512/2,112,26,0,d),t.fill(),t.lineWidth=4,t.beginPath(),t.arc(512/2,112,44,0,d),t.stroke();const i=[3,7,12,21,30,44,53,61,77,85];for(let h=0;h<3;h++)for(let u=0;u<13;u++){const T=o+92+h*118,f=n+90+u*86,p=i[(h*13+u)%i.length]+u*3+h;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 h=-3;h<=3;h++)t.beginPath(),t.ellipse(512/2+h*52,s+62,30,58,h*.22,Math.PI,d),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,d),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*d),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*d),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*d),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,d),t.stroke(),t.beginPath(),t.arc(0,-512*.62,7,0,d),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*d),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,d),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,d),t.fill(),t.save(),t.beginPath(),t.arc(256,256,o,0,d),t.clip();for(let n=0;n<18;n++){const s=y(17,n,1)*d,i=Math.sqrt(y(17,n,2))*o*.75,h=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,h);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,d):(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[h,u]=o.eyes[1],T=h*1024;t.lineWidth=4,t.strokeStyle="rgba(255,255,255,0.9)";for(const f of[-1,1])t.beginPath(),t.moveTo(r(f*h*.4),n(u+.022)),t.quadraticCurveTo(r(f*h*1.1),n(u+.035),r(f*h*1.8),n(u+.02)),t.stroke();t.beginPath(),t.moveTo(r(-h*.5),n(u-.055)),t.quadraticCurveTo(r(0),n(u-.062),r(h*.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,d),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,d),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,d),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*d/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,d),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,d),t.stroke(),t.lineWidth=2,t.beginPath(),t.arc(r*512,n*512,512*.18,0,d),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*d),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",h=i?D0():$0(e),u=i?a%Q*J:0,T=i?Math.floor(a/Q)*J:0,f=i?J:h.width,p=i?J:h.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(h,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,h=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=>h-(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*h0,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*d0,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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-QBI5GJTZ.js","assets/titleFrameBudget-Cml-MO53.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 Q,CircleGeometry as pe,MeshBasicMaterial as H,CylinderGeometry as Oe,ExtrudeGeometry as Ee,ShapeGeometry as Te,Shape as Fe,Vector3 as l,Euler as Z,Quaternion as A,Matrix4 as $,PerspectiveCamera as me,Raycaster as fe,Vector2 as we,Plane as G,Scene as Le,WebGLRenderer as Ie,HemisphereLight as qe,DirectionalLight as Re,NoToneMapping as De,PCFShadowMap as je,ShadowMaterial as Ve,ACESFilmicToneMapping as Ge,Box3 as P,AnimationMixer as _e,Matrix3 as Be,BufferGeometry as ne,BufferAttribute as X,ShaderMaterial as We,Points as Ue,GridHelper as Ye,LoopRepeat as Xe,Line as Ne,LineBasicMaterial as Qe}from"./three.module-Bx43vjkH.js";import{G as se}from"./GLTFLoader-BHWu1lKg.js";import{az as Ke}from"./api-QBI5GJTZ.js";import{lO as D,_ as Je,ec as N,lP as He,lQ as Ze,f7 as $e,f9 as et,cb as tt,fp as ye,fy as oe,fz as nt,lR as st,lS as ot,lT as it,lU as at,lV as rt,lW as ct,lN as ht}from"./titleFrameBudget-Cml-MO53.js";import{R as ge}from"./RoomEnvironment-Dmv_G5ka.js";const dt=new Map;async function lt(a){try{const e=await(await Je(async()=>{const{signOutput:t}=await import("./api-QBI5GJTZ.js").then(n=>n.c1);return{signOutput:t}},__vite__mapDeps([0,1]))).signOutput({gcsUri:a});return typeof e=="string"&&e?e:null}catch{return null}}function xe(a,e,t){const n=new Fe,s=-a/2,o=-e/2;return t=Math.min(t,a/2,e/2),n.moveTo(s+t,o),n.lineTo(s+a-t,o),n.quadraticCurveTo(s+a,o,s+a,o+t),n.lineTo(s+a,o+e-t),n.quadraticCurveTo(s+a,o+e,s+a-t,o+e),n.lineTo(s+t,o+e),n.quadraticCurveTo(s,o+e,s,o+e-t),n.lineTo(s,o+t),n.quadraticCurveTo(s,o,s+t,o),n}function C(a,e,t){const n=new Te(xe(a,e,t),12),s=n.attributes.uv,o=n.attributes.position;for(let i=0;i<s.count;i++)s.setXY(i,o.getX(i)/a+.5,o.getY(i)/e+.5);return n}function F(a,e,t,n,s=.012){const o=new Ee(xe(a-s*2,e-s*2,Math.max(.001,n-s)),{depth:t-s*2,bevelEnabled:!0,bevelThickness:s,bevelSize:s,bevelSegments:4,curveSegments:14});return o.translate(0,0,-(t-s*2)/2),o}const S=(a,e=.32)=>new B({color:a,metalness:.85,roughness:e}),_=()=>new B({color:"#050506",metalness:.2,roughness:.08}),ie=a=>new B({color:a,metalness:.1,roughness:.75}),W=()=>new H({color:"#ffffff",toneMapped:!1});function ae(a,{w:e,h:t,d:n,r:s,bezel:o,island:i,lenses:r}){const c=new k;c.add(new p(F(e,t,n,s),S(a)));const h=new p(C(e-.012,t-.012,s-.006),_());h.position.z=n/2+.0015,c.add(h);const m=e-o*2,d=t-o*2,f=new p(C(m,d,Math.max(.01,s-o)),W());if(f.position.z=n/2+.003,c.add(f),i){const u=new p(C(m*.3,d*.032,d*.016),new H({color:"#000"}));u.position.set(0,d/2-d*.035,n/2+.004),c.add(u)}if(r){const u=new p(F(e*.42,e*.42,.02,e*.1,.006),_());u.position.set(-e/2+e*.27,t/2-e*.27,-n/2-.008),c.add(u);for(let g=0;g<r;g++){const M=g*2*Math.PI/Math.max(1,r)+.6,x=new p(new Oe(e*.075,e*.08,.018,28),S("#2a2a2c",.2));x.rotation.x=Math.PI/2,x.position.set(u.position.x+Math.cos(M)*e*.09,u.position.y+Math.sin(M)*e*.09,-n/2-.022),c.add(x);const w=new p(new pe(e*.05,24),_());w.rotation.y=Math.PI,w.position.set(x.position.x,x.position.y,-n/2-.0315),c.add(w)}}for(const[u,g]of[[t*.22,t*.08],[t*.09,t*.08]]){const M=new p(new q(.008,g,n*.35),S(a));M.position.set(-e/2-.002,u,0),c.add(M)}const v=new p(new q(.008,t*.12,n*.35),S(a));return v.position.set(e/2+.002,t*.14,0),c.add(v),{object:c,screen:f,screenAspect:m/d}}function ut(a,e){const t=new k,n=1.8,s=1.22,o=.045,i=new p(F(n,s,o,.06),S(a));i.rotation.x=-Math.PI/2,t.add(i);const r=new p(C(n*.86,s*.42,.02),ie("#111214"));r.rotation.x=-Math.PI/2,r.position.set(0,o/2+.001,-s*.15),t.add(r);const c=new q(n*.86/15*.82,.006,s*.42/6*.78),h=ie("#1b1c1f");for(let O=0;O<6;O++)for(let E=0;E<15;E++){const T=new p(c,h);T.position.set(-n*.43+(E+.5)*n*.86/15,o/2+.004,-s*.15-s*.21+(O+.5)*s*.42/6),t.add(T)}const m=new p(C(n*.36,s*.26,.025),S(a,.5));m.rotation.x=-Math.PI/2,m.position.set(0,o/2+.0012,s*.27),t.add(m);const d=new k;d.position.set(0,o/2,-s/2),t.add(d);const f=1.16,v=.022,u=new k;u.position.set(0,f/2,0),d.add(u),u.add(new p(F(n,f,v,.05),S(a)));const g=new p(C(n-.01,f-.01,.045),_());g.position.z=v/2+.0015,u.add(g);const M=n-.09,x=f-.1,w=new p(C(M,x,.012),W());w.position.set(0,.01,v/2+.003),u.add(w);const y=new p(new pe(.07,40),S("#e9e9ea",.15));y.rotation.y=Math.PI,y.position.z=-v/2-.002,u.add(y);const z=Math.max(0,Math.min(1,e));return d.rotation.x=(1-z)*Math.PI/2-z*.26,{object:t,screen:w,screenAspect:M/x}}function pt(a){const e=new k,t=1.8,n=1.04,s=.035;e.add(new p(F(t,n,s,.02,.006),S(a,.45)));const o=t-.04,i=n-.04,r=new p(C(o,i,.006),W());r.position.z=s/2+.002,e.add(r);const c=new p(new q(.12,.32,.04),S(a,.4));c.position.set(0,-n/2-.14,-.05),e.add(c);const h=new p(F(.62,.26,.025,.08,.006),S(a,.4));return h.rotation.x=-Math.PI/2,h.position.set(0,-n/2-.3,-.02),e.add(h),{object:e,screen:r,screenAspect:o/i}}function mt(a){const e=new k,t=1.2,n=1.6,s=.42,o=new B({color:new ue(a).multiplyScalar(.62),metalness:0,roughness:.85}),i=new q(t,n,s);e.add(new p(i,o));const r=new p(new Q(t*.98,n*.98),W());return r.position.z=s/2+.002,e.add(r),{object:e,screen:r,screenAspect:t/n}}function ft(a){const e=a.color??(a.type==="box"?D.white:a.type==="tv"?D.black:a.type==="laptop"?D.silver:D.titanium);switch(a.type){case"phone":return ae(e,{w:.83,h:1.8,d:.075,r:.13,bezel:.032,island:!0,lenses:3});case"tablet":return ae(e,{w:1.35,h:1.8,d:.06,r:.09,bezel:.05,island:!1,lenses:1});case"laptop":return ut(e,a.open??1);case"tv":return pt(e);default:return mt(e)}}const re=new WeakMap;function wt(a){let e=re.get(a);if(!e){const t=new he(a);e=t.fromScene(new ge,0,.1,100,{size:64}).texture,t.dispose(),re.set(a,e)}return e}class yt{constructor(e,t,n){this.mesh=e,this.aspect=t,this.media=n;const s=o=>n.kind==="video"?this.loadVideo(o):this.loadImage(o);this.ready=n?.url?s(n.url).catch(async o=>{const i=n.gcsUri?await lt(n.gcsUri):null;if(!i||i===n.url)throw o;return s(i)}):Promise.resolve(),n?.url||e.material.color.set("#0d0f12")}texture=null;video=null;ready;whenReady(){return this.ready}fit(e,t){const n=this.texture,s=e/t;s>this.aspect?(n.repeat.set(this.aspect/s,1),n.offset.set((1-this.aspect/s)/2,0)):(n.repeat.set(1,s/this.aspect),n.offset.set(0,(1-s/this.aspect)/2))}apply(e,t,n){e.colorSpace=ke,e.anisotropy=4,this.texture=e,this.fit(t,n);const s=this.mesh.material;s.map=e,s.needsUpdate=!0}loadImage(e){return new Promise((t,n)=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>{this.apply(new de(s),s.naturalWidth,s.naturalHeight),this.texture.needsUpdate=!0,t()},s.onerror=()=>n(Error("Không tải được ảnh màn hình thiết bị")),s.src=e})}canvas=null;draw(){const e=this.video,t=this.canvas;!e||!t||e.readyState<2||(t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.texture&&(this.texture.needsUpdate=!0))}loadVideo(e){const t=document.createElement("video");return t.crossOrigin="anonymous",t.muted=!0,t.playsInline=!0,t.preload="auto",this.video=t,new Promise((n,s)=>{t.onloadeddata=()=>{const o=Math.min(1,1280/Math.max(t.videoWidth,t.videoHeight)),i=document.createElement("canvas");i.width=Math.max(2,Math.round(t.videoWidth*o)),i.height=Math.max(2,Math.round(t.videoHeight*o)),this.canvas=i,this.apply(new le(i),t.videoWidth,t.videoHeight),this.draw(),n()},t.onerror=()=>s(Error("Không tải được video màn hình thiết bị")),t.src=e})}async sync(e,t=!1){const n=this.video,s=this.media;if(!n||!s||!this.texture)return;const o=Number.isFinite(n.duration)&&n.duration>0?n.duration:0;let i=(s.inPoint||0)+Math.max(0,e)*(s.speed||1);if(o&&(i=Math.min(i,o-.04)),Math.abs(n.currentTime-i)>(t?.004:.12)){const r=new Promise(c=>{const h=()=>{n.removeEventListener("seeked",h),c()};n.addEventListener("seeked",h),setTimeout(h,t?4e3:600)});if(n.currentTime=i,t)await r;else{r.then(()=>this.draw());return}}this.draw()}dispose(){this.texture?.dispose(),this.video&&(this.video.removeAttribute("src"),this.video.load(),this.video=null)}}const gt=1.8,b=Math.PI/180;function I(a,e,t,n,s){if($e(t)&&a.is3D!==!1){const o=ye(n,s),i=et(t,a.start+Math.max(0,e),n,s),r=c=>new l(i.R[0][c],-i.R[1][c],-i.R[2][c]);return{pos:new l(i.pos[0]/o,-i.pos[1]/o,-i.pos[2]/o),quat:new A().setFromRotationMatrix(new $().makeBasis(r(0),r(1).negate(),r(2).negate())),fov:2*Math.atan(s/2/i.f)/b,on:!0}}return{pos:new l(0,0,5),quat:new A,fov:40,on:!1}}function K(a,e,t,n,s){const o=tt(a,Math.max(0,e),n,s);if(t.on){const r=ye(n,s);return{pos:new l(o.x*n/r,-o.y*s/r,o.depth),zoom:o.zoom}}const i=2*(5-o.depth)*Math.tan(t.fov*b/2);return{pos:new l(o.x*i*(n/s),-o.y*i,o.depth),zoom:o.zoom}}function ve(a){const e=a.modelRotation||{x:0,y:0,z:0};return new l(0,1,0).applyEuler(new Z(e.x*b,e.y*b,e.z*b)).normalize()}function Me(a,e,t,n,s){const o=Math.min(48,Math.max(2,Math.ceil(a.duration/.1)));let i=1/0;for(let r=0;r<=o;r++){const c=a.duration*r/o;i=Math.min(i,K(a,c,I(a,c,t,n,s),n,s).pos.dot(e))}return i}function xt(a,e,t,n,s,o){const i=new me(a.fov,s/o,.01,100);i.position.copy(a.pos),i.quaternion.copy(a.quat),i.updateMatrixWorld(!0),i.updateProjectionMatrix();const r=new fe;return r.setFromCamera(new we(e[0]*2-1,1-e[1]*2),i),r.ray.intersectPlane(new G(t.clone(),-n),new l)}function vt(a,e,t,n,s,o,i){const r=I(a,e,t,n,s),{pos:c,zoom:h}=K(a,e,r,n,s),m={x:N(a,"rx",e),y:N(a,"ry",e),z:N(a,"rz",e)},d=a.modelSpin||{x:0,y:0,z:0},f=(a.inPoint||0)+e,v=new Z((m.x+d.x*f)*b,(m.y+d.y*f)*b,(m.z+d.z*f)*b),u=ve(a),g=gt*h,x=!!a.modelLaunch||!!a.modelLook?i??Me(a,u,t,n,s):null,w=a.modelLaunch,y=w?He(w,e):null;if(w&&y){const E=K(a,w.at,I(a,w.at,t,n,s),n,s).pos,T=E.clone().addScaledVector(u,x-E.dot(u)),ee=xt(I(a,w.at+w.duration,t,n,s),w.to,u,x,n,s)??T.clone(),ze=T.clone().lerp(ee,y.g),L=ee.clone().sub(T);L.addScaledVector(u,-L.dot(u));const Ae=Ze(y,L.length()/g);let R;if(w.face!==!1&&L.lengthSq()>1e-8){const Y=L.normalize(),te=new l().crossVectors(u,Y).normalize(),Ce=new l().crossVectors(Y,te);R=new A().setFromRotationMatrix(new $().makeBasis(te,Ce,Y))}else R=new A().setFromEuler(v);R.multiply(new A().setFromAxisAngle(new l(1,0,0),-Ae*b)).multiply(new A().setFromAxisAngle(new l(0,0,1),y.roll*b));const U=y.jolt*.035*g,Pe=new l(Math.sin(e*91)*U,Math.sin(e*67+1)*U*.6,Math.sin(e*53+2)*U);return{cam:r,pos:ze.addScaledVector(u,o*h+y.h*g).add(Pe),quat:R,zoom:h,N:u,d:x,len:g}}const z=new A().setFromEuler(v),O=c.clone();return a.modelGround&&O.add(new l(0,1,0).applyQuaternion(z).multiplyScalar(o*h)),{cam:r,pos:O,quat:z,zoom:h,N:u,d:x,len:g}}function Mt(a,e,t){const n=new l(1,0,0).applyQuaternion(t.quat),o=e.clone().cross(n).normalize().clone().negate(),i=new l().crossVectors(e,o).normalize(),r=a.azimuth*b,c=a.elevation*b;return o.multiplyScalar(Math.cos(c)*Math.cos(r)).addScaledVector(i,Math.cos(c)*Math.sin(r)).addScaledVector(e,Math.sin(c)).normalize()}const be=new Map,J=new Set,bt=a=>a?be.get(a):void 0;function St(a){return J.add(a),()=>{J.delete(a)}}const ce=(a,e)=>a.name||`Animation ${e+1}`,Se=new Map,zt=a=>a?Se.get(a):void 0,j=600,At="attribute float aAlpha;attribute float aSize;varying float vA;uniform float uScale;void main(){vA=aAlpha;vec4 mv=modelViewMatrix*vec4(position,1.);gl_PointSize=aSize*uScale/max(.05,-mv.z);gl_Position=projectionMatrix*mv;}",Pt="uniform vec3 uColor;varying float vA;void main(){vec2 d=gl_PointCoord-.5;float r=length(d);if(r>.5)discard;gl_FragColor=vec4(uColor,vA*smoothstep(.5,.05,r));}";let V=null;function Ct(){if(V)return V;const a=document.createElement("canvas");a.width=a.height=128;const e=a.getContext("2d"),t=e.createRadialGradient(64,64,0,64,64,64);return t.addColorStop(0,"rgba(0,0,0,1)"),t.addColorStop(.35,"rgba(0,0,0,.75)"),t.addColorStop(.7,"rgba(0,0,0,.22)"),t.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=t,e.fillRect(0,0,128,128),V=new le(a),V}class kt{canvas;renderer;scene=new Le;camera=new me(40,1,.01,100);halfY=0;group=new k;disposed=!1;mixer=null;clips=[];action=null;rest=[];width;height;screen=null;pieces=[];dust=null;cut=[new G,new G];guides=null;buildOn=!1;constructor(e,t){this.width=e,this.height=t,this.renderer=new Ie({alpha:!0,antialias:!0,preserveDrawingBuffer:!0}),this.renderer.setPixelRatio(1),this.renderer.setSize(e,t,!1),this.renderer.setClearColor(0,0),this.canvas=this.renderer.domElement,this.camera.aspect=e/t,this.camera.position.set(0,0,5),this.camera.lookAt(0,0,0),this.camera.updateProjectionMatrix(),this.scene.add(this.group,this.hemi,this.key,this.key.target),this.key.position.set(3,5,5)}hemi=new qe(16777215,7829367,3);key=new Re(16777215,3);catcher=null;contact=null;lookEnv=null;lookOn=!1;groundCache=null;applyLook(e){const t=this.renderer;if(!e){if(!this.lookOn)return;this.lookOn=!1,t.shadowMap.enabled=!1,t.toneMapping=De,t.toneMappingExposure=1,this.hemi.color.set(16777215),this.hemi.groundColor.set(7829367),this.hemi.intensity=3,this.key.color.set(16777215),this.key.intensity=3,this.key.castShadow=!1,this.key.position.set(3,5,5),this.key.target.position.set(0,0,0),this.scene.environment===this.lookEnv&&(this.scene.environment=null),this.catcher&&(this.catcher.visible=!1),this.contact&&(this.contact.visible=!1);return}if(!this.lookOn&&(this.lookOn=!0,t.shadowMap.enabled=!0,t.shadowMap.type=je,this.key.castShadow=!0,this.key.shadow.mapSize.set(2048,2048),this.key.shadow.bias=-4e-4,this.key.shadow.normalBias=.02,this.group.traverse(n=>{const s=n;s.isMesh&&(s.castShadow=!0,s.receiveShadow=!0)}),this.catcher||(this.catcher=new p(new Q(1,1),new Ve({opacity:.4,depthWrite:!1})),this.catcher.receiveShadow=!0,this.catcher.renderOrder=-2,this.scene.add(this.catcher)),this.contact||(this.contact=new p(new Q(1,1),new H({map:Ct(),transparent:!0,depthWrite:!1,color:0})),this.contact.renderOrder=-1,this.scene.add(this.contact)),!this.lookEnv&&!this.screen)){const n=new he(t);this.lookEnv=n.fromScene(new ge,.04,.1,100,{size:128}).texture,n.dispose()}t.toneMapping=Ge,t.toneMappingExposure=e.exposure,!this.screen&&this.lookEnv&&(this.scene.environment=this.lookEnv),this.scene.environmentIntensity=e.env,this.hemi.color.set(e.ambient),this.hemi.groundColor.set(e.ambient).multiplyScalar(.45),this.hemi.intensity=e.ambientIntensity,this.key.color.set(e.color),this.key.intensity=e.intensity,this.key.shadow.radius=1+e.softness*9,this.key.shadow.blurSamples=8+Math.round(e.softness*16),this.catcher.material.opacity=e.shadow,this.catcher.visible=e.shadow>0}groundFor(e,t){const n=JSON.stringify([e.id,e.start,e.duration,e.posX,e.posY,e.spatialDepth,e.modelDepth,e.scale,e.motionKeys,e.modelRotation,e.parentId,t?JSON.stringify(t):""]);if(this.groundCache?.key===n)return this.groundCache.d;const s=Me(e,ve(e),t,this.width,this.height);return this.groundCache={key:n,d:s},s}async load(e){const t=await Ke(e);this.add(await new se().loadAsync(t),e)}async loadBuffer(e,t){this.add(await new se().parseAsync(e,""),t)}async loadDevice(e){if(!e.device)throw Error("Không phải thiết bị 3D");const t=ft(e.device);this.scene.environment=wt(this.renderer),this.addObject(t.object),!this.disposed&&(this.screen=new yt(t.screen,t.screenAspect,e.deviceScreen),await this.screen.whenReady())}async prepare(e){await this.screen?.sync(e,!0)}addObject(e){if(this.disposed){this.disposeObject(e);return}const t=new P().setFromObject(e),n=t.getSize(new l),s=Math.max(n.x,n.y,n.z);e.scale.setScalar(1.8/s),e.updateMatrixWorld(!0),this.halfY=n.y*1.8/s/2,e.position.sub(new P().setFromObject(e).getCenter(new l)),e.updateMatrixWorld(!0),this.group.add(e)}add(e,t){if(this.disposed){this.disposeObject(e.scene);return}const s=new P().setFromObject(e.scene).getSize(new l),o=Math.max(s.x,s.y,s.z);if(!Number.isFinite(o)||o<=0)throw Error("GLB không có hình học hợp lệ");e.scene.scale.setScalar(1.8/o),e.scene.updateMatrixWorld(!0);const i=new P().setFromObject(e.scene).getCenter(new l);e.scene.position.sub(i),e.scene.updateMatrixWorld(!0),this.halfY=s.y*1.8/o/2,this.group.add(e.scene),this.clips=e.animations||[],this.clips.length&&(this.mixer=new _e(e.scene),e.scene.traverse(r=>{r!==e.scene&&this.rest.push({o:r,p:r.position.clone(),q:r.quaternion.clone(),s:r.scale.clone()})})),this.collectPieces(e.scene),Se.set(t,this.pieces.length),be.set(t,this.clips.map((r,c)=>({name:ce(r,c),duration:r.duration}))),J.forEach(r=>r())}collectPieces(e){this.group.updateMatrixWorld(!0);const t=[];e.traverse(c=>{c.isMesh&&t.push(c)});const n=new P().setFromObject(e),s=c=>{const h=c.getSize(new l);return h.x*h.y*h.z},o=s(n)*.02,i=n.getSize(new l),r=i.x*i.z;for(const c of t.slice(0,oe.maxPieces)){const h=new P().setFromObject(c),m=h.getCenter(new l),d=h.getSize(new l),f=new $().copy(c.parent.matrixWorld).invert();this.pieces.push({o:c,p:c.position.clone(),q:c.quaternion.clone(),s:c.scale.clone(),toParent:new Be().setFromMatrix4(f),box:{bottom:h.min.y,cx:m.x,cz:m.z,h:d.y,r:Math.max(d.x,d.z)/2,big:s(h)>o,base:d.x*d.z>=r*.25&&h.min.y<=n.min.y+i.y*.03}})}}build(e,t){let n=null;try{n=e.modelBuild?nt(e.modelBuild):null}catch{n=null}const s=new Set;this.group.traverse(i=>{const r=i.material;if(r)for(const c of Array.isArray(r)?r:[r])s.add(c)});const o=[];if(n){const i=st(this.pieces.map(h=>h.box),n);this.pieces.forEach((h,m)=>{const d=ot(n.style,h.box,i[m],t,m,n.seed);h.o.position.copy(h.p),h.o.quaternion.copy(h.q),h.o.scale.copy(h.s),h.o.visible=d.visible,(d.dx||d.dy||d.dz)&&h.o.position.add(new l(d.dx,d.dy,d.dz).applyMatrix3(h.toParent)),(d.rx||d.ry||d.rz)&&h.o.quaternion.multiply(new A().setFromEuler(new Z(d.rx,d.ry,d.rz)))}),this.group.updateMatrixWorld(!0);const r=new l(0,1,0).applyQuaternion(this.group.getWorldQuaternion(new A)).normalize();it(n,t)&&o.push(this.cut[0].setFromNormalAndCoplanarPoint(r,this.group.localToWorld(new l(0,-this.halfY,0))));const c=at(n,t,this.halfY);c!==null&&o.push(this.cut[1].setFromNormalAndCoplanarPoint(r.clone().negate(),this.group.localToWorld(new l(0,c,0)))),this.dustAt(rt(this.pieces.map(h=>h.box),i,n,t,j),n.dustColor),this.buildOn=!0}else{for(const i of this.pieces)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s),i.o.visible=!0;this.dustAt([],oe.dustColor),this.buildOn=!1}this.renderer.localClippingEnabled=o.length>0;for(const i of s){const r=o.length?o:null;i.clippingPlanes!==r&&(i.clippingPlanes?.length||r)&&(i.clippingPlanes=r,i.needsUpdate=!0)}}dustAt(e,t){if(!e.length&&!this.dust)return;if(!this.dust){const r=new ne;r.setAttribute("position",new X(new Float32Array(j*3),3)),r.setAttribute("aAlpha",new X(new Float32Array(j),1)),r.setAttribute("aSize",new X(new Float32Array(j),1));const c=new We({uniforms:{uColor:{value:new ue(t)},uScale:{value:this.height*1.2}},vertexShader:At,fragmentShader:Pt,transparent:!0,depthWrite:!1});this.dust=new Ue(r,c),this.dust.frustumCulled=!1,this.group.add(this.dust)}const n=this.dust.geometry,s=n.getAttribute("position"),o=n.getAttribute("aAlpha"),i=n.getAttribute("aSize");e.forEach((r,c)=>{s.setXYZ(c,r[0],r[1],r[2]),o.setX(c,r[3]),i.setX(c,r[4])}),n.setDrawRange(0,e.length),s.needsUpdate=o.needsUpdate=i.needsUpdate=!0,this.dust.material.uniforms.uColor.value.set(t)}setGuides(e,t=4){if(!e){this.guides&&(this.scene.remove(this.guides),this.disposeObject(this.guides),this.guides=null);return}if(this.guides)return;const n=new k,s=new Ye(t,16,6742271,2781056);s.rotation.x=Math.PI/2;for(const i of Array.isArray(s.material)?s.material:[s.material])i.transparent=!0,i.opacity=.85,i.depthWrite=!1;const o=(i,r)=>new Ne(new ne().setFromPoints([new l,i]),new Qe({color:r}));n.add(s,o(new l(.5,0,0),16731469),o(new l(0,.5,0),5111674),o(new l(0,0,.5),5086207)),this.guides=n,this.scene.add(n)}surfaceAt(e,t){const n=new fe;n.setFromCamera(new we(e/this.width*2-1,1-t/this.height*2),this.camera);const s=n.ray.intersectPlane(new G(new l(0,0,1),0),new l);return s?{x:s.x,y:s.y}:null}pose(e,t){if(!this.mixer)return;const n=e.modelAnim,s=n?this.clips.find((i,r)=>ce(i,r)===n.clip):void 0;if(!n||!s){if(this.action){this.mixer.stopAllAction(),this.action=null;for(const i of this.rest)i.o.position.copy(i.p),i.o.quaternion.copy(i.q),i.o.scale.copy(i.s)}return}const o=this.mixer.clipAction(s);this.action!==o&&(this.mixer.stopAllAction(),o.setLoop(Xe,1/0),o.play(),this.action=o),o.time=ct(n,s.duration,t,e.inPoint||0),this.mixer.update(0)}render(e,t,n=!1,s){const o=e.modelLook?ht(e.modelLook):null;this.applyLook(o);const i=this.width,r=this.height,c=e.modelLook||e.modelLaunch?this.groundFor(e,s):void 0,h=vt(e,t,s,i,r,this.halfY,c);this.camera.position.copy(h.cam.pos),this.camera.quaternion.copy(h.cam.quat),this.camera.fov=h.cam.fov,this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(!0),this.group.scale.setScalar(h.zoom),this.group.quaternion.copy(h.quat),this.group.position.copy(h.pos),this.pose(e,t),(e.modelBuild||this.buildOn)&&this.build(e,t),o&&this.placeShadows(e,o,h.N,h.d??0,h.len,s),n&&this.screen?.sync(t),this.renderer.render(this.scene,this.camera),n&&this.publish(e.id)}placeShadows(e,t,n,s,o,i){const r=this.group.getWorldPosition(new l),c=r.dot(n)-s,h=r.clone().addScaledVector(n,-c),m=new A().setFromUnitVectors(new l(0,0,1),n),d=Math.max(0,c-this.halfY*this.group.scale.x),f=Math.max(6*o,d*4+3*o);this.catcher.position.copy(h).addScaledVector(n,.001*o),this.catcher.quaternion.copy(m),this.catcher.scale.set(f,f,1);const v=new P().setFromObject(this.group),u=v.getSize(new l),g=Math.max(.2*o,Math.hypot(u.x,u.y,u.z)-Math.abs(u.clone().dot(n)))*.62,M=Math.max(0,1-d/(.8*o));this.contact.visible=t.contact>0&&M>0,this.contact.position.copy(h).addScaledVector(n,.002*o),this.contact.quaternion.copy(m),this.contact.scale.set(g*(1+d/o),g*.75*(1+d/o),1),this.contact.material.opacity=t.contact*.85*M;const x=Mt(t,n,I(e,0,i,this.width,this.height)),w=12*o;this.key.target.position.copy(h),this.key.position.copy(h).addScaledVector(x,w),this.key.target.updateMatrixWorld();const y=this.key.shadow.camera,z=f*.6;y.left=-z,y.right=z,y.top=z,y.bottom=-z,y.near=Math.max(.01,w-4*o-d),y.far=w+4*o+d,y.updateProjectionMatrix()}publish(e){const t=new P().setFromObject(this.group);if(t.isEmpty())return;let n=1/0,s=1/0,o=-1/0,i=-1/0;for(const r of[t.min.x,t.max.x])for(const c of[t.min.y,t.max.y])for(const h of[t.min.z,t.max.z]){const m=new l(r,c,h).project(this.camera),d=(m.x+1)/2*this.width,f=(1-m.y)/2*this.height;n=Math.min(n,d),o=Math.max(o,d),s=Math.min(s,f),i=Math.max(i,f)}dt.set(e,{cx:(n+o)/2,cy:(s+i)/2,w:o-n,h:i-s,angle:0,W:this.width,H:this.height})}async frame(e){const t=await new Promise(o=>(e??this.canvas).toBlob(o,"image/webp",.8));if(!t)throw Error("Không xuất được frame 3D");const n=new Uint8Array(await t.arrayBuffer());let s="";for(let o=0;o<n.length;o+=16384)s+=String.fromCharCode(...n.subarray(o,o+16384));return btoa(s)}disposeObject(e){e.traverse(t=>{const n=t;n.geometry?.dispose();for(const s of n.material?Array.isArray(n.material)?n.material:[n.material]:[]){for(const o of Object.values(s))o instanceof de&&o.dispose();s.dispose()}})}dispose(){this.disposed=!0,this.screen?.dispose(),this.screen=null,this.mixer?.stopAllAction(),this.disposeObject(this.group),this.renderer.dispose(),this.canvas.remove()}}const It=Object.freeze(Object.defineProperty({__proto__:null,Timeline3DScene:kt,modelAnimations:bt,modelPieces:zt,onModelAnimations:St},Symbol.toStringTag,{value:"Module"}));export{kt as T,zt as a,dt as l,bt as m,St as o,It as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b$ as E,eO as M,eP as D,lN as F,eQ as v}from"./titleFrameBudget-Cml-MO53.js";import{T as P}from"./timeline3d-YIIk_Kn2.js";import{wantsFrame as u,SKIPPED_FRAME as C}from"./frameSink-BGRj7wqY.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./api-QBI5GJTZ.js";import"./RoomEnvironment-Dmv_G5ka.js";const d=6;async function B(p,w,a,g,f){const{width:s,height:m,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 P(s,m),h=e.modelLook?F(e.modelLook).blur:e.motionBlur?.5:0,c=h>0?Object.assign(document.createElement("canvas"),{width:s,height:m}):null,t=c?.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,C);continue}if(v(b),await o.prepare(i/r),c&&t){t.globalCompositeOperation="copy",t.clearRect(0,0,s,m),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(c))}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{B 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,ik as C,eO as nt,eP as ot,eQ as Mt,jb as bt,i7 as F,F as vt,fn as _t,gT as it,ec as L,g$ as at,h3 as St,gU as Pt,gW as $t,fs as tt,jf as rt,m as E,l as A,gS as st,fc as J,lI as ut,lJ as K,iq as et,ea as q,d5 as dt,lK as lt,h as U,s as pt,h$ as Ot,i0 as Et}from"./titleFrameBudget-Cml-MO53.js";const $=1/vt,w=1e-6,X=t=>typeof t=="number"&&Number.isFinite(t);function jt(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t)||Object.keys(t).some(i=>i!=="in"&&i!=="out")||!X(t.in)||!X(t.out))throw Error("Invalid export range");const n=b(t.in),e=b(t.out);if(n<0||e>R||e-n<$-w)throw Error("Invalid export range");return{in:n,out:e}}function B(t,n){if(t==null&&n==null)return null;const e=jt({in:t??0,out:n??R});return e.in<=w&&e.out>=R-w?null:e}function Gt(t,n,e){const i=Math.max(0,Math.min(R,b(e))),o=t?.in??0,s=t?.out??R;try{return n==="in"?i>=R-$+w?void 0:B(i,i>=s-w?null:s):i<$-w?void 0:B(i<=o+w?null:o,i)}catch{return}}function Qt(t,n,e,i){if(!(i>=$))return t??null;const o=t?.in??0,s=t?.out??R;try{if(n==="in")return B(Math.max(0,Math.min(b(e),b(Math.min(s,i)-$))),s>=R-w?null:s);const f=Math.max(b(o+$),Math.min(b(e),i));return B(o,f>=i-w?null:f)}catch{return t??null}}function Zt(t,n){if(!t||!X(t.in)||!X(t.out)||!(n>0))return null;const e=Math.max(0,Math.min(n,t.in)),i=Math.max(0,Math.min(n,t.out));return i-e<$-w||e<=w&&i>=n-w?null:{in:e,out:i}}function Rt(t,n,e){if(!t||!Array.isArray(t.motionKeys)||!t.motionKeys.length)return t;let i={...t,motionKeys:[]};for(const o of St){const s=Pt(t,o);if(!s.length)continue;const f=s.some(a=>a.time<n-w),l=s.some(a=>a.time>e+w),p=[...s].reverse().find(a=>a.time<=n+w);i=$t(i,o,[...f?[{time:0,value:tt(t,o,n),...p?.ease!==void 0?{ease:p.ease}:{}}]:[],...s.filter(a=>(f?a.time>n+w:a.time>=n-w)&&(l?a.time<e-w:a.time<=e+w)).map(a=>({...a,time:Math.max(0,b(a.time-n))})),...l?[{time:b(e-n),value:tt(t,o,e)}]:[]])}return i}const At=t=>[...t.parentId?[t.parentId]:[],...Array.isArray(t.shape?.items)?t.shape.items.flatMap(n=>n?.pins&&typeof n.pins=="object"?Object.values(n.pins):[]):[]];function Tt(t,n,e,i,o,s){const f=n.find(I=>I.id===t.id)??t,l=t.start+t.duration<=e+w?t.duration:0,p=_t(f,l,o,s),a=p.sx??1,r=p.sy??1,v=it("image",t.track)?t.track:0;return{...at({id:t.id,track:v,start:0,duration:i,label:String(t.label||"Null").slice(0,160)}),posX:p.x,posY:p.y,scale:p.zoom,rotation:p.rot,anchorX:L(t,"ax",l),anchorY:L(t,"ay",l),...a!==1||r!==1?{motionKeys:[{time:0,sx:a,sy:r}]}:{}}}function G({clips:t,camera:n=null},e,{W:i=1280,H:o=720}={}){if(!e||!Array.isArray(t))return{clips:t,camera:n};const s=e.in,f=e.out,l=b(f-s),p=[];for(const m of t){if(m.start+m.duration<=s+w||m.start>=f-w)continue;let k=m;if(k.start<s-w){const x=b(s-k.start);if(k.duration-x<$-w)continue;if(x>=$-w){const _=C(k,s,`${m.id}~in`);_.length===2&&(k={..._[1],id:m.id})}}if(k.start+k.duration>f+w){const x=b(f-k.start);if(x<$-w)continue;k.duration-x>=$-w&&(k=C(k,f,`${m.id}~out`)[0])}p.push({...k,start:Math.max(0,b(k.start-s))})}const a=new Set(p.map(m=>m.id)),r=new Map(t.map(m=>[m.id,m])),v=[...new Set(p.flatMap(At))].filter(m=>!a.has(m)&&r.get(m)&&!r.get(m).disabled&&r.get(m).kind!=="audio");let I=[];if(v.length){const m=nt(ot(t.filter(k=>!k.disabled)));Mt(m),I=v.map(k=>Tt(r.get(k),m,s,l,i,o))}const y=new Set([...a,...I.map(m=>m.id)]);return{clips:[...p.map(m=>{const k=r.get(m.id),x=[];let _=m;if(m.parentId&&!y.has(m.parentId)&&x.push("parentId"),m.matte&&!a.has(m.matte.source)&&(x.push("matte"),m.matte.mode?.endsWith("-inverted")||(_={...m,opacity:0,motionKeys:bt(m,"opacity",[])})),m.transition&&k&&F(t,k)&&!F(p,m)&&x.push("transition"),m.join&&k&&F(t,k)&&!F(p,m)&&x.push("join"),!x.length)return _;_={..._};for(const T of x)delete _[T];return _}),...I],camera:Rt(n,s,f)}}const j=t=>!!t&&!!t.comp&&Array.isArray(t.comp.clips),D=">",Q=t=>j(t)?1+Math.max(0,...t.comp.clips.map(Q)):0,mt=t=>j(t)?t.comp.clips.reduce((n,e)=>n+1+mt(e),0):0,Ft=t=>j(t)?Math.max(0,...t.comp.clips.map(n=>n.start+n.duration)):0,ft=t=>{let n=1;for(;t.some(e=>e.label===`Comp ${n}`);)n++;return`Comp ${n}`},z=t=>String(t).padStart(3,"0"),V=["x","y","zoom","rot","ax","ay"],Kt={x:0,y:0,zoom:1,rot:0,ax:0,ay:0};function Z(t){return t.parentId||V.some(n=>q(t,n).length||Math.abs(L(t,n,0)-Kt[n])>1e-9)?!0:["enter","exit"].some(n=>t[n]&&t[n].type!=="fade")}const ct=t=>q(t,"opacity").length>0||["enter","exit"].some(n=>t[n]&&(t[n].type==="fade"||t[n].fade!==!1));function ht(t,n){const e=[];for(const o of t.motionKeys||[]){const s={time:o.time};for(const l of V)Number.isFinite(o[l])&&(s[l]=o[l]);if(Object.keys(s).length===1)continue;const f=o.ease&&Object.fromEntries(Object.entries(o.ease).filter(([l])=>V.includes(l)));f&&Object.keys(f).length&&(s.ease=f),e.push(s)}const i=Object.fromEntries(["posX","posY","scale","rotation","anchorX","anchorY","parentId","zIndex","enter","exit"].filter(o=>t[o]!==void 0).map(o=>[o,t[o]]));return{...at({id:n,track:t.track,start:t.start,duration:t.duration,label:t.label}),...i,motionKeys:e,_comp:t.id}}function zt(t,n){if(Math.abs(n-1)<1e-9)return t;const e=q(t,"opacity"),i={...t,opacity:(t.opacity??1)*n};return e.length?{...i,...dt(i,"opacity",e.map(o=>({...o,value:o.value*n})))}:i}function Nt(t,n){const e=Math.max(1,Math.ceil(t.duration*60-1e-6)),i=[];for(let o=0;o<=e;o++){const s=Math.min(t.duration,o/60);i.push({time:+s.toFixed(6),value:Math.max(0,Math.min(1,L(t,"opacity",s)*n(s)))})}return{...t,...dt(t,"opacity",i)}}function W(t,n){const e={...t},i=o=>n(o);if(e.parentId!==void 0){const o=i(e.parentId);o?e.parentId=o:delete e.parentId}if(e.matte?.source!==void 0){const o=i(e.matte.source);o?e.matte={...e.matte,source:o}:delete e.matte}e._virtual!==void 0&&(e._virtual=i(e._virtual)??e._virtual),typeof e.space=="string"&&(e.space=i(e.space)??e.space);for(const o of["bend","vfx"])typeof e[o]?.source=="string"&&(e[o]={...e[o],source:i(e[o].source)??e[o].source});return Array.isArray(e.shape?.items)&&e.shape.items.some(o=>o?.pins)&&(e.shape={...e.shape,items:e.shape.items.map(o=>o?.pins&&typeof o.pins=="object"?{...o,pins:Object.fromEntries(Object.entries(o.pins).map(([s,f])=>[s,i(f)??f]))}:o)}),e}const Dt=t=>{if(t.transition===void 0&&t.join===void 0)return t;const{transition:n,join:e,...i}=t;return i};function H(t){const n=t.comp.tracks||{};return t.comp.clips.filter(e=>!e.disabled&&!(e.kind!=="audio"&&n[e.track]?.hidden)).map(e=>n[e.track]?.muted?{...e,volume:0}:e)}function kt(t,n,e,i){const o=t.inPoint||0,s=t.start-o;return G({clips:n},{in:o,out:o+t.duration},{W:e,H:i}).clips.map(l=>{const p={...l,start:b(t.start+l.start)};for(const a of["_txIn","_txOut"])p[a]&&(p[a]={...p[a],t0:p[a].t0+s});return p})}function Lt(t,n){const e=t.inPoint||0;if(U(t)&&!t.reverse)return e+pt(t,Math.max(0,Math.min(t.duration,n)));const i=t.playbackRate||1,o=Math.max(0,Math.min(t.duration,n));return e+(t.reverse?Math.max(0,t.duration-o-1/30):o)*i}function yt(t){const n=t.inPoint||0,e=U(t)&&!t.reverse?pt(t,t.duration):t.duration*(t.playbackRate||1);return{from:n,to:n+e}}function wt(t){const n=H(t),e=new Set(n.map(o=>o.id)),i=`${t.id}${D}`;return n.map(o=>({...W(o,s=>e.has(s)?i+s:null),id:i+o.id}))}function It(t,{W:n=1280,H:e=720}={}){const{from:i,to:o}=yt(t);return G({clips:wt(t)},{in:i,out:o},{W:n,H:e}).clips.map(s=>({...s,volume:0}))}function Ut(t,{W:n=1280,H:e=720}={}){const i=[],o=(s,f)=>{for(const l of s)if(l?._group&&j(l)&&f<K){const p=N(It(l,{W:n,H:e}),{W:n,H:e});i.push(p),o(p,f+1)}};return o(N(t||[],{W:n,H:e}),0),i}function Xt(t,n,e,i){if(t.reverse||U(t))return[];const o=t.playbackRate||1,s=t.inPoint||0,f=`${t.id}${D}`,l=N(H(t),{W:e,H:i,depth:n+1}).filter(a=>a.url&&(a.volume??1)>0&&(a.kind==="audio"||a.kind==="video"&&!a.freeze&&!a.reverse));return G({clips:l},{in:s,out:s+t.duration*o},{W:e,H:i}).clips.flatMap(a=>{const r=(a.playbackRate||1)*o;return r>8||U(a)&&o!==1?[]:[{...Object.fromEntries(["nodeId","url","gcsUri","label","inPoint","sourceDuration","audioFx","duck","muffle"].filter(I=>a[I]!==void 0).map(I=>[I,a[I]])),id:`${f}${a.id}~a`,kind:"audio",track:a.kind==="audio"?a.track:st[0],start:b(t.start+a.start/o),duration:Math.max(1/30,b(a.duration/o)),volume:(a.volume??1)*(t.volume??1),...r!==1?{playbackRate:r}:{},...a.speedRamp&&o===1?{speedRamp:a.speedRamp}:{},...a.audioFadeIn?{audioFadeIn:a.audioFadeIn/o}:{},...a.audioFadeOut?{audioFadeOut:a.audioFadeOut/o}:{},_comp:t.id,_slot:`§a${f}${a.id}`}]})}function gt(t,n,e){let i=n;return n.kind!=="audio"&&!n.nullLayer&&(i=e!==null?zt(i,e):Nt(i,o=>J(t,i.start-t.start+o).opacity)),t.volume!==void 0&&t.volume!==1&&(n.kind==="video"||n.kind==="audio")&&(i={...i,volume:(i.volume??1)*t.volume}),t.lookBypass&&(i={...i,lookBypass:!0}),i}function Bt(t,n,e,i,o){if(n>=K)return[];t={...t,...rt(t)};let s=nt(ot(H(t))).map(Dt);s=N(s,{W:e,H:i,depth:n+1});const f=kt(t,s,e,i),l=new Set(f.map(y=>y.id)),p=`${t.id}${D}`,a=o?`${p}~comp`:null,r=ct(t)?null:J(t,0).opacity,v=[...new Set(f.filter(y=>y.kind!=="audio").map(y=>`${z((y.zIndex??0)+200)}:${z(E(y.track)+1)}`))].sort(),I=f.map(y=>{let g=W(y,m=>l.has(m)?p+m:null);return g={...gt(t,g,r),id:p+y.id,_comp:t.id,...g.parentId===void 0&&a&&y.kind!=="audio"?{parentId:a}:{}},y.kind!=="audio"?(g.track=t.track,g._slot=`§${z(v.indexOf(`${z((y.zIndex??0)+200)}:${z(E(y.track)+1)}`))}${y._slot??""}`,t.zIndex!==void 0?g.zIndex=t.zIndex:delete g.zIndex):g._slot=`§${y._slot??""}${y.id}`,g});return I.sort((y,g)=>y._slot<g._slot?-1:y._slot>g._slot?1:0),a?[ht(t,a),...I]:I}function N(t,{W:n=1280,H:e=720,depth:i=0}={}){if(!Array.isArray(t)||!t.some(r=>j(r)&&!r._group))return t;const o=new Set(t.filter(r=>r.transition).map(r=>F(t,r)?.id).filter(Boolean)),s=r=>lt(r)||o.has(r.id),f=new Set(t.filter(r=>r.parentId).map(r=>r.parentId)),l=new Set(t.filter(r=>j(r)&&!s(r)).map(r=>r.id)),p=new Map,a=[];for(const r of t){if(!j(r)||r._group){a.push(r);continue}if(r.disabled)continue;if(s(r)){i<K&&a.push({...r,_group:!0},...Xt(r,i,n,e));continue}const v=Z(r)||f.has(r.id);v&&p.set(r.id,`${r.id}${D}~comp`),a.push(...Bt(r,i,n,e,v))}return a.map(r=>{if(r.parentId&&p.has(r.parentId))return{...r,parentId:p.get(r.parentId)};if(r.matte&&l.has(r.matte.source)){const{matte:v,...I}=r;return I}return r})}function Yt(t,n,{id:e,label:i,tracks:o={},W:s=1280,H:f=720}={}){const l=new Set(n||[]),p=t.filter(u=>l.has(u.id));if(!p.length)throw Error("Precompose: select at least one layer");if(!p.some(u=>u.kind!=="audio"))throw Error("Precompose needs at least one picture layer");if(p.some(u=>o[u.track]?.locked))throw Error("Track đã khóa");if(1+Math.max(0,...p.map(Q))>K)throw Error(`Comps nest at most ${K} deep`);const a=t.filter(u=>!l.has(u.id)),r=[...p.filter(u=>u.matte&&!l.has(u.matte.source)),...a.filter(u=>u.matte&&l.has(u.matte.source))];if(r.length)throw Error(`Precompose: the track matte of "${r[0].label||r[0].id}" crosses the comp's edge — take the matte layer in too, or remove the matte`);const v=b(Math.min(...p.map(u=>u.start))),I=b(Math.max(...p.map(u=>u.start+u.duration))),y=Math.max(1/30,b(I-v)),g=u=>a.some(c=>c.track===u&&c.kind!=="audio"&&c.start<I-1e-6&&c.start+c.duration>v+1e-6)||o[u]?.locked,m=[...new Set(p.filter(u=>u.kind!=="audio").map(u=>u.track))].sort((u,c)=>E(c)-E(u));let k=m.find(u=>!g(u));for(let u=E(m[0])+1;k===void 0;u++)g(A(u))||(k=A(u));const x=u=>F(t,u),_=p.map(u=>{let c={...u};return c.parentId&&!l.has(c.parentId)&&(c={...c,...et(t,u,null,0,s,f)}),c.transition&&!l.has(x(u)?.id)&&delete c.transition,c.join&&!l.has(x(u)?.id)&&delete c.join,c.parentId===void 0&&delete c.parentId,{...c,start:b(u.start-v)}}),T=a.map(u=>{let c=u;return u.parentId&&l.has(u.parentId)&&(c={...c,...et(t,u,null,0,s,f)},c.parentId===void 0&&(c={...c},delete c.parentId)),(c.transition||c.join)&&l.has(x(u)?.id)&&(c={...c},delete c.transition,delete c.join),c}),O=[...new Set(p.map(u=>u.track))].filter(u=>o[u]?.hidden||o[u]?.muted),Y=Object.fromEntries(O.map(u=>[u,{...o[u].hidden?{hidden:!0}:{},...o[u].muted?{muted:!0}:{}}])),P={id:e||`comp-${Date.now().toString(36)}`,nodeId:"",kind:"image",url:"",label:i||ft(t),track:k,start:v,duration:y,inPoint:0,sourceDuration:y,motionV:2,comp:{clips:_,...O.length?{tracks:Y}:{}}};return{clips:[...T,P],id:P.id,track:k}}function Vt(t,n,{tracks:e={},W:i=1280,H:o=720,newId:s=()=>`null-${Math.random().toString(36).slice(2,9)}`}={}){const f=t.find(d=>d.id===n);if(!j(f))throw Error("Uncompose needs a comp layer");if(e[f.track]?.locked)throw Error("Track đã khóa");const l={...f,...rt(f)},p=t.filter(d=>d.id!==n),a=new Set(p.map(d=>d.id)),r=l.comp.tracks||{},v=l.comp.clips.map(d=>({...d,...r[d.track]?.hidden&&d.kind!=="audio"?{disabled:!0}:{},...r[d.track]?.muted?{volume:0}:{}})),I=kt(l,v,i,o),y=new Map;for(const d of I){let h=d.id,M=2;for(;a.has(h)||[...y.values()].includes(h);)h=`${d.id}-${M++}`;y.set(d.id,h)}const g=[...p],m=(d,h)=>!e[d]?.locked&&!g.some(M=>M.track===d&&h.some(S=>M.start<S.start+S.duration-1e-6&&M.start+M.duration>S.start+1e-6)),k=new Map,x=[...new Set(I.filter(d=>d.kind!=="audio").map(d=>d.track))].sort((d,h)=>E(d)-E(h)),_=d=>I.filter(h=>h.kind!=="audio"&&h.track===d),T=x.every(d=>m(d,_(d)));let O=T?E(x.at(-1)??l.track)+1:E(l.track);for(const d of x){const h=_(d);if(T){k.set(d,d),g.push(...h);continue}for(;!m(A(O),h);)O++;k.set(d,A(O)),g.push(...h.map(M=>({...M,track:A(O)}))),O++}for(const d of[...new Set(I.filter(h=>h.kind==="audio").map(h=>h.track))]){const h=I.filter(S=>S.kind==="audio"&&S.track===d),M=[d,...st.filter(S=>S!==d)].find(S=>m(S,h));if(M===void 0)throw Error("Uncompose: no free audio row for the comp's sounds");k.set(d,M),g.push(...h.map(S=>({...S,track:M})))}const Y=Z(l)||p.some(d=>d.parentId===n);let P=null;if(Y){let d=O;const h=[{start:l.start,duration:l.duration}];for(;!m(A(d),h);)d++;let M=s();for(;a.has(M);)M=s();const{_comp:S,...xt}=ht(l,M);P={...xt,track:A(d),label:l.label||"Null"}}const u=ct(l)?null:J(l,0).opacity,c=I.map(d=>{let h=W(d,M=>y.get(M)??null);if(h={...gt(l,h,u),id:y.get(d.id),track:k.get(d.track)??d.track},h.parentId===void 0&&P&&d.kind!=="audio"&&(h.parentId=P.id),!it(h.kind,h.track))throw Error("Uncompose: no free row");return h});return{clips:[...p.map(d=>d.parentId===n?P?{...d,parentId:P.id}:(({parentId:h,...M})=>M)(d):d),...P?[P]:[],...c],ids:c.map(d=>d.id),nullId:P?.id??null,dropped:ut(f)}}const Wt=Object.freeze(Object.defineProperty({__proto__:null,COMP_DEPTH:K,COMP_SEP:D,compBlockers:Ot,compClipCount:mt,compContentEnd:Ft,compDepth:Q,compGrouped:lt,compInner:wt,compLabel:ft,compMoves:Z,compPictureFields:ut,compRange:yt,compRenderLevel:It,compTime:Lt,expandComps:N,groupedLevels:Ut,isComp:j,precompose:Yt,stripComp:Et,uncompose:Vt},Symbol.toStringTag,{value:"Module"}));export{wt as a,Lt as b,Ft as c,Zt as d,N as e,ft as f,mt as g,Qt as h,j as i,Gt as j,B as m,Yt as p,G as s,Wt as t,Vt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dy as P,eA as O,dz as M,i5 as F,fC as R,fE as j}from"./remote-BJdzzFZg.js";import"./api-QBI5GJTZ.js";import"./titleFrameBudget-Cml-MO53.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-2zneEhhu.js";import"./rotoMaskStore-DIi45swK.js";import"./textAnimators-Bdt5LWXk.js";import"./timelineComp-B73i_8vD.js";import"./rigTrack-CUt4O67J.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"),C=[...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 J(t,e){if(e==="camera")return A;const i=t.items.find(o=>o.id===e);return i?i.kind==="fx"?i.fx?.attach?_:C:U:[]}function q(t,e){return e==="camera"?t.motion==="path"&&!!t.cameraKeys?.length:(t.objectKeys?.[e]?.length??0)>0}const y=t=>+t.slice(1);function G(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 X=t=>+t.toFixed(3);function H(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(F(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,R(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=>X(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,E)=>u.time-E.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 I(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,C as FX_FREE_PROPS,_ as FX_OFFSET_PROPS,U as OBJECT_PROPS,T as addKeyAt,Q as copyKeys,v as easeKeys,I as keyAllAt,g as nudgeKeys,W as pasteKeys,G as readProp,q as rowKeyed,J as rowProps,H as writeProp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as o}from"./store-
|
|
1
|
+
import{u as o}from"./store-2zneEhhu.js";import{t as l,c as w}from"./api-QBI5GJTZ.js";import{l as v,d as C}from"./titleArt-hb_T45WJ.js";import{i as h}from"./textAnimators-Bdt5LWXk.js";import"./titleFrameBudget-Cml-MO53.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};
|