@taole/giftstage-plugin-multi-gift 0.0.58
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/index.cjs +1 -0
- package/dist/index.d.ts +207 -0
- package/dist/index.js +1513 -0
- package/package.json +26 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("@taole/giftstage");const pe=.42,Z=8192,de="LOTTIE_EFFECT_PARTICLE_CAPACITY_EXCEEDED",ve=Object.freeze([Object.freeze({batch:"main",rate:105,phase:"launch"}),Object.freeze({batch:"main",rate:78,phase:"launch"}),Object.freeze({batch:"main",rate:48,phase:"launch"}),Object.freeze({batch:"smoke",rate:18,phase:"launch"}),Object.freeze({batch:"main",rate:390,phase:"burst"}),Object.freeze({batch:"main",rate:275,phase:"burst"}),Object.freeze({batch:"main",rate:145,phase:"burst"}),Object.freeze({batch:"main",rate:265,phase:"secondary"}),Object.freeze({batch:"main",rate:175,phase:"secondary"}),Object.freeze({batch:"main",rate:48,phase:"secondary"})]);function tt(e,t,i){return Math.max(t,Math.min(i,e))}function $e(e={}){const t=e.quality??"auto";if(typeof t=="number")return tt(t,.25,1.25);if(t==="low")return .46;if(t==="medium")return .72;if(t==="high")return 1;const i=Number.isFinite(e.deviceMemory)?e.deviceMemory:8,s=Number.isFinite(e.hardwareConcurrency)?e.hardwareConcurrency:8;return i<=4||s<=4?.52:/Android|iPhone|iPad|iPod/i.test(e.userAgent||"")?.72:1}function Ue({launchDuration:e,density:t=1,resolvedQualityScale:i=1}){if(!Number.isFinite(e)||e<0||!Number.isFinite(t)||t<0||!Number.isFinite(i)||i<0)throw new Error("firework 粒子数量规划参数必须是有限非负数");const s=t*i;if(!Number.isFinite(s))throw new Error("firework 粒子数量规划结果不是有限数值");const r={launch:e*.84,burst:.11,secondary:.14},n=ve.map(({rate:o,phase:c})=>Math.max(1,Math.round(o*r[c]*s)));let l=0,a=0;return n.forEach((o,c)=>{ve[c].batch==="smoke"?l+=o:a+=o}),Object.freeze({emitterCounts:Object.freeze(n),smokeCount:l,mainCount:a,totalCount:l+a,flashCount:1})}function je(e,t=Z){if(!Number.isSafeInteger(e==null?void 0:e.smokeCount)||e.smokeCount<0||!Number.isSafeInteger(e==null?void 0:e.mainCount)||e.mainCount<0)throw new Error("firework smoke/main 粒子数量必须是非负安全整数");if(!Number.isSafeInteger(t)||t<1)throw new Error("firework maxInstancesPerBatch 必须是正安全整数");if(e.smokeCount>t||e.mainCount>t){const i=new RangeError(`firework 粒子批次超过上限 ${t}(smoke=${e.smokeCount}, main=${e.mainCount})`);throw i.code=de,i.counts=e,i.maxInstancesPerBatch=t,i}return e}function Ge({frameRate:e,dismissFrame:t,durationSeconds:i=pe}){if(!Number.isFinite(e)||!(e>0)||!Number.isFinite(t)||!Number.isFinite(i)||!(i>0))throw new Error("firework dismissDuration 必须生成有限且严格递增的毫秒区间");const s=t/e,r=s*1e3,n=(s+i)*1e3;if(!Number.isFinite(r)||!Number.isFinite(n)||!(n>r))throw new Error("firework dismissDuration 必须生成有限且严格递增的毫秒区间");return Object.freeze({durationSeconds:i,startSeconds:s,startMs:r,endMs:n})}const Te=150,Re=new WeakMap;function te(e,t){return Array.isArray(e)?e:e!=null?[e]:Array.isArray(t)?t:[t]}function le(e,t,i){const s=e==null?void 0:e[t];if(!s)return null;if(Array.isArray(s))return{x:s[0],y:s[1]??s[0]};if(typeof s=="object"){const r=a=>{const o=s[a];return o==null?null:Array.isArray(o)?o[i]??o[0]:o},n=r("x"),l=r("y");return n==null||l==null?null:{x:n,y:l}}return null}function it(e,t,i){const s=1-e;return 3*s*s*e*t+3*s*e*e*i+e*e*e}function st(e,t,i){const s=1-e;return 3*s*s*e*t+3*s*e*e*i+e*e*e}class ne extends Error{constructor(t,i,s=[],r=!1){super(i),this.name="MultiGiftValidationError",this.code=t,this.findings=s,this.recoverable=r}}function F(e,t,i={}){return{code:e,severity:i.severity||"error",scope:i.scope||"slot",where:t,...i.layer?{layer:i.layer}:{},...Number.isInteger(i.effectIndex)?{effectIndex:i.effectIndex}:{}}}function L(e,t){e.some(i=>i.code===t.code&&i.where===t.where)||e.push(t)}function ie(e){return!e||typeof e!="object"?[]:e.a===1?Array.isArray(e.k)?e.k.flatMap(t=>[t==null?void 0:t.s,t==null?void 0:t.e]).filter(t=>t!==void 0):[]:e.k===void 0?[]:[e.k]}function V(e){const t=Array.isArray(e)?e:[e];return t.length>0&&t.every(Number.isFinite)?t:null}function Ye(e,t=new Set){return!e||typeof e!="object"||t.has(e)?!1:(t.add(e),typeof e.x=="string"?!0:Object.values(e).some(i=>Ye(i,t)))}function J(e,t,i,s,r){if(e==null)return;const n=()=>L(i,F("LOTTIE_INVALID_KEYFRAME",t,{layer:s}));if(typeof e!="object"||e.k===void 0){n();return}if(typeof e.x=="string"&&L(i,F("LOTTIE_UNSUPPORTED_TRANSFORM",`${t}.x`,{layer:s})),e.a!==1){const o=V(e.k);(!o||!r.includes(o.length))&&n();return}if(!Array.isArray(e.k)||e.k.length===0){n();return}let l=-1/0,a=null;for(let o=0;o<e.k.length;o+=1){const c=e.k[o];if(!c||!Number.isFinite(c.t)||c.t<l){n();return}l=c.t;const d=[c.s,c.e].filter(m=>m!==void 0);if(c.s===void 0||d.length===0){n();return}for(const m of d){const p=V(m);if(!p||!r.includes(p.length)){n();return}if(a==null&&(a=p.length),a!==p.length){n();return}}}}function me(e){var n,l,a,o,c,d;const t=[],i=e.nm||`ind_${e.ind}`,s={layer:i};e.parent!==void 0&&t.push(F("LOTTIE_UNSUPPORTED_PARENT",i,s)),e.ddd===1&&t.push(F("LOTTIE_UNSUPPORTED_3D",i,s));const r=(n=e.ks)==null?void 0:n.p;return r&&(r.s===!0||r.x!==void 0||r.y!==void 0)&&t.push(F("LOTTIE_UNSUPPORTED_SPLIT_POSITION",i,s)),(((l=e.ks)==null?void 0:l.rx)!==void 0||((a=e.ks)==null?void 0:a.ry)!==void 0||((o=e.ks)==null?void 0:o.or)!==void 0||((c=e.ks)==null?void 0:c.sk)!==void 0||((d=e.ks)==null?void 0:d.sa)!==void 0||e.ao===1||e.sr!==void 0&&e.sr!==1||e.st!==void 0&&e.st!==0||e.tm!==void 0||e.bm!==void 0&&e.bm!==0||e.tt!==void 0||e.td!==void 0||e.hasMask===!0||Array.isArray(e.masksProperties)&&e.masksProperties.length>0||Array.isArray(e.ef)&&e.ef.length>0||Ye(e))&&t.push(F("LOTTIE_UNSUPPORTED_TRANSFORM",i,s)),(r==null?void 0:r.a)===1&&Array.isArray(r.k)&&r.k.forEach((m,p)=>{var w;const v=(m==null?void 0:m.to)!==void 0,y=(m==null?void 0:m.ti)!==void 0;if(!v&&!y)return;const b=m==null?void 0:m.s,g=(m==null?void 0:m.e)??((w=r.k[p+1])==null?void 0:w.s),h=Array.isArray(b)?b.length:-1,u=M=>Array.isArray(M)&&M.length===h&&M.every(Number.isFinite);(!u(b)||!u(g)||!u(m.to)||!u(m.ti))&&t.push(F("LOTTIE_INVALID_KEYFRAME",`${i}.ks.p[${p}]`,s))}),t}function Ke(e,t,i){let s=0,r=1;for(let l=0;l<32;l+=1){const a=(s+r)/2;it(a,t.x,i.x)<e?s=a:r=a}const n=(s+r)/2;return st(n,t.y,i.y)}function rt(e){return((e==null?void 0:e.layers)||[]).flatMap(me)}function We(e,t={}){var d,m,p,v,y,b,g;const i=[],s=Array.isArray(e==null?void 0:e.layers)?e.layers:[];(!Number.isFinite(e==null?void 0:e.w)||e.w<=0||!Number.isFinite(e==null?void 0:e.h)||e.h<=0||!Number.isFinite(e==null?void 0:e.fr)||e.fr<=0||!Number.isFinite(e==null?void 0:e.ip)||!Number.isFinite(e==null?void 0:e.op)||e.op<=e.ip)&&i.push(F("LOTTIE_INVALID_COMPOSITION","composition",{scope:"composition"}));const r=/^(slot|img_slot)_(\d+)$/,n=s.filter(h=>r.test((h==null?void 0:h.nm)||""));n.filter(h=>/^slot_\d+$/.test(h.nm)).length===0&&i.push(F("LOTTIE_SLOT_MISSING","layers",{scope:"composition"}));for(const h of["slot","img_slot"]){const u=n.filter(O=>O.nm.startsWith(`${h}_`)),w=new Set,M=[];for(const O of u)w.has(O.nm)&&L(i,F("LOTTIE_SLOT_DUPLICATED",O.nm,{scope:"composition"})),w.add(O.nm),M.push(Number((d=r.exec(O.nm))==null?void 0:d[2]));Array.from(new Set(M)).sort((O,_)=>O-_).some((O,_)=>O!==_+1)&&i.push(F("LOTTIE_SLOT_INDEX_GAP",h,{scope:"composition"}))}for(const h of n){const u=h.nm;for(const k of me(h))L(i,k);h.ty!==3&&L(i,F("LOTTIE_UNSUPPORTED_LAYER_TYPE",u,{layer:u})),(!Number.isFinite(h.ip)||!Number.isFinite(h.op)||h.op<=h.ip)&&L(i,F("LOTTIE_INVALID_KEYFRAME",`${u}.ip/op`,{layer:u}));const w=h.ks||{};J(w.p,`${u}.ks.p`,i,u,[2,3]),J(w.s,`${u}.ks.s`,i,u,[2,3]),J(w.r,`${u}.ks.r`,i,u,[1]),J(w.rz,`${u}.ks.rz`,i,u,[1]),J(w.o,`${u}.ks.o`,i,u,[1]),w.r!==void 0&&w.rz!==void 0&&L(i,F("LOTTIE_UNSUPPORTED_TRANSFORM",`${u}.ks.r/rz`,{layer:u}));const M=w.a,E=ie(M);((M==null?void 0:M.a)===1||E.some(k=>{const T=V(k);return!T||T.some(R=>R!==0)}))&&L(i,F("LOTTIE_UNSUPPORTED_ANCHOR",`${u}.ks.a`,{layer:u})),ie(w.p).some(k=>{const T=V(k);return!!T&&T.length>2&&T[2]!==0})&&L(i,F("LOTTIE_UNSUPPORTED_3D",`${u}.ks.p`,{layer:u})),ie(w.s).some(k=>{const T=V(k);return!!T&&(T[0]<0||T[1]<0||T.length>2&&T[2]!==100)})&&L(i,F("LOTTIE_UNSUPPORTED_TRANSFORM",`${u}.ks.s`,{layer:u}))}const a=oe(e==null?void 0:e.markers,"target_flight");(!a||!Number.isFinite(a.tm)||!Number.isFinite(a.dr)||a.dr<=0||a.tm<e.ip||a.tm+a.dr>e.op)&&i.push(F("LOTTIE_TARGET_MARKER_MISSING","markers.target_flight",{scope:"composition",severity:"warning"}));const o=new Map(((e==null?void 0:e.markers)||[]).map(h=>[h==null?void 0:h.cm,h])),c=new Map(s.map(h=>[h==null?void 0:h.nm,h]));for(const[h,u]of(t.effects||[]).entries()){if((u==null?void 0:u.type)!=="firework")continue;for(const R of["launch","burst"]){const S=(m=u.anchors)==null?void 0:m[R],N=c.get(S);if(!S||!((p=N==null?void 0:N.ks)!=null&&p.p)){L(i,F("LOTTIE_EFFECT_ANCHOR_MISSING",`effects[${h}].anchors.${R}`,{scope:"effect",severity:"warning",effectIndex:h}));continue}const z=me(N),P=[];J(N.ks.p,`${S}.ks.p`,P,S,[2,3]),ie(N.ks.p).some(f=>{const A=V(f);return!!A&&A.length>2&&A[2]!==0})&&z.push(F("LOTTIE_UNSUPPORTED_3D",`${S}.ks.p`,{layer:S}));for(const[f,A]of[["s",[100,100,100]],["r",[0]],["rz",[0]],["o",[100]],["a",[0,0,0]]]){const C=N.ks[f];if(C==null)continue;const D=ie(C);C.a!==1&&D.length>0&&D.every(Y=>{const W=V(Y);return!!W&&W.length===A.length&&W.every((X,$)=>X===A[$])})||z.push(F("LOTTIE_UNSUPPORTED_TRANSFORM",`${S}.ks.${f}`,{layer:S}))}N.ty!==3&&z.push(F("LOTTIE_UNSUPPORTED_LAYER_TYPE",S,{layer:S}));for(const f of[...z,...P])L(i,F(f.code,f.where,{scope:"effect",severity:"warning",effectIndex:h,layer:S}))}for(const R of["launch","burst","dismiss"]){const S=(v=u.markers)==null?void 0:v[R],N=o.get(S);!S||!N?L(i,F("LOTTIE_EFFECT_MARKER_MISSING",`effects[${h}].markers.${R}`,{scope:"effect",severity:"warning",effectIndex:h})):(!Number.isFinite(N.tm)||!Number.isFinite(N.dr)||N.dr<0||R==="launch"&&N.dr<=0)&&L(i,F("LOTTIE_EFFECT_MARKER_INVALID",`effects[${h}].markers.${R}`,{scope:"effect",severity:"warning",effectIndex:h}))}const w=o.get((y=u.markers)==null?void 0:y.launch),M=o.get((b=u.markers)==null?void 0:b.burst),E=o.get((g=u.markers)==null?void 0:g.dismiss),O=u.dismissDuration??pe,_=Number.isFinite(O)&&O>0;let k=null,T=_;if(_&&E&&Number.isFinite(E.tm)&&Number.isFinite(e.fr)&&e.fr>0)try{k=Ge({frameRate:e.fr,dismissFrame:E.tm,durationSeconds:O})}catch{T=!1}if(T||L(i,F("LOTTIE_EFFECT_DISMISS_DURATION_INVALID",`effects[${h}].dismissDuration`,{scope:"effect",severity:"warning",effectIndex:h})),w&&Number.isFinite(w.dr)&&w.dr>0&&Number.isFinite(e.fr)&&e.fr>0)try{const R=t.fireworkEnvironment||{},S=$e({...R,quality:u.quality??R.quality??"auto"});je(Ue({launchDuration:w.dr/e.fr,density:u.density??1,resolvedQualityScale:S}),t.maxInstancesPerBatch??Z)}catch(R){L(i,F((R==null?void 0:R.code)===de?de:"LOTTIE_EFFECT_PARTICLE_CONFIG_INVALID",`effects[${h}]`,{scope:"effect",severity:"warning",effectIndex:h}))}w&&M&&E&&Number.isFinite(w.tm)&&Number.isFinite(M.tm)&&Number.isFinite(E.tm)&&Number.isFinite(e.fr)&&e.fr>0&&k&&!(w.tm/e.fr*1e3<=M.tm/e.fr*1e3&&M.tm/e.fr*1e3<k.endMs)&&L(i,F("LOTTIE_EFFECT_TIMING_INVALID",`effects[${h}].markers`,{scope:"effect",severity:"warning",effectIndex:h}))}return i}function Xe(e,t,i,s){const r=Math.max(e.length,t.length,i.length,s.length),n=[];let l=0,a=null;for(let o=0;o<Te;o+=1){const c=o/(Te-1),d=1-c,m=Array.from({length:r},(v,y)=>{const b=e[y]??0,g=t[y]??b,h=b+(i[y]??0),u=g+(s[y]??0);return d**3*b+3*d**2*c*h+3*d*c**2*u+c**3*g}),p=a?Math.sqrt(m.reduce((v,y,b)=>v+(y-a[b])**2,0)):0;l+=p,n.push({partialLength:p,point:m}),a=m}return{points:n,segmentLength:l}}function nt(e,t,i){let s=Re.get(e);return s||(s=Xe(t,i,e.to,e.ti),Re.set(e,s)),s}function Ve(e,t){const i=Math.max(0,Math.min(1,e)),s=t.segmentLength*i;let r=0;for(let n=0;n<t.points.length;n+=1){const l=t.points[n];if(r+=l.partialLength,s===0||i===0||n===t.points.length-1)return l.point.slice();const a=t.points[n+1];if(s>=r&&s<r+a.partialLength){const o=(s-r)/a.partialLength;return l.point.map((c,d)=>c+(a.point[d]-c)*o)}}return t.points[t.points.length-1].point.slice()}function ot(e,t,i,s,r){return Ve(e,Xe(t,i,s,r))}function B(e,t,i){if(!e||e.a===0)return te(e==null?void 0:e.k,i);const s=e.k,r=s.findIndex((v,y)=>{const b=s[y+1];return!b||t<b.t}),n=s[Math.max(r,0)],l=s[r+1];if(!l||t<=n.t||n.h===1)return te(n.s,i);const a=te(n.s,i),o=te(n.e||l.s,a),c=Math.max(0,Math.min(1,(t-n.t)/(l.t-n.t))),d=le(n,"o",0),m=le(n,"i",0)||le(l,"i",0),p=d&&m?Ke(c,d,m):c;return Array.isArray(n.to)&&Array.isArray(n.ti)?Ve(p,nt(n,a,o)):a.map((v,y)=>v+((o[y]??v)-v)*p)}function Be(e){return 1-(1-e)**3}function at(e){return e<.5?4*e*e*e:1-(-2*e+2)**3/2}function oe(e,t){return e==null?void 0:e.find(i=>i.cm===t)}const ce=Math.PI*2,lt=Object.freeze({glow:[22,22],spark:[10,22],star:[24,24],smoke:[26,26],petal:[18,24],flash:[96,96]});function ct(e,{type:t,color:i,width:s,height:r},n=0,l=0){e.save(),e.translate(n,l);const a=s/2,o=r/2;if(t==="glow"||t==="smoke"||t==="flash"){const c=e.createRadialGradient(a,o,0,a,o,s/2);c.addColorStop(0,t==="smoke"?i:"#ffffff"),c.addColorStop(t==="flash"?.22:.3,i),c.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=c,e.fillRect(0,0,s,r)}else if(t==="spark"){const c=e.createLinearGradient(a,r,a,0);c.addColorStop(0,"rgba(255,255,255,0)"),c.addColorStop(.46,i),c.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=c,e.fillRect(0,0,s,r),e.fillStyle="#ffffff",e.beginPath(),e.arc(a,o*.72,5,0,ce),e.fill()}else if(t==="star")e.strokeStyle=i,e.fillStyle="#ffffff",e.lineCap="round",e.lineWidth=2,e.beginPath(),e.moveTo(a,1),e.lineTo(a,r-1),e.moveTo(1,o),e.lineTo(s-1,o),e.moveTo(5,5),e.lineTo(s-5,r-5),e.moveTo(s-5,5),e.lineTo(5,r-5),e.stroke(),e.beginPath(),e.arc(a,o,4,0,ce),e.fill();else if(t==="petal"){e.save(),e.translate(a,o),e.rotate(-.32),e.scale(.72,1);const c=e.createLinearGradient(0,-r/2,0,r/2);c.addColorStop(0,"#ffffff"),c.addColorStop(.42,i),c.addColorStop(1,"rgba(105, 0, 25, 0.5)"),e.fillStyle=c,e.beginPath(),e.ellipse(0,0,8,15,0,0,ce),e.fill(),e.restore()}else throw e.restore(),new Error(`未知 firework texture 类型:${t}`);e.restore()}const K=Math.PI*2,ft=Object.freeze(["#ff385c","#ffad38","#ffe095"]),ht=20260808;function ut(e,t=0,i=1){return Math.max(t,Math.min(i,e))}function dt(e){let t=e>>>0;return()=>{t+=1831565813;let i=t;return i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61),((i^i>>>14)>>>0)/4294967296}}function mt(e){const t=e??ht;if(!Number.isInteger(t)||t<0||t>4294967295)throw new Error("firework seed 必须是 0 到 4294967295 之间的整数");return t}function Ae(e,t,i=1,s=!1){if(!Number.isFinite(t))throw new Error("firework envelope 时间必须是有限毫秒值");if(!(e!=null&&e.length))return i;const r=s?t-1e-6:t;if(r<e[0].startMs)return e[0].from;let n=e[0].from;for(const l of e){if(r<l.startMs)return n;if(r<l.endMs){if(l.interpolation==="hold")return l.from;const a=(r-l.startMs)/(l.endMs-l.startMs);return l.from+(l.to-l.from)*a}n=l.to}return n}function gt(e,t,i,s,r){const n=1-r,l=n**3,a=3*n*n*r,o=3*n*r*r,c=r**3;return{x:l*e.x+a*t.x+o*i.x+c*s.x,y:l*e.y+a*t.y+o*i.y+c*s.y}}function fe(e,t){var r;const i=e.markers||((r=e.lottie)==null?void 0:r.markers)||[],s=i instanceof Map?i.get(t):oe(i,t);if(!s)throw new Error(`Lottie 中缺少效果 marker:${t}`);return s}function Oe(e,t,i,s){var a,o;if(typeof e.resolveAnchor=="function"){const c=e.resolveAnchor(t,i);return{x:c.x*s.scale+s.offsetX,y:c.y*s.scale+s.offsetY}}const r=(a=e.layers)==null?void 0:a.get(t);if(!((o=r==null?void 0:r.ks)!=null&&o.p))throw new Error(`Lottie 中缺少效果锚点图层:${t}`);const[n,l]=B(r.ks.p,i,[0,0,0]);return{x:n*s.scale+s.offsetX,y:l*s.scale+s.offsetY}}function ge(e,t){return`${e}:${String(t).trim().toLowerCase()}`}function Je(e){return Object.freeze(ft.map((t,i)=>{const s=e==null?void 0:e[i];return typeof s=="string"&&s.trim()?s.trim():t}))}function qe(e={}){const t=Je(e.colors),i=[["glow","#ffffff"],["spark",t[1]],["glow",t[0]],["smoke","rgba(184, 184, 184, 0.24)"],["spark",t[0]],["star","#ffffff"],["glow",t[2]||t[1]],["petal",t[0]],["flash",t[0]]],s=[],r=new Set;for(const[n,l]of i){const a=ge(n,l);if(r.has(a))continue;r.add(a);const[o,c]=lt[n];s.push(Object.freeze({key:a,type:n,color:l,width:o,height:c}))}return Object.freeze({key:JSON.stringify(s.map(({key:n,width:l,height:a})=>[n,l,a])),cells:Object.freeze(s)})}function pt({startMs:e,endMs:t}){return Object.freeze([Object.freeze({startMs:e,endMs:t,from:1,to:0,interpolation:"linear"})])}function wt(e){const t=e*1e3;return Object.freeze([Object.freeze({startMs:t,endMs:t+28.8,from:0,to:1,interpolation:"linear"}),Object.freeze({startMs:t+28.8,endMs:t+100.8,from:1,to:.72,interpolation:"linear"}),Object.freeze({startMs:t+100.8,endMs:t+360,from:.5184,to:0,interpolation:"linear"})])}function bt(e){const t=e*1e3;return Object.freeze([Object.freeze({startMs:t,endMs:t+43.2,from:.18,to:1.35,interpolation:"linear"}),Object.freeze({startMs:t+43.2,endMs:t+115.2,from:1.35,to:.78,interpolation:"linear"}),Object.freeze({startMs:t+115.2,endMs:t+360,from:.78,to:2.25,interpolation:"linear"})])}function yt({effect:e,composition:t,layout:i={scale:1,offsetX:0,offsetY:0},resolvedQualityScale:s=1,seed:r=e==null?void 0:e.seed,maxParticleCount:n=Z*2,maxInstancesPerBatch:l=Z}){var X,$,se,we,be,ye,Ee;const a=mt(r),o=t.frameRate??((X=t.lottie)==null?void 0:X.fr);if(![o,i.scale,i.offsetX,i.offsetY,s].every(Number.isFinite)||!(o>0))throw new Error("firework 编译参数包含非有限数值");const c=fe(t,($=e.markers)==null?void 0:$.launch),d=fe(t,(se=e.markers)==null?void 0:se.burst),m=fe(t,(we=e.markers)==null?void 0:we.dismiss);for(const U of[c,d,m])if(!Number.isFinite(U.tm)||!Number.isFinite(U.dr)||U.dr<0)throw new Error(`firework marker 无效:${U.cm}`);const p=e.dismissDuration??pe,v=e.density??1,y=e.formationRadius??200;if(!Number.isFinite(p)||p<=0||!Number.isFinite(v)||v<0||!Number.isFinite(y)||y<0)throw new Error("firework dismissDuration 必须是正数,其他效果参数必须是有限非负数");const b=c.tm/o,g=c.dr/o,h=d.tm/o,u=Ge({frameRate:o,dismissFrame:m.tm,durationSeconds:p}),w=u.startSeconds;if(!(b<=h&&h*1e3<u.endMs))throw new Error("firework marker 时间顺序无效");const M=Oe(t,(be=e.anchors)==null?void 0:be.launch,c.tm,i),E=Oe(t,(ye=e.anchors)==null?void 0:ye.burst,d.tm,i),O=(t.width??((Ee=t.lottie)==null?void 0:Ee.w)??0)*i.scale,_=y*i.scale,k=Je(e.colors),T=v*s;if(!Number.isFinite(T))throw new Error("firework quality 参数无效");const R=je(Ue({launchDuration:g,density:v,resolvedQualityScale:s}),l);if(R.totalCount>n)throw new Error(`firework 粒子数量超过安全上限:${n}`);const S=dt(a),N=[],z=U=>{const I=ut((U-b)/Math.max(g,.001)),ae=I*I,Q=Math.min(O*.08,30*i.scale),ee=Math.abs(M.y-E.y);return gt(M,{x:M.x-Q,y:M.y-ee*.34},{x:E.x+Q*.55,y:E.y+ee*.28},E,ae)},P=(U,I)=>{const ae=R.emitterCounts[U];for(let Q=0;Q<ae;Q+=1){const ee=I.start+S()*(I.end-I.start),Se=I.angle+(S()-.5)*I.angleRange,Me=Math.max(0,I.velocity+(S()-.5)*2*I.velocityRange),ke=I.origin(ee);N.push(Object.freeze({emitterIndex:U,type:I.type,color:I.color,cellKey:ge(I.type,I.color),blend:I.blend,birthTime:ee,lifetime:Math.max(.08,I.lifetime+(S()-.5)*2*I.lifetimeRange),x:ke.x,y:ke.y,vx:Math.cos(Se)*Me,vy:Math.sin(Se)*Me,ax:I.gravityX||0,ay:I.gravityY||0,scale:Math.max(.08,I.scale+(S()-.5)*2*(I.scaleRange||0)),scaleSpeed:I.scaleSpeed||-.16,rotation:S()*K,spin:(I.spin||0)+(S()-.5)*2*(I.spinRange||0)}))}},j=b+g*.84;P(0,{type:"glow",color:"#ffffff",blend:"lighter",rate:105,start:b,end:j,lifetime:.24,lifetimeRange:.08,velocity:24*i.scale,velocityRange:10*i.scale,angle:0,angleRange:K,gravityY:0,scale:.72,scaleRange:.24,origin:z}),P(1,{type:"spark",color:k[1],blend:"lighter",rate:78,start:b,end:j,lifetime:.42,lifetimeRange:.12,velocity:38*i.scale,velocityRange:18*i.scale,angle:Math.PI/2,angleRange:Math.PI*.72,gravityY:38*i.scale,scale:.9,scaleRange:.32,spin:1.4,spinRange:2.8,origin:z}),P(2,{type:"glow",color:k[0],blend:"lighter",rate:48,start:b,end:j,lifetime:.5,lifetimeRange:.16,velocity:30*i.scale,velocityRange:16*i.scale,angle:Math.PI/2,angleRange:Math.PI*.88,gravityY:32*i.scale,scale:.5,scaleRange:.2,origin:z}),P(3,{type:"smoke",color:"rgba(184, 184, 184, 0.24)",blend:"source-over",rate:18,start:b,end:j,lifetime:.72,lifetimeRange:.18,velocity:18*i.scale,velocityRange:9*i.scale,angle:0,angleRange:K,gravityY:-8*i.scale,scale:.9,scaleRange:.32,scaleSpeed:.24,origin:z});const f=Math.max(_*1.22,118*i.scale);P(4,{type:"spark",color:k[1],blend:"lighter",rate:390,start:h,end:h+.11,lifetime:1.18,lifetimeRange:.28,velocity:f,velocityRange:f*.42,angle:0,angleRange:K,gravityY:72*i.scale,scale:.5,scaleRange:.19,scaleSpeed:-.1,spin:1.8,spinRange:4.2,origin:()=>E}),P(5,{type:"spark",color:k[0],blend:"lighter",rate:275,start:h,end:h+.11,lifetime:1.38,lifetimeRange:.34,velocity:f*.82,velocityRange:f*.46,angle:0,angleRange:K,gravityY:84*i.scale,scale:.4,scaleRange:.15,scaleSpeed:-.1,spin:-1.2,spinRange:4.8,origin:()=>E}),P(6,{type:"glow",color:"#ffffff",blend:"lighter",rate:145,start:h,end:h+.11,lifetime:.62,lifetimeRange:.12,velocity:f*.68,velocityRange:f*.26,angle:0,angleRange:K,gravityY:46*i.scale,scale:.44,scaleRange:.17,scaleSpeed:-.1,origin:()=>E});const A=h+.12,C=Math.max(_*.74,76*i.scale);P(7,{type:"star",color:"#ffffff",blend:"lighter",rate:265,start:A,end:A+.14,lifetime:1.5,lifetimeRange:.38,velocity:C,velocityRange:C*.48,angle:0,angleRange:K,gravityY:62*i.scale,scale:.4,scaleRange:.18,scaleSpeed:-.055,spin:1.8,spinRange:5.6,origin:()=>E}),P(8,{type:"glow",color:k[2]||k[1],blend:"lighter",rate:175,start:A,end:A+.14,lifetime:1.72,lifetimeRange:.42,velocity:C*.72,velocityRange:C*.5,angle:0,angleRange:K,gravityY:74*i.scale,scale:.24,scaleRange:.12,scaleSpeed:-.035,origin:()=>E}),P(9,{type:"petal",color:k[0],blend:"lighter",rate:48,start:A,end:A+.14,lifetime:1.55,lifetimeRange:.32,velocity:C*.62,velocityRange:C*.38,angle:0,angleRange:K,gravityX:5*i.scale,gravityY:86*i.scale,scale:.62,scaleRange:.26,scaleSpeed:-.08,spin:2.4,spinRange:6.2,origin:()=>E});const D=[],G=[];for(const U of N)(U.blend==="source-over"?D:G).push(U);const Y=pt(u),W=Object.freeze({type:"flash",color:k[0],cellKey:ge("flash",k[0]),x:E.x,y:E.y,birthTime:h,lifetime:.36,opacityEnvelope:wt(h),sizeEnvelope:bt(h)});return Object.freeze({seed:a,palette:k,atlasRecipeKey:qe(e).key,timeline:Object.freeze({launchStart:b,launchDuration:g,burstStart:h,dismissStart:w,dismissDuration:p}),launchPoint:Object.freeze(M),burstPoint:Object.freeze(E),particles:Object.freeze(N),smoke:Object.freeze(D),main:Object.freeze(G),flash:W,dismissEnvelope:Y})}function Fe(e){return typeof e=="string"?e.trim():""}function Ze(e={}){const t=e.playConfig||e,i=t.multiGiftEffect||{},s=t.giftUrl||t.assetUrl||"",r=t.giftRealSize||t.giftBodySize||null;let n=t.assetType;n||(s==="box"?n="box":typeof s=="string"&&(/\.(png|jpe?g|webp|gif|bmp)($|\?)/i.test(s)||s.startsWith("data:image/"))?n="image":n="svga");const l=i.lottie||t.lottieUrl||t.lottie,a=i.slotSize||t.slotSize||{width:60,height:60},o=Array.isArray(i.effects)?i.effects:Array.isArray(t.effects)?t.effects:[],c=Array.isArray(i.imgs)?i.imgs:Array.isArray(t.imgs)?t.imgs:[],d=e.imageSlots&&e.imageSlots.length?e.imageSlots:c.map(p=>({slot:p.slot,width:p.width,height:p.height,radius:p.radius})),m={...e.imageUrls||{},...Object.fromEntries(c.filter(p=>p.url!==void 0&&p.url!==null).map(p=>[p.slot,p.url]))};return{giftUrl:s,giftRealSize:r,giftBodySize:r,assetType:n,assetUrl:s,lottie:l,lottieUrl:l,slotSize:a,effects:o,imgs:c,imageSlots:d,imageUrls:m}}const Et=16,Ie=24;function he(e,t,i){if(!Number.isFinite(t)||t<1)throw new Error("firework GPU capability maxInstancesPerBatch 无效");if(e>t)throw new Error(`${i} 粒子数量超过 GPU batch 上限:${t}`)}function St(e,t,i){e.set([i.birthTime,i.lifetime,i.x,i.y,i.vx,i.vy,i.ax,i.ay,i.scale,i.scaleSpeed,i.rotation,i.spin,1,1,1,1],t)}function ue(e,t,i){const s=new Float32Array(e.length*Ie);return e.forEach((r,n)=>{const l=t.get(r.cellKey);if(!l)throw new Error(`firework atlas 缺少 cell:${r.cellKey}`);const a=n*Ie;St(s,a,r),s.set([l.width*i,l.height*i,.5,.5,l.u0,l.v0,l.u1,l.v1],a+Et)}),s}function Mt(e,t){var a,o;const i=((a=e[0])==null?void 0:a.startMs)??1/0,s=((o=e.at(-1))==null?void 0:o.endMs)??-1/0;if(!Number.isFinite(i)||!Number.isFinite(s)||!(s>i))return[];const r=new Set([i,s]);for(const c of[...e,...t])c.startMs>i&&c.startMs<s&&r.add(c.startMs),c.endMs>i&&c.endMs<s&&r.add(c.endMs);const n=[...r].sort((c,d)=>c-d),l=[];for(let c=0;c<n.length-1;c+=1){const d=n[c],m=n[c+1];if(!(m>d))continue;const p=(u,w=!1)=>Ae(e,u,1,w)*Ae(t,u,1,w),v=p(d),y=p(m,!0),b=(d+m)*.5,h=Math.abs(p(b)-(v+y)*.5)>1e-6?4:m-d;for(let u=d;u<m;u+=h){const w=Math.min(m,u+h);l.push({startMs:u,endMs:w,from:p(u),to:p(w,!0),interpolation:"linear"})}}return l}function kt({effect:e,composition:t,layout:i,resolvedQualityScale:s,seed:r,atlas:n,atlasCells:l,maxInstancesPerBatch:a}){const o=yt({effect:e,composition:t,layout:i,resolvedQualityScale:s,seed:r,maxParticleCount:a*2,maxInstancesPerBatch:a});he(o.smoke.length,a,"firework smoke"),he(o.main.length,a,"firework main"),he(1,a,"firework flash");const c={birthTime:o.flash.birthTime,lifetime:o.flash.lifetime,x:o.flash.x,y:o.flash.y,vx:0,vy:0,ax:0,ay:0,scale:1,scaleSpeed:0,rotation:0,spin:0,cellKey:o.flash.cellKey},d={format:"sprite-v2",atlas:n,opacity:1,compositeLayer:"behind-media"};return Object.freeze({model:o,descriptors:Object.freeze([Object.freeze({...d,count:o.smoke.length,instances:ue(o.smoke,l,i.scale),fadeMode:"lifetime",envelope:{opacity:o.dismissEnvelope},zIndex:0,blend:"normal",label:"multi-gift-firework-smoke"}),Object.freeze({...d,count:o.main.length,instances:ue(o.main,l,i.scale),fadeMode:"lifetime",envelope:{opacity:o.dismissEnvelope},zIndex:1,blend:"additive",label:"multi-gift-firework-main"}),Object.freeze({...d,count:1,instances:ue([c],l,i.scale),fadeMode:"none",envelope:{opacity:Mt(o.flash.opacityEnvelope,o.dismissEnvelope),size:o.flash.sizeEnvelope},zIndex:2,blend:"additive",label:"multi-gift-firework-flash"})])})}const re=4,x=256;function vt(e,t,i){if(i)return i(e,t);if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(e,t);if(typeof document<"u"){const s=document.createElement("canvas");return s.width=e,s.height=t,s}throw new Error("当前环境无法生成 firework sprite atlas")}function Tt(e){const t=new Map;let i=0,s=0,r=0;for(const n of e.cells){const l=n.width+re*2,a=n.height+re*2;if(i+l>x&&(i=0,s+=r,r=0),s+a>x)throw new Error("firework atlas recipe exceeds 256x256");const o=i+re,c=s+re;t.set(n.key,Object.freeze({...n,x:o,y:c,u0:o/x,v0:c/x,u1:(o+n.width)/x,v1:(c+n.height)/x})),i+=l,r=Math.max(r,a)}return t}function Rt(e,t={}){const i=qe(e),s=Tt(i),r=vt(x,x,t.canvasFactory);r.width=x,r.height=x;const n=r.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("无法创建 firework atlas Canvas2D context");n.clearRect(0,0,x,x);for(const o of s.values())ct(n,o,o.x,o.y);const l=n.getImageData(0,0,x,x),a=new Uint8Array(l.data.length);for(let o=0;o<l.data.length;o+=4){const c=l.data[o+3];a[o+3]=c,c===0?(a[o]=0,a[o+1]=0,a[o+2]=0):(a[o]=Math.round(l.data[o]*c/255),a[o+1]=Math.round(l.data[o+1]*c/255),a[o+2]=Math.round(l.data[o+2]*c/255))}return Object.freeze({key:i.key,width:x,height:x,pixels:a,cells:s})}const Ne=8,Ce=10;function At(e){const t=new RegExp(`^${e}_(\\d+)$`);return(i,s)=>{var l,a;const r=Number(((l=t.exec(i.nm))==null?void 0:l[1])??Number.MAX_SAFE_INTEGER),n=Number(((a=t.exec(s.nm))==null?void 0:a[1])??Number.MAX_SAFE_INTEGER);return r-n}}function _e(e,t,i,s){return!e||!t||!i||!s?1:Math.min(i/e,s/t)}function Ot(e){return Number.isFinite(e==null?void 0:e.x)&&Number.isFinite(e==null?void 0:e.y)?{x:e.x,y:e.y}:null}function q(e){const t=new Error(e);return t.name="AbortError",t}function Pe(e){var i,s,r,n;const t=(i=e==null?void 0:e.capabilities)==null?void 0:i.particles;return(t==null?void 0:t.backend)==="unavailable"||!((s=t==null?void 0:t.formats)!=null&&s.includes("sprite-v2"))||((r=t==null?void 0:t.spriteAtlas)==null?void 0:r.source)!=="rgba8-premultiplied"||!((n=t==null?void 0:t.compositeLayers)!=null&&n.includes("behind-media"))||(t==null?void 0:t.batchEnvelope)!==!0||(t==null?void 0:t.atomicBatchGroup)!==!0||!Number.isFinite(t==null?void 0:t.maxInstancesPerBatch)||typeof(e==null?void 0:e.createParticleAtlas)!="function"?null:t}function Le(e){const t=typeof navigator<"u"?navigator:{};return{quality:e,deviceMemory:t.deviceMemory,hardwareConcurrency:t.hardwareConcurrency,userAgent:t.userAgent}}function Ft(e,t){if(!Number.isFinite(e))return t;let i=t;for(;i-e>Math.PI;)i-=Math.PI*2;for(;i-e<-Math.PI;)i+=Math.PI*2;return i}async function It(e,t){if(e&&typeof e=="object")return e;if(typeof e=="string"&&e.trim().startsWith("{"))try{return JSON.parse(e)}catch(s){throw new Error(`Lottie JSON 解析失败:${s.message||"格式错误"}`)}if(typeof e!="string"||!e.trim())throw new Error("未提供有效的 Lottie 轨迹配置");const i=await fetch(e,{signal:t});if(!i.ok)throw new Error(`Lottie 加载失败 (${i.status})`);return i.json()}function ze(e,t,i){var l;const s=(l=e==null?void 0:e.capabilities)==null?void 0:l.motionTrack,r=(s==null?void 0:s.gpuMediaTypes)||[];return(s==null?void 0:s.mode)==="gpu-table"&&t==="svga"&&r.includes(t)?"gpu-table":"cpu-reference"}function Nt(e){if(!e||typeof e.getRenderInfo!="function")return null;try{return e.getRenderInfo()}catch{return null}}function Ct(e,t){var s,r;const i=[];return e.forEach((n,l)=>{if(n.kind!=="svga")return;const a=t[l],o=Nt(a),c={slotId:n.id,giftId:(a==null?void 0:a.id)??n.id,svgaFramePath:(o==null?void 0:o.svgaFramePath)??(o==null?void 0:o.selectedPath)??(o==null?void 0:o.path)??null};o!=null&&o.parentMotionMode&&(c.parentMotionMode=o.parentMotionMode);for(const d of["backend","pathState","frameTableBytes","commandTableBytes","drawBatchMode","drawCompatibleInstanceCount","fallbackReasons"])(o==null?void 0:o[d])!=null&&(c[d]=o[d]);i.push(c)}),{svgaFramePath:((s=i.find(n=>n.svgaFramePath!=null))==null?void 0:s.svgaFramePath)??null,parentMotionMode:((r=i.find(n=>n.parentMotionMode!=null))==null?void 0:r.parentMotionMode)??null,svgaFramePaths:i}}class _t{constructor(t,i,s,r,n){this.id=t,this.scope=i,this.completion=s,this.onStop=r,this.diagnosticsProvider=n}get diagnostics(){return this.diagnosticsProvider()}get state(){return this.scope.state}pause(){this.scope.pause()}resume(){this.scope.resume()}seek(t){this.scope.seek(t)}stop(){this.onStop()}destroy(){this.onStop()}}class He{constructor(t,i={}){this.host=t,this.options=i,this.sampleRate=Math.max(30,Math.min(120,i.sampleRate||60)),this.onStateChange=i.onStateChange||(()=>{}),this.onRenderFrame=i.onRenderFrame||(()=>{}),this.disabledSlotIds=new Set(i.disabledSlotIds||[]),this.playConfig=null,this.composition=null,this.assetLease=null,this.imageLeases=new Map,this.activePlayback=null,this.pendingScope=null,this.playEpoch=0,this.playIntentEpoch=0,this.preloadController=null,this.preloadEpoch=0,this._preloadDiagnostics=null,this.fireworkAtlas=null,this.fireworkAtlasCells=null,this.fireworkAtlasRecipeKey=null,this.fireworkQualityScale=1,this.particleCapabilityWarningEmitted=!1,this.destroyed=!1}get capabilities(){return this.host.capabilities}get preloadDiagnostics(){return this._preloadDiagnostics}async preload(t=this.options.playConfig,i=!1){var v,y,b;if(this.assertAlive(),!t)throw new Error("未提供 playConfig");this.cancelPlayback(!i),this.releaseLeases(),this.playConfig=null,this.composition=null,this._preloadDiagnostics=null;const s=Ze({...this.options,playConfig:t});if(s.assetType!=="svga"&&s.assetType!=="image")throw new Error(`GiftStage 插件不支持的礼物类型:${s.assetType}`);this.emitStateChange({status:"loading",message:"正在预加载 Lottie 与共享礼物资源"});const r=new AbortController;(v=this.preloadController)==null||v.abort(),this.preloadController=r;const n=++this.preloadEpoch;let l=null,a=new Map,o=null,c=null,d=null,m=1,p=!1;try{const g=await It(s.lottieUrl,r.signal);this.assertCurrentPreload(r,n);const h=Pe(this.host),u=We(g,{effects:s.effects,fireworkEnvironment:Le("auto"),maxInstancesPerBatch:Math.min(Z,(h==null?void 0:h.maxInstancesPerBatch)??Z)});u.length&&this.emitStateChange({validationFindings:u});const w=u.find(f=>f.code==="LOTTIE_TARGET_MARKER_MISSING");if(w)throw this.emitStateChange({status:"fallback",reason:w.code,message:"多礼物编排缺少 target_flight,交由宿主降级普通单礼物"}),new ne(w.code,"Lottie 中缺少有效的 target_flight marker",u,!0);const M=u.filter(f=>f.scope==="composition"&&f.severity==="error");if(M.length)throw new ne(M[0].code,`Lottie 合成校验失败:${M.map(f=>`${f.code}@${f.where}`).join(", ")}`,u);const E=new Set(u.filter(f=>f.scope==="slot"&&f.severity==="error"&&f.layer).map(f=>f.layer)),O=new Set(u.filter(f=>f.scope==="effect"&&Number.isInteger(f.effectIndex)).map(f=>f.effectIndex)),_=new Map((g.layers||[]).map(f=>[f.nm,f])),k=(g.layers||[]).filter(f=>/^slot_\d+$/.test(f.nm)&&f.ks&&!E.has(f.nm)).sort(At("slot"));if(!k.length)throw new ne("LOTTIE_SLOT_MISSING","Lottie 中没有可播放的 slot_N 礼物插槽图层",u);const T=oe(g.markers,"target_flight"),R=s.effects.filter((f,A)=>!O.has(A));l=await this.host.preload(s.assetType,s.assetUrl,r.signal),this.assertCurrentPreload(r,n);for(const f of s.imageSlots){const A=Fe(s.imageUrls[f.slot]);if(!A||!((y=_.get(f.slot))!=null&&y.ks)||E.has(f.slot))continue;const C=await this.host.preload("image",A,r.signal);(b=a.get(f.slot))==null||b.release(),a.set(f.slot,C),this.assertCurrentPreload(r,n)}const S={startFrame:T.tm,endFrame:T.tm+T.dr},N=new Map(k.map(f=>{var W,X;const A=((X=(W=f.ks)==null?void 0:W.s)==null?void 0:X.a)===1&&Array.isArray(f.ks.s.k)?f.ks.s.k.filter($=>Number.isFinite($==null?void 0:$.t)&&$.t>=S.startFrame&&$.t<=S.endFrame).sort(($,se)=>$.t-se.t):[],C=A[0],D=A[A.length-1];let G=Number.isFinite(C==null?void 0:C.t)?C.t:S.startFrame,Y=Number.isFinite(D==null?void 0:D.t)?D.t:S.endFrame;return G=Math.max(S.startFrame,Math.min(S.endFrame,G)),Y=Math.max(S.startFrame,Math.min(S.endFrame,Y)),Y>G||(G=S.startFrame,Y=S.endFrame),[f.nm,{start:G,end:Y}]})),z={lottie:g,width:g.w,height:g.h,frameRate:g.fr,inFrame:g.ip,outFrame:g.op,durationMs:(g.op-g.ip)/g.fr*1e3,layers:_,timeline:k,targetFlight:S,flightWindows:N},P=R.find(f=>f.type==="firework");if(P&&h){m=$e(Le(P.quality??"auto"));const f=Rt(P);if(f.width>h.spriteAtlas.maxSize||f.height>h.spriteAtlas.maxSize)throw new Error("firework atlas 超过当前 GPU capability");o=await this.host.createParticleAtlas({width:f.width,height:f.height,pixels:f.pixels,colorSpace:"srgb",alphaMode:"premultiplied",filter:"linear",label:`multi-gift-firework:${f.key}`}),c=f.cells,d=f.key,this.assertCurrentPreload(r,n)}this.assertCurrentPreload(r,n),this.playConfig={...s,effects:R},this.assetLease=l,this.imageLeases=a,this.composition=z,this.fireworkAtlas=o,this.fireworkAtlasCells=c,this.fireworkAtlasRecipeKey=d,this.fireworkQualityScale=m,p=!0;const j=ze(this.host,s.assetType,l.metadata);this._preloadDiagnostics=Object.freeze({parentMotionMode:j,motionMode:j}),this.emitStateChange({status:"ready",message:`${k.length} 个礼物轨道已就绪`,slotCount:k.length,backend:this.host.capabilities.backend,...this._preloadDiagnostics})}catch(g){if(!p){l==null||l.release();for(const h of a.values())h.release();o==null||o.destroy()}throw(g==null?void 0:g.name)==="AbortError"||this.destroyed||this.preloadEpoch!==n||r.signal.aborted?q("多礼物资源预加载已取消"):g}finally{this.preloadController===r&&(this.preloadController=null)}}async play(t={}){var v,y,b;if(this.assertAlive(),!Object.prototype.hasOwnProperty.call(t,"target"))throw new Error("play() 必须显式传入 target,值可为 null 或 undefined");const i=++this.playIntentEpoch;if(!this.composition&&(await this.preload(void 0,!0),this.playIntentEpoch!==i)||(this.assertAlive(),this.playIntentEpoch!==i))throw q("多礼物播放已取消");this.cancelPlayback(!1);const s=this.composition,r=this.playConfig,n=Ot(t.target),l=this.host.getViewport(),a=s.width>0?l.width/s.width:1,o=0,c=(l.height-s.height*a)*.5,d=this.host.createPlaybackScope(`multi-gift-${Date.now()}`),m=this.playEpoch;this.pendingScope={scope:d,playEpoch:m};const p=s.timeline.map((g,h)=>{var u,w,M,E,O,_,k,T;return{id:g.nm,layer:g,kind:r.assetType,source:r.assetUrl,width:this.assetLease.metadata.width*_e((u=r.giftBodySize)==null?void 0:u.width,(w=r.giftBodySize)==null?void 0:w.height,(M=r.slotSize)==null?void 0:M.width,(E=r.slotSize)==null?void 0:E.height)*a,height:this.assetLease.metadata.height*_e((O=r.giftBodySize)==null?void 0:O.width,(_=r.giftBodySize)==null?void 0:_.height,(k=r.slotSize)==null?void 0:k.width,(T=r.slotSize)==null?void 0:T.height)*a,zIndex:Ce+h,redirect:!0}});for(const g of r.imageSlots){const h=this.imageLeases.get(g.slot),u=s.layers.get(g.slot);!h||!(u!=null&&u.ks)||p.push({id:g.slot,layer:u,kind:"image",source:Fe(r.imageUrls[g.slot]),width:g.width*a,height:g.height*a,zIndex:Ce+p.length,redirect:!1})}try{const g=await Promise.all(p.map(f=>d.addGift({type:f.kind,source:f.source,x:0,y:0,width:f.width,height:f.height,zIndex:f.zIndex,opacity:0,loop:f.kind==="svga"?0:void 0,mute:f.kind==="svga"?!0:void 0,clearsAfterStop:!1})));this.assertCurrentPlay(d,m);const h=this.compileMotionTrack(p,n,{scale:a,offsetX:o,offsetY:c}),u=d.createMotionTrack(h);g.forEach((f,A)=>d.bindMotion(f,u,A));const w=()=>{var C,D;const f=Ct(p,g),A=f.parentMotionMode??((C=this._preloadDiagnostics)==null?void 0:C.parentMotionMode)??ze(this.host,r.assetType,(D=this.assetLease)==null?void 0:D.metadata);return Object.freeze({...f,parentMotionMode:A,motionMode:A})},M=w(),E=(v=r.effects)==null?void 0:v.find(f=>f.type==="firework"),O=Pe(this.host);if(E&&O&&this.fireworkAtlas&&this.fireworkAtlasCells&&typeof d.createParticleBatchGroup=="function")try{const f=kt({effect:E,composition:s,layout:{scale:a,offsetX:o,offsetY:c},resolvedQualityScale:this.fireworkQualityScale,seed:E.seed,atlas:this.fireworkAtlas,atlasCells:this.fireworkAtlasCells,maxInstancesPerBatch:O.maxInstancesPerBatch});d.createParticleBatchGroup(f.descriptors)}catch(f){this.emitStateChange({effectWarning:`firework 编译失败,已跳过:${f instanceof Error?f.message:String(f)}`})}else E&&(this.particleCapabilityWarningEmitted||(this.particleCapabilityWarningEmitted=!0,this.emitStateChange({effectWarning:"当前核心缺少 sprite-v2/atlas/envelope/atomic group 能力,已跳过 firework;未创建 Canvas2D 后端"})));let _;const k=new Promise(f=>{_=f});let T=!1,R;const S=f=>{T||(T=!0,_({status:f}))},N=()=>{d.state!=="destroyed"&&d.destroy(),this.activePlayback===R&&(this.activePlayback=null),T||(this.emitStateChange({status:"stopped",message:"播放已停止"}),S("stopped"))};R=new _t(d.id,d,k,N,w),this.assertCurrentPlay(d,m),this.pendingScope=null,this.activePlayback=R;let z=0,P=0,j=!1;return d.onFrame(({nowMs:f,deltaMs:A})=>{const C=Math.min(s.outFrame,s.inFrame+f*s.frameRate/1e3);this.emitRenderFrame(C),j||(j=!0,this.emitStateChange({status:"playing",diagnosticsRefreshed:!0,...R.diagnostics})),z+=A,P+=1,z>=500&&(this.emitStateChange({fps:Math.round(P*1e3/z)}),z=0,P=0)}),d.onFinish(()=>{T||(this.activePlayback===R&&(this.activePlayback=null),d.destroy(),this.emitStateChange({status:"finished",message:"本轮编排播放完成"}),S("finished"))}),d.start({durationMs:s.durationMs}),this.emitStateChange({status:"playing",message:`${g.length} 个实例由 GiftStage 统一时钟驱动`,...M}),R}catch(g){throw((y=this.pendingScope)==null?void 0:y.scope)===d&&(this.pendingScope=null),((b=this.activePlayback)==null?void 0:b.scope)===d?this.activePlayback.stop():d.state!=="destroyed"&&d.destroy(),(g==null?void 0:g.name)==="AbortError"||this.destroyed||this.playEpoch!==m?q("多礼物播放已取消"):g}}compileMotionTrack(t,i,s){const r=this.composition,n=1e3/this.sampleRate,l=Math.ceil(r.durationMs/n)+1,a=new Float32Array(t.length*l*Ne);return t.forEach((o,c)=>{let d=Number.NaN;for(let m=0;m<l;m+=1){const p=Math.min(r.durationMs,m*n),v=r.inFrame+p*r.frameRate/1e3,y=this.evaluateLayer(o,v,i,s);y.rotation=Ft(d,y.rotation),d=y.rotation;const b=(c*l+m)*Ne;a[b]=y.x,a[b+1]=y.y,a[b+2]=y.scaleX,a[b+3]=y.scaleY,a[b+4]=y.rotation,a[b+5]=y.opacity,a[b+6]=y.visible?1:0,a[b+7]=m+1<l&&y.interpolateToNext?1:0}}),{trackCount:t.length,sampleCount:l,sampleIntervalMs:n,durationMs:r.durationMs,samples:a,label:"lottie-multi-gift"}}evaluateLayer(t,i,s,r){const n=t.layer;let[l,a]=B(n.ks.p,i,[0,0,0]);const[o,c]=B(n.ks.s,i,[100,100,100]),d=n.ks.r??n.ks.rz,[m]=B(d,i,[0]),[p]=B(n.ks.o,i,[100]),v=i>=n.ip&&i<n.op&&p>0&&!this.disabledSlotIds.has(t.id);let y=l*r.scale+r.offsetX,b=a*r.scale+r.offsetY;if(t.redirect){const h=this.composition.flightWindows.get(n.nm)||this.composition.targetFlight;if(i>=h.start){const[u,w]=B(n.ks.p,h.start,[l,a,0]),M=u*r.scale+r.offsetX,E=w*r.scale+r.offsetY;if(s){const O=h.end-h.start,_=O>0?Math.max(0,Math.min(1,(i-h.start)/O)):0,k=Be(_);y=M+(s.x-M)*k,b=E+(s.y-E)*k}else y=M,b=E}}const g=[n.ks.p,n.ks.s,d,n.ks.o].some(h=>{if((h==null?void 0:h.a)!==1)return!1;const u=h.k||[];return u.some((w,M)=>{const E=u[M+1];return E&&i>=w.t&&i<E.t&&w.h===1})});return{x:y,y:b,scaleX:o/100,scaleY:c/100,rotation:m*Math.PI/180,opacity:Math.max(0,Math.min(1,p/100)),visible:v,interpolateToNext:!g}}setDisabledSlots(t=[]){this.disabledSlotIds=new Set(t)}stop(){this.cancelPlayback(!0)}cancelPlayback(t){t&&(this.playIntentEpoch+=1),this.playEpoch+=1;const i=this.pendingScope;this.pendingScope=null,i&&i.scope.state!=="destroyed"&&i.scope.destroy();const s=this.activePlayback;this.activePlayback=null,s==null||s.stop()}destroy(){var t;this.destroyed||(this.destroyed=!0,this.preloadEpoch+=1,(t=this.preloadController)==null||t.abort(),this.preloadController=null,this.stop(),this.releaseLeases(),this.composition=null,this._preloadDiagnostics=null)}releaseLeases(){var t,i;(t=this.assetLease)==null||t.release(),this.assetLease=null;for(const s of this.imageLeases.values())s.release();this.imageLeases.clear(),(i=this.fireworkAtlas)==null||i.destroy(),this.fireworkAtlas=null,this.fireworkAtlasCells=null,this.fireworkAtlasRecipeKey=null}assertAlive(){if(this.destroyed)throw new Error("GiftStage multi-gift plugin is destroyed")}emitStateChange(t){try{this.onStateChange(t)}catch{}}emitRenderFrame(t){try{this.onRenderFrame(t)}catch{}}assertCurrentPlay(t,i){var s;if(this.destroyed||this.playEpoch!==i||((s=this.pendingScope)==null?void 0:s.scope)!==t||t.state==="destroyed")throw q("多礼物播放已取消")}assertCurrentPreload(t,i){if(this.destroyed||t.signal.aborted||this.preloadEpoch!==i||this.preloadController!==t)throw q("多礼物资源预加载已取消")}}function Qe(e={}){return{name:"giftstage-plugin-multi-gift",apiVersion:1,setup(t){return new He(t,e)}}}function H(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xe(e,t){let i;try{i=JSON.parse(e)}catch{throw new Error(`${t}不是合法 JSON`)}if(!H(i))throw new Error(`${t}必须是 JSON 对象`);return i}function et(e,t){if(!H(e)||!Number.isFinite(e.width)||e.width<=0||!Number.isFinite(e.height)||e.height<=0)throw new Error(`${t}必须包含大于 0 的 width 和 height`);return{width:e.width,height:e.height}}function Pt(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("multiGiftEffect.imgs 必须是数组");return e.map((t,i)=>{if(!H(t)||typeof t.slot!="string"||!/^img_slot_\d+$/.test(t.slot))throw new Error(`multiGiftEffect.imgs[${i}].slot 必须是 img_slot_xx`);if(et(t,`multiGiftEffect.imgs[${i}]`),t.radius!==void 0&&(!Number.isFinite(t.radius)||t.radius<0))throw new Error(`multiGiftEffect.imgs[${i}].radius 必须是大于等于 0 的数字`);return{...t}})}function De(e){if(!H(e)||!Array.isArray(e.layers))throw new Error("multiGiftEffect.lottie 必须包含 layers 数组");let t=0;for(const i of e.layers){const s=/^slot_(\d+)$/.exec((i==null?void 0:i.nm)||"");s&&(t=Math.max(t,Number(s[1])))}if(!t)throw new Error("multiGiftEffect.lottie 中至少需要一个 slot_xx 礼物插槽");return t}function Lt(e){const t=typeof e=="string"?xe(e,"本地特效配置"):e;if(!H(t))throw new Error("本地特效配置必须是 JSON 对象");if(!Object.prototype.hasOwnProperty.call(t,"lottie"))throw Array.isArray(t.layers)?new Error("请上传 multiGiftEffect 配置,不能直接上传纯 Lottie JSON"):new Error("multiGiftEffect.lottie 不能为空");let i,s;if(H(t.lottie))i=t.lottie;else if(typeof t.lottie=="string"&&t.lottie.trim()){const l=t.lottie.trim();l.startsWith("{")?i=xe(l,"multiGiftEffect.lottie"):s=l}else throw new Error("multiGiftEffect.lottie 必须是 Lottie JSON 对象、JSON 字符串或 URL");const r=et(t.slotSize,"multiGiftEffect.slotSize"),n=t.effects===void 0?[]:t.effects;if(!Array.isArray(n))throw new Error("multiGiftEffect.effects 必须是数组");return{lottieJson:i,lottieUrl:s,slotSize:r,effects:n.map(l=>({...l})),imgs:Pt(t.imgs)}}async function zt(e,t=fetch){if(e.lottieJson)return{lottieJson:e.lottieJson,slotCount:De(e.lottieJson)};let i;try{i=await t(e.lottieUrl)}catch(r){throw new Error(`无法加载 lottie URL:${r.message||"网络错误"}`)}if(!i.ok)throw new Error(`无法加载 lottie URL(${i.status})`);let s;try{s=await i.json()}catch{throw new Error("lottie URL 返回的内容不是合法 JSON")}return{lottieJson:s,slotCount:De(s)}}exports.GiftStageMultiGiftPluginApi=He;exports.MultiGiftValidationError=ne;exports.bezierEase=Ke;exports.createGiftStageMultiGiftPlugin=Qe;exports.default=Qe;exports.easeInOutCubic=at;exports.easeOutCubic=Be;exports.findMarker=oe;exports.findUnsupportedCapabilities=rt;exports.inspectLocalLottie=zt;exports.normalizePlayConfig=Ze;exports.parseLocalMultiGiftEffect=Lt;exports.spatialBezierPoint=ot;exports.validateMultiGiftComposition=We;exports.valueAt=B;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
GiftStageCapabilities,
|
|
3
|
+
GiftStagePlugin,
|
|
4
|
+
GiftStagePluginHost,
|
|
5
|
+
PlaybackScopeState,
|
|
6
|
+
} from '@taole/giftstage';
|
|
7
|
+
|
|
8
|
+
export interface ImageSlotItem {
|
|
9
|
+
slot: string;
|
|
10
|
+
url: string;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
radius?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface EffectConfigItem {
|
|
17
|
+
type: string;
|
|
18
|
+
anchors?: Record<string, string>;
|
|
19
|
+
markers?: Record<string, string>;
|
|
20
|
+
colors?: string[];
|
|
21
|
+
seed?: number;
|
|
22
|
+
density?: number;
|
|
23
|
+
quality?: 'auto' | 'low' | 'medium' | 'high' | number;
|
|
24
|
+
/** Fade-out seconds; its derived millisecond interval must be finite and strictly increasing. */
|
|
25
|
+
dismissDuration?: number;
|
|
26
|
+
formationRadius?: number;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface MultiGiftEffectConfig {
|
|
31
|
+
lottie: string | Record<string, unknown>;
|
|
32
|
+
slotSize: { width: number; height: number };
|
|
33
|
+
effects?: EffectConfigItem[];
|
|
34
|
+
imgs?: ImageSlotItem[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PlayConfig {
|
|
38
|
+
giftUrl: string;
|
|
39
|
+
giftRealSize?: { width: number; height: number };
|
|
40
|
+
giftBodySize?: { width: number; height: number };
|
|
41
|
+
assetType?: 'svga' | 'image';
|
|
42
|
+
multiGiftEffect: MultiGiftEffectConfig;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface NormalizedPlayConfig {
|
|
46
|
+
giftUrl: string;
|
|
47
|
+
giftRealSize: { width: number; height: number } | null;
|
|
48
|
+
giftBodySize: { width: number; height: number } | null;
|
|
49
|
+
assetType: 'svga' | 'image';
|
|
50
|
+
assetUrl: string;
|
|
51
|
+
lottie: string | Record<string, unknown>;
|
|
52
|
+
lottieUrl: string | Record<string, unknown>;
|
|
53
|
+
slotSize: { width: number; height: number };
|
|
54
|
+
effects: EffectConfigItem[];
|
|
55
|
+
imgs: ImageSlotItem[];
|
|
56
|
+
imageSlots: Array<{ slot: string; width: number; height: number; radius?: number }>;
|
|
57
|
+
imageUrls: Record<string, string>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface GiftStageMultiGiftPluginOptions {
|
|
61
|
+
playConfig?: PlayConfig;
|
|
62
|
+
sampleRate?: 30 | 60 | 120 | number;
|
|
63
|
+
disabledSlotIds?: string[];
|
|
64
|
+
onStateChange?: (state: GiftStageMultiGiftState) => void;
|
|
65
|
+
onRenderFrame?: (frame: number) => void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Parent Lottie track transport selected by the core GiftStage host. */
|
|
69
|
+
export type GiftStageMultiGiftParentMotionMode = 'gpu-table' | 'cpu-reference';
|
|
70
|
+
|
|
71
|
+
/** SVGA frame-evaluation path reported by GiftStage's `gift.getRenderInfo()`. */
|
|
72
|
+
export type GiftStageMultiGiftSvgaFramePath =
|
|
73
|
+
| 'gpu-direct'
|
|
74
|
+
| 'gpu-hybrid'
|
|
75
|
+
| 'cpu-reference';
|
|
76
|
+
|
|
77
|
+
export interface GiftStageMultiGiftPreloadDiagnostics {
|
|
78
|
+
parentMotionMode: GiftStageMultiGiftParentMotionMode;
|
|
79
|
+
/** Compatibility alias retained for earlier plugin consumers. */
|
|
80
|
+
motionMode: GiftStageMultiGiftParentMotionMode;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface GiftStageMultiGiftSvgaFramePathDiagnostic {
|
|
84
|
+
slotId: string;
|
|
85
|
+
giftId: string;
|
|
86
|
+
svgaFramePath: GiftStageMultiGiftSvgaFramePath | null;
|
|
87
|
+
parentMotionMode?: GiftStageMultiGiftParentMotionMode;
|
|
88
|
+
backend?: 'webgpu' | 'webgl2' | 'webgl1';
|
|
89
|
+
pathState?: 'preparing' | 'settled' | 'fallback';
|
|
90
|
+
frameTableBytes?: number;
|
|
91
|
+
commandTableBytes?: number;
|
|
92
|
+
drawBatchMode?: 'multi-slot' | 'per-slot' | 'hybrid-scheduled';
|
|
93
|
+
drawCompatibleInstanceCount?: number;
|
|
94
|
+
fallbackReasons?: string[];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface GiftStageMultiGiftPlaybackDiagnostics extends GiftStageMultiGiftPreloadDiagnostics {
|
|
98
|
+
/** Primary path for the shared SVGA resource used by this formation. */
|
|
99
|
+
svgaFramePath: GiftStageMultiGiftSvgaFramePath | null;
|
|
100
|
+
/** Per-slot snapshots; useful if a future plan contains mixed SVGA resources. */
|
|
101
|
+
svgaFramePaths: GiftStageMultiGiftSvgaFramePathDiagnostic[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface GiftStageMultiGiftState extends Record<string, unknown> {
|
|
105
|
+
status?: 'loading' | 'ready' | 'playing' | 'paused' | 'stopped' | 'finished' | 'fallback';
|
|
106
|
+
parentMotionMode?: GiftStageMultiGiftParentMotionMode;
|
|
107
|
+
/** Compatibility alias retained for existing state observers. */
|
|
108
|
+
motionMode?: GiftStageMultiGiftParentMotionMode;
|
|
109
|
+
svgaFramePath?: GiftStageMultiGiftSvgaFramePath | null;
|
|
110
|
+
svgaFramePaths?: GiftStageMultiGiftSvgaFramePathDiagnostic[];
|
|
111
|
+
/** True for the one post-bind state refresh emitted after the first playback frame tick. */
|
|
112
|
+
diagnosticsRefreshed?: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface GiftStageMultiGiftPlaybackResult {
|
|
116
|
+
status: 'finished' | 'stopped';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export type LottieValidationSeverity = 'error' | 'warning' | 'info';
|
|
120
|
+
export type LottieValidationScope = 'composition' | 'slot' | 'effect';
|
|
121
|
+
|
|
122
|
+
export interface LottieValidationFinding {
|
|
123
|
+
code: string;
|
|
124
|
+
severity: LottieValidationSeverity;
|
|
125
|
+
scope: LottieValidationScope;
|
|
126
|
+
where: string;
|
|
127
|
+
layer?: string;
|
|
128
|
+
effectIndex?: number;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export class MultiGiftValidationError extends Error {
|
|
132
|
+
constructor(
|
|
133
|
+
code: string,
|
|
134
|
+
message: string,
|
|
135
|
+
findings?: LottieValidationFinding[],
|
|
136
|
+
recoverable?: boolean,
|
|
137
|
+
);
|
|
138
|
+
readonly code: string;
|
|
139
|
+
readonly findings: LottieValidationFinding[];
|
|
140
|
+
readonly recoverable: boolean;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface GiftStageMultiGiftPlayback {
|
|
144
|
+
readonly id: string;
|
|
145
|
+
readonly state: PlaybackScopeState;
|
|
146
|
+
readonly completion: Promise<GiftStageMultiGiftPlaybackResult>;
|
|
147
|
+
readonly diagnostics: GiftStageMultiGiftPlaybackDiagnostics;
|
|
148
|
+
pause(): void;
|
|
149
|
+
resume(): void;
|
|
150
|
+
seek(timeMs: number): void;
|
|
151
|
+
stop(): void;
|
|
152
|
+
destroy(): void;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export class GiftStageMultiGiftPluginApi {
|
|
156
|
+
constructor(host: GiftStagePluginHost, options?: GiftStageMultiGiftPluginOptions);
|
|
157
|
+
readonly capabilities: GiftStageCapabilities;
|
|
158
|
+
readonly preloadDiagnostics: GiftStageMultiGiftPreloadDiagnostics | null;
|
|
159
|
+
preload(playConfig?: PlayConfig): Promise<void>;
|
|
160
|
+
play(options: { target: { x: number; y: number } | null | undefined }): Promise<GiftStageMultiGiftPlayback>;
|
|
161
|
+
setDisabledSlots(slotIds?: string[]): void;
|
|
162
|
+
stop(): void;
|
|
163
|
+
destroy(): void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export type GiftStageMultiGiftPlugin = GiftStagePlugin<GiftStageMultiGiftPluginApi>;
|
|
167
|
+
|
|
168
|
+
export function createGiftStageMultiGiftPlugin(
|
|
169
|
+
options?: GiftStageMultiGiftPluginOptions,
|
|
170
|
+
): GiftStageMultiGiftPlugin;
|
|
171
|
+
|
|
172
|
+
export default createGiftStageMultiGiftPlugin;
|
|
173
|
+
|
|
174
|
+
export function normalizePlayConfig(
|
|
175
|
+
options?: GiftStageMultiGiftPluginOptions | { playConfig?: PlayConfig },
|
|
176
|
+
): NormalizedPlayConfig;
|
|
177
|
+
|
|
178
|
+
export function parseLocalMultiGiftEffect(text: string | Record<string, unknown>): {
|
|
179
|
+
lottieJson?: Record<string, unknown>;
|
|
180
|
+
lottieUrl?: string;
|
|
181
|
+
slotSize: { width: number; height: number };
|
|
182
|
+
effects: EffectConfigItem[];
|
|
183
|
+
imgs: ImageSlotItem[];
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export function inspectLocalLottie(
|
|
187
|
+
config: { lottieJson?: Record<string, unknown>; lottieUrl?: string },
|
|
188
|
+
fetchImpl?: typeof fetch,
|
|
189
|
+
): Promise<{ lottieJson: Record<string, unknown>; slotCount: number }>;
|
|
190
|
+
|
|
191
|
+
export function bezierEase(progress: number, out: unknown, inn: unknown): number;
|
|
192
|
+
export function easeInOutCubic(progress: number): number;
|
|
193
|
+
export function easeOutCubic(progress: number): number;
|
|
194
|
+
export function findMarker(markers: unknown[], name: string): unknown;
|
|
195
|
+
export function findUnsupportedCapabilities(lottie: unknown): LottieValidationFinding[];
|
|
196
|
+
export function validateMultiGiftComposition(
|
|
197
|
+
lottie: unknown,
|
|
198
|
+
options?: { effects?: EffectConfigItem[] },
|
|
199
|
+
): LottieValidationFinding[];
|
|
200
|
+
export function spatialBezierPoint(
|
|
201
|
+
progress: number,
|
|
202
|
+
start: number[],
|
|
203
|
+
end: number[],
|
|
204
|
+
outTangent: number[],
|
|
205
|
+
inTangent: number[],
|
|
206
|
+
): number[];
|
|
207
|
+
export function valueAt(property: unknown, frame: number, fallback: unknown): unknown;
|