clipoox-render 0.4.1 → 0.4.3

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.
Files changed (105) hide show
  1. package/package.json +1 -1
  2. package/scripts/render-local.mjs +1322 -1320
  3. package/web/assets/{FxEmbed-CGqGi2Lw.js → FxEmbed-BCmj9Q5C.js} +1 -1
  4. package/web/assets/{MotionEmbed-C3CZ3_y_.js → MotionEmbed-CEmbcq8Z.js} +1 -1
  5. package/web/assets/PluginStore-C5hyahvG.js +3 -0
  6. package/web/assets/{ShotComposer-DFfaYLoV.js → ShotComposer-0DUtMTVI.js} +4 -4
  7. package/web/assets/{TemplateEmbed-C8pXcPsc.js → TemplateEmbed-ANxSs7H5.js} +1 -1
  8. package/web/assets/{TimelinePlugins-DnkV3i4G.js → TimelinePlugins-BYZ9y4m3.js} +4 -4
  9. package/web/assets/{TimelinePlugins-DYarX9RK.css → TimelinePlugins-D841ngau.css} +1 -1
  10. package/web/assets/{TimelineShotFx-foiuuogg.js → TimelineShotFx-q5PQwq-V.js} +2 -2
  11. package/web/assets/{TransitionEmbed-BueDilY0.js → TransitionEmbed-O6LInGWq.js} +1 -1
  12. package/web/assets/{Whiteboard-zBsNHh5h.js → Whiteboard-BP_DvIAV.js} +1 -1
  13. package/web/assets/{aerial-z34Nww_T.js → aerial-CGLDKKtP.js} +2 -2
  14. package/web/assets/{agentTools-ALxghYpf.js → agentTools-2Ghb80VH.js} +2 -2
  15. package/web/assets/{analyzerRun-DNwryAlU.js → analyzerRun-DRgxrcJA.js} +1 -1
  16. package/web/assets/{analyzerSandbox-A1oFsCrO.js → analyzerSandbox-DuIVFnsk.js} +1 -1
  17. package/web/assets/{api-DUp403BK.js → api-CJ8PdbfZ.js} +5 -5
  18. package/web/assets/{auraTrack-BKVZCwNt.js → auraTrack-DQw9sVU6.js} +1 -1
  19. package/web/assets/{breakthrough-Cwt8gEwK.js → breakthrough-BNj_iTDr.js} +2 -2
  20. package/web/assets/{cameraPresets-DSOPj4oy.js → cameraPresets-CYw0OdM3.js} +1 -1
  21. package/web/assets/{captionLayout-EuB59pN_.js → captionLayout-DvDPTwO9.js} +1 -1
  22. package/web/assets/{clientExport-BL1XMTF0.js → clientExport-xhoXY6Dh.js} +1 -1
  23. package/web/assets/conversion-4rhF3xRJ.js +17 -0
  24. package/web/assets/{depthEstimate-DOvsY8mn.js → depthEstimate-DEpeCojm.js} +1 -1
  25. package/web/assets/{directorTools-BkbNYbSq.js → directorTools-C5CpTmci.js} +1 -1
  26. package/web/assets/{distortFrames-Drch0LhT.js → distortFrames-Dia8O1NM.js} +2 -2
  27. package/web/assets/{distortGL-BlmBZKRU.js → distortGL-QalhICvi.js} +1 -1
  28. package/web/assets/{editTools-BcGinqHC.js → editTools-CY_JrQfw.js} +1 -1
  29. package/web/assets/engine-BedcnK45.js +1 -0
  30. package/web/assets/{exportEncode-MUwVTI52.js → exportEncode-QYsT9JBO.js} +1 -1
  31. package/web/assets/{exportGlb-SIXFRRJM.js → exportGlb-TSj09XoV.js} +1 -1
  32. package/web/assets/{faceTracker-DCbZbLMc.js → faceTracker-CnCWOwnJ.js} +1 -1
  33. package/web/assets/{fightDirector-hlF1JS_z.js → fightDirector-DCI_FWTh.js} +1 -1
  34. package/web/assets/{fightDrama-fHN5EXk3.js → fightDrama-Bg7uP_2Q.js} +2 -2
  35. package/web/assets/{frameSink-BvOXjLuw.js → frameSink-DeM8xC8_.js} +3 -3
  36. package/web/assets/{gpuCompose-CNkLwpbZ.js → gpuCompose-CA3UmOl4.js} +1 -1
  37. package/web/assets/{gpuExport-DQB6x4eh.js → gpuExport-D31azOQA.js} +13 -9
  38. package/web/assets/{handMatte-BD7OE3Zc.js → handMatte-Dl-xVXFR.js} +1 -1
  39. package/web/assets/{handTracker-BumGtRCW.js → handTracker-CplBsAFg.js} +2 -2
  40. package/web/assets/{id3-BCR9Bqgo.js → id3-arvEpAg7.js} +1 -1
  41. package/web/assets/{index-CuaB7Y0L.js → index-D5oyVCRl.js} +1 -1
  42. package/web/assets/index-_tSTJnL9.js +8 -0
  43. package/web/assets/layer-worker-DFuo32bk.js +5 -0
  44. package/web/assets/library-BufgA-Pl.js +1 -0
  45. package/web/assets/{lottieLayer-1ET89OUr.js → lottieLayer-DzbA3bHV.js} +4 -4
  46. package/web/assets/{lottie_light_canvas-DD9pkFL8.js → lottie_light_canvas-B-d7-ATe.js} +1 -1
  47. package/web/assets/main-VVYiW8XD.js +309 -0
  48. package/web/assets/{mapBake-DLoBt_k5.js → mapBake-BKOcEd0w.js} +1 -1
  49. package/web/assets/maskTrack-CHGXtBRy.js +1 -0
  50. package/web/assets/{matteFixRun-BdHKC3m5.js → matteFixRun-vgYrINet.js} +1 -1
  51. package/web/assets/{objectLocate-bZtc5AJo.js → objectLocate-BJltm8Ob.js} +1 -1
  52. package/web/assets/{output-BwZzMbp-.js → output-p-Q7qous.js} +1 -1
  53. package/web/assets/{pendingMatte-mlyLLZCT.js → pendingMatte-BPyzzx4y.js} +2 -2
  54. package/web/assets/{personAi-CUNQeseG.js → personAi-gJu03SjU.js} +2 -2
  55. package/web/assets/{plateCamera-_jP1xXnj.js → plateCamera-B2JvhjJw.js} +1 -1
  56. package/web/assets/{plateCameraMatch-rr0oUwQ2.js → plateCameraMatch-ByB9nVQT.js} +2 -2
  57. package/web/assets/{plateFollow-BjvtcT8q.js → plateFollow-C9S-l7RH.js} +2 -2
  58. package/web/assets/{plateMatte-BqyL8cQZ.js → plateMatte-J4qlNHnY.js} +2 -2
  59. package/web/assets/{pluginAutomation-Dp188qm7.js → pluginAutomation-CkP3tA9r.js} +1 -1
  60. package/web/assets/{poseTracker-DDGDhhMF.js → poseTracker-DGLbouqt.js} +1 -1
  61. package/web/assets/{productTools-CRgI88-O.js → productTools-CkaWF1bM.js} +2 -2
  62. package/web/assets/remote-C7J0Tqhb.js +1433 -0
  63. package/web/assets/{rigTrack-UYZU4P-e.js → rigTrack-urT3nDK0.js} +1 -1
  64. package/web/assets/{rotoMaskStore-BxyxB2bD.js → rotoMaskStore-DPziPKAN.js} +1 -1
  65. package/web/assets/{rotoMatte-BdYa8FSB.js → rotoMatte-C-2o3vv0.js} +1 -1
  66. package/web/assets/{rotoscope-DDixNQCt.js → rotoscope-GvPFRUBg.js} +1 -1
  67. package/web/assets/{shot-worker-D9sZS6bn.js → shot-worker-6dYkHPoL.js} +1 -1
  68. package/web/assets/{shotFxAgent-7RQNtEe4.js → shotFxAgent-BFLkqs8v.js} +1 -1
  69. package/web/assets/{skin-CVwmK130.js → skin-DY4QLaBI.js} +1 -1
  70. package/web/assets/{spark.module-B34aiScb.js → spark.module-DzziUgOj.js} +1 -1
  71. package/web/assets/{spellDuel-BkweL6pI.js → spellDuel-BD3m2ebA.js} +2 -2
  72. package/web/assets/store-Cug4GGcP.js +1 -0
  73. package/web/assets/{store-75tQUvPT.js → store-DW4E9xnW.js} +1 -1
  74. package/web/assets/{surfaceLight-DhU-zgNL.js → surfaceLight-aDSYU8Jg.js} +1 -1
  75. package/web/assets/surfacePin-m83hCgGP.js +2 -0
  76. package/web/assets/{textAnimators-nVSz_sZo.js → textAnimators-DUZjhVGO.js} +1 -1
  77. package/web/assets/{thumb-r6dlZprA.js → thumb-CS0ZuiGS.js} +1 -1
  78. package/web/assets/{timeline3d-246tBEJl.js → timeline3d-DOw-CpZI.js} +2 -2
  79. package/web/assets/{timeline3dExport-T57qnWi9.js → timeline3dExport-BtYLU1pw.js} +1 -1
  80. package/web/assets/{timelineComp-BcewYGR2.js → timelineComp-B4GtoH2f.js} +1 -1
  81. package/web/assets/{timelineProps-CJzzAWWO.js → timelineProps-D7MVutxu.js} +1 -1
  82. package/web/assets/{timelineText-BzUhNWPB.js → timelineText-BH09jfSM.js} +1 -1
  83. package/web/assets/{titleArt-B8DVR58F.js → titleArt-Drsrtfiv.js} +3 -3
  84. package/web/assets/{titleFrameBudget-BYRZAQPs.js → titleFrameBudget-CLZWaFHO.js} +1 -1
  85. package/web/assets/{titleFrames-BVgm601q.js → titleFrames-BI1DnLBn.js} +1 -1
  86. package/web/assets/{tool-CAGU3dUa.js → tool-DktQYmS6.js} +1 -1
  87. package/web/assets/{tools-DVaOkokV.js → tools-Co9aRDiT.js} +1 -1
  88. package/web/assets/{toonTools-CfGTR_H1.js → toonTools-CD9clJvN.js} +2 -2
  89. package/web/assets/{trackAnchor-DzUt1r5Q.js → trackAnchor-sOjTtd3I.js} +1 -1
  90. package/web/assets/{userFonts-DzY0A4bD.js → userFonts-CwlKh9NR.js} +1 -1
  91. package/web/assets/{vfxAlpha-DQJOaZ9v.js → vfxAlpha-71tSN86T.js} +2 -2
  92. package/web/assets/{vfxBackground-DiktQFOD.js → vfxBackground-Bq7lJvmZ.js} +2 -2
  93. package/web/assets/{videoExport-Ce0ElSQR.js → videoExport-D4KbireJ.js} +1 -1
  94. package/web/assets/{views-V3si1lOz.js → views-ozVF4ABO.js} +1 -1
  95. package/web/assets/{weaponDuel-D6sLVGmG.js → weaponDuel-ZhX-tjGZ.js} +1 -1
  96. package/web/assets/{windowFrames-D_2QJCJJ.js → windowFrames-CpqX3kOM.js} +1 -1
  97. package/web/layer-worker.html +3 -3
  98. package/web/assets/PluginStore-DKXZ-jBj.js +0 -3
  99. package/web/assets/index-DYa7fEK0.js +0 -24
  100. package/web/assets/layer-worker-DxPMMKIZ.js +0 -5
  101. package/web/assets/library-CyjJ8nGG.js +0 -1
  102. package/web/assets/main-BKjBWQik.js +0 -309
  103. package/web/assets/maskTrack-C2SJbDGO.js +0 -1
  104. package/web/assets/remote-Dva2qg58.js +0 -1241
  105. package/web/assets/surfacePin-ObK6QgDm.js +0 -2
@@ -1 +1 @@
1
- import{j as d,dy as y,dz as w}from"./remote-Dva2qg58.js";import{r as p}from"./api-DUp403BK.js";import{t as b,a as E,d as u}from"./thumb-r6dlZprA.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-75tQUvPT.js";import"./titleFrameBudget-BYRZAQPs.js";import"./rotoMaskStore-BxyxB2bD.js";import"./textAnimators-nVSz_sZo.js";import"./timelineComp-BcewYGR2.js";import"./rigTrack-UYZU4P-e.js";const j=["https://admin.clipoox.com","http://localhost:3000","http://localhost:5173"],x=960,h=540;function F(i){const r=i&&typeof i=="object"?i:{},m=y({...r,name:String(r.name||"preview").slice(0,60),category:r.category||"tu-tien"});let o=5381;for(const l of JSON.stringify(m))o=(o<<5)+o+l.charCodeAt(0)|0;return w({id:(o>>>0).toString(16).padStart(32,"0"),...m})}function D(){const i=p.useRef(null),[r,m]=p.useState(null),[o,l]=p.useState("");return p.useEffect(()=>{const s=(t,a)=>t.source?.postMessage(a,{targetOrigin:t.origin}),c=t=>{if(!j.includes(t.origin)||t.source!==window.parent||!t.data||typeof t.data!="object")return;const a="id"in t.data?t.data.id:null;let n;try{n=F(t.data.fx)}catch(e){t.data.type==="clipoox-fx-play"&&l(e.message),s(t,{type:"clipoox-fx-error",id:a,error:e.message});return}if(t.data.type==="clipoox-fx-play"){l(""),m(n);return}if(t.data.type==="clipoox-fx-thumb")try{const e=Object.assign(document.createElement("canvas"),{width:480,height:270}),f=e.getContext("2d");if(!f)throw Error("canvas");const g=Number.isFinite(t.data.t)?Math.max(0,Number(t.data.t)):E(n);u(f,n,g,480,270),s(t,{type:"clipoox-fx-thumb",id:a,webp:e.toDataURL("image/webp",.85)})}catch(e){s(t,{type:"clipoox-fx-error",id:a,error:e.message})}};return window.addEventListener("message",c),window.parent?.postMessage({type:"clipoox-fx-ready"},"*"),()=>window.removeEventListener("message",c)},[]),p.useEffect(()=>{const s=i.current,c=s?.getContext("2d");if(!r||!s||!c)return;let t=0;const a=performance.now(),n=b(r),e=()=>{u(c,r,(performance.now()-a)/1e3%n,x,h),t=requestAnimationFrame(e)};return t=requestAnimationFrame(e),()=>cancelAnimationFrame(t)},[r]),d.jsxs("div",{style:{margin:0,background:"#0a0e14",width:"100vw",height:"100vh",display:"grid",placeItems:"center"},children:[d.jsx("canvas",{ref:i,width:x,height:h,style:{maxWidth:"100%",maxHeight:"100vh",objectFit:"contain"},"aria-label":"FX preview"}),o&&d.jsx("p",{role:"alert",style:{position:"fixed",bottom:8,left:8,right:8,color:"#ff8080",font:"12px sans-serif"},children:o})]})}export{D as default,F as previewEntry};
1
+ import{j as d,dy as y,dz as w}from"./remote-C7J0Tqhb.js";import{r as p}from"./api-CJ8PdbfZ.js";import{t as b,a as E,d as u}from"./thumb-CS0ZuiGS.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-DW4E9xnW.js";import"./titleFrameBudget-CLZWaFHO.js";import"./rotoMaskStore-DPziPKAN.js";import"./textAnimators-DUZjhVGO.js";import"./timelineComp-B4GtoH2f.js";import"./rigTrack-urT3nDK0.js";const j=["https://admin.clipoox.com","http://localhost:3000","http://localhost:5173"],x=960,h=540;function F(i){const r=i&&typeof i=="object"?i:{},m=y({...r,name:String(r.name||"preview").slice(0,60),category:r.category||"tu-tien"});let o=5381;for(const l of JSON.stringify(m))o=(o<<5)+o+l.charCodeAt(0)|0;return w({id:(o>>>0).toString(16).padStart(32,"0"),...m})}function D(){const i=p.useRef(null),[r,m]=p.useState(null),[o,l]=p.useState("");return p.useEffect(()=>{const s=(t,a)=>t.source?.postMessage(a,{targetOrigin:t.origin}),c=t=>{if(!j.includes(t.origin)||t.source!==window.parent||!t.data||typeof t.data!="object")return;const a="id"in t.data?t.data.id:null;let n;try{n=F(t.data.fx)}catch(e){t.data.type==="clipoox-fx-play"&&l(e.message),s(t,{type:"clipoox-fx-error",id:a,error:e.message});return}if(t.data.type==="clipoox-fx-play"){l(""),m(n);return}if(t.data.type==="clipoox-fx-thumb")try{const e=Object.assign(document.createElement("canvas"),{width:480,height:270}),f=e.getContext("2d");if(!f)throw Error("canvas");const g=Number.isFinite(t.data.t)?Math.max(0,Number(t.data.t)):E(n);u(f,n,g,480,270),s(t,{type:"clipoox-fx-thumb",id:a,webp:e.toDataURL("image/webp",.85)})}catch(e){s(t,{type:"clipoox-fx-error",id:a,error:e.message})}};return window.addEventListener("message",c),window.parent?.postMessage({type:"clipoox-fx-ready"},"*"),()=>window.removeEventListener("message",c)},[]),p.useEffect(()=>{const s=i.current,c=s?.getContext("2d");if(!r||!s||!c)return;let t=0;const a=performance.now(),n=b(r),e=()=>{u(c,r,(performance.now()-a)/1e3%n,x,h),t=requestAnimationFrame(e)};return t=requestAnimationFrame(e),()=>cancelAnimationFrame(t)},[r]),d.jsxs("div",{style:{margin:0,background:"#0a0e14",width:"100vw",height:"100vh",display:"grid",placeItems:"center"},children:[d.jsx("canvas",{ref:i,width:x,height:h,style:{maxWidth:"100%",maxHeight:"100vh",objectFit:"contain"},"aria-label":"FX preview"}),o&&d.jsx("p",{role:"alert",style:{position:"fixed",bottom:8,left:8,right:8,color:"#ff8080",font:"12px sans-serif"},children:o})]})}export{D as default,F as previewEntry};
@@ -1 +1 @@
1
- import{j as w,dx as F}from"./remote-Dva2qg58.js";import{r as l}from"./api-DUp403BK.js";import{d as M,m as E}from"./lottieLayer-1ET89OUr.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-75tQUvPT.js";import"./titleFrameBudget-BYRZAQPs.js";import"./rotoMaskStore-BxyxB2bD.js";import"./textAnimators-nVSz_sZo.js";import"./timelineComp-BcewYGR2.js";import"./rigTrack-UYZU4P-e.js";const I=["https://admin.clipoox.com","http://localhost:3000","http://localhost:5173"],j={"16:9":[1280,720],"9:16":[720,1280],"1:1":[960,960],"4:5":[768,960]},L=f=>j[f.aspect??"16:9"]??j["16:9"];function z(){const f=l.useRef(null),[o,R]=l.useState(null),[x,y]=l.useState(""),b=l.useRef(Promise.resolve());return l.useEffect(()=>{const a=(t,i)=>t.source?.postMessage(i,{targetOrigin:t.origin}),h=async t=>{if(!I.includes(t.origin)||t.source!==window.parent||!t.data||typeof t.data!="object")return;const i="id"in t.data?t.data.id:null;let e;try{e=F(t.data.motion)}catch(n){a(t,{type:"clipoox-motion-error",id:i,error:n.message});return}if(t.data.type==="clipoox-motion-play"){y(""),R(e);return}if(t.data.type==="clipoox-motion-thumb"){const[n,u]=L(e),m=480/Math.max(n,u),s=Math.round(n*m),d=Math.round(u*m);try{const p=await E({layer:"embed:thumb",motion:{v:1,code:e.code,params:e.params},t:Number.isFinite(t.data.t)?Math.max(0,Math.min(e.duration,Number(t.data.t))):e.duration*.55,width:s,height:d,duration:e.duration}),c=Object.assign(document.createElement("canvas"),{width:s,height:d}),g=c.getContext("2d");if(!g)throw Error("canvas");g.fillStyle="#16181c",g.fillRect(0,0,s,d),g.drawImage(p,0,0),p.close(),a(t,{type:"clipoox-motion-thumb",id:i,webp:c.toDataURL("image/webp",.85)})}catch(p){a(t,{type:"clipoox-motion-error",id:i,error:p.message})}finally{M("embed:thumb")}}},r=t=>{b.current=b.current.then(()=>h(t)).catch(()=>{})};return window.addEventListener("message",r),window.parent?.postMessage({type:"clipoox-motion-ready"},"*"),()=>window.removeEventListener("message",r)},[]),l.useEffect(()=>{const a=f.current,h=a?.getContext("2d");if(!o||!a||!h)return;let r=!0,t=0;const i=performance.now(),[e,n]=L(o),u=Math.min(1,960/Math.max(e,n)),m=Math.round(e*u),s=Math.round(n*u);a.width=m,a.height=s;const d=async()=>{if(!r)return;const p=(performance.now()-i)/1e3%(o.duration+.8);try{const c=await E({layer:"embed:play",motion:{v:1,code:o.code,params:o.params},t:Math.min(p,o.duration),width:m,height:s,duration:o.duration});r&&(h.clearRect(0,0,m,s),h.drawImage(c,0,0)),c.close()}catch(c){if(r){y(c.message);return}}r&&(t=requestAnimationFrame(()=>void d()))};return d(),()=>{r=!1,cancelAnimationFrame(t),M("embed:play")}},[o]),w.jsxs("div",{style:{margin:0,background:"repeating-conic-gradient(#1d2026 0 25%,#16181c 0 50%) 0 0/24px 24px",width:"100vw",height:"100vh",display:"grid",placeItems:"center"},children:[w.jsx("canvas",{ref:f,width:1280,height:720,style:{maxWidth:"100%",maxHeight:"100vh",objectFit:"contain"},"aria-label":"Motion preview"}),x&&w.jsx("p",{role:"alert",style:{position:"fixed",bottom:8,left:8,color:"#ff8080",font:"12px sans-serif"},children:x})]})}export{z as default};
1
+ import{j as w,dx as F}from"./remote-C7J0Tqhb.js";import{r as l}from"./api-CJ8PdbfZ.js";import{d as M,m as E}from"./lottieLayer-DzbA3bHV.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-DW4E9xnW.js";import"./titleFrameBudget-CLZWaFHO.js";import"./rotoMaskStore-DPziPKAN.js";import"./textAnimators-DUZjhVGO.js";import"./timelineComp-B4GtoH2f.js";import"./rigTrack-urT3nDK0.js";const I=["https://admin.clipoox.com","http://localhost:3000","http://localhost:5173"],j={"16:9":[1280,720],"9:16":[720,1280],"1:1":[960,960],"4:5":[768,960]},L=f=>j[f.aspect??"16:9"]??j["16:9"];function z(){const f=l.useRef(null),[o,R]=l.useState(null),[x,y]=l.useState(""),b=l.useRef(Promise.resolve());return l.useEffect(()=>{const a=(t,i)=>t.source?.postMessage(i,{targetOrigin:t.origin}),h=async t=>{if(!I.includes(t.origin)||t.source!==window.parent||!t.data||typeof t.data!="object")return;const i="id"in t.data?t.data.id:null;let e;try{e=F(t.data.motion)}catch(n){a(t,{type:"clipoox-motion-error",id:i,error:n.message});return}if(t.data.type==="clipoox-motion-play"){y(""),R(e);return}if(t.data.type==="clipoox-motion-thumb"){const[n,u]=L(e),m=480/Math.max(n,u),s=Math.round(n*m),d=Math.round(u*m);try{const p=await E({layer:"embed:thumb",motion:{v:1,code:e.code,params:e.params},t:Number.isFinite(t.data.t)?Math.max(0,Math.min(e.duration,Number(t.data.t))):e.duration*.55,width:s,height:d,duration:e.duration}),c=Object.assign(document.createElement("canvas"),{width:s,height:d}),g=c.getContext("2d");if(!g)throw Error("canvas");g.fillStyle="#16181c",g.fillRect(0,0,s,d),g.drawImage(p,0,0),p.close(),a(t,{type:"clipoox-motion-thumb",id:i,webp:c.toDataURL("image/webp",.85)})}catch(p){a(t,{type:"clipoox-motion-error",id:i,error:p.message})}finally{M("embed:thumb")}}},r=t=>{b.current=b.current.then(()=>h(t)).catch(()=>{})};return window.addEventListener("message",r),window.parent?.postMessage({type:"clipoox-motion-ready"},"*"),()=>window.removeEventListener("message",r)},[]),l.useEffect(()=>{const a=f.current,h=a?.getContext("2d");if(!o||!a||!h)return;let r=!0,t=0;const i=performance.now(),[e,n]=L(o),u=Math.min(1,960/Math.max(e,n)),m=Math.round(e*u),s=Math.round(n*u);a.width=m,a.height=s;const d=async()=>{if(!r)return;const p=(performance.now()-i)/1e3%(o.duration+.8);try{const c=await E({layer:"embed:play",motion:{v:1,code:o.code,params:o.params},t:Math.min(p,o.duration),width:m,height:s,duration:o.duration});r&&(h.clearRect(0,0,m,s),h.drawImage(c,0,0)),c.close()}catch(c){if(r){y(c.message);return}}r&&(t=requestAnimationFrame(()=>void d()))};return d(),()=>{r=!1,cancelAnimationFrame(t),M("embed:play")}},[o]),w.jsxs("div",{style:{margin:0,background:"repeating-conic-gradient(#1d2026 0 25%,#16181c 0 50%) 0 0/24px 24px",width:"100vw",height:"100vh",display:"grid",placeItems:"center"},children:[w.jsx("canvas",{ref:f,width:1280,height:720,style:{maxWidth:"100%",maxHeight:"100vh",objectFit:"contain"},"aria-label":"Motion preview"}),x&&w.jsx("p",{role:"alert",style:{position:"fixed",bottom:8,left:8,color:"#ff8080",font:"12px sans-serif"},children:x})]})}export{z as default};
@@ -0,0 +1,3 @@
1
+ import{r as Te,j as n}from"./remote-C7J0Tqhb.js";import{u as ke,r as l,t as a}from"./api-CJ8PdbfZ.js";import{au as Ae,av as Ee,aw as Ie,ax as we,ay as ye,az as Z,aA as _,T as Q,aB as Ve,O as Fe,aC as Ke,A as Oe,N as Re,aD as Be,q as qe,aE as Ge,aF as J,aG as He,aH as _e,e as ze,aI as We,aJ as Xe}from"./main-VVYiW8XD.js";import{d as Qe,k as Je,m as Ye,l as Ze}from"./lottieLayer-DzbA3bHV.js";import{p as en}from"./TimelinePlugins-BYZ9y4m3.js";import"./three.module-Bx43vjkH.js";import"./GLTFLoader-BHWu1lKg.js";import"./store-DW4E9xnW.js";import"./titleFrameBudget-CLZWaFHO.js";import"./rotoMaskStore-DPziPKAN.js";import"./textAnimators-DUZjhVGO.js";import"./timelineComp-B4GtoH2f.js";import"./rigTrack-urT3nDK0.js";import"./spark.module-DzziUgOj.js";import"./userFonts-CwlKh9NR.js";import"./timeline3d-DOw-CpZI.js";import"./RoomEnvironment-Dmv_G5ka.js";import"./exportEncode-QYsT9JBO.js";import"./captionLayout-DvDPTwO9.js";import"./timelineText-BH09jfSM.js";import"./titleArt-Drsrtfiv.js";import"./rotoMatte-C-2o3vv0.js";import"./distortGL-QalhICvi.js";import"./motionBlur-uAm030t9.js";import"./pluginAutomation-CkP3tA9r.js";const Se=[{id:"all",vi:"Tất cả",en:"All"},{id:"motion",vi:"Motion",en:"Motion"},{id:"lottie",vi:"Lottie",en:"Lottie"},{id:"recipe",vi:"Công thức",en:"Recipe"},{id:"sfx",vi:"Âm thanh",en:"Sounds"},{id:"pack",vi:"Gói ngách",en:"Niche pack"},{id:"kit",vi:"Bộ 3D",en:"3D kit"},{id:"sfxlib",vi:"Kho âm thanh",en:"Sound library"},{id:"link",vi:"Cho AI agent",en:"AI agents"}],B=s=>s.kind==="pack"&&!!s.kit?.modelAssets,ie=s=>B(s)?"kit":s.kind,q=s=>s.kind==="link"&&!!s.link,nn=s=>{s.link&&window.open(s.link.url,"_blank","noopener,noreferrer")},Ce=(s,r)=>s>=1024*1024?`${(s/1024/1024).toFixed(s>=10*1024*1024?0:1).replace(".",r==="en"?".":",")} MB`:`${Math.max(1,Math.round(s/1024))} KB`,le=({n:s=28})=>n.jsx("span",{className:"ps-wave","aria-hidden":!0,children:Array.from({length:s},(r,c)=>n.jsx("i",{style:{height:`${18+Math.round(72*Math.abs(Math.sin(c*1.37)*Math.cos(c*.41)))}%`}},c))}),Le=(s,r)=>Se.find(c=>c.id===s)?.[r==="en"?"en":"vi"]??s,sn=5e3,an=600*1e3,Ne=s=>s.normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/gi,"d").toLowerCase(),Y=s=>(s.passVnd??0)>0||(s.passUsd??0)>0,tn=s=>{const r=(c,h)=>c>0&&h>0?Math.min(c,h):c>0?c:h;return _({priceVnd:r(s.priceVnd,s.passVnd??0),priceUsd:r(s.priceUsd,s.passUsd??0)})};function Fn({installed:s,initialId:r=null,onClose:c,onInstalled:h,onUse:v,toast:o}){const x=ke(),u=x==="en"?"en":"vi",[j,y]=l.useState(null),[g,S]=l.useState([]),[M,D]=l.useState(""),[p,i]=l.useState("all"),[d,b]=l.useState("all"),[C,V]=l.useState(""),[z,A]=l.useState(0),[w,U]=l.useState(null),[E,N]=l.useState(!1),[P,L]=l.useState(),[T,F]=l.useState("");l.useEffect(()=>{const e=window.setTimeout(()=>F(C.trim()),250);return()=>window.clearTimeout(e)},[C]);const I=l.useCallback(e=>Ae({q:T||void 0,kind:d==="all"?void 0:d==="pack"?"niche":d,price:p==="free"?"free":p==="paid"?"paid":void 0,limit:Xe,cursor:e||void 0}),[T,d,p]),K=l.useRef(null),O=l.useRef(0),[k,R]=l.useState(null),[re,ce]=l.useState(""),[W,ee]=l.useState({}),[ne,Me]=l.useState(""),G=l.useCallback(()=>Ee().then(e=>(S(e.owned),e.owned)).catch(()=>[]),[]),[oe,De]=l.useState(!1);l.useEffect(()=>{G().finally(()=>De(!0))},[G]),l.useEffect(()=>{if(p==="owned")return;const e=++O.current;y(null),D(""),I().then(t=>{e===O.current&&(y(t.items),A(t.total??t.items.length),U(t.nextCursor??null),L(t.facets))},t=>{e===O.current&&(y([]),U(null),D(t.message))})},[I,p]);const se=l.useCallback(()=>{if(!w||E||p==="owned")return;const e=O.current;N(!0),I(w).then(t=>{e===O.current&&(y(m=>{const f=new Set((m??[]).map($=>$.id));return[...m??[],...t.items.filter($=>!f.has($.id))]}),U(t.nextCursor??null))},t=>{e===O.current&&D(t.message)}).finally(()=>N(!1))},[w,E,p,I]);l.useEffect(()=>{const e=K.current;if(!e||!w)return;const t=new IntersectionObserver(m=>{m.some(f=>f.isIntersecting)&&se()},{rootMargin:"600px"});return t.observe(e),()=>t.disconnect()},[w,se,j]);const de=l.useRef(!1);l.useEffect(()=>{if(!r||de.current||j===null||!oe)return;de.current=!0;const e=j.find(t=>t.id===r)??g.find(t=>t.storeId===r&&t.item)?.item;e?R(e):Ie(r).then(t=>R(t.item),()=>o(a("Không tìm thấy plug-in này trong kho."),"error"))},[r,j,g,oe,o]),l.useEffect(()=>{const e=t=>{t.key==="Escape"&&(t.stopPropagation(),k?R(null):c())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[k,c]);const he=Object.keys(W).join(",");l.useEffect(()=>{if(!he)return;const e=window.setInterval(()=>{G().then(t=>{ee(m=>{const f={...m};for(const $ of Object.keys(f))(xe(t,$)||Date.now()-f[$]>an)&&delete f[$];return f})})},sn);return()=>window.clearInterval(e)},[he,G]);const H=e=>g.some(t=>t.storeId===e&&t.owned),ae=e=>g.find(t=>t.storeId===e),ue=e=>g.some(t=>t.storeId===e&&t.status==="refunded"),me=e=>s.some(t=>t.id===e&&t.source?.store===e),te=async e=>{ce(e.id);try{await Be(e.id),h(),qe(),Me(e.id),o(a("Đã cài “{0}” vào Plug-in của tôi",[e.name[u]]),"ok")}catch(t){const m=en(t);o(m.text,"error")}finally{ce("")}},pe=l.useRef({}),ge=e=>e?.owned?e.expiresAt?String(e.expiresAt):"life":"none",xe=(e,t)=>{const m=e.find(f=>f.storeId===t);return!!m?.owned&&ge(m)!==(pe.current[t]??"none")},fe=(e,t)=>{pe.current[e.id]=ge(ae(e.id)),Re(e.id,t),ee(m=>({...m,[e.id]:Date.now()}))},Ue=async e=>{const t=await G();xe(t,e)?(ee(m=>{const f={...m};return delete f[e],f}),o(a("Thanh toán xong — plug-in đã thuộc về bạn"),"ok")):o(a("Chưa thấy thanh toán. Nếu bạn vừa chuyển khoản, đợi một chút rồi kiểm tra lại."),"error")},$e=g.filter(e=>e.item).map(e=>e.item),X=(p==="owned"?$e:(j??[]).filter(e=>p==="all"||(p==="free"?e.free:!e.free))).filter(e=>(d==="all"||ie(e)===d)&&(!C.trim()||Ne(C).split(/\s+/).every(t=>Ne(`${e.name.vi} ${e.name.en} ${e.description.vi} ${e.description.en} ${e.author.name} ${e.tags.join(" ")}`).includes(t)))),Pe=[{id:"all",label:a("Plug-in")},{id:"free",label:a("Miễn phí")},{id:"paid",label:a("Trả phí")},{id:"owned",label:a("Đã sở hữu")}],ve=(e,t)=>re===e.id?n.jsxs("button",{className:t,disabled:!0,children:[n.jsx("i",{className:"spin"})," ",a("Đang cài…")]}):me(e.id)||ne===e.id?n.jsxs(n.Fragment,{children:[v?n.jsxs("button",{className:`${t} ps-use`,onClick:()=>v(e.id),children:["✓ ",a("Đã cài · Dùng ngay")]}):n.jsxs("span",{className:`${t} ps-use`,role:"status",children:["✓ ",a("Đã cài")]}),n.jsx("button",{className:"ps-reinstall",title:a("Cài lại plug-in"),onClick:()=>void te(e),children:a("Cài lại")})]}):n.jsx("button",{className:t,onClick:()=>void te(e),children:a("Cài plug-in")}),je=(e,t=!1)=>{const m=`ad-use${t?" ps-big":""}`;if(q(e))return n.jsxs("button",{className:m,onClick:()=>nn(e),children:[e.link.label?.[u]||a("Hướng dẫn cài")," ↗"]});if(e.free)return ve(e,m);if(W[e.id])return n.jsx("button",{className:`${m} ps-wait`,onClick:()=>void Ue(e.id),children:a("Đã thanh toán? Kiểm tra lại")});if(e.kind==="sfxlib"||Y(e)){const f=ae(e.id);if(!t&&!f?.owned)return n.jsx("button",{className:m,onClick:()=>R(e),children:f?.expiresAt?a("Gia hạn"):a("Xem & mua")});if(t)return n.jsx(hn,{item:e,owned:f,busy:re===e.id,installed:me(e.id),onInstall:()=>void te(e),onBuy:$=>fe(e,$)})}return H(e.id)?ve(e,m):n.jsx("button",{className:m,onClick:()=>fe(e),children:a("Mua · {0}",[_(e)])})},be=e=>{if(e.free)return n.jsx("span",{className:"ps-price free",children:a("Miễn phí")});const t=ae(e.id);return t?.owned?n.jsxs("span",{className:"ps-price owned",children:["✓ ",t.expiresAt?a("Vé đến {0}",[Q(t.expiresAt,x)]):a("Đã sở hữu")]}):n.jsx("span",{className:"ps-price",children:e.kind==="sfxlib"||Y(e)?(e.passVnd||e.passUsd)&&!(e.priceVnd||e.priceUsd)?a("{0} / 30 ngày",[Z(e)]):a("từ {0}",[tn(e)]):_(e)})};return Te.createPortal(n.jsx("div",{className:"ad-backdrop",role:"dialog","aria-modal":"true","aria-label":a("Kho Plug-in"),onMouseDown:e=>{e.target===e.currentTarget&&c()},children:n.jsxs("section",{className:"ad-drawer ps-drawer",onMouseDown:e=>e.stopPropagation(),children:[n.jsxs("header",{className:"ad-head",children:[n.jsxs("div",{className:"ad-title",children:["🛍 ",a("Kho Plug-in")]}),n.jsxs("span",{className:"ad-count",children:[p==="owned"?X.length:Math.max(z,X.length)," ",a("mục")]}),n.jsx("div",{className:"grow"}),n.jsx("button",{className:"ad-iconbtn",title:a("Đóng"),"aria-label":a("Đóng"),onClick:c,children:"✕"})]}),n.jsx("nav",{className:"ad-sources",children:Pe.map(e=>n.jsxs("button",{className:`ad-tab${p===e.id?" on":""}`,"aria-pressed":p===e.id,onClick:()=>i(e.id),children:[e.id==="all"&&n.jsx("span",{className:"ad-pin",children:"⧉"}),e.label,e.id==="owned"&&g.filter(t=>t.owned).length>0&&n.jsx("span",{className:"ps-n",children:g.filter(t=>t.owned).length})]},e.id))}),n.jsxs("div",{className:"ad-tools",children:[n.jsx("input",{className:"ad-search","aria-label":a("Tìm plug-in"),placeholder:a("Tìm plug-in, tác giả, thẻ…"),value:C,onChange:e=>V(e.target.value),onKeyDown:e=>e.stopPropagation()}),n.jsx("div",{className:"ad-chips",role:"group","aria-label":a("Loại plug-in"),children:Se.map(e=>{const t=e.id==="all"||p==="owned"?void 0:P?.kinds?.[e.id];return P&&e.id!=="all"&&p!=="owned"&&d!==e.id&&!t?null:n.jsxs("button",{className:`ad-chip${d===e.id?" on":""}`,"aria-pressed":d===e.id,onClick:()=>b(e.id),children:[e[u],t!==void 0&&n.jsx("span",{className:"ps-n",children:t.toLocaleString(u==="en"?"en-US":"vi-VN")})]},e.id)})})]}),n.jsxs("div",{className:"ad-notice",children:[n.jsxs("b",{children:["⧉ ",a("Plug-in không tốn credit.")]})," ",d==="sfxlib"?a("Kho âm thanh: mua một lần hoặc vé 30 ngày trên clipoox.com, tính là 1 plug-in; âm chỉ chép vào dự án khi bạn dùng."):a("Bản miễn phí cài ngay; bản trả phí mua một lần hoặc vé 30 ngày trên clipoox.com (chuyển khoản / thẻ), không tự trừ tiền.")]}),n.jsxs("div",{className:"ad-content",children:[M&&n.jsx("p",{role:"alert",className:"ad-alert",children:M}),j===null&&n.jsx("p",{className:"ad-muted",children:a("Đang tải…")}),j!==null&&!X.length&&n.jsx("div",{className:"ad-empty",children:p==="owned"?a("Bạn chưa mua plug-in nào."):C?a("Không có plug-in khớp tìm kiếm."):a("Kho chưa có plug-in nào trong nhóm này.")}),n.jsx("div",{className:"ad-grid",children:X.map(e=>n.jsxs("article",{className:"ad-card ps-card","data-store":e.id,children:[n.jsxs("button",{className:"ad-prev ps-open","aria-label":a("Xem {0}",[e.name[u]]),onClick:()=>R(e),children:[e.thumbnailUrl?n.jsx("img",{src:e.thumbnailUrl,alt:"",loading:"lazy"}):e.kind==="sfx"||e.kind==="sfxlib"?n.jsx(le,{}):n.jsx("span",{className:"ad-ph",children:"⧉"}),n.jsx("span",{className:"ad-badge",children:(q(e)?e.link.platform:Le(ie(e),x)).toUpperCase()}),e.featured&&n.jsxs("span",{className:"ps-featured",title:a("Đối tác tiên phong của Clipoox"),children:["★ ",a("Đối tác tiên phong")]}),e.private&&n.jsxs("span",{className:"ps-private",title:a("Chỉ các tài khoản được Clipoox chọn mới thấy gói này"),children:["🔒 ",a("Gói riêng")]})]}),n.jsxs("div",{className:"ad-meta",children:[n.jsx("div",{className:"ad-name",title:e.name[u],children:e.name[u]}),n.jsxs("div",{className:"ad-sub ps-sub",children:[n.jsxs("span",{className:"ps-by",children:[e.author.name," · v",e.version]}),be(e)]}),e.kind==="pack"&&!B(e)&&n.jsxs("div",{className:"ps-sounds-meta",children:["⧉ ",a("{0} mục trong gói",[e.itemCount??0])]}),B(e)&&n.jsxs("div",{className:"ps-kit-meta",children:["◈ ",n.jsx("b",{children:e.kit.items})," ",a("mục")," · ",n.jsx("b",{children:e.kit.models})," ",a("mô hình 3D")," · ",n.jsx("b",{children:e.kit.looks})," ",a("look")," · ",Ce(e.kit.bytes,u)]}),q(e)&&n.jsxs("div",{className:"ps-sounds-meta",children:["↗ ",a("Cài trong {0} trên máy bạn",[e.link.platform])]}),e.kind==="sfx"&&n.jsxs("div",{className:"ps-sounds-meta",children:["♪ ",a("{0} âm thanh",[e.soundCount??0])," · ",we(e.totalDuration)]}),e.kind==="sfxlib"&&n.jsxs("div",{className:"ps-sounds-meta",children:["📚 ",a("{0} âm thanh",[(e.soundCount??0).toLocaleString(u==="en"?"en-US":"vi-VN")])," · ",ye(e.totalDuration,u)]}),(e.kind==="sfxlib"||Y(e))&&!e.free&&!H(e.id)&&n.jsx("div",{className:"ps-sounds-meta ps-lib-prices",children:[e.passVnd||e.passUsd?a("{0} / 30 ngày",[Z(e)]):"",e.priceVnd||e.priceUsd?a("{0} trọn đời",[_(e)]):""].filter(Boolean).join(" · ")}),ne===e.id&&n.jsxs("div",{className:"ps-installed",role:"status",children:["✓ ",a("Đã cài vào Plug-in của tôi")]}),W[e.id]&&n.jsxs("div",{className:"ps-waiting",role:"status",children:[n.jsx("i",{className:"spin"}),a("Đang chờ thanh toán…")]}),ue(e.id)&&!H(e.id)&&n.jsx("div",{className:"ps-waiting bad",children:a("Đơn đã hoàn tiền")}),n.jsx("div",{className:"ad-actions",children:je(e)})]})]},e.id))}),p!=="owned"&&w&&n.jsx("div",{ref:K,className:"ps-more",role:"status",children:E?n.jsxs(n.Fragment,{children:[n.jsx("i",{className:"spin"})," ",a("Đang tải thêm…")]}):n.jsx("button",{className:"ad-chip",onClick:se,children:a("Xem thêm")})})]}),k&&n.jsx(ln,{item:k,locale:u,owned:H(k.id),free:k.free,waiting:!!W[k.id],refunded:ue(k.id),action:je(k,!0),price:be(k),installed:ne===k.id,onClose:()=>R(null)},`${k.id}:${H(k.id)}`)]})}),document.body)}function ln({item:s,locale:r,owned:c,free:h,waiting:v,refunded:o,action:x,price:u,installed:j,onClose:y}){const g=l.useRef(null),[S,M]=l.useState(!1),[D,p]=l.useState(!1);return l.useEffect(()=>{if(!(h||c)||s.kind==="recipe"||s.kind==="sfx"||s.kind==="pack"||s.kind==="sfxlib"||s.kind==="link")return;let i=!0,d=0,b=null;const C=`store-preview:${s.id}`,V={v:""},z=performance.now();return(async()=>{try{b=await Ve(s.id)}catch{i&&p(!0);return}if(!i||!b)return;const A=b.manifest,w=640,U=360;if(A.kind==="motion"){const E=Fe(A,b.entry,{}),N=A.duration,P=async()=>{if(i){try{const L=await Ye({layer:C,motion:E,t:(performance.now()-z)/1e3%N,width:w,height:U,duration:N}),T=g.current?.getContext("2d");T&&i&&(T.clearRect(0,0,w,U),T.drawImage(L,0,0),M(!0)),L.close()}catch{}d=requestAnimationFrame(()=>void P())}};P()}else{const E=await Ke(b.lottie,A,Oe(A,{}));V.v=URL.createObjectURL(new Blob([JSON.stringify(E)],{type:"application/json"}));const N=b.lottie.meta,P=Math.min(w/N.w,U/N.h),L={W:Math.max(2,Math.round(N.w*P/2)*2),H:Math.max(2,Math.round(N.h*P/2)*2)},T=N.op-N.ip,F=document.createElement("canvas");F.width=L.W,F.height=L.H;const I=async()=>{if(i){try{await Ze(C,V.v,L,Math.floor((performance.now()-z)/1e3*N.fr%T),F);const K=g.current?.getContext("2d");K&&i&&(K.clearRect(0,0,w,U),K.drawImage(F,(w-L.W)/2,(U-L.H)/2),M(!0))}catch{}d=requestAnimationFrame(()=>void I())}};I()}})(),()=>{i=!1,cancelAnimationFrame(d),Qe(C),Je(C),V.v&&URL.revokeObjectURL(V.v)}},[s.id,s.kind,h,c]),n.jsx("div",{className:"ad-preview-modal",onMouseDown:i=>{i.target===i.currentTarget&&y()},children:n.jsxs("div",{className:"ad-preview-box ps-detail",role:"dialog","aria-label":s.name[r],children:[n.jsxs("header",{children:[n.jsx("b",{children:s.name[r]}),n.jsx("button",{className:"ad-iconbtn","aria-label":a("Đóng"),onClick:y,children:"✕"})]}),s.kind==="sfxlib"?n.jsx(dn,{item:s,locale:r}):s.kind==="sfx"?n.jsx(on,{item:s,locale:r,owned:c,free:h}):n.jsxs("div",{className:"ps-stage",children:[n.jsx("canvas",{ref:g,width:640,height:360,style:{display:S?"block":"none"}}),!S&&(s.previewUrl&&/\.(mp4|webm)(\?|$)/.test(s.previewUrl)?n.jsx("video",{src:s.previewUrl,autoPlay:!0,muted:!0,loop:!0,playsInline:!0}):s.previewUrl||s.thumbnailUrl?n.jsx("img",{src:s.previewUrl||s.thumbnailUrl,alt:""}):n.jsx("span",{className:"ad-ph",children:"⧉"})),n.jsx("span",{className:"ps-stage-note",children:S?a("Xem thử trực tiếp trong sandbox"):h||c?D?a("Không tải được bản xem thử"):s.kind==="recipe"?a("Công thức chạy trên clip bạn chọn"):s.kind==="pack"?a("Gói {0} mục — cài rồi dùng từng mục trong tab Plug-in",[s.itemCount??0]):q(s)?a("Cài trong {0} trên máy bạn — không cài vào Timeline",[s.link.platform]):a("Đang tải bản xem thử…"):a("Mua để xem thử trực tiếp và dùng")})]}),s.kind==="pack"&&n.jsx(cn,{item:s,locale:r}),n.jsxs("div",{className:"ps-info",children:[s.featured&&n.jsxs("p",{className:"ps-featured-line",children:["★ ",a("Đối tác tiên phong của Clipoox")]}),s.private&&n.jsxs("p",{className:"ps-private-line",children:["🔒 ",a("Gói riêng: chỉ các tài khoản được Clipoox chọn mới thấy và cài được.")]}),n.jsxs("div",{className:"ps-row",children:[u,n.jsxs("span",{className:"ps-kind",children:[q(s)?s.link.platform:Le(ie(s),r)," · v",s.version," · ",s.author.name,s.kit?` · ${Ce(s.kit.bytes,r)}`:"",B(s)?` · ${a("GLB ≤ 20 MB, ≤ 300 000 tam giác")}`:""]})]}),n.jsx("p",{children:s.description[r]}),q(s)&&s.link.commands.length>0&&n.jsx(rn,{commands:s.link.commands}),s.params.length>0&&n.jsxs("p",{className:"ps-params",children:[n.jsxs("b",{children:[a("Tham số chỉnh được"),":"]})," ",s.params.map(i=>i.label[r]).join(" · ")]}),v&&n.jsxs("div",{className:"ps-waiting",role:"status",children:[n.jsx("i",{className:"spin"}),a("Đang chờ thanh toán… Hoàn tất trên trang clipoox.com vừa mở, rồi quay lại đây.")]}),o&&!c&&n.jsx("div",{className:"ps-waiting bad",children:a("Đơn mua này đã được hoàn tiền nên không cài mới được. Các clip đã dùng vẫn giữ nguyên.")}),j&&n.jsxs("div",{className:"ps-installed",role:"status",children:["✓ ",a("Đã cài vào Plug-in của tôi — mở tab Plug-in để dùng.")]}),n.jsx("div",{className:"ad-actions",children:x}),B(s)&&!h&&!c&&n.jsxs("div",{className:"ps-lock",children:["🔒 ",a("Mô hình và texture chỉ tải về máy sau khi mua. Lớp đã dựng vẫn giữ nếu bộ bị gỡ hay ngừng bán.")]}),B(s)&&(h||c)&&n.jsx("small",{className:"muted",children:a("Tài nguyên 3D chỉ chép vào dự án khi bạn dùng một mục. Lớp đã dựng vẫn giữ nếu bộ bị gỡ hay ngừng bán.")}),!h&&!c&&s.kind!=="sfxlib"&&!Y(s)&&n.jsx("small",{className:"muted",children:a("Thanh toán một lần trên clipoox.com: chuyển khoản (VND) hoặc thẻ quốc tế (USD). Không trừ credit.")})]})]})})}function rn({commands:s}){const[r,c]=l.useState(!1),h=()=>{navigator.clipboard?.writeText(s.join(`
2
+ `)).then(()=>{c(!0),window.setTimeout(()=>c(!1),2e3)},()=>{})};return n.jsxs("div",{className:"ps-cmds",children:[n.jsxs("div",{className:"ps-cmds-head",children:[n.jsx("b",{children:a("Lệnh cài")}),n.jsx("span",{className:"muted",children:a("chạy trong terminal trên máy bạn")}),n.jsx("button",{className:"ad-chip",onClick:h,children:r?`✓ ${a("Đã chép")}`:a("Chép lệnh")})]}),n.jsx("pre",{children:s.join(`
3
+ `)})]})}function cn({item:s,locale:r}){const[c,h]=l.useState(null);if(l.useEffect(()=>{let o=!0;return We(s.id).then(x=>{o&&h(x.items)},()=>{o&&h([])}),()=>{o=!1}},[s.id]),!c?.length)return null;const v=o=>o.kind==="model"?a("Mô hình"):o.kind==="lut"?"Look":o.kind==="motion"&&o.engine==="3d"?"3D":o.kind==="recipe"?a("Combo"):o.kind==="lottie"?"Lottie":"2D";return n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"ps-items-head",children:[n.jsx("b",{children:a("{0} mục trong gói",[c.length])})," · ",n.jsx("span",{className:"muted",children:a("ảnh chụp từ lần chạy thử")})]}),n.jsx("div",{className:"ps-items",children:c.slice(0,24).map(o=>n.jsxs("figure",{children:[o.thumbnail?n.jsx("img",{src:`data:${o.thumbnail.type};base64,${o.thumbnail.data}`,alt:""}):n.jsx("span",{className:"ph",children:o.kind==="model"?"◈":"✦"}),n.jsxs("figcaption",{title:o.name[r],children:[v(o)," · ",o.name[r]]})]},o.id))})]})}function on({item:s,locale:r,owned:c,free:h}){const[v,o]=l.useState(null),[x,u]=l.useState(!1),[j,y]=l.useState(!1),[g,S]=l.useState(null),M=l.useRef(null),D=l.useRef(0);l.useEffect(()=>{let i=!0;return _e(s.id).then(d=>{i&&(o(d.sounds),u(d.full))},()=>{i&&y(!0)}),()=>{i=!1,M.current?.pause(),window.clearTimeout(D.current)}},[s.id,c,h]);const p=i=>{if(M.current?.pause(),window.clearTimeout(D.current),g===i.id||!i.url){S(null);return}const d=new Audio(i.url);M.current=d,d.volume=.8,S(i.id),d.onended=()=>S(b=>b===i.id?null:b),i.preview&&(D.current=window.setTimeout(()=>{d.pause(),S(b=>b===i.id?null:b)},J.previewSeconds*1e3+300)),d.play().catch(()=>S(null))};return n.jsxs("div",{className:"ps-sounds","data-full":x?"1":"0",children:[n.jsxs("div",{className:"ps-sounds-head",children:[s.thumbnailUrl?n.jsx("img",{src:s.thumbnailUrl,alt:""}):n.jsx(le,{n:40}),n.jsxs("div",{children:[n.jsxs("b",{children:["♪ ",a("{0} âm thanh",[s.soundCount??v?.length??0])," · ",we(s.totalDuration)]}),n.jsx("small",{className:"muted",children:x?a("Nghe đầy đủ — bấm ▶"):a("Nghe thử {0} âm thanh đầu, mỗi âm tối đa {1} giây. Mua để nghe đủ và dùng.",[J.previewCount,J.previewSeconds])})]})]}),j&&n.jsx("p",{className:"ad-alert",role:"alert",children:a("Không tải được bản xem thử")}),v===null&&!j&&n.jsx("p",{className:"ad-muted",children:a("Đang tải…")}),v&&n.jsx("ul",{className:"ps-sound-list","aria-label":a("Âm thanh trong gói"),children:v.map(i=>{const d=i.name?.[r]||i.name?.vi||i.id;return n.jsxs("li",{className:`${g===i.id?"on":""}${i.url?"":" locked"}`,"data-store-sound":i.id,children:[n.jsx("button",{className:"tl-sfx-play",disabled:!i.url,"aria-label":i.url?`${a("Nghe thử")} ${d}`:a("Mua để nghe {0}",[d]),title:i.url?a("Nghe thử"):a("Mua để nghe"),onClick:()=>p(i),children:i.url?g===i.id?"■":"▶":"🔒"}),n.jsxs("span",{className:"ps-sound-name",children:[n.jsxs("span",{className:"ell",children:[d,i.loop?" ↻":""]}),n.jsxs("small",{className:"muted ell",children:[ze(i.category,r),i.tags.length?` · ${i.tags.slice(0,3).join(", ")}`:""]})]}),n.jsxs("small",{className:"muted",children:[i.preview&&(i.previewSeconds??0)<i.duration-.05?`▶ ${(i.previewSeconds??0).toFixed(1)}s / `:"",i.duration.toFixed(1),"s"]})]},i.id)})})]})}function dn({item:s,locale:r}){const c=l.useCallback(x=>Ge(s.id,x),[s.id]),[h,v]=l.useState(null),o=l.useCallback(async x=>{const u=await c(x);return v(u.access.full),u},[c]);return n.jsxs("div",{className:"ps-sounds","data-full":h?"1":"0",children:[n.jsxs("div",{className:"ps-sounds-head",children:[s.thumbnailUrl?n.jsx("img",{src:s.thumbnailUrl,alt:""}):n.jsx(le,{n:40}),n.jsxs("div",{children:[n.jsxs("b",{children:["📚 ",a("{0} âm thanh",[(s.soundCount??0).toLocaleString(r==="en"?"en-US":"vi-VN")])," · ",ye(s.totalDuration,r)]}),n.jsxs("div",{className:"ps-stats",children:[(s.folders?.length??0)>0&&n.jsxs("span",{children:[n.jsx("b",{children:s.folders.length})," ",a("thư mục")]}),n.jsxs("span",{children:[n.jsx("b",{children:"48 kHz"})," stereo"]}),n.jsxs("span",{children:["v",s.version]})]}),n.jsx("small",{className:"muted",children:h?a("Nghe đầy đủ — thêm âm từ mục SFX của Timeline."):a("Nghe thử mọi âm ({0} giây, chất lượng thấp). Mua để nghe đủ và dùng.",[J.previewSeconds])})]})]}),n.jsx(He,{libId:s.id,fetchPage:o,variant:"store"})]})}function hn({item:s,owned:r,busy:c,installed:h,onInstall:v,onBuy:o}){const x=ke(),u=s.kind==="sfxlib",j=(s.passVnd??0)>0||(s.passUsd??0)>0,y=s.priceVnd>0||s.priceUsd>0,g=n.jsx("button",{className:"ad-use ps-big",disabled:c,onClick:v,children:c?a("Đang cài…"):h?a("Cài lại"):a("Cài plug-in")});return r?.owned&&!r.expiresAt?g:r?.owned?n.jsxs("div",{className:"ps-lib-buy-wrap",children:[g,j&&n.jsx("button",{className:"ad-use ps-big ps-alt",onClick:()=>o("pass"),children:a("Gia hạn thêm 30 ngày · {0}",[Z(s)])}),n.jsx("small",{className:"muted",children:a("Vé đến {0}. Gia hạn cộng nối từ ngày đó, không tự trừ tiền.",[Q(r.expiresAt,x)])})]}):n.jsxs("div",{className:"ps-lib-buy-wrap",children:[r?.expiresAt&&n.jsx("div",{className:"ps-waiting",children:u?a("Vé 30 ngày đã hết hạn ngày {0}. Âm đã dùng trong dự án vẫn giữ nguyên.",[Q(r.expiresAt,x)]):a("Vé 30 ngày đã hết hạn ngày {0}. Lớp đã thêm vào video vẫn giữ nguyên.",[Q(r.expiresAt,x)])}),n.jsxs("div",{className:"ps-lib-buy",children:[j&&n.jsxs("button",{className:"ad-use ps-big",onClick:()=>o("pass"),children:[a("Vé 30 ngày · {0}",[Z(s)]),n.jsx("small",{children:a("Trả lại để gia hạn, không tự trừ tiền")})]}),y&&n.jsxs("button",{className:"ad-use ps-big",onClick:()=>o("lifetime"),children:[a("Mua trọn đời · {0}",[_(s)]),n.jsx("small",{children:u?a("Một lần, gồm các đợt âm mới"):a("Một lần, dùng mãi mãi")})]})]}),n.jsx("small",{className:"muted",children:u?a("Thanh toán trên clipoox.com: chuyển khoản (VND) hoặc thẻ quốc tế (USD). Không trừ credit. Âm đã dùng trong dự án vẫn giữ khi vé hết hạn."):a("Thanh toán trên clipoox.com: chuyển khoản (VND) hoặc thẻ quốc tế (USD). Không trừ credit. Hết vé thì không thêm mới được; lớp đã thêm vào video vẫn giữ nguyên.")})]})}export{Fn as default};