swf2es 0.1.14 → 0.1.16
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/README.md +4 -4
- package/dist/chunks/207ce410b343c034.js +2 -0
- package/dist/chunks/207ce410b343c034.js.map +1 -0
- package/dist/codegen.wasm +0 -0
- package/dist/swf2es.js +17 -16
- package/dist/swf2es.js.map +1 -1
- package/dist/worker.js +9 -9
- package/dist/worker.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/930051e19c278c65.js +0 -2
- package/dist/chunks/930051e19c278c65.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,18 +9,18 @@ modules that loads from a CDN, with nothing to install or build. A page
|
|
|
9
9
|
that has a bundler installs `@swf2es/web` instead.
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
|
-
<script type="module" src="https://unpkg.com/swf2es@0.1.
|
|
12
|
+
<script type="module" src="https://unpkg.com/swf2es@0.1.16"></script>
|
|
13
13
|
|
|
14
14
|
<swf2es-player src="movie.swf" width="800" height="600"></swf2es-player>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
jsDelivr serves it too, at `https://cdn.jsdelivr.net/npm/swf2es@0.1.
|
|
17
|
+
jsDelivr serves it too, at `https://cdn.jsdelivr.net/npm/swf2es@0.1.16`.
|
|
18
18
|
The module exports what `@swf2es/web` does. To call it, import it from the
|
|
19
19
|
same URL, so that the page has one copy:
|
|
20
20
|
|
|
21
21
|
```html
|
|
22
22
|
<script type="module">
|
|
23
|
-
import { configure, watchFlash } from "https://unpkg.com/swf2es@0.1.
|
|
23
|
+
import { configure, watchFlash } from "https://unpkg.com/swf2es@0.1.16";
|
|
24
24
|
|
|
25
25
|
configure({ cache: true }); // keep compiled modules in IndexedDB
|
|
26
26
|
watchFlash(); // the page's Flash <object> and <embed> tags become players
|
|
@@ -37,7 +37,7 @@ Name a version in the URL. Until 1.0, a minor release (0.2) may change
|
|
|
37
37
|
what a page sees, so pin at least the minor version: unpkg's
|
|
38
38
|
`swf2es@0.1` takes 0.1's fixes as they are released, and redirects to the
|
|
39
39
|
exact version, whose files the page then loads together. On jsDelivr, pin
|
|
40
|
-
the exact version (`swf2es@0.1.
|
|
40
|
+
the exact version (`swf2es@0.1.16`): it serves a range without
|
|
41
41
|
redirecting, so the files the main one loads later would come from
|
|
42
42
|
whatever version the range names by then.
|
|
43
43
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const __rspack_esm_ids=[92];export const __webpack_modules__={4655(e,r,t){t.d(r,{Stage3DSession:()=>T});var o=t(1238);let a=["always","never","less","lessEqual","equal","notEqual","greaterEqual","greater"],s=["none","back","front","frontAndBack"],n=["keep","zero","set","incrementSaturate","decrementSaturate","invert","incrementWrap","decrementWrap"],i=["zero","one","sourceColor","oneMinusSourceColor","sourceAlpha","oneMinusSourceAlpha","destinationColor","oneMinusDestinationColor","destinationAlpha","oneMinusDestinationAlpha"],l=["clamp","repeat_u_clamp_v","clamp_u_repeat_v","repeat"],c=["nearest","linear","anisotropic2x","anisotropic4x","anisotropic8x","anisotropic16x"],u=["mipnone","mipnearest","miplinear"],d=["float1","float2","float3","float4","bytes4"];class h extends Error{}class f extends Error{}class g extends Error{}class p extends Error{reason;sampler;constructor(e,r=-1){super(`Invalid texture binding: ${e}`),this.reason=e,this.sampler=r}}class m extends Error{reason;constructor(e,r){super(r),this.reason=e}}new Int32Array(4),new Int32Array(16),new Uint8Array(8),new Uint8Array(0);var w=t(7291),x=t(5195),y=t(5592);function b(e){throw new m("unsupported",`Context3D does not support ${e} yet`)}function E(e){return"bgra"!==e&&"compressed"!==e&&"compressedAlpha"!==e&&b(`the texture format "${e}"`),e}let v={disposed:3694,backBuffer:3698,limit:3691,bufferAllocation:3672,textureAllocation:3684,nativeShader:3613,program:3600,indexBuffer:3601,indexData:3601,vertexBinding:3611,vertexStream:3608,vertexData:3609,drawRange:3603,triangleCount:3602,textureSize:3683,compressedSize:3745,textureShape:3678,texturePowerOfTwo:3682,textureUpload:3679,range:3669,operation:3699,unsupported:3708,agalLength:3615,agalMagic:3616,agalVersion:3617,agalStageMarker:3618,agalVertexStage:3631,agalFragmentStage:3630,agalStage:3619,agalTokens:3629,agalOpcode:3621,agalUnusedSource:3636,agalAttributeStage:3645,agalAttributeWrite:3651,agalAttributeIndex:3658,agalConstantWrite:3652,agalConstantIndex:3659,agalTemporaryIndex:3661,agalTemporaryRead:3647,agalTemporaryComponent:3648,agalOutputRead:3646,agalOutputIndex:3660,agalVertexOutput:3635,agalFragmentOutput:3634,agalColorMask:3701,agalVaryingIndex:3657,agalVaryingRead:3644,agalVaryingWrite:3650,agalVaryingMissing:3632,agalVaryingPartial:3633,agalRegister:3655,agalIndirect:3639,agalSourceEncoding:3643,agalDiscard:3703,agalMask:3653,agalReserved:3654,agalSampler:3668},k={drawRange:"RangeError",texturePowerOfTwo:"ArgumentError",compressedSize:"ArgumentError"};function D(e){return{id:v[e.reason],kind:k[e.reason]??"Error"}}var A=t(6023);class T{layer=document.createElement("div");slots=new Map;host;close;destroyed=!1;x=0;y=0;sx=1;sy=1;box;isolation;constructor(e,r,t,v){var k;let T;this.box=e,this.isolation=e.style.isolation,this.layer.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:0";let $=(k=this.layer,T=new Map,{create(e,r){var o,a;let s,n;if(T.has(e))throw Error("Stage3D surface must be removed before recreation");let i=t(e),l=(o=i.canvas,a=r,s=e=>{e.preventDefault(),a.lost()},n=()=>a.restored(),o.addEventListener("webglcontextlost",s),o.addEventListener("webglcontextrestored",n),()=>{o.removeEventListener("webglcontextlost",s),o.removeEventListener("webglcontextrestored",n)});try{i.canvas.style.position="absolute",i.canvas.style.zIndex=String(e),k.append(i.canvas),T.set(e,{...i,detach:l})}catch(e){throw l(),i.context.dispose(),i.canvas.remove(),i.destroy?.(),e}return i.context},place(e,r,t,o){let a=T.get(e);if(a){let e=a.canvas.style;e.left=`${r}px`,e.top=`${t}px`,e.visibility=o?"visible":"hidden"}},remove(e){let r=T.get(e);r&&(r.detach(),r.canvas.remove(),T.delete(e),r.destroy?.())}});this.host=$;try{e.append(this.layer),e.style.isolation="isolate",this.close=function(e,r){let t,v,k,T,$,M,B,S,R,C,F,P,O,W,V,z,I,_,N,j,Z,q,L={},H=(t=new WeakMap,v=new WeakSet,k=new WeakMap,T=new WeakMap,$=new Map,M=new Map,B=new WeakMap,S=new WeakMap,R=new WeakMap,C=new WeakMap,F=!1,P=e=>{M.get(e.owner)?.resources.delete(e),O.unregister(e),e.value.dispose(),e.disposed=!0},O=new FinalizationRegistry(e=>{M.get(e.owner)?.resources.has(e)&&P(e)}),W=e=>{for(let r of e.resources)O.unregister(r);e.resources.clear(),e.vertices.fill(null),e.textures.fill(null),e.program=null,e.target=null,e.targetObject=null,e.backend.dispose()},V=r=>{let t=C.get(r);return void 0===t&&((t=e.rt.getProperty(e.stage?.object,e.rt.publicName("stage3Ds")).$a.indexOf(r))<0&&b("a Stage3D that the stage does not list"),C.set(r,t)),t},z=e=>{!F&&t.has(e)&&r.place(V(e),e.$x??0,e.$y??0,e.$visible??!0)},I=r=>{let t=M.get(r);if(!t||t.backend.disposed)throw e.rt.error("Error",3694);return t},_=(r,t,o="flash.display3D")=>{try{let t=e.rt.classNamed(`${o}::${r}`).$it,a=t.instance(),s=e.rt.classNamed("flash.events::EventDispatcher");return t.isSubtypeOf(s.$it)&&e.rt.constructSuper(s,a),a}catch(e){throw t?.dispose(),e}},N=r=>{queueMicrotask(()=>e.loads.deferHostEvent(r))},j=r=>{N(()=>{F||e.destroyed||(0,y.Pt)(e,r,e.rt.construct(e.rt.classNamed("flash.events::ErrorEvent"),"error",!1,!1,"Error #3702: Context3D not available.",3702))})},Z=(o,a=k.get(o)??"baseline")=>{v.has(o)||$.has(o)||(k.set(o,a),v.add(o),N(()=>{let a,s;if(v.delete(o),F||e.destroyed||$.has(o))return;let n=t.get(o);n&&q(n);let i={};T.set(o,i);let l=V(o);try{a=r.create(l,{lost:()=>{if(F||e.destroyed||T.get(o)!==i||$.has(o))return;let r=t.get(o);if(!r)return;let a=M.get(r);M.delete(r),t.delete(o),$.set(o,i),a&&W(a)},restored:()=>{F||e.destroyed||$.get(o)!==i||($.delete(o),T.delete(o),r.remove(l),Z(o))}})}catch(e){if(T.delete(o),e instanceof m){r.remove(l),j(o);return}throw e}a.samplerFormats=e.rt.swfVersion>=17,a.setDxtEncoder?.(x.x);try{s=_("Context3D")}catch(e){throw T.delete(o),a.dispose(),r.remove(l),e}M.set(s,{backend:a,slot:o,profile:k.get(o)??"baseline",cleared:0,depth:!1,aa:0,target:null,targetObject:null,compressedTarget:!1,program:null,vertices:Array(8).fill(null),textures:Array(8).fill(null),resources:new Set}),t.set(o,s),z(o),(0,y.Pt)(e,o,e.rt.construct(e.rt.classNamed("flash.events::Event"),"context3DCreate"))}))},q=e=>{let o=M.get(e);return o?(M.delete(e),t.delete(o.slot),T.delete(o.slot),W(o),r.remove(V(o.slot)),o.slot):null},{slots:t,pending:v,lost:$,contexts:M,buffers:B,programs:S,textures:R,own:(e,r)=>(M.get(r.owner)?.resources.add(r),O.register(e,r,r),r),allocate:(e,r)=>{try{return r()}catch(a){let t=!1,o=M.get(e)?.resources;if(o)for(let e of o)e.reference.deref()||(P(e),t=!0);if(!t)throw a;return r()}},disposeResource:(e,r)=>{if(!r||r.disposed)return;P(r);let t=M.get(r.owner);if(t){for(let r=0;r<8;r++)t.vertices[r]===e&&(t.vertices[r]=null),t.textures[r]===e&&(t.textures[r]=null);t.program===e&&(t.program=null),t.targetObject===e&&(t.target=null,t.targetObject=null)}},place:z,state:I,context:e=>I(e).backend,requireClear:r=>{if(!r.backend.width||!r.backend.height)throw e.rt.error("Error",3698);let t=r.target,o=r.depth?7:1;if(t?!t.initialized:(r.cleared&o)!==o)throw e.rt.error("Error",t?3777:3692)},buffer:r=>{let t=B.get(r);if(!t||t.disposed||!M.has(t.owner))throw e.rt.error("Error",3694);return t.value},program:r=>{let t=S.get(r);if(!t||t.disposed||!M.has(t.owner))throw e.rt.error("Error",3694);return t.value},construct:_,texture:r=>{let t=R.get(r);if(!t||!M.has(t.owner))throw e.rt.error("Error",3694);return t.value},bytes:r=>{let t=o.D.$$(e.rt,r);return t.buffer.subarray(0,t.length)},request:Z,unavailable:j,dispose:q,close:()=>{for(let e of(F=!0,M.keys()))q(e);for(let e of $.keys())T.delete(e),r.remove(V(e));$.clear()},get closed(){return F}}),{slots:U,place:Q,request:X,unavailable:G}=H,J=["baseline","baselineConstrained"],K=r=>{switch(r){case null:return"baseline";case"baseline":case"baselineConstrained":case"baselineExtended":case"standardConstrained":case"standard":case"standardExtended":return r;default:throw e.rt.error("ArgumentError",2008,"profile")}};for(let r of(o.D.fZ(L,"flash.display::Stage3D",class{get context3D(){return U.get(this)??null}requestContext3D(r="auto",t="baseline"){if(null===r)throw e.rt.error("TypeError",2007,"context3DRenderMode");if("auto"!==r&&"software"!==r)throw e.rt.error("ArgumentError",2008,"context3DRenderMode");let o=K(t);if(H.closed)throw e.rt.error("Error",3694);"auto"===r&&J.includes(o)?X(this,o):G(this)}requestContext3DMatchingProfiles(r){if(!r)throw e.rt.error("ArgumentError",1508,"profiles");let t=r.$a;if(!t.length)throw e.rt.error("ArgumentError",2008,"profiles");let o=new Set;for(let e=0;e<t.length;e++)o.add(K(t[e]));if(H.closed)throw e.rt.error("Error",3694);let a=J.find(e=>o.has(e));a?X(this,a):G(this)}}),!function(e,r,t){let{contexts:g,buffers:m,programs:x,textures:y,own:v,allocate:k,state:D,context:A,requireClear:T,buffer:$,program:M,construct:B,texture:S,request:R,dispose:C}=t,F=new Float32Array(16);o.D.fZ(e,"flash.display3D::Context3D",class{get driverInfo(){return g.has(this)?"swf2es experimental WebGL2":"Disposed"}get profile(){return g.get(this)?.profile??null}get enableErrorChecking(){return this.$checking??!1}set enableErrorChecking(e){this.$checking=e}get backBufferWidth(){return g.get(this)?.backend.width??0}get backBufferHeight(){return g.get(this)?.backend.height??0}configureBackBuffer(e,t,o,a=!0,s=!1,n=!1){let i=D(this),l=i.backend;if(e<32)throw r.rt.error("Error",3780,32,2048);if(t<32)throw r.rt.error("Error",3781,32,2048);(s||n)&&b("configureBackBuffer's wantsBestResolution or wantsBestResolutionOnBrowserZoom");let c=e!==l.width||t!==l.height||a!==i.depth||o!==i.aa;l.configure(e,t,a,o),c&&(i.cleared=0),i.depth=a,i.aa=o}clear(e=0,t=0,o=0,a=1,s=1,n=0,i=0xffffffff){let l=D(this);if(l.compressedTarget)throw r.rt.error("Error",3746);let c=l.backend;if(0===c.width)throw r.rt.error("Error",3698);0xffffffff!==i&&i>7&&b(`clear's mask ${i}`),c.clear(e,t,o,a,s,i,n),l.target?l.target.initialized=!0:l.cleared|=i&(l.depth?7:1)}createVertexBuffer(e,r,t="staticDraw"){("staticDraw"!==t||0===r)&&b(`a vertex buffer of usage "${t}" or 32-bit values per vertex ${r}`);let o=this,a=k(o,()=>A(o).createBuffer(e,r)),s=B("VertexBuffer3D",a);return m.set(s,v(s,{value:a,owner:o,disposed:!1,reference:new WeakRef(s)})),s}createIndexBuffer(e,r="staticDraw"){"staticDraw"!==r&&b(`an index buffer of usage "${r}"`);let t=this,o=k(t,()=>A(t).createBuffer(e,0)),a=B("IndexBuffer3D",o);return m.set(a,v(a,{value:o,owner:t,disposed:!1,reference:new WeakRef(a)})),a}createProgram(){let e=this,r=k(e,()=>A(e).createProgram()),t=B("Program3D",r);return x.set(t,v(t,{value:r,owner:e,disposed:!1,reference:new WeakRef(t)})),t}createTexture(e,r,t,o,a=0){let s=A(this),n=E(t);0!==a&&b(`createTexture's streamingLevels ${a}`);let i=k(this,()=>s.createTexture(e,r,!1,n)),l=B("Texture",i,"flash.display3D.textures");return y.set(l,v(l,{value:i,owner:this,disposed:!1,initialized:!1,reference:new WeakRef(l)})),l}createRectangleTexture(e,t,o,a){let s=A(this);if(null===o)throw r.rt.error("TypeError",2007,"format");switch(o){case"bgra":case"bgraPacked4444":case"bgrPacked565":case"compressed":case"compressedAlpha":case"rgbaHalfFloat":break;default:throw r.rt.error("ArgumentError",2008,"format")}if(e<=0||t<=0)throw r.rt.error("ArgumentError",3681);if(e>2048||t>2048)throw r.rt.error("ArgumentError",3766);if("compressed"===o||"compressedAlpha"===o)throw r.rt.error("ArgumentError",3762);"bgra"!==o&&b(`the rectangle texture format "${o}"`);let n=k(this,()=>s.createRectangleTexture(e,t)),i=B("RectangleTexture",n,"flash.display3D.textures");return y.set(i,v(i,{value:n,owner:this,disposed:!1,initialized:!1,reference:new WeakRef(i)})),i}createCubeTexture(e,r,t,o=0){let a=A(this),s=E(r);0!==o&&b(`createCubeTexture's streamingLevels ${o}`);let n=k(this,()=>a.createTexture(e,e,!0,s)),i=B("CubeTexture",n,"flash.display3D.textures");return y.set(i,v(i,{value:n,owner:this,disposed:!1,initialized:!1,reference:new WeakRef(i)})),i}setSamplerStateAt(e,t,o,a){if(null===t)throw r.rt.error("TypeError",2007,"wrap");if(!l.includes(t))throw r.rt.error("ArgumentError",2008,"wrap");if(null===o)throw r.rt.error("TypeError",2007,"filter");if(!c.includes(o))throw r.rt.error("ArgumentError",2008,"filter");if(null===a)throw r.rt.error("TypeError",2007,"mipfilter");if(!u.includes(a))throw r.rt.error("ArgumentError",2008,"mipfilter");if(e<0||e>=16)throw r.rt.error("RangeError",2006);let s=g.get(this)?.backend;s&&s.setSampler(e,t,o,a)}setTextureAt(e,r){let t=D(this);if(r&&!y.has(r)){let r=t.textures[e];t.backend.setTexture(e,r?S(r):null);return}t.backend.setTexture(e,r&&S(r)),t.textures[e]=r}setRenderToTexture(e,t=!1,o=0,a=0,s=0){0!==s&&b(`setRenderToTexture's colorOutputIndex ${s}`);let n=D(this);if(e&&!y.has(e))throw r.rt.error("ArgumentError",0);let i=e&&S(e);if(i&&(a<0||a>=(i.cube?6:1)))throw r.rt.error("ArgumentError",i.cube?3772:3771);e&&y.get(e)?.disposed&&(i=null),n.compressedTarget=null!==i&&"bgra"!==i.format,n.compressedTarget&&(i=null),n.backend.setRenderTarget(i,t,a,o),n.target=i&&e?y.get(e)??null:null,n.targetObject=i?e:null}setRenderToBackBuffer(){let e=D(this);e.compressedTarget=!1,e.backend.setRenderTarget(null),e.target=null,e.targetObject=null}setProgram(e){let r=D(this);r.backend.setProgram(M(e)),r.program=e}setVertexBufferAt(e,t,o=0,a="float4"){let s=g.get(this),n=s?.backend,i=t&&m.get(t),l=i&&!i.disposed&&g.has(i.owner);if(n&&l){if(null===a)throw r.rt.error("TypeError",2007,"format");if(!d.includes(a))throw r.rt.error("ArgumentError",2008,"format")}if(e<0)throw r.rt.error("RangeError",2006);e>=8&&b(`vertex buffer index ${e}`),n&&(n.setVertex(e,l?i.value:null,o,a),s.vertices[e]=l?t:null)}setProgramConstantsFromVector(e,r,t,o=-1){"vertex"!==e&&"fragment"!==e&&b(`program constants of type "${e}"`);let a=t.$a;A(this).setConstants(e,r,a,-1===o?Math.floor(a.length/4):o)}setProgramConstantsFromMatrix(e,t,o,a=!1){let s=A(this);if("vertex"!==e&&"fragment"!==e)throw r.rt.error("ArgumentError",2008,"programType");if(!o)throw r.rt.error("TypeError",2007,"matrix");if(t<0)throw r.rt.error("RangeError",2006);let n=o.$matrix3D;for(let e=0;e<16;e++)F[e]=n[a?e%4*4+Math.floor(e/4):e];s.setConstants(e,t,F,4)}setCulling(e){if(!s.includes(e))throw r.rt.error("ArgumentError",2008,"triangleFaceToCull");g.get(this)?.backend.setCulling(e)}setBlendFactors(e,t){if(!i.includes(e))throw r.rt.error("ArgumentError",2008,"sourceFactor");if(!i.includes(t))throw r.rt.error("ArgumentError",2008,"destinationFactor");g.get(this)?.backend.setBlend(e,t)}setColorMask(e,r,t,o){g.get(this)?.backend.setColorMask(e,r,t,o)}setStencilActions(e="frontAndBack",t="always",o="keep",i="keep",l="keep"){if(!s.includes(e))throw r.rt.error("ArgumentError",2008,"triangleFace");if(!a.includes(t))throw r.rt.error("ArgumentError",2008,"compareMode");if(!n.includes(o))throw r.rt.error("ArgumentError",2008,"actionOnBothPass");if(!n.includes(i))throw r.rt.error("ArgumentError",2008,"actionOnDepthFail");if(!n.includes(l))throw r.rt.error("ArgumentError",2008,"actionOnDepthPassStencilFail");g.get(this)?.backend.setStencilActions(e,t,o,i,l)}setStencilReferenceValue(e,r=255,t=255){g.get(this)?.backend.setStencilReference(e,r,t)}setDepthTest(e,t){if(!a.includes(t))throw r.rt.error("ArgumentError",2008,"passCompareMode");g.get(this)?.backend.setDepth(e,t)}setScissorRectangle(e){let t=g.get(this)?.backend;if(!t)return;if(null===e)return void t.setScissor(null);let o=r.rt;t.setScissor(o.toNumber(o.getProperty(e,o.publicName("x"))),o.toNumber(o.getProperty(e,o.publicName("y"))),o.toNumber(o.getProperty(e,o.publicName("width"))),o.toNumber(o.getProperty(e,o.publicName("height"))))}drawTriangles(e,t=0,o=-1){if(!e)throw r.rt.error("TypeError",2007,"indexBuffer");try{let a=D(this);if(a.compressedTarget)throw r.rt.error("Error",3746);this.$checking&&T(a),a.backend.draw($(e),t,o)}catch(e){if(e instanceof h)throw r.rt.error("RangeError",3610);if(e instanceof f)throw r.rt.error("Error",3706);if(e instanceof p)switch(e.reason){case"feedback":throw r.rt.error("Error",3604);case"unused":throw r.rt.error("Error",3697);case"conflicting":throw r.rt.error("Error",3695);case"unuploaded":throw r.rt.error("Error",3605);case"mipmaps":throw r.rt.error("Error",3700);case"rectangleMip":throw r.rt.error("Error",3755);case"wrap":throw r.rt.error("Error",3753);case"dimension":throw r.rt.error("Error",3754);case"missing":throw r.rt.error("Error",3663);case"format":throw r.rt.error("Error",r.rt.swfVersion>=19?3763:3606,e.sampler)}throw e}}drawToBitmapData(e){let t=D(this);if(!e)throw r.rt.error("TypeError",2007,"destination");let o=t.backend;if(0===o.width)return;T(t);let a=(0,w.xX)(r,e),s=Math.min(a.width,o.width),n=Math.min(a.height,o.height);!function(e,r,t,o,a){let s=e.pixels,n=e.height-a,i=e.transparent,l=t===e.width&&o===e.height,c=!i&&(l||!e.holdsAlpha),u=!0;for(let a=0;a<o;a++){let o=a<n,l=a*e.width;for(let e=0,n=a*t*4;e<t;e++,n+=4){let t=r[n],a=r[n+1],d=r[n+2],h=r[n+3];o?i&&(t=Math.min(t,h),a=Math.min(a,h),d=Math.min(d,h)):h=Math.max(t,a,d,h),s[l+e]=h<<24|t<<16|a<<8|d,c&&255!==h&&(u=!1)}}c&&(e.holdsAlpha=!u),e.changed()}(a,o.read(s,n),s,n,o.height)}present(){let e=D(this);e.compressedTarget=!1,e.target&&(e.backend.setRenderTarget(null),e.target=null,e.targetObject=null),this.$checking&&T(e),e.backend.present(),e.cleared=0}dispose(e=!0){let o=C(this);o&&e&&!t.closed&&!r.destroyed&&R(o)}})}(L,e,H),!function(e,r,t){let{buffers:a,programs:s,textures:n,contexts:i,disposeResource:l,context:c,buffer:u,program:d,texture:h,bytes:f}=t;class p{uploadFromByteArray(e,t,s,n){if(!e)throw r.rt.error("TypeError",2007,"data");let i=a.get(this);if(!i)throw r.rt.error("Error",3694);if(i.disposed)return;c(i.owner);let l=o.D.$$(r.rt,e),u=i.value,d=n*(0===u.stride?2:4*u.stride);if(t<0||t>=l.length||s<0||n<0||s>u.count-n||d>l.length-t)throw r.rt.error("RangeError",3669);u.uploadBytes(l.buffer,t,s,n)}uploadFromVector(e,r,t){u(this).upload(e.$a,r,t)}dispose(){l(this,a.get(this))}}function x(e,t,o,a){let s=h(e);if(n.get(e)?.disposed)return;if(a>=(s.cube?6:1))throw r.rt.error("ArgumentError",3673);if(o>=s.levels)throw r.rt.error("ArgumentError",3674);if(!t)throw r.rt.error("TypeError",2007,"source");let i=(0,w.xX)(r,t);s.upload(i.readable,o,a,i.width,i.height);let l=n.get(e);l&&0===o&&!s.cube&&(l.initialized=!0)}function b(e,t,a,s,i){if(!t)throw r.rt.error("TypeError",2007,"data");if(n.get(e)?.disposed)return;let l=h(e);if(i>=(l.cube?6:1))throw r.rt.error("ArgumentError",3673);if(s>=l.levels)throw r.rt.error("ArgumentError",3674);let c=o.D.$$(r.rt,t),u=Math.max(1,l.width>>s)*Math.max(1,l.height>>s)*4;if(a>c.length-u)throw r.rt.error("RangeError",3669);l.uploadBytes(c.buffer,a,s,i);let d=n.get(e);d&&0===s&&!l.cube&&(d.initialized=!0)}let E={size:3669,decode:3677,format:3675},v={3669:"RangeError",3675:"ArgumentError",3677:"ArgumentError",3679:"ArgumentError"};function k(e,t,o,a){let s,i=(0,A.Ah)(a.format),l=r.rt.swfVersion;if(void 0===i||l<17&&(!a.old||"compressedAlpha"===i)||l<29&&a.version>=3)return E.decode;if(i!==t.format||a.cube!==t.cube)return E.format;try{s=(0,A.oT)(o,a)}catch(e){if(e instanceof A.Q$)return E[e.reason];throw e}if(a.width!==t.width||a.height!==t.height)return 3679;for(let e of s){let r=t.cube?1^e.face:0,o=Math.max(1,t.width>>e.level),a=Math.max(1,t.height>>e.level),s="bgra"===i?o*a*4:Math.max(1,o+3>>2)*Math.max(1,a+3>>2)*("compressedAlpha"===i?16:8);if(e.level>=t.levels||r>=(t.cube?6:1)||e.width!==o||e.height!==a||e.bytes.length!==s)return E.decode}for(let e of s){let r=t.cube?1^e.face:0;"bgra"===i?t.uploadBytes(e.bytes,0,e.level,r):t.uploadCompressed(e.bytes,e.level,r)}let c=n.get(e);return c&&!t.cube&&s.some(e=>0===e.level)&&(c.initialized=!0),0}function T(e,t,a,s){let l;if(!t)throw r.rt.error("TypeError",2007,"data");if(n.get(e)?.disposed)return;let c=h(e),u=o.D.$$(r.rt,t),d=u.buffer.subarray(0,u.length);try{l=(0,A.xt)(d,a)}catch(e){if(e instanceof A.Q$)throw r.rt.error(v[E[e.reason]],E[e.reason]);throw e}if(!s){let t=k(e,c,d,l);if(t)throw r.rt.error(v[t],t);return}let f=d.slice(a);r.loads.deferHostEvent(()=>{let t=n.get(e);if(!t||!i.has(t.owner)||r.destroyed)return;let a=E.decode;try{a=t.disposed?a:k(e,c,f,(0,A.xt)(f,0))}catch(e){if(!(e instanceof m))throw e;a=D(e).id}let s=a?r.rt.construct(r.rt.classNamed("flash.events::ErrorEvent"),"error",!1,!1,`Error #${a}: ${o.D.xc[a]??""}`,a):r.event("textureReady");(0,y.Pt)(r,e,s)})}o.D.fZ(e,"flash.display3D::VertexBuffer3D",p),o.D.fZ(e,"flash.display3D::IndexBuffer3D",p),o.D.fZ(e,"flash.display3D::Program3D",class{upload(e,t){try{d(this).upload(f(e),f(t))}catch(e){if(e instanceof g)throw r.rt.error("Error",3696);throw e}}dispose(){l(this,s.get(this))}}),o.D.fZ(e,"flash.display3D.textures::Texture",class{uploadCompressedTextureFromByteArray(e,r,t=!1){T(this,e,r,t)}uploadFromByteArray(e,r,t=0){b(this,e,r,t,0)}uploadFromBitmapData(e,r=0){x(this,e,r,0)}}),o.D.fZ(e,"flash.display3D.textures::CubeTexture",class{uploadCompressedTextureFromByteArray(e,r,t=!1){T(this,e,r,t)}uploadFromByteArray(e,r,t,o=0){b(this,e,r,o,t)}uploadFromBitmapData(e,r,t=0){x(this,e,t,r)}}),o.D.fZ(e,"flash.display3D.textures::RectangleTexture",class{uploadFromByteArray(e,r){b(this,e,r,0,0)}uploadFromBitmapData(e){if(!e)throw r.rt.error("TypeError",2007,"source");n.get(this)?.disposed||x(this,e,0,0)}}),o.D.fZ(e,"flash.display3D.textures::TextureBase",class{dispose(){l(this,n.get(this))}})}(L,e,H),["x","y","visible"])){let t=`flash.display::Stage3D#set:${r}`,o=e.rt.natives[t];L[t]=e=>{let r=o(e);return function(e){r.call(this,e),Q(this)}}}return!function(e,r){let t=new Set,a=Object.keys(e);for(let s=0;s<a.length;s++){let n=a[s],i=e[n](r.rt);e[n]=o.D.pj(function(e,o,a,s,l,c,u,d){try{return i.call(this,e,o,a,s,l,c,u,d)}catch(e){if(e instanceof m){let{id:o,kind:a}=D(e),s=`${n}: ${e.message} (Error #${o})`;throw t.has(s)||(t.add(s),console.warn(`swf2es: ${s}`)),r.rt.error(a,o)}throw e}})}}(L,e),Object.assign(e.rt.natives,L),H.close}(r,{create:(e,r)=>{let t=$.create(e,r);return this.slots.set(e,{x:0,y:0,visible:!0}),v(),t},place:(e,r,t,o)=>{let a=this.slots.get(e);a&&(a.x=r,a.y=t,a.visible=o,this.place(e,a))},remove:e=>{$.remove(e),this.slots.delete(e)&&!this.destroyed&&v()}})}catch(r){throw this.layer.remove(),e.style.isolation=this.isolation,r}}get active(){return 0!==this.slots.size}layout(e,r,t){this.x=e.x,this.y=e.y,this.sx=e.width/(r||1),this.sy=e.height/(t||1);for(let e=0;e<4;e++){let r=this.slots.get(e);r&&this.place(e,r)}}place(e,r){this.host.place(e,this.x+r.x*this.sx,this.y+r.y*this.sy,r.visible)}destroy(){if(!this.destroyed){this.destroyed=!0;try{this.close()}finally{this.layer.remove(),this.box.style.isolation=this.isolation}}}}}};
|
|
2
|
+
//# sourceMappingURL=207ce410b343c034.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunks/207ce410b343c034.js","sources":["webpack://swf2es/../context3d/dist/backend.js","webpack://swf2es/../context3d/dist/errors.js","webpack://swf2es/../context3d/dist/dxt.js","webpack://swf2es/../player/dist/playerglobal/context3d/lifecycle.js","webpack://swf2es/../player/dist/playerglobal/context3d/context.js","webpack://swf2es/../player/dist/playerglobal/context3d/errors.js","webpack://swf2es/../web/dist/stage3d.js","webpack://swf2es/../player-hosts/dist/stage3d.js","webpack://swf2es/../player/dist/playerglobal/context3d.js","webpack://swf2es/../player/dist/playerglobal/context3d/readback.js","webpack://swf2es/../player/dist/playerglobal/context3d/resources.js"],"sourcesContent":["export const COMPARE_MODES = [\n \"always\",\n \"never\",\n \"less\",\n \"lessEqual\",\n \"equal\",\n \"notEqual\",\n \"greaterEqual\",\n \"greater\",\n];\nexport const CULL_FACES = [\"none\", \"back\", \"front\", \"frontAndBack\"];\nexport const STENCIL_ACTIONS = [\n \"keep\",\n \"zero\",\n \"set\",\n \"incrementSaturate\",\n \"decrementSaturate\",\n \"invert\",\n \"incrementWrap\",\n \"decrementWrap\",\n];\nexport const BLEND_FACTORS = [\n \"zero\",\n \"one\",\n \"sourceColor\",\n \"oneMinusSourceColor\",\n \"sourceAlpha\",\n \"oneMinusSourceAlpha\",\n \"destinationColor\",\n \"oneMinusDestinationColor\",\n \"destinationAlpha\",\n \"oneMinusDestinationAlpha\",\n];\nexport const SAMPLER_WRAPS = [\"clamp\", \"repeat_u_clamp_v\", \"clamp_u_repeat_v\", \"repeat\"];\nexport const SAMPLER_FILTERS = [\n \"nearest\",\n \"linear\",\n \"anisotropic2x\",\n \"anisotropic4x\",\n \"anisotropic8x\",\n \"anisotropic16x\",\n];\nexport const SAMPLER_MIPS = [\"mipnone\", \"mipnearest\", \"miplinear\"];\n/** The texture formats a backend stores: BGRA, and S3TC's DXT1 and DXT5 as Flash calls them. */\nexport const TEXTURE_FORMATS = [\"bgra\", \"compressed\", \"compressedAlpha\"];\nexport const VERTEX_FORMATS = [\"float1\", \"float2\", \"float3\", \"float4\", \"bytes4\"];\nexport class VertexOffsetError extends Error {\n}\nexport class ScissorBoundsError extends Error {\n}\nexport class SamplerBiasError extends Error {\n}\nexport class TextureBindingError extends Error {\n reason;\n /** The sampler it names, where it names one. */\n sampler;\n constructor(reason, sampler = -1) {\n super(`Invalid texture binding: ${reason}`);\n this.reason = reason;\n this.sampler = sampler;\n }\n}\n//# sourceMappingURL=backend.js.map","export class Context3DError extends Error {\n reason;\n constructor(reason, message) {\n super(message);\n this.reason = reason;\n }\n}\n//# sourceMappingURL=errors.js.map","// S3TC's DXT1 and DXT5 on the CPU: blocks decoded to RGBA for a backend\n// whose GPU takes no S3TC (WEBGL_compressed_texture_s3tc absent), and RGBA\n// encoded to blocks for pixels uploaded to a compressed texture, which AIR\n// compresses too. DXT1 is \"compressed\": a block whose first colour is not\n// above its second has a third, the midpoint, and transparent black for its\n// fourth index, as AIR draws it (GL's COMPRESSED_RGBA_S3TC_DXT1). DXT5's\n// colours always have four.\n/** RGB565 as 0xRRGGBB, each channel's high bits repeated into its low ones. */\nfunction rgb(c) {\n const r = (c >> 11) & 31;\n const g = (c >> 5) & 63;\n const b = c & 31;\n return (((r << 3) | (r >> 2)) << 16) | (((g << 2) | (g >> 4)) << 8) | ((b << 3) | (b >> 2));\n}\n/** `a` weighted `wa` against `b`, per channel of two 0xRRGGBB colours, over `total`. */\nfunction mix(a, b, wa, wb, total) {\n let out = 0;\n for (let shift = 0; shift < 24; shift += 8) {\n const channel = ((((a >> shift) & 255) * wa + ((b >> shift) & 255) * wb) / total) | 0;\n out |= channel << shift;\n }\n return out;\n}\n/** DXT1's fourth colour where a block has three: black, and the one transparent texel. */\nconst TRANSPARENT = -1;\nconst palette = new Int32Array(4);\nconst texels = new Int32Array(16);\nconst alphas = new Uint8Array(8);\n/**\n * `blocks`, a level `width` by `height` of DXT1 (8 bytes a 4x4 block) or,\n * with `dxt5`, DXT5 (16), rows of blocks from the top, written to `out` as\n * top-down RGBA rows of `width` pixels. The level's edge blocks may stand\n * past it, as a 2x2 level's one block does; what stands past is dropped.\n */\nexport function decodeDxt(blocks, dxt5, width, height, out) {\n const size = dxt5 ? 16 : 8;\n const across = Math.max(1, (width + 3) >> 2);\n const down = Math.max(1, (height + 3) >> 2);\n for (let by = 0; by < down; by++) {\n for (let bx = 0; bx < across; bx++) {\n const at = (by * across + bx) * size;\n const colour = dxt5 ? at + 8 : at;\n const c0 = blocks[colour] | (blocks[colour + 1] << 8);\n const c1 = blocks[colour + 2] | (blocks[colour + 3] << 8);\n palette[0] = rgb(c0);\n palette[1] = rgb(c1);\n if (dxt5 || c0 > c1) {\n palette[2] = mix(palette[0], palette[1], 2, 1, 3);\n palette[3] = mix(palette[0], palette[1], 1, 2, 3);\n }\n else {\n palette[2] = mix(palette[0], palette[1], 1, 1, 2);\n palette[3] = TRANSPARENT;\n }\n if (dxt5) {\n const a0 = blocks[at];\n const a1 = blocks[at + 1];\n alphas[0] = a0;\n alphas[1] = a1;\n if (a0 > a1) {\n for (let i = 1; i < 7; i++) {\n alphas[i + 1] = (((7 - i) * a0 + i * a1) / 7) | 0;\n }\n }\n else {\n for (let i = 1; i < 5; i++) {\n alphas[i + 1] = (((5 - i) * a0 + i * a1) / 5) | 0;\n }\n alphas[6] = 0;\n alphas[7] = 255;\n }\n }\n const indices = (blocks[colour + 4] |\n (blocks[colour + 5] << 8) |\n (blocks[colour + 6] << 16) |\n (blocks[colour + 7] << 24)) >>>\n 0;\n // DXT5's 48 bits of 3-bit alpha indices, as two 24-bit halves.\n const low = dxt5 ? blocks[at + 2] | (blocks[at + 3] << 8) | (blocks[at + 4] << 16) : 0;\n const high = dxt5 ? blocks[at + 5] | (blocks[at + 6] << 8) | (blocks[at + 7] << 16) : 0;\n for (let y = 0; y < 4; y++) {\n const py = by * 4 + y;\n if (py >= height) {\n break;\n }\n for (let x = 0; x < 4; x++) {\n const px = bx * 4 + x;\n if (px >= width) {\n break;\n }\n const i = y * 4 + x;\n const c = palette[(indices >>> (i * 2)) & 3];\n const o = (py * width + px) * 4;\n if (c === TRANSPARENT) {\n out[o] = out[o + 1] = out[o + 2] = out[o + 3] = 0;\n continue;\n }\n out[o] = c >> 16;\n out[o + 1] = c >> 8;\n out[o + 2] = c;\n out[o + 3] = dxt5 ? alphas[(i < 8 ? low >> (i * 3) : high >> ((i - 8) * 3)) & 7] : 255;\n }\n }\n }\n }\n}\n/** A colour's distance from palette entry `c`, squared, per channel. */\nfunction distance(r, g, b, c) {\n const dr = r - ((c >> 16) & 255);\n const dg = g - ((c >> 8) & 255);\n const db = b - (c & 255);\n return dr * dr + dg * dg + db * db;\n}\n/** 0xRRGGBB as RGB565. */\nfunction pack(r, g, b) {\n return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);\n}\n/** The bytes of a level `width` by `height` as DXT1's blocks, or DXT5's: one block at least. */\nexport function blockBytes(width, height, dxt5) {\n return Math.max(1, (width + 3) >> 2) * Math.max(1, (height + 3) >> 2) * (dxt5 ? 16 : 8);\n}\n/** encodeDxt's output, kept for the next level: each upload copies its blocks out at once. */\nlet encoded = new Uint8Array(0);\n/**\n * `rgba`, top-down RGBA rows of `width` pixels, `height` high, as blocks,\n * DXT1's or with `dxt5` DXT5's, for `decodeDxt` or a GPU: each block's\n * colours on the line through them that their spread runs along (its\n * principal axis, by a few power iterations), between the pixels that lie\n * farthest out on it, four of them always; DXT5's alpha between its lowest\n * and highest, eight. A level smaller than a block repeats its pixels across\n * it. The result is a view of a buffer the next call reuses.\n */\nexport function encodeDxt(rgba, dxt5, width, height) {\n const size = dxt5 ? 16 : 8;\n const across = Math.max(1, (width + 3) >> 2);\n const down = Math.max(1, (height + 3) >> 2);\n const length = blockBytes(width, height, dxt5);\n if (encoded.length < length) {\n encoded = new Uint8Array(length);\n }\n const out = encoded;\n for (let by = 0; by < down; by++) {\n for (let bx = 0; bx < across; bx++) {\n const at = (by * across + bx) * size;\n // The block's pixels, its edge repeated past a level smaller than a block.\n let mr = 0;\n let mg = 0;\n let mb = 0;\n let lowA = 255;\n let highA = 0;\n for (let i = 0; i < 16; i++) {\n const p = (Math.min(by * 4 + (i >> 2), height - 1) * width +\n Math.min(bx * 4 + (i & 3), width - 1)) *\n 4;\n texels[i] = p;\n mr += rgba[p];\n mg += rgba[p + 1];\n mb += rgba[p + 2];\n lowA = Math.min(lowA, rgba[p + 3]);\n highA = Math.max(highA, rgba[p + 3]);\n }\n mr /= 16;\n mg /= 16;\n mb /= 16;\n // The colours' covariance, and its principal axis.\n let rr = 0;\n let rg = 0;\n let rb = 0;\n let gg = 0;\n let gb = 0;\n let bb = 0;\n for (let i = 0; i < 16; i++) {\n const p = texels[i];\n const r = rgba[p] - mr;\n const g = rgba[p + 1] - mg;\n const b = rgba[p + 2] - mb;\n rr += r * r;\n rg += r * g;\n rb += r * b;\n gg += g * g;\n gb += g * b;\n bb += b * b;\n }\n // Iterated from the pixel farthest from the mean, which no axis is orthogonal to.\n let vr = 0;\n let vg = 0;\n let vb = 0;\n let spread = -1;\n for (let i = 0; i < 16; i++) {\n const p = texels[i];\n const r = rgba[p] - mr;\n const g = rgba[p + 1] - mg;\n const b = rgba[p + 2] - mb;\n if (r * r + g * g + b * b > spread) {\n spread = r * r + g * g + b * b;\n vr = r;\n vg = g;\n vb = b;\n }\n }\n for (let k = 0; k < 4; k++) {\n const nr = rr * vr + rg * vg + rb * vb;\n const ng = rg * vr + gg * vg + gb * vb;\n const nb = rb * vr + gb * vg + bb * vb;\n const m = Math.max(Math.abs(nr), Math.abs(ng), Math.abs(nb));\n if (m === 0) {\n break;\n }\n vr = nr / m;\n vg = ng / m;\n vb = nb / m;\n }\n // The pixels farthest out along it, either way, are the endpoints.\n let first = texels[0];\n let second = texels[0];\n let least = Infinity;\n let most = -Infinity;\n for (let i = 0; i < 16; i++) {\n const p = texels[i];\n const d = rgba[p] * vr + rgba[p + 1] * vg + rgba[p + 2] * vb;\n if (d < least) {\n least = d;\n second = p;\n }\n if (d > most) {\n most = d;\n first = p;\n }\n }\n // Four colours need the first endpoint above the second; one alike stays one.\n let c0 = pack(rgba[first], rgba[first + 1], rgba[first + 2]);\n let c1 = pack(rgba[second], rgba[second + 1], rgba[second + 2]);\n if (c0 < c1) {\n const swap = c0;\n c0 = c1;\n c1 = swap;\n }\n palette[0] = rgb(c0);\n palette[1] = rgb(c1);\n palette[2] = mix(palette[0], palette[1], 2, 1, 3);\n palette[3] = mix(palette[0], palette[1], 1, 2, 3);\n const colour = dxt5 ? at + 8 : at;\n out[colour] = c0;\n out[colour + 1] = c0 >> 8;\n out[colour + 2] = c1;\n out[colour + 3] = c1 >> 8;\n if (dxt5) {\n // Eight alphas: the first endpoint above the second, or alike.\n alphas[0] = highA;\n alphas[1] = lowA;\n for (let i = 1; i < 7; i++) {\n alphas[i + 1] = (((7 - i) * highA + i * lowA) / 7) | 0;\n }\n out[at] = highA;\n out[at + 1] = lowA;\n }\n let indices = 0;\n let low = 0;\n let high = 0;\n const colours = c0 === c1 ? 1 : 4;\n for (let i = 0; i < 16; i++) {\n const o = texels[i];\n let best = 0;\n let nearest = Infinity;\n for (let p = 0; p < colours; p++) {\n const d = distance(rgba[o], rgba[o + 1], rgba[o + 2], palette[p]);\n if (d < nearest) {\n nearest = d;\n best = p;\n }\n }\n indices |= best << (i * 2);\n if (dxt5) {\n let index = 0;\n for (let p = 1; p < 8; p++) {\n if (Math.abs(rgba[o + 3] - alphas[p]) < Math.abs(rgba[o + 3] - alphas[index])) {\n index = p;\n }\n }\n if (i < 8) {\n low |= index << (i * 3);\n }\n else {\n high |= index << ((i - 8) * 3);\n }\n }\n }\n out[colour + 4] = indices;\n out[colour + 5] = indices >>> 8;\n out[colour + 6] = indices >>> 16;\n out[colour + 7] = indices >>> 24;\n if (dxt5) {\n out[at + 2] = low;\n out[at + 3] = low >> 8;\n out[at + 4] = low >> 16;\n out[at + 5] = high;\n out[at + 6] = high >> 8;\n out[at + 7] = high >> 16;\n }\n }\n }\n return out.subarray(0, length);\n}\n//# sourceMappingURL=dxt.js.map","import { Context3DError, } from \"@swf2es/context3d\";\nimport { avm2 } from \"@swf2es/runtime\";\nimport { encodeDxt } from \"../../bitmap/dxt.js\";\nimport { dispatchEvent } from \"../../scripting/events.js\";\n/** Error #3708 for what Context3D does not do yet, `what` naming it for the console. */\nexport function unsupported(what) {\n throw new Context3DError(\"unsupported\", `Context3D does not support ${what} yet`);\n}\nexport function createBindings(s, host) {\n const slots = new WeakMap();\n const pending = new WeakSet();\n // The profile each slot last asked for, which a context restored after a loss keeps.\n const profiles = new WeakMap();\n const generations = new WeakMap();\n const lost = new Map();\n const contexts = new Map();\n const buffers = new WeakMap();\n const programs = new WeakMap();\n const textures = new WeakMap();\n const indices = new WeakMap();\n let closed = false;\n const release = (entry) => {\n contexts.get(entry.owner)?.resources.delete(entry);\n finalized.unregister(entry);\n entry.value.dispose();\n entry.disposed = true;\n };\n // Held records never strongly reference their own AS wrapper. Active bindings\n // keep wrappers alive through ContextState until they are replaced or cleared.\n const finalized = new FinalizationRegistry((entry) => {\n if (contexts.get(entry.owner)?.resources.has(entry)) {\n release(entry);\n }\n });\n const own = (object, entry) => {\n contexts.get(entry.owner)?.resources.add(entry);\n finalized.register(object, entry, entry);\n return entry;\n };\n const allocate = (owner, create) => {\n try {\n return create();\n }\n catch (error) {\n // A full collection can precede its finalizers. Recover that capacity\n // before refusing an allocation, without scanning warm draw paths.\n let collected = false;\n const resources = contexts.get(owner)?.resources;\n if (resources) {\n for (const entry of resources) {\n if (!entry.reference.deref()) {\n release(entry);\n collected = true;\n }\n }\n }\n if (!collected) {\n throw error;\n }\n return create();\n }\n };\n const closeContext = (entry) => {\n for (const resource of entry.resources) {\n finalized.unregister(resource);\n }\n entry.resources.clear();\n entry.vertices.fill(null);\n entry.textures.fill(null);\n entry.program = null;\n entry.target = null;\n entry.targetObject = null;\n entry.backend.dispose();\n };\n const disposeResource = (object, entry) => {\n if (!entry || entry.disposed) {\n return;\n }\n release(entry);\n const owner = contexts.get(entry.owner);\n if (!owner) {\n return;\n }\n for (let i = 0; i < 8; i++) {\n if (owner.vertices[i] === object) {\n owner.vertices[i] = null;\n }\n if (owner.textures[i] === object) {\n owner.textures[i] = null;\n }\n }\n if (owner.program === object) {\n owner.program = null;\n }\n if (owner.targetObject === object) {\n owner.target = null;\n owner.targetObject = null;\n }\n };\n const indexOf = (slot) => {\n let index = indices.get(slot);\n if (index === undefined) {\n const vector = s.rt.getProperty(s.stage?.object, s.rt.publicName(\"stage3Ds\"));\n index = vector.$a.indexOf(slot);\n if (index < 0) {\n unsupported(\"a Stage3D that the stage does not list\");\n }\n indices.set(slot, index);\n }\n return index;\n };\n const place = (slot) => {\n if (!closed && slots.has(slot)) {\n host.place(indexOf(slot), slot.$x ?? 0, slot.$y ?? 0, slot.$visible ?? true);\n }\n };\n const state = (o) => {\n const entry = contexts.get(o);\n if (!entry || entry.backend.disposed) {\n throw s.rt.error(\"Error\", 3694);\n }\n return entry;\n };\n const context = (o) => state(o).backend;\n const requireClear = (entry) => {\n if (!entry.backend.width || !entry.backend.height) {\n throw s.rt.error(\"Error\", 3698);\n }\n const target = entry.target;\n const required = entry.depth ? 7 : 1;\n if (target ? !target.initialized : (entry.cleared & required) !== required) {\n throw s.rt.error(\"Error\", target ? 3777 : 3692);\n }\n };\n const buffer = (o) => {\n const value = buffers.get(o);\n if (!value) {\n throw s.rt.error(\"Error\", 3694);\n }\n if (value.disposed || !contexts.has(value.owner)) {\n throw s.rt.error(\"Error\", 3694);\n }\n return value.value;\n };\n const program = (o) => {\n const value = programs.get(o);\n if (!value) {\n throw s.rt.error(\"Error\", 3694);\n }\n if (value.disposed || !contexts.has(value.owner)) {\n throw s.rt.error(\"Error\", 3694);\n }\n return value.value;\n };\n const construct = (name, resource, namespace = \"flash.display3D\") => {\n try {\n // Flash reserves these constructors for its native factories.\n const traits = s.rt.classNamed(`${namespace}::${name}`).$it;\n const object = traits.instance();\n const dispatcher = s.rt.classNamed(\"flash.events::EventDispatcher\");\n if (traits.isSubtypeOf(dispatcher.$it)) {\n s.rt.constructSuper(dispatcher, object);\n }\n return object;\n }\n catch (error) {\n resource?.dispose();\n throw error;\n }\n };\n const texture = (o) => {\n const entry = textures.get(o);\n if (!entry) {\n throw s.rt.error(\"Error\", 3694);\n }\n if (!contexts.has(entry.owner)) {\n throw s.rt.error(\"Error\", 3694);\n }\n return entry.value;\n };\n const bytes = (o) => {\n const storage = avm2.bytesOf(s.rt, o);\n return storage.buffer.subarray(0, storage.length);\n };\n const deferEvent = (deliver) => {\n // A constructor's request must leave the current script turn, including\n // its first-frame scripts, before the frame queue can deliver the result.\n queueMicrotask(() => s.loads.deferHostEvent(deliver));\n };\n const created = (slot) => {\n dispatchEvent(s, slot, s.rt.construct(s.rt.classNamed(\"flash.events::Event\"), \"context3DCreate\"));\n };\n const unavailable = (slot) => {\n deferEvent(() => {\n if (!closed && !s.destroyed) {\n dispatchEvent(s, slot, s.rt.construct(s.rt.classNamed(\"flash.events::ErrorEvent\"), \"error\", false, false, \"Error #3702: Context3D not available.\", 3702));\n }\n });\n };\n const request = (slot, profile = profiles.get(slot) ?? \"baseline\") => {\n if (pending.has(slot) || lost.has(slot)) {\n return;\n }\n profiles.set(slot, profile);\n pending.add(slot);\n deferEvent(() => {\n pending.delete(slot);\n if (closed || s.destroyed || lost.has(slot)) {\n return;\n }\n const previous = slots.get(slot);\n if (previous) {\n dispose(previous);\n }\n const generation = {};\n generations.set(slot, generation);\n const index = indexOf(slot);\n let backend;\n try {\n backend = host.create(index, {\n lost: () => {\n if (closed || s.destroyed || generations.get(slot) !== generation || lost.has(slot)) {\n return;\n }\n const object = slots.get(slot);\n if (!object) {\n return;\n }\n const entry = contexts.get(object);\n contexts.delete(object);\n slots.delete(slot);\n lost.set(slot, generation);\n if (entry) {\n closeContext(entry);\n }\n },\n restored: () => {\n if (closed || s.destroyed || lost.get(slot) !== generation) {\n return;\n }\n lost.delete(slot);\n generations.delete(slot);\n host.remove(index);\n request(slot);\n },\n });\n }\n catch (error) {\n generations.delete(slot);\n if (error instanceof Context3DError) {\n host.remove(index);\n unavailable(slot);\n return;\n }\n throw error;\n }\n // Older content reads a compressed texture with any sampler, as AIR lets it.\n backend.samplerFormats = s.rt.swfVersion >= 17;\n backend.setDxtEncoder?.(encodeDxt);\n let object;\n try {\n object = construct(\"Context3D\");\n }\n catch (error) {\n generations.delete(slot);\n backend.dispose();\n host.remove(index);\n throw error;\n }\n contexts.set(object, {\n backend,\n slot,\n profile: profiles.get(slot) ?? \"baseline\",\n cleared: 0,\n depth: false,\n aa: 0,\n target: null,\n targetObject: null,\n compressedTarget: false,\n program: null,\n vertices: new Array(8).fill(null),\n textures: new Array(8).fill(null),\n resources: new Set(),\n });\n slots.set(slot, object);\n place(slot);\n created(slot);\n });\n };\n const dispose = (object) => {\n const entry = contexts.get(object);\n if (!entry) {\n return null;\n }\n contexts.delete(object);\n slots.delete(entry.slot);\n generations.delete(entry.slot);\n closeContext(entry);\n host.remove(indexOf(entry.slot));\n return entry.slot;\n };\n const close = () => {\n closed = true;\n for (const object of contexts.keys()) {\n dispose(object);\n }\n for (const slot of lost.keys()) {\n generations.delete(slot);\n host.remove(indexOf(slot));\n }\n lost.clear();\n };\n return {\n slots,\n pending,\n lost,\n contexts,\n buffers,\n programs,\n textures,\n own,\n allocate,\n disposeResource,\n place,\n state,\n context,\n requireClear,\n buffer,\n program,\n construct,\n texture,\n bytes,\n request,\n unavailable,\n dispose,\n close,\n get closed() {\n return closed;\n },\n };\n}\n//# sourceMappingURL=lifecycle.js.map","import { BLEND_FACTORS, COMPARE_MODES, CULL_FACES, SAMPLER_FILTERS, SAMPLER_MIPS, SAMPLER_WRAPS, ScissorBoundsError, STENCIL_ACTIONS, TextureBindingError, VERTEX_FORMATS, VertexOffsetError, } from \"@swf2es/context3d\";\nimport { avm2 } from \"@swf2es/runtime\";\nimport { storeOf } from \"../flash/display/BitmapData.js\";\nimport { unsupported } from \"./lifecycle.js\";\nimport { writeReadback } from \"./readback.js\";\n/** The backend's format for a texture's; the packed and half-float ones are not yet. */\nfunction textureFormat(format) {\n if (format !== \"bgra\" && format !== \"compressed\" && format !== \"compressedAlpha\") {\n unsupported(`the texture format \"${format}\"`);\n }\n return format;\n}\nexport function registerContext(natives, s, bindings) {\n const { contexts, buffers, programs, textures, own, allocate, state, context, requireClear, buffer, program, construct, texture, request, dispose, } = bindings;\n const matrixConstants = new Float32Array(16);\n class ContextNatives {\n get driverInfo() {\n return contexts.has(this) ? \"swf2es experimental WebGL2\" : \"Disposed\";\n }\n get profile() {\n return contexts.get(this)?.profile ?? null;\n }\n get enableErrorChecking() {\n return this.$checking ?? false;\n }\n set enableErrorChecking(value) {\n this.$checking = value;\n }\n get backBufferWidth() {\n return contexts.get(this)?.backend.width ?? 0;\n }\n get backBufferHeight() {\n return contexts.get(this)?.backend.height ?? 0;\n }\n configureBackBuffer(width, height, aa, depth = true, best = false, zoom = false) {\n const entry = state(this);\n const backend = entry.backend;\n if (width < 32) {\n throw s.rt.error(\"Error\", 3780, 32, 2048);\n }\n if (height < 32) {\n throw s.rt.error(\"Error\", 3781, 32, 2048);\n }\n if (best || zoom) {\n unsupported(\"configureBackBuffer's wantsBestResolution or wantsBestResolutionOnBrowserZoom\");\n }\n const changed = width !== backend.width ||\n height !== backend.height ||\n depth !== entry.depth ||\n aa !== entry.aa;\n backend.configure(width, height, depth, aa);\n if (changed) {\n entry.cleared = 0;\n }\n entry.depth = depth;\n entry.aa = aa;\n }\n clear(r = 0, g = 0, b = 0, a = 1, depth = 1, stencil = 0, mask = 0xffffffff) {\n const entry = state(this);\n if (entry.compressedTarget) {\n throw s.rt.error(\"Error\", 3746);\n }\n const backend = entry.backend;\n if (backend.width === 0) {\n throw s.rt.error(\"Error\", 3698);\n }\n if (mask !== 0xffffffff && mask > 7) {\n unsupported(`clear's mask ${mask}`);\n }\n backend.clear(r, g, b, a, depth, mask, stencil);\n // Only successful AS3 clears count, not the backend's allocation-time clear.\n if (entry.target) {\n entry.target.initialized = true;\n }\n else {\n entry.cleared |= mask & (entry.depth ? 7 : 1);\n }\n }\n createVertexBuffer(count, stride, usage = \"staticDraw\") {\n if (usage !== \"staticDraw\" || stride === 0) {\n unsupported(`a vertex buffer of usage \"${usage}\" or 32-bit values per vertex ${stride}`);\n }\n const owner = this;\n const resource = allocate(owner, () => context(owner).createBuffer(count, stride));\n const object = construct(\"VertexBuffer3D\", resource);\n buffers.set(object, own(object, {\n value: resource,\n owner,\n disposed: false,\n reference: new WeakRef(object),\n }));\n return object;\n }\n createIndexBuffer(count, usage = \"staticDraw\") {\n if (usage !== \"staticDraw\") {\n unsupported(`an index buffer of usage \"${usage}\"`);\n }\n const owner = this;\n const resource = allocate(owner, () => context(owner).createBuffer(count, 0));\n const object = construct(\"IndexBuffer3D\", resource);\n buffers.set(object, own(object, {\n value: resource,\n owner,\n disposed: false,\n reference: new WeakRef(object),\n }));\n return object;\n }\n createProgram() {\n const owner = this;\n const resource = allocate(owner, () => context(owner).createProgram());\n const object = construct(\"Program3D\", resource);\n programs.set(object, own(object, {\n value: resource,\n owner,\n disposed: false,\n reference: new WeakRef(object),\n }));\n return object;\n }\n createTexture(width, height, format, _target, levels = 0) {\n const backend = context(this);\n const compressed = textureFormat(format);\n if (levels !== 0) {\n unsupported(`createTexture's streamingLevels ${levels}`);\n }\n const value = allocate(this, () => backend.createTexture(width, height, false, compressed));\n const object = construct(\"Texture\", value, \"flash.display3D.textures\");\n textures.set(object, own(object, {\n value,\n owner: this,\n disposed: false,\n initialized: false,\n reference: new WeakRef(object),\n }));\n return object;\n }\n createRectangleTexture(width, height, format, _target) {\n const backend = context(this);\n if (format === null) {\n throw s.rt.error(\"TypeError\", 2007, \"format\");\n }\n switch (format) {\n case \"bgra\":\n case \"bgraPacked4444\":\n case \"bgrPacked565\":\n case \"compressed\":\n case \"compressedAlpha\":\n case \"rgbaHalfFloat\":\n break;\n default:\n throw s.rt.error(\"ArgumentError\", 2008, \"format\");\n }\n if (width <= 0 || height <= 0) {\n throw s.rt.error(\"ArgumentError\", 3681);\n }\n if (width > 2048 || height > 2048) {\n throw s.rt.error(\"ArgumentError\", 3766);\n }\n if (format === \"compressed\" || format === \"compressedAlpha\") {\n throw s.rt.error(\"ArgumentError\", 3762);\n }\n if (format !== \"bgra\") {\n unsupported(`the rectangle texture format \"${format}\"`);\n }\n const value = allocate(this, () => backend.createRectangleTexture(width, height));\n const object = construct(\"RectangleTexture\", value, \"flash.display3D.textures\");\n textures.set(object, own(object, {\n value,\n owner: this,\n disposed: false,\n initialized: false,\n reference: new WeakRef(object),\n }));\n return object;\n }\n createCubeTexture(size, format, _target, levels = 0) {\n const backend = context(this);\n const compressed = textureFormat(format);\n if (levels !== 0) {\n unsupported(`createCubeTexture's streamingLevels ${levels}`);\n }\n const value = allocate(this, () => backend.createTexture(size, size, true, compressed));\n const object = construct(\"CubeTexture\", value, \"flash.display3D.textures\");\n textures.set(object, own(object, {\n value,\n owner: this,\n disposed: false,\n initialized: false,\n reference: new WeakRef(object),\n }));\n return object;\n }\n setSamplerStateAt(index, wrap, filter, mip) {\n if (wrap === null) {\n throw s.rt.error(\"TypeError\", 2007, \"wrap\");\n }\n if (!SAMPLER_WRAPS.includes(wrap)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"wrap\");\n }\n if (filter === null) {\n throw s.rt.error(\"TypeError\", 2007, \"filter\");\n }\n if (!SAMPLER_FILTERS.includes(filter)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"filter\");\n }\n if (mip === null) {\n throw s.rt.error(\"TypeError\", 2007, \"mipfilter\");\n }\n if (!SAMPLER_MIPS.includes(mip)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"mipfilter\");\n }\n if (index < 0 || index >= 16) {\n throw s.rt.error(\"RangeError\", 2006);\n }\n const backend = contexts.get(this)?.backend;\n if (backend) {\n backend.setSampler(index, wrap, filter, mip);\n }\n }\n setTextureAt(index, object) {\n const entry = state(this);\n if (object && !textures.has(object)) {\n // An AS3-created TextureBase has no native resource and leaves this slot intact.\n const previous = entry.textures[index];\n entry.backend.setTexture(index, previous ? texture(previous) : null);\n return;\n }\n entry.backend.setTexture(index, object && texture(object));\n entry.textures[index] = object;\n }\n setRenderToTexture(object, depth = false, aa = 0, surface = 0, output = 0) {\n if (output !== 0) {\n unsupported(`setRenderToTexture's colorOutputIndex ${output}`);\n }\n const entry = state(this);\n if (object && !textures.has(object)) {\n throw s.rt.error(\"ArgumentError\", 0);\n }\n let value = object && texture(object);\n if (value && (surface < 0 || surface >= (value.cube ? 6 : 1))) {\n throw s.rt.error(\"ArgumentError\", value.cube ? 3772 : 3771);\n }\n if (object && textures.get(object)?.disposed) {\n value = null;\n }\n // AIR takes a compressed texture as the target, and refuses to clear or draw into it.\n entry.compressedTarget = value !== null && value.format !== \"bgra\";\n if (entry.compressedTarget) {\n value = null;\n }\n entry.backend.setRenderTarget(value, depth, surface, aa);\n entry.target = value && object ? (textures.get(object) ?? null) : null;\n entry.targetObject = value ? object : null;\n }\n setRenderToBackBuffer() {\n const entry = state(this);\n entry.compressedTarget = false;\n entry.backend.setRenderTarget(null);\n entry.target = null;\n entry.targetObject = null;\n }\n setProgram(object) {\n const entry = state(this);\n entry.backend.setProgram(program(object));\n entry.program = object;\n }\n setVertexBufferAt(index, object, offset = 0, format = \"float4\") {\n const owner = contexts.get(this);\n const backend = owner?.backend;\n const entry = object && buffers.get(object);\n const live = entry && !entry.disposed && contexts.has(entry.owner);\n if (backend && live) {\n if (format === null) {\n throw s.rt.error(\"TypeError\", 2007, \"format\");\n }\n if (!VERTEX_FORMATS.includes(format)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"format\");\n }\n }\n if (index < 0) {\n throw s.rt.error(\"RangeError\", 2006);\n }\n if (index >= 8) {\n unsupported(`vertex buffer index ${index}`);\n }\n if (!backend) {\n return;\n }\n backend.setVertex(index, live ? entry.value : null, offset, format);\n owner.vertices[index] = live ? object : null;\n }\n setProgramConstantsFromVector(type, first, values, count = -1) {\n if (type !== \"vertex\" && type !== \"fragment\") {\n unsupported(`program constants of type \"${type}\"`);\n }\n const data = values.$a;\n context(this).setConstants(type, first, data, count === -1 ? Math.floor(data.length / 4) : count);\n }\n setProgramConstantsFromMatrix(type, first, matrix, transpose = false) {\n const backend = context(this);\n if (type !== \"vertex\" && type !== \"fragment\") {\n throw s.rt.error(\"ArgumentError\", 2008, \"programType\");\n }\n if (!matrix) {\n throw s.rt.error(\"TypeError\", 2007, \"matrix\");\n }\n if (first < 0) {\n throw s.rt.error(\"RangeError\", 2006);\n }\n const values = matrix.$matrix3D;\n for (let i = 0; i < 16; i++) {\n matrixConstants[i] = values[transpose ? (i % 4) * 4 + Math.floor(i / 4) : i];\n }\n backend.setConstants(type, first, matrixConstants, 4);\n }\n setCulling(face) {\n if (!CULL_FACES.includes(face)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"triangleFaceToCull\");\n }\n // AIR validates enum values but otherwise ignores these setters after disposal.\n contexts.get(this)?.backend.setCulling(face);\n }\n setBlendFactors(source, destination) {\n if (!BLEND_FACTORS.includes(source)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"sourceFactor\");\n }\n if (!BLEND_FACTORS.includes(destination)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"destinationFactor\");\n }\n contexts\n .get(this)\n ?.backend.setBlend(source, destination);\n }\n setColorMask(red, green, blue, alpha) {\n contexts.get(this)?.backend.setColorMask(red, green, blue, alpha);\n }\n setStencilActions(face = \"frontAndBack\", compare = \"always\", pass = \"keep\", depthFail = \"keep\", stencilFail = \"keep\") {\n if (!CULL_FACES.includes(face)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"triangleFace\");\n }\n if (!COMPARE_MODES.includes(compare)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"compareMode\");\n }\n if (!STENCIL_ACTIONS.includes(pass)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"actionOnBothPass\");\n }\n if (!STENCIL_ACTIONS.includes(depthFail)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"actionOnDepthFail\");\n }\n if (!STENCIL_ACTIONS.includes(stencilFail)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"actionOnDepthPassStencilFail\");\n }\n contexts\n .get(this)\n ?.backend.setStencilActions(face, compare, pass, depthFail, stencilFail);\n }\n setStencilReferenceValue(reference, readMask = 255, writeMask = 255) {\n contexts\n .get(this)\n ?.backend.setStencilReference(reference, readMask, writeMask);\n }\n setDepthTest(write, compare) {\n if (!COMPARE_MODES.includes(compare)) {\n throw s.rt.error(\"ArgumentError\", 2008, \"passCompareMode\");\n }\n contexts.get(this)?.backend.setDepth(write, compare);\n }\n setScissorRectangle(rect) {\n const backend = contexts.get(this)?.backend;\n if (!backend) {\n return;\n }\n if (rect === null) {\n backend.setScissor(null);\n return;\n }\n const rt = s.rt;\n backend.setScissor(rt.toNumber(rt.getProperty(rect, rt.publicName(\"x\"))), rt.toNumber(rt.getProperty(rect, rt.publicName(\"y\"))), rt.toNumber(rt.getProperty(rect, rt.publicName(\"width\"))), rt.toNumber(rt.getProperty(rect, rt.publicName(\"height\"))));\n }\n drawTriangles(object, first = 0, count = -1) {\n if (!object) {\n throw s.rt.error(\"TypeError\", 2007, \"indexBuffer\");\n }\n try {\n const entry = state(this);\n if (entry.compressedTarget) {\n throw s.rt.error(\"Error\", 3746);\n }\n if (this.$checking) {\n requireClear(entry);\n }\n entry.backend.draw(buffer(object), first, count);\n }\n catch (error) {\n if (error instanceof VertexOffsetError) {\n throw s.rt.error(\"RangeError\", 3610);\n }\n if (error instanceof ScissorBoundsError) {\n throw s.rt.error(\"Error\", 3706);\n }\n if (error instanceof TextureBindingError) {\n switch (error.reason) {\n case \"feedback\":\n throw s.rt.error(\"Error\", 3604);\n case \"unused\":\n throw s.rt.error(\"Error\", 3697);\n case \"conflicting\":\n throw s.rt.error(\"Error\", 3695);\n case \"unuploaded\":\n throw s.rt.error(\"Error\", 3605);\n case \"mipmaps\":\n throw s.rt.error(\"Error\", 3700);\n case \"rectangleMip\":\n throw s.rt.error(\"Error\", 3755);\n case \"wrap\":\n throw s.rt.error(\"Error\", 3753);\n case \"dimension\":\n throw s.rt.error(\"Error\", 3754);\n case \"missing\":\n throw s.rt.error(\"Error\", 3663);\n case \"format\":\n // AIR's message for it changed at SWF 19.\n throw s.rt.error(\"Error\", s.rt.swfVersion >= 19 ? 3763 : 3606, error.sampler);\n }\n }\n throw error;\n }\n }\n drawToBitmapData(destination) {\n const entry = state(this);\n if (!destination) {\n throw s.rt.error(\"TypeError\", 2007, \"destination\");\n }\n // AIR reads nothing, and checks nothing more, before the back buffer is configured.\n const backend = entry.backend;\n if (backend.width === 0) {\n return;\n }\n requireClear(entry);\n const store = storeOf(s, destination);\n // AIR copies the back buffer's top-left corner to the destination's,\n // as much as both hold, and leaves the rest of the destination alone.\n const width = Math.min(store.width, backend.width);\n const height = Math.min(store.height, backend.height);\n writeReadback(store, backend.read(width, height), width, height, backend.height);\n }\n present() {\n const entry = state(this);\n entry.compressedTarget = false;\n // AIR returns to the back buffer even when the following validation fails.\n if (entry.target) {\n entry.backend.setRenderTarget(null);\n entry.target = null;\n entry.targetObject = null;\n }\n if (this.$checking) {\n requireClear(entry);\n }\n entry.backend.present();\n entry.cleared = 0;\n }\n dispose(recreate = true) {\n const slot = dispose(this);\n if (slot && recreate && !bindings.closed && !s.destroyed) {\n request(slot);\n }\n }\n }\n avm2.registerNativeClass(natives, \"flash.display3D::Context3D\", ContextNatives);\n}\n//# sourceMappingURL=context.js.map","import { Context3DError } from \"@swf2es/context3d\";\nimport { avm2 } from \"@swf2es/runtime\";\nconst ERROR_IDS = {\n disposed: 3694,\n backBuffer: 3698,\n limit: 3691,\n bufferAllocation: 3672,\n textureAllocation: 3684,\n nativeShader: 3613,\n program: 3600,\n indexBuffer: 3601,\n indexData: 3601,\n vertexBinding: 3611,\n vertexStream: 3608,\n vertexData: 3609,\n drawRange: 3603,\n triangleCount: 3602,\n textureSize: 3683,\n compressedSize: 3745,\n textureShape: 3678,\n texturePowerOfTwo: 3682,\n textureUpload: 3679,\n range: 3669,\n operation: 3699,\n unsupported: 3708,\n agalLength: 3615,\n agalMagic: 3616,\n agalVersion: 3617,\n agalStageMarker: 3618,\n agalVertexStage: 3631,\n agalFragmentStage: 3630,\n agalStage: 3619,\n agalTokens: 3629,\n agalOpcode: 3621,\n agalUnusedSource: 3636,\n agalAttributeStage: 3645,\n agalAttributeWrite: 3651,\n agalAttributeIndex: 3658,\n agalConstantWrite: 3652,\n agalConstantIndex: 3659,\n agalTemporaryIndex: 3661,\n agalTemporaryRead: 3647,\n agalTemporaryComponent: 3648,\n agalOutputRead: 3646,\n agalOutputIndex: 3660,\n agalVertexOutput: 3635,\n agalFragmentOutput: 3634,\n agalColorMask: 3701,\n agalVaryingIndex: 3657,\n agalVaryingRead: 3644,\n agalVaryingWrite: 3650,\n agalVaryingMissing: 3632,\n agalVaryingPartial: 3633,\n agalRegister: 3655,\n agalIndirect: 3639,\n agalSourceEncoding: 3643,\n agalDiscard: 3703,\n agalMask: 3653,\n agalReserved: 3654,\n agalSampler: 3668,\n};\n/** The class of each error that is not an Error. */\nconst ERROR_CLASSES = {\n drawRange: \"RangeError\",\n texturePowerOfTwo: \"ArgumentError\",\n compressedSize: \"ArgumentError\",\n};\n/** A backend failure's Flash error: its ID and class. */\nexport function flashError(error) {\n return { id: ERROR_IDS[error.reason], kind: ERROR_CLASSES[error.reason] ?? \"Error\" };\n}\n/** Only known backend failures become Flash errors; programming errors still surface. */\nexport function translateErrors(natives, s) {\n // The SWF sees only Flash's error, its number and no more, as Flash gives it. The console\n // names the call and what it refused, once each, so a report says what to fix.\n const told = new Set();\n const keys = Object.keys(natives);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const native = natives[key](s.rt);\n // Fixed arguments avoid an array allocation in native draw/state calls.\n natives[key] = avm2.plain(function (a, b, c, d, e, f, g, h) {\n try {\n return native.call(this, a, b, c, d, e, f, g, h);\n }\n catch (error) {\n if (error instanceof Context3DError) {\n const { id, kind } = flashError(error);\n const said = `${key}: ${error.message} (Error #${id})`;\n if (!told.has(said)) {\n told.add(said);\n console.warn(`swf2es: ${said}`);\n }\n throw s.rt.error(kind, id);\n }\n throw error;\n }\n });\n }\n}\n//# sourceMappingURL=errors.js.map","import { installContext3D } from \"@swf2es/player/context3d\";\nimport { stage3DCanvasHost } from \"@swf2es/player-hosts/stage3d\";\n/** One load's Stage3D layers, below its transparent display-list canvas. */\nexport class Stage3DSession {\n layer = document.createElement(\"div\");\n slots = new Map();\n host;\n close;\n destroyed = false;\n x = 0;\n y = 0;\n sx = 1;\n sy = 1;\n box;\n isolation;\n constructor(box, scripting, create, changed) {\n this.box = box;\n this.isolation = box.style.isolation;\n this.layer.style.cssText = \"position:absolute;inset:0;pointer-events:none;z-index:0\";\n const host = stage3DCanvasHost(this.layer, create);\n this.host = host;\n try {\n box.append(this.layer);\n // Keep canvases from different overlapping players in separate stacks.\n box.style.isolation = \"isolate\";\n this.close = installContext3D(scripting, {\n create: (slot, lifecycle) => {\n const context = host.create(slot, lifecycle);\n this.slots.set(slot, { x: 0, y: 0, visible: true });\n changed();\n return context;\n },\n place: (slot, x, y, visible) => {\n const position = this.slots.get(slot);\n if (position) {\n position.x = x;\n position.y = y;\n position.visible = visible;\n this.place(slot, position);\n }\n },\n remove: (slot) => {\n host.remove(slot);\n if (this.slots.delete(slot) && !this.destroyed) {\n changed();\n }\n },\n });\n }\n catch (error) {\n this.layer.remove();\n box.style.isolation = this.isolation;\n throw error;\n }\n }\n get active() {\n return this.slots.size !== 0;\n }\n layout(placed, width, height) {\n this.x = placed.x;\n this.y = placed.y;\n this.sx = placed.width / (width || 1);\n this.sy = placed.height / (height || 1);\n // AIR transforms viewport positions with the stage, but keeps configured\n // back-buffer sizes in pixels instead of scaling the entire surface.\n for (let slot = 0; slot < 4; slot++) {\n const position = this.slots.get(slot);\n if (position) {\n this.place(slot, position);\n }\n }\n }\n place(slot, position) {\n this.host.place(slot, this.x + position.x * this.sx, this.y + position.y * this.sy, position.visible);\n }\n destroy() {\n if (this.destroyed) {\n return;\n }\n this.destroyed = true;\n try {\n this.close();\n }\n finally {\n this.layer.remove();\n this.box.style.isolation = this.isolation;\n }\n }\n}\n//# sourceMappingURL=stage3d.js.map","/** The caller supplies a positioned, clipped parent, with the display-list canvas\n * above slots 0..3. The adapter disposes resources before removing a surface. */\nexport function stage3DCanvasHost(parent, create) {\n const surfaces = new Map();\n return {\n create(slot, lifecycle) {\n if (surfaces.has(slot)) {\n throw new Error(\"Stage3D surface must be removed before recreation\");\n }\n const surface = create(slot);\n const detach = observeLoss(surface.canvas, lifecycle);\n try {\n surface.canvas.style.position = \"absolute\";\n surface.canvas.style.zIndex = String(slot);\n parent.append(surface.canvas);\n surfaces.set(slot, { ...surface, detach });\n }\n catch (error) {\n detach();\n surface.context.dispose();\n surface.canvas.remove();\n surface.destroy?.();\n throw error;\n }\n return surface.context;\n },\n place(slot, x, y, visible) {\n const surface = surfaces.get(slot);\n if (surface) {\n const style = surface.canvas.style;\n style.left = `${x}px`;\n style.top = `${y}px`;\n style.visibility = visible ? \"visible\" : \"hidden\";\n }\n },\n remove(slot) {\n const surface = surfaces.get(slot);\n if (surface) {\n surface.detach();\n surface.canvas.remove();\n surfaces.delete(slot);\n surface.destroy?.();\n }\n },\n };\n}\n/** The surface outlives its lost resources so the browser can signal recovery. */\nexport function observeLoss(canvas, lifecycle) {\n const lost = (event) => {\n event.preventDefault();\n lifecycle.lost();\n };\n const restored = () => lifecycle.restored();\n canvas.addEventListener(\"webglcontextlost\", lost);\n canvas.addEventListener(\"webglcontextrestored\", restored);\n return () => {\n canvas.removeEventListener(\"webglcontextlost\", lost);\n canvas.removeEventListener(\"webglcontextrestored\", restored);\n };\n}\n//# sourceMappingURL=stage3d.js.map","import { avm2 } from \"@swf2es/runtime\";\nimport { registerContext } from \"./context3d/context.js\";\nimport { translateErrors } from \"./context3d/errors.js\";\nimport { createBindings } from \"./context3d/lifecycle.js\";\nimport { registerResources } from \"./context3d/resources.js\";\n/** Returns the host teardown; it also cancels creation queued before teardown. */\nexport function installContext3D(s, host) {\n const natives = {};\n const bindings = createBindings(s, host);\n const { slots, place, request, unavailable } = bindings;\n // The profiles the backend serves, best first: baselineConstrained asks for less of it than\n // baseline does, and is Starling 1.x's default.\n const served = [\"baseline\", \"baselineConstrained\"];\n const profileName = (value) => {\n switch (value) {\n case null:\n return \"baseline\";\n case \"baseline\":\n case \"baselineConstrained\":\n case \"baselineExtended\":\n case \"standardConstrained\":\n case \"standard\":\n case \"standardExtended\":\n return value;\n default:\n throw s.rt.error(\"ArgumentError\", 2008, \"profile\");\n }\n };\n class StageNatives {\n get context3D() {\n return slots.get(this) ?? null;\n }\n requestContext3D(mode = \"auto\", profile = \"baseline\") {\n const slot = this;\n if (mode === null) {\n throw s.rt.error(\"TypeError\", 2007, \"context3DRenderMode\");\n }\n if (mode !== \"auto\" && mode !== \"software\") {\n throw s.rt.error(\"ArgumentError\", 2008, \"context3DRenderMode\");\n }\n const selected = profileName(profile);\n if (bindings.closed) {\n throw s.rt.error(\"Error\", 3694);\n }\n if (mode !== \"auto\" || !served.includes(selected)) {\n unavailable(slot);\n return;\n }\n request(slot, selected);\n }\n requestContext3DMatchingProfiles(profiles) {\n if (!profiles) {\n throw s.rt.error(\"ArgumentError\", 1508, \"profiles\");\n }\n const values = profiles.$a;\n if (!values.length) {\n throw s.rt.error(\"ArgumentError\", 2008, \"profiles\");\n }\n const asked = new Set();\n for (let i = 0; i < values.length; i++) {\n asked.add(profileName(values[i]));\n }\n if (bindings.closed) {\n throw s.rt.error(\"Error\", 3694);\n }\n // The best of them the backend serves, as Flash takes the best its device has.\n const best = served.find((p) => asked.has(p));\n if (best) {\n request(this, best);\n }\n else {\n unavailable(this);\n }\n }\n }\n avm2.registerNativeClass(natives, \"flash.display::Stage3D\", StageNatives);\n registerContext(natives, s, bindings);\n registerResources(natives, s, bindings);\n // Keep the existing Flash-tested position validation and property storage.\n for (const property of [\"x\", \"y\", \"visible\"]) {\n const key = `flash.display::Stage3D#set:${property}`;\n const original = s.rt.natives[key];\n natives[key] = (rt) => {\n const setter = original(rt);\n return function (value) {\n setter.call(this, value);\n place(this);\n };\n };\n }\n translateErrors(natives, s);\n Object.assign(s.rt.natives, natives);\n return bindings.close;\n}\n//# sourceMappingURL=context3d.js.map","/**\n * drawToBitmapData's copy, as AIR makes it: `rgba`, the back buffer's\n * top-left `width` by `height`, top-down raw RGBA, written into the store's\n * top-left corner, the rest of the store left as it was. `backHeight` is the\n * back buffer's height.\n *\n * AIR raises alpha to the largest channel, which makes the pixel\n * premultiplied without multiplying RGB (that would darken textures twice),\n * but only over the back buffer's height of rows counted up from the\n * destination's bottom: it fixes alpha up in a bottom-up layout aligned to\n * the destination's last row. A destination taller than the back buffer\n * keeps the raw alpha in the rows above those, with or without\n * antialiasing. An opaque store keeps it as it is, as erase leaves alpha in\n * one (`holdsAlpha`). A transparent store's pixels must stay premultiplied,\n * so there each channel is clamped to alpha: AIR's getPixel32 lets a channel\n * above alpha spill into the one above (`8001fc00` for green 255 over alpha\n * 128), where ours reads `8000ff00`.\n */\nexport function writeReadback(store, rgba, width, height, backHeight) {\n const pixels = store.pixels;\n const raw = store.height - backHeight;\n const transparent = store.transparent;\n const whole = width === store.width && height === store.height;\n // Whether alpha below 255 is looked for: an opaque store holds alpha once\n // it has any, until a copy rewrites all of it at 255.\n const track = !transparent && (whole || !store.holdsAlpha);\n let opaque = true;\n for (let y = 0; y < height; y++) {\n const keep = y < raw;\n const row = y * store.width;\n for (let x = 0, at = y * width * 4; x < width; x++, at += 4) {\n let r = rgba[at];\n let g = rgba[at + 1];\n let b = rgba[at + 2];\n let alpha = rgba[at + 3];\n if (!keep) {\n alpha = Math.max(r, g, b, alpha);\n }\n else if (transparent) {\n r = Math.min(r, alpha);\n g = Math.min(g, alpha);\n b = Math.min(b, alpha);\n }\n pixels[row + x] = (alpha << 24) | (r << 16) | (g << 8) | b;\n if (track && alpha !== 255) {\n opaque = false;\n }\n }\n }\n // Where it tracked a part of the store, the store held no alpha before.\n if (track) {\n store.holdsAlpha = !opaque;\n }\n store.changed();\n}\n//# sourceMappingURL=readback.js.map","import { blockBytes, Context3DError, SamplerBiasError } from \"@swf2es/context3d\";\nimport { AtfError, atfKind, decodeAtf, readAtfHeader, } from \"@swf2es/native/atf\";\nimport { avm2 } from \"@swf2es/runtime\";\nimport { dispatchEvent } from \"../../scripting/events.js\";\nimport { storeOf } from \"../flash/display/BitmapData.js\";\nimport { flashError } from \"./errors.js\";\nexport function registerResources(natives, s, bindings) {\n const { buffers, programs, textures, contexts, disposeResource, context, buffer, program, texture, bytes, } = bindings;\n class BufferNatives {\n uploadFromByteArray(data, offset, start, count) {\n if (!data) {\n throw s.rt.error(\"TypeError\", 2007, \"data\");\n }\n const entry = buffers.get(this);\n if (!entry) {\n throw s.rt.error(\"Error\", 3694);\n }\n // Unlike vector uploads, AIR ignores byte uploads after explicit disposal.\n if (entry.disposed) {\n return;\n }\n context(entry.owner);\n const storage = avm2.bytesOf(s.rt, data);\n const value = entry.value;\n const length = count * (value.stride === 0 ? 2 : value.stride * 4);\n if (offset < 0 ||\n offset >= storage.length ||\n start < 0 ||\n count < 0 ||\n start > value.count - count ||\n length > storage.length - offset) {\n throw s.rt.error(\"RangeError\", 3669);\n }\n value.uploadBytes(storage.buffer, offset, start, count);\n }\n uploadFromVector(values, start, count) {\n buffer(this).upload(values.$a, start, count);\n }\n dispose() {\n const object = this;\n disposeResource(object, buffers.get(object));\n }\n }\n class ProgramNatives {\n upload(vertex, fragment) {\n try {\n program(this).upload(bytes(vertex), bytes(fragment));\n }\n catch (error) {\n if (error instanceof SamplerBiasError) {\n throw s.rt.error(\"Error\", 3696);\n }\n throw error;\n }\n }\n dispose() {\n const object = this;\n disposeResource(object, programs.get(object));\n }\n }\n function uploadTexture(object, source, level, face) {\n const value = texture(object);\n // AIR accepts this call after explicit texture disposal without reviving\n // the resource. A disposed owner context is still rejected above.\n if (textures.get(object)?.disposed) {\n return;\n }\n if (face >= (value.cube ? 6 : 1)) {\n throw s.rt.error(\"ArgumentError\", 3673);\n }\n if (level >= value.levels) {\n throw s.rt.error(\"ArgumentError\", 3674);\n }\n if (!source) {\n throw s.rt.error(\"TypeError\", 2007, \"source\");\n }\n const bitmap = storeOf(s, source);\n value.upload(bitmap.readable, level, face, bitmap.width, bitmap.height);\n const entry = textures.get(object);\n if (entry && level === 0 && !value.cube) {\n entry.initialized = true;\n }\n }\n function uploadTextureBytes(object, data, offset, level, face) {\n if (!data) {\n throw s.rt.error(\"TypeError\", 2007, \"data\");\n }\n // Unlike bitmap uploads, explicit disposal wins over owner disposal.\n if (textures.get(object)?.disposed) {\n return;\n }\n const value = texture(object);\n if (face >= (value.cube ? 6 : 1)) {\n throw s.rt.error(\"ArgumentError\", 3673);\n }\n if (level >= value.levels) {\n throw s.rt.error(\"ArgumentError\", 3674);\n }\n const storage = avm2.bytesOf(s.rt, data);\n const length = Math.max(1, value.width >> level) * Math.max(1, value.height >> level) * 4;\n if (offset > storage.length - length) {\n throw s.rt.error(\"RangeError\", 3669);\n }\n value.uploadBytes(storage.buffer, offset, level, face);\n const entry = textures.get(object);\n if (entry && level === 0 && !value.cube) {\n entry.initialized = true;\n }\n }\n /** AIR's errors for an ATF it refuses, their classes, and an ErrorEvent's whole text. */\n const ATF_IDS = { size: 3669, decode: 3677, format: 3675 };\n const ATF_ERRORS = {\n 3669: \"RangeError\",\n 3675: \"ArgumentError\",\n 3677: \"ArgumentError\",\n 3679: \"ArgumentError\",\n };\n /**\n * The ATF's levels uploaded to `value`, checked as AIR checks them after\n * its header: a format AIR knows (#3677), the texture's (#3675), levels\n * that decode (#3677), then the texture's size (#3679). 0 where it is\n * uploaded, else the error's ID, and nothing uploaded.\n */\n function applyAtf(object, value, data, header) {\n // AIR reads the new header and CompressedAlpha for content from SWF 17,\n // and version 3, with ETC2's blocks, from SWF 29: before, they are corrupt.\n const kind = atfKind(header.format);\n const swf = s.rt.swfVersion;\n if (kind === undefined ||\n (swf < 17 && (!header.old || kind === \"compressedAlpha\")) ||\n (swf < 29 && header.version >= 3)) {\n return ATF_IDS.decode;\n }\n if (kind !== value.format || header.cube !== value.cube) {\n return ATF_IDS.format;\n }\n let images;\n try {\n images = decodeAtf(data, header);\n }\n catch (error) {\n if (error instanceof AtfError) {\n return ATF_IDS[error.reason];\n }\n throw error;\n }\n if (header.width !== value.width || header.height !== value.height) {\n return 3679;\n }\n // Every level is checked before any goes up, so that an upload is whole or\n // nothing, as AIR's is. Then the backend cannot refuse one: it checks only\n // these ranges and lengths, and its context, which nothing here changes;\n // WebGL reports its own failures by getError, not by throwing, and a\n // context lost meanwhile takes calls as no-ops.\n for (const image of images) {\n const face = value.cube ? image.face ^ 1 : 0;\n const width = Math.max(1, value.width >> image.level);\n const height = Math.max(1, value.height >> image.level);\n const length = kind === \"bgra\"\n ? width * height * 4\n : blockBytes(width, height, kind === \"compressedAlpha\");\n if (image.level >= value.levels ||\n face >= (value.cube ? 6 : 1) ||\n image.width !== width ||\n image.height !== height ||\n image.bytes.length !== length) {\n return ATF_IDS.decode;\n }\n }\n for (const image of images) {\n // ATF's faces go -X, +X, -Y, +Y, -Z, +Z; CubeTexture's sides +X, -X, and so on.\n const face = value.cube ? image.face ^ 1 : 0;\n if (kind === \"bgra\") {\n value.uploadBytes(image.bytes, 0, image.level, face);\n }\n else {\n value.uploadCompressed(image.bytes, image.level, face);\n }\n }\n const entry = textures.get(object);\n if (entry && !value.cube && images.some((image) => image.level === 0)) {\n entry.initialized = true;\n }\n return 0;\n }\n /**\n * uploadCompressedTextureFromByteArray. AIR checks the signature and the\n * length before returning, even for an asynchronous upload; the rest of\n * an asynchronous one it reports as an ErrorEvent on the texture, or\n * textureReady once it is uploaded, at the next frame before its\n * enterFrame. The bytes are read when it is called.\n */\n function uploadAtf(object, data, offset, async) {\n if (!data) {\n throw s.rt.error(\"TypeError\", 2007, \"data\");\n }\n // As for byte uploads, explicit disposal wins over the owner's.\n if (textures.get(object)?.disposed) {\n return;\n }\n const value = texture(object);\n const storage = avm2.bytesOf(s.rt, data);\n const bytes = storage.buffer.subarray(0, storage.length);\n let header;\n try {\n header = readAtfHeader(bytes, offset);\n }\n catch (error) {\n if (error instanceof AtfError) {\n throw s.rt.error(ATF_ERRORS[ATF_IDS[error.reason]], ATF_IDS[error.reason]);\n }\n throw error;\n }\n if (!async) {\n const id = applyAtf(object, value, bytes, header);\n if (id) {\n throw s.rt.error(ATF_ERRORS[id], id);\n }\n return;\n }\n // AIR reads on past the length, as far as the data goes.\n const copy = bytes.slice(offset);\n s.loads.deferHostEvent(() => {\n // A texture whose context is gone hears nothing; one disposed meanwhile, #3677, as in AIR.\n const entry = textures.get(object);\n if (!entry || !contexts.has(entry.owner) || s.destroyed) {\n return;\n }\n let id = ATF_IDS.decode;\n try {\n id = entry.disposed ? id : applyAtf(object, value, copy, readAtfHeader(copy, 0));\n }\n catch (error) {\n // The backend's own failure, which a synchronous upload throws translated, as an event.\n if (!(error instanceof Context3DError)) {\n throw error;\n }\n id = flashError(error).id;\n }\n const event = id\n ? s.rt.construct(s.rt.classNamed(\"flash.events::ErrorEvent\"), \"error\", false, false, \n // AIR's whole message, in debugger players and release ones alike.\n `Error #${id}: ${avm2.errorMessages[id] ?? \"\"}`, id)\n : s.event(\"textureReady\");\n dispatchEvent(s, object, event);\n });\n }\n class TextureNatives {\n uploadCompressedTextureFromByteArray(data, offset, async = false) {\n uploadAtf(this, data, offset, async);\n }\n uploadFromByteArray(data, offset, level = 0) {\n uploadTextureBytes(this, data, offset, level, 0);\n }\n uploadFromBitmapData(source, level = 0) {\n uploadTexture(this, source, level, 0);\n }\n }\n class RectangleTextureNatives {\n uploadFromByteArray(data, offset) {\n uploadTextureBytes(this, data, offset, 0, 0);\n }\n uploadFromBitmapData(source) {\n if (!source) {\n throw s.rt.error(\"TypeError\", 2007, \"source\");\n }\n if (textures.get(this)?.disposed) {\n return;\n }\n uploadTexture(this, source, 0, 0);\n }\n }\n class CubeTextureNatives {\n uploadCompressedTextureFromByteArray(data, offset, async = false) {\n uploadAtf(this, data, offset, async);\n }\n uploadFromByteArray(data, offset, face, level = 0) {\n uploadTextureBytes(this, data, offset, level, face);\n }\n uploadFromBitmapData(source, face, level = 0) {\n uploadTexture(this, source, level, face);\n }\n }\n class TextureBaseNatives {\n dispose() {\n const object = this;\n disposeResource(object, textures.get(object));\n }\n }\n avm2.registerNativeClass(natives, \"flash.display3D::VertexBuffer3D\", BufferNatives);\n avm2.registerNativeClass(natives, \"flash.display3D::IndexBuffer3D\", BufferNatives);\n avm2.registerNativeClass(natives, \"flash.display3D::Program3D\", ProgramNatives);\n avm2.registerNativeClass(natives, \"flash.display3D.textures::Texture\", TextureNatives);\n avm2.registerNativeClass(natives, \"flash.display3D.textures::CubeTexture\", CubeTextureNatives);\n avm2.registerNativeClass(natives, \"flash.display3D.textures::RectangleTexture\", RectangleTextureNatives);\n avm2.registerNativeClass(natives, \"flash.display3D.textures::TextureBase\", TextureBaseNatives);\n}\n//# sourceMappingURL=resources.js.map"],"names":["Error","Int32Array","Uint8Array","e","document","Map","String","WeakMap","WeakSet","FinalizationRegistry","r","t","queueMicrotask","Array","Set","Float32Array","c","a","o","WeakRef","l","Math","s","A","Object","console"],"mappings":"6HAAO,IAAM,EAAgB,CACzB,SAC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